LowPowerLab/SPIFlash — pull request #1 by wilsynet (2014-06-27 22:39:39+00:00)
Title: Fixes for wakeup() and writeBytes().

Change writeBytes() len parameter from uint8_t to uint16_t because writing 256 bytes is a valid number of bytes to write, but overflows for uint8_t type.

Change unselect() to add optional parameter us (microseconds) so that the system will wait us amount of time before returning. For example, this is useful when waking up from sleep, because the WINBOND spec sheet says the chip takes 3 us to return to operational state.

Change command() function so that waiting for the flash chip to become not busy is optional (busyWait default is true). This is important for the wakeup function because the WINBOND flash chip does not accept any other commands than 0xAB when in sleep state (including read status).

Define SPIFLASH_T_RES_1_US to reflect 3 microseconds as per WINBOND spec sheet. Use this when adding delay for unselect() function.

Modify wakeup() method to use new unselect() us parameter, and use command() method with isWrite = false and busyWait = false. Without these options, wakeup() hangs.