Re-implement sleep/wakeup for touch panel, display, NOR Flash, SPI and TWI.

This commit is contained in:
JF
2020-08-22 17:59:59 +02:00
parent ecbbeb6283
commit f7e40b1b58
11 changed files with 80 additions and 24 deletions

View File

@@ -2,7 +2,6 @@
#include <task.h>
#include <nrfx_log.h>
#include <legacy/nrf_drv_gpiote.h>
#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");
}