foxBMS  1.4.1
The foxBMS Battery Management System API Documentation
debug_default.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2022, 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 2022-10-27 (date of last update)
47  * @version v1.4.1
48  * @ingroup DRIVER
49  * @prefix FAKE
50  *
51  * @brief Driver implementation for the fake AFE
52  *
53  */
54 
55 /*========== Includes =======================================================*/
56 #include "general.h"
57 
58 #include "debug_default.h"
59 
60 #include "battery_cell_cfg.h"
61 #include "battery_system_cfg.h"
62 
63 #include "database.h"
64 #include "diag.h"
65 #include "os.h"
66 
67 /*========== Macros and Definitions =========================================*/
68 /** faked cell voltage value for all cell voltages in mV */
69 #define FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV)
70 
71 /** faked cell temperature for all cell temperatures in deci °C */
72 #define FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u)
73 
74 /**
75  * state machine short time definition in #FAKE_TriggerAfe calls
76  * until next state is processed
77  */
78 #define FAKE_FSM_SHORT_TIME (1u)
79 
80 /**
81  * state machine medium time definition in #FAKE_TriggerAfe calls
82  * until next state/substate is processed
83  */
84 #define FAKE_FSM_MEDIUM_TIME (5u)
85 
86 /**
87  * state machine long time definition in #FAKE_TriggerAfe calls
88  * until next state/substate is processed
89  */
90 #define FAKE_FSM_LONG_TIME (10u)
91 
92 /** Symbolic names to check for multiple calls of #FAKE_TriggerAfe */
93 typedef enum {
94  FAKE_MULTIPLE_CALLS_NO, /*!< no multiple calls, OK */
95  FAKE_MULTIPLE_CALLS_YES, /*!< multiple calls, not OK */
97 
98 /*========== Static Constant and Variable Definitions =======================*/
99 
100 /** local copies of database tables */
101 /**@{*/
110 /**@}*/
111 
112 /*========== Extern Constant and Variable Definitions =======================*/
113 
114 /** local instance of the driver-state */
116  .timer = 0,
117  .triggerEntry = 0,
118  .nextState = FAKE_FSM_STATE_HAS_NEVER_RUN,
119  .currentState = FAKE_FSM_STATE_HAS_NEVER_RUN,
120  .previousState = FAKE_FSM_STATE_HAS_NEVER_RUN,
121  .nextSubstate = FAKE_FSM_SUBSTATE_DUMMY,
122  .currentSubstate = FAKE_FSM_SUBSTATE_DUMMY,
123  .previousSubstate = FAKE_FSM_SUBSTATE_DUMMY,
124  .firstMeasurementFinished = false,
125  .data.allGpioVoltages = &fake_allGpioVoltage,
126  .data.balancingControl = &fake_balancingControl,
127  .data.balancingFeedback = &fake_balancingFeedback,
128  .data.cellTemperature = &fake_cellTemperature,
129  .data.cellVoltage = &fake_cellVoltage,
130  .data.openWire = &fake_openWire,
131  .data.slaveControl = &fake_slaveControl,
132 };
133 
134 /*========== Static Function Prototypes =====================================*/
135 /**
136  * @brief check for multiple calls of state machine trigger function
137  * @details The trigger function is not reentrant, which means it cannot
138  * be called multiple times. This functions increments the
139  * triggerEntry counter once and must be called each time the
140  * trigger function is called. If triggerEntry is greater than
141  * one, there were multiple calls. For this function to work,
142  * triggerEntry must be decremented each time the trigger function
143  * is called, even if no processing do because the timer is
144  * non-zero.
145  * @param pFakeState state of the fake state machine
146  * @return true if there were multiple calls, false otherwise
147  */
148 static bool FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState);
149 
150 /**
151  * @brief Sets the next state, the next substate and the timer value
152  * of the state variable.
153  * @param pFakeState state of the example state machine
154  * @param nextState state to be transferred into
155  * @param nextSubstate substate to be transferred into
156  * @param idleTime wait time for the state machine
157  */
158 static void FAKE_SetState(
159  FAKE_STATE_s *pFakeState,
160  FAKE_FSM_STATES_e nextState,
161  FAKE_FSM_SUBSTATES_e nextSubstate,
162  uint16_t idleTime);
163 
164 /**
165  * @brief Sets the next substate and the timer value
166  * of the state variable.
167  * @param pFakeState state of the example state machine
168  * @param nextSubstate substate to be transferred into
169  * @param idleTime wait time for the state machine
170  */
171 static void FAKE_SetSubstate(FAKE_STATE_s *pFakeState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime);
172 
173 /**
174  * @brief Sets the indicator that one full measurement cycles was successful
175  * @param pFakeState state of the fake state machine
176  * @return true if it is a reentrance, false otherwise
177  */
178 static void FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState);
179 
180 /**
181  * @brief Write voltage measurement data
182  * @param pFakeState state of the fake state machine
183  * @return #STD_OK if successful, #STD_NOT_OK otherwise
184  */
186 
187 /**
188  * @brief Write temperature measurement data
189  * @param pFakeState state of the fake state machine
190  * @return #STD_OK if successful, #STD_NOT_OK otherwise
191  */
193 
194 /**
195  * @brief Processes the initialization state
196  * @param pFakeState state of the fake state machine
197  * @return Always #STD_OK
198  */
200 
201 /**
202  * @brief Processes the running state
203  * @param pFakeState state of the fake state machine
204  * @return Always #STD_OK
205  */
207 
208 /**
209  * @brief Defines the state transitions
210  * @details This function contains the implementation of the state
211  * machine, i.e., the sequence of states and substates.
212  * It is called by the trigger function every time
213  * the state machine timer has a non-zero value.
214  * @param pFakeState state of the example state machine
215  * @return Always #STD_OK
216  */
218 
219 /*========== Static Function Implementations ================================*/
220 
221 static bool FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState) {
222  FAS_ASSERT(pFakeState != NULL_PTR);
223  bool reentrance = false;
225  if (pFakeState->triggerEntry == 0u) {
226  pFakeState->triggerEntry++;
227  } else {
228  reentrance = true; /* multiple calls of function */
229  }
231  return reentrance;
232 }
233 
234 static void FAKE_SetState(
235  FAKE_STATE_s *pFakeState,
236  FAKE_FSM_STATES_e nextState,
237  FAKE_FSM_SUBSTATES_e nextSubstate,
238  uint16_t idleTime) {
239  FAS_ASSERT(pFakeState != NULL_PTR);
240  bool earlyExit = false;
241 
242  pFakeState->timer = idleTime;
243 
244  if ((pFakeState->currentState == nextState) && (pFakeState->currentSubstate == nextSubstate)) {
245  /* Next state and next substate equal to current state and substate: nothing to do */
246  pFakeState->nextState = FAKE_FSM_STATE_DUMMY; /* no state transistion required -> reset */
247  pFakeState->nextSubstate = FAKE_FSM_SUBSTATE_DUMMY; /* no substate transistion required -> reset */
248  earlyExit = true;
249  }
250 
251  if (earlyExit == false) {
252  if (pFakeState->currentState != nextState) {
253  /* Next state is different: switch to it and set substate to entry value */
254  pFakeState->previousState = pFakeState->currentState;
255  pFakeState->currentState = nextState;
256  pFakeState->previousSubstate = pFakeState->currentSubstate;
257  pFakeState->currentSubstate = FAKE_FSM_SUBSTATE_ENTRY; /* Use entry state after a top level state change */
258  pFakeState->nextState = FAKE_FSM_STATE_DUMMY; /* no state transistion required -> reset */
259  pFakeState->nextSubstate = FAKE_FSM_SUBSTATE_DUMMY; /* no substate transistion required -> reset */
260  } else if (pFakeState->currentSubstate != nextSubstate) {
261  /* Only the next substate is different, switch to it */
262  FAKE_SetSubstate(pFakeState, nextSubstate, idleTime);
263  } else {
264  ;
265  }
266  }
267 }
268 
269 static void FAKE_SetSubstate(FAKE_STATE_s *pFakeState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime) {
270  FAS_ASSERT(pFakeState != NULL_PTR);
271  pFakeState->timer = idleTime;
272  pFakeState->previousSubstate = pFakeState->currentSubstate;
273  pFakeState->currentSubstate = nextSubstate;
274  pFakeState->nextSubstate = FAKE_FSM_SUBSTATE_DUMMY; /* substate has been set, now reset value for nextSubstate */
275 }
276 
278  FAS_ASSERT(pFakeState != NULL_PTR);
280 
281  uint16_t i = 0;
282 
283  for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) {
285  for (i = 0; i < BS_NR_OF_CELL_BLOCKS_PER_STRING; i++) {
287  }
288 
289  pFakeState->data.cellVoltage->state = 0;
290  pFakeState->data.cellTemperature->state = 0;
291  for (i = 0; i < BS_NR_OF_TEMP_SENSORS_PER_STRING; i++) {
293  }
294 
295  pFakeState->data.balancingFeedback->state = 0;
296  for (i = 0; i < BS_NR_OF_CELL_BLOCKS_PER_STRING; i++) {
297  pFakeState->data.balancingControl->balancingState[s][i] = 0;
298  }
299  pFakeState->data.balancingControl->nrBalancedCells[s] = 0u;
300  for (i = 0; i < BS_NR_OF_MODULES_PER_STRING; i++) {
301  pFakeState->data.balancingFeedback->value[s][i] = 0;
302  }
303 
304  pFakeState->data.slaveControl->state = 0;
305  for (i = 0; i < BS_NR_OF_MODULES_PER_STRING; i++) {
306  pFakeState->data.slaveControl->ioValueIn[i] = 0;
307  pFakeState->data.slaveControl->ioValueOut[i] = 0;
308  pFakeState->data.slaveControl->externalTemperatureSensor[i] = 0;
309  pFakeState->data.slaveControl->eepromValueRead[i] = 0;
310  pFakeState->data.slaveControl->eepromValueWrite[i] = 0;
311  }
312  pFakeState->data.slaveControl->eepromReadAddressLastUsed = 0xFFFFFFFF;
313  pFakeState->data.slaveControl->eepromReadAddressToUse = 0xFFFFFFFF;
314  pFakeState->data.slaveControl->eepromWriteAddressLastUsed = 0xFFFFFFFF;
315  pFakeState->data.slaveControl->eepromWriteAddressToUse = 0xFFFFFFFF;
316 
317  pFakeState->data.allGpioVoltages->state = 0;
318  for (i = 0; i < (BS_NR_OF_MODULES_PER_STRING * BS_NR_OF_GPIOS_PER_MODULE); i++) {
319  pFakeState->data.allGpioVoltages->gpioVoltages_mV[s][i] = 0;
320  }
321 
322  for (i = 0; i < (BS_NR_OF_MODULES_PER_STRING * (BS_NR_OF_CELL_BLOCKS_PER_MODULE + 1)); i++) {
323  pFakeState->data.openWire->openwire[s][i] = 0;
324  }
325  pFakeState->data.openWire->state = 0;
326  }
327 
328  pFakeState->firstMeasurementFinished = true;
331  pFakeState->data.cellVoltage,
332  pFakeState->data.cellTemperature,
333  pFakeState->data.balancingFeedback,
334  pFakeState->data.balancingControl);
335  DATA_WRITE_DATA(pFakeState->data.slaveControl, pFakeState->data.openWire);
336 }
337 
339  FAS_ASSERT(pFakeState != NULL_PTR);
340  STD_RETURN_TYPE_e successfullSave = STD_OK;
341 
342  for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) {
343  pFakeState->data.cellVoltage->nrValidCellVoltages[s] = 0u;
344  for (uint16_t i = 0u; i < BS_NR_OF_CELL_BLOCKS_PER_STRING; i++) {
346  pFakeState->data.cellVoltage->nrValidCellVoltages[s] += 1u;
347  }
348  }
349 
350  DATA_WRITE_DATA(pFakeState->data.cellVoltage);
351 
352  return successfullSave;
353 }
354 
356  FAS_ASSERT(pFakeState != NULL_PTR);
357  STD_RETURN_TYPE_e successfullSave = STD_OK;
358 
359  for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) {
360  for (uint16_t i = 0u; i < BS_NR_OF_TEMP_SENSORS_PER_STRING; i++) {
362  }
363  }
364 
365  DATA_WRITE_DATA(pFakeState->data.cellTemperature);
366 
367  return successfullSave;
368 }
369 
371  FAKE_FSM_STATES_e nextState = FAKE_FSM_STATE_INITIALIZATION; /* default behavior: stay in state */
372  static uint8_t waitForDataSaving = 0;
373  switch (pFakeState->currentSubstate) {
375  /* Nothing to do, just transfer to next substate */
378  break;
379 
381  if (FAKE_IsFirstMeasurementCycleFinished(pFakeState) == true) {
384  } else {
385  if (waitForDataSaving == 0u) {
386  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
387  waitForDataSaving++;
388  } else {
389  /* Voltages could not be saved, transfer to error state */
390  nextState = FAKE_FSM_STATE_ERROR;
391  }
392  } else if (waitForDataSaving == 1u) {
393  if (STD_OK == FAKE_SaveFakeTemperatureMeasurementData(pFakeState)) {
394  waitForDataSaving = 0u;
396  } else {
397  /* First measurement cycle could not be finished, transfer to error state */
398  nextState = FAKE_FSM_STATE_ERROR;
399  }
400  } else {
401  /* must never happen */
402  nextState = FAKE_FSM_STATE_ERROR;
403  }
404  }
405  break;
406 
408  /* Nothing to do, just transfer to next substate */
410  break;
411 
413  /* Nothing to do, just transfer to next state */
414  nextState = FAKE_FSM_STATE_RUNNING;
415  break;
416 
417  default:
419  break;
420  }
421  return nextState;
422 }
423 
425  FAKE_FSM_STATES_e nextState = FAKE_FSM_STATE_RUNNING; /* default behavior: stay in state */
426 
427  switch (pFakeState->currentSubstate) {
429  /* Nothing to do, just transfer to next substate */
431  break;
432 
434  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
437  } else {
438  nextState = FAKE_FSM_STATE_ERROR;
439  }
440  break;
441 
443  if (STD_OK == FAKE_SaveFakeTemperatureMeasurementData(pFakeState)) {
446  } else {
447  nextState = FAKE_FSM_STATE_ERROR;
448  }
449  break;
450 
451  default:
453  break;
454  }
455 
456  return nextState;
457 }
458 
460  STD_RETURN_TYPE_e ranStateMachine = STD_OK;
462  switch (pFakeState->currentState) {
463  /********************************************** STATE: HAS NEVER RUN */
465  /* Nothing to do, just transfer */
467  break;
468 
469  /********************************************** STATE: UNINITIALIZED */
471  /* Nothing to do, just transfer */
473  break;
474 
475  /********************************************* STATE: INITIALIZATION */
477  nextState = FAKE_ProcessInitializationState(pFakeState);
478  if (nextState == FAKE_FSM_STATE_INITIALIZATION) {
479  /* staying in state, processed by state function */
480  } else if (nextState == FAKE_FSM_STATE_ERROR) {
482  } else if (nextState == FAKE_FSM_STATE_RUNNING) {
484  } else {
485  FAS_ASSERT(FAS_TRAP); /* Something went wrong */
486  }
487  break;
488 
489  /**************************************************** STATE: RUNNING */
491  nextState = FAKE_ProcessRunningState(pFakeState);
492  if (nextState == FAKE_FSM_STATE_RUNNING) {
493  /* staying in state, processed by state function */
494  } else if (nextState == FAKE_FSM_STATE_ERROR) {
496  } else {
497  FAS_ASSERT(FAS_TRAP); /* Something went wrong */
498  }
499  break;
500 
501  /****************************************************** STATE: ERROR */
503  /* this case must never happen for the dummy AFE, as all cases are processed */
505  break;
506 
507  /**************************************************** STATE: DEFAULT */
508  default:
509  /* all cases must be processed, trap if unknown state arrives */
511  break;
512  }
513 
514  return ranStateMachine;
515 }
516 
517 /*========== Extern Function Implementations ================================*/
519  return STD_OK;
520 }
521 
523  FAS_ASSERT(pFakeState != NULL_PTR);
524  bool returnValue = false;
526  returnValue = pFakeState->firstMeasurementFinished;
528  return returnValue;
529 }
530 
532  FAS_ASSERT(pFakeState != NULL_PTR);
533  bool earlyExit = false;
534  STD_RETURN_TYPE_e returnValue = STD_OK;
535  FAS_ASSERT(pFakeState != NULL_PTR);
536 
537  /* Check re-entrance of function */
539  returnValue = STD_NOT_OK;
540  earlyExit = true;
541  }
542 
543  if (earlyExit == false) {
544  if (pFakeState->timer > 0u) {
545  if ((--pFakeState->timer) > 0u) {
546  pFakeState->triggerEntry--;
547  returnValue = STD_OK;
548  earlyExit = true;
549  }
550  }
551  }
552 
553  if (earlyExit == false) {
554  FAKE_RunStateMachine(pFakeState);
555  pFakeState->triggerEntry--;
556  }
557  return returnValue;
558 }
559 
560 /*========== Externalized Static Function Implementations (Unit Test) =======*/
561 #ifdef UNITY_UNIT_TEST
562 extern bool TEST_FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState) {
563  return FAKE_CheckMultipleCalls(pFakeState);
564 }
565 
566 extern void TEST_FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState) {
568 }
569 
570 extern void TEST_FAKE_SetState(
571  FAKE_STATE_s *pFakeState,
572  FAKE_FSM_STATES_e nextState,
573  FAKE_FSM_SUBSTATES_e nextSubstate,
574  uint16_t idleTime) {
575  FAKE_SetState(pFakeState, nextState, nextSubstate, idleTime);
576 }
577 
578 extern STD_RETURN_TYPE_e TEST_FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState) {
579  return FAKE_SaveFakeVoltageMeasurementData(pFakeState);
580 }
581 
582 extern STD_RETURN_TYPE_e TEST_FAKE_SaveFakeTemperatureMeasurementData(FAKE_STATE_s *pFakeState) {
583  return FAKE_SaveFakeTemperatureMeasurementData(pFakeState);
584 }
585 
586 #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_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
Number of GPIOs on the LTC IC.
#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
Database module header.
#define DATA_WRITE_DATA(...)
Definition: database.h:93
@ DATA_BLOCK_ID_BALANCING_CONTROL
Definition: database_cfg.h:80
@ DATA_BLOCK_ID_CELL_TEMPERATURE_BASE
Definition: database_cfg.h:98
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
Definition: database_cfg.h:84
@ DATA_BLOCK_ID_SLAVE_CONTROL
Definition: database_cfg.h:81
@ DATA_BLOCK_ID_CELL_VOLTAGE_BASE
Definition: database_cfg.h:97
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE
Definition: database_cfg.h:85
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
Definition: database_cfg.h:82
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
#define FAKE_CELL_TEMPERATURE_ddegC
Definition: debug_default.c:72
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:69
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:90
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
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:78
FAKE_CHECK_MULTIPLE_CALLS_e
Definition: debug_default.c:93
@ FAKE_MULTIPLE_CALLS_NO
Definition: debug_default.c:94
@ FAKE_MULTIPLE_CALLS_YES
Definition: debug_default.c:95
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.
FAKE_FSM_SUBSTATES_e
Definition: debug_default.h:76
@ FAKE_FSM_SUBSTATE_DUMMY
Definition: debug_default.h:77
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FINISH_FIRST_MEASUREMENT
Definition: debug_default.h:79
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FIRST_MEASUREMENT_FINISHED
Definition: debug_default.h:80
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_TEMPERATURE_MEASUREMENT_DATA
Definition: debug_default.h:83
@ FAKE_FSM_SUBSTATE_INITIALIZATION_EXIT
Definition: debug_default.h:81
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_VOLTAGE_MEASUREMENT_DATA
Definition: debug_default.h:82
@ FAKE_FSM_SUBSTATE_ENTRY
Definition: debug_default.h:78
FAKE_FSM_STATES_e
Definition: debug_default.h:66
@ FAKE_FSM_STATE_DUMMY
Definition: debug_default.h:67
@ FAKE_FSM_STATE_HAS_NEVER_RUN
Definition: debug_default.h:68
@ FAKE_FSM_STATE_ERROR
Definition: debug_default.h:72
@ FAKE_FSM_STATE_RUNNING
Definition: debug_default.h:71
@ FAKE_FSM_STATE_UNINITIALIZED
Definition: debug_default.h:69
@ FAKE_FSM_STATE_INITIALIZATION
Definition: debug_default.h:70
Diagnosis driver header.
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
Definition: fassert.h:252
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
Definition: fassert.h:126
STD_RETURN_TYPE_e
Definition: fstd_types.h:81
@ STD_NOT_OK
Definition: fstd_types.h:83
@ STD_OK
Definition: fstd_types.h:82
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:76
General macros and definitions for the whole platform.
Declaration of the OS wrapper interface.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
Definition: os_freertos.c:135
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
Definition: os_freertos.c:131
uint16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *BS_NR_OF_GPIOS_PER_MODULE]
Definition: database_cfg.h:318
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:315
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:247
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
Definition: database_cfg.h:252
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
Definition: database_cfg.h:255
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:282
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]
Definition: database_cfg.h:284
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:146
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS_PER_STRING]
Definition: database_cfg.h:148
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
Definition: database_cfg.h:131
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:129
uint16_t nrValidCellVoltages[BS_NR_OF_STRINGS]
Definition: database_cfg.h:136
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
Definition: database_cfg.h:132
DATA_BLOCK_ID_e uniqueId
Definition: database_cfg.h:119
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:302
uint8_t openwire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *(BS_NR_OF_CELL_BLOCKS_PER_MODULE+1u)]
Definition: database_cfg.h:307
uint8_t ioValueOut[BS_NR_OF_MODULES_PER_STRING]
Definition: database_cfg.h:269
uint8_t ioValueIn[BS_NR_OF_MODULES_PER_STRING]
Definition: database_cfg.h:270
uint8_t eepromValueWrite[BS_NR_OF_MODULES_PER_STRING]
Definition: database_cfg.h:271
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES_PER_STRING]
Definition: database_cfg.h:274
uint8_t eepromValueRead[BS_NR_OF_MODULES_PER_STRING]
Definition: database_cfg.h:272
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:263
DATA_BLOCK_BALANCING_CONTROL_s * balancingControl
Definition: debug_default.h:91
DATA_BLOCK_SLAVE_CONTROL_s * slaveControl
Definition: debug_default.h:92
DATA_BLOCK_OPEN_WIRE_s * openWire
Definition: debug_default.h:94
DATA_BLOCK_CELL_VOLTAGE_s * cellVoltage
Definition: debug_default.h:88
DATA_BLOCK_BALANCING_FEEDBACK_s * balancingFeedback
Definition: debug_default.h:90
DATA_BLOCK_CELL_TEMPERATURE_s * cellTemperature
Definition: debug_default.h:89
DATA_BLOCK_ALL_GPIO_VOLTAGES_s * allGpioVoltages
Definition: debug_default.h:93
FAKE_FSM_SUBSTATES_e nextSubstate
FAKE_FSM_STATES_e currentState
FAKE_FSM_SUBSTATES_e previousSubstate
uint16_t timer
Definition: debug_default.h:99
FAKE_FSM_STATES_e nextState
FAKE_FSM_STATES_e previousState
FAKE_DATABASE_ENTRIES_s data
uint8_t triggerEntry
FAKE_FSM_SUBSTATES_e currentSubstate
bool firstMeasurementFinished