Forking https://os.mbed.com/users/cam/code/Modbus/ to work for NUCLEO 64 boards
Fork of Cam's original FreeModbus port (https://os.mbed.com/users/cam/code/Modbus/)
Change: - Serial implementation to work for NUCLEO 64 boards and receive interrupts instead of timer. (see `portserial.cpp`)
Added: - Custom RTU mode. Allows for external implementation of packet receiving and sending. Sends and receives packets as whole frames (address + PDU) (i.e. this was added for a custom LoRa implementation). implement `xMBRTUCustGetPDU` and `xMBRTUCustSendResponse` (see `mbport.h`) and call `eMBRTUCustomInit( address )`. implementations need to be fully initialised as `eMBRTUCustomInit` only sets the address and nothing else.
Diff: mbrtucustom.cpp
- Revision:
- 4:7621103c5a40
- Parent:
- 3:4cda95d7b6c5
--- a/mbrtucustom.cpp Mon Jan 06 01:17:26 2020 +0000 +++ b/mbrtucustom.cpp Tue Aug 04 04:42:52 2020 +0000 @@ -75,11 +75,9 @@ ENTER_CRITICAL_SECTION( ); if( xMBRTUCustGetPDU( &pucMBFrame, &usLength ) != FALSE ) { - - //TODO: check modbus CRC vs LoRa CRC (redundant if both) - + //TODO: // usMBCRC16( ( UCHAR * ) ucRTUBuf, usRcvBufferPos ) == 0; - *pucRcvAddress = pucMBFrame[0]; //TODO: check this is address for modbus RTU + *pucRcvAddress = pucMBFrame[0]; *ppucFrame = &pucMBFrame[1]; *pusLength = usLength - 1; // removed address eStatus = MB_ENOERR;