...
data_store provides an abstraction layer between reading the data and doing something with it. It stores all of the data collected by sense et al., then raises a “data ready” event. Consumers of the data (logger, fault_monitor, etc) can retrieve the data directly from data_store to avoid overloading the event queue. All data is stored as
uint16_t
.To store and retrieve data, we’ll likely we use a
SolarData
DataPoint
enum with one entry for each data entry point we need (e.g.SOLARDATA_DATAPOINT_VOLTAGE_1
,SOLARDATA_DATAPOINT_MPPT_CURRENT_3
, etc.).The
data_store_enter()
function (not sold on the name) takes aSolarData
DataPoint
parameter to identify which data point it is, as well as the data point as auint16_t
. It’ll overwrite that data point in the module’s storage.The
data_store_done()
function is called by sense when a batch of data is read. It raises a “data ready” event which is received by the consumers of the data.The
data_store_get()
function will take aSolarData
DataPoint
parameter and auint16_t*
and will set the pointer to the value of the data point.
...