diff options
| author | Jean-François Milants <jf@codingfield.com> | 2023-05-18 15:18:56 +0200 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2023-06-04 17:22:27 +0200 |
| commit | 62848b33fb3df756fea17f31c818cd6de7a85b34 (patch) | |
| tree | fa4b778d7b965fdc3b633e05a63b6753b741e78d /src/drivers/SpiNorFlash.cpp | |
| parent | 4c0f897953aa8d478f3c941e75d3b2eb5611531d (diff) | |
Power optimization - Improve SPI sleep mode
Calls to Spi::Init() are not needed, pin initialization is already done in ctor().
Remove calls to Spi::Sleep()/Spi::Wakeup() to ensure that SPI CS pins are kept high even in sleep mode.
Diffstat (limited to 'src/drivers/SpiNorFlash.cpp')
| -rw-r--r-- | src/drivers/SpiNorFlash.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/src/drivers/SpiNorFlash.cpp b/src/drivers/SpiNorFlash.cpp index 525b812c..28f82fe6 100644 --- a/src/drivers/SpiNorFlash.cpp +++ b/src/drivers/SpiNorFlash.cpp @@ -10,7 +10,6 @@ SpiNorFlash::SpiNorFlash(Spi& spi) : spi {spi} { } void SpiNorFlash::Init() { - spi.Init(); device_id = ReadIdentificaion(); NRF_LOG_INFO("[SpiNorFlash] Manufacturer : %d, Memory type : %d, memory density : %d", device_id.manufacturer, @@ -24,12 +23,10 @@ void SpiNorFlash::Uninit() { void SpiNorFlash::Sleep() { auto cmd = static_cast<uint8_t>(Commands::DeepPowerDown); spi.Write(&cmd, sizeof(uint8_t)); - spi.Sleep(); NRF_LOG_INFO("[SpiNorFlash] Sleep") } void SpiNorFlash::Wakeup() { - spi.Wakeup(); // send Commands::ReleaseFromDeepPowerDown then 3 dummy bytes before reading Device ID static constexpr uint8_t cmdSize = 4; uint8_t cmd[cmdSize] = {static_cast<uint8_t>(Commands::ReleaseFromDeepPowerDown), 0x01, 0x02, 0x03}; |
