SpiFlash.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * SpiFlash.h
8  *
9  ****/
10 #pragma once
11 
12 #include "Device.h"
13 
14 namespace Storage
15 {
22 extern SpiFlash* spiFlash;
23 
27 class SpiFlash : public Device
28 {
29 public:
30  String getName() const override;
31  size_t getBlockSize() const override;
32  storage_size_t getSize() const override;
33 
34  Type getType() const override
35  {
36  return Type::flash;
37  }
38 
39  uint32_t getId() const override;
40 
41  bool read(storage_size_t address, void* dst, size_t size) override;
42  bool write(storage_size_t address, const void* src, size_t size) override;
43  bool erase_range(storage_size_t address, storage_size_t size) override;
44 };
45 
46 } // namespace Storage
uint32_t storage_size_t
Definition: Components/Storage/src/include/Storage/Types.h:19
Represents a storage device (e.g. flash memory)
Definition: Components/Storage/src/include/Storage/Device.h:34
Type
Storage type.
Definition: Components/Storage/src/include/Storage/Device.h:42
Main flash storage device.
Definition: SpiFlash.h:28
bool write(storage_size_t address, const void *src, size_t size) override
Write data to the storage device.
storage_size_t getSize() const override
Obtain addressable size of this device.
String getName() const override
Obtain unique device name.
uint32_t getId() const override
Obtain device ID.
Type getType() const override
Obtain device type.
Definition: SpiFlash.h:34
bool erase_range(storage_size_t address, storage_size_t size) override
Erase a region of storage in preparation for writing.
bool read(storage_size_t address, void *dst, size_t size) override
Read data from the storage device.
size_t getBlockSize() const override
Obtain smallest allocation unit for erase operations.
The String class.
Definition: WString.h:133
Definition: FileDevice.h:26
SpiFlash * spiFlash
The main SPI flash device. Where possible, access via partition API. If lower-level access is require...