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.

Dependencies:   mbed

Revision:
6:70460dcbc43c
Parent:
5:e00f46d18514
Child:
9:d49cdc77f867
diff -r e00f46d18514 -r 70460dcbc43c main.cpp
--- a/main.cpp	Tue Nov 11 17:53:16 2014 +0000
+++ b/main.cpp	Tue Nov 11 18:17:52 2014 +0000
@@ -72,9 +72,10 @@
                     dlms.send_packet ("\r\nDLMS Test 1 \r\n", 16);
                     break;
               }
-              debugger.printf (">> %c 0x%02X IRQ rxcount=%5ld txcount=%5ld\r\n", ch, ch, 
+              debugger.printf (">> %c 0x%02X IRQ rxcount=%5ld txcount=%5ld Dir_485=%d\r\n", ch, ch, 
                                dlms.ret_rx_irq_count(),
-                               dlms.ret_tx_irq_count());
+                               dlms.ret_tx_irq_count(),
+                               dlms.ret_dir_485());
          }
          if (dlms.char_available())
          {