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.
This commit is contained in:
Markus Hitter 2015-06-10 13:54:29 +02:00
parent 846d575aee
commit 0a013d6e5e
4 changed files with 22 additions and 0 deletions

6
pff.c
View File

@ -37,9 +37,13 @@
- Moved integer.h content to the end of pff_conf.h, again, to avoid - Moved integer.h content to the end of pff_conf.h, again, to avoid
file name conflicts. file name conflicts.
- Changed former integer.h content to use fixed width types (int8_t, etc). - 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 */ #include "pff.h" /* Petit FatFs configurations and declarations */
#ifdef SD
#include "pff_diskio.h" /* Declarations of low level disk I/O functions */ #include "pff_diskio.h" /* Declarations of low level disk I/O functions */
@ -1118,3 +1122,5 @@ FRESULT pf_readdir (
} }
#endif /* _USE_DIR */ #endif /* _USE_DIR */
#endif /* SD */

6
pff.h
View File

@ -15,6 +15,10 @@
/----------------------------------------------------------------------------*/ /----------------------------------------------------------------------------*/
/* Changes for Teacup see pff.c. */ /* Changes for Teacup see pff.c. */
#include "sd.h"
#ifdef SD
#ifndef _PFATFS #ifndef _PFATFS
#define _PFATFS 4004 /* Revision ID */ #define _PFATFS 4004 /* Revision ID */
@ -157,3 +161,5 @@ FRESULT pf_readdir (DIR* dj, FILINFO* fno); /* Read a directory
#endif #endif
#endif /* _PFATFS */ #endif /* _PFATFS */
#endif /* SD */

View File

@ -5,6 +5,8 @@
#include "pff_diskio.h" #include "pff_diskio.h"
#ifdef SD
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Initialize Disk Drive */ /* Initialize Disk Drive */
@ -72,3 +74,5 @@ DRESULT disk_writep (
return res; return res;
} }
#endif /* SD */

View File

@ -3,6 +3,10 @@
/-----------------------------------------------------------------------*/ /-----------------------------------------------------------------------*/
/* Changes for Teacup see pff.c. */ /* Changes for Teacup see pff.c. */
#include "sd.h"
#ifdef SD
#ifndef _DISKIO_DEFINED #ifndef _DISKIO_DEFINED
#define _DISKIO_DEFINED #define _DISKIO_DEFINED
@ -41,3 +45,5 @@ DRESULT disk_writep (const BYTE* buff, DWORD sc);
#endif #endif
#endif /* _DISKIO_DEFINED */ #endif /* _DISKIO_DEFINED */
#endif /* SD */