STM32F1 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F1 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Groups
stm32f10x_usart.c File Reference

This file provides all the USART firmware functions. More...

#include "stm32f10x_usart.h"
#include "stm32f10x_rcc.h"

Macros

#define CR1_UE_Set   ((uint16_t)0x2000)
 
#define CR1_UE_Reset   ((uint16_t)0xDFFF)
 
#define CR1_WAKE_Mask   ((uint16_t)0xF7FF)
 
#define CR1_RWU_Set   ((uint16_t)0x0002)
 
#define CR1_RWU_Reset   ((uint16_t)0xFFFD)
 
#define CR1_SBK_Set   ((uint16_t)0x0001)
 
#define CR1_CLEAR_Mask   ((uint16_t)0xE9F3)
 
#define CR2_Address_Mask   ((uint16_t)0xFFF0)
 
#define CR2_LINEN_Set   ((uint16_t)0x4000)
 
#define CR2_LINEN_Reset   ((uint16_t)0xBFFF)
 
#define CR2_LBDL_Mask   ((uint16_t)0xFFDF)
 
#define CR2_STOP_CLEAR_Mask   ((uint16_t)0xCFFF)
 
#define CR2_CLOCK_CLEAR_Mask   ((uint16_t)0xF0FF)
 
#define CR3_SCEN_Set   ((uint16_t)0x0020)
 
#define CR3_SCEN_Reset   ((uint16_t)0xFFDF)
 
#define CR3_NACK_Set   ((uint16_t)0x0010)
 
#define CR3_NACK_Reset   ((uint16_t)0xFFEF)
 
#define CR3_HDSEL_Set   ((uint16_t)0x0008)
 
#define CR3_HDSEL_Reset   ((uint16_t)0xFFF7)
 
#define CR3_IRLP_Mask   ((uint16_t)0xFFFB)
 
#define CR3_CLEAR_Mask   ((uint16_t)0xFCFF)
 
#define CR3_IREN_Set   ((uint16_t)0x0002)
 
#define CR3_IREN_Reset   ((uint16_t)0xFFFD)
 
#define GTPR_LSB_Mask   ((uint16_t)0x00FF)
 
#define GTPR_MSB_Mask   ((uint16_t)0xFF00)
 
#define IT_Mask   ((uint16_t)0x001F)
 
#define CR1_OVER8_Set   ((u16)0x8000) /* USART OVER8 mode Enable Mask */
 
#define CR1_OVER8_Reset   ((u16)0x7FFF) /* USART OVER8 mode Disable Mask */
 
#define CR3_ONEBITE_Set   ((u16)0x0800) /* USART ONEBITE mode Enable Mask */
 
#define CR3_ONEBITE_Reset   ((u16)0xF7FF) /* USART ONEBITE mode Disable Mask */
 

Functions

void USART_DeInit (USART_TypeDef *USARTx)
 Deinitializes the USARTx peripheral registers to their default reset values. 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_StructInit (USART_InitTypeDef *USART_InitStruct)
 Fills each USART_InitStruct member with its default value. 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_ITConfig (USART_TypeDef *USARTx, uint16_t USART_IT, FunctionalState NewState)
 Enables or disables the specified USART interrupts. More...
 
void USART_DMACmd (USART_TypeDef *USARTx, uint16_t USART_DMAReq, FunctionalState NewState)
 Enables or disables the USART’s DMA interface. More...
 
void USART_SetAddress (USART_TypeDef *USARTx, uint8_t USART_Address)
 Sets the address of the USART node. More...
 
void USART_WakeUpConfig (USART_TypeDef *USARTx, uint16_t USART_WakeUp)
 Selects the USART WakeUp method. More...
 
void USART_ReceiverWakeUpCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Determines if the USART is in mute mode or not. More...
 
void USART_LINBreakDetectLengthConfig (USART_TypeDef *USARTx, uint16_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_SendData (USART_TypeDef *USARTx, uint16_t Data)
 Transmits single data through the USARTx peripheral. More...
 
uint16_t USART_ReceiveData (USART_TypeDef *USARTx)
 Returns the most recent received data by the USARTx peripheral. More...
 
void USART_SendBreak (USART_TypeDef *USARTx)
 Transmits break characters. 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_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_HalfDuplexCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART’s Half Duplex communication. More...
 
void USART_OverSampling8Cmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's 8x oversampling mode. More...
 
void USART_OneBitMethodCmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART's one bit sampling methode. More...
 
void USART_IrDAConfig (USART_TypeDef *USARTx, uint16_t USART_IrDAMode)
 Configures the USART’s IrDA interface. More...
 
void USART_IrDACmd (USART_TypeDef *USARTx, FunctionalState NewState)
 Enables or disables the USART’s IrDA interface. More...
 
FlagStatus USART_GetFlagStatus (USART_TypeDef *USARTx, uint16_t USART_FLAG)
 Checks whether the specified USART flag is set or not. More...
 
void USART_ClearFlag (USART_TypeDef *USARTx, uint16_t USART_FLAG)
 Clears the USARTx's pending flags. More...
 
ITStatus USART_GetITStatus (USART_TypeDef *USARTx, uint16_t USART_IT)
 Checks whether the specified USART interrupt has occurred or not. More...
 
void USART_ClearITPendingBit (USART_TypeDef *USARTx, uint16_t USART_IT)
 Clears the USARTx’s interrupt pending bits. More...
 
void USART_putchar (USART_TypeDef *USARTx, uint16_t Data)
 

Detailed Description

This file provides all the USART firmware functions.

Author
MCD Application Team
Version
V3.3.0
Date
04/16/2010

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics