touch.h

Go to the documentation of this file.
00001 /***************************************************************************/
00018 #ifndef __TOUCH_H
00019 #define __TOUCH_H
00020 
00021 #include "em_device.h"
00022 #include "em_adc.h"
00023 #include "calibrate.h"
00024 
00025 /***************************************************************************/
00030 /***************************************************************************/
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00040 #define TOUCH_IDLE         0
00041 #define TOUCH_BUSY_PRESSED 1
00042 #define TOUCH_BUSY_CHECK   2
00043 #define TOUCH_BUSY_SCAN    3
00044 
00047 typedef struct
00048 { uint16_t x;           
00049   uint16_t y;           
00050   uint16_t adcx;        
00051   uint16_t adcy;        
00052   uint8_t  pen;         
00053 } TOUCH_Pos_TypeDef;
00054 
00056 typedef struct
00057 { uint32_t               frequency;     
00058   uint8_t                ignore;        
00059   ADC_OvsRateSel_TypeDef oversampling;  
00060 } TOUCH_Config_TypeDef;
00061 
00063 #define TOUCH_INIT_DEFAULT                                             \
00064   { 500000,                /* 500kHz sampling frequency */             \
00065     1,                     /* Ignore moves not greater than 1 pixel */ \
00066     adcOvsRateSel128,      /* Oversampling 128 times */                \
00067   }
00068 
00070 typedef void (TOUCH_Upcall_TypeDef)(TOUCH_Pos_TypeDef *);
00071 
00072 void TOUCH_Init(TOUCH_Config_TypeDef *config);
00073 void TOUCH_RegisterUpcall(TOUCH_Upcall_TypeDef *new_upcall);
00074 TOUCH_Pos_TypeDef *TOUCH_GetPos(void);
00075 int TOUCH_CalibrationTable(POINT * displayPtr, POINT * screenPtr);
00076 int TOUCH_IsBusy(void);
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00085 #endif