-
Notifications
You must be signed in to change notification settings - Fork 0
UART Functions
This page contains informations pertaining to the UART peripheral library of SUBLIBinal. Please refer to the following list to be redirected towards the appropriate documentation.
Definition
UART_Data* initialize_UART(UART_Config config);
Description
This function is used for the initialization of the UART channel on the microcontroller.
Parameters
-
config: This parameter should be a completely filled out
UART_Configstructure. It is important to note that the UART rx and tx callback functions are not necessary for proper UART functionality.
Return
This function will return a pointer to a UART_Data structure pointer. This structure is to be used only for querying information about the status of the UART. This structure must not be modified. If it is, the UART channel can potentially malfunction.
Definition
Error send_UART(UART_Channel channel, uint8 *data_ptr, uint data_size);
Description
This function will transmit information on the UART channel specified. The data transmitted does not need to remain in scope to function correctly.
Parameters
- channel: This parameter specifies the channel upon which the send should occur.
-
data_ptr: This parameter is a pointer to the data that should be transmitted on the UART. This data does not need to remain in scope, as it is copied into the UART transmission buffer upon a
send_UARTfunction call. -
data_size: This parameter specifies the number of bytes that should be transmitted. Transmission will begin from the data pointed to by
data_ptrand continue sequentially untildata_sizebytes have been copied into the transmission buffer.
Return
This function returns an ERROR enumeration specifying whether a transmission was successful. This function will only return an error code if it failed to copy all of the data into the UART transmission buffer.
Definition
Error receive_UART(UART_Channel channel, uint8 *data_ptr, uint data_size);
Description
This function will attempt to read data from the received UART channel.
Parameters
- channel: This specifies which UART channel that we should attempt to read from.
-
data_ptr: The
data_ptrparameter specifies a location that the read data will be placed if a successful read occurs. -
data_size: This parameter specifies how many bytes should be read from the UART buffer. If there are less than
data_sizebytes available in the UART receive buffer, the function will not read any pieces of information.
Return
This function will return an error code associated with the respective read status from the UART receive queue. This function will attempt to read data_size bytes into the memory location specified by data_ptr. the function will return an error if there are not data_size bytes located within the UART receive buffer.
SUBLIBinal was created by the Palouse Robosub Club.