USBLocalFileSystem.lib testing program for LPC11U35

Dependencies:   BaseDAP SWD USBDAP USBLocalFileSystem mbed DA14580 SWSPI W25X40BV

USB memory + Writer for DA14580 BLE chip + CMSIS-DAP debugger + USB-UART functions in one chip

One button input loads your application into DA14580 or DA14580 included BLE modules

Quote:

Current compatible hardware description can be found at https://github.com/K4zuki/da14580/releases/tag/MurataBLEr04

mystorage.h

Committer:
k4zuki
Date:
2017-08-19
Revision:
13:9a2f6902f4f1
Parent:
9:e279dee6e41c

File content as of revision 13:9a2f6902f4f1:

/** MyStorage: a StorageInterface class to interface SPI flash memory and USBLocalFilesystem
*/
#include "mbed.h"
#include "StorageInterface.h"
#include "W25X40BV.h"
/** MyStorage: a StorageInterface class to interface SPI flash memory and USBLocalFilesystem
It uses W25X40BV library also hints from Sissors/code/S25FL216K_USBFileSystem
- USBLocalFileSystem by va009039/USBLocalFileSystem
- W25X40BV by k4zuki/code/W25X40BV forked from jyam/code/W25X40BV
*/
class MyStorage : public StorageInterface {
public:
    MyStorage(PinName mosi, PinName miso, PinName sclk, PinName cs);

    /** read 512bytes from memory;
    @param data
    @param block numbered from 0
    */
    virtual int storage_read(uint8_t* data, uint32_t block);
    /** write 512bytes to memory;
    @param data
    @param block numbered from 0
    */
    virtual int storage_write(const uint8_t* data, uint32_t block);
    /** returns number of 512byte sectors in storage;
    */
    virtual uint32_t storage_sectors();
    /** returns size of storage in bytes;
    */
    virtual uint32_t storage_size();

private:
    W25X40BV _flash;
    uint64_t _sectors;
};