nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ set_monotonic_counter()

int set_monotonic_counter ( uint16_t  counter_desc,
uint16_t  new_counter 
)

#include <include/bl_storage.h>

Set the current HW monotonic counter.

Note
FYI for users looking at the values directly in flash: Values are stored with their bits flipped. This is to squeeze one more value out of the counter.
Parameters
[in]counter_descCounter description.
[in]new_counterThe new counter value. Must be larger than the current value.
Return values
0The counter was updated successfully.
-EINVALnew_counter is invalid (must be larger than current counter, and cannot be 0xFFFF).
-ENOMEMThere are no more free counter slots (see
embed:rst:inline :kconfig:option:`CONFIG_SB_NUM_VER_COUNTER_SLOTS` 
).