diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h index a70cfc41..238b965d 100644 --- a/src/drivers/PinMap.h +++ b/src/drivers/PinMap.h @@ -34,6 +34,7 @@ namespace Pinetime { static constexpr uint8_t SpiFlashCsn = 5; static constexpr uint8_t SpiLcdCsn = 25; static constexpr uint8_t LcdDataCommand = 18; + static constexpr uint8_t LcdReset = 26; static constexpr uint8_t TwiScl = 7; static constexpr uint8_t TwiSda = 6; 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"); } diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 8a1bdfca..68e1da44 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -8,7 +8,7 @@ namespace Pinetime { class St7789 { public: - explicit St7789(Spi& spi, uint8_t pinDataCommand); + explicit St7789(Spi& spi, uint8_t pinDataCommand, uint8_t pinReset); St7789(const St7789&) = delete; St7789& operator=(const St7789&) = delete; St7789(St7789&&) = delete; @@ -29,6 +29,7 @@ namespace Pinetime { private: Spi& spi; uint8_t pinDataCommand; + uint8_t pinReset; uint8_t verticalScrollingStartAddress = 0; void HardwareReset(); diff --git a/src/main.cpp b/src/main.cpp index 9c13a169..ee6a6d3d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,7 +68,7 @@ Pinetime::Drivers::SpiMaster spi {Pinetime::Drivers::SpiMaster::SpiModule::SPI0, Pinetime::PinMap::SpiMiso}}; Pinetime::Drivers::Spi lcdSpi {spi, Pinetime::PinMap::SpiLcdCsn}; -Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; +Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand, Pinetime::PinMap::LcdReset}; Pinetime::Drivers::Spi flashSpi {spi, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi};