Storage Namespace Reference

Namespaces

 Debug
 
 Disk
 
 SD
 

Classes

class  FileDevice
 Create custom storage device using backing file. More...
 
class  Device
 Represents a storage device (e.g. flash memory) More...
 
class  Iterator
 
class  Partition
 Represents a flash partition. More...
 
struct  esp_partition_info_t
 Internal structure describing the binary layout of a partition table entry. More...
 
class  PartitionStream
 Stream operating directory on a Storage partition. More...
 
class  PartitionTable
 
class  ProgMem
 Storage device to access PROGMEM using flash API. More...
 
class  SpiFlash
 Main flash storage device. More...
 
class  StreamDevice
 Read-only partition on a stream object. More...
 
class  SysMem
 Storage device to access system memory, e.g. RAM. More...
 

Enumerations

enum class  Mode { ReadOnly , Write , BlockErase }
 

Functions

bool isSize64 (uint64_t value)
 Determine if a value requires 64-bits to store. More...
 
bool isSize64 (int64_t value)
 Determine if a value requires 64-bits to store. More...
 
template<typename T >
constexpr bool isLog2 (T value)
 Determine if a value is an exact power of 2. More...
 
void initialize ()
 Called early in the startup phase. More...
 
const Device::List getDevices ()
 Get read-only reference to device list. More...
 
bool registerDevice (Device *device)
 Register a storage device. More...
 
bool unRegisterDevice (Device *device)
 Unregister a storage device. More...
 
DevicefindDevice (const String &name)
 Find a registered device. More...
 
Partition findPartition (const String &name)
 Find the first partition matching the given name. More...
 
Iterator findPartition (Partition::Type type=Partition::Type::any, uint8_t subType=Partition::SubType::any)
 Find partitions of the given type. More...
 
template<typename T >
std::enable_if< std::is_enum< T >::value, Iterator >::type findPartition (T subType)
 
template<typename T >
Storage::Partition findDefaultPartition (T subType)
 
Get power of 2 for given value
Parameters
valueMust be an exact power of 2
Return values
uint8_tResult n such that value == 1 << n
See also
Use isLog2() to confirm value is power of 2
template<typename T >
constexpr std::enable_if<(sizeof(T)<=4), uint8_t >::type getSizeBits (T value)
 
template<typename T >
constexpr std::enable_if<(sizeof(T) > 4), uint8_t >::type getSizeBits (T value)
 

Variables

constexpr uint16_t ESP_PARTITION_MAGIC {0x50AA}
 Identifies a valid partition. More...
 
constexpr uint16_t ESP_PARTITION_MAGIC_MD5 {0xEBEB}
 Identifies an MD5 hash block. More...
 
constexpr size_t ESP_PARTITION_TABLE_MAX_LEN {0xC00}
 
ProgMem progMem
 
SpiFlashspiFlash
 
SysMem sysMem
 

Enumeration Type Documentation

◆ Mode

enum Storage::Mode
strong
Enumerator
ReadOnly 
Write 

Write but do not erase, region should be pre-erased.

BlockErase 

Erase blocks as required before writing.

Function Documentation

◆ findDefaultPartition()

template<typename T >
Storage::Partition Storage::findDefaultPartition ( subType)

◆ findDevice()

Device* Storage::findDevice ( const String name)

Find a registered device.

◆ findPartition() [1/3]

Partition Storage::findPartition ( const String name)

Find the first partition matching the given name.

◆ findPartition() [2/3]

Iterator Storage::findPartition ( Partition::Type  type = Partition::Type::any,
uint8_t  subType = Partition::SubType::any 
)
inline

Find partitions of the given type.

◆ findPartition() [3/3]

template<typename T >
std::enable_if<std::is_enum<T>::value, Iterator>::type Storage::findPartition ( subType)

◆ getDevices()

const Device::List Storage::getDevices ( )

Get read-only reference to device list.

◆ getSizeBits() [1/2]

template<typename T >
constexpr std::enable_if<(sizeof(T) <= 4), uint8_t>::type Storage::getSizeBits ( value)
constexpr

◆ getSizeBits() [2/2]

template<typename T >
constexpr std::enable_if<(sizeof(T) > 4), uint8_t>::type Storage::getSizeBits ( value)
constexpr

◆ initialize()

void Storage::initialize ( )

Called early in the startup phase.

◆ isLog2()

template<typename T >
constexpr bool Storage::isLog2 ( value)
constexpr

Determine if a value is an exact power of 2.

◆ isSize64() [1/2]

bool Storage::isSize64 ( int64_t  value)
inline

Determine if a value requires 64-bits to store.

◆ isSize64() [2/2]

bool Storage::isSize64 ( uint64_t  value)
inline

Determine if a value requires 64-bits to store.

◆ registerDevice()

bool Storage::registerDevice ( Device device)

Register a storage device.

Return values
booltrue on success, false if another device already registered with same name

◆ unRegisterDevice()

bool Storage::unRegisterDevice ( Device device)

Unregister a storage device.

Use extreme care: behaviour is unpredictable if partitions are in use

Variable Documentation

◆ ESP_PARTITION_MAGIC

constexpr uint16_t Storage::ESP_PARTITION_MAGIC {0x50AA}
constexpr

Identifies a valid partition.

◆ ESP_PARTITION_MAGIC_MD5

constexpr uint16_t Storage::ESP_PARTITION_MAGIC_MD5 {0xEBEB}
constexpr

Identifies an MD5 hash block.

◆ ESP_PARTITION_TABLE_MAX_LEN

constexpr size_t Storage::ESP_PARTITION_TABLE_MAX_LEN {0xC00}
constexpr

◆ progMem

ProgMem Storage::progMem
extern

◆ spiFlash

SpiFlash* Storage::spiFlash
extern

◆ sysMem

SysMem Storage::sysMem
extern