Skip to content

Move the FlashIAPBlockDevice example to an external repo #913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 3 additions & 33 deletions docs/api/storage/FlashIAPBlockDevice.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,9 @@ To configure this class, please see our [BlockDevice configuration documentation

[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/development/mbed-os-api-doxy/class_flash_i_a_p_block_device.html)

### FlashIAPBlockDevicesBlockDevice example:

``` cpp TODO
#include "mbed.h"
#include "FlashIAPBlockDevice.h"

// Create flash block device.
FlashIAPBlockDevice bd;

int main() {
printf("FlashIAPBlockDevice test\n");

// Initialize the FLASHIAP device and print the memory layout
bd.init();
printf("Flash block device size: %llu\n", bd.size());
printf("Flash block device read size: %llu\n", bd.get_read_size());
printf("Flash block device program size: %llu\n", bd.get_program_size());
printf("Flash block device erase size: %llu\n", bd.get_erase_size());

// Write "Hello World!" to the first block
char *buffer = (char*)malloc(bd.get_erase_size());
sprintf(buffer, "Hello World!\n");
bd.erase(0, bd.get_erase_size());
bd.program(buffer, 0, bd.get_erase_size());

// Read back what was stored
bd.read(buffer, 0, bd.get_erase_size());
printf("%s", buffer);

// Deinitialize the device
bd.deinit();
}
```
### FlashIAPBlockDevice example

[![View code](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/blockdevices/FlashIAPBlockDevice/)](https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/blockdevices/FlashIAPBlockDevice/main.cpp)

### Related content

Expand Down