From 9bd90c906e0c738836976cad5328bfae36393e7e Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Thu, 18 May 2023 15:19:44 +0200 Subject: Power optimization - Improve SPI sleep mode ST7789 driver : replace the constant '26' with a named constant to specify the pin number of the reset pin of the LCD controller. --- src/drivers/St7789.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/drivers/St7789.cpp') diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index e18c43a3..7855bc31 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -6,13 +6,13 @@ using namespace Pinetime::Drivers; -St7789::St7789(Spi& spi, uint8_t pinDataCommand) : spi {spi}, pinDataCommand {pinDataCommand} { +St7789::St7789(Spi& spi, uint8_t pinDataCommand, uint8_t pinReset) : spi {spi}, pinDataCommand {pinDataCommand}, pinReset{pinReset} { } void St7789::Init() { nrf_gpio_cfg_output(pinDataCommand); - nrf_gpio_cfg_output(26); - nrf_gpio_pin_set(26); + nrf_gpio_cfg_output(pinReset); + nrf_gpio_pin_set(pinReset); HardwareReset(); SoftwareReset(); SleepOut(); @@ -178,15 +178,15 @@ void St7789::DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, } void St7789::HardwareReset() { - nrf_gpio_pin_clear(26); + nrf_gpio_pin_clear(pinReset); nrf_delay_ms(10); - nrf_gpio_pin_set(26); + nrf_gpio_pin_set(pinReset); } void St7789::Sleep() { SleepIn(); nrf_gpio_cfg_default(pinDataCommand); - nrf_gpio_cfg_default(26); + nrf_gpio_cfg_default(pinReset); NRF_LOG_INFO("[LCD] Sleep"); } -- cgit v1.2.3-70-g09d2