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

How do I block until any flash writes are finished by fstorage?

My application uses SDK 11 and s130 on an nRF51822. In certain cases I want to delete all my bonds and go into sys off.

I presume that when I call pm_peers_delete(), that results in a flash write using fstorage. How do I wait for that to complete before I go into sys off?

Parents
  • Perhaps I can do this in the main context? (Adapted from the approach I had with pstorage in the past)

    printf("Blocking till flash write completes.\n");
    
    uint32_t queued_flash_operations = 0;
    do {
        app_sched_execute();
        fs_queued_op_count_get(&queued_flash_operations);
    }
    while (queued_flash_operations > 0);
    
    app_system_off();
    
  • @stefanbirnir You mean wait for pm_evt_handler() to be called with PM_EVT_PEERS_DELETE_SUCCEEDED?

Reply Children
No Data