tinyproto
|
tiny_serial_handle_t | tiny_serial_open (const char *name, uint32_t baud) |
Opens serial port. More... | |
void | tiny_serial_close (tiny_serial_handle_t port) |
Closes serial connection. More... | |
int | tiny_serial_send (tiny_serial_handle_t port, const void *buf, int len) |
Sends data over serial connection. More... | |
int | tiny_serial_send_timeout (tiny_serial_handle_t port, const void *buf, int len, uint32_t timeout_ms) |
Sends data over serial connection. More... | |
int | tiny_serial_read (tiny_serial_handle_t port, void *buf, int len) |
Receive data from serial connection. More... | |
int | tiny_serial_read_timeout (tiny_serial_handle_t port, void *buf, int len, uint32_t timeout_ms) |
Receive data from serial connection. More... | |
Serial port API
void tiny_serial_close | ( | tiny_serial_handle_t | port | ) |
Closes serial connection.
Closes serial connection
port | handle to serial port |
tiny_serial_handle_t tiny_serial_open | ( | const char * | name, |
uint32_t | baud | ||
) |
Opens serial port.
Opens serial port by name
name | path to the port to open For linux this can be "/dev/ttyO1", "/dev/ttyS1", "/dev/ttyUSB0", etc. For windows this can be "COM1", "COM2", etc. For ESP32 IDF the line should in format "uart0,tx,rx,rts,cts", where uart0 - uart hardware device number ("uart1", "uart2"); "tx", "rx", "rts", "cts" are optional arguments, specifying integer pin numbers (-1 to use standard pin). For Arduino this is must be pointer to HardwareSerial class |
baud | baud rate in bits |
int tiny_serial_read | ( | tiny_serial_handle_t | port, |
void * | buf, | ||
int | len | ||
) |
Receive data from serial connection.
Receive data from serial connection with 100ms timeout.
port | handle to serial port |
buf | pointer to data buffer to read to |
len | maximum size of receive buffer |
int tiny_serial_read_timeout | ( | tiny_serial_handle_t | port, |
void * | buf, | ||
int | len, | ||
uint32_t | timeout_ms | ||
) |
Receive data from serial connection.
Receive data from serial connection.
port | handle to serial port |
buf | pointer to data buffer to read to |
len | maximum size of receive buffer |
timeout_ms | timeout in milliseconds to wait for incoming data |
int tiny_serial_send | ( | tiny_serial_handle_t | port, |
const void * | buf, | ||
int | len | ||
) |
Sends data over serial connection.
Sends data over serial connection with 100 ms timeout.
port | handle to serial port |
buf | pointer to data buffer to send |
len | length of data to send |
int tiny_serial_send_timeout | ( | tiny_serial_handle_t | port, |
const void * | buf, | ||
int | len, | ||
uint32_t | timeout_ms | ||
) |
Sends data over serial connection.
Sends data over serial connection.
port | handle to serial port |
buf | pointer to data buffer to send |
len | length of data to send |
timeout_ms | timeout in milliseconds to wait until data are sent |