stm32库中文版
目录
1.1 缩写.......................................................................................................................................................... 27
1.2 命名规则 .................................................................................................................................................. 27
1.3 编码规则 .................................................................................................................................................. 28
1.3.1 变量 ................................................................................................................................................ 28
1.3.2 布尔型 ............................................................................................................................................ 28
1.3.3 标志位状态类型 ........................................................................................................................... 29
1.3.4 功能状态类型 ............................................................................................................................... 29
1.3.5 错误状态类型 ............................................................................................................................... 29
1.3.6 外设 ............................................................................................................................................... 29
2.1 压缩包描述 .............................................................................................................................................. 32
2.1.1 文件夹Examples............................................................................................................................ 32
2.1.2 文件夹Library ............................................................................................................................... 32
2.1.3 文件夹Project................................................................................................................................ 33
2.2 固件函数库文件描述 .............................................................................................................................. 33
2.3 外设的初始化和设置 .............................................................................................................................. 34
2.4 位段(Bit-Banding)............................................................................................................................... 35
2.4.1 映射公式 ....................................................................................................................................... 35
2.4.2 应用实例 ....................................................................................................................................... 35
2.5 运行时间检测 .......................................................................................................................................... 36
4.1 ADC寄存器结构....................................................................................................................................... 39
4.2 ADC库函数............................................................................................................................................... 40
4.2.1 函数ADC_DeInit........................................................................................................................... 42
4.2.2 函数ADC_Init ............................................................................................................................... 42
4.2.3 函数ADC_StructInit...................................................................................................................... 44
4.2.4 函数ADC_Cmd ............................................................................................................................. 44
4.2.5 函数ADC_DMACmd.................................................................................................................... 45
4.2.6 函数ADC_ITConfig ...................................................................................................................... 45
4.2.7 函数ADC_ResetCalibration .......................................................................................................... 46
4.2.8 函数ADC_GetResetCalibrationStatus........................................................................................... 46
4.2.9 函数ADC_StartCalibration ........................................................................................................... 46
4.2.10 函数ADC_GetCalibrationStatus.................................................................................................. 47
4.2.11 函数ADC_SoftwareStartConvCmd............................................................................................. 47
4.2.12 函数ADC_GetSoftwareStartConvStatus..................................................................................... 48
4.2.13 函数ADC_DiscModeChannelCountConfig ................................................................................ 48
4.2.14 函数ADC_DiscModeCmd........................................................................................................... 49
4.2.15 函数ADC_RegularChannelConfig.............................................................................................. 49
4.2.16 函数ADC_ExternalTrigConvConfig........................................................................................... 51
4.2.17 函数ADC_GetConversionValue.................................................................................................. 51
4.2.18 函数ADC_GetDuelModeConversionValue................................................................................. 52
4.2.19 函数ADC_AutoInjectedConvCmd.............................................................................................. 52
4.2.20 函数ADC_InjectedDiscModeCmd.............................................................................................. 53
4.2.21 函数ADC_ExternalTrigInjectedConvConfig .............................................................................. 53
4.2.22 函数ADC_ExternalTrigInjectedConvCmd.................................................................................. 54
4.2.23 函数ADC_SoftwareStartinjectedConvCmd ................................................................................ 54
4.2.24 函数ADC_GetsoftwareStartinjectedConvStatus ......................................................................... 55
4.2.25 函数ADC_InjectedChannleConfig.............................................................................................. 55
4.2.26 函数ADC_InjectedSequencerLengthConfig ............................................................................... 56
4.2.27 函数ADC_SetinjectedOffset ....................................................................................................... 56
4.2.28 函数ADC_GetInjectedConversionValue..................................................................................... 57
4.2.29 函数ADC_AnalogWatchdogCmd ............................................................................................... 57
目录
3/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
4.2.30 函数ADC_AnalogWatchdongThresholdsConfig ........................................................................ 58
4.2.31 函数ADC_AnalogWatchdongSingleChannelConfig................................................................... 58
4.2.32 函数ADC_TampSensorVrefintCmd ............................................................................................ 59
4.2.33 函数ADC_GetFlagStatus ............................................................................................................ 59
4.2.34 函数ADC_ClearFlag ................................................................................................................... 60
4.2.35 函数ADC_GetITStatus................................................................................................................ 60
4.2.36 函数ADC_ClearITPendingBit..................................................................................................... 61
5.1 BKP寄存器结构..................................................................................................................................... 62
5.2 BKP库函数 ............................................................................................................................................... 63
5.2.1 函数BKP_DeInit ........................................................................................................................... 64
5.2.2 函数BKP_TamperPinLevelConfig................................................................................................ 64
5.2.3 函数BKP_TamperPinCmd ............................................................................................................ 65
5.2.4 函数BKP_ITConfig....................................................................................................................... 65
5.2.5 函数BKP_RTCOutputConfig........................................................................................................ 66
5.2.6 函数BKP_SetRTCCalibrationValue .............................................................................................. 66
5.2.7 函数BKP_WriteBackupRegister ................................................................................................... 67
5.2.8 函数BKP_ReadBackupRegister.................................................................................................... 67
5.2.9 函数BKP_GetFlagStatus............................................................................................................... 68
5.2.10 函数BKP_ClearFlag.................................................................................................................... 68
5.2.11 函数BKP_GetITStatus................................................................................................................. 69
5.2.12 函数BKP_ClearITPendingBit ..................................................................................................... 69
6.1 CAN寄存器结构....................................................................................................................................... 70
6.2 CAN库函数............................................................................................................................................... 72
6.2.1 函数CAN_DeInit........................................................................................................................... 72
6.2.2 函数CAN_Init ............................................................................................................................... 73
6.2.3 函数CAN_FilterInit....................................................................................................................... 75
6.2.4 函数CAN_StructInit...................................................................................................................... 76
6.2.5 函数CAN_ITConfig ...................................................................................................................... 77
6.2.6 函数CAN_Transmit....................................................................................................................... 78
6.2.7 函数CAN_TransmitStatus............................................................................................................. 79
6.2.8 函数CAN_CancelTransmit............................................................................................................ 79
6.2.9 函数CAN_FIFORelease................................................................................................................ 80
6.2.10 函数CAN_MessagePending........................................................................................................ 80
6.2.11 函数CAN_Receive ...................................................................................................................... 81
6.2.12 函数CAN_Sleep.......................................................................................................................... 82
6.2.13 函数CAN_WakeUp ..................................................................................................................... 82
6.2.14 函数CAN_GetFlagStatus ............................................................................................................ 83
6.2.15 函数CAN_ClearFlag ................................................................................................................... 83
6.2.16 函数CAN_GetITStatus................................................................................................................ 84
6.2.17 函数CAN_ClearITPendingBit..................................................................................................... 85
7.1 DMA寄存器结构...................................................................................................................................... 86
7.2 DMA库函数.............................................................................................................................................. 88
7.2.1 函数DMA_DeInit.......................................................................................................................... 89
7.2.2 函数DMA_Init .............................................................................................................................. 89
7.2.3 函数DMA_StructInit..................................................................................................................... 92
7.2.4 函数DMA_Cmd ............................................................................................................................ 92
7.2.5 函数DMA_ITConfig ..................................................................................................................... 93
7.2.6 函数DMA_GetCurrDataCounte.................................................................................................... 93
7.2.7 函数DMA_GetFlagStatus ............................................................................................................. 94
7.2.8 函数DMA_ClearFlag .................................................................................................................... 95
7.2.9 函数DMA_GetITStatus................................................................................................................. 95
7.2.10 函数DMA_ClearITPendingBit.................................................................................................... 96
8.1 EXTI寄存器结构...................................................................................................................................... 97
目录
4/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
8.2 EXTI库函数.............................................................................................................................................. 98
8.2.1 函数EXTI_DeInit.......................................................................................................................... 98
8.2.2 函数EXTI_Init............................................................................................................................... 99
8.2.3 函数EXTI_StructInit ................................................................................................................... 100
8.2.4 函数EXTI_GenerateSWInterrupt................................................................................................ 101
8.2.5 函数EXTI_GetFlagStatus............................................................................................................ 101
8.2.6 函数EXTI_ClearFlag .................................................................................................................. 102
8.2.7 函数EXTI_GetITStatus............................................................................................................... 102
8.2.8 函数EXTI_ClearITPendingBit.................................................................................................... 103
9.1 FLASH寄存器结构................................................................................................................................. 104
9.2 FLASH库函数......................................................................................................................................... 105
9.2.1 函数FLASH_SetLatency............................................................................................................. 106
9.2.2 函数FLASH_HalfCycleAccessCmd ........................................................................................... 107
9.2.3 函数FLASH_PrefetchBufferCmd ............................................................................................... 107
9.2.4 函数FLASH_Unlock................................................................................................................... 108
9.2.5 函数FLASH_Lock ...................................................................................................................... 108
9.2.6 函数FLASH_ErasePage .............................................................................................................. 109
9.2.7 函数FLASH_EraseAllPages ....................................................................................................... 109
9.2.8 函数FLASH_EraseOptionBytes...................................................................................................110
9.2.9 函数FLASH_ProgramWord .........................................................................................................110
9.2.10 函数FLASH_ProgramHalfWord ................................................................................................111
9.2.11 函数FLASH_ProgramOptionByteData ......................................................................................111
9.2.12 函数FLASH_EnableWriteProtection .........................................................................................112
9.2.13 函数FLASH_ReadOutProtection ...............................................................................................113
9.2.14 函数FLASH_UserOptionByteConfig.........................................................................................114
9.2.15 函数FLASH_GetUserOptionByte..............................................................................................115
9.2.16 函数FLASH_GetWriteProtectionOptionByte ............................................................................115
9.2.17 函数FLASH_GetReadOutProtectionStatus................................................................................116
9.2.18 函数FLASH_GetPrefetchBufferStatus.......................................................................................116
9.2.19 函数FLASH_ITConfig...............................................................................................................117
9.2.20 函数FLASH_GetFlagStatus.......................................................................................................117
9.2.21 函数FLASH_ClearFlag..............................................................................................................118
9.2.22 函数FLASH_GetStatus..............................................................................................................119
9.2.23 函数FLASH_WaitForLastOperation..........................................................................................119
10.1 GPIO寄存器结构.................................................................................................................................. 120
10.2 GPIO库函数.......................................................................................................................................... 122
10.2.1 函数GPIO_DeInit...................................................................................................................... 123
10.2.2 函数GPIO_AFIODeInit............................................................................................................. 123
10.2.3 函数GPIO_Init .......................................................................................................................... 124
10.2.4 函数GPIO_StructInit................................................................................................................. 126
10.2.5 函数GPIO_ReadInputDataBit................................................................................................... 126
10.2.6 函数GPIO_ReadInputData........................................................................................................ 127
10.2.7 函数GPIO_ReadOutputDataBit ................................................................................................ 127
10.2.8 函数GPIO_ReadOutputData ..................................................................................................... 128
10.2.9 函数GPIO_SetBits .................................................................................................................... 128
10.2.10 函数GPIO_ResetBits............................................................................................................... 129
10.2.11 函数GPIO_WriteBit ................................................................................................................ 129
10.2.12 函数GPIO_Write ..................................................................................................................... 130
10.2.13 函数GPIO_PinLockConfig ..................................................................................................... 130
10.2.14 函数GPIO_EventOutputConfig............................................................................................... 131
10.2.15 函数GPIO_EventOutputCmd.................................................................................................. 131
10.2.16 函数GPIO_PinRemapConfig .................................................................................................. 132
10.2.17 函数GPIO_EXTILineConfig................................................................................................... 133
目录
5/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
11.1 I2C寄存器结构 ..................................................................................................................................... 134
11.2 I2C库函数 ............................................................................................................................................. 135
11.2.1 函数I2C_DeInit ......................................................................................................................... 136
11.2.2 函数I2C_ Init............................................................................................................................. 137
11.2.3 函数I2C_ StructInit ................................................................................................................... 138
11.2.4 函数I2C_ Cmd........................................................................................................................... 139
11.2.5 函数I2C_ DMACmd ................................................................................................................. 139
11.2.6 函数I2C_ DMALastTransferCmd ............................................................................................. 140
11.2.7 函数I2C_ GenerateSTART........................................................................................................ 140
11.2.8 函数I2C_ GenerateSTOP .......................................................................................................... 141
11.2.9 函数I2C_ AcknowledgeConfig.................................................................................................. 141
11.2.10 函数I2C_ OwnAddress2Config............................................................................................... 142
11.2.11 函数I2C_ DualAddressCmd .................................................................................................... 142
11.2.12 函数I2C_ GeneralCallCmd...................................................................................................... 143
11.2.13 函数I2C_ ITConfig.................................................................................................................. 143
11.2.14 函数I2C_ SendData ................................................................................................................. 144
11.2.15 函数I2C_ ReceiveData ............................................................................................................ 144
11.2.16 函数I2C_ Send7bitAddress..................................................................................................... 145
11.2.17 函数I2C_ ReadRegister........................................................................................................... 145
11.2.18 函数I2C_ SoftwareResetCmd.................................................................................................. 146
11.2.19 函数I2C_ SMBusAlertConfig ................................................................................................. 147
11.2.20 函数I2C_ TransmitPEC........................................................................................................... 147
11.2.21 函数I2C_ PECPositionConfig ................................................................................................. 148
11.2.22 函数I2C_ CalculatePEC.......................................................................................................... 148
11.2.23 函数I2C_ GetPEC ................................................................................................................... 149
11.2.24 函数I2C_ ARPCmd ................................................................................................................. 149
11.2.25 函数I2C_ StretchClockCmd .................................................................................................... 150
11.2.26 函数I2C_ FastModeDutyCycleConfig .................................................................................... 150
11.2.27 函数I2C_ GetLastEvent........................................................................................................... 151
11.2.29 函数I2C_ GetFlagStatus.......................................................................................................... 152
11.2.30 函数I2C_ ClearFlag................................................................................................................. 153
11.2.31 函数I2C_ GetITStatus ............................................................................................................. 154
11.2.32 函数I2C_ ClearITPendingBit .................................................................................................. 155
12.1 IWDG寄存器结构 ................................................................................................................................ 156
12.2 IWDG库函数 ........................................................................................................................................ 157
12.2.1 函数IWDG_WriteAccessCmd................................................................................................... 157
12.2.2 函数IWDG_SetPrescaler........................................................................................................... 158
12.2.3 函数IWDG_SetReload .............................................................................................................. 158
12.2.4 函数IWDG_ReloadCounter ...................................................................................................... 159
12.2.5 函数IWDG_Enable ................................................................................................................... 159
12.2.6 函数IWDG_GetFlagStatus........................................................................................................ 159
13.1 NVIC寄存器结构.................................................................................................................................. 161
13.2 NVIC库函数 ......................................................................................................................................... 163
13.2.1 函数NVIC_DeInit ..................................................................................................................... 164
13.2.2 函数NVIC_SCBDeInit.............................................................................................................. 164
13.2.3 函数NVIC_PriorityGroupConfig .............................................................................................. 165
13.2.4 函数NVIC_Init.......................................................................................................................... 166
13.2.5 函数NVIC_StructInit................................................................................................................. 168
13.2.6 函数NVIC_SETPRIMASK....................................................................................................... 169
13.2.7 函数NVIC_RESETPRIMASK.................................................................................................. 169
13.2.8 函数NVIC_SETFAULTMASK................................................................................................. 170
13.2.9 函数NVIC_RESETFAULTMASK............................................................................................ 170
13.2.10 函数NVIC_BASEPRICONFIG .............................................................................................. 171
目录
6/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
13.2.11 函数NVIC_GetBASEPRI........................................................................................................ 171
13.2.12 函数NVIC_GetCurrentPendingIRQChannel........................................................................... 172
13.2.13 函数NVIC_GetIRQChannelPendingBitStatus........................................................................ 172
13.2.14 函数NVIC_SetIRQChannelPendingBit .................................................................................. 173
13.2.15 函数NVIC_ClearIRQChannelPendingBit............................................................................... 173
13.2.16 函数NVIC_GetCurrentActiveHandler .................................................................................... 174
13.2.17 函数NVIC_GetIRQChannelActiveBitStatus........................................................................... 174
13.2.18 函数NVIC_GetCPUID............................................................................................................ 175
13.2.19 函数NVIC_SetVectorTable ..................................................................................................... 175
13.2.20 函数NVIC_GenerateSystemReset........................................................................................... 176
13.2.21 函数NVIC_GenerateCoreReset............................................................................................... 176
13.2.22 函数NVIC_SystemLPConfig .................................................................................................. 177
13.2.23 函数NVIC_SystemHandlerConfig.......................................................................................... 177
13.2.24 函数NVIC_SystemHandlerPriorityConfig.............................................................................. 182
13.2.25 函数NVIC_GetSystemHandlerPendingBitStatus.................................................................... 183
13.2.26 函数NVIC_SetSystemHandlerPendingBit.............................................................................. 183
13.2.27 函数NVIC_ClearSystemHandlerPendingBit .......................................................................... 184
13.2.28 函数NVIC_GetSystemHandlerActiveBitStatus...................................................................... 184
13.2.29 函数NVIC_GetFaultHandlerSources...................................................................................... 185
13.2.30 函数NVIC_GetFaultAddress................................................................................................... 186
14.1 PWR寄存器结构................................................................................................................................... 187
14.2 PWR库函数........................................................................................................................................... 188
14.2.1 函数PWR_DeInit ...................................................................................................................... 188
14.2.2 函数PWR_BackupAccessCmd ................................................................................................. 189
14.2.3 函数PWR_PVDCmd................................................................................................................. 189
14.2.4 函数PWR_PVDLevelConfig..................................................................................................... 190
14.2.5 函数PWR_WakeUpPinCmd...................................................................................................... 190
14.2.6 函数PWR_EnterSTOPMode ..................................................................................................... 191
14.2.7 函数PWR_EnterSTANDBYMode ............................................................................................ 191
14.2.8 函数PWR_GetFlagStatus.......................................................................................................... 192
14.2.9 函数PWR_ClearFlag................................................................................................................. 192
15.1 RCC寄存器结构 ................................................................................................................................... 193
15.2 RCC库函数 ........................................................................................................................................... 194
15.2.1 函数RCC_DeInit ....................................................................................................................... 195
15.2.2 函数RCC_HSEConfig............................................................................................................... 195
15.2.3 函数RCC_WaitForHSEStartUp................................................................................................. 196
15.2.4 函数RCC_AdjustHSICalibrationValue ..................................................................................... 196
15.2.5 函数RCC_HSICmd ................................................................................................................... 197
15.2.6 函数RCC_PLLConfig ............................................................................................................... 197
15.2.7 函数RCC_PLLCmd .................................................................................................................. 198
15.2.8 函数RCC_SYSCLKConfig....................................................................................................... 199
15.2.9 函数RCC_GetSYSCLKSource ................................................................................................. 199
15.2.10 函数RCC_HCLKConfig ......................................................................................................... 200
15.2.11 函数RCC_PCLK1Config ........................................................................................................ 200
15.2.12 函数RCC_PCLK2Config ........................................................................................................ 201
15.2.13 函数RCC_ITConfig................................................................................................................. 202
15.2.14 函数RCC_USBCLKConfig..................................................................................................... 202
15.2.15 函数RCC_ADCCLKConfig.................................................................................................... 203
15.2.16 函数RCC_LSEConfig ............................................................................................................. 204
15.2.17 函数RCC_LSICmd.................................................................................................................. 204
15.2.18 函数RCC_RTCCLKConfig..................................................................................................... 205
15.2.19 函数RCC_RTCCLKCmd ........................................................................................................ 205
15.2.20 函数RCC_GetClocksFreq ....................................................................................................... 206
目录
7/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
15.2.21 函数RCC_AHBPeriphClockCmd ........................................................................................... 207
15.2.22 函数RCC_APB2PeriphClockCmd .......................................................................................... 207
15.2.23 函数RCC_APB1PeriphClockCmd .......................................................................................... 208
15.2.24 函数RCC_APB2PeriphResetCmd........................................................................................... 209
15.2.25 函数RCC_APB1PeriphResetCmd........................................................................................... 209
15.2.26 函数RCC_BackupResetCmd................................................................................................... 210
15.2.27 函数RCC_ClockSecuritySystemCmd ..................................................................................... 210
15.2.28 函数RCC_MCOConfig ........................................................................................................... 210
15.2.29 函数RCC_GetFlagStatus..........................................................................................................211
15.2.30 函数RCC_ClearFlag................................................................................................................ 212
15.2.31 函数RCC_GetITStatus............................................................................................................ 212
15.2.32 函数RCC_ClearITPendingBit................................................................................................. 213
16.1 RTC寄存器结构.................................................................................................................................... 214
16.2 RTC库函数............................................................................................................................................ 215
16.2.1 函数RTC_ITConfig................................................................................................................... 216
16.2.2 函数RTC_EnterConfigMode..................................................................................................... 216
16.2.3 函数RTC_ExitConfigMode....................................................................................................... 217
16.2.4 函数RTC_GetCounter ............................................................................................................... 217
16.2.5 函数RTC_SetCounter................................................................................................................ 218
16.2.6 函数RTC_SetPrescaler.............................................................................................................. 218
16.2.7 函数RTC_SetAlarm................................................................................................................... 219
16.2.8 函数RTC_GetDivider................................................................................................................ 219
16.2.9 函数RTC_WaitForLastTask....................................................................................................... 220
16.2.10 函数RTC_WaitForSynchro...................................................................................................... 220
16.2.11 函数RTC_GetFlagStatus ......................................................................................................... 221
16.2.12 函数RTC_ClearFlag ................................................................................................................ 221
16.2.13 函数RTC_GetITStatus............................................................................................................. 222
16.2.14 函数RTC_ClearITPendingBit.................................................................................................. 222
17.1 SPI寄存器结构 ..................................................................................................................................... 223
17.2 SPI库函数 ............................................................................................................................................. 224
17.2.1 函数SPI_DeInit ......................................................................................................................... 225
17.2.2 函数SPI_Init.............................................................................................................................. 225
17.2.3 函数SPI_StructInit..................................................................................................................... 227
17.2.4 函数SPI_Cmd............................................................................................................................ 228
17.2.5 函数SPI_ITConfig..................................................................................................................... 228
17.2.6 函数SPI_DMACmd .................................................................................................................. 229
17.2.7 函数SPI_SendData .................................................................................................................... 229
17.2.8 函数SPI_ReceiveData ............................................................................................................... 230
17.2.9 函数SPI_NSSInternalSoftwareConfig ...................................................................................... 230
17.2.10 函数SPI_SSOutputCmd .......................................................................................................... 231
17.2.11 函数SPI_DataSizeConfig ........................................................................................................ 231
17.2.12 函数SPI_TransmitCRC ........................................................................................................... 232
17.2.13 函数SPI_CalculateCRC........................................................................................................... 232
17.2.14 函数SPI_GetCRC.................................................................................................................... 233
17.2.15 函数SPI_GetCRCPolynomial ................................................................................................. 233
17.2.16 函数SPI_BiDirectionalLineConfig.......................................................................................... 234
17.2.17 函数SPI_GetFlagStatus........................................................................................................... 234
17.2.18 函数SPI_ClearFlag.................................................................................................................. 235
17.2.19 函数SPI_GetITStatus .............................................................................................................. 235
17.2.20 函数SPI_ClearITPendingBit ................................................................................................... 236
18.1 SysTick寄存器结构 .............................................................................................................................. 237
18.2 SysTick库函数 ...................................................................................................................................... 238
18.2.1 函数SysTick_CLKSourceConfig .............................................................................................. 238
目录
8/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
18.2.2 函数SysTick_SetReload............................................................................................................ 239
18.2.3 函数SysTick_CounterCmd........................................................................................................ 239
18.2.4 函数SysTick_ITConfig.............................................................................................................. 240
18.2.5 函数SysTick_GetCounter.......................................................................................................... 240
18.2.6 函数SysTick_GetFlagStatus...................................................................................................... 241
19.1 TIM寄存器结构.................................................................................................................................... 242
19.2 TIM库函数............................................................................................................................................ 244
19.2.1 函数TIM_DeInit........................................................................................................................ 246
19.2.2 函数TIM_TimeBaseInit ............................................................................................................ 246
19.2.3 函数TIM_OCInit....................................................................................................................... 247
19.2.4 函数TIM_ICInit ........................................................................................................................ 249
19.2.5 函数TIM_TimeBaseStructInit................................................................................................... 251
19.2.6 函数TIM_OCStructInit ............................................................................................................. 251
19.2.7 函数TIM_ICStructInit............................................................................................................... 252
19.2.8 函数TIM_Cmd .......................................................................................................................... 252
19.2.9 函数TIM _ITConfig .................................................................................................................. 253
19.2.10 函数TIM_DMAConfig............................................................................................................ 253
19.2.11 函数TIM_DMACmd ............................................................................................................... 255
19.2.12 函数TIM_InternalClockConfig ............................................................................................... 255
19.2.13 函数TIM_ITRxExternalClockConfig...................................................................................... 256
19.2.14 函数TIM_TIxExternalClockConfig ........................................................................................ 256
19.2.15 函数TIM_ETRClockMode1Config......................................................................................... 257
19.2.16 函数TIM_ETRClockMode2Config......................................................................................... 258
19.2.17 函数TIM_ETRConfig ............................................................................................................. 258
19.2.18 函数TIM_SelectInputTrigger .................................................................................................. 259
19.2.19 函数TIM_PrescalerConfig ...................................................................................................... 260
19.2.20 函数TIM_CounterModeConfig............................................................................................... 260
19.2.21 函数TIM_ForcedOC1Config .................................................................................................. 261
19.2.22 函数TIM_ForcedOC2Config .................................................................................................. 261
19.2.23 函数TIM_ForcedOC3Config .................................................................................................. 262
19.2.24 函数TIM_ForcedOC4Config .................................................................................................. 262
19.2.25 函数TIM_ARRPreloadConfig................................................................................................. 263
19.2.26 函数TIM_SelectCCDMA........................................................................................................ 263
19.2.27 函数TIM_OC1PreloadConfig ................................................................................................. 264
19.2.28 函数TIM_OC2PreloadConfig ................................................................................................. 264
19.2.29 函数TIM_OC3PreloadConfig ................................................................................................. 265
19.2.30 函数TIM_OC4PreloadConfig ................................................................................................. 265
19.2.31 函数TIM_OC1FastConfig....................................................................................................... 266
19.2.32 函数TIM_OC2FastConfig....................................................................................................... 266
19.2.33 函数TIM_OC3FastConfig....................................................................................................... 267
19.2.34 函数TIM_OC4FastConfig....................................................................................................... 267
19.2.35 函数TIM_ClearOC1Ref.......................................................................................................... 268
19.2.36 函数TIM_ClearOC2Ref.......................................................................................................... 268
19.2.37 函数TIM_ClearOC3Ref.......................................................................................................... 269
19.2.38 函数TIM_ClearOC4Ref.......................................................................................................... 269
19.2.39 函数TIM_UpdateDisableConfig ............................................................................................. 270
19.2.40 函数TIM_EncoderInterfaceConfig.......................................................................................... 270
19.2.41 函数TIM_GenerateEvent ........................................................................................................ 271
19.2.42 函数TIM_OC1PolarityConfig................................................................................................. 271
19.2.43 函数TIM_OC2PolarityConfig................................................................................................. 272
19.2.44 函数TIM_OC3PolarityConfig................................................................................................. 272
19.2.45 函数TIM_OC4PolarityConfig................................................................................................. 273
19.2.46 函数TIM_UpdateRequestConfig............................................................................................. 273
目录
9/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
19.2.47 函数TIM_SelectHallSensor..................................................................................................... 274
19.2.48 函数TIM_SelectOnePulseMode.............................................................................................. 274
19.2.49 函数TIM_SelectOutputTrigger ............................................................................................... 275
19.2.50 函数TIM_SelectSlaveMode .................................................................................................... 276
19.2.51 函数TIM_SelectMasterSlaveMode ......................................................................................... 277
19.2.52 函数TIM_SetCounter.............................................................................................................. 277
19.2.53 函数TIM_SetAutoreload......................................................................................................... 278
19.2.54 函数TIM_SetCompare1 .......................................................................................................... 278
19.2.55 函数TIM_SetCompare2 .......................................................................................................... 279
19.2.56 函数TIM_SetCompare3 .......................................................................................................... 279
19.2.57 函数TIM_SetCompare4 .......................................................................................................... 280
19.2.58 函数TIM_SetIC1Prescaler ...................................................................................................... 280
19.2.59 函数TIM_SetIC2Prescaler ...................................................................................................... 281
19.2.60 函数TIM_SetIC3Prescaler ...................................................................................................... 281
19.2.61 函数TIM_SetIC4Prescaler ...................................................................................................... 282
19.2.62 函数TIM_SetClockDivision.................................................................................................... 282
19.2.63 函数TIM_GetCapture1............................................................................................................ 283
19.2.64 函数TIM_GetCapture2............................................................................................................ 283
19.2.65 函数TIM_GetCapture3............................................................................................................ 283
19.2.66 函数TIM_GetCapture4............................................................................................................ 284
19.2.67 函数TIM_GetCounter ............................................................................................................. 284
19.2.68 函数TIM_GetPrescaler............................................................................................................ 285
19.2.69 函数TIM_GetFlagStatus.......................................................................................................... 285
19.2.70 函数TIM_ClearFlag ................................................................................................................ 286
19.2.71 函数TIM_GetITStatus............................................................................................................. 286
19.2.72 函数TIM_ClearITPendingBit.................................................................................................. 287
20.1 TIM1 寄存器结构................................................................................................................................. 288
20.2 TIM1 库函数......................................................................................................................................... 290
20.2.1 函数TIM1_DeInit...................................................................................................................... 292
20.2.2 函数TIM1_TIM1BaseInit ......................................................................................................... 292
20.2.3 函数TIM1_OC1Init................................................................................................................... 294
20.2.4 函数TIM1_OC2Init................................................................................................................... 296
20.2.5 函数TIM1_OC3Init................................................................................................................... 296
20.2.6 函数TIM1_OC4Init................................................................................................................... 297
20.2.7 函数TIM1_BDTRConfig .......................................................................................................... 297
20.2.8 函数TIM1_ICInit ...................................................................................................................... 299
20.2.9 函数TIM1_PWMIConfig .......................................................................................................... 300
20.2.10 函数TIM1_TimeBaseStructInit............................................................................................... 301
20.2.11 函数TIM1_OCStructInit.......................................................................................................... 301
20.2.12 函数TIM1_ICStructInit ........................................................................................................... 302
20.2.13 函数TIM1_BDTRStructInit .................................................................................................... 303
20.2.14 函数TIM1_Cmd ...................................................................................................................... 303
20.2.15 函数TIM1_CtrlPWMOutputs.................................................................................................. 304
20.2.16 函数TIM1_ITConfig ............................................................................................................... 304
20.2.17 函数TIM1_DMAConfig.......................................................................................................... 305
20.2.18 函数TIM1_DMACmd............................................................................................................. 306
20.2.19 函数TIM1_InternalClockConfig ............................................................................................. 307
20.2.20 函数TIM1_ETRClockMode1Config....................................................................................... 307
20.2.21 函数TIM1_ETRClockMode2Config....................................................................................... 308
20.2.22 函数TIM1_ETRConfig ........................................................................................................... 309
20.2.23 函数TIM1_ITRxExternalClockConfig.................................................................................... 309
20.2.24 函数TIM1_TIxExternalClockConfig ...................................................................................... 310
20.2.25 函数TIM1_SelectInputTrigger................................................................................................ 310
目录
10/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
20.2.26 函数TIM1_UpdateDisableConfig ............................................................................................311
20.2.27 函数TIM1_UpdateRequestConfig............................................................................................311
20.2.28 函数TIM1_SelectHallSensor................................................................................................... 312
20.2.29 函数TIM1_SelectOnePulseMode............................................................................................ 312
20.2.30 函数TIM1_SelectOutputTrigger ............................................................................................. 313
20.2.31 函数TIM1_SelectSlaveMode .................................................................................................. 313
20.2.32 函数TIM1_SelectMasterSlaveMode ....................................................................................... 314
20.2.33 函数TIM1_EncoderInterfaceConfig........................................................................................ 315
20.2.34 函数TIM1_PrescalerConfig .................................................................................................... 315
20.2.35 函数TIM1_CounterModeConfig............................................................................................. 316
20.2.36 函数TIM1_ForcedOC1Config ................................................................................................ 316
20.2.37 函数TIM1_ForcedOC2Config ................................................................................................ 317
20.2.38 函数TIM1_ForcedOC3Config ................................................................................................ 317
20.2.39 函数TIM1_ForcedOC4Config ................................................................................................ 318
20.2.40 函数TIM1_ARRPreloadConfig............................................................................................... 318
20.2.41 函数TIM1_SelectCOM ........................................................................................................... 319
20.2.42 函数TIM1_SelectCCDMA...................................................................................................... 319
20.2.43 函数TIM1_CCPreloadControl ................................................................................................ 320
20.2.44 函数TIM1_OC1PreloadConfig ............................................................................................... 320
20.2.45 函数TIM1_OC2PreloadConfig ............................................................................................... 321
20.2.46 函数TIM1_OC3PreloadConfig ............................................................................................... 321
20.2.47 函数TIM1_OC4PreloadConfig ............................................................................................... 322
20.2.48 函数TIM1_OC1FastConfig..................................................................................................... 322
20.2.49 函数TIM1_OC2FastConfig..................................................................................................... 323
20.2.50 函数TIM1_OC3FastConfig..................................................................................................... 323
20.2.51 函数TIM1_OC4FastConfig..................................................................................................... 324
20.2.52 函数TIM1_ClearOC1Ref........................................................................................................ 324
20.2.53 函数TIM1_ClearOC2Ref........................................................................................................ 325
20.2.54 函数TIM1_ClearOC3Ref........................................................................................................ 325
20.2.55 函数TIM1_ClearOC4Ref........................................................................................................ 326
20.2.56 函数TIM1_GenerateEvent ...................................................................................................... 326
20.2.57 函数TIM1_OC1PolarityConfig............................................................................................... 327
20.2.58 函数TIM1_OC1NPolarityConfig............................................................................................ 327
20.2.59 函数TIM1_OC2PolarityConfig............................................................................................... 328
20.2.60 函数TIM1_OC2NPolarityConfig............................................................................................ 328
20.2.61 函数TIM1_OC3PolarityConfig............................................................................................... 329
20.2.62 函数TIM1_OC3NPolarityConfig............................................................................................ 329
20.2.63 函数TIM1_OC4PolarityConfig............................................................................................... 330
20.2.64 函数TIM1_CCxCmd............................................................................................................... 330
20.2.65 函数TIM1_CCxNCmd ............................................................................................................ 331
20.2.66 函数TIM1_SelectOCxM ......................................................................................................... 331
20.2.67 函数TIM1_SetCounter............................................................................................................ 332
20.2.68 函数TIM1_SetAutoreload....................................................................................................... 332
20.2.69 函数TIM1_SetCompare1 ........................................................................................................ 333
20.2.70 函数TIM1_SetCompare2 ........................................................................................................ 333
20.2.71 函数TIM1_SetCompare3 ........................................................................................................ 334
20.2.72 函数TIM1_SetCompare4 ........................................................................................................ 334
20.2.73 函数TIM1_SetIC1Prescaler .................................................................................................... 335
20.2.74 函数TIM1_SetIC2Prescaler .................................................................................................... 335
20.2.75 函数TIM1_SetIC3Prescaler .................................................................................................... 336
20.2.76 函数TIM1_SetIC4Prescaler .................................................................................................... 336
20.2.77 函数TIM1_SetClockDivision.................................................................................................. 337
20.2.78 函数TIM1_GetCapture1.......................................................................................................... 337
目录
11/368
译文英文原版为 UM0427 Oct. 2007 Rev 2, 译文仅供参考,与英文版冲突的,以英文版为准
20.2.79 函数TIM1_GetCapture2.......................................................................................................... 338
20.2.80 函数TIM1_GetCapture3.......................................................................................................... 338
20.2.81 函数TIM1_GetCapture4.......................................................................................................... 338
20.2.82 函数TIM1_GetCounter ........................................................................................................... 339
20.2.83 函数TIM1_GetPrescaler.......................................................................................................... 339
20.2.84 函数TIM1_GetFlagStatus........................................................................................................ 340
20.2.85 函数TIM1_ClearFlag .............................................................................................................. 341
20.2.86 函数TIM1_GetITStatus........................................................................................................... 341
20.2.87 函数TIM1_ClearITPendingBit................................................................................................ 342
21.1 USART寄存器结构 .............................................................................................................................. 343
21.2 USART库函数 ...................................................................................................................................... 344
21.2.1 函数USART_DeInit .................................................................................................................. 345
21.2.2 函数USART_Init....................................................................................................................... 346
21.2.3 函数USART_StructInit.............................................................................................................. 349
21.2.4 函数USART_Cmd..................................................................................................................... 349
21.2.5 函数USART_ITConfig.............................................................................................................. 350
21.2.6 函数USART_DMACmd ........................................................................................................... 351
21.2.7 函数USART_SetAddress .......................................................................................................... 351
21.2.8 函数USART_WakeUpConfig.................................................................................................... 352
21.2.9 函数USART_ReceiverWakeUpCmd......................................................................................... 352
21.2.10 函数USART_LINBreakDetectiLengthConfig......................................................................... 353
21.2.11 函数USART_LINCmd ............................................................................................................ 353
21.2.12 函数USART_SendData ........................................................................................................... 354
21.2.13 函数USART_ReceiveData ...................................................................................................... 354
21.2.14 函数USART_SendBreak......................................................................................................... 355
21.2.15 函数USART_SetGuardTime ................................................................................................... 355
21.2.16 函数USART_SetPrescaler....................................................................................................... 356
21.2.17 函数USART_SmartCardCmd.................................................................................................. 356
21.2.18 函数USART_SmartCardNackCmd ......................................................................................... 357
21.2.19 函数USART_HalfDuplexCmd................................................................................................ 357
21.2.20 函数USART_IrDAConfig ....................................................................................................... 358
21.2.21 函数USART_IrDACmd .......................................................................................................... 358
21.2.22 函数USART_GetFlagStatus.................................................................................................... 359
21.2.23 函数USART_ClearFlag........................................................................................................... 360
21.2.24 函数USART_GetITStatus ....................................................................................................... 360
21.2.25 函数USART_ClearITPendingBit ............................................................................................ 361
22.1 WWDG寄存器结构.............................................................................................................................. 362
22.2 WWDG库函数...................................................................................................................................... 363
22.1.1 函数WWDG_DeInit.................................................................................................................. 363
22.1.2 函数WWDG_SetPrescaler ........................................................................................................ 363
22.1.3 函数WWDG_SetWindowValue ................................................................................................ 364
22.1.4 函数WWDG_EnableIT ............................................................................................................. 364
22.1.5 函数WWDG_SetCounter .......................................................................................................... 365
22.1.6 函数WWDG_Enable................................................................................................................. 365
22.1.7 函数WWDG_GetFlagStatus...................................................................................................... 366
22.1.8 函数WWDG_ClearFlag ............................................................................................................ 366
评论