foxBMS
1.1.0
The foxBMS Battery Management System API Documentation
|
Driver implementation for the fake measurement IC. More...
#include "general.h"
#include "debug_default.h"
#include "battery_cell_cfg.h"
#include "battery_system_cfg.h"
#include "database.h"
#include "diag.h"
#include "os.h"
Go to the source code of this file.
Macros | |
#define | FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV) |
#define | FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u) |
#define | FAKE_FSM_SHORT_TIME (1u) |
#define | FAKE_FSM_MEDIUM_TIME (5u) |
#define | FAKE_FSM_LONG_TIME (10u) |
Typedefs | |
typedef enum FAKE_CHECK_MULTIPLE_CALLS | FAKE_CHECK_MULTIPLE_CALLS_e |
Enumerations | |
enum | FAKE_CHECK_MULTIPLE_CALLS { FAKE_MULTIPLE_CALLS_NO , FAKE_MULTIPLE_CALLS_YES } |
Functions | |
static bool | FAKE_CheckMultipleCalls (FAKE_STATE_s *pFakeState) |
check for multiple calls of state machine trigger function More... | |
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. More... | |
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. More... | |
static void | FAKE_SetFirstMeasurementCycleFinished (FAKE_STATE_s *pFakeState) |
Sets the indicator that one full measurement cycles was successful. More... | |
static STD_RETURN_TYPE_e | FAKE_SaveFakeVoltageMeasurementData (FAKE_STATE_s *pFakeState) |
Write voltage measurement data. More... | |
static STD_RETURN_TYPE_e | FAKE_SaveFakeTemperatureMeasurementData (FAKE_STATE_s *pFakeState) |
Write temperature measurement data. More... | |
static FAKE_FSM_STATES_e | FAKE_ProcessInitializationState (FAKE_STATE_s *pFakeState) |
Processes the initialization state. More... | |
static FAKE_FSM_STATES_e | FAKE_ProcessRunningState (FAKE_STATE_s *pFakeState) |
Processes the running state. More... | |
static STD_RETURN_TYPE_e | FAKE_RunStateMachine (FAKE_STATE_s *pFakeState) |
Defines the state transitions. More... | |
STD_RETURN_TYPE_e | FAKE_Initialize (void) |
initialize driver More... | |
bool | FAKE_IsFirstMeasurementCycleFinished (FAKE_STATE_s *pFakeState) |
return whether the first measurement cycle is finished More... | |
STD_RETURN_TYPE_e | FAKE_TriggerMeasurementIc (FAKE_STATE_s *pFakeState) |
Trigger function for the driver, called to advance the state machine. More... | |
Variables | |
FAKE_STATE_s | fake_state |
static DATA_BLOCK_CELL_VOLTAGE_s | fake_cellVoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE} |
static DATA_BLOCK_CELL_TEMPERATURE_s | fake_cellTemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE} |
static DATA_BLOCK_BALANCING_FEEDBACK_s | fake_balancingFeedback |
static DATA_BLOCK_BALANCING_CONTROL_s | fake_balancingControl = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL} |
static DATA_BLOCK_SLAVE_CONTROL_s | fake_slaveControl = {.header.uniqueId = DATA_BLOCK_ID_SLAVE_CONTROL} |
static DATA_BLOCK_ALL_GPIO_VOLTAGES_s | fake_allGpioVoltage = {.header.uniqueId = DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE} |
static DATA_BLOCK_OPEN_WIRE_s | fake_openWire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE} |
Driver implementation for the fake measurement IC.
SPDX-License-Identifier: BSD-3-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:
Definition in file debug_default.c.
#define FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u) |
faked cell temperature for all cell temperatures in deci °C
Definition at line 71 of file debug_default.c.
#define FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV) |
faked cell voltage value for all cell voltages in mV
Definition at line 68 of file debug_default.c.
#define FAKE_FSM_LONG_TIME (10u) |
statemachine long time definition in FAKE_TriggerMeasurementIc calls until next state/substate is processed
Definition at line 89 of file debug_default.c.
#define FAKE_FSM_MEDIUM_TIME (5u) |
statemachine medium time definition in FAKE_TriggerMeasurementIc calls until next state/substate is processed
Definition at line 83 of file debug_default.c.
#define FAKE_FSM_SHORT_TIME (1u) |
statemachine short time definition in FAKE_TriggerMeasurementIc calls until next state is processed
Definition at line 77 of file debug_default.c.
typedef enum FAKE_CHECK_MULTIPLE_CALLS FAKE_CHECK_MULTIPLE_CALLS_e |
Symbolic names to check for multiple calls of FAKE_TriggerMeasurementIc
Symbolic names to check for multiple calls of FAKE_TriggerMeasurementIc
Enumerator | |
---|---|
FAKE_MULTIPLE_CALLS_NO | no multiple calls, OK |
FAKE_MULTIPLE_CALLS_YES | multiple calls, not OK |
Definition at line 92 of file debug_default.c.
|
static |
check for multiple calls of state machine trigger function
The trigger function is not reentrant, which means it cannot be called multiple times. This functions increments the triggerEntry counter once and must be called each time the trigger function is called. If triggerEntry is greater than one, there were multiple calls. For this function to work, triggerEntry must be decremented each time the trigger function is called, even if no processing do because the timer is non-zero.
pFakeState | state of the fake state machine |
Definition at line 220 of file debug_default.c.
STD_RETURN_TYPE_e FAKE_Initialize | ( | void | ) |
initialize driver
Definition at line 515 of file debug_default.c.
bool FAKE_IsFirstMeasurementCycleFinished | ( | FAKE_STATE_s * | pFakeState | ) |
return whether the first measurement cycle is finished
pFakeState | current state of the fake driver |
Definition at line 519 of file debug_default.c.
|
static |
Processes the initialization state.
pFakeState | state of the fake state machine |
Definition at line 367 of file debug_default.c.
|
static |
Processes the running state.
pFakeState | state of the fake state machine |
Definition at line 421 of file debug_default.c.
|
static |
Defines the state transitions.
This function contains the implementation of the state machine, i.e., the sequence of states and substates. It is called by the trigger function every time the state machine timer has a non-zero value.
pFakeState | state of the example state machine |
Definition at line 456 of file debug_default.c.
|
static |
Write temperature measurement data.
pFakeState | state of the fake state machine |
Definition at line 352 of file debug_default.c.
|
static |
Write voltage measurement data.
pFakeState | state of the fake state machine |
Definition at line 337 of file debug_default.c.
|
static |
Sets the indicator that one full measurement cycles was successful.
pFakeState | state of the fake state machine |
Definition at line 276 of file debug_default.c.
|
static |
Sets the next state, the next substate and the timer value of the state variable.
pFakeState | state of the example state machine |
nextState | state to be transferred into |
nextSubstate | substate to be transferred into |
idleTime | wait time for the state machine |
Definition at line 233 of file debug_default.c.
|
static |
Sets the next substate and the timer value of the state variable.
pFakeState | state of the example state machine |
nextSubstate | substate to be transferred into |
idleTime | wait time for the state machine |
Definition at line 268 of file debug_default.c.
STD_RETURN_TYPE_e FAKE_TriggerMeasurementIc | ( | FAKE_STATE_s * | pFakeState | ) |
Trigger function for the driver, called to advance the state machine.
pFakeState | current state of the fake driver |
Definition at line 528 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 107 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 105 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 103 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 102 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 101 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 108 of file debug_default.c.
|
static |
local copies of database tables
Definition at line 106 of file debug_default.c.
FAKE_STATE_s fake_state |
local instance of the driver-state
Definition at line 114 of file debug_default.c.