Skip to content

Commit 86fa677

Browse files
authored
Add erase to example
Use defined blocksize constant
1 parent 37b3b40 commit 86fa677

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

features/filesystem/bd/HeapBlockDevice.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@
3434
* #include "mbed.h"
3535
* #include "HeapBlockDevice.h"
3636
*
37-
* HeapBlockDevice bd(2048, 512); // 2048 bytes with a block size of 512 bytes
38-
* uint8_t block[512] = "Hello World!\n";
37+
* #define BLOCK_SIZE 512
38+
*
39+
* HeapBlockDevice bd(2048, BLOCK_SIZE); // 2048 bytes with a block size of 512 bytes
40+
* uint8_t block[BLOCK_SIZE] = "Hello World!\n";
3941
*
4042
* int main() {
4143
* bd.init();
42-
* bd.program(block, 0, bd.get_program_size());
43-
* bd.read(block, 0, bd.get_read_size());
44+
* bd.erase(0, BLOCK_SIZE);
45+
* bd.program(block, 0, BLOCK_SIZE);
46+
* bd.read(block, 0, BLOCK_SIZE);
4447
* printf("%s", block);
4548
* bd.deinit();
4649
* }

0 commit comments

Comments
 (0)