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: main.cpp
- Revision:
- 1:7091401482c5
- Parent:
- 0:044dfba47660
- Child:
- 2:c99c596be3d1
diff -r 044dfba47660 -r 7091401482c5 main.cpp --- a/main.cpp Tue Nov 11 16:01:12 2014 +0000 +++ b/main.cpp Tue Nov 11 16:11:21 2014 +0000 @@ -63,17 +63,17 @@ else debugger.printf("0 \r\n"); } -// if (debugger.readable()) -// { -// ch = debugger.getc(); -// switch (ch) -// { -// case '1': -// dlms.send_packet ("\r\nDLMS Test 1 \r\n", 16); -// break; -// } -// debugger.printf ("ret_irq_count = %ld\r\n", dlms.ret_irq_count()); -// } + if (debugger.readable()) + { + ch = debugger.getc(); + switch (ch) + { + case '1': + dlms.send_packet ("\r\nDLMS Test 1 \r\n", 16); + break; + } + //debugger.printf ("ret_irq_count = %ld\r\n", dlms.ret_irq_count()); + } // if (dlms.char_available()) // { // debugger.printf("Rx Char ");