mdot UDK & STMicro MEMS Shield Sensor packet example

Dependencies:   libmDot-mbed5 DOGS102 ISL29011 MMA845x MPL3115A2 NCP5623B X_NUCLEO_IKS01A1 Senet_Packet

Fork of MTDOT-UDKDemo_Senet by canuck lehead

Branch:
develop
Revision:
28:4fd8a894a403
Parent:
27:1753a44fa9ec
Child:
39:022b327d6bf0
--- a/board/udk/board_udk.cpp	Thu Aug 24 17:56:53 2017 -0400
+++ b/board/udk/board_udk.cpp	Fri Aug 25 09:29:01 2017 -0400
@@ -11,7 +11,7 @@
  */
 #if defined MTDOT_UDK
 
-#include "board.h"
+#include "board_udk.h"
 #include "x_nucleo_iks01a1.h"
 
 extern void mDotInit();
@@ -20,15 +20,20 @@
 static X_NUCLEO_IKS01A1 *mems_shield;
 
 
-void BoardInit()
+CBoardUDK::CBoardUDK()
 {
-	mems_shield = X_NUCLEO_IKS01A1::Instance(NULL, NC);
+	boardPtr = this;
 }
 
-void BoardStart() { }
-void BoardStop()  { }
+EBoardStatus CBoardUDK::init()
+{
+	CBoard::init();
+	mems_shield = X_NUCLEO_IKS01A1::Instance(NULL, NC);
 
-void BoardReadSensors(BoardSensorData &data)
+	return Board_Ok;
+}
+
+EBoardStatus CBoardUDK::readSensors ( BoardSensorData &data )
 {
     uint32_t ret = 0;
     int32_t  accel_data[3];
@@ -57,24 +62,25 @@
        // rightside up
        if(data.accel_z >= 750)
        {
-           data.orientation.horizontal = true;
+           // data.orientation.horizontal = true;
        }
        // upside down
        else if(data.accel_z <= -750)
        {
-           data.orientation.horizontal  = true;
-           data.orientation.down        = true;
+           data.orientation.down  = true;
            // position_value = (2 << 12) | (1 << 8);
        }
        // vertical down
        else if(data.accel_y >= 900 )
        {
-           data.orientation.down = true;
+           data.orientation.vertical = true;
+           data.orientation.down     = true;
        }
        // vertical up
        else if(data.accel_y <= -900 )
        {
-           data.orientation.up = true;
+           data.orientation.vertical = true;
+           data.orientation.up       = true;
        }
        // side right
        else if(data.accel_x > 900)
@@ -86,34 +92,9 @@
        {
            data.orientation.left = true;
        }
-
-       /*
-       if(horizontal)
-       {
-           next_value = (2 << 12) | (upsidedown << 8);
-       }
-       else
-       {
-           next_value = (up << 12) | (left << 8) | (down << 4) | right;
-       }
+   }
 
-       if(next_value != position_value)
-       {
-           position_value = next_value;
-           position_changed = true;
-
-           // Set reflected_value to an out of range value to stay
-           // in fast transmit mode until server responds
-           reflected_value = 0;
-
-            // Turn LED off to indicate server is not in agreement
-            SYNC_LED=SYNC_LED_OOS;
-       }
-       */
-   }
+   return Board_Ok;
 }
 
-
-bool BoardCheckForExit( bool exit ) { return false; }
-
 #endif