semf
semf::app::Flash Class Referenceabstract

Interface for flash storage. More...

#include <flash.h>

Inheritance diagram for semf::app::Flash:
Inheritance graph
Collaboration diagram for semf::app::Flash:
Collaboration graph

Public Member Functions

virtual ~Flash ()=default
 
virtual void erase (size_t sector, size_t numOfSectors=1)=0
 Erase sector(s). More...
 
virtual size_t sector (uint32_t address) const =0
 Return in which sector an address is located. More...
 
virtual uint32_t address (size_t sector) const =0
 Return on which address a sector starts. More...
 
virtual size_t sectorSize (size_t sector) const =0
 Return the size of a sector in bytes. More...
 
virtual size_t numberOfSectors () const =0
 Return the number/amount of sectors of a flash memory. More...
 
- Public Member Functions inherited from semf::app::Storage
virtual ~Storage ()=default
 
virtual void write (uint32_t address, const uint8_t data[], size_t dataSize)=0
 Writes data into the storage. More...
 
virtual void read (uint32_t address, uint8_t buffer[], size_t bufferSize)=0
 Reads data from the storage into a given read buffer. More...
 
virtual bool isBusy () const =0
 Returns if the storage is busy reading, writing or e.g. erasing. More...
 

Public Attributes

Signal erased
 
- Public Attributes inherited from semf::app::Storage
Signal dataAvailable
 
Signal dataWritten
 
Signal< Errorerror
 

Detailed Description

Interface for flash storage.

Definition at line 23 of file flash.h.

Constructor & Destructor Documentation

◆ ~Flash()

virtual semf::app::Flash::~Flash ( )
virtualdefault

Member Function Documentation

◆ address()

virtual uint32_t semf::app::Flash::address ( size_t  sector) const
pure virtual

Return on which address a sector starts.

Parameters
sectorSector index in a flash memory.
Returns
The address, where a sector starts.
Here is the caller graph for this function:

◆ erase()

virtual void semf::app::Flash::erase ( size_t  sector,
size_t  numOfSectors = 1 
)
pure virtual

Erase sector(s).

Parameters
sectorThe numerical order of the targeted sector.
numOfSectorsAmount of sectors to be erased.

Implemented in semf::Stm32Flash.

◆ numberOfSectors()

virtual size_t semf::app::Flash::numberOfSectors ( ) const
pure virtual

Return the number/amount of sectors of a flash memory.

Returns
Number of sectors.
Here is the caller graph for this function:

◆ sector()

virtual size_t semf::app::Flash::sector ( uint32_t  address) const
pure virtual

Return in which sector an address is located.

Attention
Return 0, if the address is out of available address range.
Parameters
addressAddress in a Flash memory.
Returns
Sector number.
Here is the caller graph for this function:

◆ sectorSize()

virtual size_t semf::app::Flash::sectorSize ( size_t  sector) const
pure virtual

Return the size of a sector in bytes.

Parameters
sectorSector index in a flash memory.
Returns
Size of a sector in bytes.

Member Data Documentation

◆ erased

Signal semf::app::Flash::erased

The signal is triggered after the pages have been erased completely.

Definition at line 58 of file flash.h.