ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
Loading...
Searching...
No Matches
ACDC_USART.h
Go to the documentation of this file.
1
11#ifndef __ACDC_USART_H
12#define __ACDC_USART_H
13
14#include "stm32f1xx.h"
15#include "ACDC_CLOCK.h"
16
17typedef enum{ // UART/USART Serial Speed
18 Serial_1200 = 1200,
19 Serial_2400 = 2400,
20 Serial_4800 = 4800,
21 Serial_9600 = 9600,
22 Serial_19200 = 19200,
23 Serial_38400 = 38400,
24 Serial_57600 = 57600,
25 Serial_115200 = 115200,
26 Serial_230400 = 230400
28
33void USART_Init(USART_TypeDef *USARTx, SerialSpeed Serial_x, bool useUART);
34
38void USART_ChangeSerialSpeed(USART_TypeDef *USARTx, SerialSpeed Serial_x);
39
43void USART_SendChar(USART_TypeDef *USARTx, char chr);
44
48void USART_SendString(USART_TypeDef *USARTx, const char* str);
49
53char USART_RecieveChar(const USART_TypeDef *USARTx);
54
59void USART_RecieveString(const USART_TypeDef *USARTx, char* buffer, uint16_t bufferLen);
60
64bool USART_HasDataToRecieve(const USART_TypeDef *USARTx);
65
66#endif
Header file containing functions for configuring the system clock and clock-related peripherals.
void USART_SendChar(USART_TypeDef *USARTx, char chr)
Sends a single character over UART/USART (BLOCKING)
Definition ACDC_USART.c:71
void USART_ChangeSerialSpeed(USART_TypeDef *USARTx, SerialSpeed Serial_x)
Changes the Serial speed of the USART.
Definition ACDC_USART.c:61
SerialSpeed
Definition ACDC_USART.h:17
@ Serial_9600
Definition ACDC_USART.h:21
@ Serial_230400
Definition ACDC_USART.h:26
@ Serial_115200
Definition ACDC_USART.h:25
@ Serial_4800
Definition ACDC_USART.h:20
@ Serial_2400
Definition ACDC_USART.h:19
@ Serial_38400
Definition ACDC_USART.h:23
@ Serial_19200
Definition ACDC_USART.h:22
@ Serial_1200
Definition ACDC_USART.h:18
@ Serial_57600
Definition ACDC_USART.h:24
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....
Definition ACDC_USART.c:89
void USART_Init(USART_TypeDef *USARTx, SerialSpeed Serial_x, bool useUART)
Initilizes the USARTx peripheral at the serial speed Serial_x, and the default.
Definition ACDC_USART.c:43
char USART_RecieveChar(const USART_TypeDef *USARTx)
Recieves a single character from UART/USART (BLOCKING)
Definition ACDC_USART.c:84
bool USART_HasDataToRecieve(const USART_TypeDef *USARTx)
Checks if there is data available in the USART recieve buffer.
Definition ACDC_USART.c:103
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)...
Definition ACDC_USART.c:76
unsigned short uint16_t
Definition ACDC_stdint.h:15