The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller
Dependents: NucleoMGC3130 i2c_master
TouchInfo/TouchInfo.h@2:c7d984193741, 2015-10-08 (annotated)
- Committer:
- yangcq88517
- Date:
- Thu Oct 08 11:14:18 2015 +0000
- Revision:
- 2:c7d984193741
- Parent:
- 1:621c4e9238ef
add some documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangcq88517 | 1:621c4e9238ef | 1 | #ifndef UK_AC_HERTS_SMARTLAB_MGC3130_TouchInfo |
yangcq88517 | 1:621c4e9238ef | 2 | #define UK_AC_HERTS_SMARTLAB_MGC3130_TouchInfo |
yangcq88517 | 1:621c4e9238ef | 3 | |
yangcq88517 | 2:c7d984193741 | 4 | /// Contains touch information |
yangcq88517 | 1:621c4e9238ef | 5 | class TouchInfo |
yangcq88517 | 1:621c4e9238ef | 6 | { |
yangcq88517 | 1:621c4e9238ef | 7 | private: |
yangcq88517 | 2:c7d984193741 | 8 | /** 2 bytes bit mask |
yangcq88517 | 2:c7d984193741 | 9 | *Bit 0: Touch South electrode |
yangcq88517 | 2:c7d984193741 | 10 | *Bit 1: Touch West electrode |
yangcq88517 | 2:c7d984193741 | 11 | *Bit 2: Touch North electrode |
yangcq88517 | 2:c7d984193741 | 12 | *Bit 3: Touch East electrode |
yangcq88517 | 2:c7d984193741 | 13 | *Bit 4: Touch Center electrode |
yangcq88517 | 2:c7d984193741 | 14 | *Bit 5: Tap South electrode |
yangcq88517 | 2:c7d984193741 | 15 | *Bit 6: Tap West electrode |
yangcq88517 | 2:c7d984193741 | 16 | *Bit 7: Tap North electrode |
yangcq88517 | 2:c7d984193741 | 17 | *Bit 8: Tap East electrode |
yangcq88517 | 2:c7d984193741 | 18 | *Bit 9: Tap Center electrode |
yangcq88517 | 2:c7d984193741 | 19 | *Bit 10: Double Tap South electrode |
yangcq88517 | 2:c7d984193741 | 20 | *Bit 11: Double Tap West electrode |
yangcq88517 | 2:c7d984193741 | 21 | *Bit 12: Double Tap North electrode |
yangcq88517 | 2:c7d984193741 | 22 | *Bit 13: Double Tap East electrode |
yangcq88517 | 2:c7d984193741 | 23 | *Bit 14: Double Tap Center electrode |
yangcq88517 | 2:c7d984193741 | 24 | *Bit 15: This bit is reserved. |
yangcq88517 | 2:c7d984193741 | 25 | */ |
yangcq88517 | 1:621c4e9238ef | 26 | int value; |
yangcq88517 | 2:c7d984193741 | 27 | |
yangcq88517 | 2:c7d984193741 | 28 | /** Bits 16...23:Touch Counter: 8-bit counter; this counter determines the |
yangcq88517 | 2:c7d984193741 | 29 | *period between the time when the hand starts moving to |
yangcq88517 | 2:c7d984193741 | 30 | *touch until it is detected. This period is equal to [Touch |
yangcq88517 | 2:c7d984193741 | 31 | *Counter Value] x 5 (ms). The counter starts counting when |
yangcq88517 | 2:c7d984193741 | 32 | *the minimum approach speed required to detect a touch |
yangcq88517 | 2:c7d984193741 | 33 | *event is exceeded, until the touch is detected. After each |
yangcq88517 | 2:c7d984193741 | 34 | *touch detection, the counter is reset. |
yangcq88517 | 2:c7d984193741 | 35 | *Bits 24...31:These bits are reserved. |
yangcq88517 | 2:c7d984193741 | 36 | */ |
yangcq88517 | 1:621c4e9238ef | 37 | int count; |
yangcq88517 | 2:c7d984193741 | 38 | |
yangcq88517 | 1:621c4e9238ef | 39 | static const int TouchSouthElectrode = 0x0100; |
yangcq88517 | 1:621c4e9238ef | 40 | static const int TouchWestElectrode = 0x0200; |
yangcq88517 | 1:621c4e9238ef | 41 | static const int TouchNorthElectrode = 0x0400; |
yangcq88517 | 1:621c4e9238ef | 42 | static const int TouchEastElectrode = 0x0800; |
yangcq88517 | 1:621c4e9238ef | 43 | static const int TouchCenterElectrode = 0x1000; |
yangcq88517 | 1:621c4e9238ef | 44 | static const int TapSouthElectrode = 0x2000; |
yangcq88517 | 1:621c4e9238ef | 45 | static const int TapWestElectrode = 0x4000; |
yangcq88517 | 1:621c4e9238ef | 46 | static const int TapNorthElectrode = 0x8000; |
yangcq88517 | 1:621c4e9238ef | 47 | static const int TapEastElectrode = 0x0001; |
yangcq88517 | 1:621c4e9238ef | 48 | static const int TapCenterElectrode = 0x0002; |
yangcq88517 | 1:621c4e9238ef | 49 | static const int DoubleTapSouthElectrode = 0x0004; |
yangcq88517 | 1:621c4e9238ef | 50 | static const int DoubleTapWestElectrode = 0x0008; |
yangcq88517 | 1:621c4e9238ef | 51 | static const int DoubleTapNorthElectrode = 0x0010; |
yangcq88517 | 1:621c4e9238ef | 52 | static const int DoubleTapEastElectrode = 0x0020; |
yangcq88517 | 1:621c4e9238ef | 53 | static const int DoubleTapCenterElectrode = 0x0040; |
yangcq88517 | 1:621c4e9238ef | 54 | |
yangcq88517 | 2:c7d984193741 | 55 | public: |
yangcq88517 | 2:c7d984193741 | 56 | /** Set the internal memory, used by API itself. |
yangcq88517 | 2:c7d984193741 | 57 | * |
yangcq88517 | 2:c7d984193741 | 58 | * @param touchEvent 2 bytes bit mask |
yangcq88517 | 2:c7d984193741 | 59 | * @param counter 1 byte |
yangcq88517 | 2:c7d984193741 | 60 | */ |
yangcq88517 | 2:c7d984193741 | 61 | void set(int touchEvent, int counter); |
yangcq88517 | 1:621c4e9238ef | 62 | |
yangcq88517 | 2:c7d984193741 | 63 | /** |
yangcq88517 | 2:c7d984193741 | 64 | *Touch Counter: this counter determines the |
yangcq88517 | 2:c7d984193741 | 65 | *period between the time when the hand starts moving to |
yangcq88517 | 2:c7d984193741 | 66 | *touch until it is detected. This period is equal to [Touch |
yangcq88517 | 2:c7d984193741 | 67 | *Counter Value] x 5 (ms). The counter starts counting when |
yangcq88517 | 2:c7d984193741 | 68 | *the minimum approach speed required to detect a touch |
yangcq88517 | 2:c7d984193741 | 69 | *event is exceeded, until the touch is detected. After each |
yangcq88517 | 2:c7d984193741 | 70 | *touch detection, the counter is reset. |
yangcq88517 | 2:c7d984193741 | 71 | * |
yangcq88517 | 2:c7d984193741 | 72 | * @returns 8-bit counter |
yangcq88517 | 1:621c4e9238ef | 73 | */ |
yangcq88517 | 2:c7d984193741 | 74 | int getCounter(); |
yangcq88517 | 2:c7d984193741 | 75 | |
yangcq88517 | 2:c7d984193741 | 76 | /** Check if touch south electrode is detected. |
yangcq88517 | 2:c7d984193741 | 77 | * |
yangcq88517 | 2:c7d984193741 | 78 | * @returns |
yangcq88517 | 2:c7d984193741 | 79 | * true qualified |
yangcq88517 | 2:c7d984193741 | 80 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 81 | */ |
yangcq88517 | 2:c7d984193741 | 82 | bool isTouchSouthElectrode(); |
yangcq88517 | 1:621c4e9238ef | 83 | |
yangcq88517 | 2:c7d984193741 | 84 | /** Check if touch west electrode is detected. |
yangcq88517 | 2:c7d984193741 | 85 | * |
yangcq88517 | 2:c7d984193741 | 86 | * @returns |
yangcq88517 | 2:c7d984193741 | 87 | * true qualified |
yangcq88517 | 2:c7d984193741 | 88 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 89 | */ |
yangcq88517 | 2:c7d984193741 | 90 | bool isTouchWestElectrode(); |
yangcq88517 | 1:621c4e9238ef | 91 | |
yangcq88517 | 2:c7d984193741 | 92 | /** Check if touch north electrode is detected. |
yangcq88517 | 2:c7d984193741 | 93 | * |
yangcq88517 | 2:c7d984193741 | 94 | * @returns |
yangcq88517 | 2:c7d984193741 | 95 | * true qualified |
yangcq88517 | 2:c7d984193741 | 96 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 97 | */ |
yangcq88517 | 2:c7d984193741 | 98 | bool isTouchNorthElectrode(); |
yangcq88517 | 1:621c4e9238ef | 99 | |
yangcq88517 | 2:c7d984193741 | 100 | /** Check if touch east electrode is detected. |
yangcq88517 | 2:c7d984193741 | 101 | * |
yangcq88517 | 2:c7d984193741 | 102 | * @returns |
yangcq88517 | 2:c7d984193741 | 103 | * true qualified |
yangcq88517 | 2:c7d984193741 | 104 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 105 | */ |
yangcq88517 | 2:c7d984193741 | 106 | bool isTouchEastElectrode(); |
yangcq88517 | 1:621c4e9238ef | 107 | |
yangcq88517 | 2:c7d984193741 | 108 | /** Check if touch center electrode is detected. |
yangcq88517 | 2:c7d984193741 | 109 | * |
yangcq88517 | 2:c7d984193741 | 110 | * @returns |
yangcq88517 | 2:c7d984193741 | 111 | * true qualified |
yangcq88517 | 2:c7d984193741 | 112 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 113 | */ |
yangcq88517 | 2:c7d984193741 | 114 | bool isTouchCenterElectrode(); |
yangcq88517 | 1:621c4e9238ef | 115 | |
yangcq88517 | 2:c7d984193741 | 116 | /** Check if tap south electrode is detected. |
yangcq88517 | 2:c7d984193741 | 117 | * |
yangcq88517 | 2:c7d984193741 | 118 | * @returns |
yangcq88517 | 2:c7d984193741 | 119 | * true qualified |
yangcq88517 | 2:c7d984193741 | 120 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 121 | */ |
yangcq88517 | 2:c7d984193741 | 122 | bool isTapSouthElectrode(); |
yangcq88517 | 1:621c4e9238ef | 123 | |
yangcq88517 | 2:c7d984193741 | 124 | /** Check if tap west electrode is detected. |
yangcq88517 | 2:c7d984193741 | 125 | * |
yangcq88517 | 2:c7d984193741 | 126 | * @returns |
yangcq88517 | 2:c7d984193741 | 127 | * true qualified |
yangcq88517 | 2:c7d984193741 | 128 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 129 | */ |
yangcq88517 | 2:c7d984193741 | 130 | bool isTapWestElectrode(); |
yangcq88517 | 1:621c4e9238ef | 131 | |
yangcq88517 | 2:c7d984193741 | 132 | /** Check if tap north electrode is detected. |
yangcq88517 | 2:c7d984193741 | 133 | * |
yangcq88517 | 2:c7d984193741 | 134 | * @returns |
yangcq88517 | 2:c7d984193741 | 135 | * true qualified |
yangcq88517 | 2:c7d984193741 | 136 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 137 | */ |
yangcq88517 | 2:c7d984193741 | 138 | bool isTapNorthElectrode(); |
yangcq88517 | 1:621c4e9238ef | 139 | |
yangcq88517 | 2:c7d984193741 | 140 | /** Check if tap east electrode is detected. |
yangcq88517 | 2:c7d984193741 | 141 | * |
yangcq88517 | 2:c7d984193741 | 142 | * @returns |
yangcq88517 | 2:c7d984193741 | 143 | * true qualified |
yangcq88517 | 2:c7d984193741 | 144 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 145 | */ |
yangcq88517 | 2:c7d984193741 | 146 | bool isTapEastElectrode(); |
yangcq88517 | 1:621c4e9238ef | 147 | |
yangcq88517 | 2:c7d984193741 | 148 | /** Check if tap center electrode is detected. |
yangcq88517 | 2:c7d984193741 | 149 | * |
yangcq88517 | 2:c7d984193741 | 150 | * @returns |
yangcq88517 | 2:c7d984193741 | 151 | * true qualified |
yangcq88517 | 2:c7d984193741 | 152 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 153 | */ |
yangcq88517 | 2:c7d984193741 | 154 | bool isTapCenterElectrode(); |
yangcq88517 | 1:621c4e9238ef | 155 | |
yangcq88517 | 2:c7d984193741 | 156 | /** Check if double tap south electrode is detected. |
yangcq88517 | 2:c7d984193741 | 157 | * |
yangcq88517 | 2:c7d984193741 | 158 | * @returns |
yangcq88517 | 2:c7d984193741 | 159 | * true qualified |
yangcq88517 | 2:c7d984193741 | 160 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 161 | */ |
yangcq88517 | 2:c7d984193741 | 162 | bool isDoubleTapSouthElectrode(); |
yangcq88517 | 1:621c4e9238ef | 163 | |
yangcq88517 | 2:c7d984193741 | 164 | /** Check if double tap west electrode is detected. |
yangcq88517 | 2:c7d984193741 | 165 | * |
yangcq88517 | 2:c7d984193741 | 166 | * @returns |
yangcq88517 | 2:c7d984193741 | 167 | * true qualified |
yangcq88517 | 2:c7d984193741 | 168 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 169 | */ |
yangcq88517 | 2:c7d984193741 | 170 | bool isDoubleTapWestElectrode(); |
yangcq88517 | 1:621c4e9238ef | 171 | |
yangcq88517 | 2:c7d984193741 | 172 | /** Check if double tap north electrode is detected. |
yangcq88517 | 2:c7d984193741 | 173 | * |
yangcq88517 | 2:c7d984193741 | 174 | * @returns |
yangcq88517 | 2:c7d984193741 | 175 | * true qualified |
yangcq88517 | 2:c7d984193741 | 176 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 177 | */ |
yangcq88517 | 2:c7d984193741 | 178 | bool isDoubleTapNorthElectrode(); |
yangcq88517 | 1:621c4e9238ef | 179 | |
yangcq88517 | 2:c7d984193741 | 180 | /** Check if double tap east electrode is detected. |
yangcq88517 | 2:c7d984193741 | 181 | * |
yangcq88517 | 2:c7d984193741 | 182 | * @returns |
yangcq88517 | 2:c7d984193741 | 183 | * true qualified |
yangcq88517 | 2:c7d984193741 | 184 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 185 | */ |
yangcq88517 | 2:c7d984193741 | 186 | bool isDoubleTapEastElectrode(); |
yangcq88517 | 1:621c4e9238ef | 187 | |
yangcq88517 | 2:c7d984193741 | 188 | /** Check if double tap center electrode is detected. |
yangcq88517 | 2:c7d984193741 | 189 | * |
yangcq88517 | 2:c7d984193741 | 190 | * @returns |
yangcq88517 | 2:c7d984193741 | 191 | * true qualified |
yangcq88517 | 2:c7d984193741 | 192 | * false not qualified |
yangcq88517 | 2:c7d984193741 | 193 | */ |
yangcq88517 | 2:c7d984193741 | 194 | bool isDoubleTapCenterElectrode(); |
yangcq88517 | 1:621c4e9238ef | 195 | }; |
yangcq88517 | 1:621c4e9238ef | 196 | |
yangcq88517 | 1:621c4e9238ef | 197 | #endif |