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