A basic library for RS485 communication

Dependencies:   BufferedSerial

Dependents:   mbed_blinko

Revision:
3:9af77202cc27
Parent:
2:2701d79eba7c
Child:
4:6a8a69b660c2
--- a/RS485.h	Sat May 13 03:57:20 2017 +0000
+++ b/RS485.h	Sun May 21 20:37:59 2017 +0000
@@ -32,9 +32,9 @@
  *  #include "mbed.h" 
  *  #include <RS485.h>
  *  Serial pc(USBTX, USBRX); 
- *  RS485 RS485(PC_10,PC_11,PB_3); // Tx, Rx , enable pin(future use)
+ *  RS485 RS485(PC_10,PC_11,PB_3); // Tx, Rx , !RE and DE MAX485 pin
  * 
- *  DigitalOut ho(PB_3);
+ *  DigitalOut ho(PB_3); // this pin should be connected to !RE and DE
  *  typedef uint8_t byte;
  * 
  *  byte regvalue[9];
@@ -44,10 +44,10 @@
  *    pc.printf("main\n");
  *    while(1) {
  *       pc.printf("Starting\n");
- *       ho = 1;                  // 3.3V output from digital out pin
+ *       ho = 1;                  // Enable sending on MAX485
  *       RS485.sendMsg(data,sizeof(data));
  *       wait_ms(600);            // Must wait for all the data to be sent   
- *       ho = 0;                  // 0V output from digital out pin
+ *       ho = 0;                  // Enable receiving on MAX485
  *       pc.printf("Getting data\n");
  *       if(RS485.readable() >0){
  *           memset(regvalue,0,sizeof(regvalue));
@@ -83,7 +83,7 @@
     /** Create a BufferedSerial port, connected to the specified transmit and receive pins
      *  @param tx Transmit pin
      *  @param rx Receive pin
-     *  @param dere Enable pin (currently not implemented)
+     *  @param dere Enable pin, this pin should be connected to !RE and DE
      *  @note uses BufferedSerial
      */
     RS485(PinName tx, PinName rx, PinName dere);