Skip to content

Commit 8dbb73a

Browse files
author
Amanda Butler
authored
Merge pull request #908 from juhaylinen/spifblock-example
Move the SPIFBlockDevice example to an external repo
2 parents 5daedad + aa8030e commit 8dbb73a

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

docs/api/storage/SPIFBlockDevice.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,7 @@ To configure this class, please see our [BlockDevice configuration documentation
1414

1515
### SPIFBlockDevice example
1616

17-
``` cpp TODO
18-
// Here's an example using the MX25R SPI flash device on the K82F
19-
#include "mbed.h"
20-
#include "SPIFBlockDevice.h"
21-
22-
// Create flash device on SPI bus with PTE5 as chip select
23-
SPIFBlockDevice spif(PTE2, PTE4, PTE1, PTE5);
24-
25-
int main() {
26-
printf("spif test\n");
27-
28-
// Initialize the SPI flash device and print the memory layout
29-
spif.init();
30-
printf("spif size: %llu\n", spif.size());
31-
printf("spif read size: %llu\n", spif.get_read_size());
32-
printf("spif program size: %llu\n", spif.get_program_size());
33-
printf("spif erase size: %llu\n", spif.get_erase_size());
34-
35-
// Write "Hello World!" to the first block
36-
char *buffer = (char*)malloc(spif.get_erase_size());
37-
sprintf(buffer, "Hello World!\n");
38-
spif.erase(0, spif.get_erase_size());
39-
spif.program(buffer, 0, spif.get_erase_size());
40-
41-
// Read back what was stored
42-
spif.read(buffer, 0, spif.get_erase_size());
43-
printf("%s", buffer);
44-
45-
// Deinitialize the device
46-
spif.deinit();
47-
}
48-
```
17+
[![View code](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-examples-docs_only/SPIFBlockDevice)](https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/SPIFBlockDevice/main.cpp)
4918

5019
### Related content
5120

0 commit comments

Comments
 (0)