@All,
I am currently using a data structure to keep count of cars entering a park:
struct currentCounts_structure { // currently 10 bytes long
int hourlyCount; // In period hourly count
int hourlyCountInFlight; // In flight and waiting for Ubidots to confirm
int dailyCount; // In period daily count
unsigned long lastCountTime; // When did we record our last count
int temperature; // Current Temperature
int alertCount; // What is the current alert count
int maxMinValue; // Highest count in one minute in the current period
} current;
I can then save the structure occasionally to FRAM using @rickkas7’s MB85RC256V-FRAM-RK library as an object such as:
fram.put(FRAM::currentCountsAddr,current);
Thing is that I can miss counts if the Particle device is busy sending data or waiting for a response from my back-end web service. As the cars trigger a hardware interrupt, I would like to move from simply raising a flag in the ISR to updating the counts in the ISR so I will miss less counts. Problem is that when I tried to make either the individual variables in the structure volatile or the whole structure volatile, I get this compile error complaining about the fram.put() and fram.get() commands.
warning: implicit dereference will not access object of type 'volatile currentCounts_structure' in statement
fram.get(FRAM::currentCountsAddr, current);
I have read about the various ways this can be done but none seem to work when I want to store or retrieve from FRAM.
https://embeddedgurus.com/barr-code/2012/11/how-to-combine-volatile-with-struct/
Any suggestions?