foxBMS - Unit Tests  1.4.0
The foxBMS Unit Tests 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-07-28 (date of last update)
47  * @version v1.4.0
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  * statemachine short time definition in #FAKE_TriggerAfe calls
76  * until next state is processed
77  */
78 #define FAKE_FSM_SHORT_TIME (1u)
79 
80 /**
81  * statemachine 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  * statemachine 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  for (uint16_t i = 0u; i < BS_NR_OF_CELL_BLOCKS_PER_STRING; i++) {
345  }
346  }
347 
348  DATA_WRITE_DATA(pFakeState->data.cellVoltage);
349 
350  return successfullSave;
351 }
352 
354  FAS_ASSERT(pFakeState != NULL_PTR);
355  STD_RETURN_TYPE_e successfullSave = STD_OK;
356 
357  for (uint8_t s = 0u; s < BS_NR_OF_STRINGS; s++) {
358  for (uint16_t i = 0u; i < BS_NR_OF_TEMP_SENSORS_PER_STRING; i++) {
360  }
361  }
362 
363  DATA_WRITE_DATA(pFakeState->data.cellTemperature);
364 
365  return successfullSave;
366 }
367 
369  FAKE_FSM_STATES_e nextState = FAKE_FSM_STATE_INITIALIZATION; /* default behavior: stay in state */
370  static uint8_t waitForDataSaving = 0;
371  switch (pFakeState->currentSubstate) {
373  /* Nothing to do, just transfer to next substate */
376  break;
377 
379  if (FAKE_IsFirstMeasurementCycleFinished(pFakeState) == true) {
382  } else {
383  if (waitForDataSaving == 0u) {
384  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
385  waitForDataSaving++;
386  } else {
387  /* Voltages could not be saved, transfer to error state */
388  nextState = FAKE_FSM_STATE_ERROR;
389  }
390  } else if (waitForDataSaving == 1u) {
391  if (STD_OK == FAKE_SaveFakeTemperatureMeasurementData(pFakeState)) {
392  waitForDataSaving = 0u;
394  } else {
395  /* First measurement cycle could not be finished, transfer to error state */
396  nextState = FAKE_FSM_STATE_ERROR;
397  }
398  } else {
399  /* must never happen */
400  nextState = FAKE_FSM_STATE_ERROR;
401  }
402  }
403  break;
404 
406  /* Nothing to do, just transfer to next substate */
408  break;
409 
411  /* Nothing to do, just transfer to next state */
412  nextState = FAKE_FSM_STATE_RUNNING;
413  break;
414 
415  default:
417  break;
418  }
419  return nextState;
420 }
421 
423  FAKE_FSM_STATES_e nextState = FAKE_FSM_STATE_RUNNING; /* default behavior: stay in state */
424 
425  switch (pFakeState->currentSubstate) {
427  /* Nothing to do, just transfer to next substate */
429  break;
430 
432  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
435  } else {
436  nextState = FAKE_FSM_STATE_ERROR;
437  }
438  break;
439 
441  if (STD_OK == FAKE_SaveFakeVoltageMeasurementData(pFakeState)) {
444  } else {
445  nextState = FAKE_FSM_STATE_ERROR;
446  }
447  break;
448 
449  default:
451  break;
452  }
453 
454  return nextState;
455 }
456 
458  STD_RETURN_TYPE_e ranStateMachine = STD_OK;
460  switch (pFakeState->currentState) {
461  /********************************************** STATE: HAS NEVER RUN */
463  /* Nothing to do, just transfer */
465  break;
466 
467  /********************************************** STATE: UNINITIALIZED */
469  /* Nothing to do, just transfer */
471  break;
472 
473  /********************************************* STATE: INITIALIZATION */
475  nextState = FAKE_ProcessInitializationState(pFakeState);
476  if (nextState == FAKE_FSM_STATE_INITIALIZATION) {
477  /* staying in state, processed by state function */
478  } else if (nextState == FAKE_FSM_STATE_ERROR) {
480  } else if (nextState == FAKE_FSM_STATE_RUNNING) {
482  } else {
483  FAS_ASSERT(FAS_TRAP); /* Something went wrong */
484  }
485  break;
486 
487  /**************************************************** STATE: RUNNING */
489  nextState = FAKE_ProcessRunningState(pFakeState);
490  if (nextState == FAKE_FSM_STATE_RUNNING) {
491  /* staying in state, processed by state function */
492  } else if (nextState == FAKE_FSM_STATE_ERROR) {
494  } else {
495  FAS_ASSERT(FAS_TRAP); /* Something went wrong */
496  }
497  break;
498 
499  /****************************************************** STATE: ERROR */
501  /* this case must never happen for the dummy AFE, as all cases are processed */
503  break;
504 
505  /**************************************************** STATE: DEFAULT */
506  default:
507  /* all cases must be processed, trap if unknown state arrives */
509  break;
510  }
511 
512  return ranStateMachine;
513 }
514 
515 /*========== Extern Function Implementations ================================*/
517  return STD_OK;
518 }
519 
521  FAS_ASSERT(pFakeState != NULL_PTR);
522  bool returnValue = false;
524  returnValue = pFakeState->firstMeasurementFinished;
526  return returnValue;
527 }
528 
530  FAS_ASSERT(pFakeState != NULL_PTR);
531  bool earlyExit = false;
532  STD_RETURN_TYPE_e returnValue = STD_OK;
533  FAS_ASSERT(pFakeState != NULL_PTR);
534 
535  /* Check re-entrance of function */
537  returnValue = STD_NOT_OK;
538  earlyExit = true;
539  }
540 
541  if (earlyExit == false) {
542  if (pFakeState->timer > 0u) {
543  if ((--pFakeState->timer) > 0u) {
544  pFakeState->triggerEntry--;
545  returnValue = STD_OK;
546  earlyExit = true;
547  }
548  }
549  }
550 
551  if (earlyExit == false) {
552  FAKE_RunStateMachine(pFakeState);
553  pFakeState->triggerEntry--;
554  }
555  return returnValue;
556 }
557 
558 /*========== Externalized Static Function Implementations (Unit Test) =======*/
559 #ifdef UNITY_UNIT_TEST
560 extern bool TEST_FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState) {
561  return FAKE_CheckMultipleCalls(pFakeState);
562 }
563 
566 }
567 
568 extern void TEST_FAKE_SetState(
569  FAKE_STATE_s *pFakeState,
570  FAKE_FSM_STATES_e nextState,
571  FAKE_FSM_SUBSTATES_e nextSubstate,
572  uint16_t idleTime) {
573  FAKE_SetState(pFakeState, nextState, nextSubstate, idleTime);
574 }
575 
577  return FAKE_SaveFakeVoltageMeasurementData(pFakeState);
578 }
579 
581  return FAKE_SaveFakeTemperatureMeasurementData(pFakeState);
582 }
583 
584 #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
STD_RETURN_TYPE_e TEST_FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState)
#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
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
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.
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_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:248
#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
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