static bool begin(); | static bool begin(); | ||||
static uint32_t capacity(const uint8_t *id); | static uint32_t capacity(const uint8_t *id); | ||||
static uint32_t blockSize(); | static uint32_t blockSize(); | ||||
static void sleep(); | |||||
static void wakeup(); | |||||
static void readID(uint8_t *buf); | static void readID(uint8_t *buf); | ||||
static void read(uint32_t addr, void *buf, uint32_t len); | static void read(uint32_t addr, void *buf, uint32_t len); | ||||
static bool ready(); | static bool ready(); |
return true; | 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) | void SerialFlashChip::readID(uint8_t *buf) | ||||
{ | { | ||||
if (busy) wait(); | if (busy) wait(); |