andrewm@0: /* andrewm@0: * I2c.h andrewm@0: * andrewm@0: * Created on: Oct 14, 2013 andrewm@0: * Author: Victor Zappi andrewm@0: */ andrewm@0: andrewm@0: #ifndef I2CTK_H_ andrewm@0: #define I2CTK_H_ andrewm@0: andrewm@0: #include "../../include/I2c.h" andrewm@0: andrewm@0: #define NUM_BYTES_OLD 9 andrewm@0: #define NUM_BYTES_NEW 13 andrewm@0: andrewm@0: class I2c_TouchKey : public I2c andrewm@0: { andrewm@0: private: andrewm@0: bool isReady; andrewm@0: bool newSensor; andrewm@0: int numBytesToRead; andrewm@0: andrewm@0: // read NUM_BYTES bytes, which have to be properly parsed andrewm@0: char dataBuffer[NUM_BYTES_NEW]; andrewm@0: int bytesRead; andrewm@0: andrewm@0: int rawSliderPosition[5]; andrewm@0: int rawSliderPositionH; andrewm@0: andrewm@0: int touchCount; andrewm@0: float sliderSize[5]; andrewm@0: float sliderPosition[5]; andrewm@0: float sliderPositionH; andrewm@0: andrewm@0: andrewm@0: public: andrewm@0: int initTouchKey(bool useNewSensor = false); andrewm@0: int readI2C(); andrewm@0: int getTouchCount(); andrewm@0: float * getSlidersize(); andrewm@0: float * getSliderPosition(); andrewm@0: float getSliderPositionH(); andrewm@0: andrewm@0: bool ready() { return isReady; } andrewm@0: andrewm@0: I2c_TouchKey(); andrewm@0: ~I2c_TouchKey(); andrewm@0: andrewm@0: }; andrewm@0: andrewm@0: inline int I2c_TouchKey::getTouchCount() andrewm@0: { andrewm@0: return touchCount; andrewm@0: } andrewm@0: andrewm@0: inline float * I2c_TouchKey::getSlidersize() andrewm@0: { andrewm@0: return sliderSize; andrewm@0: } andrewm@0: andrewm@0: inline float * I2c_TouchKey::getSliderPosition() andrewm@0: { andrewm@0: return sliderPosition; andrewm@0: } andrewm@0: andrewm@0: inline float I2c_TouchKey::getSliderPositionH() andrewm@0: { andrewm@0: return sliderPositionH; andrewm@0: } andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: #endif /* I2CTK_H_ */