• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ HAL_RTC_GetTime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAL_RTC_GetTime函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_RTC_GetTime函数的具体用法?C++ HAL_RTC_GetTime怎么用?C++ HAL_RTC_GetTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAL_RTC_GetTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: RTC_CalendarShow

/**
  * @brief  Displays the current time and date.
  * @param  None
  * @retval None
  */
static void RTC_CalendarShow(void)
{
  RTC_DateTypeDef sdatestructureget;
  RTC_TimeTypeDef stimestructureget;
  
#ifdef USE_LCD   
  /* Get the RTC current Time */
  HAL_RTC_GetTime(&RtcHandle, &stimestructureget, RTC_FORMAT_BCD);
  /* Get the RTC current Date */
  HAL_RTC_GetDate(&RtcHandle, &sdatestructureget, RTC_FORMAT_BCD);
  /* Set the Back Color */
  BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
  /* Set the Text Color */
  BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
  BSP_LCD_DisplayStringAtLine(6, (uint8_t *)"Current Time Display");

  RTC_Time_display(7, LCD_COLOR_BLACK , RTC_Get_Time(&stimestructureget));
#else
  /* Get the RTC current Time */
  HAL_RTC_GetTime(&RtcHandle, &stimestructureget, RTC_FORMAT_BIN);
  /* Get the RTC current Date */
  HAL_RTC_GetDate(&RtcHandle, &sdatestructureget, RTC_FORMAT_BIN);
  /* Display time Format : hh:mm:ss */
  sprintf((char*)aShowTime,"%0.2d:%0.2d:%0.2d", stimestructureget.Hours, stimestructureget.Minutes, stimestructureget.Seconds);
  /* Display date Format : mm-dd-yy */
  sprintf((char*)aShowDate,"%0.2d-%0.2d-%0.2d", sdatestructureget.Month, sdatestructureget.Date, 2000 + sdatestructureget.Year); 
#endif /* USE_LCD */
} 
开发者ID:PaxInstruments,项目名称:STM32CubeF4,代码行数:33,代码来源:main.c


示例2: RTC_Read_datetime

//-------------------------------------------------------------------
//read date time
void RTC_Read_datetime(uint8_t * data,uint8_t flag)
{
	uint8_t temp[3];
	//first read tiem ,then read date, or not time is not run;
	RTC_DateTypeDef sdatestructureget;
  RTC_TimeTypeDef stimestructureget;
	HAL_RTCStateTypeDef status;

	if(data!=NULL)
	{	
		osMutexWait(rtc_mutex, osWaitForever);
		/* Get the RTC current Time */
		HAL_RTC_GetTime(&hrtc, &stimestructureget, RTC_FORMAT_BIN);
		temp[0]=stimestructureget.Hours;
		temp[1]=stimestructureget.Minutes;
		temp[2]=stimestructureget.Seconds;
		
		memcpy(&current_datetime[3],temp,3);
		
		/* Get the RTC current Date */
		HAL_RTC_GetDate(&hrtc, &sdatestructureget, RTC_FORMAT_BIN);
		data[0]=sdatestructureget.Year;
		data[1]=sdatestructureget.Month;
		data[2]=sdatestructureget.Date;
		current_datetime[6]=sdatestructureget.WeekDay;

		memcpy(&current_datetime[0],data,3);

		if(flag==1)
		{
			memcpy(data,temp,3);
		}
		osMutexRelease(rtc_mutex);
	}
}
开发者ID:hlmpost,项目名称:code_backup,代码行数:37,代码来源:eric_rtc.c


示例3: StartTaskTFT

