FEP receive
Dependents: 34_emStop_FEP_receive
FEP.h
- Committer:
- THtakahiro702286
- Date:
- 2021-10-08
- Revision:
- 0:b0bd3bee5ab4
File content as of revision 0:b0bd3bee5ab4:
#ifndef FEP_H #define FEP_H #include "mbed.h" #define FEP_BUFFER_SIZE 22 #define FEP_HEADER0 'R' #define FEP_HEADER1 'B' #define FEP_HEADER2 'N' #define TIMEOUT_COUNT 10 class FEP : public RawSerial { public : FEP(PinName tx, PinName rx, uint8_t addr, int baud=115200); void startReceive(uint16_t dataSize); void getData(uint8_t data_[]); void sendData(uint8_t data_[], uint8_t length); bool status; private : void receiveByte(); void checkData(); void timeoutLoop(); uint8_t *buffer; uint8_t bufferPoint; uint8_t receivedBytes; uint16_t bufferSize; uint8_t* data; uint8_t _address; Ticker timeoutTicker; int timeout; }; #endif