Abstract base class for MCP79410SRAM and MCP79410EEPROM.
More...
#include <MCP79410RK.h>
|
| 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...
|
|
Abstract base class for MCP79410SRAM and MCP79410EEPROM.
You cannot construct one of these, as it's abstract.
◆ 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
-
addr | Address in the memory block (0 = beginning of block; do not use hardware regiser address) |
t | The 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
-
addr | Address in the memory block (0 = beginning of block; do not use hardware regiser address) |
t | The 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
-
addr | Address in the memory block (0 = beginning of block; do not use hardware register address) |
data | Pointer to buffer to store data in |
dataLen | Number 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
-
addr | Address in the memory block (0 = beginning of block; do not use hardware register address) |
data | Pointer to buffer containing the data to write to memory. Buffer is not modified (is const). |
dataLen | Number of bytes to write |
Implemented in MCP79410EEPROM, and MCP79410SRAM.
The documentation for this class was generated from the following files: