Header file containing various functions for sending, receiving, and initilizing the UART/USART prehiperal.  
More...
#include "stm32f1xx.h"
#include "ACDC_CLOCK.h"
 
Go to the source code of this file.
 | 
| 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.  
  | 
|   | 
Header file containing various functions for sending, receiving, and initilizing the UART/USART prehiperal. 
- Author
 - Devin Marx 
 
- Version
 - 0.1 
 
- Date
 - 2023-11-8
 
- Copyright
 - Copyright (c) 2023-2024 
 
 
◆ SerialSpeed
| Enumerator | 
|---|
| Serial_1200  | Baud rate: 1200 bps  
  
 | 
| Serial_2400  | Baud rate: 2400 bps  
  
 | 
| Serial_4800  | Baud rate: 4800 bps  
  
 | 
| Serial_9600  | Baud rate: 9600 bps  
  
 | 
| Serial_19200  | Baud rate: 19200 bps  
  
 | 
| Serial_38400  | Baud rate: 38400 bps  
  
 | 
| Serial_57600  | Baud rate: 57600 bps  
  
 | 
| Serial_115200  | Baud rate: 115200 bps  
 | 
| Serial_230400  | Baud rate: 230400 bps  
 | 
 
 
◆ USART_ChangeSerialSpeed()
      
        
          | void USART_ChangeSerialSpeed  | 
          ( | 
          USART_TypeDef * |           USARTx,  | 
        
        
           | 
           | 
          SerialSpeed |           Serial_x ) | 
        
      
 
Changes the Serial speed of the USART. 
- Parameters
 - 
  
    | USARTx | USART Peripheral (Ex. USART1, USART2, ...)  | 
    | Serial_x | Tx/Rx speed of the USART peripheral (Ex. Serial_115200, Serial_9600, ...)  | 
  
   
 
 
◆ USART_HasDataToRecieve()
      
        
          | bool USART_HasDataToRecieve  | 
          ( | 
          const USART_TypeDef * |           USARTx | ) | 
           | 
        
      
 
Checks if there is data available in the USART recieve buffer. 
- Parameters
 - 
  
    | USARTx | USART Peripheral (Ex. USART1, USART2, ...)  | 
  
   
- Returns
 - True if there is data available to recieve, false otherwise. 
 
 
 
◆ USART_Init()
      
        
          | void USART_Init  | 
          ( | 
          USART_TypeDef * |           USARTx,  | 
        
        
           | 
           | 
          SerialSpeed |           Serial_x,  | 
        
        
           | 
           | 
          bool |           useUART ) | 
        
      
 
Initilizes the USARTx peripheral at the serial speed Serial_x, and the default. 
- Parameters
 - 
  
    | 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  | 
  
   
 
 
◆ USART_RecieveChar()
      
        
          | char USART_RecieveChar  | 
          ( | 
          const USART_TypeDef * |           USARTx | ) | 
           | 
        
      
 
Recieves a single character from UART/USART (BLOCKING) 
- Parameters
 - 
  
    | USARTx | USART Peripheral (Ex. USART1, USART2, ...)  | 
  
   
- Returns
 - Character recieved over UART/USART 
 
 
 
◆ USART_RecieveString()
      
        
          | 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) 
- Parameters
 - 
  
    | USARTx | USART Peripheral (Ex. USART1, USART2, ...)  | 
    | buffer | Buffer to store the recieved string  | 
    | bufferLen | Maximum length of the buffer  | 
  
   
 
 
◆ USART_SendChar()
      
        
          | void USART_SendChar  | 
          ( | 
          USART_TypeDef * |           USARTx,  | 
        
        
           | 
           | 
          char |           chr ) | 
        
      
 
Sends a single character over UART/USART (BLOCKING) 
- Parameters
 - 
  
    | USARTx | USART Peripheral (Ex. USART1, USART2, ...)  | 
    | chr | Signular character to send over UART/USART  | 
  
   
 
 
◆ USART_SendString()
      
        
          | 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)) 
- Parameters
 - 
  
    | USARTx | USART Peripheral (Ex. USART1, USART2, ...)  | 
    | str | String to send over UART/USART  |