A controller for a 5 wire resistive touch screen
TouchController.hpp
- Committer:
- Generic
- Date:
- 2016-09-16
- Revision:
- 3:710534c5a240
- Parent:
- 2:d0930962a3bb
- Child:
- 4:ab2e56595286
File content as of revision 3:710534c5a240:
#ifndef TOUCHCONTROLLER_H #define TOUCHCONTROLLER_H // Macros for calibration function #define X_T1 t[0][0] #define X_T2 t[1][0] #define X_T3 t[2][0] #define Y_T1 t[0][1] #define Y_T2 t[1][1] #define Y_T3 t[2][1] #define X_D1 d[0][0] #define X_D2 d[1][0] #define X_D3 d[2][0] #define Y_D1 d[0][1] #define Y_D2 d[1][1] #define Y_D3 d[2][1] //Includes #include "mbed.h" class TouchController { public: TouchController(PinName ur, PinName lr,PinName s, PinName ul, PinName ll, int num_of_samples = 5); int TouchDetected(); float RawX(); float RawY(); float GetX(); float GetY(); void Calibrate(float t[3][2], float d[3][2]); uint32_t settle; private: DigitalInOut _UR; DigitalInOut _LR; PinName _S; DigitalInOut _UL; DigitalInOut _LL; static const char DETECT = 1; static const char X = 2; static const char Y = 3; float A; float B; float C; float D; float E; float F; int n_samples; void ConfigPins(char mode); float MeasureS(); }; #endif