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... | |
enum | KUARTStatus { UART_OK, UART_ERROR, UART_ERROR_NULL_HANDLE, UART_ERROR_CONFIG } |
Uart status values. More... | |
Functions | |
KUARTConf | k_uart_conf_defaults (void) |
Generate KUARTConf with default uart values. More... | |
KUARTStatus | k_uart_init (KUARTNum uart, KUARTConf *conf) |
Setup and enable uart interface. More... | |
void | k_uart_terminate (KUARTNum uart) |
Terminates 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... | |
KUARTStatus | k_uart_write_immediate (KUARTNum uart, char c) |
Write data directly to a uart interface. More... | |
KUARTStatus | k_uart_write_immediate_str (KUARTNum uart, uint8_t *ptr, uint8_t len) |
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... | |
KUARTStatus | kprv_uart_dev_init (KUARTNum uart) |
Performs low level uart hardware initialization. More... | |
void | kprv_uart_dev_terminate (KUARTNum uart) |
void | kprv_uart_enable_tx_int (KUARTNum uart) |
Enables uart transmit interrupt. More... | |
Enumeration Type Documentation
enum KParity |
enum KStopBits |
enum KUARTNum |
enum KUARTStatus |
enum KWordLen |
Function Documentation
KUARTConf k_uart_conf_defaults | ( | void | ) |
void k_uart_console_init | ( | void | ) |
Setup and enable console uart interface.
KUARTStatus k_uart_init | ( | KUARTNum | uart, |
KUARTConf * | conf | ||
) |
Setup and enable uart interface.
- Parameters
-
uart uart interface to initialize conf config values to initialize with
- Returns
- KUARTStatus UART_OK if OK, failure otherwise
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 or -1 to indicate a null uart handle
int k_uart_rx_pin | ( | KUARTNum | uart | ) |
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 or -1 to indicate a null uart handle or -2 to indicate a null rx queue pointer
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
void k_uart_terminate | ( | KUARTNum | uart | ) |
Terminates uart interface.
- Parameters
-
uart uart interface to terminate
int k_uart_tx_pin | ( | KUARTNum | uart | ) |
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 or -1 to indicate a null uart handle
KUARTStatus 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
- Returns
- KUARTStatus UART_OK if success, otherwise failure
KUARTStatus k_uart_write_immediate_str | ( | KUARTNum | uart, |
uint8_t * | ptr, | ||
uint8_t | len | ||
) |
Write data directly to a uart interface.
- Parameters
-
uart uart interface to write to ptr buffer to write data from len length of data to write
- Returns
- KUARTStatus UART_OK if success, otherwise failure
KUARTStatus kprv_uart_dev_init | ( | KUARTNum | uart | ) |
Performs low level uart hardware initialization.
- Parameters
-
uart uart interface to initialize
- Returns
- KUARTStatus UART_OK if OK, failure otherwise
void kprv_uart_dev_terminate | ( | KUARTNum | uart | ) |
void kprv_uart_enable_tx_int | ( | KUARTNum | uart | ) |
Enables uart transmit interrupt.
- Parameters
-
uart uart interface number