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,37 +30,39 @@ 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.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
|
if (info.isValid) {
|
||||||
if (prevGesture != info.gesture) {
|
if (info.gesture != Pinetime::Drivers::Cst816S::Gestures::None) {
|
||||||
if (info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideDown || info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideLeft ||
|
if (slideReleased) {
|
||||||
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideUp || info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideRight) {
|
if (info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideDown ||
|
||||||
prevGesture = info.gesture;
|
info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideLeft ||
|
||||||
|
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);
|
if (info.touching) {
|
||||||
} else {
|
if (!isCancelled) {
|
||||||
if (info.touching) {
|
lvgl.SetNewTouchPoint(info.x, info.y, true);
|
||||||
if (!isCancelled) {
|
}
|
||||||
lvgl.SetNewTouchPoint(info.x, info.y, true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isCancelled) {
|
|
||||||
lvgl.SetNewTouchPoint(-1, -1, false);
|
|
||||||
isCancelled = false;
|
|
||||||
} else {
|
} else {
|
||||||
lvgl.SetNewTouchPoint(info.x, info.y, false);
|
if (isCancelled) {
|
||||||
|
lvgl.SetNewTouchPoint(-1, -1, false);
|
||||||
|
isCancelled = false;
|
||||||
|
} else {
|
||||||
|
lvgl.SetNewTouchPoint(info.x, info.y, false);
|
||||||
|
}
|
||||||
|
slideReleased = true;
|
||||||
}
|
}
|
||||||
prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
|
|
||||||
}
|
}
|
||||||
systemTask->OnTouchEvent();
|
systemTask->OnTouchEvent();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue