Read data from an ADIS16355 IMU and write it to the USB port.

Dependencies:   mbed

Revision:
0:c6ee363ac724
diff -r 000000000000 -r c6ee363ac724 imu-spi.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imu-spi.h	Wed Aug 10 21:50:36 2011 +0000
@@ -0,0 +1,31 @@
+//
+// imu-spi.h
+//
+// copyright 2010 Hugh Shane
+//
+
+class ImuSpi {
+private:
+    const static int bufferSize = 7;
+    int16_t buffer[2][bufferSize]; // ping-pong IMU data buffer
+    unsigned pingpong;
+    bool dataReady;
+    SPI spi; 
+    DigitalOut cs; 
+    DigitalOut reset; 
+    DigitalOut diag; 
+    InterruptIn imuDataReady;
+    void InitImu(void);
+    void DataReadyISR(void);
+    int16_t Read(char);
+    void Write(char, char);        
+    void TogglePingpong() {pingpong = (~pingpong) & 1U;}; 
+    int16_t* GetBufferWritePtr() {return buffer[pingpong & 1U];};
+public:
+    ImuSpi(void);  
+    void BurstRead(void);
+    int16_t* GetBufferReadPtr() {return buffer[(~pingpong) & 1U];};    
+    bool IsDataReady(void);
+    int GetBufferSize(void) {return bufferSize*sizeof(int16_t);};
+    void reinitInterrupts(void);
+};
\ No newline at end of file