Using SPI flash with STM32F407VET6 board.
Dependencies: SpiFlash25 flash-fs mbed
Fork of Dragonfly_Filesystem_Example by
Using the on-board Winbond W25Q16 16Mbit SPI Flash memory chip with STM32F407VET6 black boards
Diff: main.cpp
- Revision:
- 5:c0f6a3babedf
- Parent:
- 0:a802928f26b6
- Child:
- 6:11c09ef31db4
--- a/main.cpp Tue Sep 29 19:37:23 2015 +0000 +++ b/main.cpp Wed Sep 30 16:26:28 2015 +0000 @@ -1,3 +1,8 @@ +/** Dragonfly Filesystem Example + * Opens file in filesystem, prints contents of the file, and writes to the file. + * + * NOTE: This example changes the baud rate of the debug port to 115200 baud! + */ #include "mbed.h" #include "SpiFlash25.h" #include "spiffs.h" @@ -19,7 +24,7 @@ static spiffs fs; static spiffs_config cfg; -// glue code between SPI driver and filesystem +// glue code between SPI driver and filesystem driver int spi_read(unsigned int addr, unsigned int size, unsigned char* data) { if (flash.read(addr, size, (char*)data)) return SPIFFS_OK; @@ -57,7 +62,7 @@ Serial pc(USBTX, USBRX); pc.baud(115200); - printf("dragonfly spi flash example started\r\n"); + printf("Dragonfly spi flash example started\r\n"); // erase entire flash // THIS WILL ERASE THE ENTIRE FLASH! EVERYTHING ON IT WILL BE LOST AND CANNOT BE RECOVERED! @@ -80,7 +85,7 @@ if (ret < 0) printf("SPIFFS_write failed %d\r\n", SPIFFS_errno(&fs)); else - printf("wrote %d bytes\r\n", ret); + printf("Wrote %d bytes\r\n", ret); SPIFFS_close(&fs, handle); } @@ -91,7 +96,7 @@ if (ret) printf("SPIFFS_stat failed %d\r\n", SPIFFS_errno(&fs)); else - printf("file size: %d bytes\r\n", stat.size); + printf("File size: %d bytes\r\n", stat.size); handle = SPIFFS_open(&fs, file, SPIFFS_RDWR, 0); if (handle < 0) @@ -104,11 +109,11 @@ printf("SPIFFS_read failed %d\r\n", SPIFFS_errno(&fs)); continue; } - printf("read %d bytes\r\n", ret); + printf("Read %d bytes\r\n", ret); sdata.append(data, ret); } - printf("data [\r\n"); + printf("Data [\r\n"); for (int i = 0; i < sdata.size(); i++) printf("%c", sdata[i]); printf("\r\n]\r\n"); @@ -116,7 +121,7 @@ SPIFFS_close(&fs, handle); } - printf("dragonfly spi flash example finished\r\n\r\n"); + printf("Dragonfly spi flash example finished\r\n\r\n"); return 0; } \ No newline at end of file