Tiny protocol
0.11.0
Tiny communication protocol for microcontrollers
|
Tiny UART serial API. More...
#include <stdint.h>
#include "serial/noplatform_serial.h"
Go to the source code of this file.
Functions | |
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... | |
Tiny UART serial API.
This is UART support implementation.
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. |
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 |