1.1.13.2 1.8.24.11 1.10.23.13 1.11.23.13 1.12.24.13 1.13.22.13 1.14.17.13 1.15.18.13 1.16.25.13 1.17.20.13 1.18.21.13 1.19.21.13 1.20.25.13 1.21.26.13 1.22.28.13 1.23.27.13 1.24.23.13 1.27.26.11 1.34.26.11 1.35.20.11 UARTx_SerialSetup Function
C
/* x = UART instance number */
/* Blocking, non-blocking and ring buffer mode */
bool UARTx_SerialSetup(UART_SERIAL_SETUP * serialSetup, uint32_t clkFrequency)
Summary
Sets up serial configurations for UART peripheral.
Description
This function provides run-time interface to configure the baud, parity, stop bits and data character size parameters of the serial connection. Calling this function when a serial communication is in progress can disrupt the communication. The caller should ensure that there is no serial communication in progress. In case of success, the function will update all parameters specified in the serialSetup parameter, even if some parameter may have not changed since a previous call to this function. In case of failure, all parameters stay unchanged.
Precondition
UARTx_Initialize must have been called for the associated UART instance.
Parameters
Param | Description |
---|---|
serialSetup | Pointer to serial configuration data structure |
clkFrequency | Input clock frequency to the Baud Rate Generator. If configured to zero, the PLIB takes the peripheral clock frequency from MHC |
Returns
true - Serial configuration was successful
false - The specified serial configuration could not be supported. This, for example, could happen if the requested baud is not supported.
Example
UART_SERIAL_SETUP setup = { 115200, UART_PARITY_ODD }; UART1_SerialSetup(&setup, 0);
Remarks
None