A controller for a 5 wire resistive touch screen
TouchController.hpp
- Committer:
- Kerneels Bezuidenhout
- Date:
- 2016-09-15
- Revision:
- 1:ed8485a78c6a
- Parent:
- 0:a3b5665b0a24
- Child:
- 2:d0930962a3bb
File content as of revision 1:ed8485a78c6a:
#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, uint32_t settle = 80); int TouchDetected(); float RawX(); float RawY(); float X(); float Y(); void Calibrate(float t[3][2], float d[3][2]); private: DigitalInOut _UR; DigitalInOut _LR; PinName _S; DigitalInOut _UL; DigitalInOut _LL; static const char DETECT_MODE = 1; static const char X_MODE = 2; static const char Y_MODE = 3; float A,B,C,D,E,F; int _samples; uint32_t _settle; void ConfigPins(char mode); float MeasureS(); }; #endif