@@ -39,6 +39,8 @@ public: | |||
static bool begin(); | |||
static uint32_t capacity(const uint8_t *id); | |||
static uint32_t blockSize(); | |||
static void sleep(); | |||
static void wakeup(); | |||
static void readID(uint8_t *buf); | |||
static void read(uint32_t addr, void *buf, uint32_t len); | |||
static bool ready(); |
@@ -383,6 +383,23 @@ bool SerialFlashChip::begin() | |||
return true; | |||
} | |||
void SerialFlashChip::sleep() | |||
{ | |||
if (busy) wait(); | |||
SPI.beginTransaction(SPICONFIG); | |||
CSASSERT(); | |||
SPI.transfer(0xB9); // Deep power down command | |||
CSRELEASE(); | |||
} | |||
void SerialFlashChip::wakeup() | |||
{ | |||
SPI.beginTransaction(SPICONFIG); | |||
CSASSERT(); | |||
SPI.transfer(0xAB); // Wake up from deep power down command | |||
CSRELEASE(); | |||
} | |||
void SerialFlashChip::readID(uint8_t *buf) | |||
{ | |||
if (busy) wait(); |