/*Will be called by the library to read the touchpad*/staticvoidtouchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data){
staticlv_coord_t last_x = 0;
staticlv_coord_t last_y = 0;
/*Save the pressed coordinates and the state*/if(touchpad_is_pressed()) {
touchpad_get_xy(&last_x, &last_y);
data->state = LV_INDEV_STATE_PR;
}
else {
data->state = LV_INDEV_STATE_REL;
}
/*Set the last pressed coordinates*/
data->point.x = last_x;
data->point.y = last_y;
}
/*Return true is the touchpad is pressed*/staticbooltouchpad_is_pressed(void){
/*Your code comes here*/// TODO: 从这里开始一次扫描,获取触摸屏状态if (TP_Scan()) {
returntrue;
}
returnfalse;
}
/*Get the x and y coordinates if the touchpad is pressed*/staticvoidtouchpad_get_xy(lv_coord_t * x, lv_coord_t * y){
/*Your code comes here*/
TP_Get_XY((uint16_t*)x, (uint16_t*)y);
}