foxBMS  1.2.0
The foxBMS Battery Management System API Documentation
debug_default.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file debug_default.c
44  * @author foxBMS Team
45  * @date 2020-09-17 (date of creation)
46  * @updated 2021-06-09 (date of last update)
47  * @ingroup DRIVER
48  * @prefix FAKE
49  *
50  * @brief Driver implementation for the fake AFE
51  *
52  */
53 
54 /*========== Includes =======================================================*/
55 #include "general.h"
56 
57 #include "debug_default.h"
58 
59 #include "battery_cell_cfg.h"
60 #include "battery_system_cfg.h"
61 
62 #include "database.h"
63 #include "diag.h"
64 #include "os.h"
65 
66 /*========== Macros and Definitions =========================================*/
67 /** faked cell voltage value for all cell voltages in mV */
68 #define FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV)
69 
70 /** faked cell temperature for all cell temperatures in deci °C */
71 #define FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u)
72 
73 /**
74  * statemachine short time definition in #FAKE_TriggerAfe calls
75  * until next state is processed
76  */
77 #define FAKE_FSM_SHORT_TIME (1u)
78 
79 /**
80  * statemachine medium time definition in #FAKE_TriggerAfe calls
81  * until next state/substate is processed
82  */
83 #define FAKE_FSM_MEDIUM_TIME (5u)
84 
85 /**
86  * statemachine long time definition in #FAKE_TriggerAfe calls
87  * until next state/substate is processed
88  */
89 #define FAKE_FSM_LONG_TIME (10u)
90 
91 /** Symbolic names to check for multiple calls of #FAKE_TriggerAfe */
93  FAKE_MULTIPLE_CALLS_NO, /*!< no multiple calls, OK */
94  FAKE_MULTIPLE_CALLS_YES, /*!< multiple calls, not OK */
96 
97 /*========== Static Constant and Variable Definitions =======================*/
98 
99 /** local copies of database tables */
100 /**@{*/
109 /**@}*/
110 
111 /*========== Extern Constant and Variable Definitions =======================*/
112 
113 /** local instance of the driver-state */
115  .timer = 0,
116  .triggerEntry = 0,
117  .nextState = FAKE_FSM_STATE_HAS_NEVER_RUN,
118  .currentState = FAKE_FSM_STATE_HAS_NEVER_RUN,
119  .previousState = FAKE_FSM_STATE_HAS_NEVER_RUN,
120  .nextSubstate = FAKE_FSM_SUBSTATE_DUMMY,
121  .currentSubstate = FAKE_FSM_SUBSTATE_DUMMY,
122  .previousSubstate = FAKE_FSM_SUBSTATE_DUMMY,
123  .firstMeasurementFinished = false,
124  .data.allGpioVoltages = &fake_allGpioVoltage,
125  .data.balancingControl = &fake_balancingControl,
126  .data.balancingFeedback = &fake_balancingFeedback,
127  .data.cellTemperature = &fake_cellTemperature,
128  .data.cellVoltage = &fake_cellVoltage,
129  .data.openWire = &fake_openWire,
130  .data.slaveControl = &fake_slaveControl,
131 };
132 
133 /*========== Static Function Prototypes =====================================*/
134 /**
135  * @brief check for multiple calls of state machine trigger function
136  * @details The trigger function is not reentrant, which means it cannot
137  * be called multiple times. This functions increments the
138  * triggerEntry counter once and must be called each time the
139  * trigger function is called. If triggerEntry is greater than
140  * one, there were multiple calls. For this function to work,
141  * triggerEntry must be decremented each time the trigger function
142  * is called, even if no processing do because the timer is
143  * non-zero.
144  * @param pFakeState state of the fake state machine
145  * @return true if there were multiple calls, false otherwise
146  */
147 static bool FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState);
148 
149 /**
150  * @brief Sets the next state, the next substate and the timer value
151  * of the state variable.
152  * @param pFakeState state of the example state machine
153  * @param nextState state to be transferred into
154  * @param nextSubstate substate to be transferred into
155  * @param idleTime wait time for the state machine
156  */
157 static void FAKE_SetState(
158  FAKE_STATE_s *pFakeState,
159  FAKE_FSM_STATES_e nextState,
160  FAKE_FSM_SUBSTATES_e nextSubstate,
161  uint16_t idleTime);
162 
163 /**
164  * @brief Sets the next substate and the timer value
165  * of the state variable.
166  * @param pFakeState state of the example state machine
167  * @param nextSubstate substate to be transferred into
168  * @param idleTime wait time for the state machine
169  */
170 static void FAKE_SetSubstate(FAKE_STATE_s *pFakeState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime);
171 
172 /**
173  * @brief Sets the indicator that one full measurement cycles was successful
174  * @param pFakeState state of the fake state machine
175  * @return true if it is a reentrance, false otherwise
176  */
177 static void FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState);
178 
179 /**
180  * @brief Write voltage measurement data
181  * @param pFakeState state of the fake state machine
182  * @return #STD_OK if successful, #STD_NOT_OK otherwise
183  */
185 
186 /**
187  * @brief Write temperature measurement data
188  * @param pFakeState state of the fake state machine
189  * @return #STD_OK if successful, #STD_NOT_OK otherwise
190  */
192 
193 /**
194  * @brief Processes the initialization state
195  * @param pFakeState state of the fake state machine
196  * @return Always #STD_OK
197  */
199 
200 /**
201  * @brief Processes the running state
202  * @param pFakeState state of the fake state machine
203  * @return Always #STD_OK
204  */
206 
207 /**
208  * @brief Defines the state transitions
209  * @details This function contains the implementation of the state
210  * machine, i.e., the sequence of states and substates.
211  * It is called by the trigger function every time
212  * the state machine timer has a non-zero value.
213  * @param pFakeState state of the example state machine
214  * @return Always #STD_OK
215  */
217 
218 /*========== Static Function Implementations ================================*/
219 
220 static bool FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState) {
221  FAS_ASSERT(pFakeState != NULL_PTR);
222  bool reentrance = false;
224  if (pFakeState->triggerEntry == 0u) {
225  pFakeState->triggerEntry++;
226  } else {
227  reentrance = true; /* multiple calls of function */
228  }
230  return reentrance;
231 }
232 
233 static void FAKE_SetState(
234  FAKE_STATE_s *pFakeState,
235  FAKE_FSM_STATES_e nextState,
236  FAKE_FSM_SUBSTATES_e nextSubstate,
237  uint16_t idleTime) {
238  FAS_ASSERT(pFakeState != NULL_PTR);
239  bool earlyExit = false;
240 
241  pFakeState->timer = idleTime;
242 
243  if ((pFakeState->currentState == nextState) && (pFakeState->currentSubstate == nextSubstate)) {
244  /* Next state and next substate equal to current state and substate: nothing to do */
245  pFakeState->nextState = FAKE_FSM_STATE_DUMMY; /* no state transistion required -> reset */
246  pFakeState->nextSubstate = FAKE_FSM_SUBSTATE_DUMMY; /* no substate transistion required -> reset */
247  earlyExit = true;
248  }
249 
250  if (earlyExit == false) {
251  if (pFakeState->currentState != nextState) {
252  /* Next state is different: switch to it and set substate to entry value */
253  pFakeState->previousState = pFakeState->currentState;
254  pFakeState->currentState = nextState;
255  pFakeState->previousSubstate = pFakeState->currentSubstate;
256  pFakeState->currentSubstate = FAKE_FSM_SUBSTATE_ENTRY; /* Use entry state after a top level state change */
257  pFakeState->nextState = FAKE_FSM_STATE_DUMMY; /* no state transistion required -> reset */
258  pFakeState->nextSubstate = FAKE_FSM_SUBSTATE_DUMMY; /* no substate transistion required -> reset */
259  } else if (pFakeState->currentSubstate != nextSubstate) {
260  /* Only the next substate is different, switch to it */
261  FAKE_SetSubstate(pFakeState, nextSubstate, idleTime);
262  } else {
263  ;
264  }
265  }
266 }
267 
268 static void FAKE_SetSubstate(FAKE_STATE_s *pFakeState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime) {
269  FAS_ASSERT(pFakeState != NULL_PTR);
270  pFakeState->timer = idleTime;
271  pFakeState->previousSubstate = pFakeState->currentSubstate;
272  pFakeState->currentSubstate = nextSubstate;
273  pFakeState->nextSubstate = FAKE_FSM_SUBSTATE_DUMMY; /* substate has been set, now reset value for nextSubstate */
274 }
275 
277  FAS_ASSERT(pFakeState != NULL_PTR);
279 
280  uint16_t i = 0;
281 
282  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
284  for (i = 0; i < BS_NR_OF_BAT_CELLS; i++) {
285  pFakeState->data.cellVoltage->cellVoltage_mV[stringNumber][i] = FAKE_CELL_VOLTAGE_mV;
286  }
287 
288  pFakeState->data.cellVoltage->state = 0;
289  pFakeState->data.cellTemperature->state = 0;
290  for (i = 0; i < BS_NR_OF_TEMP_SENSORS_PER_STRING; i++) {
292  }
293 
294  pFakeState->data.balancingFeedback->state = 0;
295  for (i = 0; i < BS_NR_OF_BAT_CELLS; i++) {
296  pFakeState->data.balancingControl->balancingState[stringNumber][i] = 0;
297  }
298  pFakeState->data.balancingControl->nrBalancedCells[stringNumber] = 0u;
299  for (i = 0; i < BS_NR_OF_MODULES; i++) {
300  pFakeState->data.balancingFeedback->value[stringNumber][i] = 0;
301  }
302 
303  pFakeState->data.slaveControl->state = 0;
304  for (i = 0; i < BS_NR_OF_MODULES; i++) {
305  pFakeState->data.slaveControl->ioValueIn[i] = 0;
306  pFakeState->data.slaveControl->ioValueOut[i] = 0;
307  pFakeState->data.slaveControl->externalTemperatureSensor[i] = 0;
308  pFakeState->data.slaveControl->eepromValueRead[i] = 0;
309  pFakeState->data.slaveControl->eepromValueWrite[i] = 0;
310  }
311  pFakeState->data.slaveControl->eepromReadAddressLastUsed = 0xFFFFFFFF;
312  pFakeState->data.slaveControl->eepromReadAddressToUse = 0xFFFFFFFF;
313  pFakeState->data.slaveControl->eepromWriteAddressLastUsed = 0xFFFFFFFF;
314  pFakeState->data.slaveControl->eepromWriteAddressToUse = 0xFFFFFFFF;
315 
316  pFakeState->data.allGpioVoltages->state = 0;
317  for (i = 0; i < (BS_NR_OF_MODULES * BS_NR_OF_GPIOS_PER_MODULE); i++) {
318  pFakeState->data.allGpioVoltages->gpioVoltages_mV[stringNumber][i] = 0;
319  }
320 
321  for (i = 0; i < (BS_NR_OF_MODULES * (BS_NR_OF_CELLS_PER_MODULE + 1)); i++) {
322  pFakeState->data.openWire->openwire[stringNumber][i] = 0;
323  }
324  pFakeState->data.openWire->state = 0;
325  }
326 
327  pFakeState->firstMeasurementFinished = true;
330  pFakeState->data.cellVoltage,
331  pFakeState->data.cellTemperature,
332  pFakeState->data.balancingFeedback,
333  pFakeState->data.balancingControl);
334  DATA_WRITE_DATA(pFakeState->data.slaveControl, pFakeState->data.openWire);
335 }
336 
338  FAS_ASSERT(pFakeState != NULL_PTR);
339  STD_RETURN_TYPE_e successfullSave = STD_OK;
340 
341  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
342  for (uint16_t i = 0u; i < BS_NR_OF_BAT_CELLS; i++) {
343  pFakeState->data.cellVoltage->cellVoltage_mV[stringNumber][i] = FAKE_CELL_VOLTAGE_mV;
344  }
345  }
346 
347  DATA_WRITE_DATA(pFakeState->data.cellVoltage);
348 
349  return successfullSave;
350 }
351 
353  FAS_ASSERT(pFakeState != NULL_PTR);
354  STD_RETURN_TYPE_e successfullSave = STD_OK;
355 
356  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
357  for (uint16_t i = 0u; i < BS_NR_OF_TEMP_SENSORS_PER_STRING; i++) {
359  }
360  }
361 
362  DATA_WRITE_DATA(pFakeState->data.cellTemperature);
363 
364  return successfullSave;
365 }
366 
368  FAKE_FSM_STATES_e nextState = FAKE_FSM_STATE_INITIALIZATION; /* default behavior: stay in state */
369  static uint8_t waitForDataSaving = 0;
370  switch (pFakeState->currentSubstate) {
372  /* Nothing to do, just transfer to next substate */
375  break;
376 
378  if (true == FAKE_IsFirstMeasurementCycleFinished(pFakeState)) {
381  } else {
382  if (waitForDataSaving == 0u) {
383  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
384  waitForDataSaving++;
385  } else {
386  /* Voltages could not be saved, transfer to error state */
387  nextState = FAKE_FSM_STATE_ERROR;
388  }
389  } else if (waitForDataSaving == 1u) {
390  if (STD_OK == FAKE_SaveFakeTemperatureMeasurementData(pFakeState)) {
391  waitForDataSaving = 0u;
393  } else {
394  /* First measurement cycle could not be finished, transfer to error state */
395  nextState = FAKE_FSM_STATE_ERROR;
396  }
397  } else {
398  /* must never happen */
399  nextState = FAKE_FSM_STATE_ERROR;
400  }
401  }
402  break;
403 
405  /* Nothing to do, just transfer to next substate */
407  break;
408 
410  /* Nothing to do, just transfer to next state */
411  nextState = FAKE_FSM_STATE_RUNNING;
412  break;
413 
414  default:
416  break;
417  }
418  return nextState;
419 }
420 
422  FAKE_FSM_STATES_e nextState = FAKE_FSM_STATE_RUNNING; /* default behavior: stay in state */
423 
424  switch (pFakeState->currentSubstate) {
426  /* Nothing to do, just transfer to next substate */
428  break;
429 
431  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
434  } else {
435  nextState = FAKE_FSM_STATE_ERROR;
436  }
437  break;
438 
440  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
443  } else {
444  nextState = FAKE_FSM_STATE_ERROR;
445  }
446  break;
447 
448  default:
450  break;
451  }
452 
453  return nextState;
454 }
455 
457  STD_RETURN_TYPE_e ranStateMachine = STD_OK;
459  switch (pFakeState->currentState) {
460  /********************************************** STATE: HAS NEVER RUN */
462  /* Nothing to do, just transfer */
464  break;
465 
466  /********************************************** STATE: UNINITIALIZED */
468  /* Nothing to do, just transfer */
470  break;
471 
472  /********************************************* STATE: INITIALIZATION */
474  nextState = FAKE_ProcessInitializationState(pFakeState);
475  if (nextState == FAKE_FSM_STATE_INITIALIZATION) {
476  /* staying in state, processed by state function */
477  } else if (nextState == FAKE_FSM_STATE_ERROR) {
479  } else if (nextState == FAKE_FSM_STATE_RUNNING) {
481  } else {
482  FAS_ASSERT(FAS_TRAP); /* Something went wrong */
483  }
484  break;
485 
486  /**************************************************** STATE: RUNNING */
488  nextState = FAKE_ProcessRunningState(pFakeState);
489  if (nextState == FAKE_FSM_STATE_RUNNING) {
490  /* staying in state, processed by state function */
491  } else if (nextState == FAKE_FSM_STATE_ERROR) {
493  } else {
494  FAS_ASSERT(FAS_TRAP); /* Something went wrong */
495  }
496  break;
497 
498  /****************************************************** STATE: ERROR */
500  /* this case must never happen for the dummy AFE, as all cases are processed */
502  break;
503 
504  /**************************************************** STATE: DEFAULT */
505  default:
506  /* all cases must be processed, trap if unknown state arrives */
508  break;
509  }
510 
511  return ranStateMachine;
512 }
513 
514 /*========== Extern Function Implementations ================================*/
516  return STD_OK;
517 }
518 
520  FAS_ASSERT(pFakeState != NULL_PTR);
521  bool returnValue = false;
523  returnValue = pFakeState->firstMeasurementFinished;
525  return returnValue;
526 }
527 
529  FAS_ASSERT(pFakeState != NULL_PTR);
530  bool earlyExit = false;
531  STD_RETURN_TYPE_e returnValue = STD_OK;
532  FAS_ASSERT(pFakeState != NULL_PTR);
533 
534  /* Check re-entrance of function */
536  returnValue = STD_NOT_OK;
537  earlyExit = true;
538  }
539 
540  if (earlyExit == false) {
541  if (pFakeState->timer > 0u) {
542  if ((--pFakeState->timer) > 0u) {
543  pFakeState->triggerEntry--;
544  returnValue = STD_OK;
545  earlyExit = true;
546  }
547  }
548  }
549 
550  if (earlyExit == false) {
551  FAKE_RunStateMachine(pFakeState);
552  pFakeState->triggerEntry--;
553  }
554  return returnValue;
555 }
556 
557 /*========== Externalized Static Function Implementations (Unit Test) =======*/
558 #ifdef UNITY_UNIT_TEST
559 extern bool TEST_FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState) {
560  return FAKE_CheckMultipleCalls(pFakeState);
561 }
562 
563 extern void TEST_FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState) {
565 }
566 
567 extern void TEST_FAKE_SetState(
568  FAKE_STATE_s *pFakeState,
569  FAKE_FSM_STATES_e nextState,
570  FAKE_FSM_SUBSTATES_e nextSubstate,
571  uint16_t idleTime) {
572  FAKE_SetState(pFakeState, nextState, nextSubstate, idleTime);
573 }
574 
575 extern STD_RETURN_TYPE_e TEST_FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState) {
576  return FAKE_SaveFakeVoltageMeasurementData(pFakeState);
577 }
578 
579 extern STD_RETURN_TYPE_e TEST_FAKE_SaveFakeTemperatureMeasurementData(FAKE_STATE_s *pFakeState) {
580  return FAKE_SaveFakeTemperatureMeasurementData(pFakeState);
581 }
582 
583 #endif
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_STRINGS
#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
Database module header.
#define DATA_WRITE_DATA(...)
Definition: database.h:86
@ DATA_BLOCK_ID_BALANCING_CONTROL
Definition: database_cfg.h:77
@ DATA_BLOCK_ID_CELL_TEMPERATURE_BASE
Definition: database_cfg.h:95
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
Definition: database_cfg.h:81
@ DATA_BLOCK_ID_SLAVE_CONTROL
Definition: database_cfg.h:78
@ DATA_BLOCK_ID_CELL_VOLTAGE_BASE
Definition: database_cfg.h:94
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE
Definition: database_cfg.h:82
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
Definition: database_cfg.h:79
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
Definition: debug_default.c:92
@ FAKE_MULTIPLE_CALLS_NO
Definition: debug_default.c:93
@ FAKE_MULTIPLE_CALLS_YES
Definition: debug_default.c:94
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
Definition: debug_default.c:71
STD_RETURN_TYPE_e FAKE_Initialize(void)
initialize driver
FAKE_STATE_s fake_state
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
Definition: debug_default.c:68
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
Definition: debug_default.c:89
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.
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
Definition: debug_default.c:77
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 AFE driver.
enum FAKE_FSM_STATES FAKE_FSM_STATES_e
@ FAKE_FSM_SUBSTATE_DUMMY
Definition: debug_default.h:76
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FINISH_FIRST_MEASUREMENT
Definition: debug_default.h:78
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FIRST_MEASUREMENT_FINISHED
Definition: debug_default.h:79
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_TEMPERATURE_MEASUREMENT_DATA
Definition: debug_default.h:82
@ FAKE_FSM_SUBSTATE_INITIALIZATION_EXIT
Definition: debug_default.h:80
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_VOLTAGE_MEASUREMENT_DATA
Definition: debug_default.h:81
@ FAKE_FSM_SUBSTATE_ENTRY
Definition: debug_default.h:77
enum FAKE_FSM_SUBSTATES FAKE_FSM_SUBSTATES_e
@ FAKE_FSM_STATE_DUMMY
Definition: debug_default.h:66
@ FAKE_FSM_STATE_HAS_NEVER_RUN
Definition: debug_default.h:67
@ FAKE_FSM_STATE_ERROR
Definition: debug_default.h:71
@ FAKE_FSM_STATE_RUNNING
Definition: debug_default.h:70
@ FAKE_FSM_STATE_UNINITIALIZED
Definition: debug_default.h:68
@ FAKE_FSM_STATE_INITIALIZATION
Definition: debug_default.h:69
Diagnosis driver header.
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
Definition: fassert.h:237
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
Definition: fassert.h:108
@ STD_NOT_OK
Definition: fstd_types.h:73
@ STD_OK
Definition: fstd_types.h:72
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:66
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.
Definition: os.c:178
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
Definition: os.c:174
Implementation of the tasks used by the system, headers.
DATA_BLOCK_ID_e uniqueId
Definition: database_cfg.h:111
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:302
uint16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *BS_NR_OF_GPIOS_PER_MODULE]
Definition: database_cfg.h:304
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
Definition: database_cfg.h:242
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
Definition: database_cfg.h:244
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:238
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:270
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
Definition: database_cfg.h:272
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS_PER_STRING]
Definition: database_cfg.h:139
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:137
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
Definition: database_cfg.h:124
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:121
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
Definition: database_cfg.h:123
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:290
uint8_t openwire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *(BS_NR_OF_CELLS_PER_MODULE+1u)]
Definition: database_cfg.h:294
uint8_t ioValueIn[BS_NR_OF_MODULES]
Definition: database_cfg.h:259
uint8_t eepromValueWrite[BS_NR_OF_MODULES]
Definition: database_cfg.h:260
uint32_t eepromWriteAddressLastUsed
Definition: database_cfg.h:257
uint32_t eepromReadAddressLastUsed
Definition: database_cfg.h:255
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:252
uint8_t ioValueOut[BS_NR_OF_MODULES]
Definition: database_cfg.h:258
uint8_t eepromValueRead[BS_NR_OF_MODULES]
Definition: database_cfg.h:261
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES]
Definition: database_cfg.h:262
DATA_BLOCK_BALANCING_FEEDBACK_s * balancingFeedback
Definition: debug_default.h:89
DATA_BLOCK_OPEN_WIRE_s * openWire
Definition: debug_default.h:93
DATA_BLOCK_ALL_GPIO_VOLTAGES_s * allGpioVoltages
Definition: debug_default.h:92
DATA_BLOCK_CELL_VOLTAGE_s * cellVoltage
Definition: debug_default.h:87
DATA_BLOCK_BALANCING_CONTROL_s * balancingControl
Definition: debug_default.h:90
DATA_BLOCK_CELL_TEMPERATURE_s * cellTemperature
Definition: debug_default.h:88
DATA_BLOCK_SLAVE_CONTROL_s * slaveControl
Definition: debug_default.h:91
bool firstMeasurementFinished
uint16_t timer
Definition: debug_default.h:98
uint8_t triggerEntry
Definition: debug_default.h:99
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