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

Dependencies:   mbed

3DM-GX2.h

Committer:
Blaze513
Date:
2010-08-31
Revision:
0:fd1fce2347d9

File content as of revision 0:fd1fce2347d9:

#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