add first rev of eeprom

and ref voltage in varhandler
This commit is contained in:
2022-12-13 14:30:40 +01:00
parent bf7cde9730
commit 7cadcdbc28
47 changed files with 30486 additions and 1377 deletions

View File

@ -32,6 +32,8 @@
#include "ANPO_AnalogPortsOut.h"
#include "VARH_VariableHandler.h"
// Toolbox
#include "../Toolbox/UTIL_Utility.h"
@ -45,7 +47,7 @@
// Description: Definition of local constants (visible by this module only).
//=================================================================================================
#define INT_DAC_REF (3.3f)// int. reference voltage for conversion
//=================================================================================================
// Section: MACROS
@ -61,7 +63,6 @@
//=================================================================================================
// Section: STRUCTURES
// Description: Definition of local Structures (visible by this module only).
@ -69,13 +70,12 @@
//=================================================================================================
// Section: LOCAL VARIABLES
// Description: Definition of local variables (visible by this module only).
//=================================================================================================
LOCAL FLOAT flRefVoltage = INT_DAC_REF;
//=================================================================================================
// Section: LOCAL CONSTANTS
@ -125,17 +125,6 @@ BOOL ANPO_boInitializeModule( VOID )
return( boOK );
}
//-------------------------------------------------------------------------------------------------
// Function: ANPO_vSetRefVoltage
// Description: Sets the Reference Voltage for calculating the Voltage
// Parameters: FLOAT flVoltage -> The Ref Voltage measured with an DMM for example
// Returns: None
//-------------------------------------------------------------------------------------------------
VOID ANPO_vSetRefVoltage( FLOAT flVoltage )
{
flRefVoltage = flVoltage;
}
//=================================================================================================
// Section: LOCAL FUNCTIONS
// Descriptionn: Definition (implementation) of local functions.
@ -166,7 +155,7 @@ BOOL ANPO_boSetVoltage( FLOAT flVoltage ){
U32 u32ConvertVoltagetoRaw( FLOAT flVoltage ){
U32 RawData;
RawData = flVoltage * 4095 / flRefVoltage;
RawData = flVoltage * 4095 / VARH_flGetVariableData(VARH_eRef_U);
return RawData;
}