The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller
Dependents: NucleoMGC3130 i2c_master
RuntimeParameter/OutputEnable.cpp@8:de7934ec7ea2, 2015-11-14 (annotated)
- Committer:
- yangcq88517
- Date:
- Sat Nov 14 15:44:44 2015 +0000
- Revision:
- 8:de7934ec7ea2
- Parent:
- 2:c7d984193741
change to unsigned char array
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangcq88517 | 1:621c4e9238ef | 1 | #include "OutputEnable.h" |
yangcq88517 | 1:621c4e9238ef | 2 | |
yangcq88517 | 1:621c4e9238ef | 3 | OutputEnable::OutputEnable() |
yangcq88517 | 1:621c4e9238ef | 4 | { |
yangcq88517 | 1:621c4e9238ef | 5 | setRuntimeParameterID(0xA0); |
yangcq88517 | 1:621c4e9238ef | 6 | } |
yangcq88517 | 1:621c4e9238ef | 7 | |
yangcq88517 | 1:621c4e9238ef | 8 | OutputEnable * OutputEnable::enableDSPStatus(bool enable) |
yangcq88517 | 1:621c4e9238ef | 9 | { |
yangcq88517 | 1:621c4e9238ef | 10 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 11 | value[4] |= 0x01; |
yangcq88517 | 1:621c4e9238ef | 12 | else value[4] &= 0xFE; |
yangcq88517 | 2:c7d984193741 | 13 | value[8] |= 0x01; |
yangcq88517 | 1:621c4e9238ef | 14 | return this; |
yangcq88517 | 1:621c4e9238ef | 15 | } |
yangcq88517 | 1:621c4e9238ef | 16 | |
yangcq88517 | 1:621c4e9238ef | 17 | OutputEnable * OutputEnable::enableGestureData(bool enable) |
yangcq88517 | 1:621c4e9238ef | 18 | { |
yangcq88517 | 1:621c4e9238ef | 19 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 20 | value[4] |= 0x02; |
yangcq88517 | 1:621c4e9238ef | 21 | else value[4] &= 0xFD; |
yangcq88517 | 2:c7d984193741 | 22 | value[8] |= 0x02; |
yangcq88517 | 1:621c4e9238ef | 23 | return this; |
yangcq88517 | 1:621c4e9238ef | 24 | } |
yangcq88517 | 1:621c4e9238ef | 25 | |
yangcq88517 | 1:621c4e9238ef | 26 | OutputEnable * OutputEnable::enableTouchInfo(bool enable) |
yangcq88517 | 1:621c4e9238ef | 27 | { |
yangcq88517 | 1:621c4e9238ef | 28 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 29 | value[4] |= 0x04; |
yangcq88517 | 1:621c4e9238ef | 30 | else value[4] &= 0xFB; |
yangcq88517 | 2:c7d984193741 | 31 | value[8] |= 0x04; |
yangcq88517 | 1:621c4e9238ef | 32 | return this; |
yangcq88517 | 1:621c4e9238ef | 33 | } |
yangcq88517 | 1:621c4e9238ef | 34 | |
yangcq88517 | 1:621c4e9238ef | 35 | OutputEnable * OutputEnable::enableAirWheelInfo(bool enable) |
yangcq88517 | 1:621c4e9238ef | 36 | { |
yangcq88517 | 1:621c4e9238ef | 37 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 38 | value[4] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 39 | else value[4] &= 0xF7; |
yangcq88517 | 2:c7d984193741 | 40 | value[8] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 41 | return this; |
yangcq88517 | 1:621c4e9238ef | 42 | } |
yangcq88517 | 1:621c4e9238ef | 43 | |
yangcq88517 | 1:621c4e9238ef | 44 | OutputEnable * OutputEnable::enablexyzPosition(bool enable) |
yangcq88517 | 1:621c4e9238ef | 45 | { |
yangcq88517 | 1:621c4e9238ef | 46 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 47 | value[4] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 48 | else value[4] &= 0xEF; |
yangcq88517 | 2:c7d984193741 | 49 | value[8] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 50 | return this; |
yangcq88517 | 1:621c4e9238ef | 51 | } |
yangcq88517 | 1:621c4e9238ef | 52 | |
yangcq88517 | 1:621c4e9238ef | 53 | OutputEnable * OutputEnable::enableNoisePower(bool enable) |
yangcq88517 | 1:621c4e9238ef | 54 | { |
yangcq88517 | 1:621c4e9238ef | 55 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 56 | value[4] |= 0x20; |
yangcq88517 | 1:621c4e9238ef | 57 | else value[4] &= 0xDF; |
yangcq88517 | 2:c7d984193741 | 58 | value[8] |= 0x20; |
yangcq88517 | 1:621c4e9238ef | 59 | return this; |
yangcq88517 | 1:621c4e9238ef | 60 | } |
yangcq88517 | 1:621c4e9238ef | 61 | |
yangcq88517 | 1:621c4e9238ef | 62 | OutputEnable * OutputEnable::enableUncalibratedSignal(bool enable) |
yangcq88517 | 1:621c4e9238ef | 63 | { |
yangcq88517 | 1:621c4e9238ef | 64 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 65 | value[5] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 66 | else value[5] &= 0xF7; |
yangcq88517 | 2:c7d984193741 | 67 | value[9] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 68 | return this; |
yangcq88517 | 1:621c4e9238ef | 69 | } |
yangcq88517 | 1:621c4e9238ef | 70 | |
yangcq88517 | 1:621c4e9238ef | 71 | OutputEnable * OutputEnable::enableSignalDeviation(bool enable) |
yangcq88517 | 1:621c4e9238ef | 72 | { |
yangcq88517 | 1:621c4e9238ef | 73 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 74 | value[5] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 75 | else value[5] &= 0xEF; |
yangcq88517 | 2:c7d984193741 | 76 | value[9] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 77 | return this; |
yangcq88517 | 1:621c4e9238ef | 78 | } |
yangcq88517 | 1:621c4e9238ef | 79 | |
yangcq88517 | 1:621c4e9238ef | 80 | OutputEnable * OutputEnable::enableEnvironmentalNoise(bool enable) |
yangcq88517 | 1:621c4e9238ef | 81 | { |
yangcq88517 | 1:621c4e9238ef | 82 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 83 | value[6] |= 0x01; |
yangcq88517 | 1:621c4e9238ef | 84 | else value[6] &= 0xFE; |
yangcq88517 | 2:c7d984193741 | 85 | value[10] |= 0x01; |
yangcq88517 | 1:621c4e9238ef | 86 | return this; |
yangcq88517 | 1:621c4e9238ef | 87 | } |
yangcq88517 | 1:621c4e9238ef | 88 | |
yangcq88517 | 1:621c4e9238ef | 89 | OutputEnable * OutputEnable::enableClipping(bool enable) |
yangcq88517 | 1:621c4e9238ef | 90 | { |
yangcq88517 | 1:621c4e9238ef | 91 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 92 | value[6] |= 0x02; |
yangcq88517 | 1:621c4e9238ef | 93 | else value[6] &= 0xFD; |
yangcq88517 | 2:c7d984193741 | 94 | value[10] |= 0x02; |
yangcq88517 | 1:621c4e9238ef | 95 | return this; |
yangcq88517 | 1:621c4e9238ef | 96 | } |
yangcq88517 | 1:621c4e9238ef | 97 | |
yangcq88517 | 1:621c4e9238ef | 98 | OutputEnable * OutputEnable::enableDSP(bool enable) |
yangcq88517 | 1:621c4e9238ef | 99 | { |
yangcq88517 | 1:621c4e9238ef | 100 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 101 | value[6] |= 0x04; |
yangcq88517 | 1:621c4e9238ef | 102 | else value[6] &= 0xFB; |
yangcq88517 | 2:c7d984193741 | 103 | value[10] |= 0x04; |
yangcq88517 | 1:621c4e9238ef | 104 | return this; |
yangcq88517 | 1:621c4e9238ef | 105 | } |
yangcq88517 | 1:621c4e9238ef | 106 | |
yangcq88517 | 1:621c4e9238ef | 107 | //If set, the AirWheel counter is decimated by the factor of 4 |
yangcq88517 | 1:621c4e9238ef | 108 | OutputEnable * OutputEnable::enableAirWheelCounterDecimation(bool enable) |
yangcq88517 | 1:621c4e9238ef | 109 | { |
yangcq88517 | 1:621c4e9238ef | 110 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 111 | value[6] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 112 | else value[6] &= 0xF7; |
yangcq88517 | 2:c7d984193741 | 113 | value[10] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 114 | return this; |
yangcq88517 | 1:621c4e9238ef | 115 | } |
yangcq88517 | 1:621c4e9238ef | 116 | |
yangcq88517 | 1:621c4e9238ef | 117 | //This applies when AirWheel or Touch Detection is ongoing. If activated, a message will be sent when the counter in the payload element TimeStamp is overflowing (TimeStamp=0) |
yangcq88517 | 1:621c4e9238ef | 118 | OutputEnable * OutputEnable::enableTimeStampOverflow(bool enable) |
yangcq88517 | 1:621c4e9238ef | 119 | { |
yangcq88517 | 1:621c4e9238ef | 120 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 121 | value[6] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 122 | else value[6] &= 0xEF; |
yangcq88517 | 2:c7d984193741 | 123 | value[10] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 124 | return this; |
yangcq88517 | 1:621c4e9238ef | 125 | } |
yangcq88517 | 1:621c4e9238ef | 126 | |
yangcq88517 | 1:621c4e9238ef | 127 | //GesturesInfo status bits: If set to ‘1’, the reporting of a state change in the payload element GestureInfo is enabled. |
yangcq88517 | 1:621c4e9238ef | 128 | OutputEnable * OutputEnable::enableHandPresence(bool enable) |
yangcq88517 | 1:621c4e9238ef | 129 | { |
yangcq88517 | 1:621c4e9238ef | 130 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 131 | value[7] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 132 | else value[7] &= 0xF7; |
yangcq88517 | 2:c7d984193741 | 133 | value[11] |= 0x08; |
yangcq88517 | 1:621c4e9238ef | 134 | return this; |
yangcq88517 | 1:621c4e9238ef | 135 | } |
yangcq88517 | 1:621c4e9238ef | 136 | |
yangcq88517 | 1:621c4e9238ef | 137 | //GesturesInfo status bits: If set to ‘1’, the reporting of a state change in the payload element GestureInfo is enabled. |
yangcq88517 | 1:621c4e9238ef | 138 | OutputEnable * OutputEnable::enableHandHold(bool enable) |
yangcq88517 | 1:621c4e9238ef | 139 | { |
yangcq88517 | 1:621c4e9238ef | 140 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 141 | value[7] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 142 | else value[7] &= 0xEF; |
yangcq88517 | 2:c7d984193741 | 143 | value[11] |= 0x10; |
yangcq88517 | 1:621c4e9238ef | 144 | return this; |
yangcq88517 | 1:621c4e9238ef | 145 | } |
yangcq88517 | 1:621c4e9238ef | 146 | |
yangcq88517 | 1:621c4e9238ef | 147 | //GesturesInfo status bits: If set to ‘1’, the reporting of a state change in the payload element GestureInfo is enabled. |
yangcq88517 | 1:621c4e9238ef | 148 | OutputEnable * OutputEnable::enableHandInside(bool enable) |
yangcq88517 | 1:621c4e9238ef | 149 | { |
yangcq88517 | 1:621c4e9238ef | 150 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 151 | value[7] |= 0x20; |
yangcq88517 | 1:621c4e9238ef | 152 | else value[7] &= 0xDF; |
yangcq88517 | 2:c7d984193741 | 153 | value[11] |= 0x20; |
yangcq88517 | 1:621c4e9238ef | 154 | return this; |
yangcq88517 | 1:621c4e9238ef | 155 | } |
yangcq88517 | 1:621c4e9238ef | 156 | |
yangcq88517 | 1:621c4e9238ef | 157 | OutputEnable * OutputEnable::enableGestureInProgress(bool enable) |
yangcq88517 | 1:621c4e9238ef | 158 | { |
yangcq88517 | 1:621c4e9238ef | 159 | if (enable) |
yangcq88517 | 1:621c4e9238ef | 160 | value[7] |= 0x80; |
yangcq88517 | 1:621c4e9238ef | 161 | else value[7] &= 0x7F; |
yangcq88517 | 2:c7d984193741 | 162 | value[11] |= 0x80; |
yangcq88517 | 1:621c4e9238ef | 163 | return this; |
yangcq88517 | 1:621c4e9238ef | 164 | } |