interface class for an inertial measurement unit that uses a serial protocol.

Dependencies:   mbed

Revision:
0:fd1fce2347d9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3DM-GX2.h	Tue Aug 31 04:38:14 2010 +0000
@@ -0,0 +1,31 @@
+#ifndef MS3DMGX2Library
+#define MS3DMGX2Library
+
+#include "stdint.h"
+#include "mbed.h"
+
+class MS3DMGX2
+{
+    private:
+        Serial DataLines;
+
+        unsigned char ModeCommand;
+        unsigned char ModeLength;
+        unsigned char ModeSync;
+        unsigned char Workspace[72];
+        float* InterruptBuffer;
+
+        void Interrupt();
+        void CheckSum(unsigned char Header, unsigned char Length,
+            unsigned char* Data, unsigned char* Timer, unsigned char* Result);
+
+    public:
+        MS3DMGX2(PinName tx, PinName rx);
+        unsigned char Mode(unsigned char Selection);
+        void AttachInterruptBuffer(float* Buffer);
+        void RequestSyncRead();
+        void DiscardSerialBuffer();
+        unsigned char Read(float* Data);
+};
+
+#endif
\ No newline at end of file