/* StartTaskTFT function */
void StartTaskTFT(void const * argument)
{
  /* USER CODE BEGIN StartTaskTFT */
RTC_TimeTypeDef	sTime;
RTC_DateTypeDef	sDate;
char buf[100];
	
	sprintf(buf, "tft run\r\n");
			HAL_UART_Transmit(&huart1,(uint8_t*)buf,strlen(buf),100);
SSD1289_Init();
LCD_Clear(yellow);
	memset(buf,0,100);
  LCD_WriteString_5x7(20, 240 - 30, "Hello world.", red, yellow, 0, 1);
	LCD_WriteString_5x7(20, 240 - 30 - 20, "STM32F103VET6", green, yellow, 0, 1);
  /* Infinite loop */
  for(;;)
  {
		
		HAL_RTC_GetDate(&hrtc, &sDate, FORMAT_BIN);
		HAL_RTC_GetTime(&hrtc, &sTime, FORMAT_BIN);
		memset(buf,0,100);
		sprintf(buf, "Date: %02d/%02d/%02d", sDate.Date, sDate.Month, sDate.Year);
		LCD_WriteString_5x7(50,100, buf, magneta, yellow,0, 2);
		memset(buf,0,100);
		sprintf(buf, "Time: %02d:%02d:%02d", sTime.Hours, sTime.Minutes, sTime.Seconds);
		LCD_WriteString_5x7(50, 160, buf, magneta, yellow,0, 2);
		LCD_WriteString_5x7(50, 50, gbuf, green, yellow,0, 2);
		
    osDelay(500);
  }
  /* USER CODE END StartTaskTFT */
}
开发者ID:Casa2011,项目名称:devices,代码行数:33,代码来源:main.c


示例4: rtc_read

/*
 RTC Registers
   RTC_WeekDay 1=monday, 2=tuesday, ..., 7=sunday
   RTC_Month   1=january, 2=february, ..., 12=december
   RTC_Date    day of the month 1-31
   RTC_Year    year 0-99
 struct tm
   tm_sec      seconds after the minute 0-61
   tm_min      minutes after the hour 0-59
   tm_hour     hours since midnight 0-23
   tm_mday     day of the month 1-31
   tm_mon      months since January 0-11
   tm_year     years since 1900
   tm_wday     days since Sunday 0-6
   tm_yday     days since January 1 0-365
   tm_isdst    Daylight Saving Time flag
*/
time_t rtc_read(void) {
    RTC_DateTypeDef dateStruct;
    RTC_TimeTypeDef timeStruct;
    struct tm timeinfo;

    RtcHandle.Instance = RTC;

    // Read actual date and time
    // Warning: the time must be read first!
    HAL_RTC_GetTime(&RtcHandle, &timeStruct, FORMAT_BIN);
    HAL_RTC_GetDate(&RtcHandle, &dateStruct, FORMAT_BIN);

    // Setup a tm structure based on the RTC
    timeinfo.tm_wday = dateStruct.WeekDay;
    timeinfo.tm_mon  = dateStruct.Month - 1;
    timeinfo.tm_mday = dateStruct.Date;
    timeinfo.tm_year = dateStruct.Year + 100;
    timeinfo.tm_hour = timeStruct.Hours;
    timeinfo.tm_min  = timeStruct.Minutes;
    timeinfo.tm_sec  = timeStruct.Seconds;

    // Convert to timestamp
    time_t t = mktime(&timeinfo);

    return t;
}
开发者ID:logxen,项目名称:mbed,代码行数:43,代码来源:rtc_api.c


示例5: RTC_CalendarShow

uint32_t RTC_CalendarShow(uint8_t* showtime)
{
    uint32_t current_time;

    RTC_DateTypeDef sdatestructureget;
    RTC_TimeTypeDef stimestructureget;
    /* Get the RTC current Time */
    HAL_RTC_GetTime(&RTCHandle, &stimestructureget, RTC_FORMAT_BIN);
    /* Get the RTC current Date */
    HAL_RTC_GetDate(&RTCHandle, &sdatestructureget, RTC_FORMAT_BIN);
#ifdef RTC_LSI
    current_time = (
                       (1000 - (stimestructureget.SubSeconds)*1000/1032) +
                       (stimestructureget.Seconds )*1000+
                       (stimestructureget.Minutes )*1000*60
                   );
#endif

#ifdef RTC_LSE
    current_time = (
                       (1000 - (stimestructureget.SubSeconds)*1000/1023) +
                       (stimestructureget.Seconds )*1000+
                       (stimestructureget.Minutes )*1000*60
                   );
#endif

    current_time &= 0x00FFFFFF;

    return current_time;
}
开发者ID:gilbertjuly,项目名称:cannon,代码行数:30,代码来源:stm32f401_lp_mode.c


