From 3770cd2e7062d0844cee7b69ec9d9f80a2ad1206 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 10 Feb 2016 16:21:38 +0000 Subject: 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. --- stmhal/storage.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'stmhal/storage.h') 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; -- cgit v1.2.3