Saving & Reading a structure using FDS (Flash Data Storage) SDK15.3

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_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; = &energy_variables; = sizeof(energy_variables);

fds_record_desc_t desc = {0};

rc = fds_record_update(&desc, &record);

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;

Parents Reply Children