I messed up the merge, so pushing it over to another repo so I don't lose it. Will tidy up and remove later
Dependencies: BufferedSerial FatFileSystemCpp mbed
Diff: VIPSSerialProtocol.h
- Revision:
- 1:dd1f7e162f91
- Parent:
- 0:97661408d0f9
- Child:
- 3:14d241e29be3
--- a/VIPSSerialProtocol.h Fri Jan 15 11:49:01 2021 +0000 +++ b/VIPSSerialProtocol.h Fri Jan 15 15:44:39 2021 +0000 @@ -11,10 +11,9 @@ public: - VIPSSerial(const PinName Rx, const PinName Tx); - void onSerialRx(); + VIPSSerial(const PinName Tx, const PinName Rx); int getStatusMessage() {int tmp=statusMessage; statusMessage=0; return tmp;} - void fakeRX(); + void run(void); // send all position outputs rather than just when requested. void sendAllUpdated(bool enable); @@ -23,6 +22,8 @@ position* sendPositionForTime(uint32_t timeValue); position* getWaitingPostion() {position *ptr = outputPtr; outputPtr=NULL; return ptr;} + static void getCRC(void *data, int len, void *checksum); + private: struct posAndTime_s { @@ -30,8 +31,8 @@ position pos; }; + void onSerialRx(void); void processRxMessage(); - void getCRC(unsigned char* data, int len, unsigned char* checksum); bool checkCRC(unsigned char* data); void sendResponse(unsigned char function, unsigned char* data, int dataLen); void sendAck(unsigned char function); @@ -40,7 +41,7 @@ void parsePostionInput_legacy(); void parsePostionInput_mocap(); bool checkNewPacketRC(unsigned char* data); - BufferedSerial _port; + RawSerial _port; unsigned char messageInBuffer[128]; unsigned char messageOutBuffer[16]; #define posHistoryLen 3