summaryrefslogtreecommitdiff
path: root/src/drivers/Cst816s.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-09-26 15:09:24 (GMT)
committerGitea <gitea@fake.local>2020-09-26 15:09:24 (GMT)
commitb6a910e52ed98b662e6586f45cfe9c6997f8f158 (patch)
treed74185cbf682cde40e5de5bfa2f620ae201565a9 /src/drivers/Cst816s.cpp
parentbe05997272b7b1d1b25b122c8162ac6f4c1c12a2 (diff)
parent3e612e79ba82bac69258094d468c996c41b29612 (diff)
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/drivers/Cst816s.cpp')
-rw-r--r--src/drivers/Cst816s.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp
index 60cd402..f681654 100644
--- a/src/drivers/Cst816s.cpp
+++ b/src/drivers/Cst816s.cpp
@@ -2,7 +2,6 @@
#include <task.h>
#include <nrfx_log.h>
#include <legacy/nrf_drv_gpiote.h>
-
#include "Cst816s.h"
using namespace Pinetime::Drivers;
@@ -60,9 +59,9 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
uint16_t y = (yHigh << 8) | yLow;
auto action = touchData[touchEventIndex + (touchStep * i)] >> 6; /* 0 = Down, 1 = Up, 2 = contact*/
- auto finger = touchData[touchIdIndex + (touchStep * i)] >> 4;
- auto pressure = touchData[touchXYIndex + (touchStep * i)];
- auto area = touchData[touchMiscIndex + (touchStep * i)] >> 4;
+ //auto finger = touchData[touchIdIndex + (touchStep * i)] >> 4;
+ //auto pressure = touchData[touchXYIndex + (touchStep * i)];
+ //auto area = touchData[touchMiscIndex + (touchStep * i)] >> 4;
info.x = x;
info.y = y;
@@ -89,7 +88,6 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
// case Gestures::LongPress: NRF_LOG_INFO("Gesture : Long press"); break;
// default : NRF_LOG_INFO("Unknown"); break;
// }
-
}
@@ -97,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