本文整理汇总了C++中RTC_ITConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ RTC_ITConfig函数的具体用法?C++ RTC_ITConfig怎么用?C++ RTC_ITConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTC_ITConfig函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SetRTCTime
/*********************************
**函数名:SetRTCTime
**功能:设置时间,除了把Real_Time的值改变外,还要把时分秒转换为RTC计数值,年月日存到后备寄存器上
**注意事项:函数内会自动根据年月日计算星期,并且返回到*time上
**********************************/
void SetRTCTime(T_STRUCT* time)
{
u32 count;
RTC_ITConfig(RTC_IT_SEC, DISABLE); //关闭秒中断
RTC_WaitForLastTask();
//付时间值到Real_Time上
Real_Time.year=time->year;
Real_Time.month=time->month;
Real_Time.day=time->day;
Real_Time.hour=time->hour;
Real_Time.minute=time->minute;
Real_Time.sec=time->sec;
//计算星期
time->date=Real_Time.date=GetDate(time);
//把新的年月日存到掉电寄存器上
BKP_WriteBackupRegister(BKP_TIME_DATE,Real_Time.date);
// RTC_WaitForLastTask();
BKP_WriteBackupRegister(BKP_TIME_DAY,Real_Time.day);
// RTC_WaitForLastTask();
BKP_WriteBackupRegister(BKP_TIME_MONTH,Real_Time.month);
// RTC_WaitForLastTask();
BKP_WriteBackupRegister(BKP_TIME_YEAR,Real_Time.year);
// RTC_WaitForLastTask();
//计算新的RTC count值
count=Real_Time.hour*3600+Real_Time.minute*60+Real_Time.sec;
RTC_WaitForLastTask();
RTC_SetCounter(count);
RTC_WaitForLastTask();
RTC_ITConfig(RTC_IT_SEC, ENABLE); //打开秒中断
}
开发者ID:jiangtaojiang,项目名称:bloodpressure,代码行数:39,代码来源:RTC.c
示例2: sleep
/***************************************************************************
Declaration : void sleep(char wdt_prescaler)
Description : Sleep until WDT interrupt controlled by wdt_prescaler
***************************************************************************/
void sleep(int data_ms, char mode)
{
/* Enable the RTC Alarm interrupt */
RTC_ITConfig(RTC_IT_ALR, ENABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Alarm in data_ms */
// RTC_SetAlarm(RTC_GetCounter()+ data_ms<<5);
RTC_SetAlarm(RTC_GetCounter()+ data_ms);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Request to enter STOP mode with regulator ON */
PWR_EnterSTOPMode(PWR_Regulator_ON, PWR_STOPEntry_WFI);
/* At this stage the system has resumed from STOP mode -------------------*/
/* Configures system clock after wake-up from STOP: enable HSE, PLL and select PLL
as system clock source (HSE and PLL are disabled in STOP mode) */
/* Enable the RTC Alarm interrupt */
SYSCLKConfig_STOP();
RTC_ITConfig(RTC_IT_ALR, DISABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
开发者ID:QXED,项目名称:MutiNodesBy2.4GWireless,代码行数:36,代码来源:mcu.c
示例3: radiotimer_schedule
void radiotimer_schedule(uint16_t offset) {
RTC_ITConfig(RTC_IT_ALR, DISABLE);
//need to disable radio also in case that a radio interrupt is happening
// Set the RTC alarm(RTC timer will alarm at next state of slot)
RTC_SetAlarm(offset);
RTC_WaitForLastTask();
//set radiotimer irpstatus
radiotimer_vars.overflowORcompare = RADIOTIMER_COMPARE;
RTC_ClearFlag(RTC_IT_ALR);
RTC_ITConfig(RTC_IT_ALR, ENABLE);
}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:13,代码来源:radiotimer.c
示例4: radiotimer_cancel
void radiotimer_cancel() {
RTC_ITConfig(RTC_IT_ALR, DISABLE);
//need to disable radio also in case that a radio interrupt is happening
// set RTC alarm (slotlength)
RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);
RTC_WaitForLastTask();
//set radiotimer irpstatus
radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;
RTC_ClearFlag(RTC_IT_ALR);
RTC_ITConfig(RTC_IT_ALR, ENABLE);
}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:14,代码来源:radiotimer.c
示例5: RTC_Configuration
/**
* @brief Configures the RTC.
* @param None
* @retval : None
*/
void RTC_Configuration(void)
{
/* Enable PWR and BKP clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
/* Allow access to BKP Domain */
PWR_BackupAccessCmd(ENABLE);
/* Reset Backup Domain */
BKP_DeInit();
/* Enable LSE */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{}
/* Select LSE as RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
/* Enable RTC Clock */
RCC_RTCCLKCmd(ENABLE);
/* Wait for RTC registers synchronization */
RTC_WaitForSynchro();
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Enable the RTC Second */
RTC_ITConfig(RTC_IT_SEC, ENABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Set RTC prescaler: set RTC period to 1sec */
RTC_SetPrescaler(32767); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) */
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
开发者ID:zxynk666666,项目名称:bluenergy_wn,代码行数:35,代码来源:system_init.c
示例6: HAL_RTC_Set_UnixAlarm
void HAL_RTC_Set_UnixAlarm(time_t value)
{
RTC_AlarmTypeDef RTC_AlarmStructure;
time_t alarm_time = HAL_RTC_Get_UnixTime() + value;
struct tm *alarm_time_tm;
alarm_time_tm = localtime(&alarm_time);
/* Disable the Alarm A */
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = alarm_time_tm->tm_hour;
RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = alarm_time_tm->tm_min;
RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = alarm_time_tm->tm_sec;
RTC_AlarmStructure.RTC_AlarmDateWeekDay = alarm_time_tm->tm_mday;
RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_None;
/* Configure the RTC Alarm A register */
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
/* Enable the RTC Alarm A Interrupt */
RTC_ITConfig(RTC_IT_ALRA, ENABLE);
/* Enable the Alarm A */
RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
/* Clear RTC Alarm Flag */
RTC_ClearFlag(RTC_FLAG_ALRAF);
}
开发者ID:RobertNewkirk,项目名称:particle,代码行数:31,代码来源:rtc_hal.c
示例7: RTC_Configuration
/**
* @file RTC_Configuration
* @brief Configures the RTC.
* @param 无
* @retval 无
*/
static void RTC_Configuration(void)
{
//启用PWR和BKP的时钟(from APB1)
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
//后备域解锁
PWR_BackupAccessCmd(ENABLE);
//备份寄存器模块复位
BKP_DeInit();
//外部32.768K时钟使能
RCC_LSEConfig(RCC_LSE_ON);
//等待稳定
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{}
//RTC时钟源配置成LSE(外部32.768K)
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
//RTC开启
RCC_RTCCLKCmd(ENABLE);
//开启后需要等待APB1时钟与RTC时钟同步,才能读写寄存器
RTC_WaitForSynchro();
//读写寄存器前,要确定上一个操作已经结束
RTC_WaitForLastTask();
//使能秒中断
RTC_ITConfig(RTC_IT_SEC, ENABLE);
//等待寄存器写入完成
RTC_WaitForLastTask();
//设置RTC分频器,使RTC时钟为1Hz
//RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1)
RTC_SetPrescaler(32767);
//等待写入完成
RTC_WaitForLastTask();
}
开发者ID:pyjhhh,项目名称:stm32_f1x,代码行数:37,代码来源:rtc.c
示例8: RTC_Configuration
/**
* @brief Configures RTC clock source and prescaler.
* @param None
* @retval None
*/
void RTC_Configuration(void)
{
/* RTC clock source configuration ----------------------------------------*/
/* Allow access to BKP Domain */
PWR_BackupAccessCmd(ENABLE);
/* Reset Backup Domain */
BKP_DeInit();
/* Enable LSE OSC */
RCC_LSICmd(ENABLE);
/* Wait till LSE is ready */
while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
{
}
/* Select the RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
/* Enable the RTC Clock */
RCC_RTCCLKCmd(ENABLE);
/* RTC configuration -----------------------------------------------------*/
/* Wait for RTC APB registers synchronisation */
RTC_WaitForSynchro();
/* Set the RTC time base to 1s */
RTC_SetPrescaler(32767);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
RTC_ITConfig(RTC_IT_ALR, ENABLE);
RTC_WaitForLastTask();
}
开发者ID:idaohang,项目名称:stm32gps-stop,代码行数:39,代码来源:stm32gps_config.c
示例9: rtc_InitWakeUpInterrupt
void rtc_InitWakeUpInterrupt(){
NVIC_InitTypeDef NVIC_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
// NVIC init
NVIC_InitStructure.NVIC_IRQChannel = RTC_WKUP_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// ext Interrupt 22 einstellen (fuer WakeUp)
EXTI_ClearITPendingBit(EXTI_Line22);
EXTI_InitStructure.EXTI_Line = EXTI_Line22;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
// zum einstellen muss Wakup disabled sein
RTC_WakeUpCmd(DISABLE);
// Teiler 16 => 32,768kHz:16 => 2048 Hz
RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);
// WakeUp Counter einstellen
RTC_SetWakeUpCounter(16); //set to 16 -> 128 interrupts per second (32768Hz / Div16 = 2048; 2948 / 128 = 16
// enable Interrupt
RTC_ITConfig(RTC_IT_WUT, ENABLE);
// enable Wakeup
RTC_WakeUpCmd(ENABLE);
}
开发者ID:Quantenkosmos,项目名称:equinox_clock,代码行数:33,代码来源:RTC.c
示例10: SysSetTime
/*设置系统时间*/
void SysSetTime(FUN_BLOCK **funBlock)
{
DIS_SING *sing_temp;
GetSubFunBlock(&pfunSubBlock);
sing_temp = (DIS_SING *)(pfunSubBlock->current_display);
pfunSubBlock->data_type = ZINUM;//显示属性
RTC_ITConfig(RTC_IT_SEC, DISABLE); //关RTC中断,防止systmtime被修改
strcpy(sing_temp->y2 , "请输入时间");
/*取得VIRTUAL_NUM_LENGTH位数的箱门数*/
if(CANCEL == KeyDisplay(pfunSubBlock , 10))
{
FreeMem();
return;
}
/*读取时间值*/
systmtime.tm_year = 2000 + (sing_temp->y3[0]-'0')*10 + sing_temp->y3[1]-'0';
systmtime.tm_mon = (sing_temp->y3[2]-'0')*10 + sing_temp->y3[3]-'0';
systmtime.tm_mday = (sing_temp->y3[4]-'0')*10 + sing_temp->y3[5]-'0';
systmtime.tm_hour = (sing_temp->y3[6]-'0')*10 + sing_temp->y3[7]-'0';
systmtime.tm_min = (sing_temp->y3[8]-'0')*10 + sing_temp->y3[9]-'0';
memset(sing_temp->y3 , 0 , 10);
/*写入时间*/
RTC_Configuration();
Time_Adjust(&systmtime);//写入系统时间
BKP_WriteBackupRegister(BKP_DR1, 0xA5A5);
strcpy(sing_temp->y2 , "系统时间修改成功");
DisplaySubBlock(pfunSubBlock);
FreeMem();
}
开发者ID:eseawind,项目名称:touchCabinet,代码行数:34,代码来源:sysfunction.c
示例11: EnterSTANDBYMode
/**
* @brief Enters STANDBY mode, RTC Alarm within 3 second or an external RESET
* will wake-up the system from STANDBY
* @param None
* @retval None
*/
static void EnterSTANDBYMode(void)
{
RTC_AlarmTypeDef RTC_AlarmStructure;
RTC_TimeTypeDef RTC_TimeStructure;
/* Disable the Alarm A */
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
/* Get the current time */
RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
/* Set the alarm to current time + 3s */
RTC_AlarmStructure.RTC_AlarmTime.RTC_H12 = RTC_TimeStructure.RTC_H12;
RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = RTC_TimeStructure.RTC_Hours;
RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = RTC_TimeStructure.RTC_Minutes;
RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = (RTC_TimeStructure.RTC_Seconds + 0x3) % 60;
RTC_AlarmStructure.RTC_AlarmDateWeekDay = 31;
RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay | RTC_AlarmMask_Hours | RTC_AlarmMask_Minutes;
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
/* Enable RTC Alarm A Interrupt: this Interrupt will wake-up the system from
STANDBY mode (RTC Alarm IT not enabled in NVIC) */
RTC_ITConfig(RTC_IT_ALRA, ENABLE);
/* Enable the Alarm A */
RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
/* Clear RTC Alarm Flag */
RTC_ClearFlag(RTC_FLAG_ALRAF);
/* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */
PWR_EnterSTANDBYMode();
}
开发者ID:yogiyi,项目名称:BP_STM32F030,代码行数:40,代码来源:main.c
示例12: RTC_AlarmConfig
/**
* @brief Configures the RTC Alarm.
* @param None
* @retval None
*/
void RTC_AlarmConfig(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
RTC_AlarmTypeDef RTC_AlarmStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* EXTI configuration */
EXTI_ClearITPendingBit(EXTI_Line17);
EXTI_InitStructure.EXTI_Line = EXTI_Line17;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable the RTC Alarm Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = RTC_Alarm_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Set the alarmA Masks */
RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_All;
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
/* Set AlarmA subseconds and enable SubSec Alarm : generate 8 interripts per Second */
RTC_AlarmSubSecondConfig(RTC_Alarm_A, 0xFF, RTC_AlarmSubSecondMask_SS14_5);
/* Enable AlarmA interrupt */
RTC_ITConfig(RTC_IT_ALRA, ENABLE);
/* Enable the alarmA */
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
}
开发者ID:jongtao,项目名称:stm32l-dev-chain,代码行数:40,代码来源:main.c
示例13: RtcSetAlarmConfig
static void RtcSetAlarmConfig( void )
{
EXTI_InitTypeDef EXTI_InitStructure;
RTC_AlarmTypeDef RTC_AlarmStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* EXTI configuration */
EXTI_ClearITPendingBit( EXTI_Line17 );
EXTI_InitStructure.EXTI_Line = EXTI_Line17;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init( &EXTI_InitStructure );
/* Enable the RTC Alarm Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = RTC_Alarm_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
//NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init( &NVIC_InitStructure );
/* Set the alarmA Masks */
RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay;
RTC_SetAlarm( RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure );
/* Enable AlarmA interrupt */
RTC_ITConfig( RTC_IT_ALRA, DISABLE );
/* Enable the alarmA */
RTC_AlarmCmd( RTC_Alarm_A, DISABLE );
}
开发者ID:davincicloud-kr,项目名称:im-l200,代码行数:32,代码来源:rtc-board.c
示例14: TM_RTC_DisableAlarm
void TM_RTC_DisableAlarm(TM_RTC_Alarm_t Alarm) {
switch (Alarm) {
case TM_RTC_Alarm_A:
/* Disable Alarm A */
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
/* Disable Alarm A interrupt */
RTC_ITConfig(RTC_IT_ALRA, DISABLE);
/* Clear Alarm A pending bit */
RTC_ClearFlag(RTC_IT_ALRA);
break;
case TM_RTC_Alarm_B:
/* Disable Alarm B */
RTC_AlarmCmd(RTC_Alarm_B, DISABLE);
/* Disable Alarm B interrupt */
RTC_ITConfig(RTC_IT_ALRB, DISABLE);
/* Clear Alarm B pending bit */
RTC_ClearFlag(RTC_IT_ALRB);
break;
default:
break;
}
/* Clear RTC Alarm pending bit */
EXTI_ClearITPendingBit(EXTI_Line17);
/* Configure EXTI 17 as interrupt */
EXTI_InitStruct.EXTI_Line = EXTI_Line17;
EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStruct.EXTI_LineCmd = ENABLE;
/* Initialite Alarm EXTI interrupt */
EXTI_Init(&EXTI_InitStruct);
/* Configure the RTC Alarm Interrupt */
NVIC_InitStruct.NVIC_IRQChannel = RTC_Alarm_IRQn;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = RTC_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = RTC_ALARM_SUBPRIORITY;
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
/* Initialize RTC Alarm Interrupt */
NVIC_Init(&NVIC_InitStruct);
}
开发者ID:Mars55,项目名称:stm32f429,代码行数:47,代码来源:tm_stm32f4_rtc.c
示例15: RTC_Configure
// 配置RTC硬件。
void RTC_Configure(void)
{
/* Enable PWR and BKP clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
/* Allow access to BKP Domain */
PWR_BackupAccessCmd(ENABLE);
RCC_RTCCLKCmd(ENABLE);
/* Reset Backup Domain */
BKP_DeInit();
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
#ifdef RTCClockSource_LSI
/* Enable LSI */
RCC_LSICmd(ENABLE);
/* Wait till LSI is ready */
while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET);
/* Select LSI as RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
#elif defined RTCClockSource_LSE
/* Enable LSE */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);
/* Select LSE as RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
#endif
// 上电后需要校准RTC时钟,也即准确计算出RTC的周期时长。
RTC_Calibrate();
#ifdef RTCClockOutput_Enable
/* Disable the Tamper Pin */
BKP_TamperPinCmd(DISABLE); /* To output RTCCLK/64 on Tamper pin, the tamper functionality must be disabled */
/* Enable RTC Clock Output on Tamper Pin */
BKP_RTCCalibrationClockOutputCmd(ENABLE);
#endif
/*允许RTC报警中断*/
RTC_ITConfig(RTC_IT_ALR, ENABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
开发者ID:jianblin,项目名称:learngit,代码行数:60,代码来源:mcu_rtc.c
示例16: RTC_Init
/**
* @file RTC_Init
* @brief RTC Initialization
* @param 无
* @retval 无
*/
void RTC_Init(void)
{
if (BKP_ReadBackupRegister(BKP_DR1)!= 0xA5A5)
{
/* Backup data register value is not correct or not yet programmed (when
the first time the program is executed) */
printf("RTC not yet configured....\r\n");
/* RTC Configuration */
RTC_Configuration();
Time_Regulate();
/* Adjust time by values entred by the user on the hyperterminal */
printf("RTC configured....\r\n");
BKP_WriteBackupRegister(BKP_DR1, 0xA5A5);
}
else
{
/* Check if the Power On Reset flag is set */
if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET)
{
printf("Power On Reset occurred....\r\n");
}
/* Check if the Pin Reset flag is set */
else if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET)
{
printf("External Reset occurred....\r\n");
}
printf("No need to configure RTC....\r\n");
/* Wait for RTC registers synchronization */
RTC_WaitForSynchro();
/* Enable the RTC Second */
RTC_ITConfig(RTC_IT_SEC, ENABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
/* NVIC configuration */
NVIC_Configuration();
#ifdef RTCClockOutput_Enable
/* Enable PWR and BKP clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
/* Allow access to BKP Domain */
PWR_BackupAccessCmd(ENABLE);
/* Disable the Tamper Pin */
BKP_TamperPinCmd(DISABLE); /* To output RTCCLK/64 on Tamper pin, the tamper
functionality must be disabled */
/* Enable RTC Clock Output on Tamper Pin */
BKP_RTCOutputConfig(BKP_RTCOutputSource_CalibClock);
#endif
/* Clear reset flags */
RCC_ClearFlag();
return;
}
开发者ID:pyjhhh,项目名称:stm32_f1x,代码行数:65,代码来源:rtc.c
示例17: radiotimer_setPeriod
void radiotimer_setPeriod(uint16_t period) {
RTC_ITConfig(RTC_IT_ALR, DISABLE);
//need to disable radio also in case that a radio interrupt is happening when set Alarm value
//Reset RTC Counter to begin a new slot
RTC_SetAlarm(period);
RTC_WaitForLastTask();
radiotimer_vars.currentSlotPeriod = period;
//set radiotimer irpstatus
radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;
RTC_ClearFlag(RTC_IT_ALR);
RTC_ITConfig(RTC_IT_ALR, ENABLE);
}
开发者ID:Babody,项目名称:openwsn-fw,代码行数:17,代码来源:radiotimer.c
示例18: RTC_Init
uint08 RTC_Init(void)
{
//检查是不是第一次配置时钟
uint08 temp=0;
if ( BKP_ReadBackupRegister(BKP_DR1) != 0x5050 ) //从指定的后备寄存器中读出数据:读出了与写入的指定数据不相乎
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); //使能PWR和BKP外设时钟
PWR_BackupAccessCmd(ENABLE); //使能后备寄存器访问
BKP_DeInit(); //复位备份区域
RCC_LSEConfig(RCC_LSE_ON); //设置外部低速晶振(LSE),使用外设低速晶振
while ( RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET && temp< 252) //检查指定的RCC标志位设置与否,等待低速晶振就绪
{
temp++;
//delay_ms(10);
//OSTimeDlyHMSM(0, 0, 0, 10);
}
if ( temp>=250 )
{
return 1;//初始化时钟失败,晶振有问题
}
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //设置RTC时钟(RTCCLK),选择LSE作为RTC时钟
RCC_RTCCLKCmd(ENABLE); //使能RTC时钟
RTC_WaitForLastTask(); //等待最近一次对RTC寄存器的写操作完成
RTC_WaitForSynchro(); //等待RTC寄存器同步
RTC_ITConfig(RTC_IT_SEC, ENABLE); //使能RTC秒中断
RTC_WaitForLastTask(); //等待最近一次对RTC寄存器的写操作完成
RTC_EnterConfigMode();/// 允许配置
RTC_SetPrescaler(32767); //设置RTC预分频的值
RTC_WaitForLastTask(); //等待最近一次对RTC寄存器的写操作完成
RTC_Set(2009,12,2,10,0,55); //设置时间
RTC_ExitConfigMode(); //退出配置模式
BKP_WriteBackupRegister(BKP_DR1, 0X5050); //向指定的后备寄存器中写入用户程序数据
}
else//系统继续计时
{
RTC_WaitForSynchro(); //等待最近一次对RTC寄存器的写操作完成
RTC_ITConfig(RTC_IT_SEC, ENABLE); //使能RTC秒中断
RTC_WaitForLastTask(); //等待最近一次对RTC寄存器的写操作完成
}
RTC_NVIC_Config();//RCT中断分组设置
RTC_Get();//更新时间
return 0; //ok
}
开发者ID:wuzeguang,项目名称:SingleChipMicrocomputer,代码行数:46,代码来源:RTC.c
示例19: RTC_AutoTest
uint8_t RTC_AutoTest(void)
{
uint8_t i = 0;
/* Enable PWR and BKP clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
/* Allow access to BKP Domain */
PWR_BackupAccessCmd(ENABLE);
/* Reset Backup Domain */
BKP_DeInit();
/* Enable LSE */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{
Delay_us(50000);
i++;
if(i>100) //5秒都还没起振,坏了
{
return 0;
}
}
/* Select LSE as RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
/* Enable RTC Clock */
RCC_RTCCLKCmd(ENABLE);
/* Wait for RTC registers synchronization
* 因为RTC时钟是低速的,内环时钟是高速的,所以要同步
*/
RTC_WaitForSynchro();
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Enable the RTC Second */
RTC_ITConfig(RTC_IT_SEC, ENABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Set RTC prescaler: set RTC period to 1sec */
RTC_SetPrescaler(32767); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) = 1HZ */
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
return 1;
}
开发者ID:FanNiu,项目名称:wildfire_stm32_iso_mini,代码行数:58,代码来源:bsp_rtc.c
示例20: TM_RTC_Interrupts
//------------------------------------------
void TM_RTC_Interrupts(uint32_t int_value) {
/* Clear pending bit */
EXTI->PR = 0x00400000;
/* Disable wakeup interrupt */
RTC_WakeUpCmd(DISABLE);
/* Disable RTC interrupt flag */
RTC_ITConfig(RTC_IT_WUT, DISABLE);
/* NVIC init for RTC */
NVIC_InitStruct.NVIC_IRQChannel = RTC_WKUP_IRQn;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = RTC_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = RTC_WAKEUP_SUBPRIORITY;
NVIC_InitStruct.NVIC_IRQChannelCmd = DISABLE;
NVIC_Init(&NVIC_InitStruct);
/* RTC connected to EXTI_Line22 */
EXTI_InitStruct.EXTI_Line = EXTI_Line22;
EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStruct.EXTI_LineCmd = DISABLE;
EXTI_Init(&EXTI_InitStruct);
if (int_value != TM_RTC_Int_Disable) {
/* Enable NVIC */
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStruct);
/* Enable EXT1 interrupt */
EXTI_InitStruct.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStruct);
/* First disable wake up command */
RTC_WakeUpCmd(DISABLE);
/* Clock divided by 8, 32768 / 8 = 4096 */
/* 4096 ticks for 1second interrupt */
RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div8);
/* Set RTC wakeup counter */
RTC_SetWakeUpCounter(0x0FFF * int_value);
/* Enable wakeup interrupt */
RTC_ITConfig(RTC_IT_WUT, ENABLE);
/* Enable wakeup command */
RTC_WakeUpCmd(ENABLE);
}
}
开发者ID:SergeyPopovGit,项目名称:MICO,代码行数:46,代码来源:rtc.c
注:本文中的RTC_ITConfig函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论