foxBMS
1.0.1
The foxBMS Battery Management System API Documentation
|
Header for the driver for balancing. More...
Go to the source code of this file.
Data Structures | |
struct | BAL_STATE |
Typedefs | |
typedef enum BAL_STATEMACH | BAL_STATEMACH_e |
typedef enum BAL_STATEMACH_SUB | BAL_STATEMACH_SUB_e |
typedef enum BAL_STATE_REQUEST | BAL_STATE_REQUEST_e |
typedef enum BAL_RETURN_TYPE | BAL_RETURN_TYPE_e |
typedef struct BAL_STATE | BAL_STATE_s |
Functions | |
void | BAL_SaveLastStates (BAL_STATE_s *pBalancingState) |
Saves the last state and the last substate. More... | |
uint8_t | BAL_CheckReEntrance (BAL_STATE_s *currentState) |
re-entrance check of BAL state machine trigger function More... | |
BAL_STATE_REQUEST_e | BAL_TransferStateRequest (BAL_STATE_s *currentState) |
transfers the current state request to the state machine. More... | |
BAL_RETURN_TYPE_e | BAL_CheckStateRequest (BAL_STATE_s *pCurrentState, BAL_STATE_REQUEST_e stateRequest) |
checks the state requests that are made. More... | |
void | BAL_ProcessStateUninitalized (BAL_STATE_s *pCurrentState, BAL_STATE_REQUEST_e stateRequest) |
Substate handling function for BAL_Trigger() More... | |
void | BAL_ProcessStateInitialization (BAL_STATE_s *currentState) |
State machine subfunction to initialize the balancing state machine. More... | |
void | BAL_ProcessStateInitialized (BAL_STATE_s *currentState) |
State machine subfunction to transfer from an initalized state to "running" states of th state machine. More... | |
STD_RETURN_TYPE_e | BAL_Init (DATA_BLOCK_BALANCING_CONTROL_s *pControl) |
Generic initialization function for the balancing module. More... | |
BAL_RETURN_TYPE_e | BAL_SetStateRequest (BAL_STATE_REQUEST_e stateRequest) |
sets the current state request of the state variable bal_state. More... | |
STD_RETURN_TYPE_e | BAL_GetInitializationState (void) |
gets the initialization state. More... | |
void | BAL_Trigger (void) |
trigger function for the BAL driver state machine. More... | |
Header for the driver for balancing.
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 bal.h.
typedef enum BAL_RETURN_TYPE BAL_RETURN_TYPE_e |
Possible return values when state requests are made to the BAL statemachine
typedef enum BAL_STATE_REQUEST BAL_STATE_REQUEST_e |
State requests for the BAL statemachine
typedef struct BAL_STATE BAL_STATE_s |
This structure contains all the variables relevant for the BAL state machine. The user can get the current state of the BAL state machine with this variable
typedef enum BAL_STATEMACH BAL_STATEMACH_e |
States of the BAL state machine
typedef enum BAL_STATEMACH_SUB BAL_STATEMACH_SUB_e |
Substates of the BAL state machine
enum BAL_RETURN_TYPE |
Possible return values when state requests are made to the BAL statemachine
enum BAL_STATE_REQUEST |
enum BAL_STATEMACH |
States of the BAL state machine
enum BAL_STATEMACH_SUB |
Substates of the BAL state machine
uint8_t BAL_CheckReEntrance | ( | BAL_STATE_s * | currentState | ) |
re-entrance check of BAL state machine trigger function
This function is not re-entrant and should only be called time- or event-triggered. It increments the triggerentry counter from the state variable. It should never be called by two different processes, so if it is the case, triggerentry should never be higher than 0 when this function is called.
Definition at line 82 of file bal.c.
BAL_RETURN_TYPE_e BAL_CheckStateRequest | ( | BAL_STATE_s * | pCurrentState, |
BAL_STATE_REQUEST_e | stateRequest | ||
) |
checks the state requests that are made.
This function checks the validity of the state requests. The results of the checked is returned immediately.
pCurrentState | pointer to the current state |
stateRequest | state request to be checked |
STD_RETURN_TYPE_e BAL_GetInitializationState | ( | void | ) |
gets the initialization state.
This function is used for getting the balancing initialization state
Definition at line 300 of file bal_strategy_history.c.
STD_RETURN_TYPE_e BAL_Init | ( | DATA_BLOCK_BALANCING_CONTROL_s * | pControl | ) |
void BAL_ProcessStateInitialization | ( | BAL_STATE_s * | currentState | ) |
void BAL_ProcessStateInitialized | ( | BAL_STATE_s * | currentState | ) |
void BAL_ProcessStateUninitalized | ( | BAL_STATE_s * | pCurrentState, |
BAL_STATE_REQUEST_e | stateRequest | ||
) |
Substate handling function for BAL_Trigger()
pCurrentState | pointer to the current state |
stateRequest | state request to set |
void BAL_SaveLastStates | ( | BAL_STATE_s * | pBalancingState | ) |
BAL_RETURN_TYPE_e BAL_SetStateRequest | ( | BAL_STATE_REQUEST_e | stateRequest | ) |
sets the current state request of the state variable bal_state.
This function is used to make a state request to the state machine, e.g, start voltage measurement, read result of voltage measurement, re-initialization. It calls BAL_CheckStateRequest() to check if the request is valid. The state request is rejected if is not valid. The result of the check is returned immediately, so that the requester can act in case it made a non-valid state request.
stateRequest | state request to set |
Definition at line 304 of file bal_strategy_history.c.
BAL_STATE_REQUEST_e BAL_TransferStateRequest | ( | BAL_STATE_s * | currentState | ) |
transfers the current state request to the state machine.
This function takes the current state request from current state and transfers it to the state machine. It resets the value from to BAL_STATE_NO_REQUEST
Definition at line 97 of file bal.c.
void BAL_Trigger | ( | void | ) |
trigger function for the BAL driver state machine.
This function contains the sequence of events in the BAL state machine. It must be called time-triggered, every 100 milliseconds.
Definition at line 318 of file bal_strategy_history.c.