From f7e40b1b5879242b4ce59854dbbadb44fe5f75e4 Mon Sep 17 00:00:00 2001 From: JF Date: Sat, 22 Aug 2020 17:59:59 +0200 Subject: Re-implement sleep/wakeup for touch panel, display, NOR Flash, SPI and TWI. --- src/drivers/Cst816s.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/drivers/Cst816s.cpp') diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp index 6afbf734..f6816545 100644 --- a/src/drivers/Cst816s.cpp +++ b/src/drivers/Cst816s.cpp @@ -2,7 +2,6 @@ #include #include #include - #include "Cst816s.h" using namespace Pinetime::Drivers; @@ -96,12 +95,16 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() { } void Cst816S::Sleep() { - // TODO re enable sleep mode - //twiMaster.Sleep(); - nrf_gpio_cfg_default(6); - nrf_gpio_cfg_default(7); + nrf_gpio_pin_clear(pinReset); + vTaskDelay(5); + nrf_gpio_pin_set(pinReset); + vTaskDelay(50); + static constexpr uint8_t sleepValue = 0x03; + twiMaster.Write(twiAddress, 0xA5, &sleepValue, 1); + NRF_LOG_INFO("[TOUCHPANEL] Sleep"); } void Cst816S::Wakeup() { Init(); + NRF_LOG_INFO("[TOUCHPANEL] Wakeup"); } \ No newline at end of file -- cgit v1.2.3