00001 /***************************************************************************/ 00036 #ifndef __TOUCH_H 00037 #define __TOUCH_H 00038 00039 #include "em_device.h" 00040 #include "em_adc.h" 00041 #include "calibrate.h" 00042 00043 /***************************************************************************/ 00048 /***************************************************************************/ 00053 #ifdef __cplusplus 00054 extern "C" { 00055 #endif 00056 00058 #define TOUCH_IDLE 0 00059 #define TOUCH_BUSY_PRESSED 1 00060 #define TOUCH_BUSY_CHECK 2 00061 #define TOUCH_BUSY_SCAN 3 00062 00065 typedef struct 00066 { uint16_t x; 00067 uint16_t y; 00068 uint16_t adcx; 00069 uint16_t adcy; 00070 uint8_t pen; 00071 } TOUCH_Pos_TypeDef; 00072 00074 typedef struct 00075 { uint32_t frequency; 00076 uint8_t ignore; 00077 ADC_OvsRateSel_TypeDef oversampling; 00078 } TOUCH_Config_TypeDef; 00079 00081 #define TOUCH_INIT_DEFAULT \ 00082 { 500000, /* 500kHz sampling frequency */ \ 00083 1, /* Ignore moves not greater than 1 pixel */ \ 00084 adcOvsRateSel128, /* Oversampling 128 times */ \ 00085 } 00086 00088 typedef void (TOUCH_Upcall_TypeDef)(TOUCH_Pos_TypeDef *); 00089 00090 void TOUCH_Init(TOUCH_Config_TypeDef *config); 00091 void TOUCH_RegisterUpcall(TOUCH_Upcall_TypeDef *new_upcall); 00092 TOUCH_Pos_TypeDef *TOUCH_GetPos(void); 00093 int TOUCH_CalibrationTable(POINT * displayPtr, POINT * screenPtr); 00094 int TOUCH_IsBusy(void); 00095 00096 #ifdef __cplusplus 00097 } 00098 #endif 00099 00103 #endif