touch & sd working
This commit is contained in:
22
fatfs_time.c
Normal file
22
fatfs_time.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get current time for FatFS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#include "ff.h"
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
/* Get current time */
|
||||
DWORD get_fattime (void)
|
||||
{
|
||||
// Return a fixed timestamp (2024-01-01 00:00:00)
|
||||
// In a real application, you would get this from an RTC
|
||||
// Format: bit31:25=Year(0-127 +1980), bit24:21=Month(1-12), bit20:16=Day(1-31)
|
||||
// bit15:11=Hour(0-23), bit10:5=Minute(0-59), bit4:0=Second/2(0-29)
|
||||
|
||||
return ((DWORD)(2024 - 1980) << 25) // Year: 2024
|
||||
| ((DWORD)1 << 21) // Month: January
|
||||
| ((DWORD)1 << 16) // Day: 1
|
||||
| ((DWORD)0 << 11) // Hour: 0
|
||||
| ((DWORD)0 << 5) // Minute: 0
|
||||
| ((DWORD)0 >> 1); // Second: 0
|
||||
}
|
||||
Reference in New Issue
Block a user