foxBMS  1.1.2
The foxBMS Battery Management System API Documentation
bal.c File Reference

Driver for the Balancing module. More...

#include "bal.h"
Include dependency graph for bal.c:

Go to the source code of this file.

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...
 
STD_RETURN_TYPE_e BAL_Init (DATA_BLOCK_BALANCING_CONTROL_s *pControl)
 Generic initialization function for the balancing module. 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...
 

Detailed Description

Driver for the Balancing module.

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2020-02-24 (date of creation)
Updated
2020-07-31 (date of last update)
Prefix
BAL

Definition in file bal.c.

Function Documentation

◆ BAL_CheckReEntrance()

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.

Returns
0 if no further instance of the function is active, 0xff otherwise

Definition at line 82 of file bal.c.

Here is the call graph for this function:

◆ BAL_CheckStateRequest()

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.

Parameters
pCurrentStatepointer to the current state
stateRequeststate request to be checked
Returns
result of the state request that was made

Definition at line 109 of file bal.c.

◆ BAL_Init()

Generic initialization function for the balancing module.

Definition at line 143 of file bal.c.

◆ BAL_ProcessStateInitialization()

void BAL_ProcessStateInitialization ( BAL_STATE_s currentState)

State machine subfunction to initialize the balancing state machine.

TODO

Definition at line 164 of file bal.c.

◆ BAL_ProcessStateInitialized()

void BAL_ProcessStateInitialized ( BAL_STATE_s currentState)

State machine subfunction to transfer from an initalized state to "running" states of th state machine.

TODO

Definition at line 171 of file bal.c.

◆ BAL_ProcessStateUninitalized()

void BAL_ProcessStateUninitalized ( BAL_STATE_s pCurrentState,
BAL_STATE_REQUEST_e  stateRequest 
)

Substate handling function for BAL_Trigger()

Parameters
pCurrentStatepointer to the current state
stateRequeststate request to set

Definition at line 151 of file bal.c.

◆ BAL_SaveLastStates()

void BAL_SaveLastStates ( BAL_STATE_s pBalancingState)

Saves the last state and the last substate.

Definition at line 69 of file bal.c.

◆ BAL_TransferStateRequest()

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

Returns
current state request

Definition at line 97 of file bal.c.

Here is the call graph for this function: