Example of 6D orientation recognition for LSM6DSL in X-NUCLEO-IKS01A2

Dependencies:   X_NUCLEO_IKS01A2 mbed

Fork of 6DOrientation_IKS01A2 by ST Expansion SW Team

6D Orientation Demo Application based on sensor expansion board X-NUCLEO-IKS01A2

Main function is to show how to use sensor expansion board to find out the 6D orientation and send data using UART to a connected PC or Desktop and display it on terminal applications like TeraTerm.
After connection has been established:
- the user can rotate the board to change the 6D orientation and then view the data using an hyper terminal.
- the user button can be used to display the current 6D orientation.

Revision:
7:d598eeaedcbd
Parent:
6:f215defe10e4
Child:
8:459b84a5287b
--- a/main.cpp	Wed Nov 23 16:44:59 2016 +0000
+++ b/main.cpp	Thu Nov 24 16:44:18 2016 +0000
@@ -49,19 +49,19 @@
 InterruptIn mybutton(USER_BUTTON);
 DigitalOut myled(LED1);
 
-volatile int orientation = 0;
+volatile int mems_event = 0;
 volatile int send_orientation_request = 0;
 
-void pressed();
-void orientation_cb();
-void sendOrientation( void );
+void pressed_cb();
+void INT1_cb();
+void sendOrientation();
 
 /* Simple main function */
 int main() {
   /* Attach callback to User button press */
-  mybutton.fall(&pressed);
+  mybutton.fall(&pressed_cb);
   /* Attach callback to LSM6DSL INT1 */
-  acc_gyro->AttachINT1IRQ(&orientation_cb);
+  acc_gyro->AttachINT1IRQ(&INT1_cb);
 
   /* Enable LSM6DSL accelerometer */
   acc_gyro->Enable_X();
@@ -71,8 +71,8 @@
   printf("\r\n--- Starting new run ---\r\n");
  
   while(1) {
-    if (orientation) {
-      orientation = 0;
+    if (mems_event) {
+      mems_event = 0;
       LSM6DSL_Event_Status_t status;
       acc_gyro->Get_Event_Status(&status);
       if (status.D6DOrientationStatus) {
@@ -93,15 +93,15 @@
   }
 }
 
-void pressed() {
+void pressed_cb() {
   send_orientation_request = 1;
 }
 
-void orientation_cb() {
-  orientation = 1;
+void INT1_cb() {
+  mems_event = 1;
 }
 
-void sendOrientation( void ) {
+void sendOrientation() {
   uint8_t xl = 0;
   uint8_t xh = 0;
   uint8_t yl = 0;