
AN758
Rev. 0.1 11
5.2. UART Functions
This section details the functions found in the gUART0.c file (AN758_USB_CDC\src\generated directory). This
file contains the hardware configuration for the SiM3U1xx device.
5.2.1. UART0_enter_default_mode_from_reset
UART0 hardware default configuration.
Syntax
void UART0_enter_default_mode_from_reset(void)
Parameters
None
Return Value
None
Description
This function set UART0 TX/RX default configuration as 115200 bps, 8-bit data width, 1 bit stop bit, no-parity
Example
UART0_enter_default_mode_from_reset();
5.2.2. uart_configuration
UART0 configuration setting.
Syntax
void uart_configuration(uint32_t baud_rate,uint8_t stop_bits,uint8_t parity,uint8_t
data_bits)
Parameters
baud_rate: baud rate
stop_bits: 0 - 1 stop bit; 1 - 1.5 stop bits; 2 - 2 stop bits
parity: 0 - none; 1 - odd; 2 - even; 3 - mark; 4 - space
data_bits: data bits(5,6,7,8 or 16)
Return Value
None
Description
This function set UART0 TX/RX baud rate, stop bits, parity and data bits.
Example
uart_configuration(115200,0,0,8);
5.2.3. uart_get_data
UART0 get data.
Syntax
uint32_t uart_get_data(uint8_t * data)
Parameters
data: pointer to receive data buffer
Return Value
The number of bytes received from UART
Description
This function gets data from UART FIFO to data buffer and return number of bytes received.
Example
uint32_t recv_count;
static uint8_t in_buff[64];
recv_count = uart_get_data(in_buff);
Comentários a estes Manuais