#include <nvstore.h>
Public Member Functions | |
uint16_t | get_max_keys () const |
Returns number of keys. More... | |
void | set_max_keys (uint16_t num_keys) |
Set number of keys. More... | |
uint16_t | get_max_possible_keys () |
Return maximal possible number of keys (in this flash configuration). More... | |
int | get (uint16_t key, uint16_t buf_size, void *buf, uint16_t &actual_size) |
Returns one item of data programmed on Flash, given key. More... | |
int | get_item_size (uint16_t key, uint16_t &actual_size) |
Returns size of the data programmed on Flash, given key. More... | |
int | set (uint16_t key, uint16_t buf_size, const void *buf) |
Programs one item of data on Flash, given key. More... | |
int | allocate_key (uint16_t &key, uint8_t owner=NVSTORE_UNSPECIFIED_OWNER) |
Allocate a free key (to be used later in a set operation). More... | |
int | free_all_keys_by_owner (uint8_t owner) |
Free all allocated keys that belong to a specific owner. More... | |
int | set_once (uint16_t key, uint16_t buf_size, const void *buf) |
Programs one item of data on Flash, given key, allowing no consequent sets to this key. More... | |
int | remove (uint16_t key) |
Remove an item from flash. More... | |
int | init () |
Initializes NVStore component. More... | |
int | deinit () |
Deinitializes NVStore component. More... | |
int | reset () |
Reset Flash NVStore areas. More... | |
size_t | size () |
Return NVStore size (area size). More... | |
int | get_area_params (uint8_t area, uint32_t &address, size_t &size) |
Return address and size of an NVStore area. More... | |
Static Public Member Functions | |
static NVStore & | get_instance () |
As a singleton, return the single instance of the class. More... | |
NVStore class.
Class for storing data by keys in the internal flash
int allocate_key | ( | uint16_t & | key, |
uint8_t | owner = NVSTORE_UNSPECIFIED_OWNER |
||
) |
Allocate a free key (to be used later in a set operation).
[out] | key | Returned key of stored item. |
[in] | owner | Owner of allocated key. |
int deinit | ( | ) |
int free_all_keys_by_owner | ( | uint8_t | owner | ) |
Free all allocated keys that belong to a specific owner.
[in] | owner | Owner. |
int get | ( | uint16_t | key, |
uint16_t | buf_size, | ||
void * | buf, | ||
uint16_t & | actual_size | ||
) |
Returns one item of data programmed on Flash, given key.
[in] | key | Key of stored item. |
[in] | buf_size | Length of input buffer in bytes. |
[in] | buf | Buffer to store data on. |
[out] | actual_size | Actual size of returned data. |
int get_area_params | ( | uint8_t | area, |
uint32_t & | address, | ||
size_t & | size | ||
) |
Return address and size of an NVStore area.
[in] | area | Area. |
[out] | address | Area address. |
[out] | size | Area size (bytes). |
|
static |
As a singleton, return the single instance of the class.
Reason for this class being a singleton is the following:
int get_item_size | ( | uint16_t | key, |
uint16_t & | actual_size | ||
) |
Returns size of the data programmed on Flash, given key.
[in] | key | Key of stored item. |
[out] | actual_size | Actual size of item |
uint16_t get_max_keys | ( | ) | const |
Returns number of keys.
uint16_t get_max_possible_keys | ( | ) |
Return maximal possible number of keys (in this flash configuration).
int init | ( | ) |
Initializes NVStore component.
int remove | ( | uint16_t | key | ) |
Remove an item from flash.
[in] | key | Key of stored item. |
int reset | ( | ) |
int set | ( | uint16_t | key, |
uint16_t | buf_size, | ||
const void * | buf | ||
) |
Programs one item of data on Flash, given key.
[in] | key | Key of stored item. |
[in] | buf_size | Item size in bytes. |
[in] | buf | Buffer containing data. |
void set_max_keys | ( | uint16_t | num_keys | ) |
Set number of keys.
int set_once | ( | uint16_t | key, |
uint16_t | buf_size, | ||
const void * | buf | ||
) |
Programs one item of data on Flash, given key, allowing no consequent sets to this key.
[in] | key | Key of stored item. |
[in] | buf_size | Item size in bytes. |
[in] | buf | Buffer containing data. |