fattime_rtc.c
Go to the documentation of this file.
1 
33 #include "compiler.h"
34 #include "rtc.h"
35 #include "globals.h"
36 
37 uint32_t get_fattime(void);
57 uint32_t get_fattime(void)
58 {
59  uint32_t ul_time;
60  uint32_t ul_hour, ul_minute, ul_second;
61  uint32_t ul_year, ul_month, ul_day, ul_week;
62 
63 #if USE_RTC_DATE_TIME
64  /* Retrieve date and time */
65  rtc_get_time(RTC, &ul_hour, &ul_minute, &ul_second);
66  rtc_get_date(RTC, &ul_year, &ul_month, &ul_day, &ul_week);
67 #else
68  ul_year = g_gps_date_time.year;
69  ul_month = g_gps_date_time.month;
70  ul_day = g_gps_date_time.day;
71  ul_hour = g_gps_date_time.hour;
72  ul_minute = g_gps_date_time.minute;
73  ul_second = g_gps_date_time.second;
74 #endif
75  ul_time = ((ul_year - 1980) << 25)
76  | (ul_month << 21)
77  | (ul_day << 16)
78  | (ul_hour << 11)
79  | (ul_minute << 5)
80  | ((ul_second >> 1) << 0);
81 
82  return ul_time;
83 }
84 
uint32_t second
Definition: globals.h:38
void rtc_get_time(Rtc *p_rtc, uint32_t *pul_hour, uint32_t *pul_minute, uint32_t *pul_second)
Get the RTC time value.
Definition: rtc.c:146
uint32_t get_fattime(void)
Current time returned is packed into a DWORD value.
Definition: fattime_rtc.c:57
Commonly used includes, types and macros.
uint32_t month
Definition: globals.h:38
uint32_t hour
Definition: globals.h:38
date_time_t g_gps_date_time
Definition: globals.c:28
uint32_t minute
Definition: globals.h:38
uint32_t year
Definition: globals.h:38
uint32_t day
Definition: globals.h:38
void rtc_get_date(Rtc *p_rtc, uint32_t *pul_year, uint32_t *pul_month, uint32_t *pul_day, uint32_t *pul_week)
Get the RTC date value.
Definition: rtc.c:296
#define RTC
(RTC ) Base Address
Definition: same70j19.h:536


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:04