Every parameter has three function pointers to allo user defined actions on read, write and setToDefault. This is useful for e.g.
- The parametervalue is not stored in a variable, but in a structure.
- After write of filter-settings the integrator must be reinitialized.
- The paramtervalue must be scaled before display.
- The parameter should perform an action on write.
If no customized action is neccessary, the default action must be linked. This default action is dependant of the datatype of the parameter. For every useable datatype a default action is defined:
- signed char: ReadFunction_STD_I8, WriteFunction_STD_I8, SetToDefaultFunction_STD_I8
- unsigned char: ReadFunction_STD_U8, WriteFunction_STD_U8, SetToDefaultFunction_STD_U8
- signed word: ReadFunction_STD_I16, WriteFunction_STD_I16, SetToDefaultFunction_STD_I16
- unsigned word: ReadFunction_STD_U16, WriteFunction_STD_U16, SetToDefaultFunction_STD_U16
- signed int: ReadFunction_STD_I32, WriteFunction_STD_I32, SetToDefaultFunction_STD_I32
- unsigned int: ReadFunction_STD_U32, WriteFunction_STD_U32, SetToDefaultFunction_STD_U32
- signed long: ReadFunction_STD_I64, WriteFunction_STD_I64, SetToDefaultFunction_STD_I64
- unsigned long: ReadFunction_STD_U64, WriteFunction_STD_U64, SetToDefaultFunction_STD_U64
- float: ReadFunction_STD_F32, WriteFunction_STD_F32, SetToDefaultFunction_STD_F32
- string: ReadFunction_STD_STR, WriteFunction_STD_STR, SetToDefaultFunction_STD_STR
Read and write functions have as return value the number of processed bytes. In case of 0 as return value an error occured.
Example for a onWrite Function
{
uint8_t val;
return 0;
val = ((uint8_t*)
pData)[0];
switch(val)
{
case 0:
Stop();
break;
case 1:
if (IsRunning())
return 0;
Run();
break;
default:
return 0;
}
}
bool IsValidForWrite(Parameter *ptThis, uint16_t ui16SubId, void *pData, int32_t ui32MaxCount, uint32_t ui32Offset, ParameterAccessSource tAccessSource, uint8_t ui8AccessLevel)
Check if the actual access-right is sufficient to write the parameter.
Definition: PARA_Data.c:801
uint16_t void int32_t uint32_t ParameterAccessSource tAccessSource
Definition: PARA_Flash_STM32H5.c:981
uint16_t void int32_t ui32MaxCount
Definition: PARA_Flash_STM32H5.c:981
uint16_t void int32_t uint32_t ui32Offset
Definition: PARA_Flash_STM32H5.c:981
uint16_t void * pData
Definition: PARA_Flash_STM32H5.c:981
uint16_t void int32_t uint32_t ParameterAccessSource uint8_t ui8AccessLevel
Definition: PARA_Flash_STM32H5.c:982
g_ui32ParaFlashFlags &return GetDataTypeSize(TYPE_uint32)
uint16_t ui16SubId
Definition: PARA_Flash_STM32H5.c:981
ParameterAccessSource
List of sources for parameter-access. Every parameter can limit access to these sources....
Definition: PARA_Lib.h:766
@ TYPE_uint8
Definition: SYS_Type.h:76
Parameter definition.
Definition: PARA_Lib.h:861
If the written value is 1, the device is started. If 0 the device stopps. The value is not written ot a variable, only the action is performed. In the same parameter the state of the device is read with this onRead function:
{
return 0;
if (get_state() & RUN_FLAG)
{
((uint8_t*)
pData)[0] = 1;
}
else
{
((uint8_t*)
pData)[0] = 0;
}
}
bool IsValidForRead(Parameter *ptThis, uint16_t ui16SubId, void *pData, int32_t ui32MaxCount, uint32_t ui32Offset, ParameterAccessSource tAccessSource, uint8_t ui8AccessLevel)
Check if the actual access-right is sufficient to read the parameter.
Definition: PARA_Data.c:770