Update
This commit is contained in:
parent
329482f873
commit
3e42297bd8
|
@ -21,7 +21,7 @@ namespace Pinetime {
|
||||||
uint16_t y = 0;
|
uint16_t y = 0;
|
||||||
Gestures gesture = Gestures::None;
|
Gestures gesture = Gestures::None;
|
||||||
bool touching = false;
|
bool touching = false;
|
||||||
bool isValid = false;
|
bool isValid = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Cst816S(TwiMaster& twiMaster, uint8_t twiAddress);
|
Cst816S(TwiMaster& twiMaster, uint8_t twiAddress);
|
||||||
|
|
|
@ -315,9 +315,6 @@ int main(void) {
|
||||||
|
|
||||||
systemTask.Start();
|
systemTask.Start();
|
||||||
|
|
||||||
touchHandler.Register(&systemTask);
|
|
||||||
touchHandler.Start();
|
|
||||||
|
|
||||||
nimble_port_init();
|
nimble_port_init();
|
||||||
|
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -144,6 +144,9 @@ void SystemTask::Work() {
|
||||||
heartRateSensor.Disable();
|
heartRateSensor.Disable();
|
||||||
heartRateApp.Start();
|
heartRateApp.Start();
|
||||||
|
|
||||||
|
touchHandler.Register(this);
|
||||||
|
touchHandler.Start();
|
||||||
|
|
||||||
nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_High);
|
nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_High);
|
||||||
nrf_gpio_cfg_output(15);
|
nrf_gpio_cfg_output(15);
|
||||||
nrf_gpio_pin_set(15);
|
nrf_gpio_pin_set(15);
|
||||||
|
|
|
@ -30,25 +30,26 @@ void TouchHandler::Process(void* instance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchHandler::Work() {
|
void TouchHandler::Work() {
|
||||||
Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
|
bool slideReleased = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
vTaskSuspend(taskHandle);
|
vTaskSuspend(taskHandle);
|
||||||
|
|
||||||
info = touchPanel.GetTouchInfo();
|
info = touchPanel.GetTouchInfo();
|
||||||
|
|
||||||
|
if (info.isValid) {
|
||||||
if (info.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
|
if (info.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
|
||||||
if (prevGesture != info.gesture) {
|
if (slideReleased) {
|
||||||
if (info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideDown || info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideLeft ||
|
if (info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideDown ||
|
||||||
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideUp || info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideRight) {
|
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideLeft ||
|
||||||
prevGesture = info.gesture;
|
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideUp ||
|
||||||
|
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideRight) {
|
||||||
|
slideReleased = false;
|
||||||
}
|
}
|
||||||
gesture = info.gesture;
|
gesture = info.gesture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systemTask->IsSleeping()) {
|
if (!systemTask->IsSleeping()) {
|
||||||
systemTask->PushMessage(System::Messages::TouchWakeUp);
|
|
||||||
} else {
|
|
||||||
if (info.touching) {
|
if (info.touching) {
|
||||||
if (!isCancelled) {
|
if (!isCancelled) {
|
||||||
lvgl.SetNewTouchPoint(info.x, info.y, true);
|
lvgl.SetNewTouchPoint(info.x, info.y, true);
|
||||||
|
@ -60,7 +61,8 @@ void TouchHandler::Work() {
|
||||||
} else {
|
} else {
|
||||||
lvgl.SetNewTouchPoint(info.x, info.y, false);
|
lvgl.SetNewTouchPoint(info.x, info.y, false);
|
||||||
}
|
}
|
||||||
prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
|
slideReleased = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
systemTask->OnTouchEvent();
|
systemTask->OnTouchEvent();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user