From 1d7fb82f0aec11331635532583617d773888b991 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 15 Sep 2014 23:49:57 +0100 Subject: stmhal: Change 64-bit arithmetic to 32-bit for SD card block addressing. By measuring SD card addresses in blocks and not bytes, one can get away with using 32-bit numbers. This patch also uses proper atomic lock/unlock around SD card read/write, adds SD.info() function, and gives error code for failed read/writes. --- stmhal/diskio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stmhal/diskio.c') diff --git a/stmhal/diskio.c b/stmhal/diskio.c index 35b9eab99..44059b04d 100644 --- a/stmhal/diskio.c +++ b/stmhal/diskio.c @@ -127,7 +127,7 @@ DRESULT disk_read ( #if MICROPY_HW_HAS_SDCARD case PD_SDCARD: - if (!sdcard_read_blocks(buff, sector, count)) { + if (sdcard_read_blocks(buff, sector, count) != 0) { return RES_ERROR; } return RES_OK; @@ -160,7 +160,7 @@ DRESULT disk_write ( #if MICROPY_HW_HAS_SDCARD case PD_SDCARD: - if (!sdcard_write_blocks(buff, sector, count)) { + if (sdcard_write_blocks(buff, sector, count) != 0) { return RES_ERROR; } return RES_OK; -- cgit v1.2.3