Update SPIFlash.cpp

Closes #26, Closes #27
This commit is contained in:
Felix Rusu 2021-06-07 16:44:39 -04:00
parent 6423a585c4
commit 9031099cdf
1 changed files with 9 additions and 0 deletions

View File

@ -292,11 +292,20 @@ void SPIFlash::blockErase64K(uint32_t addr) {
unselect(); unselect();
} }
/// Put flash memory chip into power down mode
/// WARNING: after this command, only the wake and device_id commands are recognized
/// hence a wakeup() command should be invoked first before further operations
/// If a MCU soft restart is possible with flash chip left in sleep(), then a wakeup() command
/// should always be invoked before any other commands to ensure the flash chip was not left in sleep
void SPIFlash::sleep() { void SPIFlash::sleep() {
command(SPIFLASH_SLEEP); command(SPIFLASH_SLEEP);
unselect(); unselect();
} }
/// Wake flash memory from power down mode
/// NOTE: this command is required after a sleep() command is used, or no other commands will be recognized
/// If a MCU soft restart is possible with flash chip left in sleep(), then a wakeup() command
/// should always be invoked before any other commands to ensure the flash chip was not left in sleep
void SPIFlash::wakeup() { void SPIFlash::wakeup() {
command(SPIFLASH_WAKE); command(SPIFLASH_WAKE);
unselect(); unselect();