MCP79410RK
|
Class for accessing the MCP79410 SRAM (static RAM) More...
#include <MCP79410RK.h>
Public Member Functions | |
MCP79410SRAM (MCP79410 *parent) | |
Class to read and write the 64-byte SRAM (battery backed RAM) block in the MCP79410. More... | |
virtual | ~MCP79410SRAM () |
Destructor. Not normally used as MCP79410 constructs this object and the MCP79410 is typically a global object. | |
virtual size_t | length () const |
Returns the length (64) | |
virtual uint8_t | eraseValue () const |
Erase erases to 0. More... | |
virtual bool | readData (size_t addr, uint8_t *data, size_t dataLen) |
Low-level API to read data from memory. More... | |
virtual bool | writeData (size_t addr, const uint8_t *data, size_t dataLen) |
Low-level API to write data to memory. More... | |
Public Member Functions inherited from MCP79410MemoryBase | |
MCP79410MemoryBase (MCP79410 *parent) | |
Constructor. | |
virtual | ~MCP79410MemoryBase () |
Destructor. | |
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... | |
Additional Inherited Members | |
Protected Attributes inherited from MCP79410MemoryBase | |
MCP79410 * | parent |
The MCP79410 object that this object is associated with. | |
Class for accessing the MCP79410 SRAM (static RAM)
The SRAM is fast to access and does not wear out. It's saved as long as there's power or the backup battery, so it's not as non-volatile as the EEPROM, but a good place to store up to 64 bytes of data.
You do not instantiate one of these, use the rtc.sram() method to get a reference to this object.
While you can use readData() and writeData(), you can also use the get() and put() methods like the EEPROM API to read and write primitives (int, bool, etc.) as well as structures. Note that you cannot get and put a String or char *, however, you can only store an array of characters.
MCP79410SRAM::MCP79410SRAM | ( | MCP79410 * | parent | ) |
|
inlinevirtual |
Erase erases to 0.
Note that on cold power up, the values are random, not zero!
Implements MCP79410MemoryBase.
|
virtual |
Low-level API to read data from memory.
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 |
Implements MCP79410MemoryBase.
|
virtual |
Low-level API to write data to memory.
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 |
Implements MCP79410MemoryBase.