repair the timeout problem of i2c interrupt for xidatong

This commit is contained in:
Wang_Weigen
2022-06-02 15:53:24 +08:00
parent c6c0a0f71b
commit d57d8e0a4d
5 changed files with 55 additions and 28 deletions
@@ -192,9 +192,12 @@ typedef struct
#define PRIV_SYSTICK_GET (CurrentTicksGain())
#define PRIV_LCD_DEV "/dev/lcd_dev"
#define PRIV_TOUCH_DEV "/dev/touch_dev"
#define MY_DISP_HOR_RES BSP_LCD_Y_MAX
#define MY_DISP_VER_RES BSP_LCD_X_MAX
#define PRIV_TOUCH_DEV "/dev/touch_dev"
#define MY_INDEV_X BSP_LCD_Y_MAX
#define MY_INDEV_Y BSP_LCD_X_MAX
/**********************mutex**************************/
int PrivMutexCreate(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *attr);
@@ -226,7 +226,12 @@ void lv_port_indev_init(void)
static void touchpad_init(void)
{
touch_fd = PrivOpen(PRIV_TOUCH_DEV,O_RDWR);
printf("touch fd = %d\n",touch_fd);
if(touch_fd >= 0) {
printf("touch fd = %d\n",touch_fd);
} else {
printf("open %s touch fd = %d\n",PRIV_TOUCH_DEV,touch_fd);
}
/*Your code comes here*/
}
@@ -256,8 +261,9 @@ static bool touchpad_is_pressed(void)
/*Your code comes here*/
memset(&touch_data, 0 ,sizeof(TouchDataParam));
ret = PrivRead(touch_fd, &touch_data, 1);
if(ret && touch_data.x >= 0 && touch_data.x <= 480 && touch_data.y >= 0 && touch_data.y <= 272)
if(ret && touch_data.x >= 0 && touch_data.x < MY_INDEV_X && touch_data.y >= 0 && touch_data.y < MY_INDEV_Y)
{
// printf("touch x %d touch y %d\n",touch_data.x,touch_data.y);
return true;
}