diff options
| author | Damien George <damien.p.george@gmail.com> | 2014-09-15 23:49:57 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-09-15 23:49:57 +0100 |
| commit | 1d7fb82f0aec11331635532583617d773888b991 (patch) | |
| tree | d1d408fafaa10826967abc1d872a5fc26c7299e1 /stmhal/sdcard.h | |
| parent | 6ff42c54bb2c6e950206c380a100db776e3938d8 (diff) | |
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.
Diffstat (limited to 'stmhal/sdcard.h')
| -rw-r--r-- | stmhal/sdcard.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/stmhal/sdcard.h b/stmhal/sdcard.h index 3a5353467..8197768de 100644 --- a/stmhal/sdcard.h +++ b/stmhal/sdcard.h @@ -32,7 +32,9 @@ bool sdcard_is_present(void); bool sdcard_power_on(void); void sdcard_power_off(void); uint64_t sdcard_get_capacity_in_bytes(void); -bool sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks); -bool sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks); + +// these return 0 on success, non-zero on error +mp_uint_t sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks); +mp_uint_t sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks); extern const struct _mp_obj_base_t pyb_sdcard_obj; |
