状态标志位获取和清除
FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, uint16_t TIM_FLAG); void TIM_ClearFlag(TIM_TypeDef* TIMx, uint16_t TIM_FLAG); ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, uint16_t TIM_IT);
void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, uint16_t TIM_IT);
TIMx相关类型名
TIM_TypeDef p191
typedef struct TIM_IT取值
{ #define TIM_IT_Update #define TIM_IT_CC4 uint16_t TIM_Prescaler; #define TIM_IT_CC1 #define TIM_IT_COM uint16_t TIM_CounterMode; #define TIM_IT_CC2 #define TIM_IT_Trigger uint16_t TIM_Period; #define TIM_IT_CC3 #define TIM_IT_Break uint16_t TIM_ClockDivision; uint8_t TIM_RepetitionCounter; } TIM_TimeBaseInitTypeDef;
TIM_FLAG取值
#define TIM_FLAG_Update #define TIM_FLAG_CC4 #define TIM_FLAG_CC1OF #define TIM_FLAG_CC1 #define TIM_FLAG_COM #define TIM_FLAG_CC2OF #define TIM_FLAG_CC2 #define TIM_FLAG_Trigger #define TIM_FLAG_CC3OF #define TIM_FLAG_CC3 #define TIM_FLAG_Break #define TIM_FLAG_CC4OF
RTC篇
RTC相关寄存器 P210
RTC控制寄存器 (RTC_CRH, RTC_CRL) RTC预分频装载寄存器 (RTC_PRLH, RTC_PRLL) RTC预分频余数寄存器 (RTC_DIVH, RTC_DIVL) RTC计数器寄存器 (RTC_CNTH, RTC_CNTL)
RTC闹钟寄存器 (RTC_ALRH ,RTC_ALRL)
备份寄存器 BKP_DRx(x=11~42)
RTC相关库函数
void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); RTC中断设置函数 void RTC_EnterConfigMode(void); 允许RTC配置 :CRL位 CNF void RTC_ExitConfigMode(void); 退出配置模式: CRL位 CNF void RTC_SetCounter(uint32_t CounterValue); 设置计数器值:CNTH/CNTL void RTC_SetPrescaler(uint32_t PrescalerValue); 预分频配置:PRLH/PRLL void RTC_SetAlarm(uint32_t AlarmValue); 闹钟设置:ALRH/ALRL
void RTC_WaitForLastTask(void); 等待上次操作完成:CRL位RTOFF void RTC_WaitForSynchro(void); 等待时钟同步: CRL位RSF void RTC_ClearITPendingBit(uint16_t RTC_IT); void RTC_ClearFlag(uint16_t RTC_FLAG);
void RCC_RTCCLKConfig(uint32_t CLKSource); ...
#define RTC_IT_SEC #define RCC_LSE_Bypass #define BKP_DR42
RTC_FLAG取值 RCC_RTCCLKSource取值
#define RTC_FLAG_RTOFF #define RCC_RTCCLKSource_LSE
#define RTC_FLAG_RSF #define RTC_FLAG_OW #define RTC_FLAG_ALR
#define RTC_FLAG_SEC
#define RCC_RTCCLKSource_LSI
#define RCC_RTCCLKSource_HSE_Div128