Vibration settings are now taken into account at lvgl input device driver layer
This commit is contained in:
parent
b65ab1ad4e
commit
2481699356
@ -15,6 +15,7 @@
|
||||
#include "lcd.h"
|
||||
#include "CST816D.h"
|
||||
#include "watch_peripherals.h"
|
||||
#include "watch_settings.h"
|
||||
|
||||
#include "app_log.h"
|
||||
|
||||
@ -50,17 +51,20 @@ static void touch_panel_isr(void *arg)
|
||||
CST816D_read_touch_event(p);
|
||||
}
|
||||
|
||||
void touch_panel_feedback_cb(struct _lv_indev_drv_t *lv_indev_drv, uint8_t lv_event_code)
|
||||
static void touch_panel_feedback_cb(struct _lv_indev_drv_t *lv_indev_drv, uint8_t lv_event_code)
|
||||
{
|
||||
(void)lv_indev_drv;
|
||||
|
||||
uint32_t vibration_duration_ms = persistency_get_settings()->display.display_vibrate_on_touch_duration*50;
|
||||
uint16_t vibration_strength = persistency_get_settings()->display.display_vibrate_on_touch_strength*32;
|
||||
|
||||
switch(lv_event_code)
|
||||
{
|
||||
case LV_EVENT_LONG_PRESSED:
|
||||
watch_peripherals_vibrate(255, 200);
|
||||
watch_peripherals_vibrate(255, vibration_duration_ms);
|
||||
break;
|
||||
case LV_EVENT_PRESSED:
|
||||
watch_peripherals_vibrate(200, 200);
|
||||
watch_peripherals_vibrate(vibration_strength > 255 ? 255 : vibration_strength, vibration_duration_ms);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -135,6 +139,7 @@ static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
// Set the last pressed coordinates taking into account the current display orientation
|
||||
switch(LCDConfig.LCDOrientation)
|
||||
{
|
||||
#if HARDWARE_PLATFORM == SMART_WATCH_BREADBOARD
|
||||
case LCD_ORIENTATION_90:
|
||||
data->point.x = 239-last_y;
|
||||
data->point.y = last_x;
|
||||
@ -151,6 +156,24 @@ static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
data->point.x = 239-last_x;
|
||||
data->point.y = 239-last_y;
|
||||
break;
|
||||
#elif HARDWARE_PLATFORM == SMART_WATCH_PCB
|
||||
case LCD_ORIENTATION_90:
|
||||
data->point.x = last_y;
|
||||
data->point.y = 239-last_x;
|
||||
break;
|
||||
case LCD_ORIENTATION_180:
|
||||
data->point.x = 239-last_x;
|
||||
data->point.y = 239-last_y;
|
||||
break;
|
||||
case LCD_ORIENTATION_270:
|
||||
data->point.x = 239-last_y;
|
||||
data->point.y = last_x;
|
||||
break;
|
||||
default:
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user