示例6: StartDefaultTask

/* StartDefaultTask function */
void StartDefaultTask(void const * argument)
{
  /* init code for FATFS */
  MX_FATFS_Init();

  /* USER CODE BEGIN 5 */
uint8_t sec = 0;
RTC_TimeTypeDef	sTime;
RTC_DateTypeDef	sDate;
char buf[50];
	sprintf(buf, "idle run\r\n");
			HAL_UART_Transmit(&huart1,(uint8_t*)buf,strlen(buf),100);
  /* Infinite loop */
  for(;;)
  {	
		HAL_RTC_GetDate(&hrtc, &sDate, FORMAT_BIN);
		HAL_RTC_GetTime(&hrtc, &sTime, FORMAT_BIN);
		//memset(buf,0,255);
		if(sec != sTime.Seconds){
			sec = sTime.Seconds;
		memset(buf,0,50);
		sprintf(buf, "Date: %02d/%02d/%02d Time: %02d:%02d:%02d\r\n\0", sDate.Date, sDate.Month, 
		sDate.Year, sTime.Hours, sTime.Minutes, sTime.Seconds);
		HAL_UART_Transmit(&huart1,(uint8_t*)buf,strlen(buf),100);
		}
    osDelay(1000);
  }
  /* USER CODE END 5 */ 
}
开发者ID:Casa2011,项目名称:devices,代码行数:30,代码来源:main.c


示例7: rtcGetDateTime

void rtcGetDateTime(RTC_DateTypeDef *date, RTC_TimeTypeDef *time)
{
    /* Get the RTC current Time */
    HAL_RTC_GetTime(&RtcHandle, time, FORMAT_BIN);
    /* Get the RTC current Date */
    HAL_RTC_GetDate(&RtcHandle, date, FORMAT_BIN);
}
开发者ID:FlankerZ,项目名称:epaper_cnt,代码行数:7,代码来源:rtc.c


示例8: HAL_GPIO_EXTI_Callback

/**
  * @brief  EXTI line detection callbacks
  * @param  GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if(GPIO_Pin == KEY_BUTTON_PIN)
  {  
    HAL_RTC_GetTime(&RTCHandle, &RTC_TimeStructure, RTC_FORMAT_BIN);
    HAL_RTC_GetDate(&RTCHandle, &RTC_DateStructure, RTC_FORMAT_BIN);
    
    /* Set the alarm to current time + 5s */
    RTC_AlarmStructure.Alarm  = RTC_ALARM_A;
    RTC_AlarmStructure.AlarmTime.TimeFormat = RTC_TimeStructure.TimeFormat;
    RTC_AlarmStructure.AlarmTime.Hours = RTC_TimeStructure.Hours;
    RTC_AlarmStructure.AlarmTime.Minutes = RTC_TimeStructure.Minutes;
    RTC_AlarmStructure.AlarmTime.Seconds = (RTC_TimeStructure.Seconds + 0x05) % 60;
    RTC_AlarmStructure.AlarmDateWeekDay = 0x31;
    RTC_AlarmStructure.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
    RTC_AlarmStructure.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY | RTC_ALARMMASK_HOURS | RTC_ALARMMASK_MINUTES;
    RTC_AlarmStructure.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE;
    
    /* The Following Wakeup sequence is highly recommended prior to each Standby
       mode entry mainly  when using more than one wakeup source this is to not 
       miss any wakeup event:
       - Disable all used wakeup sources,
       - Clear all related wakeup flags,
       - Re-enable all used wakeup sources,
       - Enter the Standby mode.
    */

    /*## Disable all used wakeup sources #####################################*/
    /* Disable Wake-up timer */
    HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
    
    /* Disable RTC Alarm */
    HAL_RTC_DeactivateAlarm(&RTCHandle, RTC_ALARM_A);

    /*## Clear all related wakeup flags ######################################*/
    /* Clear PWR wake up Flag */
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
    
    /* Clear the Alarm Flag */
    __HAL_RTC_ALARM_CLEAR_FLAG(&RTCHandle, RTC_FLAG_ALRAF);

    /*## Re-enable all used wakeup sources ###################################*/
    /* Set RTC alarm */
    if(HAL_RTC_SetAlarm_IT(&RTCHandle, &RTC_AlarmStructure, RTC_FORMAT_BIN) != HAL_OK) 
    {
      /* Initialization Error */
      Error_Handler();
    }

    /* Enable WKUP pin */
    HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

    /* Turn LED1 off */
    BSP_LED_Off(LED1);

    /*## Enter Standby Mode ##################################################*/
    HAL_PWR_EnterSTANDBYMode();
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF4,代码行数:64,代码来源:main.c


