NagaokaRoboticsClub_mbedTeam / R1370MeasuringWheel
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers R1370.h Source File

R1370.h

00001 #ifndef R1370_H
00002 #define R1370_H
00003 
00004 #include "mbed.h"
00005 #include <vector>
00006 
00007 #define R1370_BUFFER_SIZE 15
00008 #define R1370_HEADER0 0xAA
00009 #define R1370_HEADER1 0x00
00010 
00011 class R1370 : public RawSerial
00012 {
00013 public :
00014     R1370(PinName tx, PinName rx);
00015 
00016     float getAngle();
00017     float getRate();
00018     int16_t getAcc(char l);
00019     int16_t getAcc(int i);
00020     int16_t getAccX();
00021     int16_t getAccY();
00022     int16_t getAccZ();
00023     
00024     unsigned char upbit();
00025     unsigned char downbit();
00026     
00027     
00028 private :
00029     void receiveByte();
00030     void checkData();
00031     void assembleLoop();
00032     void assemble();
00033     
00034     uint8_t index;
00035     int16_t angle;
00036     int16_t rate;
00037     int16_t acc[3];
00038     uint8_t reserved;
00039     uint8_t buffer[R1370_BUFFER_SIZE];
00040     uint8_t data[R1370_BUFFER_SIZE-3];
00041     uint8_t bufferPoint;
00042     uint8_t receivedBytes;
00043     
00044     unsigned char upbit_, downbit_;
00045 };
00046 
00047 #endif