本文整理汇总了C++中RTC_GetCounter函数的典型用法代码示例。如果您正苦于以下问题:C++ RTC_GetCounter函数的具体用法?C++ RTC_GetCounter怎么用?C++ RTC_GetCounter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTC_GetCounter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: updateTime
void updateTime()
{
uint32_t TimeVar = RTC_GetCounter();
/* Reset RTC Counter when Time is 23:59:59 */
if (RTC_GetCounter() >= 0x0001517F)
{
RTC_SetCounter(0x0);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
DateUpdate();
}
/* Compute hours */
mHour = TimeVar / 3600;
/* Compute minutes */
mMinute = (TimeVar % 3600) / 60;
/* Compute seconds */
mSecond = (TimeVar % 3600) % 60;
}
开发者ID:JanusErasmus,项目名称:stm-discovery-feeder,代码行数:25,代码来源:rtc.c
示例2: save_2g_err
void save_2g_err( unsigned char force, GPRS_REASON reason)
{
u16 result_temp ;
//force=1: save to BK reg even BKP_DR1 have data, force=0: don't save if have data
//BKP_DR1, ERR index: 15~12:MCU reset
// 11~8:upgrade fw failure code
// 7~4:GPRS failure reason
// 3~0:GSM module poweroff reason
//BKP_DR4, GPRS failure time (UTC Time) high
//BKP_DR5, GPRS failure time (UTC Time) low
if ( (BKP_ReadBackupRegister(BKP_DR1))&0x00F0 ) {//have data
if ( !force ) {//don't cover if have data
return ;
}
}
result_temp = (BKP_ReadBackupRegister(BKP_DR1))&0xFF0F;
result_temp = result_temp | ((reason<<4)&0xF0) ;
BKP_WriteBackupRegister(BKP_DR1, result_temp);
BKP_WriteBackupRegister(BKP_DR4, ((RTC_GetCounter( ))>>16)&0xFFFF);//high
BKP_WriteBackupRegister(BKP_DR5, (RTC_GetCounter( ))&0xFFFF);//low
}
开发者ID:bg8wj,项目名称:icar-firmware,代码行数:28,代码来源:drv_mg323.c
示例3: rtc_gettime
void rtc_gettime (RTC_t *rtc)
{
uint32_t t;
while ( ( t = RTC_GetCounter() ) != RTC_GetCounter() ) { ; }
counter_to_struct( t, rtc ); // get non DST time
adjustDST( rtc );
}
开发者ID:ljh665577,项目名称:stm32_prj_template,代码行数:8,代码来源:rtc.c
示例4: getTime
timeval getTime(void)
{
timeval tv;
#ifndef PRECISION_IN_MS
tv.tv_sec = RTC_GetCounter();
#else
tv.tv_sec = seconds;
tv.tv_msec = RTC_GetCounter();
#endif
return tv;
}
开发者ID:running1919,项目名称:qianlab,代码行数:11,代码来源:clock.c
示例5: CheckForDaysElapsed
void CheckForDaysElapsed(void)
{
uint8_t DaysElapsed;
if((RTC_GetCounter() / SECONDS_IN_DAY) != 0)
{
for(DaysElapsed = 0; DaysElapsed < (RTC_GetCounter() / SECONDS_IN_DAY)\
;DaysElapsed++)
{
DateUpdate();
}
RTC_SetCounter(RTC_GetCounter() % SECONDS_IN_DAY);
}
}
开发者ID:JanusErasmus,项目名称:stm-discovery-feeder,代码行数:15,代码来源:rtc.c
示例6: 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
示例7: HandleTimers
/*********************************************************************
* @fn HandleTimers
* Handles the MSG_TIMER_EXPIRY messages
*
*********************************************************************/
static void HandleTimers(MsgTimerExpiry *pTimerExp)
{
uint32_t timeStamp;
switch (pTimerExp->userValue) {
case TIMER_REF_PRESSURE_READ:
/* Schedule the next sampling */
ASFTimerStart(SENSOR_ACQ_TASK_ID, TIMER_REF_PRESSURE_READ,
PRESSURE_SAMPLE_PERIOD, &sPressureTimer);
timeStamp = GetCurrentTime();
SensorDataHandler(PRESSURE_INPUT_SENSOR, timeStamp);
break;
#ifndef INTERRUPT_BASED_SAMPLING
case TIMER_REF_SENSOR_READ:
/* Schedule the next sampling */
ASFTimerStart(SENSOR_ACQ_TASK_ID, TIMER_REF_SENSOR_READ,
SENSOR_SAMPLE_PERIOD, &sSensorTimer);
/* Call data handler for each sensors */
timeStamp = RTC_GetCounter();
SensorDataHandler(ACCEL_INPUT_SENSOR, timeStamp);
SensorDataHandler(MAG_INPUT_SENSOR, timeStamp);
SensorDataHandler(GYRO_INPUT_SENSOR, timeStamp);
break;
#endif
default:
D1_printf("Unknown Timer! Reference %d\r\n", pTimerExp->userValue);
break;
}
}
开发者ID:smitpanchal,项目名称:osp,代码行数:36,代码来源:sensoracq_t.c
示例8: Read_DATA
/*
函数名:void Read_DATA(u8 Command)
描述: 将Command的命令数值返回到printf打印输出
输入: Command命令
输出: 由printf输出
返回: 无
*/
void Read_Data(u8 Command)
{
switch(Command)
{
case 10:
{ //读取当前始终值
printf("%u\r\n",RTC_GetCounter()); //打印秒
break;
}
case 201:
{
printf("控制寄存器1:TIM4_CR1=0X%x\r\n",TIM4->CR1);
printf("控制寄存器2:TIM4_CR2=0X%x\r\n",TIM4->CR2);
printf("计数器: TIM4_CNT=0X%u\r\n",TIM4->CNT);
printf("预分频器: TIM4_PSC=0X%x\r\n",TIM4->PSC);
printf("重载寄存器: TIM4_ARR=0X%x\r\n",TIM4->ARR);
printf("状态寄存器: TIM4_SR =0X%x\r\n",TIM4->SR);
printf("事件产生器: TIM4_EGR=0X%x\r\n",TIM4->EGR);
printf("从模式存器: TIM4_SMCR=0X%x\r\n",TIM4->SMCR);
break;
}
case 202:
{
printf("计数器:TIM4_CNT=%u\r\n",TIM4->CNT);
break;
}
default:
{
printf("无此命令,请核对!\r\n");
break;
}
}
}
开发者ID:zhaotun,项目名称:fanyaSTM,代码行数:40,代码来源:communication.c
示例9: VirtualRTC_Resume
/**
* @brief Resume virtual RTC
* @retval : None
*/
void VirtualRTC_Resume(void)
{
SecondNumNow = RTC_GetCounter();
StartSecondNum = SecondNumNow - SecondBkp;
if (VirtualRTCHandle != NULL)
vTaskResume(VirtualRTCHandle);
}
开发者ID:yanke928,项目名称:Kanade,代码行数:11,代码来源:VirtualRTC.c
示例10: RTC_IRQHandler
/*******************************************************************************
* Function Name : RTC_IRQHandler
* Description : This function handles RTC global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void RTC_IRQHandler(void)
{
volatile unsigned long int stanRTC;
static unsigned char stanRTCTekst[17] = {"0\0"};
unsigned long int godziny, minuty, sekundy;
if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
{
// Czekaj na zakonczenie ewentualnych operacji zapisu do rejestrów RTC
RTC_WaitForLastTask();
// Wyczysc flage od przerwania RTC
RTC_ClearITPendingBit(RTC_IT_SEC);
// Zmiana stanu wyprowadzenia PB15 co 1s
GPIO_WriteBit(GPIOB, GPIO_Pin_15, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_15)));
stanRTC=RTC_GetCounter();
//sprintf((char *)stanRTCTekst,"%16i\0",stanRTC);
//LCD_WriteTextXY(stanRTCTekst,0,1);
sekundy=stanRTC%60; //liczba sekund od ostatniej pelnej minuty
minuty=(long int)(stanRTC)/60; //dzielenie calkowite, "usuniecie" sekund, czas pracy w samych minutach
godziny=(long int)(minuty)/60; //dzielenie calkowite, "usuniecie" minut, czas pracy w samych godzinach
minuty=minuty%60; //liczba minut od ostatniej pelnej godziny
sprintf((char *)stanRTCTekst,"%3i:%02i:%02i\0",godziny,minuty,sekundy);
LCD_WriteTextXY(stanRTCTekst,7,1);
}
}
开发者ID:develorn,项目名称:ARM_function_kamami,代码行数:37,代码来源:stm32f10x_it.c
示例11: rtcIrqHandler
void rtcIrqHandler(void)
{
if (RTC_GetITStatus(RTC_IT_SEC) != RESET) {
RTC_ClearITPendingBit(RTC_FLAG_SEC);
#ifdef PRECISION_IN_MS
if (RTC_GetCounter() / 999 >= 1) {
RTC_WaitForLastTask();
RTC_SetCounter(0);
RTC_WaitForLastTask();
++seconds;
}
#endif
}
/* ignore overflow */
//if (RTC_GetITStatus(RTC_IT_OW) != RESET) {
// RTC_ClearITPendingBit(RTC_FLAG_OW);
//}
#ifndef PRECISION_IN_MS
if (RTC_GetITStatus(RTC_IT_ALR) != RESET) {
RTC_ClearITPendingBit(RTC_FLAG_ALR);
if (alarm > 0 && alarm != NULL) {
alarmProc();
}
}
#else
if (alarm > 0 && alarm == seconds
&& alarm != NULL) {
alarmProc();
}
#endif
}
开发者ID:running1919,项目名称:qianlab,代码行数:33,代码来源:clock.c
示例12: Show_Message
/*******************************************************************************
* Function Name : ShowMessage
* Description :
* Input : *Text
* Return : None
*******************************************************************************/
void Show_Message(char *Text)
{
/* */
if(TriggShowInfo.Status == DISABLE){ gMessage.Coord[1] = 206; gMessage.Coord[3] = 220; }
else{ gMessage.Coord[1] = 186; gMessage.Coord[3] = 200; }
/* Clear if another message now displayed */
if(gMessage.Visible == TRUE) Clear_Message();
/* Reset X1 coordinate */
gMessage.Coord[2] = gMessage.Coord[0];
memcpy(&chMessage[0], Text, strlen(Text));
/* Width message text */
LCD_Strig_PointsWidht((uint16_t*)&gMessage.Coord[2], gMessage.Text);
/* устанавливаем ограничения для отрисовки */
Set_New_ClipObject(leftLimit + 1, gMessage.Coord[1], gMessage.Coord[2], gMessage.Coord[3], IN_OBJECT, Message_ClipObj);
Update_Oscillogram(); // обновлем осциллограммы, для того что бы они "обрезались" по размерам отсечения
/* Print message */
LCD_ClearArea(leftLimit + 1, gMessage.Coord[1], gMessage.Coord[2] + 5, gMessage.Coord[3], Active_BackColor);
LCD_PutColorStrig(gMessage.Coord[0], gMessage.Coord[1], 1, gMessage.Text, gMessage.Color);
gMessage.TimeOFF = RTC_GetCounter();
gMessage.TimeOFF += gMessage.TimeShow;
gMessage.Visible = TRUE;
}
开发者ID:assets1975,项目名称:neil-scope3,代码行数:34,代码来源:User_Interface.c
示例13: RTCAlarm_IRQHandler
void RTCAlarm_IRQHandler(void)
{
uint32_t RTC_counter;
RTC->CRL &= (uint16_t)RTC_FLAG_ALR;
EXTI->PR = EXTI_Line17;
RTC_counter = RTC_GetCounter();
if(RTC_counter >= (sysCfg.sleepTime + sleepTimeOld))
{
sleepTimeOld = RTC_counter;
sysEventFlag |= MCU_WAKEUP_FLAG;
InitTimeout(&MCU_WakeupTimeout,TIME_SEC(60));
}
if(GET_ACC_PIN == ACC_ON)
{
POWER_EN_SET_OUTPUT;
POWER_EN_PIN_SET;
timepowerOffDelay = RTC_counter;
}
else if(RTC_counter >= (sysCfg.powerOffDelayTime + timepowerOffDelay))
{
POWER_EN_SET_INPUT;
timepowerOffDelay = RTC_counter;
}
RTC_SetAlarm((RTC_counter + ALARM_TIME));
sysEventFlag |= RTC_ALARM_FLAG;
}
开发者ID:PascalSI,项目名称:ampm_car_tracker,代码行数:28,代码来源:rtc.c
示例14: RTC_IRQHandler
void RTC_IRQHandler(void)
{
/* 判断中断标志位_秒中断 是否被置位 */
if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
{
/* Clear the RTC Second interrupt */
RTC_ClearITPendingBit(RTC_IT_SEC);
/* Toggle GPIO_LED pin 6 each 1s */
//GPIO_WriteBit(GPIO_LED, GPIO_Pin_6, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIO_LED, GPIO_Pin_6)));
/* Enable time update
* TimeDisplay是一个标志位,只有等于1时才让串口发送时 间数据,即让串口一秒发一次时间值 */
TimeDisplay = 1;
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Reset RTC Counter when Time is 23:59:59
* 当时间走到23:59:59秒时RTC计数器中的值清零,0x00015180=23*3600+56*60+59 */
if (RTC_GetCounter() == 0x00015180)
{
RTC_SetCounter(0x0);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
}
}
开发者ID:vcheung,项目名称:STM32,代码行数:27,代码来源:stm32f10x_it.c
示例15: __cmd_TIME_Handler
static void __cmd_TIME_Handler(const SMSInfo *sms) {
DateTime dateTime;
char *pdu = NULL;
int len;
char __toUser[17] = {0}; // 15/06/25,13:20:28
#if defined (__EXTRTC__)
readRTCTime(&dateTime);
#else
SecondToDateTime(&dateTime, RTC_GetCounter());
#endif
__toUser[0] = (dateTime.year / 10) + '0';
__toUser[1] = (dateTime.year % 10) + '0';
__toUser[2] = '/';
__toUser[3] = (dateTime.month / 10) + '0';
__toUser[4] = (dateTime.month % 10) + '0';
__toUser[5] = '/';
__toUser[6] = (dateTime.date / 10) + '0';
__toUser[7] = (dateTime.date % 10) + '0';
__toUser[8] = ',';
__toUser[9] = (dateTime.hour / 10) + '0';
__toUser[10] = (dateTime.hour % 10) + '0';
__toUser[11] = ':';
__toUser[12] = (dateTime.minute / 10) + '0';
__toUser[13] = (dateTime.minute % 10) + '0';
__toUser[14] = ':';
__toUser[15] = (dateTime.second / 10) + '0';
__toUser[16] = (dateTime.second % 10) + '0';
// __sendToNumber(sms->number, __toUser, sizeof(__toUser));
pdu = pvPortMalloc(100);
len = SMSEncodePdu8bit(pdu, sms->number, (char *)__toUser);
GsmTaskSendSMS(pdu, len);
vPortFree(pdu);
}
开发者ID:masuchen,项目名称:chargingmachine,代码行数:35,代码来源:sms_cmd.c
示例16: RTC_IRQHandler
void RTC_IRQHandler(void)
{
uint32_t Curent_RTC_Counter;
ITStatus bitstatus = (ITStatus)(RTC->CRL & RTC_IT_SEC);
// if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
if (((RTC->CRH & RTC_IT_SEC) != (uint16_t)RESET) && (bitstatus != (uint16_t)RESET))
{
NVIC_ClearPendingIRQ(RTC_IRQn);
RTC->CRL &= (uint16_t)~RTC_IT_SEC;
while ((RTC->CRL & RTC_FLAG_RTOFF) == (uint16_t)RESET)
{
}
// RTC_ClearITPendingBit(RTC_IT_SEC);
// RTC_WaitForLastTask();
/* If counter is equal to 86399 */
Curent_RTC_Counter = RTC_GetCounter();
if(Curent_RTC_Counter == 86399)
{
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Reset counter value */
RTC_SetCounter(0x0);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
RTC_Sec_Event = 1;
}
}
开发者ID:LeftRadio,项目名称:cu_indesit_104W,代码行数:31,代码来源:stm32f10x_it.c
示例17: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/* Setup the microcontroller system. Initialize the Embedded Flash Interface,
initialize the PLL and update the SystemFrequency variable. */
SystemInit();
/* Initialize LEDs and Key Button mounted on STM3210X-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_PBInit(Button_KEY, Mode_EXTI);
/* Enable PWR and BKP clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
/* Configure EXTI Line to generate an interrupt on falling edge */
EXTI_Configuration();
/* Configure RTC clock source and prescaler */
RTC_Configuration();
/* NVIC configuration */
NVIC_Configuration();
/* Configure the SysTick to generate an interrupt each 1 millisecond */
SysTick_Configuration();
/* Turn on LED1 */
STM_EVAL_LEDOn(LED1);
while (1)
{
/* Insert 1.5 second delay */
Delay(1500);
/* Wait till RTC Second event occurs */
RTC_ClearFlag(RTC_FLAG_SEC);
while(RTC_GetFlagStatus(RTC_FLAG_SEC) == RESET);
/* Alarm in 3 second */
RTC_SetAlarm(RTC_GetCounter()+ 3);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Turn off LED1 */
STM_EVAL_LEDOff(LED1);
/* Request to enter STOP mode with regulator in low power mode*/
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
/* At this stage the system has resumed from STOP mode -------------------*/
/* Turn on LED1 */
STM_EVAL_LEDOn(LED1);
/* 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) */
SYSCLKConfig_STOP();
}
}
开发者ID:DerekTan,项目名称:STM32F107_ucosIII,代码行数:64,代码来源:main.c
示例18: main
/*******************************************************************************
* Function Name : main
* Description : Main program.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
debug();
#endif
/* Clock configuration */
RCC_Configuration();
/* Enable PWR and BKP clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
/* GPIO configuration */
GPIO_Configuration();
/* Configure EXTI Line to generate an interrupt on falling edge */
EXTI_Configuration();
/* Configure RTC clock source and prescaler */
RTC_Configuration();
/* NVIC configuration */
NVIC_Configuration();
/* Configure the SysTick to generate an interrupt each 1 millisecond */
SysTick_Configuration();
/* Turn on led connected to GPIO_LED Pin6 */
GPIO_SetBits(GPIO_LED, GPIO_Pin_6);
while (1)
{
/* Insert 1.5 second delay */
Delay(1500);
/* Wait till RTC Second event occurs */
RTC_ClearFlag(RTC_FLAG_SEC);
while(RTC_GetFlagStatus(RTC_FLAG_SEC) == RESET);
/* Alarm in 3 second */
RTC_SetAlarm(RTC_GetCounter()+ 3);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Turn off led connected to GPIO_LED Pin6 */
GPIO_ResetBits(GPIO_LED, GPIO_Pin_6);
/* Request to enter STOP mode with regulator in low power mode*/
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
/* At this stage the system has resumed from STOP mode -------------------*/
/* Turn on led connected to GPIO_LED Pin6 */
GPIO_SetBits(GPIO_LED, GPIO_Pin_6);
/* 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) */
SYSCLKConfig_STOP();
}
}
开发者ID:timmy00274672,项目名称:STM32-Learning,代码行数:66,代码来源:main.c
示例19: __time32
/* STD C TIME FUNC */
__time32_t __time32(__time32_t *p)
{
#ifndef PRECISION_IN_MS
RTC_GetCounter();
#else
return seconds;
#endif
}
开发者ID:running1919,项目名称:qianlab,代码行数:9,代码来源:clock.c
示例20: VirtualRTC_Init
/**
* @brief Init virtualRTC
* @retval : None
*/
void VirtualRTC_Init(void)
{
StartSecondNum = RTC_GetCounter();
if (VirtualRTCHandle != NULL)
vTaskDelete(VirtualRTCHandle);
xTaskCreate(VirtualRTC_Handler, "VirtualClock",
128, NULL, VIRTUAL_CLOCK_UPDATE_PRIORITY, &VirtualRTCHandle);
}
开发者ID:yanke928,项目名称:Kanade,代码行数:12,代码来源:VirtualRTC.c
注:本文中的RTC_GetCounter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论