Home » Source Code » » stm32f10x_usart.h

stm32f10x_usart.h ( File view )

From:
Description:...
  • By junsheng 2014-03-11
  • View(s):19
  • Download(s):0
  • Point(s): 1
			/**
  ******************************************************************************
  * @file  stm32f10x_usart.h
  * @author  MCD Application Team
  * @version  V3.0.0
  * @date  04/06/2009
  * @brief  This file contains all the functions prototypes for the USART 
  *         firmware library.
  ******************************************************************************
  * @copy
  *
  * 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.
  *
  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_USART_H
#define __STM32F10x_USART_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

/** @addtogroup StdPeriph_Driver
  * @{

  */

/** @addtogroup USART
  * @{

  */ 

/** @defgroup USART_Exported_Types
  * @{

  */ 

/** 
  * @brief  USART Init Structure definition  
  */ 
  
typedef struct
{

  uint32_t USART_BaudRate;
  uint16_t USART_WordLength;
  uint16_t USART_StopBits;
  uint16_t USART_Parity;
  uint16_t USART_Mode;
  uint16_t USART_HardwareFlowControl;  

} USART_InitTypeDef;

/** 
  * @brief  USART Clock Init Structure definition  
  */ 
  
typedef struct
{

  uint16_t USART_Clock;
  uint16_t USART_CPOL;
  uint16_t USART_CPHA;
  uint16_t USART_LastBit;

} USART_ClockInitTypeDef;

/**
  * @
}
  */ 

/** @defgroup USART_Exported_Constants
  * @{

  */ 
  
#define IS_USART_ALL_PERIPH(PERIPH) (((*(uint32_t*)&(PERIPH)) == USART1_BASE) || \
                                     ((*(uint32_t*)&(PERIPH)) == USART2_BASE) || \
                                     ((*(uint32_t*)&(PERIPH)) == USART3_BASE) || \
                                     ((*(uint32_t*)&(PERIPH)) == UART4_BASE) || \
                                     ((*(uint32_t*)&(PERIPH)) == UART5_BASE))
#define IS_USART_123_PERIPH(PERIPH) (((*(uint32_t*)&(PERIPH)) == USART1_BASE) || \
                                     ((*(uint32_t*)&(PERIPH)) == USART2_BASE) || \
                                     ((*(uint32_t*)&(PERIPH)) == USART3_BASE))
#define IS_USART_1234_PERIPH(PERIPH) (((*(uint32_t*)&(PERIPH)) == USART1_BASE) || \
                                      ((*(uint32_t*)&(PERIPH)) == USART2_BASE) || \
                                      ((*(uint32_t*)&(PERIPH)) == USART3_BASE) || \
                                      ((*(uint32_t*)&(PERIPH)) == UART4_BASE))
/** @defgroup USART_Word_Length 
  * @{

  */ 
  
#define USART_WordLength_8b                  ((uint16_t)0x0000)
#define USART_WordLength_9b                  ((uint16_t)0x1000)
                                    
#define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \
                                      ((LENGTH) == USART_WordLength_9b))
/**
  * @
}
  */ 

/** @defgroup USART_Stop_Bits 
  * @{

  */ 
  
#define USART_StopBits_1                     ((uint16_t)0x0000)
#define USART_StopBits_0_5                   ((uint16_t)0x1000)
#define USART_StopBits_2                     ((uint16_t)0x2000)
#define USART_StopBits_1_5                   ((uint16_t)0x3000)
#define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \
                                     ((STOPBITS) == USART_StopBits_0_5) || \
                                     ((STOPBITS) == USART_StopBits_2) || \
                                     ((STOPBITS) == USART_StopBits_1_5))
/**
  * @
}
  */ 

/** @defgroup USART_Parity 
  * @{

  */ 
  
#define USART_Parity_No                      ((uint16_t)0x0000)
#define USART_Parity_Even                    ((uint16_t)0x0400)
#define USART_Parity_Odd                     ((uint16_t)0x0600) 
#define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \
                                 ((PARITY) == USART_Parity_Even) || \
                                 ((PARITY) == USART_Parity_Odd))
/**
  * @
}
  */ 

/** @defgroup USART_Mode 
  * @{

  */ 
  
#define USART_Mode_Rx                        ((uint16_t)0x0004)
#define USART_Mode_Tx                        ((uint16_t)0x0008)
#define IS_USART_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00))
/**
  * @
}
  */ 

