Speeduino
Loading...
Searching...
No Matches
Enumerations | Functions
storage.h File Reference

Functions for reading and writing user settings to/from EEPROM. More...

#include <stdint.h>
#include "storage_api.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  SensorCalibrationTable : uint8_t { SensorCalibrationTable::CoolantSensor = 0U , SensorCalibrationTable::IntakeAirTempSensor = 1U , SensorCalibrationTable::O2Sensor = 2U }
 Enum to identify sensor calibration tables. More...
 

Functions

void setStorageAPI (const storage_api_t &api)
 Inject the external storage API.
 
const storage_api_tgetStorageAPI (void)
 Provide global access to the raw storage API.
 
void saveAllPages (void)
 Write all pages from RAM to durable storage.
 
void savePage (uint8_t pageNum)
 Write one page from RAM to durable storage.
 
void loadAllPages (void)
 Load all pages from durable storage. I.e. load the tune.
 
bool isEepromWritePending (void)
 Do we have page data that needs to be written to durable storage?
 
void setEepromWritePending (bool isPending)
 Set or clear the Write Pending flag.
 
void loadAllCalibrationTables (void)
 Load the curves for all sensors from durable storage.
 
void saveAllCalibrationTables (void)
 Store the curves for all sensors in durable storage.
 
void saveCalibrationTable (SensorCalibrationTable sensor)
 Store one sensor curve in durable storage.
 
void saveCalibrationCrc (SensorCalibrationTable sensor, uint32_t crc)
 Store the CRC for one sensor curve in durable storage.
 
uint32_t loadCalibrationCrc (SensorCalibrationTable sensor)
 Retrieve the CRC for one sensor curve from durable storage.
 
uint8_t loadLastBaro (void)
 Last barometer reading cache.
 
void saveLastBaro (uint8_t newValue)
 Last barometer reading cache.
 
uint8_t loadEEPROMVersion (void)
 Save/load the version number of the storage layout.
 
void saveEEPROMVersion (uint8_t newVersion)
 Save/load the version number of the storage layout.
 

Detailed Description

Functions for reading and writing user settings to/from EEPROM.

See the output from the print_eeprom_layout() unit test for the layout of the EEPROM.

Function Documentation

◆ getStorageAPI()

const storage_api_t & getStorageAPI ( void  )

Provide global access to the raw storage API.

Here is the caller graph for this function:

◆ setStorageAPI()

void setStorageAPI ( const storage_api_t api)

Inject the external storage API.

Note
This must be called before any other storage function.

Storage is split into two components:

  1. An API that abstracts basic storage I/O (storage_api_t).
  2. A set of functions that read/write Speeduino entities to/from storage (defined here)
Parameters
apiThe external storage I/O functions
Here is the call graph for this function:
Here is the caller graph for this function: