Merge pull request #5292 from kegilbert/HeapBlockDevice-ex-update

Update HeapBlockDevice example
pull/4955/head
Jimmy Brisson 2017-10-13 09:28:39 -05:00 committed by GitHub
commit 20d93bf78d
1 changed files with 7 additions and 4 deletions

View File

@ -34,13 +34,16 @@
* #include "mbed.h"
* #include "HeapBlockDevice.h"
*
* HeapBlockDevice bd(2048, 512); // 2048 bytes with a block size of 512 bytes
* uint8_t block[512] = "Hello World!\n";
* #define BLOCK_SIZE 512
*
* HeapBlockDevice bd(2048, BLOCK_SIZE); // 2048 bytes with a block size of 512 bytes
* uint8_t block[BLOCK_SIZE] = "Hello World!\n";
*
* int main() {
* bd.init();
* bd.program(block, 0);
* bd.read(block, 0);
* bd.erase(0, BLOCK_SIZE);
* bd.program(block, 0, BLOCK_SIZE);
* bd.read(block, 0, BLOCK_SIZE);
* printf("%s", block);
* bd.deinit();
* }