1 /* 2 * Copyright (c) 2006-2022, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2022-6-27 solar first version 9 */ 10 11 #ifndef __DRV_XPT2046_H__ 12 #define __DRV_XPT2046_H__ 13 14 #include <rtthread.h> 15 #include <rtdevice.h> 16 17 #ifdef BSP_USING_TOUCH_RES 18 19 /* Related parameters of screen calibration, if the calibration is not performed 20 * after power on, please manually set the following macro definitions */ 21 #define BSP_XPT2046_MIN_RAW_X 100 22 #define BSP_XPT2046_MIN_RAW_Y 100 23 #define BSP_XPT2046_MAX_RAW_X 1950 24 #define BSP_XPT2046_MAX_RAW_Y 1950 25 #define BSP_XPT2046_RANGE_X 320 26 #define BSP_XPT2046_RANGE_Y 480 27 28 struct rt_xpt2046 29 { 30 struct rt_touch_device parent; 31 struct rt_spi_device *spi; 32 rt_uint16_t min_raw_x; 33 rt_uint16_t min_raw_y; 34 rt_uint16_t max_raw_x; 35 rt_uint16_t max_raw_y; 36 }; 37 typedef struct rt_xpt2046 *rt_xpt2046_t; 38 39 rt_err_t xpt2046_calibration(const char *lcd_name,const char *touch_name); 40 41 #endif /* BSP_USING_TOUCH_RES */ 42 43 #endif /* __DRV_XPT2046_H__ */ 44