From 7776aa4e2e7430da6fab1712816b887d21032dd9 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 13 Jan 2011 19:14:38 +0000 Subject: Changed TempDataLogger project's DS1307 driver to simplify the function interface and prevent a possible race condition. --- Projects/TempDataLogger/Lib/FATFs/diskio.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'Projects/TempDataLogger/Lib/FATFs/diskio.c') diff --git a/Projects/TempDataLogger/Lib/FATFs/diskio.c b/Projects/TempDataLogger/Lib/FATFs/diskio.c index c18151284..400687734 100644 --- a/Projects/TempDataLogger/Lib/FATFs/diskio.c +++ b/Projects/TempDataLogger/Lib/FATFs/diskio.c @@ -83,18 +83,16 @@ DRESULT disk_ioctl ( DWORD get_fattime (void) { - uint8_t Day, Month, Year; - uint8_t Hour, Minute, Second; + TimeDate_t CurrTimeDate; - DS1307_GetDate(&Day, &Month, &Year); - DS1307_GetTime(&Hour, &Minute, &Second); + DS1307_GetTimeDate(&CurrTimeDate); - return ((DWORD)(20 + Year) << 25) | - ((DWORD)Month << 21) | - ((DWORD)Day << 16) | - ((DWORD)Hour << 11) | - ((DWORD)Minute << 5) | - (((DWORD)Second >> 1) << 0); + return ((DWORD)(20 + CurrTimeDate.Year) << 25) | + ((DWORD)CurrTimeDate.Month << 21) | + ((DWORD)CurrTimeDate.Day << 16) | + ((DWORD)CurrTimeDate.Hour << 11) | + ((DWORD)CurrTimeDate.Minute << 5) | + (((DWORD)CurrTimeDate.Second >> 1) << 0); } -- cgit v1.2.3