EFM32 Jade Gecko 12 Software Documentation  efm32jg12-doc-5.1.2
touch.h
Go to the documentation of this file.
1 /***************************************************************************/
18 #ifndef __TOUCH_H
19 #define __TOUCH_H
20 
21 #include "em_device.h"
22 #include "em_adc.h"
23 #include "calibrate.h"
24 
25 /***************************************************************************/
30 /***************************************************************************/
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
40 #define TOUCH_IDLE 0
41 #define TOUCH_BUSY_PRESSED 1
42 #define TOUCH_BUSY_CHECK 2
43 #define TOUCH_BUSY_SCAN 3
44 
47 typedef struct
48 { uint16_t x;
49  uint16_t y;
50  uint16_t adcx;
51  uint16_t adcy;
52  uint8_t pen;
54 
56 typedef struct
57 { uint32_t frequency;
58  uint8_t ignore;
61 
63 #define TOUCH_INIT_DEFAULT \
64  { 500000, /* 500kHz sampling frequency */ \
65  1, /* Ignore moves not greater than 1 pixel */ \
66  adcOvsRateSel128, /* Oversampling 128 times */ \
67  }
68 
71 
72 void TOUCH_Init(TOUCH_Config_TypeDef *config);
75 int TOUCH_CalibrationTable(POINT * displayPtr, POINT * screenPtr);
76 int TOUCH_IsBusy(void);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
85 #endif
void TOUCH_Init(TOUCH_Config_TypeDef *config)
Initialize touch panel driver.
Definition: touch.c:340
uint16_t x
Definition: touch.h:48
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
ADC_OvsRateSel_TypeDef
Definition: em_adc.h:89
uint16_t y
Definition: touch.h:49
uint16_t adcx
Definition: touch.h:50
uint8_t pen
Definition: touch.h:52
int TOUCH_IsBusy(void)
Check status of the touch panel.
Definition: touch.c:318
void TOUCH_RegisterUpcall(TOUCH_Upcall_TypeDef *new_upcall)
Register upcall which will be call every position or state change.
Definition: touch.c:392
uint16_t adcy
Definition: touch.h:51
TOUCH_Pos_TypeDef * TOUCH_GetPos(void)
Returns current touch position and state.
Definition: touch.c:372
uint32_t frequency
Definition: touch.h:57
Analog to Digital Converter (ADC) peripheral API.
void( TOUCH_Upcall_TypeDef)(TOUCH_Pos_TypeDef *)
Definition: touch.h:70
uint8_t ignore
Definition: touch.h:58
int TOUCH_CalibrationTable(POINT *displayPtr, POINT *screenPtr)
Set calibration table.
Definition: touch.c:410
ADC_OvsRateSel_TypeDef oversampling
Definition: touch.h:59