add eeprom feature v2

This commit is contained in:
2022-12-15 15:04:05 +01:00
parent f654257dd8
commit ed6b7160de
6 changed files with 14 additions and 14 deletions

View File

@ -76,8 +76,6 @@
// Description: Definition of local variables (visible by this module only).
//=================================================================================================
__IO uint32_t ErasingOnGoing = 0;
LOCAL osMutexId_t m_pstMutexID = NULL;
//=================================================================================================
@ -127,7 +125,7 @@ BOOL USFL_boInitializeModule( VOID )
//-------------------------------------------------------------------------------------------------
// Function: USFL_boGetVariable
// Description: Gets a variable out of the virtual eeprom
// Parameters: U8 u8Variable -> virtual adress of variable
// Parameters: U8 u8Variable -> virtual address of variable
// U32 * u32Variable -> pointer to data
// Returns: Boolean TRUE if successful
//-------------------------------------------------------------------------------------------------
@ -136,15 +134,13 @@ BOOL USFL_boGetVariable ( U8 u8Variable, VARH_UVariable * uVariable ){
boOK &= EE_ReadVariable32bits( (U16) u8Variable, (PU32)uVariable ) == EE_OK ? TRUE : FALSE;
//*u32Variable = UTIL_u32RevFLOAT( *u32Variable );
return boOK;
}
//-------------------------------------------------------------------------------------------------
// Function: USFL_boSetVariable
// Description: Writes a variable into the virtual eeprom
// Parameters: U8 u8Variable -> virtual adress of variable
// Parameters: U8 u8Variable -> virtual address of variable
// U32 u32Variable -> data to write
// Returns: Boolean TRUE if successful
//-------------------------------------------------------------------------------------------------
@ -152,12 +148,13 @@ BOOL USFL_boSetVariable ( U8 u8Variable, VARH_UVariable uVariable ){
BOOL boOK = TRUE;
EE_Status ee_status = EE_OK;
boOK &= (ee_status = EE_WriteVariable32bits( (U16) u8Variable, uVariable.u32Val )) == EE_OK ? TRUE : FALSE;
ee_status = EE_WriteVariable32bits( (U16) u8Variable, uVariable.u32Val );
/* Start cleanup mode, if cleanup is needed */
if ((ee_status & EE_STATUSMASK_CLEANUP) == EE_STATUSMASK_CLEANUP) {
ErasingOnGoing = 1;
boOK &= (ee_status |= EE_CleanUp()) == EE_OK ? TRUE : FALSE;
boOK &= EE_WriteVariable32bits( (U16) u8Variable, uVariable.u32Val ) == EE_OK ? TRUE : FALSE;
}
if ((ee_status & EE_STATUSMASK_ERROR) == EE_STATUSMASK_ERROR) {boOK &= FALSE;}