示例9: get_fattime

DWORD get_fattime(void) {
    rtc_init_finalise();
    RTC_TimeTypeDef time;
    RTC_DateTypeDef date;
    HAL_RTC_GetTime(&RTCHandle, &time, FORMAT_BIN);
    HAL_RTC_GetDate(&RTCHandle, &date, FORMAT_BIN);
    return ((2000 + date.Year - 1980) << 25) | ((date.Month) << 21) | ((date.Date) << 16) | ((time.Hours) << 11) | ((time.Minutes) << 5) | (time.Seconds / 2);
}
开发者ID:19emtuck,项目名称:micropython,代码行数:8,代码来源:fatfs_port.c


示例10: RtcGetCalendar

static RtcCalendar_t RtcGetCalendar( void )
{
    RtcCalendar_t calendar;
    HAL_RTC_GetTime( &RtcHandle, &calendar.CalendarTime, RTC_FORMAT_BIN );
    HAL_RTC_GetDate( &RtcHandle, &calendar.CalendarDate, RTC_FORMAT_BIN );
    calendar.CalendarCentury = Century;
    RtcCheckCalendarRollOver( calendar.CalendarDate.Year );
    return calendar;
}
开发者ID:CommunicationSolutions,项目名称:Comsol_LPWA_Node,代码行数:9,代码来源:rtc-board.c


示例11: time_time

/// \function time()
/// Returns the number of seconds, as an integer, since 1/1/2000.
STATIC mp_obj_t time_time(void) {
    // get date and time
    // note: need to call get time then get date to correctly access the registers
    RTC_DateTypeDef date;
    RTC_TimeTypeDef time;
    HAL_RTC_GetTime(&RTCHandle, &time, FORMAT_BIN);
    HAL_RTC_GetDate(&RTCHandle, &date, FORMAT_BIN);
    return mp_obj_new_int(timeutils_seconds_since_2000(2000 + date.Year, date.Month, date.Date, time.Hours, time.Minutes, time.Seconds));
}
开发者ID:EmuxEvans,项目名称:micropython,代码行数:11,代码来源:modutime.c


示例12: RTC_Set_datetime

