measuringwheel関数がついかされています。
R1370.h@2:b6f5a4994a84, 2018-08-24 (annotated)
- Committer:
- UCHITAKE
- Date:
- Fri Aug 24 04:50:46 2018 +0000
- Revision:
- 2:b6f5a4994a84
- Parent:
- 0:243364135087
add doxygen comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
UCHITAKE | 0:243364135087 | 1 | #ifndef R1370_H |
UCHITAKE | 0:243364135087 | 2 | #define R1370_H |
UCHITAKE | 0:243364135087 | 3 | |
UCHITAKE | 2:b6f5a4994a84 | 4 | /** |
UCHITAKE | 2:b6f5a4994a84 | 5 | * Includes |
UCHITAKE | 2:b6f5a4994a84 | 6 | */ |
UCHITAKE | 0:243364135087 | 7 | #include "mbed.h" |
UCHITAKE | 0:243364135087 | 8 | #include <vector> |
UCHITAKE | 0:243364135087 | 9 | |
UCHITAKE | 2:b6f5a4994a84 | 10 | /** |
UCHITAKE | 2:b6f5a4994a84 | 11 | * Defines |
UCHITAKE | 2:b6f5a4994a84 | 12 | */ |
UCHITAKE | 0:243364135087 | 13 | #define R1370_BUFFER_SIZE 15 |
UCHITAKE | 0:243364135087 | 14 | #define R1370_HEADER0 0xAA |
UCHITAKE | 0:243364135087 | 15 | #define R1370_HEADER1 0x00 |
UCHITAKE | 0:243364135087 | 16 | |
UCHITAKE | 2:b6f5a4994a84 | 17 | /** |
UCHITAKE | 2:b6f5a4994a84 | 18 | * R1370 sensor module |
UCHITAKE | 2:b6f5a4994a84 | 19 | * sample code is here https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/R1370sample/ |
UCHITAKE | 2:b6f5a4994a84 | 20 | */ |
UCHITAKE | 0:243364135087 | 21 | class R1370 : public RawSerial |
UCHITAKE | 0:243364135087 | 22 | { |
UCHITAKE | 0:243364135087 | 23 | public : |
UCHITAKE | 2:b6f5a4994a84 | 24 | /** |
UCHITAKE | 2:b6f5a4994a84 | 25 | * Constructor. |
UCHITAKE | 2:b6f5a4994a84 | 26 | * |
UCHITAKE | 2:b6f5a4994a84 | 27 | * set 2pins for UART |
UCHITAKE | 2:b6f5a4994a84 | 28 | * |
UCHITAKE | 2:b6f5a4994a84 | 29 | * @param tx - TXpin for UART |
UCHITAKE | 2:b6f5a4994a84 | 30 | * @param rx - RXpin for UART |
UCHITAKE | 2:b6f5a4994a84 | 31 | */ |
UCHITAKE | 0:243364135087 | 32 | R1370(PinName tx, PinName rx); |
UCHITAKE | 0:243364135087 | 33 | |
UCHITAKE | 2:b6f5a4994a84 | 34 | //Getters. |
UCHITAKE | 0:243364135087 | 35 | float getAngle(); |
UCHITAKE | 0:243364135087 | 36 | float getRate(); |
UCHITAKE | 0:243364135087 | 37 | int16_t getAcc(char l); |
UCHITAKE | 0:243364135087 | 38 | int16_t getAcc(int i); |
UCHITAKE | 0:243364135087 | 39 | int16_t getAccX(); |
UCHITAKE | 0:243364135087 | 40 | int16_t getAccY(); |
UCHITAKE | 0:243364135087 | 41 | int16_t getAccZ(); |
UCHITAKE | 0:243364135087 | 42 | |
UCHITAKE | 0:243364135087 | 43 | |
UCHITAKE | 0:243364135087 | 44 | private : |
UCHITAKE | 0:243364135087 | 45 | void receiveByte(); |
UCHITAKE | 0:243364135087 | 46 | void assembleLoop(); |
UCHITAKE | 0:243364135087 | 47 | void assemble(); |
UCHITAKE | 0:243364135087 | 48 | |
UCHITAKE | 0:243364135087 | 49 | Thread thread; |
UCHITAKE | 0:243364135087 | 50 | std::vector<unsigned char> buf; |
UCHITAKE | 0:243364135087 | 51 | |
UCHITAKE | 0:243364135087 | 52 | uint8_t index; |
UCHITAKE | 0:243364135087 | 53 | int16_t angle; |
UCHITAKE | 0:243364135087 | 54 | int16_t rate; |
UCHITAKE | 0:243364135087 | 55 | int16_t acc[3]; |
UCHITAKE | 0:243364135087 | 56 | uint8_t reserved; |
UCHITAKE | 0:243364135087 | 57 | }; |
UCHITAKE | 0:243364135087 | 58 | |
UCHITAKE | 0:243364135087 | 59 | #endif |