From dd995683ea1f233b79724d524a9a3dbcdc171d30 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 24 Jan 2010 11:13:23 +0000 Subject: Enhance TemperatureDatalogger project -- add RTC capabilities so that data is logged along with the current time and date. Make logging interval configurable, set by a C# PC host application. --- Projects/TemperatureDataLogger/Lib/FATFs/diskio.c | 14 +++++++++++++- Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'Projects/TemperatureDataLogger/Lib/FATFs') diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c b/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c index e6be68734..0c0083bac 100644 --- a/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c +++ b/Projects/TemperatureDataLogger/Lib/FATFs/diskio.c @@ -83,5 +83,17 @@ DRESULT disk_ioctl ( DWORD get_fattime (void) { - return (1UL << 25) | (1UL << 21) | (1UL << 16) | (1UL << 11) | (1UL << 5) | (1UL << 0); + uint8_t Day, Month, Year; + uint8_t Hour, Minute, Second; + + DS1307_GetDate(&Day, &Month, &Year); + DS1307_GetTime(&Hour, &Minute, &Second); + + + return ((DWORD)(20 + Year) << 25) | + ((DWORD)Month << 21) | + ((DWORD)Day << 16) | + ((DWORD)Hour << 11) | + ((DWORD)Minute << 5) | + (((DWORD)Second >> 1) << 0); } diff --git a/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h b/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h index 18510157d..9b414e979 100644 --- a/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h +++ b/Projects/TemperatureDataLogger/Lib/FATFs/ffconf.h @@ -36,7 +36,7 @@ / 3: f_lseek is removed in addition to level 2. */ -#define _USE_STRFUNC 1 /* 0, 1 or 2 */ +#define _USE_STRFUNC 0 /* 0, 1 or 2 */ /* To enable string functions, set _USE_STRFUNC to 1 or 2. */ -- cgit v1.2.3