/** @defgroup USART_Hardware_Flow_Control 
  * @{

  */ 
#define USART_HardwareFlowControl_None       ((uint16_t)0x0000)
#define USART_HardwareFlowControl_RTS        ((uint16_t)0x0100)
#define USART_HardwareFlowControl_CTS        ((uint16_t)0x0200)
#define USART_HardwareFlowControl_RTS_CTS    ((uint16_t)0x0300)
#define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\
                              (((CONTROL) == USART_HardwareFlowControl_None) || \
                               ((CONTROL) == USART_HardwareFlowControl_RTS) || \
                               ((CONTROL) == USART_HardwareFlowControl_CTS) || \
                               ((CONTROL) == USART_HardwareFlowControl_RTS_CTS))
#define IS_USART_PERIPH_HFC(PERIPH, HFC) ((((*(uint32_t*)&(PERIPH)) != UART4_BASE) && \
                                          ((*(uint32_t*)&(PERIPH)) != UART5_BASE)) \
                                          || ((HFC) == USART_HardwareFlowControl_None))
/**
  * @
}
  */ 

/** @defgroup USART_Clock 
  * @{

  */ 
#define USART_Clock_Disable                  ((uint16_t)0x0000)
#define USART_Clock_Enable                   ((uint16_t)0x0800)
#define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \
                               ((CLOCK) == USART_Clock_Enable))
/**
  * @
}
  */ 

/** @defgroup USART_Clock_Polarity 
  * @{

  */
  
#define USART_CPOL_Low                       ((uint16_t)0x0000)
#define USART_CPOL_High                      ((uint16_t)0x0400)
#define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High))

/**
  * @
}
  */ 

/** @defgroup USART_Clock_Phase
  * @{

  */

#define USART_CPHA_1Edge                     ((uint16_t)0x0000)
#define USART_CPHA_2Edge                     ((uint16_t)0x0200)
#define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge))

/**
  * @
}
  */

/** @defgroup USART_Last_Bit
  * @{

  */

#define USART_LastBit_Disable                ((uint16_t)0x0000)
#define USART_LastBit_Enable                 ((uint16_t)0x0100)
#define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \
                                   ((LASTBIT) == USART_LastBit_Enable))
/**
  * @
}
  */ 

/** @defgroup USART_Interrupt_definition 
  * @{

  */
  
#define USART_IT_PE                          ((uint16_t)0x0028)
#define USART_IT_TXE                         ((uint16_t)0x0727)
#define USART_IT_TC                          ((uint16_t)0x0626)
#define USART_IT_RXNE                        ((uint16_t)0x0525)
#define USART_IT_IDLE                        ((uint16_t)0x0424)
#define USART_IT_LBD                         ((uint16_t)0x0846)
#define USART_IT_CTS                         ((uint16_t)0x096A)
#define USART_IT_ERR                         ((uint16_t)0x0060)
#define USART_IT_ORE                         ((uint16_t)0x0360)
#define USART_IT_NE                          ((uint16_t)0x0260)
#define USART_IT_FE                          ((uint16_t)0x0160)
#define IS_USART_CONFIG_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
                               ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
                               ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
                               ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ERR))
#define IS_USART_GET_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
                            ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
                            ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
                            ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ORE) || \
                            ((IT) == USART_IT_NE) || ((IT) == USART_IT_FE))
#define IS_USART_CLEAR_IT(IT) (((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
                               ((IT) == USART_IT_LBD) || ((IT) == USART_IT_CTS))
#define IS_USART_PERIPH_IT(PERIPH, USART_IT) ((((*(uint32_t*)&(PERIPH)) != UART4_BASE) && \
                                              ((*(uint32_t*)&(PERIPH)) != UART5_BASE)) \
                                              || ((USART_IT) != USART_IT_CTS))
/**
  * @
}
  */

/** @defgroup USART_DMA_Requests 
  * @{

  */

#define USART_DMAReq_Tx                      ((uint16_t)0x0080)
#define USART_DMAReq_Rx                      ((uint16_t)0x0040)
#define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFF3F) == 0x00) && ((DMAREQ) != (uint16_t)0x00))

/**
  * @
}
  */ 

/** @defgroup USART_WakeUp_methods
  * @{

  */

