00001 00039 #ifndef TOUCH_TOUCH_H 00040 #define TOUCH_TOUCH_H 00041 00042 #include <stdint.h> 00043 00148 00167 00168 struct touch_point { 00169 int16_t panel_x; 00170 int16_t panel_y; 00171 uint16_t raw_x; 00172 uint16_t raw_y; 00173 }; 00174 00176 #define TOUCH_NR_CALIBRATION_POINTS 3 00177 00183 typedef struct touch_point 00184 touch_calibration_points_t[TOUCH_NR_CALIBRATION_POINTS]; 00185 00191 struct touch_calibration_matrix { 00192 int32_t a; 00193 int32_t b; 00194 int32_t c; 00195 int32_t d; 00196 int32_t e; 00197 int32_t f; 00198 int32_t k; 00199 }; 00200 00201 00203 enum touch_event_types { 00204 TOUCH_NO_EVENT, 00205 TOUCH_PRESS, 00206 TOUCH_MOVE, 00207 TOUCH_RELEASE, 00208 }; 00209 00210 00212 struct touch_event { 00213 enum touch_event_types type; 00214 struct touch_point point; 00215 }; 00216 00217 00219 typedef void (* touch_event_handler_t)(const struct touch_event *event); 00220 00221 00222 void touch_init(void); 00223 void touch_enable(void); 00224 void touch_disable(void); 00225 void touch_get_event(struct touch_event *buffer); 00226 bool touch_is_touched(void); 00227 void touch_set_calibration_matrix( 00228 const struct touch_calibration_matrix *matrix); 00229 void touch_get_calibration_matrix(struct touch_calibration_matrix *buffer); 00230 void touch_compute_calibration_matrix( 00231 const touch_calibration_points_t points, 00232 struct touch_calibration_matrix *matrix); 00233 void touch_set_event_handler(touch_event_handler_t handler); 00234 touch_event_handler_t touch_get_event_handler(void); 00235 00237 00238 #endif /* TOUCH_TOUCH_H */
1.6.3