Mercurial > hg > beaglert
comparison projects/d-box/I2c_TouchKey.h @ 0:8a575ba3ab52
Initial commit.
author | andrewm |
---|---|
date | Fri, 31 Oct 2014 19:10:17 +0100 |
parents | |
children | 901d205d1a3c |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8a575ba3ab52 |
---|---|
1 /* | |
2 * I2c.h | |
3 * | |
4 * Created on: Oct 14, 2013 | |
5 * Author: Victor Zappi | |
6 */ | |
7 | |
8 #ifndef I2CTK_H_ | |
9 #define I2CTK_H_ | |
10 | |
11 #include "../../include/I2c.h" | |
12 | |
13 #define NUM_BYTES_OLD 9 | |
14 #define NUM_BYTES_NEW 13 | |
15 | |
16 class I2c_TouchKey : public I2c | |
17 { | |
18 private: | |
19 bool isReady; | |
20 bool newSensor; | |
21 int numBytesToRead; | |
22 | |
23 // read NUM_BYTES bytes, which have to be properly parsed | |
24 char dataBuffer[NUM_BYTES_NEW]; | |
25 int bytesRead; | |
26 | |
27 int rawSliderPosition[5]; | |
28 int rawSliderPositionH; | |
29 | |
30 int touchCount; | |
31 float sliderSize[5]; | |
32 float sliderPosition[5]; | |
33 float sliderPositionH; | |
34 | |
35 | |
36 public: | |
37 int initTouchKey(bool useNewSensor = false); | |
38 int readI2C(); | |
39 int getTouchCount(); | |
40 float * getSlidersize(); | |
41 float * getSliderPosition(); | |
42 float getSliderPositionH(); | |
43 | |
44 bool ready() { return isReady; } | |
45 | |
46 I2c_TouchKey(); | |
47 ~I2c_TouchKey(); | |
48 | |
49 }; | |
50 | |
51 inline int I2c_TouchKey::getTouchCount() | |
52 { | |
53 return touchCount; | |
54 } | |
55 | |
56 inline float * I2c_TouchKey::getSlidersize() | |
57 { | |
58 return sliderSize; | |
59 } | |
60 | |
61 inline float * I2c_TouchKey::getSliderPosition() | |
62 { | |
63 return sliderPosition; | |
64 } | |
65 | |
66 inline float I2c_TouchKey::getSliderPositionH() | |
67 { | |
68 return sliderPositionH; | |
69 } | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 #endif /* I2CTK_H_ */ |