This commit is contained in:
刘可亮
2024-06-04 19:00:30 +08:00
parent 990c72f5be
commit 0a13af6a1d
1668 changed files with 342810 additions and 37726 deletions

View File

@@ -54,7 +54,7 @@ static calibration g_cal = {
};
void lv_rtp_calibrate(rt_device_t rtp_dev, int fb_width, int fb_height);
void lv_convert_adc_to_coord(struct rt_touch_data *data);
void lv_convert_adc_to_coord(rt_device_t rtp_dev, struct rt_touch_data *data);
static void rtp_check_event_type(int event_type, int pressure)
{
@@ -166,6 +166,8 @@ static void rtp_get_valid_point(rt_device_t rtp_dev, int index, struct rt_touch_
if (data->x_coordinate > 0 || data->y_coordinate > 0) {
press_flag = 1;
rt_device_control(rtp_dev, RT_TOUCH_CTRL_SET_X_TO_Y,
(void *)data);
x = data->x_coordinate;
y = data->y_coordinate;
sum_x += x;
@@ -357,12 +359,14 @@ void lv_rtp_calibrate(rt_device_t rtp_dev, int fb_width, int fb_height)
rt_device_control(rtp_dev, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL);
}
void lv_convert_adc_to_coord(struct rt_touch_data *data)
void lv_convert_adc_to_coord(rt_device_t rtp_dev, struct rt_touch_data *data)
{
int panel_x = 0;
int panel_y = 0;
int a[7] = {0};
rt_device_control(rtp_dev, RT_TOUCH_CTRL_SET_X_TO_Y, (void *)data);
panel_x = AIC_RTP_MAX_VAL - data->x_coordinate;
panel_y = AIC_RTP_MAX_VAL - data->y_coordinate;
panel_x = (panel_x * g_fb_width) / AIC_RTP_MAX_VAL;

View File

@@ -48,10 +48,11 @@ static void touch_panel_gt911_read_info(void)
static void touch_entry(void *parameter) /* touch panel control entry */
{
#ifdef AIC_TOUCH_PANEL_GT911
rt_device_control(dev, RT_TOUCH_CTRL_GET_INFO, &info);
#endif
#ifdef AIC_USING_RTP /* by default, only one point is supported */
info.point_num = 1;
rt_device_control(dev, RT_TOUCH_CTRL_PDEB_VALID_CHECK, RT_NULL);
#endif
read_data = (struct rt_touch_data *)rt_malloc(sizeof(struct rt_touch_data) * info.point_num);
@@ -70,13 +71,13 @@ static void touch_entry(void *parameter) /* touch panel control entry */
{
rt_uint16_t u16X, u16Y;
#ifdef AIC_USING_RTP
extern void lv_convert_adc_to_coord(struct rt_touch_data *data);
lv_convert_adc_to_coord(&read_data[i]);
extern void lv_convert_adc_to_coord(rt_device_t rtp_dev, struct rt_touch_data *data);
lv_convert_adc_to_coord(dev, &read_data[i]);
#endif
u16X = read_data[i].x_coordinate;
u16Y = read_data[i].y_coordinate;
//rt_kprintf("[%d] %d %d\n", read_data[i].event, u16X, u16Y);
// rt_kprintf("[%d] %d %d\n", read_data[i].event, u16X, u16Y);
aic_touch_inputevent_cb(u16X, u16Y, read_data[i].event);
}
}
@@ -117,8 +118,10 @@ int tpc_run(const char *name, rt_uint16_t x, rt_uint16_t y)
if (rt_device_open(dev, RT_DEVICE_FLAG_INT_RX) != RT_EOK)
{
rt_kprintf("open device failed!");
rt_kprintf("open device failed!\n");
return -1;
} else {
rt_kprintf("lvgl is occupying %s device\n", name);
}
#ifdef AIC_USING_RTP