2021-05-18 12:23:14 +03:00
|
|
|
#include "fatfs.h"
|
2023-04-01 16:50:30 +03:00
|
|
|
#include "furi_hal_rtc.h"
|
2021-05-18 12:23:14 +03:00
|
|
|
|
2023-03-20 16:09:10 +03:00
|
|
|
/** logical drive path */
|
|
|
|
char fatfs_path[4];
|
|
|
|
/** File system object */
|
|
|
|
FATFS fatfs_object;
|
2021-05-18 12:23:14 +03:00
|
|
|
|
2023-03-20 16:09:10 +03:00
|
|
|
void fatfs_init(void) {
|
|
|
|
FATFS_LinkDriver(&sd_fatfs_driver, fatfs_path);
|
2021-05-18 12:23:14 +03:00
|
|
|
}
|
|
|
|
|
2023-04-01 16:50:30 +03:00
|
|
|
/** Gets Time from RTC
|
|
|
|
*
|
|
|
|
* @return Time in DWORD (toasters per square washing machine)
|
2021-05-18 12:23:14 +03:00
|
|
|
*/
|
2023-04-01 16:50:30 +03:00
|
|
|
DWORD get_fattime() {
|
|
|
|
FuriHalRtcDateTime furi_time;
|
|
|
|
furi_hal_rtc_get_datetime(&furi_time);
|
|
|
|
|
|
|
|
return ((uint32_t)(furi_time.year - 1980) << 25) | furi_time.month << 21 |
|
|
|
|
furi_time.day << 16 | furi_time.hour << 11 | furi_time.minute << 5 | furi_time.second;
|
2021-05-18 12:23:14 +03:00
|
|
|
}
|