Wirepas SDK
persistent.h File Reference

Go to the source code of this file.

Functions

persistent_res_e Mcu_Persistent_read (uint8_t *data, uint16_t offset, uint16_t len)
 Reading data from persistent memory from the beginnings. More...
 
persistent_res_e Mcu_Persistent_write (uint8_t *data, uint16_t offset, uint16_t len)
 Writing data to persistent memory. More...
 
persistent_res_e Mcu_Persistent_isValid (uint32_t magic_key)
 Check persistent memory data validity by checking magic key value. More...
 
uint8_t Mcu_Persistent_getMaxSize ()
 Get persistent memory maximum data size. More...
 

Enumerations

enum  persistent_res_e { PERSISTENT_RES_OK = 0, PERSISTENT_RES_DATA_AREA_OVERFLOW = 1, PERSISTENT_RES_MAGIC_KEY_NOT_VALID = 2 }
 List of return code. More...
 

Macros

#define PERSISTENT_MAGIC_KEY   (uint32_t)0xA133F0E8
 

Function Documentation

◆ Mcu_Persistent_getMaxSize()

uint8_t Mcu_Persistent_getMaxSize ( )

Get persistent memory maximum data size.

Returns
The maximum size of data in bytes

◆ Mcu_Persistent_isValid()

persistent_res_e Mcu_Persistent_isValid ( uint32_t  magic_key)

Check persistent memory data validity by checking magic key value.

Parameters
magic_keyReference key
Returns
PERSISTENT_RES_OK Succeed PERSISTENT_RES_MAGIC_KEY_NOT_VALID Magic key not valid

◆ Mcu_Persistent_read()

persistent_res_e Mcu_Persistent_read ( uint8_t *  data,
uint16_t  offset,
uint16_t  len 
)

Reading data from persistent memory from the beginnings.

Parameters
dataPointer to store raw data from persistent memory
offsetThe offset to read from
lenRead the desired amount of data length
Returns
PERSISTENT_RES_OK Succeed PERSISTENT_RES_DATA_AREA_OVERFLOW The suggested read data area is too long

◆ Mcu_Persistent_write()

persistent_res_e Mcu_Persistent_write ( uint8_t *  data,
uint16_t  offset,
uint16_t  len 
)

Writing data to persistent memory.

Parameters
dataPointer to data to store in persistent memory
offsetThe place where from writing start if not in the beginning
lenWrite the desired amount of data length
Returns
PERSISTENT_RES_OK Succeed PERSISTENT_RES_DATA_AREA_OVERFLOW The suggested write data area or offset place is too long

Enumeration Type Documentation

◆ persistent_res_e

List of return code.

Enumerator
PERSISTENT_RES_OK 

Operation is successful

PERSISTENT_RES_DATA_AREA_OVERFLOW 

Suggested read or write data area is too long

PERSISTENT_RES_MAGIC_KEY_NOT_VALID 

Magic key not valid

Definition at line 14 of file persistent.h.

Macro Definition Documentation

◆ PERSISTENT_MAGIC_KEY

#define PERSISTENT_MAGIC_KEY   (uint32_t)0xA133F0E8

Definition at line 9 of file persistent.h.

persistent_res_e
persistent_res_e
List of return code.
Definition: persistent.h:14
PERSISTENT_RES_DATA_AREA_OVERFLOW
@ PERSISTENT_RES_DATA_AREA_OVERFLOW
Definition: persistent.h:19
PERSISTENT_RES_MAGIC_KEY_NOT_VALID
@ PERSISTENT_RES_MAGIC_KEY_NOT_VALID
Definition: persistent.h:21
PERSISTENT_RES_OK
@ PERSISTENT_RES_OK
Definition: persistent.h:17