mirror of
https://github.com/CovidBraceletPrj/CovidBracelet.git
synced 2025-01-08 04:14:25 +01:00
Add mutex for entire NVS
This commit is contained in:
parent
b8eb13f634
commit
da234280b8
@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
static struct nvs_fs fs;
|
static struct nvs_fs fs;
|
||||||
|
|
||||||
|
struct k_mutex fs_mutex;
|
||||||
|
|
||||||
|
|
||||||
// Information about currently stored contacts
|
// Information about currently stored contacts
|
||||||
static stored_contacts_information_t contact_information = {.oldest_contact = 0, .count = 0};
|
static stored_contacts_information_t contact_information = {.oldest_contact = 0, .count = 0};
|
||||||
|
|
||||||
@ -77,10 +80,12 @@ void increment_stored_contact_counter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int init_contact_storage(void) {
|
int init_contact_storage(void) {
|
||||||
|
k_mutex_init(&fs_mutex);
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct flash_pages_info info;
|
struct flash_pages_info info;
|
||||||
// define the nvs file system
|
// define the nvs file system
|
||||||
fs.offset = FLASH_AREA_OFFSET(storage);
|
fs.offset = FLASH_AREA_OFFSET(storage);
|
||||||
|
fs.nvs_lock = fs_mutex;
|
||||||
rc = flash_get_page_info_by_offs(device_get_binding(FLASH_DEVICE), fs.offset, &info);
|
rc = flash_get_page_info_by_offs(device_get_binding(FLASH_DEVICE), fs.offset, &info);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user