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:
3:29454cac7930
Parent:
2:c99c596be3d1
Child:
4:2945afce4322
--- a/main.cpp	Tue Nov 11 16:16:34 2014 +0000
+++ b/main.cpp	Tue Nov 11 16:39:29 2014 +0000
@@ -72,14 +72,16 @@
                     dlms.send_packet ("\r\nDLMS Test 1 \r\n", 16);
                     break;
               }
-              debugger.printf (">> %c 0x%02X ret_irq_count = %ld\r\n", ch, ch, dlms.ret_irq_count());
+              debugger.printf (">> %c 0x%02X IRQ rxcount=%5ld txcount=%5ld\r\n", ch, ch, 
+                               dlms.ret_rx_irq_count(),
+                               dlms.ret_tx_irq_count());
          }
-//         if (dlms.char_available())
-//         {
-//            debugger.printf("Rx Char ");
-//            debugger.printf("%c\r\n", dlms.get_char());
-//         }
-//         dlms.poll_rs485();
+         if (dlms.char_available())
+         {
+            debugger.printf("Rx Char ");
+            debugger.printf("%c\r\n", dlms.get_char());
+         }
+         dlms.poll_rs485();
     }
     while (1);
 }