From 0a013d6e5e52bc1505b18b218da8d04600a913c0 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Wed, 10 Jun 2015 13:54:29 +0200 Subject: [PATCH] SD card: wrap Petit FatFs code in #ifdef SD. No need to compile this when not needed and also make sure it's nowhere used with SD card support disabled. --- pff.c | 6 ++++++ pff.h | 6 ++++++ pff_diskio.c | 4 ++++ pff_diskio.h | 6 ++++++ 4 files changed, 22 insertions(+) diff --git a/pff.c b/pff.c index c6794f0..52deffd 100644 --- a/pff.c +++ b/pff.c @@ -37,9 +37,13 @@ - Moved integer.h content to the end of pff_conf.h, again, to avoid file name conflicts. - Changed former integer.h content to use fixed width types (int8_t, etc). + - Wrapped code in #ifdef SD to compile it only when needed. */ #include "pff.h" /* Petit FatFs configurations and declarations */ + +#ifdef SD + #include "pff_diskio.h" /* Declarations of low level disk I/O functions */ @@ -1118,3 +1122,5 @@ FRESULT pf_readdir ( } #endif /* _USE_DIR */ + +#endif /* SD */ diff --git a/pff.h b/pff.h index 04158d2..9bb2ead 100644 --- a/pff.h +++ b/pff.h @@ -15,6 +15,10 @@ /----------------------------------------------------------------------------*/ /* Changes for Teacup see pff.c. */ +#include "sd.h" + +#ifdef SD + #ifndef _PFATFS #define _PFATFS 4004 /* Revision ID */ @@ -157,3 +161,5 @@ FRESULT pf_readdir (DIR* dj, FILINFO* fno); /* Read a directory #endif #endif /* _PFATFS */ + +#endif /* SD */ diff --git a/pff_diskio.c b/pff_diskio.c index 3dfe2ef..79e4214 100644 --- a/pff_diskio.c +++ b/pff_diskio.c @@ -5,6 +5,8 @@ #include "pff_diskio.h" +#ifdef SD + /*-----------------------------------------------------------------------*/ /* Initialize Disk Drive */ @@ -72,3 +74,5 @@ DRESULT disk_writep ( return res; } + +#endif /* SD */ diff --git a/pff_diskio.h b/pff_diskio.h index d6107cd..e471115 100644 --- a/pff_diskio.h +++ b/pff_diskio.h @@ -3,6 +3,10 @@ /-----------------------------------------------------------------------*/ /* Changes for Teacup see pff.c. */ +#include "sd.h" + +#ifdef SD + #ifndef _DISKIO_DEFINED #define _DISKIO_DEFINED @@ -41,3 +45,5 @@ DRESULT disk_writep (const BYTE* buff, DWORD sc); #endif #endif /* _DISKIO_DEFINED */ + +#endif /* SD */