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 {
16 extern SpiFlash* spiFlash;
17 
21 class SpiFlash : public Device
22 {
23 public:
24  String getName() const override;
25  size_t getBlockSize() const override;
26  size_t getSize() const override;
27 
28  Type getType() const override
29  {
30  return Type::flash;
31  }
32 
33  uint32_t getId() const override;
34 
35  bool read(uint32_t address, void* dst, size_t size) override;
36  bool write(uint32_t address, const void* src, size_t size) override;
37  bool erase_range(uint32_t address, size_t size) override;
38 };
39 
40 } // namespace Storage
String getName() const override
Obtain unique device name.
bool write(uint32_t address, const void *src, size_t size) override
Write data to the storage device.
The String class.
Definition: WString.h:136
Type
Storage type.
Definition: Components/Storage/src/include/Storage/Device.h:41
size_t getSize() const override
Obtain addressable size of this device.
Main flash storage device.
Definition: SpiFlash.h:21
uint32_t getId() const override
Obtain device ID.
SpiFlash * spiFlash
Represents a storage device (e.g. flash memory)
Definition: Components/Storage/src/include/Storage/Device.h:32
Type getType() const override
Obtain device type.
Definition: SpiFlash.h:28
size_t getBlockSize() const override
Obtain smallest allocation unit for erase operations.
bool read(uint32_t address, void *dst, size_t size) override
Read data from the storage device.
Definition: FileDevice.h:23
bool erase_range(uint32_t address, size_t size) override
Erase a region of storage in preparation for writing.