Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BaseDAP SWD USBDAP USBLocalFileSystem mbed DA14580 SWSPI W25X40BV
mystorage.h
00001 /** MyStorage: a StorageInterface class to interface SPI flash memory and USBLocalFilesystem 00002 */ 00003 #include "mbed.h" 00004 #include "StorageInterface.h" 00005 #include "W25X40BV.h" 00006 /** MyStorage: a StorageInterface class to interface SPI flash memory and USBLocalFilesystem 00007 It uses W25X40BV library also hints from Sissors/code/S25FL216K_USBFileSystem 00008 - USBLocalFileSystem by va009039/USBLocalFileSystem 00009 - W25X40BV by k4zuki/code/W25X40BV forked from jyam/code/W25X40BV 00010 */ 00011 class MyStorage : public StorageInterface { 00012 public: 00013 MyStorage(PinName mosi, PinName miso, PinName sclk, PinName cs); 00014 00015 /** read 512bytes from memory; 00016 @param data 00017 @param block numbered from 0 00018 */ 00019 virtual int storage_read(uint8_t* data, uint32_t block); 00020 /** write 512bytes to memory; 00021 @param data 00022 @param block numbered from 0 00023 */ 00024 virtual int storage_write(const uint8_t* data, uint32_t block); 00025 /** returns number of 512byte sectors in storage; 00026 */ 00027 virtual uint32_t storage_sectors(); 00028 /** returns size of storage in bytes; 00029 */ 00030 virtual uint32_t storage_size(); 00031 00032 private: 00033 W25X40BV _flash; 00034 uint64_t _sectors; 00035 };
Generated on Mon Jul 25 2022 10:58:37 by
1.7.2