MySensors Library & Examples  2.3.2
Public Member Functions | List of all members
SoftEeprom Class Reference

Detailed Description

This a software emulation of EEPROM that uses a file for data storage. A copy of the eeprom values are also held in memory for faster reading. SoftEeprom class

Definition at line 33 of file SoftEeprom.h.

#include <SoftEeprom.h>

+ Collaboration diagram for SoftEeprom:

Public Member Functions

 SoftEeprom ()
 SoftEeprom constructor.
 
 SoftEeprom (const SoftEeprom &other)
 SoftEeprom copy constructor.
 
 ~SoftEeprom ()
 SoftEeprom destructor.
 
int init (const char *fileName, size_t length)
 Initializes the eeprom class. More...
 
void destroy ()
 Clear all allocated memory variables. More...
 
void readBlock (void *buf, void *addr, size_t length)
 Read a block of bytes from eeprom. More...
 
void writeBlock (void *buf, void *addr, size_t length)
 Write a block of bytes to eeprom. More...
 
uint8_t readByte (int addr)
 Read a byte from eeprom. More...
 
void writeByte (int addr, uint8_t value)
 Write a byte to eeprom. More...
 
SoftEepromoperator= (const SoftEeprom &other)
 Overloaded assign operator. More...
 

Member Function Documentation

◆ destroy()

void SoftEeprom::destroy ( )

Clear all allocated memory variables.

◆ init()

int SoftEeprom::init ( const char *  fileName,
size_t  length 
)

Initializes the eeprom class.

Parameters
fileNamefilepath where the data is saved.
lengtheeprom size in bytes.
Returns
0 if SUCCESS or -1 if FAILURE.

◆ operator=()

SoftEeprom& SoftEeprom::operator= ( const SoftEeprom other)

Overloaded assign operator.

◆ readBlock()

void SoftEeprom::readBlock ( void *  buf,
void *  addr,
size_t  length 
)

Read a block of bytes from eeprom.

Parameters
bufbuffer to copy to.
addreeprom address to read from.
lengthnumber of bytes to read.

◆ readByte()

uint8_t SoftEeprom::readByte ( int  addr)

Read a byte from eeprom.

Parameters
addreeprom address to read from.
Returns
the read byte.

◆ writeBlock()

void SoftEeprom::writeBlock ( void *  buf,
void *  addr,
size_t  length 
)

Write a block of bytes to eeprom.

Parameters
bufbuffer to read from.
addreeprom address to write to.
lengthnumber of bytes to write.

◆ writeByte()

void SoftEeprom::writeByte ( int  addr,
uint8_t  value 
)

Write a byte to eeprom.

Parameters
addreeprom address to write to.
valueto write.

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