-
Notifications
You must be signed in to change notification settings - Fork 0
UART Structures
This page contains information about the structures used within the UART configuration and modification. Please refer to the list below to be redirected to the appropriate documentation.
Definition
typedef struct UART_DATA {
Queue Rx_queue;
Queue Tx_queue;
boolean Tx_is_idle;
} UART_Data;
Description
The UART_Data
structure is used as an internal reference structure. It is handed back by the initialization function, but it should not be modified by the user in any way. The purpose of this structure is to query the current status of the UART. If this structure is modified, the UART could potentially malfunction.
Parameters
- Rx_queue: This parameter is the receive buffer for the UART
- Tx_queue: This parameter is the transmission buffer for the UART
- Tx_is_idle: This parameter specifies whether the UART is currently transmitting or not
Definition
typedef struct UART_CONFIG {
uint speed;
uint pb_clk;
UART_Channel which_uart;
uint8 *rx_buffer_ptr;
uint rx_buffer_size;
uint8 *tx_buffer_ptr;
uint tx_buffer_size;
void (*rx_callback);
void (*tx_callback);
boolean tx_en;
boolean rx_en;
} UART_Config;
Description
The UART_Config
structure is used for UART configuration. This structure should be completely populated when configuring the UART for proper functionality.
Parameters
- speed: This is the desired baud rate that the user would like the UART to run at.
- pb_clk: This parameter is a speed that the peripheral bus clock is running at. This is used to properly set the UART baud rate.
- which_uart: This specifies which UART channel should be configured.
- rx_buffer_ptr: This should be a pointer to an array of memory for use by the RX buffer of the UART.
-
rx_buffer_size: This is a size (in bytes) of the data pointed to by
rx_buffer_ptr
. - tx_buffer_ptr_: This is a pointer to an array of memory for use by the TX buffer of the UART. This buffer should be different than the RX buffer, as the memory must be distinctly different.
-
tx_buffer_size: This parameter specifies (in bytes) the size of the data pointed to by
tx_buffer_ptr
. - rx_callback: This is a callback function that will occur whenever a receive is completed on the UART channel. Please refer to the callback documentation for more information.
- tx_callback: This is a callback function that will occur whenever a transmission on the UART occurs. Please refer to the callback documentation for more information.
- tx_en: This parameter specifies whether the transmission functionality of the UART should be enabled or not.
- rx_en: This parameter specifies whether the receive functionality of the UART should be enabled or not
SUBLIBinal was created by the Palouse Robosub Club.