Kouki Suzuki
/
NHK2020_master
NHK2020_master_program
FEP2/FEP.h@1:496ab5127b06, 2020-10-27 (annotated)
- Committer:
- skouki
- Date:
- Tue Oct 27 09:33:35 2020 +0000
- Revision:
- 1:496ab5127b06
2020_10_27;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
skouki | 1:496ab5127b06 | 1 | #ifndef FEP_H |
skouki | 1:496ab5127b06 | 2 | #define FEP_H |
skouki | 1:496ab5127b06 | 3 | |
skouki | 1:496ab5127b06 | 4 | #include "mbed.h" |
skouki | 1:496ab5127b06 | 5 | |
skouki | 1:496ab5127b06 | 6 | #define FEP_BUFFER_SIZE 22 |
skouki | 1:496ab5127b06 | 7 | #define FEP_HEADER0 'R' |
skouki | 1:496ab5127b06 | 8 | #define FEP_HEADER1 'B' |
skouki | 1:496ab5127b06 | 9 | #define FEP_HEADER2 'N' |
skouki | 1:496ab5127b06 | 10 | |
skouki | 1:496ab5127b06 | 11 | class FEP : public RawSerial |
skouki | 1:496ab5127b06 | 12 | { |
skouki | 1:496ab5127b06 | 13 | public : |
skouki | 1:496ab5127b06 | 14 | FEP(PinName tx, PinName rx, uint8_t addr, int baud=115200); |
skouki | 1:496ab5127b06 | 15 | |
skouki | 1:496ab5127b06 | 16 | void startReceive(uint16_t dataSize); |
skouki | 1:496ab5127b06 | 17 | void getData(uint8_t data_[]); |
skouki | 1:496ab5127b06 | 18 | void sendData(uint8_t *data_[], uint8_t length); |
skouki | 1:496ab5127b06 | 19 | |
skouki | 1:496ab5127b06 | 20 | private : |
skouki | 1:496ab5127b06 | 21 | void receiveByte(); |
skouki | 1:496ab5127b06 | 22 | void checkData(); |
skouki | 1:496ab5127b06 | 23 | |
skouki | 1:496ab5127b06 | 24 | uint8_t *buffer; |
skouki | 1:496ab5127b06 | 25 | uint8_t bufferPoint; |
skouki | 1:496ab5127b06 | 26 | uint8_t receivedBytes; |
skouki | 1:496ab5127b06 | 27 | |
skouki | 1:496ab5127b06 | 28 | uint16_t bufferSize; |
skouki | 1:496ab5127b06 | 29 | uint8_t* data; |
skouki | 1:496ab5127b06 | 30 | |
skouki | 1:496ab5127b06 | 31 | uint8_t _address; |
skouki | 1:496ab5127b06 | 32 | }; |
skouki | 1:496ab5127b06 | 33 | |
skouki | 1:496ab5127b06 | 34 | #endif |