Mbed Cloud Connect for Ethernet Platforms
Fork of example-Ethernet-mbed-Cloud-connect by
Diff: main.cpp
- Revision:
- 4:53eff875f5d0
- Parent:
- 3:b35ad81a2d6a
- Child:
- 6:2d0e0866f2e7
--- a/main.cpp Fri Feb 23 16:31:00 2018 +0100 +++ b/main.cpp Tue Feb 27 17:36:27 2018 +0000 @@ -22,20 +22,17 @@ #include "simple-mbed-cloud-client.h" #include "key-config-manager/kcm_status.h" #include "key-config-manager/key_config_manager.h" -#include "SDBlockDevice.h" -#include "FATFileSystem.h" +#include "HeapBlockDevice.h" +#include "BlockDevice.h" +#include "LittleFileSystem.h" #include "EthernetInterface.h" // Placeholder to hardware that trigger events (timer, button, etc) Ticker timer; // Placeholder for storage -#if (defined(TARGET_NUCLEO_F429ZI) || defined(TARGET_NUCLEO_F767ZI) || defined(TARGET_NUCLEO_F746ZG)) -SDBlockDevice sd(PC_12, PC_11, PC_10, PA_15); // MOSI, MISO, SCLK, CS -#else // normal arduino SPI connection -SDBlockDevice sd(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS); // MOSI, MISO, SCLK, CS -#endif -FATFileSystem fs("sd"); +HeapBlockDevice bd(1024*28, 128); // 28 KBytes - Block size: 128 bytes +LittleFileSystem fs("sd"); // Pointers to the resources that will be created in main_application(). static MbedCloudClientResource* pattern_ptr; @@ -83,20 +80,20 @@ printf("Start Simple Mbed Cloud Client\n"); - // Initialize SD card - int status = sd.init(); + // Initialize Block Device + int status = bd.init(); if (status != BD_ERROR_OK) { - printf("Failed to init SD card\r\n"); + printf("Failed to init Block Device\r\n"); return -1; } // Mount the file system (reformatting on failure) - status = fs.mount(&sd); + status = fs.mount(&bd); if (status) { - printf("Failed to mount FAT file system, reformatting...\r\n"); - status = fs.reformat(&sd); + printf("Failed to mount filesystem, reformatting...\r\n"); + status = fs.reformat(&bd); if (status) { - printf("Failed to reformat FAT file system\r\n"); + printf("Failed to reformat filesystem\r\n"); return -1; } else { printf("Reformat and mount complete\r\n");