SlotNVM  0.1.0
List of all members
SlotNVM32CRC< PROVISION, LAST_SLOT > Class Template Reference

SlotNVM with 32 bytes per cluster protected with CRC. More...

#include <SlotNVM.h>

Inheritance diagram for SlotNVM32CRC< PROVISION, LAST_SLOT >:
SlotNVM< ArduinoEEPROM<>, 32, PROVISION, LAST_SLOT, &_crc8_ccitt_update, long, &random > ArduinoEEPROM<>

Additional Inherited Members

- Public Member Functions inherited from SlotNVM< ArduinoEEPROM<>, 32, PROVISION, LAST_SLOT, &_crc8_ccitt_update, long, &random >
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 Public Attributes inherited from SlotNVM< ArduinoEEPROM<>, 32, PROVISION, LAST_SLOT, &_crc8_ccitt_update, long, &random >
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.
 

Detailed Description

template<nvm_size_t PROVISION = 0, uint8_t LAST_SLOT = 0>
class SlotNVM32CRC< PROVISION, LAST_SLOT >

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().

Template Parameters
PROVISIONBytes 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_SLOTNumber of last usable slot. Maximum value is 250. 0 mean number is equal to count of available cluster.

The documentation for this class was generated from the following file: