The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller
Dependents: NucleoMGC3130 i2c_master
RuntimeParameter/CalibrationMode.h@3:b657bfcffc0a, 2015-10-08 (annotated)
- Committer:
- yangcq88517
- Date:
- Thu Oct 08 17:37:33 2015 +0000
- Revision:
- 3:b657bfcffc0a
bug fix, add some runtime message
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangcq88517 | 3:b657bfcffc0a | 1 | #ifndef UK_AC_HERTS_SMARTLAB_MGC3130_CalibrationMode |
yangcq88517 | 3:b657bfcffc0a | 2 | #define UK_AC_HERTS_SMARTLAB_MGC3130_CalibrationMode |
yangcq88517 | 3:b657bfcffc0a | 3 | |
yangcq88517 | 3:b657bfcffc0a | 4 | #include "Parameter.h" |
yangcq88517 | 3:b657bfcffc0a | 5 | |
yangcq88517 | 3:b657bfcffc0a | 6 | /** This parameter enables/disables the selected auto-calibration feature. |
yangcq88517 | 3:b657bfcffc0a | 7 | *If a bit in Argument0 is set to ‘0’, the respective auto-calibration feature will be enabled. |
yangcq88517 | 3:b657bfcffc0a | 8 | *If a bit in Argument0 is set to ‘1’ the respective auto-calibration feature will be disabled. |
yangcq88517 | 3:b657bfcffc0a | 9 | */ |
yangcq88517 | 3:b657bfcffc0a | 10 | class CalibrationMode: public Parameter |
yangcq88517 | 3:b657bfcffc0a | 11 | { |
yangcq88517 | 3:b657bfcffc0a | 12 | public: |
yangcq88517 | 3:b657bfcffc0a | 13 | CalibrationMode() { |
yangcq88517 | 3:b657bfcffc0a | 14 | setRuntimeParameterID(0x80); |
yangcq88517 | 3:b657bfcffc0a | 15 | } |
yangcq88517 | 3:b657bfcffc0a | 16 | |
yangcq88517 | 3:b657bfcffc0a | 17 | /// Enable/disable gesture-triggered calibration. |
yangcq88517 | 3:b657bfcffc0a | 18 | void enableGestureTriggered(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 19 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 20 | value[4] |= 0xFE; |
yangcq88517 | 3:b657bfcffc0a | 21 | else value[4] &= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 22 | value[8] |= 0x01; |
yangcq88517 | 3:b657bfcffc0a | 23 | } |
yangcq88517 | 3:b657bfcffc0a | 24 | |
yangcq88517 | 3:b657bfcffc0a | 25 | /// Enable/disable negative calibration. |
yangcq88517 | 3:b657bfcffc0a | 26 | void enableNegative(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 27 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 28 | value[4] |= 0xFD; |
yangcq88517 | 3:b657bfcffc0a | 29 | else value[4] &= 0x02; |
yangcq88517 | 3:b657bfcffc0a | 30 | value[8] |= 0x02; |
yangcq88517 | 3:b657bfcffc0a | 31 | } |
yangcq88517 | 3:b657bfcffc0a | 32 | |
yangcq88517 | 3:b657bfcffc0a | 33 | /// Enable/disable idle calibration. |
yangcq88517 | 3:b657bfcffc0a | 34 | void enableIdle(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 35 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 36 | value[4] |= 0xFB; |
yangcq88517 | 3:b657bfcffc0a | 37 | else value[4] &= 0x04; |
yangcq88517 | 3:b657bfcffc0a | 38 | value[8] |= 0x04; |
yangcq88517 | 3:b657bfcffc0a | 39 | } |
yangcq88517 | 3:b657bfcffc0a | 40 | |
yangcq88517 | 3:b657bfcffc0a | 41 | /// Enable/disable invalidity value calibration, if values are completely out of range. |
yangcq88517 | 3:b657bfcffc0a | 42 | void enableInvalidityValue(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 43 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 44 | value[4] |= 0xF7; |
yangcq88517 | 3:b657bfcffc0a | 45 | else value[4] &= 0x08; |
yangcq88517 | 3:b657bfcffc0a | 46 | value[8] |= 0x08; |
yangcq88517 | 3:b657bfcffc0a | 47 | } |
yangcq88517 | 3:b657bfcffc0a | 48 | |
yangcq88517 | 3:b657bfcffc0a | 49 | /// Enable/disable calibration triggered by AFA |
yangcq88517 | 3:b657bfcffc0a | 50 | void enableTriggeredAFA(bool enable) { |
yangcq88517 | 3:b657bfcffc0a | 51 | if (enable) |
yangcq88517 | 3:b657bfcffc0a | 52 | value[4] |= 0xEF; |
yangcq88517 | 3:b657bfcffc0a | 53 | else value[4] &= 0x10; |
yangcq88517 | 3:b657bfcffc0a | 54 | value[8] |= 0x10; |
yangcq88517 | 3:b657bfcffc0a | 55 | } |
yangcq88517 | 3:b657bfcffc0a | 56 | }; |
yangcq88517 | 3:b657bfcffc0a | 57 | |
yangcq88517 | 3:b657bfcffc0a | 58 | #endif |