I am trying to save and read a structure using FDS, how do I go about it?
I have the structure:
typedef struct { uint16_t total_runhours_flash; float total_energy_consumed_flash; }energy_struct; energy_struct energy_variables;
Is this correct by populating the record as such?:
fds_record_t record; fds_record_desc_t record_desc; record.file_id = FILE_ID; record.key = ENERGY_KEY; record.data.p_data = &energy_variables; record.data.length_words = sizeof(energy_variables); fds_record_desc_t desc = {0}; rc = fds_record_update(&desc, &record); APP_ERROR_CHECK(rc);
And to read is the main problem, I can't seem to match the types in which it would load data from the structure: (This is giving error)
energy_variables = (struct energy_struct *) config.p_data;