//------------------------------------------------------------------
void RTC_Set_datetime(uint8_t * data)
{
	uint8_t temp[3];
	RTC_DateTypeDef sdatestructure;
  RTC_TimeTypeDef stimestructure;
	if(data!=NULL)
	{
		osMutexWait(rtc_mutex, osWaitForever);

			sdatestructure.Year =data[0];
			sdatestructure.Month = data[1];
			sdatestructure.Date = data[2];
		  sdatestructure.WeekDay= CaculateWeekDay(data[0],data[1],data[2]);

			if(HAL_RTC_SetDate(&hrtc,&sdatestructure,RTC_FORMAT_BIN) != HAL_OK)
			{
				/* Initialization Error */
				Error_Handler("set time error"); 
			} 
			stimestructure.Hours = data[3];
			stimestructure.Minutes = data[4];
			stimestructure.Seconds = data[5];
			stimestructure.TimeFormat = RTC_HOURFORMAT12_AM;
			stimestructure.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
			stimestructure.StoreOperation = RTC_STOREOPERATION_RESET;
			if(HAL_RTC_SetTime(&hrtc,&stimestructure,RTC_FORMAT_BIN) != HAL_OK)
				{
					/* Initialization Error */
					Error_Handler("set date error"); 
				}	
#if 0				
					//flash lcd
		HAL_RTC_GetTime(&hrtc, &stimestructure, RTC_FORMAT_BIN);
		temp[0]=stimestructure.Hours;
		temp[1]=stimestructure.Minutes;
		temp[2]=stimestructure.Seconds;
		
		memcpy(&current_datetime[3],temp,3);
		
		/* Get the RTC current Date */
		HAL_RTC_GetDate(&hrtc, &sdatestructure, RTC_FORMAT_BIN);
		data[0]=sdatestructure.Year;
		data[1]=sdatestructure.Month;
		data[2]=sdatestructure.Date;
		current_datetime[6]=sdatestructure.WeekDay;
		memcpy(&current_datetime[0],data,3);
#endif
		if(disp_sort==0)
				send_message(4);

	  osMutexRelease(rtc_mutex);

	}//data=null
}
开发者ID:hlmpost,项目名称:code_backup,代码行数:55,代码来源:eric_rtc.c


示例13: fp_get_rtc_time

/*
    Conditions:
      0
    Exit points:
      1
    M = 0 - 1 + 2 = 3
    Cyclomatic complexity
      1
  */
uint32_t fp_get_rtc_time(void)
{
  RTC_TimeTypeDef sTime;
  uint32_t curTime;

  HAL_RTC_GetTime(&rtc, &sTime, FORMAT_BIN);

  curTime = (sTime.Hours * 3600) + (sTime.Minutes * 60) + (sTime.Seconds);

  return curTime;
}
开发者ID:ChicoState,项目名称:eggbeater,代码行数:20,代码来源:fingerprint_reader.c


示例14: RTC_TimeShow

/**
  * @brief  Display the current time.
  * @param  showtime : pointer to buffer
  * @retval None
  */
static void RTC_TimeShow(uint8_t* showtime)
{
  RTC_DateTypeDef sdatestructureget;
  RTC_TimeTypeDef stimestructureget;
  
  /* Get the RTC current Time */
  HAL_RTC_GetTime(&RtcHandle, &stimestructureget, RTC_FORMAT_BIN);
  /* Get the RTC current Date */
  HAL_RTC_GetDate(&RtcHandle, &sdatestructureget, RTC_FORMAT_BIN);
  /* Display time Format : hh:mm:ss */
  sprintf((char*)showtime,"%02d:%02d:%02d",stimestructureget.Hours, stimestructureget.Minutes, stimestructureget.Seconds);
} 
开发者ID:451506709,项目名称:automated_machine,代码行数:17,代码来源:main.c


示例15: main

int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  RTC_TimeTypeDef Tim;
  RTC_DateTypeDef Dat;

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  /* Initialize LED 4 */
  BSP_LED_Init(LED4);
  /* Initialize RTC */
  BSP_RTC_Init();

  BSP_RTC_Alarm_Init(AlarmA,0,0,5,RTC_ALARMDATEWEEKDAYSEL_DATE); //Generate alarm interrupt
  /* Initialize UART with 115200 baud rate */
  BSP_UART_Init(115200);

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    __HAL_RTC_ALARM_CLEAR_FLAG(&hrtc_bsp,RTC_ISR_ALRAF);
    __HAL_RTC_ALARM_CLEAR_FLAG(&hrtc_bsp,RTC_ISR_ALRBF);
    HAL_RTC_GetTime(&hrtc_bsp,&Tim,FORMAT_BIN);
    HAL_RTC_GetDate(&hrtc_bsp,&Dat,FORMAT_BIN);
    Tim.SubSeconds = 1000 - ((hrtc_bsp.Instance->SSR*1000)/hrtc_bsp.Init.SynchPrediv);                // Count msec
    uprintf("\x1b[3;1H %d02 : %d02 : %d02 : %d04",Tim.Hours,Tim.Minutes,Tim.Seconds,Tim.SubSeconds);
