From 4c0f897953aa8d478f3c941e75d3b2eb5611531d Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 7 May 2023 18:24:34 +0200 Subject: Power optimization - Improve SPI sleep mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure that all pins are set to their default configuration during sleep mode. Disable the workaround for FTPAN58 (SPI freezes when transfering a single byte) at the end of the transfer. This disables the resources needed for the workaround. Those changes reduce the power usage by 430-490µA. --- src/drivers/St7789.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/drivers/St7789.cpp') diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index cfd5bd2c..ed98c06d 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -187,10 +187,13 @@ void St7789::HardwareReset() { void St7789::Sleep() { SleepIn(); nrf_gpio_cfg_default(pinDataCommand); + nrf_gpio_cfg_default(26); + spi.Sleep(); NRF_LOG_INFO("[LCD] Sleep"); } void St7789::Wakeup() { + spi.Wakeup(); nrf_gpio_cfg_output(pinDataCommand); SleepOut(); VerticalScrollStartAddress(verticalScrollingStartAddress); -- cgit v1.2.3-70-g09d2