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/board.h	Thu Aug 24 17:56:53 2017 -0400
+++ b/board/board.h	Fri Aug 25 09:29:01 2017 -0400
@@ -12,11 +12,11 @@
 #define BOARD_BOARD_H_
 
 #include "mbed.h"
-#include "mdot.h"
+#include "mDot.h"
 
 extern Serial     debugUART;
-extern mDot      *mDotPtr;
 extern DigitalOut appLED;
+extern mDot       *mDotPtr;
 
 enum EBoardState
 {
@@ -27,7 +27,7 @@
 
 struct BoardOrientation
 {
-	bool horizontal;
+	bool vertical;
 	bool up;
 	bool down;
 	bool right;
@@ -35,11 +35,11 @@
 
 	void init()
 	{
-		horizontal = false;
-		up         = false;
-		down       = false;
-		right      = false;
-		left       = false;
+		vertical = false;
+		up       = false;
+		down     = false;
+		right    = false;
+		left     = false;
 	}
 
 	BoardOrientation() { init(); }
@@ -70,10 +70,32 @@
     BoardSensorData() { init(); }
 };
 
+enum EBoardStatus
+{
+	Board_Ok,
+	Board_Fail
+};
 
-extern void BoardSetState( EBoardState state );
-extern bool BoardCheckForExit( bool exit );
-extern void BoardReadSensors( BoardSensorData &sensorData);
+EBoardStatus BoardInit();
+
+class CBoard
+{
+	public:
+
+		static EBoardStatus ReadSensors(BoardSensorData  &data ) { return (  ( boardPtr != 0 ) ? boardPtr->readSensors( data ) : Board_Fail ); }
+		static EBoardStatus Init()                               { return (  ( boardPtr != 0 ) ? boardPtr->init( )  : Board_Fail ); }
+		static EBoardStatus Start()                              { return (  ( boardPtr != 0 ) ? boardPtr->start( ) : Board_Fail ); }
 
+	protected:
+
+		virtual EBoardStatus init();
+
+		virtual EBoardStatus readSensors ( BoardSensorData &data ) { return Board_Fail; }
+		virtual EBoardStatus start()                               { return Board_Ok;   }
+
+		static CBoard *boardPtr;
+
+		friend EBoardStatus BoardInit();
+};
 
 #endif /* BOARD_BOARD_H_ */