diff options
Diffstat (limited to 'os/hal/src/rtc.c')
-rw-r--r-- | os/hal/src/rtc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/os/hal/src/rtc.c b/os/hal/src/rtc.c index 01f88e82d..a6601fd1c 100644 --- a/os/hal/src/rtc.c +++ b/os/hal/src/rtc.c @@ -101,6 +101,26 @@ void rtcGetTime(RTCDriver *rtcp, RTCTime *timespec) { chSysUnlock();
}
+/**
+ * @brief Get current time in format suitable for usage in FatFS.
+ *
+ * @param[in] rtcp pointer to RTC driver structure
+ * @return FAT time value.
+ *
+ * @api
+ */
+uint32_t rtcGetFatTime(RTCDriver *rtcp) {
+ RTCTime timespec;
+
+ chDbgCheck((rtcp != NULL), "rtcGetTime");
+
+ chSysLock();
+ rtcGetTimeI(rtcp, ×pec);
+ chSysUnlock();
+
+ return rtc_lld_calc_fat_time(×pec);
+}
+
#if (RTC_ALARMS > 0) || defined(__DOXYGEN__)
/**
* @brief Set alarm time.
|