Macros | Functions
stm32f30x_usart.c File Reference

This file provides firmware functions to manage the following functionalities of the Universal synchronous asynchronous receiver transmitter (USART): More...

#include "stm32f30x_usart.h"
#include "stm32f30x_rcc.h"
Include dependency graph for stm32f30x_usart.c:

Go to the source code of this file.

Macros

#define CR1_CLEAR_MASK
 
#define CR2_CLOCK_CLEAR_MASK
 
#define CR3_CLEAR_MASK   ((uint32_t)(USART_CR3_RTSE | USART_CR3_CTSE))
 
#define IT_MASK   ((uint32_t)0x000000FF)
 

Functions

void USART_AddressDetectionConfig (USART_TypeDef *USARTx, uint32_t USART_AddressLength)
 Configure the the USART Address detection length. More...
 
void USART_AutoBaudRateCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the Auto Baud Rate. More...
 
void USART_AutoBaudRateConfig (USART_TypeDef *USARTx, uint32_t USART_AutoBaudRate)
 Selects the USART auto baud rate method. More...
 
void USART_ClearFlag (USART_TypeDef *USARTx, uint32_t USART_FLAG)
 Clears the USARTx's pending flags. More...
 
void USART_ClearITPendingBit (USART_TypeDef *USARTx, uint32_t USART_IT)
 Clears the USARTx's interrupt pending bits. More...
 
