MCP79410RK
Public Member Functions | Protected Attributes
MCP79410MemoryBase Class Referenceabstract

Abstract base class for MCP79410SRAM and MCP79410EEPROM. More...

#include <MCP79410RK.h>

Inheritance diagram for MCP79410MemoryBase:
MCP79410EEPROM MCP79410SRAM

Public Member Functions

 MCP79410MemoryBase (MCP79410 *parent)
 Constructor.
 
virtual ~MCP79410MemoryBase ()
 Destructor.
 
virtual size_t length () const =0
 Return the length of the memory in bytes (abstract)
 
virtual uint8_t eraseValue () const =0
 Value to erase to (abstract)
 
virtual bool erase ()
 Erase the memory. More...
 
template<typename T >
T & get (size_t addr, T &t)
 Templated accessor to get data from a specific offset. This API works like the EEPROM API. More...
 
template<typename T >
const T & put (size_t addr, const T &t)
 Templated accessor to set data at a specific offset. This API works like the EEPROM API. More...
 
virtual bool readData (size_t addr, uint8_t *data, size_t dataLen)=0
 Low-level API to read data from memory. More...
 
virtual bool writeData (size_t addr, const uint8_t *data, size_t dataLen)=0
 Low-level API to write data to memory. More...
 

Protected Attributes

MCP79410parent
 The MCP79410 object that this object is associated with.
 

Detailed Description

Abstract base class for MCP79410SRAM and MCP79410EEPROM.

You cannot construct one of these, as it's abstract.

Member Function Documentation

◆ erase()

bool MCP79410MemoryBase::erase ( )
virtual

Erase the memory.

The MCP79410 doesn't have an erase primitive so this just writes the eraseValue() to each byte but you could imagine with flash, this would be different.

◆ get()

template<typename T >
T& MCP79410MemoryBase::get ( size_t  addr,
T &  t 
)
inline

Templated accessor to get data from a specific offset. This API works like the EEPROM API.

Parameters
addrAddress in the memory block (0 = beginning of block; do not use hardware regiser address)
tThe object to read data into

◆ put()

template<typename T >
const T& MCP79410MemoryBase::put ( size_t  addr,
const T &  t 
)
inline

Templated accessor to set data at a specific offset. This API works like the EEPROM API.

Parameters
addrAddress in the memory block (0 = beginning of block; do not use hardware regiser address)
tThe object to write data from

◆ readData()

virtual bool MCP79410MemoryBase::readData ( size_t  addr,
uint8_t *  data,
size_t  dataLen 
)
pure virtual

Low-level API to read data from memory.

Parameters
addrAddress in the memory block (0 = beginning of block; do not use hardware register address)
dataPointer to buffer to store data in
dataLenNumber of bytes to read

Implemented in MCP79410EEPROM, and MCP79410SRAM.

◆ writeData()

virtual bool MCP79410MemoryBase::writeData ( size_t  addr,
const uint8_t *  data,
size_t  dataLen 
)
pure virtual

Low-level API to write data to memory.

Parameters
addrAddress in the memory block (0 = beginning of block; do not use hardware register address)
dataPointer to buffer containing the data to write to memory. Buffer is not modified (is const).
dataLenNumber of bytes to write

Implemented in MCP79410EEPROM, and MCP79410SRAM.


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