REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
nvmconfig::PersistentSettingsWriter Class Reference

Persistent user-changable configuration of the Teensy Microcontroller. More...

#include <persistent.h>

Inheritance diagram for nvmconfig::PersistentSettingsWriter:
Collaboration diagram for nvmconfig::PersistentSettingsWriter:

Public Member Functions

size_t write_to_eeprom ()
 serialize configuration to eeprom,
 
void read_from_eeprom ()
 read configuration from eeprom
 
void reset_defaults (bool write_to_eeprom=true)
 
void fromJson (JsonObjectConst src, Context c)
 This will only call the respective fromJson call in the subsystem if its key is given in the object.
 
void toJson (JsonObject target, Context c)
 Note that empty subsystems get removed, i.e.
 
void info (JsonObject target)
 

Public Attributes

std::list< PersistentSettings * > subsystems
 

Additional Inherited Members

- Static Public Member Functions inherited from utils::HeapSingleton< PersistentSettingsWriter >
static PersistentSettingsWriter & get ()
 

Detailed Description

Persistent user-changable configuration of the Teensy Microcontroller.

The persistency is realized via the EEPROM.

Values will be hold in the instance and synced to the EEPROM only via calls to read_from_eeprom() or write_to_eeprom().

Note that, given that this class can use the more compact MessagePack representation instead of classical JSON, the objects on the flash are usually smaller then the ones transfered over network.

Definition at line 63 of file persistent.h.

Member Function Documentation

◆ fromJson()

FLASHMEM void nvmconfig::PersistentSettingsWriter::fromJson ( JsonObjectConst src,
Context c )

This will only call the respective fromJson call in the subsystem if its key is given in the object.

Definition at line 38 of file persistent.cpp.

◆ info()

FLASHMEM void nvmconfig::PersistentSettingsWriter::info ( JsonObject target)

Definition at line 22 of file persistent.cpp.

References nvmconfig::eeprom_size, and write_to_eeprom().

◆ read_from_eeprom()

FLASHMEM void nvmconfig::PersistentSettingsWriter::read_from_eeprom ( )

read configuration from eeprom

Definition at line 53 of file persistent.cpp.

References nvmconfig::eeprom_address, nvmconfig::eeprom_size, nvmconfig::Flash, LOG4, LOG_ERROR, and nvmconfig::required_magic.

◆ reset_defaults()

FLASHMEM void nvmconfig::PersistentSettingsWriter::reset_defaults ( bool write_to_eeprom = true)

Definition at line 45 of file persistent.cpp.

References nvmconfig::required_magic.

◆ toJson()

FLASHMEM void nvmconfig::PersistentSettingsWriter::toJson ( JsonObject target,
Context c )

Note that empty subsystems get removed, i.e.

if their toJson call doesn't fill the Object, it is omitted.

Definition at line 29 of file persistent.cpp.

◆ write_to_eeprom()

FLASHMEM size_t nvmconfig::PersistentSettingsWriter::write_to_eeprom ( )

serialize configuration to eeprom,

Returns
consumed bytes in eeprom

Definition at line 84 of file persistent.cpp.

References nvmconfig::eeprom_address, nvmconfig::eeprom_size, nvmconfig::Flash, and LOGMEV.

Referenced by info().

Member Data Documentation

◆ subsystems

std::list<PersistentSettings *> nvmconfig::PersistentSettingsWriter::subsystems

Definition at line 68 of file persistent.h.


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