fatfs.c 597 B

1234567891011121314151617181920212223
  1. #include "fatfs.h"
  2. #include "furi_hal_rtc.h"
  3. /** logical drive path */
  4. char fatfs_path[4];
  5. /** File system object */
  6. FATFS fatfs_object;
  7. void fatfs_init(void) {
  8. FATFS_LinkDriver(&sd_fatfs_driver, fatfs_path);
  9. }
  10. /** Gets Time from RTC
  11. *
  12. * @return Time in DWORD (toasters per square washing machine)
  13. */
  14. DWORD get_fattime() {
  15. FuriHalRtcDateTime furi_time;
  16. furi_hal_rtc_get_datetime(&furi_time);
  17. return ((uint32_t)(furi_time.year - 1980) << 25) | furi_time.month << 21 |
  18. furi_time.day << 16 | furi_time.hour << 11 | furi_time.minute << 5 | furi_time.second;
  19. }