This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

In heart rate monitor, what is the purpose of m_memory_access_in_progress?

I am working through the heart rate monitor central ble device code on Nordic SDK 8.1. I noticed that the variable

bool m_memory_access_in_progress = false;  /**< Flag to keep track of ongoing operations on persistent memory. */

is created, but I can't figure out what the use of it is. From what I can see it's only set to true when pstorage_access_status_get() returns a number that isn't 0, and all other times m_memory_access_in_progress is false. The thing is I don't see it being passed into any functions or ever checked so what is the purpose of having it?
As a side note the board I'm using just has an nRF51822 without any storage added onto it.

Parents
  • This is to signal that nRF5x flash operation is ongoing, nothing to do with external storage. One of rarely moments when you can block entire nRF5x MCU for long milliseconds is flash page erase operation (as you can read in the manual) so any FW which uses time-sensitive activities (e.g. radio) and writes to internal flash tries to limit thee activities when it is safe to do them. More on this in countless Q&S on this forum...

  • Ok. I moved the declaration to a header file (sys_evt.h):
    static bool m_memory_access_in_progress = false; And then moved all the scanning operations (for example scan_start()) to a different file that includes sys_evt.h using #include"sys_evt.h". Will this cause a problem?

Reply Children
No Data
Related