void USART_ClockInit (USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
 Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . More...
 
void USART_ClockStructInit (USART_ClockInitTypeDef *USART_ClockInitStruct)
 Fills each USART_ClockInitStruct member with its default value. More...
 
void USART_Cmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the specified USART peripheral. More...
 
void USART_DataInvCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the binary data inversion. More...
 
void USART_DECmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's DE functionality. More...
 
void USART_DeInit (USART_TypeDef *USARTx)
 Deinitializes the USARTx peripheral registers to their default reset values. More...
 
void USART_DEPolarityConfig (USART_TypeDef *USARTx, uint32_t USART_DEPolarity)
 Configures the USART's DE polarity. More...
 
void USART_DirectionModeCmd (USART_TypeDef *USARTx, uint32_t USART_DirectionMode, FunctionalState NewState)
 Enables or disables the USART's transmitter or receiver. More...
 
void USART_DMACmd (USART_TypeDef *USARTx, uint32_t USART_DMAReq, FunctionalState NewState)
 Enables or disables the USART's DMA interface. More...
 
void USART_DMAReceptionErrorConfig (USART_TypeDef *USARTx, uint32_t USART_DMAOnError)
 Enables or disables the USART's DMA interface when reception error occurs. More...
 
FlagStatus USART_GetFlagStatus (USART_TypeDef *USARTx, uint32_t USART_FLAG)
 Checks whether the specified USART flag is set or not. More...
 
ITStatus USART_GetITStatus (USART_TypeDef *USARTx, uint32_t USART_IT)
 Checks whether the specified USART interrupt has occurred or not. More...
 
void USART_HalfDuplexCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's Half Duplex communication. More...
 
void USART_Init (USART_TypeDef *USARTx, USART_InitTypeDef *USART_InitStruct)
 Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct . More...
 
void USART_InvPinCmd (USART_TypeDef *USARTx, uint32_t USART_InvPin, FunctionalState NewState)
 Enables or disables the Pin(s) active level inversion. More...
 
void USART_IrDACmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's IrDA interface. More...
 
void USART_IrDAConfig (USART_TypeDef *USARTx, uint32_t USART_IrDAMode)
 Configures the USART's IrDA interface. More...
 
void USART_ITConfig (USART_TypeDef *USARTx, uint32_t USART_IT, FunctionalState NewState)
 Enables or disables the specified USART interrupts. More...
 
void USART_LINBreakDetectLengthConfig (USART_TypeDef *USARTx, uint32_t USART_LINBreakDetectLength)
 Sets the USART LIN Break detection length. More...
 
void USART_LINCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's LIN mode. More...
 
void USART_MSBFirstCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's most significant bit first transmitted/received following the start bit. More...
 
void USART_MuteModeCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's mute mode. More...
 
void USART_MuteModeWakeUpConfig (USART_TypeDef *USARTx, uint32_t USART_WakeUp)
 Selects the USART WakeUp method from mute mode. More...
 
void USART_OneBitMethodCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's one bit sampling method. More...
 
void USART_OverrunDetectionConfig (USART_TypeDef *USARTx, uint32_t USART_OVRDetection)
 Enables or disables the USART's Overrun detection. More...
 
void USART_OverSampling8Cmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's 8x oversampling mode. More...
 
uint16_t USART_ReceiveData (USART_TypeDef *USARTx)
 Returns the most recent received data by the USARTx peripheral. More...
 
void USART_ReceiverTimeOutCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the receiver Time Out feature. More...
 
void USART_RequestCmd (USART_TypeDef *USARTx, uint32_t USART_Request, FunctionalState NewState)
 Enables the specified USART's Request. More...
 
void USART_SendData (USART_TypeDef *USARTx, uint16_t Data)
 Transmits single data through the USARTx peripheral. More...
 
void USART_SetAddress (USART_TypeDef *USARTx, uint8_t USART_Address)
 Sets the address of the USART node. More...
 
void USART_SetAutoRetryCount (USART_TypeDef *USARTx, uint8_t USART_AutoCount)
 Sets the Smart Card number of retries in transmit and receive. More...
 
void USART_SetBlockLength (USART_TypeDef *USARTx, uint8_t USART_BlockLength)
 Sets the Smart Card Block length. More...
 
void USART_SetDEAssertionTime (USART_TypeDef *USARTx, uint32_t USART_DEAssertionTime)
 Sets the specified RS485 DE assertion time. More...
 
void USART_SetDEDeassertionTime (USART_TypeDef *USARTx, uint32_t USART_DEDeassertionTime)
 Sets the specified RS485 DE deassertion time. More...
 
void USART_SetGuardTime (USART_TypeDef *USARTx, uint8_t USART_GuardTime)
 Sets the specified USART guard time. More...
 
void USART_SetPrescaler (USART_TypeDef *USARTx, uint8_t USART_Prescaler)
 Sets the system clock prescaler. More...
 
void USART_SetReceiverTimeOut (USART_TypeDef *USARTx, uint32_t USART_ReceiverTimeOut)
 Sets the receiver Time Out value. More...
 
void USART_SmartCardCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's Smart Card mode. More...
 
void USART_SmartCardNACKCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables NACK transmission. More...
 
void USART_STOPModeCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the specified USART peripheral in STOP Mode. More...
 
void USART_StopModeWakeUpSourceConfig (USART_TypeDef *USARTx, uint32_t USART_WakeUpSource)
 Selects the USART WakeUp method form stop mode. More...
 
void USART_StructInit (USART_InitTypeDef *USART_InitStruct)
 Fills each USART_InitStruct member with its default value. More...
 
void USART_SWAPPinCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the swap Tx/Rx pins. More...
 

Detailed Description

This file provides firmware functions to manage the following functionalities of the Universal synchronous asynchronous receiver transmitter (USART):

Author
MCD Application Team
Version
V1.1.1
Date
04-April-2014
  • Initialization and Configuration
  • STOP Mode
  • AutoBaudRate
  • Data transfers
  • Multi-Processor Communication
  • LIN mode
  • Half-duplex mode
  • Smartcard mode
  • IrDA mode
  • RS485 mode
  • DMA transfers management
  • Interrupts and flags management
===============================================================================
                     ##### How to use this driver #####
===============================================================================
     [..]
         (#) Enable peripheral clock using RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE)
            function for USART1 or using RCC_APB1PeriphClockCmd(RCC_APB1Periph_USARTx, ENABLE)
            function for USART2, USART3, UART4 and UART5.
         (#)  According to the USART mode, enable the GPIO clocks using
             RCC_AHBPeriphClockCmd() function. (The I/O can be TX, RX, CTS,
             or and SCLK).
         (#) Peripheral's alternate function:
             (++) Connect the pin to the desired peripherals' Alternate
                  Function (AF) using GPIO_PinAFConfig() function.
             (++) Configure the desired pin in alternate function by:
                  GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF.
             (++) Select the type, pull-up/pull-down and output speed via
                  GPIO_PuPd, GPIO_OType and GPIO_Speed members.
             (++) Call GPIO_Init() function.
         (#) Program the Baud Rate, Word Length , Stop Bit, Parity, Hardware
            flow control and Mode(Receiver/Transmitter) using the SPI_Init()
            function.
         (#) For synchronous mode, enable the clock and program the polarity,
            phase and last bit using the USART_ClockInit() function.
         (#) Enable the USART using the USART_Cmd() function.
         (#) Enable the NVIC and the corresponding interrupt using the function
            USART_ITConfig() if you need to use interrupt mode.
         (#) When using the DMA mode:
             (++) Configure the DMA using DMA_Init() function.
             (++) Activate the needed channel Request using USART_DMACmd() function.
         (#) Enable the DMA using the DMA_Cmd() function, when using DMA mode.
     [..]
             Refer to Multi-Processor, LIN, half-duplex, Smartcard, IrDA sub-sections
             for more details.
Attention

© COPYRIGHT 2014 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file stm32f30x_usart.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:27