A library to read from an Epson IMU
IMU.h@0:b4479b51578c, 2013-11-28 (annotated)
- Committer:
- GijsB
- Date:
- Thu Nov 28 15:14:40 2013 +0000
- Revision:
- 0:b4479b51578c
- Child:
- 1:a2b5b17c949d
eerste;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GijsB | 0:b4479b51578c | 1 | #ifndef IMU_H |
GijsB | 0:b4479b51578c | 2 | #define IMU_H |
GijsB | 0:b4479b51578c | 3 | |
GijsB | 0:b4479b51578c | 4 | #include "mbed.h" |
GijsB | 0:b4479b51578c | 5 | |
GijsB | 0:b4479b51578c | 6 | |
GijsB | 0:b4479b51578c | 7 | #define TEMP_OUT 0x02 |
GijsB | 0:b4479b51578c | 8 | #define XGYRO_OUT 0x04 |
GijsB | 0:b4479b51578c | 9 | #define YGYRO_OUT 0x06 |
GijsB | 0:b4479b51578c | 10 | #define ZGYRO_OUT 0x08 |
GijsB | 0:b4479b51578c | 11 | #define XACCL_OUT 0x0A |
GijsB | 0:b4479b51578c | 12 | #define YACCL_OUT 0x0C |
GijsB | 0:b4479b51578c | 13 | #define ZACCL_OUT 0x0E |
GijsB | 0:b4479b51578c | 14 | |
GijsB | 0:b4479b51578c | 15 | #define CR 0x0D |
GijsB | 0:b4479b51578c | 16 | |
GijsB | 0:b4479b51578c | 17 | #define BAUDRATE 57600 |
GijsB | 0:b4479b51578c | 18 | |
GijsB | 0:b4479b51578c | 19 | |
GijsB | 0:b4479b51578c | 20 | class IMU { |
GijsB | 0:b4479b51578c | 21 | |
GijsB | 0:b4479b51578c | 22 | public: |
GijsB | 0:b4479b51578c | 23 | IMU(PinName tx, PinName rx); |
GijsB | 0:b4479b51578c | 24 | ~IMU(); |
GijsB | 0:b4479b51578c | 25 | signed int getParam(unsigned char par); |
GijsB | 0:b4479b51578c | 26 | float getScaledParam(unsigned char par); |
GijsB | 0:b4479b51578c | 27 | |
GijsB | 0:b4479b51578c | 28 | |
GijsB | 0:b4479b51578c | 29 | private: |
GijsB | 0:b4479b51578c | 30 | Serial *s_; |
GijsB | 0:b4479b51578c | 31 | bool faulty; |
GijsB | 0:b4479b51578c | 32 | |
GijsB | 0:b4479b51578c | 33 | void init(Serial *s); |
GijsB | 0:b4479b51578c | 34 | bool isReady(); |
GijsB | 0:b4479b51578c | 35 | bool isFaulty(); |
GijsB | 0:b4479b51578c | 36 | void goToStartOfSentence(unsigned char par); |
GijsB | 0:b4479b51578c | 37 | |
GijsB | 0:b4479b51578c | 38 | |
GijsB | 0:b4479b51578c | 39 | |
GijsB | 0:b4479b51578c | 40 | |
GijsB | 0:b4479b51578c | 41 | }; |
GijsB | 0:b4479b51578c | 42 | |
GijsB | 0:b4479b51578c | 43 | #endif |