Paint for the FRDM-KL25Z
Dependencies: mbed TFT_fonts SPI_TFT_ILI9341
touch.cpp
- Committer:
- ecowboy
- Date:
- 2019-01-07
- Revision:
- 1:33506fcfdd95
- Parent:
- 0:42ec9a44bc24
- Child:
- 2:fe018965e46c
File content as of revision 1:33506fcfdd95:
#include "touch.h" #include "mbed.h" TouchScreen::TouchScreen(PinName xp, PinName yp, PinName xm, PinName ym) { PinName _yp = yp; PinName _xm = xm; PinName _ym = ym; PinName _xp = xp; } int TouchScreen::readTouch(PinName n, PinName m, PinName a, PinName i){ DigitalOut _n(n); _n = 1; DigitalOut _m(m); _m = 0; AnalogIn _a(a); AnalogIn _i(i); wait_us(10); return _a.read_u16(); } /*bool TouchScreen::isTouching(void){ Point p = getPoint(p); if(p.z > PRESSURE)return 1; else return 0; }*/ int map(int value, int fromSource, int toSource, int fromTarget, int toTarget){ return (value - fromSource) / (toSource - fromSource) * (toTarget - fromTarget) + fromTarget; }