Mercurial > hg > beaglert
diff projects/d-box/I2c_TouchKey.h @ 15:901d205d1a3c
Updated to latest PRU library; external PRU file no longer needed. Also catch SIGTERM as well as SIGINT to clean up gracefully.
author | andrewm |
---|---|
date | Sat, 07 Feb 2015 16:41:56 +0000 |
parents | 8a575ba3ab52 |
children | 59edd5780fef |
line wrap: on
line diff
--- a/projects/d-box/I2c_TouchKey.h Fri Jan 23 15:35:10 2015 +0000 +++ b/projects/d-box/I2c_TouchKey.h Sat Feb 07 16:41:56 2015 +0000 @@ -10,18 +10,28 @@ #include "../../include/I2c.h" -#define NUM_BYTES_OLD 9 -#define NUM_BYTES_NEW 13 +// #define NUM_BYTES_OLD 9 +// #define NUM_BYTES_NEW 13 + +#define MAX_SENSOR_BYTES 20 + +enum { + kSensorTypeTouchKey = 0, + kSensorTypeDBox1 = 1, + kSensorTypeDBox2 = 2 +}; + +static const int kSensorBytes[3] = {9, 13, 20}; class I2c_TouchKey : public I2c { private: bool isReady; - bool newSensor; + int sensorType; int numBytesToRead; // read NUM_BYTES bytes, which have to be properly parsed - char dataBuffer[NUM_BYTES_NEW]; + char dataBuffer[MAX_SENSOR_BYTES]; int bytesRead; int rawSliderPosition[5]; @@ -34,7 +44,7 @@ public: - int initTouchKey(bool useNewSensor = false); + int initTouchKey(int sensorTypeToUse = kSensorTypeTouchKey); int readI2C(); int getTouchCount(); float * getSlidersize();