The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller
Dependents: NucleoMGC3130 i2c_master
RuntimeParameter/GestureProcessing.h@8:de7934ec7ea2, 2015-11-14 (annotated)
- Committer:
- yangcq88517
- Date:
- Sat Nov 14 15:44:44 2015 +0000
- Revision:
- 8:de7934ec7ea2
- Parent:
- 3:b657bfcffc0a
change to unsigned char array
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangcq88517 | 3:b657bfcffc0a | 1 | #ifndef UK_AC_HERTS_SMARTLAB_MGC3130_GestureProcessing |
yangcq88517 | 3:b657bfcffc0a | 2 | #define UK_AC_HERTS_SMARTLAB_MGC3130_GestureProcessing |
yangcq88517 | 3:b657bfcffc0a | 3 | |
yangcq88517 | 3:b657bfcffc0a | 4 | #include "Parameter.h" |
yangcq88517 | 3:b657bfcffc0a | 5 | |
yangcq88517 | 3:b657bfcffc0a | 6 | /** |
yangcq88517 | 3:b657bfcffc0a | 7 | *This parameter enables the in-built gestures. Disabling one gesture will increase the |
yangcq88517 | 3:b657bfcffc0a | 8 | *recognition probability of the others. |
yangcq88517 | 3:b657bfcffc0a | 9 | *If a bit in Argument0 is set To ‘1’, the respective Gesture will be enabled. If a bit in |
yangcq88517 | 3:b657bfcffc0a | 10 | *Argument0 is set To ‘0’, the respective Gesture will be disabled. |
yangcq88517 | 3:b657bfcffc0a | 11 | */ |
yangcq88517 | 3:b657bfcffc0a | 12 | class GestureProcessing: public Parameter |
yangcq88517 | 3:b657bfcffc0a | 13 | { |
yangcq88517 | 3:b657bfcffc0a | 14 | public: |
yangcq88517 | 3:b657bfcffc0a | 15 | GestureProcessing() { |
yangcq88517 | 3:b657bfcffc0a | 16 | setRuntimeParameterID(0x85); |
yangcq88517 | 3:b657bfcffc0a | 17 | } |
yangcq88517 | 3:b657bfcffc0a | 18 | |
yangcq88517 | 3:b657bfcffc0a | 19 | void enableGarbageModel(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 20 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 21 | value[4] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 22 | else value[4] &= 0xFE; |
yangcq88517 | 3:b657bfcffc0a | 23 | value[8] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 24 | } |
yangcq88517 | 3:b657bfcffc0a | 25 | |
yangcq88517 | 3:b657bfcffc0a | 26 | void enableFlickWesToEast(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 27 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 28 | value[4] |= 0x02; |
yangcq88517 | 3:b657bfcffc0a | 29 | else value[4] &= 0xFD; |
yangcq88517 | 3:b657bfcffc0a | 30 | value[8] |= 0x02; |
yangcq88517 | 3:b657bfcffc0a | 31 | } |
yangcq88517 | 3:b657bfcffc0a | 32 | |
yangcq88517 | 3:b657bfcffc0a | 33 | void enableFlickEastToWest(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 34 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 35 | value[4] |= 0x04; |
yangcq88517 | 3:b657bfcffc0a | 36 | else value[4] &= 0xFB; |
yangcq88517 | 3:b657bfcffc0a | 37 | value[8] |= 0x04; |
yangcq88517 | 3:b657bfcffc0a | 38 | } |
yangcq88517 | 3:b657bfcffc0a | 39 | |
yangcq88517 | 3:b657bfcffc0a | 40 | void enableFlickSouthToNorth(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 41 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 42 | value[4] |= 0x08; |
yangcq88517 | 3:b657bfcffc0a | 43 | else value[4] &= 0xF7; |
yangcq88517 | 3:b657bfcffc0a | 44 | value[8] |= 0x08; |
yangcq88517 | 3:b657bfcffc0a | 45 | } |
yangcq88517 | 3:b657bfcffc0a | 46 | |
yangcq88517 | 3:b657bfcffc0a | 47 | void enableFlickNorthToSouth(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 48 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 49 | value[4] |= 0x10; |
yangcq88517 | 3:b657bfcffc0a | 50 | else value[4] &= 0xEF; |
yangcq88517 | 3:b657bfcffc0a | 51 | value[8] |= 0x10; |
yangcq88517 | 3:b657bfcffc0a | 52 | } |
yangcq88517 | 3:b657bfcffc0a | 53 | |
yangcq88517 | 3:b657bfcffc0a | 54 | void enableCircleClockwise(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 55 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 56 | value[4] |= 0x20; |
yangcq88517 | 3:b657bfcffc0a | 57 | else value[4] &= 0xDF; |
yangcq88517 | 3:b657bfcffc0a | 58 | value[8] |= 0x20; |
yangcq88517 | 3:b657bfcffc0a | 59 | } |
yangcq88517 | 3:b657bfcffc0a | 60 | |
yangcq88517 | 3:b657bfcffc0a | 61 | void enableCircleCounterclockwise(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 62 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 63 | value[4] |= 0x40; |
yangcq88517 | 3:b657bfcffc0a | 64 | else value[4] &= 0xBF; |
yangcq88517 | 3:b657bfcffc0a | 65 | value[8] |= 0x40; |
yangcq88517 | 3:b657bfcffc0a | 66 | } |
yangcq88517 | 3:b657bfcffc0a | 67 | |
yangcq88517 | 3:b657bfcffc0a | 68 | void enableWaveX(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 69 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 70 | value[4] |= 0x80; |
yangcq88517 | 3:b657bfcffc0a | 71 | else value[4] &= 0x7F; |
yangcq88517 | 3:b657bfcffc0a | 72 | value[8] |= 0x80; |
yangcq88517 | 3:b657bfcffc0a | 73 | } |
yangcq88517 | 3:b657bfcffc0a | 74 | |
yangcq88517 | 3:b657bfcffc0a | 75 | void enableWaveY(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 76 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 77 | value[5] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 78 | else value[5] &= 0xFE; |
yangcq88517 | 3:b657bfcffc0a | 79 | value[9] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 80 | } |
yangcq88517 | 3:b657bfcffc0a | 81 | |
yangcq88517 | 3:b657bfcffc0a | 82 | void enableHoldGesture(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 83 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 84 | value[6] |= 0x40; |
yangcq88517 | 3:b657bfcffc0a | 85 | else value[6] &= 0xBF; |
yangcq88517 | 3:b657bfcffc0a | 86 | value[10] |= 0x40; |
yangcq88517 | 3:b657bfcffc0a | 87 | } |
yangcq88517 | 3:b657bfcffc0a | 88 | |
yangcq88517 | 3:b657bfcffc0a | 89 | void enablePresenceGesture(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 90 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 91 | value[6] |= 0x80; |
yangcq88517 | 3:b657bfcffc0a | 92 | else value[6] &= 0x7F; |
yangcq88517 | 3:b657bfcffc0a | 93 | value[10] |= 0x80; |
yangcq88517 | 3:b657bfcffc0a | 94 | } |
yangcq88517 | 3:b657bfcffc0a | 95 | |
yangcq88517 | 3:b657bfcffc0a | 96 | void enableEdgeFlickWestToEast(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 97 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 98 | value[7] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 99 | else value[7] &= 0xFE; |
yangcq88517 | 3:b657bfcffc0a | 100 | value[11] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 101 | } |
yangcq88517 | 3:b657bfcffc0a | 102 | |
yangcq88517 | 3:b657bfcffc0a | 103 | void enableEdgeFlickEastToWest(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 104 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 105 | value[7] |= 0x02; |
yangcq88517 | 3:b657bfcffc0a | 106 | else value[7] &= 0xFD; |
yangcq88517 | 3:b657bfcffc0a | 107 | value[11] |= 0x02; |
yangcq88517 | 3:b657bfcffc0a | 108 | } |
yangcq88517 | 3:b657bfcffc0a | 109 | |
yangcq88517 | 3:b657bfcffc0a | 110 | void enableEdgeFlickSouthToNorth(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 111 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 112 | value[7] |= 0x04; |
yangcq88517 | 3:b657bfcffc0a | 113 | else value[7] &= 0xFB; |
yangcq88517 | 3:b657bfcffc0a | 114 | value[11] |= 0x04; |
yangcq88517 | 3:b657bfcffc0a | 115 | } |
yangcq88517 | 3:b657bfcffc0a | 116 | |
yangcq88517 | 3:b657bfcffc0a | 117 | void enableEdgeFlickNorthToSouth(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 118 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 119 | value[7] |= 0x08; |
yangcq88517 | 3:b657bfcffc0a | 120 | else value[7] &= 0xF7; |
yangcq88517 | 3:b657bfcffc0a | 121 | value[11] |= 0x08; |
yangcq88517 | 3:b657bfcffc0a | 122 | } |
yangcq88517 | 3:b657bfcffc0a | 123 | |
yangcq88517 | 3:b657bfcffc0a | 124 | void enableDoubleFlickWestToEast(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 125 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 126 | value[7] |= 0x10; |
yangcq88517 | 3:b657bfcffc0a | 127 | else value[7] &= 0xEF; |
yangcq88517 | 3:b657bfcffc0a | 128 | value[11] |= 0x10; |
yangcq88517 | 3:b657bfcffc0a | 129 | } |
yangcq88517 | 3:b657bfcffc0a | 130 | |
yangcq88517 | 3:b657bfcffc0a | 131 | void enableDoubleFlickEastToWest(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 132 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 133 | value[7] |= 0x20; |
yangcq88517 | 3:b657bfcffc0a | 134 | else value[7] &= 0xDF; |
yangcq88517 | 3:b657bfcffc0a | 135 | value[11] |= 0x20; |
yangcq88517 | 3:b657bfcffc0a | 136 | } |
yangcq88517 | 3:b657bfcffc0a | 137 | |
yangcq88517 | 3:b657bfcffc0a | 138 | void enableDoubleFlickSouthToNorth(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 139 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 140 | value[7] |= 0x40; |
yangcq88517 | 3:b657bfcffc0a | 141 | else value[7] &= 0xBF; |
yangcq88517 | 3:b657bfcffc0a | 142 | value[11] |= 0x40; |
yangcq88517 | 3:b657bfcffc0a | 143 | } |
yangcq88517 | 3:b657bfcffc0a | 144 | |
yangcq88517 | 3:b657bfcffc0a | 145 | void enableDoubleFlickNorthToSouth(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 146 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 147 | value[7] |= 0x80; |
yangcq88517 | 3:b657bfcffc0a | 148 | else value[7] &= 0x7F; |
yangcq88517 | 3:b657bfcffc0a | 149 | value[11] |= 0x80; |
yangcq88517 | 3:b657bfcffc0a | 150 | } |
yangcq88517 | 3:b657bfcffc0a | 151 | }; |
yangcq88517 | 3:b657bfcffc0a | 152 | |
yangcq88517 | 3:b657bfcffc0a | 153 | #endif |