This is a RS485 class that uses the second UART and was tested on a Nucleo F030R8. A main demo program howto use the class is included. This class control the direction pin on the transceiver buffer automatically, and used transmit and receive interrupts. Ring buffers (256 bytes) are implemented on both transmission and reception. It assumes a ADM3485 'type' buffer where pins 2 ans 3 are connected and seen as direction. This test program could easily be adapted as base for other programs.
Diff: dlms_comms.cpp
- Revision:
- 10:e104a1b24165
- Parent:
- 9:d49cdc77f867
- Child:
- 11:ca1e0ca3a673
--- a/dlms_comms.cpp Tue Nov 11 20:59:43 2014 +0000 +++ b/dlms_comms.cpp Tue Nov 11 21:02:06 2014 +0000 @@ -8,8 +8,8 @@ // Instantiate the raw serial (2nd uart) Tx then Rx RawSerial rs485(PA_9, PA_10); // pin to switch the rs485 buffer direction - //DigitalOut dir_485 (PB_0); - DigitalOut dir_485 (D7); + DigitalOut dir_485 (PB_0); + //DigitalOut dir_485 (D7); /** --------------------------------------------------------------------------- * @brief C O N S T R U C T O R