UART
Data Structures | |
struct | KUARTConf |
Uart configuration structure. More... | |
struct | KUART |
Uart interface data structure. More... | |
Enumerations | |
enum | KUARTNum { K_UART1 = 0, K_UART2, K_UART3, K_UART4, K_UART5, K_UART6 } |
Available uart interfaces. More... | |
enum | KWordLen { K_WORD_LEN_7BIT = 0, K_WORD_LEN_8BIT, K_WORD_LEN_9BIT } |
Word length. More... | |
enum | KStopBits { K_STOP_BITS_1 = 0, K_STOP_BITS_2 } |
Number of stop bits. More... | |
enum | KParity { K_PARITY_NONE = 0, K_PARITY_EVEN, K_PARITY_ODD } |
Parity setting. More... | |
Functions | |
KUARTConf | k_uart_conf_defaults (void) |
Generate KUARTConf with default uart values. More... | |
void | k_uart_init (KUARTNum uart, KUARTConf *conf) |
Setup and enable uart interface. More... | |
void | k_uart_console_init (void) |
Setup and enable console uart interface. More... | |
int | k_uart_read (KUARTNum uart, char *ptr, int len) |
Interrupt driven function for reading data from a uart interface. More... | |
int | k_uart_write (KUARTNum uart, char *ptr, int len) |
Interrupt driven function for writing data to a uart interface. More... | |
void | k_uart_write_immediate (KUARTNum uart, char c) |
Write data directly to a uart interface. More... | |
int | k_uart_rx_queue_len (KUARTNum uart) |
Returns the number of characters currently in the uart rx queue. More... | |
void | k_uart_rx_queue_push (KUARTNum uart, char c, void *task_woken) |
Pushes a character into the uart rx queue. More... | |
int | k_uart_rx_pin (KUARTNum uart) |
Returns rx pin for specified uart interface. More... | |
int | k_uart_tx_pin (KUARTNum uart) |
Returns tx pin for specified uart interface. More... | |
KUART * | kprv_uart_get (KUARTNum uart) |
Returns uart data structure for specified interface. More... | |
void | kprv_uart_dev_init (KUARTNum uart) |
Performs low level uart hardware initialization. More... | |
void | kprv_uart_enable_tx_int (KUARTNum uart) |
Enables uart transmit interrupt. More... | |
Enumeration Type Documentation
enum KParity |
enum KStopBits |
enum KUARTNum |
enum KWordLen |
Function Documentation
KUARTConf k_uart_conf_defaults | ( | void | ) |
void k_uart_console_init | ( | void | ) |
Setup and enable console uart interface.
Setup and enable uart interface.
- Parameters
-
uart uart interface to initialize conf config values to initialize with
int k_uart_read | ( | KUARTNum | uart, |
char * | ptr, | ||
int | len | ||
) |
Interrupt driven function for reading data from a uart interface.
This function reads from a queue which is filled up via the uart interrupt handler.
- Parameters
-
uart uart interface to read from ptr buffer to read data into len length of data to read
- Returns
- int number of characters read
|
inline |
Returns rx pin for specified uart interface.
- Parameters
-
uart uart interface number
- Returns
- int rx pin
int k_uart_rx_queue_len | ( | KUARTNum | uart | ) |
Returns the number of characters currently in the uart rx queue.
- Parameters
-
uart uart interface number
void k_uart_rx_queue_push | ( | KUARTNum | uart, |
char | c, | ||
void * | task_woken | ||
) |
Pushes a character into the uart rx queue.
- Parameters
-
uart uart interface number c character to push task_woken used by FreeRTOS to determine task blocking
|
inline |
Returns tx pin for specified uart interface.
- Parameters
-
uart uart interface number
- Returns
- int tx pin
int k_uart_write | ( | KUARTNum | uart, |
char * | ptr, | ||
int | len | ||
) |
Interrupt driven function for writing data to a uart interface.
This function writes data into a queue which is then written out in the interrupt handler.
- Parameters
-
uart uart interface to write to ptr buffer to write data from len length of data to write
- Returns
- int number of characters written
void k_uart_write_immediate | ( | KUARTNum | uart, |
char | c | ||
) |
Write data directly to a uart interface.
- Parameters
-
uart uart interface to write to c character to write
void kprv_uart_dev_init | ( | KUARTNum | uart | ) |
Performs low level uart hardware initialization.
- Parameters
-
uart uart interface to initialize
void kprv_uart_enable_tx_int | ( | KUARTNum | uart | ) |
Enables uart transmit interrupt.
- Parameters
-
uart uart interface number