A basic library for RS485 communication
Diff: RS485.h
- Revision:
- 1:f7cead04d73e
- Parent:
- 0:dccd2df6a07c
- Child:
- 2:2701d79eba7c
diff -r dccd2df6a07c -r f7cead04d73e RS485.h --- a/RS485.h Mon Feb 27 21:53:25 2017 +0000 +++ b/RS485.h Mon Feb 27 22:18:01 2017 +0000 @@ -20,7 +20,8 @@ #ifndef RS485_H #define RS485_H -#include <BufferedSerial.h> + +#include "BufferedSerial.h" #include "mbed.h" /** A serial port (UART) is used for RS485 @@ -89,8 +90,8 @@ /** calculate 8-bit CRC * cyclic redundancy check - * @addr byte pointer of information to use (typical an char array) - * @len length of byte of information were converting + * @param addr byte pointer of information to use (typical an char array) + * @param len length of byte of information were converting * @return the CRC byte */ static byte crc8 (const byte *addr, byte len); @@ -105,17 +106,18 @@ /** send message * cyclic redundancy check - * @data the data to be sent through RS485 - * @length length of the data + * @param data the data to be sent through RS485 + * @param length length of the data * @note puts STX at start, ETX at end, and add CRC */ void sendMsg (const byte * data, const byte length); /** receive message * reads serial port and populates data - * @data buffer to receive into - * @length length of the data - * @timeout clock_mseconds before timing out + * @param data buffer to receive into + * @param length length of the data + * @param timeout clock_mseconds before timing out + * @return the number of bytes received * */ byte recvMsg (byte * data, const byte length, unsigned long timeout);