71 #define FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV)
74 #define FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u)
80 #define FAKE_FSM_SHORT_TIME (1u)
86 #define FAKE_FSM_MEDIUM_TIME (5u)
92 #define FAKE_FSM_LONG_TIME (10u)
126 .firstMeasurementFinished =
false,
225 bool reentrance =
false;
242 bool earlyExit =
false;
244 pFakeState->
timer = idleTime;
253 if (earlyExit ==
false) {
273 pFakeState->
timer = idleTime;
354 return successfullSave;
369 return successfullSave;
374 static uint8_t waitForDataSaving = 0;
387 if (waitForDataSaving == 0u) {
394 }
else if (waitForDataSaving == 1u) {
396 waitForDataSaving = 0u;
516 return ranStateMachine;
526 bool returnValue =
false;
535 bool earlyExit =
false;
545 if (earlyExit ==
false) {
546 if (pFakeState->
timer > 0u) {
547 if ((--pFakeState->
timer) > 0u) {
555 if (earlyExit ==
false) {
563 #ifdef UNITY_UNIT_TEST
577 FAKE_SetState(pFakeState, nextState, nextSubstate, idleTime);
Configuration of the battery cell (e.g., minimum and maximum cell voltage)
Configuration of the battery system (e.g., number of battery modules, battery cells,...
#define BS_NR_OF_CELL_BLOCKS_PER_MODULE
number of cells per module
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define BS_NR_OF_GPIOS_PER_MODULE
Defines the number of GPIOs.
#define BS_NR_OF_CELL_BLOCKS_PER_STRING
#define BS_NR_OF_MODULES_PER_STRING
number of modules in a string
#define BS_NR_OF_TEMP_SENSORS_PER_STRING
#define DATA_WRITE_DATA(...)
@ DATA_BLOCK_ID_BALANCING_CONTROL
@ DATA_BLOCK_ID_CELL_TEMPERATURE_BASE
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
@ DATA_BLOCK_ID_SLAVE_CONTROL
@ DATA_BLOCK_ID_CELL_VOLTAGE_BASE
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
static FAKE_FSM_STATES_e FAKE_ProcessInitializationState(FAKE_STATE_s *pFakeState)
Processes the initialization state.
static STD_RETURN_TYPE_e FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState)
Write voltage measurement data.
static STD_RETURN_TYPE_e FAKE_SaveFakeTemperatureMeasurementData(FAKE_STATE_s *pFakeState)
Write temperature measurement data.
static bool FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState)
check for multiple calls of state machine trigger function
static void FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
Sets the indicator that one full measurement cycles was successful.
static DATA_BLOCK_ALL_GPIO_VOLTAGES_s fake_allGpioVoltage
static DATA_BLOCK_BALANCING_CONTROL_s fake_balancingControl
STD_RETURN_TYPE_e TEST_FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState)
#define FAKE_CELL_TEMPERATURE_ddegC
STD_RETURN_TYPE_e FAKE_Initialize(void)
initialize driver
STD_RETURN_TYPE_e FAKE_TriggerAfe(FAKE_STATE_s *pFakeState)
Trigger function for the driver, called to advance the state machine.
#define FAKE_CELL_VOLTAGE_mV
static DATA_BLOCK_CELL_TEMPERATURE_s fake_cellTemperature
static FAKE_FSM_STATES_e FAKE_ProcessRunningState(FAKE_STATE_s *pFakeState)
Processes the running state.
#define FAKE_FSM_LONG_TIME
static DATA_BLOCK_SLAVE_CONTROL_s fake_slaveControl
STD_RETURN_TYPE_e TEST_FAKE_SaveFakeTemperatureMeasurementData(FAKE_STATE_s *pFakeState)
static void FAKE_SetState(FAKE_STATE_s *pFakeState, FAKE_FSM_STATES_e nextState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next state, the next substate and the timer value of the state variable.
bool FAKE_IsFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
return whether the first measurement cycle is finished
static DATA_BLOCK_BALANCING_FEEDBACK_s fake_balancingFeedback
void TEST_FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
static DATA_BLOCK_CELL_VOLTAGE_s fake_cellVoltage
static DATA_BLOCK_OPEN_WIRE_s fake_openWire
#define FAKE_FSM_SHORT_TIME
FAKE_CHECK_MULTIPLE_CALLS_e
@ FAKE_MULTIPLE_CALLS_YES
static STD_RETURN_TYPE_e FAKE_RunStateMachine(FAKE_STATE_s *pFakeState)
Defines the state transitions.
static void FAKE_SetSubstate(FAKE_STATE_s *pFakeState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next substate and the timer value of the state variable.
void TEST_FAKE_SetState(FAKE_STATE_s *pFakeState, FAKE_FSM_STATES_e nextState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
bool TEST_FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState)
Header for the driver of the fake AFE driver.
@ FAKE_FSM_SUBSTATE_DUMMY
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FINISH_FIRST_MEASUREMENT
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FIRST_MEASUREMENT_FINISHED
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_TEMPERATURE_MEASUREMENT_DATA
@ FAKE_FSM_SUBSTATE_INITIALIZATION_EXIT
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_VOLTAGE_MEASUREMENT_DATA
@ FAKE_FSM_SUBSTATE_ENTRY
@ FAKE_FSM_STATE_HAS_NEVER_RUN
@ FAKE_FSM_STATE_UNINITIALIZED
@ FAKE_FSM_STATE_INITIALIZATION
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
Definition of foxBMS standard types.
#define NULL_PTR
Null pointer.
Declaration of the OS wrapper interface.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
int16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *BS_NR_OF_GPIOS_PER_MODULE]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]
DATA_BLOCK_HEADER_s header
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS_PER_STRING]
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint16_t nrValidCellVoltages[BS_NR_OF_STRINGS]
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
DATA_BLOCK_HEADER_s header
uint8_t openWire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *BS_NR_OF_CELL_BLOCKS_PER_MODULE]
uint32_t eepromWriteAddressToUse
uint32_t eepromWriteAddressLastUsed
uint8_t ioValueOut[BS_NR_OF_MODULES_PER_STRING]
uint32_t eepromReadAddressToUse
uint32_t eepromReadAddressLastUsed
uint8_t ioValueIn[BS_NR_OF_MODULES_PER_STRING]
uint8_t eepromValueWrite[BS_NR_OF_MODULES_PER_STRING]
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES_PER_STRING]
uint8_t eepromValueRead[BS_NR_OF_MODULES_PER_STRING]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_BALANCING_CONTROL_s * balancingControl
DATA_BLOCK_SLAVE_CONTROL_s * slaveControl
DATA_BLOCK_OPEN_WIRE_s * openWire
DATA_BLOCK_CELL_VOLTAGE_s * cellVoltage
DATA_BLOCK_BALANCING_FEEDBACK_s * balancingFeedback
DATA_BLOCK_CELL_TEMPERATURE_s * cellTemperature
DATA_BLOCK_ALL_GPIO_VOLTAGES_s * allGpioVoltages
FAKE_FSM_SUBSTATES_e nextSubstate
FAKE_FSM_STATES_e currentState
FAKE_FSM_SUBSTATES_e previousSubstate
FAKE_FSM_STATES_e nextState
FAKE_FSM_STATES_e previousState
FAKE_DATABASE_ENTRIES_s data
FAKE_FSM_SUBSTATES_e currentSubstate
bool firstMeasurementFinished