Example for HeapBlockDevice use

Committer:
kgilbert
Date:
Tue Oct 10 21:14:20 2017 +0000
Revision:
2:e29db7517d42
Parent:
1:fbc7acd77a77
Child:
3:5991e7053465
Fix mbed.lib link and update program and read function parameters to take in size

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kgilbert 0:acdc1ce79ab5 1 #include "mbed.h"
kgilbert 1:fbc7acd77a77 2 #include "HeapBlockDevice.h"
kgilbert 1:fbc7acd77a77 3
kgilbert 1:fbc7acd77a77 4 HeapBlockDevice bd(2048, 512); // 2048 bytes with a block size of 512 bytes
kgilbert 1:fbc7acd77a77 5 uint8_t block[512] = "Hello World!\n";
kgilbert 1:fbc7acd77a77 6
kgilbert 1:fbc7acd77a77 7 int main() {
kgilbert 1:fbc7acd77a77 8 bd.init();
kgilbert 2:e29db7517d42 9 bd.program(block, 0, bd.get_program_size());
kgilbert 2:e29db7517d42 10 bd.read(block, 0, bd.get_read_size());
kgilbert 1:fbc7acd77a77 11 printf("%s", block);
kgilbert 1:fbc7acd77a77 12 bd.deinit();
kgilbert 1:fbc7acd77a77 13 }