Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal by
Diff: inc/drivers/MicroBitAccelerometer.h
- Revision:
- 39:112df23f039f
- Parent:
- 38:1a9e8e5e23f2
- Child:
- 40:948486a56c9d
diff -r 1a9e8e5e23f2 -r 112df23f039f inc/drivers/MicroBitAccelerometer.h
--- 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
