STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
EERef Struct Reference

EERef class. More...

#include <EEPROM.h>

Public Member Functions

 EERef (const int idx)
 Construct a reference to an EEPROM cell.
 
uint8_t operator* () const
 Read the value of the referenced EEPROM cell.
 
 operator uint8_t () const
 Implicit conversion to uint8_t, reads the referenced EEPROM cell.
 
EERef & operator= (const EERef &ref)
 Write the value of another EERef to the referenced EEPROM cell.
 
EERef & operator= (uint8_t in)
 Write a byte to the referenced EEPROM cell.
 
EERef & operator+= (uint8_t in)
 Add a value to the stored value and write the result back.
 
EERef & operator-= (uint8_t in)
 Subtract a value from the stored value and write the result back.
 
EERef & operator*= (uint8_t in)
 Multiply the stored value by a value and write the result back.
 
EERef & operator/= (uint8_t in)
 Divide the stored value by a value and write the result back.
 
EERef & operator^= (uint8_t in)
 Bitwise XOR the stored value with a value and write the result back.
 
EERef & operator%= (uint8_t in)
 Modulo the stored value by a value and write the result back.
 
EERef & operator&= (uint8_t in)
 Bitwise AND the stored value with a value and write the result back.
 
EERef & operator|= (uint8_t in)
 Bitwise OR the stored value with a value and write the result back.
 
EERef & operator<<= (uint8_t in)
 Left shift the stored value by a value and write the result back.
 
EERef & operator>>= (uint8_t in)
 Right shift the stored value by a value and write the result back.
 
EERef & update (uint8_t in)
 Write a value only if it differs from the stored value, to reduce EEPROM wear.
 
EERef & operator++ ()
 Prefix increment of the stored value.
 
EERef & operator-- ()
 Prefix decrement of the stored value.
 
uint8_t operator++ (int)
 Postfix increment of the stored value.
 
uint8_t operator-- (int)
 Postfix decrement of the stored value.
 

Public Attributes

int index
 Index of the EEPROM cell this reference points to.
 

Detailed Description

EERef class.

This object references an EEPROM cell. Its purpose is to mimic a typical byte of RAM, however its storage is the EEPROM. This class has an overhead of two bytes, similar to storing a pointer to an EEPROM cell.

Constructor & Destructor Documentation

◆ EERef()

EERef::EERef ( const int  idx)
inline

Construct a reference to an EEPROM cell.

Parameters
idxIndex of the EEPROM cell.

Member Function Documentation

◆ operator uint8_t()

EERef::operator uint8_t ( ) const
inline

Implicit conversion to uint8_t, reads the referenced EEPROM cell.

Returns
Value stored in the EEPROM cell.

◆ operator%=()

EERef & EERef::operator%= ( uint8_t  in)
inline

Modulo the stored value by a value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator&=()

EERef & EERef::operator&= ( uint8_t  in)
inline

Bitwise AND the stored value with a value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator*()

uint8_t EERef::operator* ( ) const
inline

Read the value of the referenced EEPROM cell.

Returns
Value stored in the EEPROM cell.

◆ operator*=()

EERef & EERef::operator*= ( uint8_t  in)
inline

Multiply the stored value by a value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator++() [1/2]

EERef & EERef::operator++ ( )
inline

Prefix increment of the stored value.

Returns
Reference to this object.

◆ operator++() [2/2]

uint8_t EERef::operator++ ( int  )
inline

Postfix increment of the stored value.

Returns
Value stored before the increment.

◆ operator+=()

EERef & EERef::operator+= ( uint8_t  in)
inline

Add a value to the stored value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator--() [1/2]

EERef & EERef::operator-- ( )
inline

Prefix decrement of the stored value.

Returns
Reference to this object.

◆ operator--() [2/2]

uint8_t EERef::operator-- ( int  )
inline

Postfix decrement of the stored value.

Returns
Value stored before the decrement.

◆ operator-=()

EERef & EERef::operator-= ( uint8_t  in)
inline

Subtract a value from the stored value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator/=()

EERef & EERef::operator/= ( uint8_t  in)
inline

Divide the stored value by a value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator<<=()

EERef & EERef::operator<<= ( uint8_t  in)
inline

Left shift the stored value by a value and write the result back.

Parameters
inNumber of bits to shift.
Returns
Reference to this object.

◆ operator=() [1/2]

EERef & EERef::operator= ( const EERef &  ref)
inline

Write the value of another EERef to the referenced EEPROM cell.

Parameters
refReference whose value is written.
Returns
Reference to this object.

◆ operator=() [2/2]

EERef & EERef::operator= ( uint8_t  in)
inline

Write a byte to the referenced EEPROM cell.

Parameters
inValue to write.
Returns
Reference to this object.

◆ operator>>=()

EERef & EERef::operator>>= ( uint8_t  in)
inline

Right shift the stored value by a value and write the result back.

Parameters
inNumber of bits to shift.
Returns
Reference to this object.

◆ operator^=()

EERef & EERef::operator^= ( uint8_t  in)
inline

Bitwise XOR the stored value with a value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ operator|=()

EERef & EERef::operator|= ( uint8_t  in)
inline

Bitwise OR the stored value with a value and write the result back.

Parameters
inOperand.
Returns
Reference to this object.

◆ update()

EERef & EERef::update ( uint8_t  in)
inline

Write a value only if it differs from the stored value, to reduce EEPROM wear.

Parameters
inValue to write.
Returns
Reference to this object.

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