Resistive TouchScreen e.g. for MCUFRIEND Display Shields
Dependents: TFT_Touch_botao_v1 TFT_Touch_exemplo5_git_touch TESTE_1 TFT_Touch_exemplo6_git_touch_button_3_ ... more
TouchScreen_kbv_mbed.h@2:f23dd0aaa0ec, 2021-05-17 (annotated)
- Committer:
- davidprentice
- Date:
- Mon May 17 08:10:08 2021 +0000
- Revision:
- 2:f23dd0aaa0ec
- Parent:
- 1:849734501e5a
set output() when leaving getPoint(). not for readTouchX() etc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davidprentice | 0:84f0f29e4695 | 1 | // Touch screen library with X Y and Z (pressure) readings as well |
davidprentice | 0:84f0f29e4695 | 2 | // as oversampling to avoid 'bouncing' |
davidprentice | 0:84f0f29e4695 | 3 | // (c) ladyada / adafruit |
davidprentice | 0:84f0f29e4695 | 4 | // Code under MIT License |
davidprentice | 0:84f0f29e4695 | 5 | |
davidprentice | 0:84f0f29e4695 | 6 | #ifndef _TOUCHSCREEN_KBV_MBED_H_ |
davidprentice | 0:84f0f29e4695 | 7 | #define _TOUCHSCREEN_KBV_MBED_H_ |
davidprentice | 0:84f0f29e4695 | 8 | #include <stdint.h> |
davidprentice | 0:84f0f29e4695 | 9 | |
davidprentice | 0:84f0f29e4695 | 10 | class TSPoint_kbv { |
davidprentice | 0:84f0f29e4695 | 11 | public: |
davidprentice | 0:84f0f29e4695 | 12 | TSPoint_kbv(void); |
davidprentice | 0:84f0f29e4695 | 13 | TSPoint_kbv(int16_t x, int16_t y, int16_t z); |
davidprentice | 0:84f0f29e4695 | 14 | |
davidprentice | 0:84f0f29e4695 | 15 | bool operator==(TSPoint_kbv); |
davidprentice | 0:84f0f29e4695 | 16 | bool operator!=(TSPoint_kbv); |
davidprentice | 0:84f0f29e4695 | 17 | |
davidprentice | 0:84f0f29e4695 | 18 | int16_t x, y, z; |
davidprentice | 0:84f0f29e4695 | 19 | }; |
davidprentice | 0:84f0f29e4695 | 20 | |
davidprentice | 0:84f0f29e4695 | 21 | class TouchScreen_kbv { |
davidprentice | 0:84f0f29e4695 | 22 | public: |
davidprentice | 1:849734501e5a | 23 | #if defined(__MBED__) |
davidprentice | 0:84f0f29e4695 | 24 | TouchScreen_kbv(PinName xp, PinName yp, PinName xm, PinName ym, uint16_t rx = 0); |
davidprentice | 1:849734501e5a | 25 | #else |
davidprentice | 1:849734501e5a | 26 | TouchScreen_kbv(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym, uint16_t rx = 0); |
davidprentice | 1:849734501e5a | 27 | #endif |
davidprentice | 0:84f0f29e4695 | 28 | // bool isTouching(void); |
davidprentice | 0:84f0f29e4695 | 29 | uint16_t pressure(void); |
davidprentice | 0:84f0f29e4695 | 30 | int readTouchY(); |
davidprentice | 0:84f0f29e4695 | 31 | int readTouchX(); |
davidprentice | 0:84f0f29e4695 | 32 | TSPoint_kbv getPoint(); |
davidprentice | 0:84f0f29e4695 | 33 | int16_t pressureThreshhold; |
davidprentice | 0:84f0f29e4695 | 34 | |
davidprentice | 0:84f0f29e4695 | 35 | private: |
davidprentice | 1:849734501e5a | 36 | #if defined(__MBED__) |
davidprentice | 0:84f0f29e4695 | 37 | uint16_t analogRead(PinName p); |
davidprentice | 0:84f0f29e4695 | 38 | void pinModeVal(PinName p, uint8_t mode, uint8_t val); |
davidprentice | 0:84f0f29e4695 | 39 | PinName _yp, _ym, _xm, _xp; |
davidprentice | 1:849734501e5a | 40 | #else |
davidprentice | 1:849734501e5a | 41 | void pinModeVal(uint8_t p, uint8_t mode, uint8_t val); |
davidprentice | 1:849734501e5a | 42 | uint8_t _yp, _ym, _xm, _xp; |
davidprentice | 1:849734501e5a | 43 | #endif |
davidprentice | 0:84f0f29e4695 | 44 | uint16_t _rxplate; |
davidprentice | 0:84f0f29e4695 | 45 | }; |
davidprentice | 0:84f0f29e4695 | 46 | |
davidprentice | 0:84f0f29e4695 | 47 | #endif |
davidprentice | 0:84f0f29e4695 | 48 | |
davidprentice | 0:84f0f29e4695 | 49 |