This file contains implementations of the EepromAbstraction that are useful for dev & testing. None of the implementations in this file are designed for production use.
More...
#include <MockEepromAbstraction.h>
|
|
| MockEepromAbstraction (unsigned int size=128) |
| bool | hasErrorOccurred () override |
|
void | clearError () |
|
void | checkBounds (EepromPosition pos, int len) |
|
void | reset () |
| uint8_t | read8 (EepromPosition position) override |
| void | write8 (EepromPosition position, uint8_t val) override |
| uint16_t | read16 (EepromPosition position) override |
| void | write16 (EepromPosition position, uint16_t val) override |
| virtual uint32_t | read32 (EepromPosition position) override |
| virtual void | write32 (EepromPosition position, uint32_t val) override |
| virtual void | readIntoMemArray (uint8_t *memDest, EepromPosition romSrc, uint8_t len) override |
| virtual void | writeArrayToRom (EepromPosition romDest, const uint8_t *memSrc, uint8_t len) override |
|
void | serPrintContents (int start, int len) |
| void | writeCharArrToRom (EepromPosition romDest, const char *memSrc, uint8_t len) |
| void | readCharArrIntoMemArray (char *memDest, EepromPosition romSrc, uint8_t len) |
This file contains implementations of the EepromAbstraction that are useful for dev & testing. None of the implementations in this file are designed for production use.
@ file MockEepromAbstraction.h @ file MockEepromAbstraction.h
An in memory eeprom implementation that can be used in unit tests the verify the behaviour of your application without needing to write to an actual eeprom. It by default allocates 128 bytes for storage, but can be changed by adjusting the defined size in the header file
◆ hasErrorOccurred()
| bool MockEepromAbstraction::hasErrorOccurred |
( |
| ) |
|
|
inlineoverridevirtual |
Best efforts error flag that will clear once read.
Reimplemented from EepromAbstraction.
◆ read8()
Read an 8 bit (byte) value at a specified position
- Parameters
-
| position | address at which to read |
Implements EepromAbstraction.
◆ write8()
| void MockEepromAbstraction::write8 |
( |
EepromPosition | position, |
|
|
uint8_t | val ) |
|
inlineoverridevirtual |
write an 8 bit (byte) value to the specified position
- Parameters
-
| position | the position at which to write |
| val | the new value |
Implements EepromAbstraction.
◆ read16()
read a 16 bit value at position at a specified position
- Parameters
-
| position | the position at which to read |
Implements EepromAbstraction.
◆ write16()
| void MockEepromAbstraction::write16 |
( |
EepromPosition | position, |
|
|
uint16_t | val ) |
|
inlineoverridevirtual |
write a 16 bit value to the specified position
- Parameters
-
| position | the position at which to write |
| val | the value to read |
Implements EepromAbstraction.
◆ read32()
| virtual uint32_t MockEepromAbstraction::read32 |
( |
EepromPosition | position | ) |
|
|
inlineoverridevirtual |
read a 32 bit value at a specified position
- Parameters
-
| position | the position at which to read |
Implements EepromAbstraction.
◆ write32()
| virtual void MockEepromAbstraction::write32 |
( |
EepromPosition | position, |
|
|
uint32_t | val ) |
|
inlineoverridevirtual |
write a 32 bit value to position
- Parameters
-
| position | the position at which to write |
| val | the value to write out. |
Implements EepromAbstraction.
◆ readIntoMemArray()
| virtual void MockEepromAbstraction::readIntoMemArray |
( |
uint8_t * | memDest, |
|
|
EepromPosition | romSrc, |
|
|
uint8_t | len ) |
|
inlineoverridevirtual |
Read an array of bytes from EEPROM into memory
- Parameters
-
| memDest | the memory where the EEPROM data should be copied to |
| romSrc | the source position in EEPROM storage |
| len | the length of the array |
Implements EepromAbstraction.
◆ writeArrayToRom()
| virtual void MockEepromAbstraction::writeArrayToRom |
( |
EepromPosition | romDest, |
|
|
const uint8_t * | memSrc, |
|
|
uint8_t | len ) |
|
inlineoverridevirtual |
Writes an array of bytes from memory to EEPROM storage
- Parameters
-
| romDest | the start position in eeprom storage that the array should be copied to |
| memSrc | the memory where the rom should be copied from |
| len | the length of the array |
Implements EepromAbstraction.
The documentation for this class was generated from the following file: