Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
imu-spi.h
00001 // 00002 // imu-spi.h 00003 // 00004 // copyright 2010 Hugh Shane 00005 // 00006 00007 class ImuSpi { 00008 private: 00009 const static int bufferSize = 7; 00010 int16_t buffer[2][bufferSize]; // ping-pong IMU data buffer 00011 unsigned pingpong; 00012 bool dataReady; 00013 SPI spi; 00014 DigitalOut cs; 00015 DigitalOut reset; 00016 DigitalOut diag; 00017 InterruptIn imuDataReady; 00018 void InitImu(void); 00019 void DataReadyISR(void); 00020 int16_t Read(char); 00021 void Write(char, char); 00022 void TogglePingpong() {pingpong = (~pingpong) & 1U;}; 00023 int16_t* GetBufferWritePtr() {return buffer[pingpong & 1U];}; 00024 public: 00025 ImuSpi(void); 00026 void BurstRead(void); 00027 int16_t* GetBufferReadPtr() {return buffer[(~pingpong) & 1U];}; 00028 bool IsDataReady(void); 00029 int GetBufferSize(void) {return bufferSize*sizeof(int16_t);}; 00030 void reinitInterrupts(void); 00031 };
Generated on Sat Jul 16 2022 14:16:22 by
1.7.2