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: mbport.h
- Revision:
- 3:4cda95d7b6c5
- Parent:
- 0:0453a0a7e500
--- a/mbport.h Tue Dec 03 09:13:22 2019 +0000 +++ b/mbport.h Mon Jan 06 01:17:26 2020 +0000 @@ -110,6 +110,12 @@ extern BOOL( *pxMBPortCBTimerExpired ) ( void ); +/* ----------------------- RTU custom port functions -------------------------------*/ + +BOOL xMBRTUCustGetPDU( UCHAR **ppucMBRTUFrame, USHORT * usRTULength ); + +BOOL xMBRTUCustSendResponse( const UCHAR *pucMBRTUFrame, USHORT usRTULength ); + /* ----------------------- TCP port functions -------------------------------*/ BOOL xMBTCPPortInit( USHORT usTCPPort ); @@ -124,4 +130,4 @@ #ifdef __cplusplus PR_END_EXTERN_C #endif -#endif +#endif \ No newline at end of file