//    uprintf("\x1b[4;1H %d02 / %d02 / %d04", Dat.Date,Dat.Month,Dat.Year);

  }
  /* USER CODE END 3 */

}
开发者ID:glocklueng,项目名称:STM32F4-Dev,代码行数:52,代码来源:main.c


示例16: HAL_GPIO_EXTI_Callback

/**
  * @brief EXTI line detection callbacks
  * @param GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if (GPIO_Pin == USER_BUTTON_PIN)
  {
    
        /* Wait that user release the User push-button */
    while(BSP_PB_GetState(BUTTON_USER) == GPIO_PIN_SET){}
    
    HAL_RTC_GetTime(&RTCHandle, &RTC_TimeStructure, RTC_FORMAT_BIN);
    HAL_RTC_GetDate(&RTCHandle, &RTC_DateStructure, RTC_FORMAT_BIN);

    /* Set the alarm to current time + 5s */
    RTC_AlarmStructure.Alarm  = RTC_ALARM_A;
    RTC_AlarmStructure.AlarmTime.TimeFormat = RTC_TimeStructure.TimeFormat;
    RTC_AlarmStructure.AlarmTime.Hours = RTC_TimeStructure.Hours;
    RTC_AlarmStructure.AlarmTime.Minutes = RTC_TimeStructure.Minutes;
    RTC_AlarmStructure.AlarmTime.Seconds = (RTC_TimeStructure.Seconds + 5) % 60;
    RTC_AlarmStructure.AlarmDateWeekDay = 31;
    RTC_AlarmStructure.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
    RTC_AlarmStructure.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY | RTC_ALARMMASK_HOURS | RTC_ALARMMASK_MINUTES;
    RTC_AlarmStructure.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE;
    if (HAL_RTC_SetAlarm_IT(&RTCHandle, &RTC_AlarmStructure, RTC_FORMAT_BIN) != HAL_OK)
    {
      /* Initialization Error */
      Error_Handler();
    }

    /* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
       mainly  when using more than one wakeup source this is to not miss any wakeup event.
         - Disable all used wakeup sources,
         - Clear all related wakeup flags, 
         - Re-enable all used wakeup sources,
         - Enter the Standby mode.
    */
  
    /*#### Disable all used wakeup sources: WKUP pin ###########################*/
    HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
  
    /*#### Clear all related wakeup flags ######################################*/
    /* Clear PWR wake up Flag */
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
  
    /* Enable WKUP pin */
    HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

    /* Turn LED3 off */
    BSP_LED_Off(LED3);

    /* Request to enter STANDBY mode */
    HAL_PWR_EnterSTANDBYMode();
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF3,代码行数:57,代码来源:main.c


示例17: get_fattime

MP_WEAK DWORD get_fattime(void) {
    #if MICROPY_HW_ENABLE_RTC
    rtc_init_finalise();
    RTC_TimeTypeDef time;
    RTC_DateTypeDef date;
    HAL_RTC_GetTime(&RTCHandle, &time, RTC_FORMAT_BIN);
    HAL_RTC_GetDate(&RTCHandle, &date, RTC_FORMAT_BIN);
    return ((2000 + date.Year - 1980) << 25) | ((date.Month) << 21) | ((date.Date) << 16) | ((time.Hours) << 11) | ((time.Minutes) << 5) | (time.Seconds / 2);
    #else
    // Jan 1st, 2018 at midnight. Not sure what timezone.
    return ((2018 - 1980) << 25) | ((1) << 21) | ((1) << 16) | ((0) << 11) | ((0) << 5) | (0 / 2);
    #endif
}
开发者ID:DanielO,项目名称:micropython,代码行数:13,代码来源:fatfs_port.c


