I'm trying to use fstorage module for event logging; several pages are used as a large circular buffer. When logging wraps from one page to another, the new page needs to be erased before the next piece of data can be logged. So I need a means to defer writing while waiting for erase to complete.
One possibility is to simply call fs_erase() and then fs_store(), assuming that fstorage queues and executes operations in order. Not sure what happens to the fs_store operation though if the erase fails.
Another possibility is to have my own write queue, calling fs_store() from the fs_evt_handler() 'erase done' callback. Is that permitted? I've seen comments that the libraries are not reentrant or thread-safe.
Or should I use the app_scheduler library? The library seems to be limited to BLE and app_timer callbacks. Can it be used for fstorage callbacks as well?
Any other suggestions?
Using SDK13.1, SD132
TIA, Richard