foxBMS  1.6.0
The foxBMS Battery Management System API Documentation
sps.h File Reference

Headers for the driver for the smart power switches. More...

#include "contactor_cfg.h"
#include "sps_cfg.h"
#include "sps_types.h"
#include <stdint.h>
Include dependency graph for sps.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void SPS_Initialize (void)
 Initialize IOs for the SPS driver. More...
 
void SPS_Ctrl (void)
 Control function for the CONT driver state machine. More...
 
void SPS_RequestContactorState (SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
 Request state of a contactor. More...
 
void SPS_RequestGeneralIoState (SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
 Request state of a general IO. More...
 
CONT_ELECTRICAL_STATE_TYPE_e SPS_GetChannelCurrentFeedback (const SPS_CHANNEL_INDEX channelIndex)
 Get feedback value. More...
 
CONT_ELECTRICAL_STATE_TYPE_e SPS_GetChannelPexFeedback (const SPS_CHANNEL_INDEX channelIndex, bool normallyOpen)
 Get the feedback state of a channel. More...
 
SPS_CHANNEL_AFFILIATION_e SPS_GetChannelAffiliation (SPS_CHANNEL_INDEX channelIndex)
 Returns the channel affiliation. More...
 

Detailed Description

Headers for the driver for the smart power switches.

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-10-14 (date of creation)
Updated
2023-10-12 (date of last update)
Version
v1.6.0
Prefix
SPS

Definition in file sps.h.

Function Documentation

◆ SPS_Ctrl()

void SPS_Ctrl ( void  )

Control function for the CONT driver state machine.

This function contains the sequence of events in the SPS state machine. It must be called time-triggered, every 10ms. It exits without effect, if the function call is a reentrance.

Definition at line 481 of file sps.c.

Here is the call graph for this function:

◆ SPS_GetChannelAffiliation()

SPS_CHANNEL_AFFILIATION_e SPS_GetChannelAffiliation ( SPS_CHANNEL_INDEX  channelIndex)

Returns the channel affiliation.

Parameters
[in]channelIndexindex of the channel in question
Returns
affiliation of the channel

Definition at line 659 of file sps.c.

◆ SPS_GetChannelCurrentFeedback()

CONT_ELECTRICAL_STATE_TYPE_e SPS_GetChannelCurrentFeedback ( const SPS_CHANNEL_INDEX  channelIndex)

Get feedback value.

This function compares the measured current in the contactor channel with a fixed threshold and assumes the contactor feedback to be closed when this threshold is passed on the channel.

Parameters
[in]channelIndexindex of the channel (contactor) that should be accessed
Returns
state of the channel's feedback

Definition at line 620 of file sps.c.

Here is the call graph for this function:

◆ SPS_GetChannelPexFeedback()

CONT_ELECTRICAL_STATE_TYPE_e SPS_GetChannelPexFeedback ( const SPS_CHANNEL_INDEX  channelIndex,
bool  normallyOpen 
)

Get the feedback state of a channel.

Retrieves the feedback state of a sps channel by looking up the appropriate channel in sps_kChannelFeedbackMapping and retrieving the value through the PEX API.

Parameters
[in]channelIndexnumber of the SPS channel that shall be checked
[in]normallyOpentrue if the feedback is normally open, false if not
Returns
state of the channel as reported by PEX

Definition at line 636 of file sps.c.

Here is the call graph for this function:

◆ SPS_Initialize()

void SPS_Initialize ( void  )

Initialize IOs for the SPS driver.

This function sets the necessary register (e.g., configure pins as input or output).

Definition at line 598 of file sps.c.

Here is the call graph for this function:

◆ SPS_RequestContactorState()

void SPS_RequestContactorState ( SPS_CHANNEL_INDEX  channelIndex,
SPS_CHANNEL_FUNCTION_e  channelFunction 
)

Request state of a contactor.

This function checks if the requested channel is affiliated to contactors and then passes the arguments on to SPS_RequestChannelState().

Parameters
[in]channelIndexnumber of the channel that should be accessed; This has to be a SPS channel and it has to be affiliated with SPS_AFF_CONTACTOR
[in]channelFunctionrequested functional state of the channel

Definition at line 602 of file sps.c.

Here is the call graph for this function:

◆ SPS_RequestGeneralIoState()

void SPS_RequestGeneralIoState ( SPS_CHANNEL_INDEX  channelIndex,
SPS_CHANNEL_FUNCTION_e  channelFunction 
)

Request state of a general IO.

This function checks if the requested channel is affiliated to general IO and then passes the arguments on to SPS_RequestChannelState().

Parameters
[in]channelIndexnumber of the channel that should be accessed; This has to be a SPS channel and it has to be affiliated with SPS_AFF_GENERAL_IO
[in]channelFunctionrequested functional state of the channel

Definition at line 611 of file sps.c.

Here is the call graph for this function: