ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
|
Implentation of UART/USART Tx/Rx functions. More...
Functions | |
void | USART_Init (USART_TypeDef *USARTx, SerialSpeed Serial_x, bool useUART) |
Initilizes the USARTx peripheral at the serial speed Serial_x, and the default. | |
void | USART_ChangeSerialSpeed (USART_TypeDef *USARTx, SerialSpeed Serial_x) |
Changes the Serial speed of the USART. | |
void | USART_SendChar (USART_TypeDef *USARTx, char chr) |
Sends a single character over UART/USART (BLOCKING) | |
void | USART_SendString (USART_TypeDef *USARTx, const char *str) |
Sends the string str over UART/USART. (Will automatically append "\r\n" to the transmision (BLOCKING)) | |
char | USART_RecieveChar (const USART_TypeDef *USARTx) |
Recieves a single character from UART/USART (BLOCKING) | |
void | USART_RecieveString (const USART_TypeDef *USARTx, char *buffer, uint16_t bufferLen) |
Recieves a string from UART/USART and stops when "\n\r" is recieved or the buffer is full. (BLOCKING) | |
bool | USART_HasDataToRecieve (const USART_TypeDef *USARTx) |
Checks if there is data available in the USART recieve buffer. | |
Implentation of UART/USART Tx/Rx functions.
void USART_ChangeSerialSpeed | ( | USART_TypeDef * | USARTx, |
SerialSpeed | Serial_x ) |
Changes the Serial speed of the USART.
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
Serial_x | Tx/Rx speed of the USART peripheral (Ex. Serial_115200, Serial_9600, ...) |
bool USART_HasDataToRecieve | ( | const USART_TypeDef * | USARTx | ) |
Checks if there is data available in the USART recieve buffer.
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
void USART_Init | ( | USART_TypeDef * | USARTx, |
SerialSpeed | Serial_x, | ||
bool | useUART ) |
Initilizes the USARTx peripheral at the serial speed Serial_x, and the default.
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
Serial_x | Tx/Rx speed of the USART peripheral (Ex. Serial_115200, Serial_9600, ...) |
SystemClockSpeed | true if you want UART, false if you want USART |
char USART_RecieveChar | ( | const USART_TypeDef * | USARTx | ) |
Recieves a single character from UART/USART (BLOCKING)
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
void USART_RecieveString | ( | const USART_TypeDef * | USARTx, |
char * | buffer, | ||
uint16_t | bufferLen ) |
Recieves a string from UART/USART and stops when "\n\r" is recieved or the buffer is full. (BLOCKING)
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
buffer | Buffer to store the recieved string |
bufferLen | Maximum length of the buffer |
void USART_SendChar | ( | USART_TypeDef * | USARTx, |
char | chr ) |
Sends a single character over UART/USART (BLOCKING)
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
chr | Signular character to send over UART/USART |
void USART_SendString | ( | USART_TypeDef * | USARTx, |
const char * | str ) |
Sends the string str over UART/USART. (Will automatically append "\r\n" to the transmision (BLOCKING))
USARTx | USART Peripheral (Ex. USART1, USART2, ...) |
str | String to send over UART/USART |