Example of Mbed filesystem using HeapBlockDevice
Dependents: TemperatureButtonFile AccelleratorRead
Diff: main.cpp
- Revision:
- 26:130bb1173866
- Parent:
- 25:65a9183a2178
diff -r 65a9183a2178 -r 130bb1173866 main.cpp --- a/main.cpp Wed Sep 26 15:01:07 2018 +0100 +++ b/main.cpp Fri Nov 23 09:15:36 2018 +0000 @@ -1,18 +1,4 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + #include "mbed.h" #include <stdio.h> #include <errno.h> @@ -36,18 +22,19 @@ #include "LittleFileSystem.h" #include "FATFileSystem.h" - // Physical block device, can be any device that supports the BlockDevice API -SPIFBlockDevice bd( +/*SPIFBlockDevice bd( MBED_CONF_SPIF_DRIVER_SPI_MOSI, MBED_CONF_SPIF_DRIVER_SPI_MISO, MBED_CONF_SPIF_DRIVER_SPI_CLK, - MBED_CONF_SPIF_DRIVER_SPI_CS); + MBED_CONF_SPIF_DRIVER_SPI_CS);*/ + +#define BLOCK_SIZE 512 +HeapBlockDevice bd(2048, BLOCK_SIZE); // File system declaration LittleFileSystem fs("fs"); - // Set up the button to trigger an erase InterruptIn irq(BUTTON1); void erase() {