PEController BSP v4
Board Support Package for PEController from Taraz Technologies
 
Loading...
Searching...
No Matches
state_storage_client_t Struct Reference

Contains the entities to be defined by each storage client. The storage module uses these members to update the storage states.

Public Attributes

void * arg
 Custom arguments used by the relevant client.

 
uint32_t dataWordLen
 No of 32-bit words required for the client storage.
 
void(* InitStatesFromStorage )(uint32_t *data, bool isDataValid)
 This callback initiates the storage for the relevant client.
 
uint32_t(* RefreshStates )(uint32_t *data, uint32_t *indexPtr)
 This callback is used to refresh the states in the data buffer for the client.
 

Member Data Documentation

◆ InitStatesFromStorage

void(* state_storage_client_t::InitStatesFromStorage) (uint32_t *data, bool isDataValid)
//Sample Definition
static void InitStatesFromStorage(uint32_t* data, bool isDataValid)
{
// @note Make sure to only save/load controllable variables here
dest_data_t* src = (dest_data_t*)data;
src_data_t* dest = (src_data_t*)&srcData;
// Put elements here which will always be default values here, such as enable etc which can't be 1 when the control starts
if (isDataValid)
src->value = dest->value;
// Set default values because the loaded values are invalid
// @note Make sure to only save/load controllable variables here
else
src->value = 0;
}
void(* InitStatesFromStorage)(uint32_t *data, bool isDataValid)
This callback initiates the storage for the relevant client.
Definition state_storage_lib.h:81
Parameters
dataBuffer containing stored states at startup used for data initialization by the client.
isDataValidContains the validity state of the data. If not valid, start with default values.

◆ RefreshStates

uint32_t(* state_storage_client_t::RefreshStates) (uint32_t *data, uint32_t *indexPtr)
//Sample Definition
static uint32_t RefreshStates(uint32_t* data, uint32_t* indexPtr)
{
uint32_t len = 0;
dest_data_t* dest = (dest_data_t*)data;
src_data_t* src = (src_data_t*)&srcData;
// @note Only update values and signal to update if values have been changed
if (dest->value != src->value)
{
dest->value = src->value;
len = storageWordLen;
}
*indexPtr = 0;
return len;
}
uint32_t(* RefreshStates)(uint32_t *data, uint32_t *indexPtr)
This callback is used to refresh the states in the data buffer for the client.
Definition state_storage_lib.h:100
Parameters
dataBuffer to be updated by the client if states have been updated.
indexPtrPointer for the initial index of the client, used in case of multiple blocks of state storages by a single client.
Returns
uint32_t Word count if the data is updated by the client, else 0