From 09d207785c77c85c957471b064ceebe0d2ee0a23 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 30 Mar 2014 12:30:35 +0100 Subject: stmhal: Unify naming of HW config; make SD detect configurable. All board config macros now begin with MICROPY_HW_. Renamed PYBv10 to PYBV10, since macros should be all uppercase. Made SDCARD_DETECT configurable in mpconfigport.h, so that the SD detect pin can be easily configured. --- stmhal/diskio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'stmhal/diskio.c') diff --git a/stmhal/diskio.c b/stmhal/diskio.c index 4d6f998f55..0c67a23d68 100644 --- a/stmhal/diskio.c +++ b/stmhal/diskio.c @@ -41,12 +41,14 @@ DSTATUS disk_initialize ( storage_init(); return 0; +#if MICROPY_HW_HAS_SDCARD case PD_SDCARD: if (!sdcard_power_on()) { return STA_NODISK; } // TODO return STA_PROTECT if SD card is read only return 0; +#endif } return STA_NOINIT; @@ -65,9 +67,11 @@ DSTATUS disk_status ( // flash is ready return 0; +#if MICROPY_HW_HAS_SDCARD case PD_SDCARD: // TODO return STA_PROTECT if SD card is read only return 0; +#endif } return STA_NOINIT; @@ -93,11 +97,13 @@ DRESULT disk_read ( } return RES_OK; +#if MICROPY_HW_HAS_SDCARD case PD_SDCARD: if (!sdcard_read_blocks(buff, sector, count)) { return RES_ERROR; } return RES_OK; +#endif } return RES_PARERR; @@ -124,11 +130,13 @@ DRESULT disk_write ( } return RES_OK; +#if MICROPY_HW_HAS_SDCARD case PD_SDCARD: if (!sdcard_write_blocks(buff, sector, count)) { return RES_ERROR; } return RES_OK; +#endif } return RES_PARERR; @@ -160,6 +168,7 @@ DRESULT disk_ioctl ( } break; +#if MICROPY_HW_HAS_SDCARD case PD_SDCARD: switch (cmd) { case CTRL_SYNC: @@ -170,6 +179,7 @@ DRESULT disk_ioctl ( return RES_OK; } break; +#endif } return RES_PARERR; -- cgit v1.2.3