SlotNVM
0.1.0
|
SlotNVM with 32 bytes per cluster protected with CRC. More...
#include <SlotNVM.h>
Additional Inherited Members | |
![]() | |
bool | begin () |
Initialize SlotNVM. More... | |
bool | isValid () const |
Check if begin is called before and returns true. More... | |
bool | isSlotAvailable (uint8_t slot) const |
Check if data is stored for a given slot. More... | |
bool | writeSlot (uint8_t slot, const uint8_t *data, nvm_size_t len) |
Write data. More... | |
bool | writeSlot (uint8_t slot, T &data) |
Write data. More... | |
bool | readSlot (uint8_t slot, uint8_t *data, nvm_size_t &len) const |
Read data If buffer is to small, nothing is read but len is set to needed size and false is returned. More... | |
bool | readSlot (uint8_t slot, T &data) const |
Read data If slot stores more or less byte than size of data false is returned and data untouched. More... | |
bool | eraseSlot (uint8_t slot) |
Delete slot data. More... | |
nvm_size_t | getSize () const |
Get amount of total available user data. More... | |
nvm_size_t | getUsableSize () const |
Get amount of total usable user data. More... | |
nvm_size_t | getFree () const |
Get amount of still writable user data. More... | |
![]() | |
static const uint16_t | S_CLUSTER_CNT |
Count of clusters. | |
static const uint8_t | S_USER_DATA_PER_CLUSTER |
Max size of user data in one cluster. | |
static const uint16_t | S_PROVISION |
Count of reserved user bytes for overwriting slots. | |
static const uint8_t | S_FIRST_SLOT |
First allowed slot number. | |
static const uint8_t | S_LAST_SLOT |
Last allowed slot number. | |
SlotNVM with 32 bytes per cluster protected with CRC.
26 bytes per cluster or 81,3% can be used for user data. Random function for wear leveling is random() so do not forget to call srandom() or randomSeed().
PROVISION | Bytes that must always be free to ensure that data can safely be rewritten. If your slot data do not exceed this limit is can always be rewritten without deleting other data before. This value is rounded to next multiple of user data of a cluster. |
LAST_SLOT | Number of last usable slot. Maximum value is 250. 0 mean number is equal to count of available cluster. |