受信割り込みバージョン
Dependents: a_team_R1370 ashimawari_sample_test 2022NHK_A_ashimawari 2022A_NHK_kikou
R1370.h@4:ffc2a55269f9, 2019-05-18 (annotated)
- Committer:
- highfieldsnj
- Date:
- Sat May 18 08:42:05 2019 +0000
- Revision:
- 4:ffc2a55269f9
- Parent:
- 3:2f00371553c1
- Child:
- 5:553c02009ad0
add function getRadian()
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 | 0:243364135087 | 4 | #include "mbed.h" |
UCHITAKE | 0:243364135087 | 5 | #include <vector> |
UCHITAKE | 0:243364135087 | 6 | |
UCHITAKE | 0:243364135087 | 7 | #define R1370_BUFFER_SIZE 15 |
UCHITAKE | 0:243364135087 | 8 | #define R1370_HEADER0 0xAA |
UCHITAKE | 0:243364135087 | 9 | #define R1370_HEADER1 0x00 |
UCHITAKE | 0:243364135087 | 10 | |
UCHITAKE | 0:243364135087 | 11 | class R1370 : public RawSerial |
UCHITAKE | 0:243364135087 | 12 | { |
UCHITAKE | 0:243364135087 | 13 | public : |
UCHITAKE | 0:243364135087 | 14 | R1370(PinName tx, PinName rx); |
UCHITAKE | 0:243364135087 | 15 | |
UCHITAKE | 0:243364135087 | 16 | float getAngle(); |
UCHITAKE | 0:243364135087 | 17 | float getRate(); |
highfieldsnj | 4:ffc2a55269f9 | 18 | float getRadian(); |
UCHITAKE | 0:243364135087 | 19 | int16_t getAcc(char l); |
UCHITAKE | 0:243364135087 | 20 | int16_t getAcc(int i); |
UCHITAKE | 0:243364135087 | 21 | int16_t getAccX(); |
UCHITAKE | 0:243364135087 | 22 | int16_t getAccY(); |
UCHITAKE | 0:243364135087 | 23 | int16_t getAccZ(); |
UCHITAKE | 0:243364135087 | 24 | |
highfieldsnj | 3:2f00371553c1 | 25 | unsigned char upbit(); |
highfieldsnj | 3:2f00371553c1 | 26 | unsigned char downbit(); |
highfieldsnj | 3:2f00371553c1 | 27 | |
UCHITAKE | 0:243364135087 | 28 | |
UCHITAKE | 0:243364135087 | 29 | private : |
UCHITAKE | 0:243364135087 | 30 | void receiveByte(); |
highfieldsnj | 3:2f00371553c1 | 31 | void checkData(); |
UCHITAKE | 0:243364135087 | 32 | void assembleLoop(); |
UCHITAKE | 0:243364135087 | 33 | void assemble(); |
UCHITAKE | 0:243364135087 | 34 | |
UCHITAKE | 0:243364135087 | 35 | uint8_t index; |
UCHITAKE | 0:243364135087 | 36 | int16_t angle; |
UCHITAKE | 0:243364135087 | 37 | int16_t rate; |
UCHITAKE | 0:243364135087 | 38 | int16_t acc[3]; |
UCHITAKE | 0:243364135087 | 39 | uint8_t reserved; |
highfieldsnj | 3:2f00371553c1 | 40 | uint8_t buffer[R1370_BUFFER_SIZE]; |
highfieldsnj | 3:2f00371553c1 | 41 | uint8_t data[R1370_BUFFER_SIZE-3]; |
highfieldsnj | 3:2f00371553c1 | 42 | uint8_t bufferPoint; |
highfieldsnj | 3:2f00371553c1 | 43 | uint8_t receivedBytes; |
highfieldsnj | 3:2f00371553c1 | 44 | |
highfieldsnj | 3:2f00371553c1 | 45 | unsigned char upbit_, downbit_; |
UCHITAKE | 0:243364135087 | 46 | }; |
UCHITAKE | 0:243364135087 | 47 | |
UCHITAKE | 0:243364135087 | 48 | #endif |