Function rc_uart_init#
Defined in File uart.h
Function Documentation#
-
int rc_uart_init(int bus, int baudrate, float timeout, int canonical_en, int stop_bits, int parity_en)#
Initializes a UART bus /dev/ttyO{bus} at specified baudrate and timeout.
This is a very generalized function that configures the bus for 8-bit characters and ignores the modem status lines.
If you need a configuration other than whats presented here then you are probably doing something fancy with the bus and you will probably want to do your own reading/writing with standard linux methods.
- Parameters:
bus – [in] The bus number /dev/ttyO{bus}
baudrate – [in] must be one of the standard speeds in the UART spec. 115200 and 57600 are most common.
timeout – [in] timeout is in seconds and must be >=0.1
canonical_en – [in]
0 for non-canonical mode (raw data), non-zero for canonical mode where only one line ending in ‘
’ is read at a time.
stop_bits – [in] number of stop bits, 1 or 2, usually 1 for most sensors
parity_en – [in] 0 to disable parity, nonzero to enable. usually disabled for most sensors.
- Returns:
0 on success, -1 on failure