68 #define FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV)
71 #define FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u)
77 #define FAKE_FSM_SHORT_TIME (1u)
83 #define FAKE_FSM_MEDIUM_TIME (5u)
89 #define FAKE_FSM_LONG_TIME (10u)
123 .firstMeasurementFinished =
false,
222 bool reentrance =
false;
239 bool earlyExit =
false;
241 pFakeState->
timer = idleTime;
250 if (earlyExit ==
false) {
270 pFakeState->
timer = idleTime;
282 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
341 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
349 return successfullSave;
356 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
364 return successfullSave;
369 static uint8_t waitForDataSaving = 0;
382 if (waitForDataSaving == 0u) {
389 }
else if (waitForDataSaving == 1u) {
391 waitForDataSaving = 0u;
511 return ranStateMachine;
521 bool returnValue =
false;
530 bool earlyExit =
false;
540 if (earlyExit ==
false) {
541 if (pFakeState->
timer > 0u) {
542 if ((--pFakeState->
timer) > 0u) {
550 if (earlyExit ==
false) {
558 #ifdef UNITY_UNIT_TEST
559 extern bool TEST_FAKE_CheckMultipleCalls(
FAKE_STATE_s *pFakeState) {
563 extern void TEST_FAKE_SetFirstMeasurementCycleFinished(
FAKE_STATE_s *pFakeState) {
567 extern void TEST_FAKE_SetState(
572 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_CELLS_PER_MODULE
number of battery cells per battery module (parallel cells are counted as one)
#define BS_NR_OF_MODULES
number of modules in battery pack
#define BS_NR_OF_GPIOS_PER_MODULE
Number of GPIOs on the LTC IC.
#define BS_NR_OF_TEMP_SENSORS_PER_STRING
#define BS_NR_OF_BAT_CELLS
#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.
FAKE_CHECK_MULTIPLE_CALLS
@ FAKE_MULTIPLE_CALLS_YES
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
#define FAKE_CELL_TEMPERATURE_ddegC
STD_RETURN_TYPE_e FAKE_Initialize(void)
initialize driver
#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
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.
STD_RETURN_TYPE_e FAKE_TriggerMeasurementIc(FAKE_STATE_s *pFakeState)
Trigger function for the driver, called to advance the state machine.
bool FAKE_IsFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
return whether the first measurement cycle is finished
static DATA_BLOCK_BALANCING_FEEDBACK_s fake_balancingFeedback
enum FAKE_CHECK_MULTIPLE_CALLS FAKE_CHECK_MULTIPLE_CALLS_e
static DATA_BLOCK_CELL_VOLTAGE_s fake_cellVoltage
static DATA_BLOCK_OPEN_WIRE_s fake_openWire
#define FAKE_FSM_SHORT_TIME
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.
Header for the driver of the fake measurement IC driver.
enum FAKE_FSM_STATES FAKE_FSM_STATES_e
@ 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
enum FAKE_FSM_SUBSTATES FAKE_FSM_SUBSTATES_e
@ 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.
#define NULL_PTR
Null pointer.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
General macros and definitions for the whole platform.
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.
Implementation of the tasks used by the system, headers.
DATA_BLOCK_HEADER_s header
uint16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *BS_NR_OF_GPIOS_PER_MODULE]
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS_PER_STRING]
DATA_BLOCK_HEADER_s header
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
DATA_BLOCK_HEADER_s header
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t openwire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *(BS_NR_OF_CELLS_PER_MODULE+1)]
uint8_t ioValueIn[BS_NR_OF_MODULES]
uint8_t eepromValueWrite[BS_NR_OF_MODULES]
uint32_t eepromWriteAddressLastUsed
uint32_t eepromReadAddressLastUsed
uint32_t eepromReadAddressToUse
DATA_BLOCK_HEADER_s header
uint8_t ioValueOut[BS_NR_OF_MODULES]
uint8_t eepromValueRead[BS_NR_OF_MODULES]
uint32_t eepromWriteAddressToUse
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES]
DATA_BLOCK_BALANCING_FEEDBACK_s * balancingFeedback
DATA_BLOCK_OPEN_WIRE_s * openWire
DATA_BLOCK_ALL_GPIO_VOLTAGES_s * allGpioVoltages
DATA_BLOCK_CELL_VOLTAGE_s * cellVoltage
DATA_BLOCK_BALANCING_CONTROL_s * balancingControl
DATA_BLOCK_CELL_TEMPERATURE_s * cellTemperature
DATA_BLOCK_SLAVE_CONTROL_s * slaveControl
bool firstMeasurementFinished
FAKE_FSM_STATES_e nextState
FAKE_FSM_SUBSTATES_e nextSubstate
FAKE_FSM_STATES_e previousState
FAKE_DATABASE_ENTRIES_s data
FAKE_FSM_SUBSTATES_e previousSubstate
FAKE_FSM_STATES_e currentState
FAKE_FSM_SUBSTATES_e currentSubstate