示例18: RtcGetCalendar

static RtcCalendar_t RtcGetCalendar( void )
{
    uint32_t first_read = 0;
    uint32_t second_read = 0;
    RtcCalendar_t now;

    // Get Time and Date
    HAL_RTC_GetTime( &RtcHandle, &now.CalendarTime, RTC_FORMAT_BIN );
    first_read = now.CalendarTime.SubSeconds;
    HAL_RTC_GetTime( &RtcHandle, &now.CalendarTime, RTC_FORMAT_BIN );
    second_read = now.CalendarTime.SubSeconds;

    // make sure it is correct due to asynchronous nature of RTC
    while( first_read != second_read )
    {
        first_read = second_read;
        HAL_RTC_GetTime( &RtcHandle, &now.CalendarTime, RTC_FORMAT_BIN );
        second_read = now.CalendarTime.SubSeconds;
    }
    HAL_RTC_GetDate( &RtcHandle, &now.CalendarDate, RTC_FORMAT_BIN );
    return( now );
}
开发者ID:Lora-net,项目名称:LoRaMac-node,代码行数:22,代码来源:rtc-board.c


示例19: TM_RTC_GetDateTime

TM_RTC_Result_t TM_RTC_GetDateTime(TM_RTC_t* data, TM_RTC_Format_t format) {
	uint32_t unix;

	/* Get time */
	if (format == TM_RTC_Format_BIN) {
		HAL_RTC_GetTime(&hRTC, &RTC_TimeStruct, RTC_FORMAT_BIN);
	} else {
		HAL_RTC_GetTime(&hRTC, &RTC_TimeStruct, RTC_FORMAT_BCD);
	}
	
	/* Format hours */
	data->Hours = RTC_TimeStruct.Hours;
	data->Minutes = RTC_TimeStruct.Minutes;
	data->Seconds = RTC_TimeStruct.Seconds;
	
	/* Get subseconds */
	data->Subseconds = RTC->SSR;
	
	/* Get date */
	if (format == TM_RTC_Format_BIN) {
		HAL_RTC_GetDate(&hRTC, &RTC_DateStruct, RTC_FORMAT_BIN);
	} else {
		HAL_RTC_GetDate(&hRTC, &RTC_DateStruct, RTC_FORMAT_BCD);
	}
	
	/* Format date */
	data->Year = RTC_DateStruct.Year;
	data->Month = RTC_DateStruct.Month;
	data->Day = RTC_DateStruct.Date;
	data->WeekDay = RTC_DateStruct.WeekDay;
	
	/* Calculate unix offset */
	unix = TM_RTC_GetUnixTimeStamp(data);
	data->Unix = unix;

	/* Return OK */
	return TM_RTC_Result_Ok;
}
开发者ID:qermit,项目名称:stm32fxxx_hal_libraries,代码行数:38,代码来源:tm_stm32_rtc.c


示例20: RTC_Alarm_IRQHandler

/**
* @brief This function handles RTC alarms A and B interrupt through EXTI line 17.
*/
void RTC_Alarm_IRQHandler(void)
{
  /* USER CODE BEGIN RTC_Alarm_IRQn 0 */

  /* Get time and date from RTC registers */
  HAL_RTC_GetTime(&hrtc, &time_now, RTC_FORMAT_BIN);
  HAL_RTC_GetDate(&hrtc, &date_now, RTC_FORMAT_BIN);
  
  /* USER CODE END RTC_Alarm_IRQn 0 */
  HAL_RTC_AlarmIRQHandler(&hrtc);
  /* USER CODE BEGIN RTC_Alarm_IRQn 1 */

  /* USER CODE END RTC_Alarm_IRQn 1 */
}
开发者ID:outsidersdelaelectronica,项目名称:tiic-2015,代码行数:17,代码来源:stm32l1xx_it.c



注:本文中的HAL_RTC_GetTime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAL_RTC_SetDate函数代码示例发布时间:2022-05-30
下一篇:
C++ HAL_RTC_GetDate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap