EFR32 Mighty Gecko 1 Software Documentation
efr32mg1-doc-5.1.2
|
EFM32GG_DK3750, Touch panel driver.
Copyright 2015 Silicon Labs, Inc. http://www.silabs.com
This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.
Definition in file touch.c.
#include <stdlib.h>
#include <string.h>
#include "em_device.h"
#include "em_adc.h"
#include "em_gpio.h"
#include "em_cmu.h"
#include "touch.h"
#include "calibrate.h"
#include "bsp.h"
#include "i2cspm.h"
#include "eeprom.h"
Go to the source code of this file.
Macros | |
#define | ADC_X adcSingleInpCh1 |
#define | ADC_Y adcSingleInpCh4 |
#define | TOUCH_X1_PIN 5 |
#define | TOUCH_X1_PORT gpioPortD |
#define | TOUCH_X2_PIN 4 |
#define | TOUCH_X2_PORT gpioPortD |
#define | TOUCH_Y1_PIN 3 |
#define | TOUCH_Y1_PORT gpioPortD |
#define | TOUCH_Y2_PIN 1 |
#define | TOUCH_Y2_PORT gpioPortD |
Enumerations | |
enum | TOUCH_State_TypeDef { TOUCH_INIT, TOUCH_CHECK_PRESS, TOUCH_MEASURE_X, TOUCH_MEASURE_Y } |
Functions | |
void | ADC0_IRQHandler (void) |
Interrupt handler is executed with frequency ~28Hz when panel is not pressed and with frequency ~140Hz when panel is pressed - this will give ~50 readings per second. | |
int | TOUCH_CalibrationTable (POINT *displayPtr, POINT *screenPtr) |
Set calibration table. More... | |
void | TOUCH_CallUpcall (void) |
Function that calls registered upcall. | |
TOUCH_Pos_TypeDef * | TOUCH_GetPos (void) |
Returns current touch position and state. More... | |
void | TOUCH_Init (TOUCH_Config_TypeDef *config) |
Initialize touch panel driver. More... | |
int | TOUCH_IsBusy (void) |
Check status of the touch panel. More... | |
void | TOUCH_RecalculatePosition (volatile TOUCH_Pos_TypeDef *pos) |
Convert ADC readings into XY position. More... | |
void | TOUCH_RegisterUpcall (TOUCH_Upcall_TypeDef *new_upcall) |
Register upcall which will be call every position or state change. More... | |
int | TOUCH_StateChanged (void) |
Check if cursor state changed (down or move) More... | |
Variables | |
MATRIX | calibrationMatrix = { 103800, 2048, -8184704, -384, 102144, -16424640, 287650 } |
#define ADC_X adcSingleInpCh1 |
#define ADC_Y adcSingleInpCh4 |
Input channel 4
Definition at line 38 of file touch.c.
Referenced by ADC0_IRQHandler(), and TOUCH_Init().
#define TOUCH_X1_PIN 5 |
#define TOUCH_X1_PORT gpioPortD |
#define TOUCH_X2_PIN 4 |
#define TOUCH_X2_PORT gpioPortD |
#define TOUCH_Y1_PIN 3 |
#define TOUCH_Y1_PORT gpioPortD |
#define TOUCH_Y2_PIN 1 |
#define TOUCH_Y2_PORT gpioPortD |
enum TOUCH_State_TypeDef |
void TOUCH_RecalculatePosition | ( | volatile TOUCH_Pos_TypeDef * | pos | ) |
Convert ADC readings into XY position.
[in] | pos | Pointer to position structure |
Definition at line 163 of file touch.c.
References TOUCH_Pos_TypeDef::adcx, TOUCH_Pos_TypeDef::adcy, calibrationMatrix, TOUCH_Pos_TypeDef::pen, TOUCH_Pos_TypeDef::x, and TOUCH_Pos_TypeDef::y.
Referenced by ADC0_IRQHandler().
int TOUCH_StateChanged | ( | void | ) |
Check if cursor state changed (down or move)
Definition at line 203 of file touch.c.
References TOUCH_Pos_TypeDef::pen, TOUCH_Pos_TypeDef::x, and TOUCH_Pos_TypeDef::y.
Referenced by ADC0_IRQHandler().
MATRIX calibrationMatrix = { 103800, 2048, -8184704, -384, 102144, -16424640, 287650 } |
Calibration table
Definition at line 71 of file touch.c.
Referenced by TOUCH_CalibrationTable(), and TOUCH_RecalculatePosition().