|
mraa
0.9.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
|
This file defines the UART interface for libmraa
Public Member Functions | |
| synchronized void | delete () |
| Uart (int uart) | |
| Uart (String path) | |
| String | getDevicePath () |
| String | readStr (int length) |
| int | writeStr (String data) |
| boolean | dataAvailable (long millis) |
| boolean | dataAvailable () |
| Result | flush () |
| Result | setBaudRate (long baud) |
| Result | setMode (int bytesize, UartParity parity, int stopbits) |
| Result | setFlowcontrol (boolean xonxoff, boolean rtscts) |
| Result | setTimeout (int read, int write, int interchar) |
| Uart | ( | int | uart | ) |
Uart Constructor, takes a pin number which will map directly to the linux uart number, this 'enables' the uart, nothing more
| uart | the index of the uart set to use |
| Uart | ( | String | path | ) |
Uart Constructor, takes a pin number which will map directly to the linux uart number, this 'enables' the uart, nothing more
| uart | the index of the uart set to use |
| boolean dataAvailable | ( | long | millis | ) |
Check to see if data is available on the device for reading
| millis | number of milliseconds to wait, or 0 to return immediately |
| String getDevicePath | ( | ) |
Get string with tty device path within Linux For example. Could point to "/dev/ttyS0"
| String readStr | ( | int | length | ) |
Read bytes from the device into a String object
| length | to read |
| Result setBaudRate | ( | long | baud | ) |
Set the baudrate. Takes an int and will attempt to decide what baudrate is to be used on the UART hardware.
| baud | unsigned int of baudrate i.e. 9600 |
| Result setFlowcontrol | ( | boolean | xonxoff, |
| boolean | rtscts | ||
| ) |
Set the flowcontrol
| xonxoff | XON/XOFF Software flow control. |
| rtscts | RTS/CTS out of band hardware flow control |
| Result setMode | ( | int | bytesize, |
| UartParity | parity, | ||
| int | stopbits | ||
| ) |
Set the transfer mode For example setting the mode to 8N1 would be "dev.setMode(8,UART_PARITY_NONE , 1)"
| bytesize | data bits |
| parity | Parity bit setting |
| stopbits | stop bits |
| Result setTimeout | ( | int | read, |
| int | write, | ||
| int | interchar | ||
| ) |
Set the timeout for read and write operations <= 0 will disable that timeout
| read | read timeout |
| write | write timeout |
| interchar | inbetween char timeout |
| int writeStr | ( | String | data | ) |
Write bytes in String object to a device
| string | to write |
1.8.9.1