David Prentice / TouchScreen_kbv_mbed

Dependents:   TFT_Touch_botao_v1 TFT_Touch_exemplo5_git_touch TESTE_1 TFT_Touch_exemplo6_git_touch_button_3_ ... more

TouchScreen_kbv_mbed.h

Committer:
davidprentice
Date:
2021-04-26
Revision:
0:84f0f29e4695
Child:
1:849734501e5a

File content as of revision 0:84f0f29e4695:

// Touch screen library with X Y and Z (pressure) readings as well
// as oversampling to avoid 'bouncing'
// (c) ladyada / adafruit
// Code under MIT License

#ifndef _TOUCHSCREEN_KBV_MBED_H_
#define _TOUCHSCREEN_KBV_MBED_H_
#include <stdint.h>

class TSPoint_kbv {
    public:
        TSPoint_kbv(void);
        TSPoint_kbv(int16_t x, int16_t y, int16_t z);

        bool operator==(TSPoint_kbv);
        bool operator!=(TSPoint_kbv);

        int16_t x, y, z;
};

class TouchScreen_kbv {
    public:
        TouchScreen_kbv(PinName xp, PinName yp, PinName xm, PinName ym, uint16_t rx = 0);

//        bool isTouching(void);
        uint16_t pressure(void);
        int readTouchY();
        int readTouchX();
        TSPoint_kbv getPoint();
        int16_t pressureThreshhold;

    private:
        uint16_t analogRead(PinName p);
        void pinModeVal(PinName p, uint8_t mode, uint8_t val); 
        PinName _yp, _ym, _xm, _xp;
        uint16_t _rxplate;
};

#endif