| ||||||
Files | |
| file | common-rs485.h |
Commonly used RS485-related functions used by drivers. | |
Functions | |
| bool | RS485write (tMassiveArray &buf, ubyte len) |
| bool | RS485read (tMassiveArray &buf, int &len, int timeout=100) |
| bool | RS485readLargeResponse (tMassiveArray &buf, int &len, int timeout=100) |
| int | RS485appendToBuff (tMassiveArray &buf, const short index, const ubyte *pData, const short nLength) |
| int | RS485appendToBuff (tMassiveArray &buf, const short index, string pData) |
| void | RS485initLib (long baudrate=230400) |
| void | RS485clearRead (bool sendnewline=false) |
| bool | RS485sendString (string &data) |
| bool | RS485sendString (char *data) |
Variables | |
| int | rxTimer |
| const ubyte | newline [1] = '\n' |
| tMassiveArray | RS485rxbuffer |
| tMassiveArray | RS485txbuffer |
Commonly used RS485-related functions used by drivers
| int RS485appendToBuff | ( | tMassiveArray & | buf, |
| const short | index, | ||
| const ubyte * | pData, | ||
| const short | nLength | ||
| ) |
Append an array of bytes to a tMassiveArray buffer, starts at index in the buffer and copies nLength bytes.
| buf | the buffer to copy to |
| index | the position in buffer where to start appending to |
| pData | the data to be appended to buf |
| nLength | the length of the data to be appended |
Append a string a tBigByteArray buffer, starts at index in the buffer
| buf | the buffer to copy to |
| index | the position in buffer where to start appending to |
| pData | the string to be appended to buf |
| nLength | the length of the data to be appended |
Definition at line 176 of file common-rs485.h.
| int RS485appendToBuff | ( | tMassiveArray & | buf, |
| const short | index, | ||
| string | pData | ||
| ) |
Append a string a tMassiveArray buffer, starts at index in the buffer
| buf | the buffer to copy to |
| index | the position in buffer where to start appending to |
| pData | the string to be appended to buf |
Append a string a tBigByteArray buffer, starts at index in the buffer
| buf | the buffer to copy to |
| index | the position in buffer where to start appending to |
| pData | the string to be appended to buf |
Definition at line 192 of file common-rs485.h.
| void RS485clearRead | ( | bool | sendnewline = false ) |
Definition at line 248 of file common-rs485.h.
| void RS485initLib | ( | long | baudrate = 230400 ) |
Initialise the port, setup buffers
Definition at line 237 of file common-rs485.h.
| bool RS485read | ( | tMassiveArray & | buf, |
| int & | len, | ||
| int | timeout = 100 |
||
| ) |
Read a message from the NXT2WIFI. An optional timeout can be specified.
| buf | the buffer in which to store the received data |
| len | the amount of data received |
| timeout | optional parameter to specify the timeout, defaults to 100ms |
Definition at line 91 of file common-rs485.h.
| bool RS485readLargeResponse | ( | tMassiveArray & | buf, |
| int & | len, | ||
| int | timeout = 100 |
||
| ) |
Read a very large response from the NXT2WIFI sensor. This breaks up the reads into many smaller chunks to prevent weirdness on the bus.
| buf | the buffer in which to store the received data |
| len | the amount of data received |
| timeout | optional parameter to specify the timeout, defaults to 100ms |
Definition at line 129 of file common-rs485.h.
| bool RS485sendString | ( | string & | data ) |
Definition at line 263 of file common-rs485.h.
| bool RS485sendString | ( | char * | data ) |
Definition at line 269 of file common-rs485.h.
| bool RS485write | ( | tMassiveArray & | buf, |
| ubyte | len | ||
| ) |
Write a message to the NXT2WIFI sensor
| buf | the buffer to be transmitted |
| len | the length of the data to be transmitted |
Definition at line 52 of file common-rs485.h.
| const ubyte newline[1] = '\n' |
Definition at line 41 of file common-rs485.h.
128 bit array for receiving
Definition at line 43 of file common-rs485.h.
128 bit array for transmission
Definition at line 44 of file common-rs485.h.
| int rxTimer |
timer for receiving timeouts
Definition at line 39 of file common-rs485.h.
1.7.2