diff options
| author | Damien George | 2016-02-10 16:21:38 +0000 |
|---|---|---|
| committer | Damien George | 2016-02-10 23:40:10 +0000 |
| commit | 3770cd2e7062d0844cee7b69ec9d9f80a2ad1206 (patch) | |
| tree | ceb2161c79c2c09552e4eeaf2b36db07c2b292a5 /stmhal/storage.h | |
| parent | f7e5e677df120122eeaac18b81d3fccfe0965180 (diff) | |
stmhal: Expose flash and SD card as proper objects with block protocol.
You can now create (singleton) objects representing the flash and SD
card, using:
flash = pyb.Flash()
sdcard = pyb.SDCard()
These objects provide the block protocol.
Diffstat (limited to 'stmhal/storage.h')
| -rw-r--r-- | stmhal/storage.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/stmhal/storage.h b/stmhal/storage.h index 4ff7abbe1..30aa48309 100644 --- a/stmhal/storage.h +++ b/stmhal/storage.h @@ -36,3 +36,9 @@ void storage_irq_handler(void); void storage_flush(void); bool storage_read_block(uint8_t *dest, uint32_t block); bool storage_write_block(const uint8_t *src, uint32_t block); + +// these return 0 on success, non-zero on error +mp_uint_t storage_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks); +mp_uint_t storage_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks); + +extern const struct _mp_obj_type_t pyb_flash_type; |
