My fork
Dependencies: BLE_API mbed-dev-bin nRF51822-bluetooth-mdw
Fork of microbit-dal-bluetooth-mdw by
Diff: inc/drivers/MicroBitAccelerometer.h
- Revision:
- 39:112df23f039f
- Parent:
- 38:1a9e8e5e23f2
- Child:
- 40:948486a56c9d
--- a/inc/drivers/MicroBitAccelerometer.h Wed Jul 13 12:18:17 2016 +0100 +++ b/inc/drivers/MicroBitAccelerometer.h Wed Jul 13 12:18:18 2016 +0100 @@ -78,6 +78,7 @@ /** * Gesture events */ +#define MICROBIT_ACCELEROMETER_EVT_NONE 0 #define MICROBIT_ACCELEROMETER_EVT_TILT_UP 1 #define MICROBIT_ACCELEROMETER_EVT_TILT_DOWN 2 #define MICROBIT_ACCELEROMETER_EVT_TILT_LEFT 3 @@ -133,22 +134,6 @@ extern const MMA8653SampleRangeConfig MMA8653SampleRange[]; extern const MMA8653SampleRateConfig MMA8653SampleRate[]; -enum BasicGesture -{ - GESTURE_NONE, - GESTURE_UP, - GESTURE_DOWN, - GESTURE_LEFT, - GESTURE_RIGHT, - GESTURE_FACE_UP, - GESTURE_FACE_DOWN, - GESTURE_FREEFALL, - GESTURE_3G, - GESTURE_6G, - GESTURE_8G, - GESTURE_SHAKE -}; - struct ShakeHistory { uint16_t shaken:1, @@ -181,8 +166,8 @@ float roll; // Roll of the device, in radians. uint8_t sigma; // the number of ticks that the instantaneous gesture has been stable. uint8_t impulseSigma; // the number of ticks since an impulse event has been generated. - BasicGesture lastGesture; // the last, stable gesture recorded. - BasicGesture currentGesture; // the instantaneous, unfiltered gesture detected. + uint16_t lastGesture; // the last, stable gesture recorded. + uint16_t currentGesture; // the instantaneous, unfiltered gesture detected. ShakeHistory shake; // State information needed to detect shake events. public: @@ -382,7 +367,7 @@ * display.scroll("SHAKE!"); * @endcode */ - BasicGesture getGesture(); + uint16_t getGesture(); /** * A periodic callback invoked by the fiber scheduler idle thread. @@ -466,7 +451,7 @@ * * @return A 'best guess' of the current posture of the device, based on instanataneous data. */ - BasicGesture instantaneousPosture(); + uint16_t instantaneousPosture(); }; #endif \ No newline at end of file