#define USART_WakeUp_IdleLine                ((uint16_t)0x0000)
#define USART_WakeUp_AddressMark             ((uint16_t)0x0800)
#define IS_USART_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \
                                 ((WAKEUP) == USART_WakeUp_AddressMark))
/**
  * @
}
  */

/** @defgroup USART_LI
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
api.crf321.00 kB05-03-14|21:03
api.d1.97 kB05-03-14|21:03
api.o354.55 kB05-03-14|21:03
core_cm3.crf3.44 kB09-03-14|10:20
core_cm3.d117.00 B09-03-14|10:20
core_cm3.o10.04 kB09-03-14|10:20
ExtDll.iex19.00 B30-09-13|23:03
gpio.crf268.62 kB13-12-12|09:33
gpio.d786.00 B13-12-12|09:33
gpio.o283.17 kB13-12-12|09:33
main.crf313.55 kB09-03-14|10:21
main.d1.67 kB09-03-14|10:21
main.o352.55 kB09-03-14|10:21
misc.crf312.89 kB09-03-14|10:19
misc.d1.73 kB09-03-14|10:19
misc.o350.23 kB09-03-14|10:19
os_cpu_a.d53.00 B05-03-14|21:02
os_cpu_a.o1.74 kB05-03-14|21:02
queue.crf5.80 kB13-12-12|09:33
queue.d426.00 B13-12-12|09:33
queue.o15.94 kB13-12-12|09:33
SPI0.00 B17%|09-03-14
SPI0.00 B38%|09-03-14
SPI0.00 B9%|09-03-14
SPI0.00 B24%|09-03-14
SPI0.00 B95%|09-03-14
SPI0.00 B50%|05-03-14
SPI0.00 B18%|09-03-14
SPI0.00 B50%|09-10-13
spiflash.crf276.33 kB13-12-12|09:33
spiflash.d1.22 kB13-12-12|09:33
spiflash.o294.59 kB13-12-12|09:33
spi_2400.crf288.55 kB03-03-14|19:34
spi_2400.d1.04 kB03-03-14|19:34
spi_2400.o305.26 kB03-03-14|19:34
spi_2400.__i400.00 B05-03-14|19:13
startup.d51.00 B05-03-14|21:02
startup.o5.77 kB05-03-14|21:02
startup_stm32f10x_md.d77.00 B07-03-14|19:44
startup_stm32f10x_md.o5.76 kB07-03-14|19:44
stm32f10x_adc.crf319.75 kB09-03-14|10:19
stm32f10x_adc.d2.01 kB09-03-14|10:19
stm32f10x_adc.o363.95 kB09-03-14|10:19
stm32f10x_bkp.crf313.76 kB09-03-14|10:19
stm32f10x_bkp.d2.01 kB09-03-14|10:19
stm32f10x_bkp.o352.49 kB09-03-14|10:19
stm32f10x_can.crf319.68 kB09-03-14|10:19
stm32f10x_can.d2.01 kB09-03-14|10:19
stm32f10x_can.o358.97 kB09-03-14|10:19
stm32f10x_cec.crf323.71 kB05-03-14|21:02
stm32f10x_cec.d2.31 kB05-03-14|21:02
stm32f10x_crc.crf312.49 kB09-03-14|10:19
stm32f10x_crc.d2.01 kB09-03-14|10:19
stm32f10x_crc.o350.20 kB09-03-14|10:19
stm32f10x_dac.crf314.39 kB09-03-14|10:19
stm32f10x_dac.d2.01 kB09-03-14|10:19
stm32f10x_dac.o353.02 kB09-03-14|10:19
stm32f10x_dbgmcu.crf312.24 kB09-03-14|10:19
stm32f10x_dbgmcu.d2.11 kB09-03-14|10:19
stm32f10x_dbgmcu.o349.39 kB09-03-14|10:19
stm32f10x_dma.crf315.22 kB09-03-14|10:19
stm32f10x_dma.d2.01 kB09-03-14|10:19
stm32f10x_dma.o352.88 kB09-03-14|10:19
stm32f10x_exti.crf313.38 kB09-03-14|10:19
stm32f10x_exti.d2.05 kB09-03-14|10:19
stm32f10x_exti.o351.03 kB09-03-14|10:19
stm32f10x_flash.crf318.80 kB09-03-14|10:19
stm32f10x_flash.d2.08 kB09-03-14|10:19
stm32f10x_flash.o359.09 kB09-03-14|10:19
stm32f10x_fsmc.crf318.23 kB09-03-14|10:19
stm32f10x_fsmc.d2.05 kB09-03-14|10:19
stm32f10x_fsmc.o356.60 kB09-03-14|10:19
stm32f10x_gpio.crf315.86 kB09-03-14|10:19
stm32f10x_gpio.d2.05 kB09-03-14|10:19
stm32f10x_gpio.o355.88 kB09-03-14|10:19
stm32f10x_i2c.crf318.47 kB09-03-14|10:19
stm32f10x_i2c.d2.01 kB09-03-14|10:19
stm32f10x_i2c.o361.22 kB09-03-14|10:19
stm32f10x_it.crf312.48 kB09-03-14|10:19
stm32f10x_it.d1.97 kB09-03-14|10:19
stm32f10x_it.o351.21 kB09-03-14|10:19
stm32f10x_iwdg.crf312.55 kB09-03-14|10:19
stm32f10x_iwdg.d2.05 kB09-03-14|10:19
stm32f10x_iwdg.o350.07 kB09-03-14|10:19
stm32f10x_pwr.crf313.82 kB09-03-14|10:19
stm32f10x_pwr.d2.01 kB09-03-14|10:19
stm32f10x_pwr.o351.79 kB09-03-14|10:19
stm32f10x_rcc.crf319.72 kB09-03-14|10:19
stm32f10x_rcc.d2.01 kB09-03-14|10:19
stm32f10x_rcc.o360.86 kB09-03-14|10:19
stm32f10x_rtc.crf313.78 kB09-03-14|10:19
stm32f10x_rtc.d2.01 kB09-03-14|10:19
stm32f10x_rtc.o352.61 kB09-03-14|10:19
stm32f10x_sdio.crf316.86 kB09-03-14|10:19
stm32f10x_sdio.d2.05 kB09-03-14|10:19
stm32f10x_sdio.o357.89 kB09-03-14|10:19
stm32f10x_spi.crf316.50 kB09-03-14|10:19
stm32f10x_spi.d2.01 kB09-03-14|10:19
stm32f10x_spi.o357.61 kB09-03-14|10:19
stm32f10x_tim.crf332.80 kB09-03-14|10:20
stm32f10x_tim.d2.01 kB09-03-14|10:20
stm32f10x_tim.o385.45 kB09-03-14|10:20
stm32f10x_usart.crf317.73 kB09-03-14|10:20
stm32f10x_usart.d2.08 kB09-03-14|10:20
stm32f10x_usart.o359.69 kB09-03-14|10:20
stm32f10x_wwdg.crf312.98 kB09-03-14|10:20
stm32f10x_wwdg.d2.05 kB09-03-14|10:20
stm32f10x_wwdg.o350.93 kB09-03-14|10:20
sysinit.crf216.50 kB05-03-14|19:45
sysinit.d270.00 B05-03-14|19:45
sysinit.o226.87 kB05-03-14|19:45
sysinit.__i358.00 B05-03-14|19:45
system_stm32f10x.crf313.42 kB09-03-14|10:20
system_stm32f10x.d2.02 kB09-03-14|10:20
system_stm32f10x.o350.25 kB09-03-14|10:20
time.crf273.11 kB13-12-12|09:34
time.d1.12 kB13-12-12|09:34
time.o292.04 kB13-12-12|09:34
uart.crf273.73 kB13-12-12|09:34
uart.d1.12 kB13-12-12|09:34
uart.o292.21 kB13-12-12|09:34
os_cpu_a.lst5.56 kB05-03-14|21:02
SPI0.00 B10%|09-03-14
startup.lst38.24 kB05-03-14|21:02
startup_stm32f10x_md.lst40.27 kB07-03-14|19:44
stm32f10x_conf.h3.08 kB05-03-14|22:14
stm32f10x_it.h1.84 kB07-05-09|13:40
JLinkLog.txt53.74 kB09-03-14|12:07
JLinkSettings.ini573.00 B13-12-12|09:33
SPI.uvgui.Administrator134.37 kB09-03-14|14:05
SPI.uvgui_Administrator.bak134.37 kB09-03-14|12:06
SPI.uvopt18.18 kB09-03-14|14:05
SPI.uvproj19.47 kB05-03-14|22:20
SPI_DebugInFlash.dep41.53 kB09-03-14|13:59
SPI_uvopt.bak18.18 kB09-03-14|12:06
SPI_uvproj.bak19.50 kB05-03-14|22:17
core_cm3.c15.87 kB07-05-09|13:40
core_cm3.h41.09 kB07-05-09|13:40
startup_stm32f10x_md.s12.27 kB07-05-09|13:40
stm32f10x.h518.43 kB07-05-09|13:40
system_stm32f10x.c23.60 kB07-03-14|19:35
system_stm32f10x.h2.11 kB07-05-09|13:40
misc.h4.83 kB07-05-09|13:40
stm32f10x_adc.h19.10 kB07-05-09|13:40
stm32f10x_bkp.h7.20 kB07-05-09|13:40
stm32f10x_can.h13.95 kB07-05-09|13:40
stm32f10x_crc.h1.93 kB07-05-09|13:40
stm32f10x_dac.h10.03 kB07-05-09|13:40
stm32f10x_dbgmcu.h2.91 kB07-05-09|13:40
stm32f10x_dma.h18.35 kB07-05-09|13:40
stm32f10x_exti.h5.70 kB07-05-09|13:40
stm32f10x_flash.h14.11 kB07-05-09|13:40
stm32f10x_fsmc.h16.87 kB07-05-09|13:40
stm32f10x_gpio.h14.70 kB07-05-09|13:40
stm32f10x_i2c.h16.53 kB07-05-09|13:40
stm32f10x_iwdg.h3.59 kB07-05-09|13:40
stm32f10x_pwr.h4.10 kB07-05-09|13:40
stm32f10x_rcc.h15.88 kB07-05-09|13:40
stm32f10x_rtc.h3.57 kB07-05-09|13:40
stm32f10x_sdio.h18.16 kB07-05-09|13:40
stm32f10x_spi.h14.55 kB07-05-09|13:40
stm32f10x_tim.h47.63 kB07-05-09|13:40
stm32f10x_usart.h14.14 kB07-05-09|13:40
stm32f10x_wwdg.h2.72 kB07-05-09|13:40
misc.c6.71 kB07-05-09|13:40
stm32f10x_adc.c45.54 kB07-05-09|13:40
stm32f10x_bkp.c8.05 kB07-05-09|13:40
stm32f10x_can.c30.23 kB07-05-09|13:40
stm32f10x_crc.c3.26 kB07-05-09|13:40
stm32f10x_dac.c13.40 kB07-05-09|13:40
stm32f10x_dbgmcu.c4.21 kB07-05-09|13:40
stm32f10x_dma.c26.72 kB07-05-09|13:40
stm32f10x_exti.c6.64 kB07-05-09|13:40
stm32f10x_flash.c25.73 kB07-05-09|13:40
stm32f10x_fsmc.c34.11 kB07-05-09|13:40
stm32f10x_gpio.c17.47 kB07-05-09|13:40
stm32f10x_i2c.c36.45 kB07-05-09|13:40
stm32f10x_iwdg.c4.70 kB07-05-09|13:40
stm32f10x_pwr.c8.72 kB07-05-09|13:40
stm32f10x_rcc.c32.99 kB07-05-09|13:40
stm32f10x_rtc.c8.38 kB07-05-09|13:40
stm32f10x_sdio.c27.82 kB07-05-09|13:40
stm32f10x_spi.c27.09 kB07-05-09|13:40
stm32f10x_tim.c99.50 kB07-05-09|13:40
stm32f10x_usart.c34.11 kB07-05-09|13:40
stm32f10x_wwdg.c5.49 kB07-05-09|13:40
main.c4.15 kB09-03-14|10:21
stm32f10x_it.c4.38 kB07-03-14|19:36
DebugInFlash0.00 B09-03-14|10:21
List0.00 B05-03-14|22:18
inc0.00 B05-03-14|22:07
src0.00 B05-03-14|22:07
debug0.00 B25-11-13|17:30
inc0.00 B05-03-14|22:14
startup0.00 B07-03-14|19:35
stm32lib0.00 B05-03-14|22:07
user0.00 B09-03-14|10:21
lowpower0.00 B09-03-14|14:05
standbylowpower0.00 B07-03-14|19:46
...
Sponsored links

stm32f10x_usart.h (4.23 MB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D