MySensors Library & Examples  2.3.2-62-ge298769
Public Member Functions | List of all members
VirtualPageClass Class Reference

Detailed Description

Virtual page management on top of Flash.

Definition at line 38 of file VirtualPage.h.

#include <VirtualPage.h>

+ Collaboration diagram for VirtualPageClass:

Public Member Functions

 VirtualPageClass ()
 
void begin ()
 
void end ()
 
uint16_t size () const
 
uint16_t length () const
 
uint16_t page_count () const
 
uint32_t wear_level ()
 
uint32_t * get (uint32_t magic)
 
uint32_t * allocate (uint32_t magic)
 
uint32_t * allocate (uint32_t magic, uint32_t max_writes)
 
void release_prepare (uint32_t *address)
 
void release (uint32_t *address)
 
bool release_started (uint32_t *address)
 
void fail (uint32_t *address)
 
void clean_up ()
 
void format ()
 

Constructor & Destructor Documentation

◆ VirtualPageClass()

VirtualPageClass::VirtualPageClass ( )
inline

Constructor

Definition at line 43 of file VirtualPage.h.

Member Function Documentation

◆ allocate() [1/2]

uint32_t* VirtualPageClass::allocate ( uint32_t  magic)

Returns an address to a blank page or (uint32_t *)~0 if no space available. Take care about RADIO, WDT and Interrupt timing! Calculate with 0-100ms until a page is available.

Parameters
[in]magicA magic number to identify the page.
Returns
Pointer to a page

◆ allocate() [2/2]

uint32_t* VirtualPageClass::allocate ( uint32_t  magic,
uint32_t  max_writes 
)

Returns an address to a blank page or (uint32_t *)~0 if no space available. Take care about RADIO, WDT and Interrupt timing! Calculate with 0-100ms until a page is available. This function allows using a page multiple times without erasing on some platforms.

Parameters
[in]magicA magic number to identify the page.
[in]max_writesThe number of planned write operations in page lifecycle.
Returns
Pointer to a page

◆ begin()

void VirtualPageClass::begin ( )
inline

Initialize Virtual Pages

Definition at line 46 of file VirtualPage.h.

◆ clean_up()

void VirtualPageClass::clean_up ( )

Prepare released pages for faster reallocation. Plan with 0-100ms.

◆ end()

void VirtualPageClass::end ( )
inline

Deinitilize Virtual Pages

Definition at line 49 of file VirtualPage.h.

◆ fail()

void VirtualPageClass::fail ( uint32_t *  address)

Mark a page as a defect page.

◆ format()

void VirtualPageClass::format ( )

Release all pages

◆ get()

uint32_t* VirtualPageClass::get ( uint32_t  magic)

Search for a page by given, unique magic number. Returns a pointer to (uint32_t *)~0 if there is no page. Don't write to this address.

Parameters
[in]magicA magic number to identify the page.
Returns
Pointer to a page

◆ length()

uint16_t VirtualPageClass::length ( ) const

Reports usable page size in 32 Bit words

Returns
Number of words

◆ page_count()

uint16_t VirtualPageClass::page_count ( ) const

Reports the maximum number of allocatable pages

Returns
Number of pages

◆ release()

void VirtualPageClass::release ( uint32_t *  address)

End releasing a page.

Parameters
[in]*addressA pointer to the page to release

◆ release_prepare()

void VirtualPageClass::release_prepare ( uint32_t *  address)

Start releasing a page. You have to allocate a new one and then release the old page.

Parameters
[in]*addressA pointer to the page to release

◆ release_started()

bool VirtualPageClass::release_started ( uint32_t *  address)

Returns true if page is in release_prepare state

Parameters
[in]*addressA pointer to a page
Returns
Release state

◆ size()

uint16_t VirtualPageClass::size ( ) const

Reports usable page size in bytes

Returns
Number of bytes

◆ wear_level()

uint32_t VirtualPageClass::wear_level ( )

Calculates the rate of wear in percent*100. Values greater than 10000 indicates exceeding the chip specification. This value is only valid for controllers, never erased completely.

Returns
calculated level

The documentation for this class was generated from the following file: