added FT6206 flip
This commit is contained in:
@@ -17,9 +17,13 @@ FT6206::FT6206() { touches = 0; }
|
||||
@returns True if an FT6206 is found, false on any failure
|
||||
*/
|
||||
/**************************************************************************/
|
||||
bool FT6206::begin(uint8_t thresh) {
|
||||
Wire.begin();
|
||||
// bool begin(uint8_t thresh = FT62XX_DEFAULT_THRESHOLD, uint16_t width, uint16_t height, bool flip );
|
||||
|
||||
bool FT6206::begin(uint16_t width, uint16_t height, bool flip, uint8_t thresh) {
|
||||
Wire.begin();
|
||||
_width = width;
|
||||
_height = height;
|
||||
_flip = flip;
|
||||
#ifdef FT6206_DEBUG
|
||||
Serial.print("Vend ID: 0x");
|
||||
Serial.println(readRegister8(FT62XX_REG_VENDID), HEX);
|
||||
@@ -86,7 +90,14 @@ TS_Point FT6206::getPoint(uint8_t n) {
|
||||
if ((touches == 0) || (n > 1)) {
|
||||
return TS_Point(0, 0, 0);
|
||||
} else {
|
||||
return TS_Point(touchX[n], touchY[n], 1);
|
||||
if(_flip)
|
||||
{
|
||||
return TS_Point(_width - touchX[n], _height - touchY[n], 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return TS_Point(touchX[n], touchY[n], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,15 @@ public:
|
||||
class FT6206 {
|
||||
public:
|
||||
FT6206(void);
|
||||
bool begin(uint8_t thresh = FT62XX_DEFAULT_THRESHOLD);
|
||||
bool begin(uint16_t width, uint16_t height, bool flip = false, uint8_t thresh = FT62XX_DEFAULT_THRESHOLD);
|
||||
uint8_t touched(void);
|
||||
TS_Point getPoint(uint8_t n = 0);
|
||||
|
||||
// void autoCalibrate(void);
|
||||
|
||||
private:
|
||||
uint16_t _width, _height;
|
||||
bool _flip;
|
||||
void writeRegister8(uint8_t reg, uint8_t val);
|
||||
uint8_t readRegister8(uint8_t reg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user