foxBMS  1.1.2
The foxBMS Battery Management System API Documentation
interlock.h File Reference

Headers for the driver for the interlock. More...

#include "interlock_cfg.h"
Include dependency graph for interlock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ILCK_STATE_s
 

Enumerations

enum  ILCK_STATEMACH_e {
  ILCK_STATEMACH_UNINITIALIZED , ILCK_STATEMACH_INITIALIZATION , ILCK_STATEMACH_INITIALIZED , ILCK_STATEMACH_WAIT_FIRST_REQUEST ,
  ILCK_STATEMACH_OPEN , ILCK_STATEMACH_CLOSED , ILCK_STATEMACH_UNDEFINED , ILCK_STATEMACH_ERROR
}
 
enum  ILCK_STATEMACH_SUB_e { ILCK_ENTRY }
 
enum  ILCK_STATE_REQUEST_e {
  ILCK_STATE_INIT_REQUEST , ILCK_STATE_OPEN_REQUEST , ILCK_STATE_CLOSE_REQUEST , ILCK_STATE_ERROR_REQUEST ,
  ILCK_STATE_NO_REQUEST
}
 
enum  ILCK_RETURN_TYPE_e {
  ILCK_OK , ILCK_BUSY_OK , ILCK_REQUEST_PENDING , ILCK_ILLEGAL_REQUEST ,
  ILCK_INIT_ERROR , ILCK_ERROR , ILCK_ALREADY_INITIALIZED , ILCK_ILLEGAL_TASK_TYPE
}
 

Functions

STD_RETURN_TYPE_e ILCK_Init (void)
 Checks the configuration of the interlock-module. More...
 
ILCK_ELECTRICAL_STATE_TYPE_e ILCK_GetInterlockFeedback (void)
 Reads the feedback pin of the interlock and returns its current value (ILCK_SWITCH_OFF/ILCK_SWITCH_ON) More...
 
ILCK_RETURN_TYPE_e ILCK_SetStateRequest (ILCK_STATE_REQUEST_e statereq)
 sets the current state request of the state variable ilck_state. More...
 
ILCK_STATEMACH_e ILCK_GetState (void)
 gets the current state. More...
 
void ILCK_Trigger (void)
 trigger function for the ILCK driver state machine. More...
 

Detailed Description

Headers for the driver for the interlock.

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-02-24 (date of last update)
Prefix
ILCK

Definition in file interlock.h.

Enumeration Type Documentation

◆ ILCK_RETURN_TYPE_e

Possible return values when state requests are made to the ILCK statemachine

Enumerator
ILCK_OK 

ILCK --> ok

ILCK_BUSY_OK 

ILCK under load --> ok

ILCK_REQUEST_PENDING 

requested to be executed

ILCK_ILLEGAL_REQUEST 

Request can not be executed

ILCK_INIT_ERROR 

Error state: Source: Initialization

ILCK_ERROR 

General error state

ILCK_ALREADY_INITIALIZED 

Initialization of ilck already finished

ILCK_ILLEGAL_TASK_TYPE 

Illegal

Definition at line 98 of file interlock.h.

◆ ILCK_STATE_REQUEST_e

State requests for the ILCK statemachine

Enumerator
ILCK_STATE_INIT_REQUEST 
ILCK_STATE_OPEN_REQUEST 
ILCK_STATE_CLOSE_REQUEST 
ILCK_STATE_ERROR_REQUEST 
ILCK_STATE_NO_REQUEST 

Definition at line 87 of file interlock.h.

◆ ILCK_STATEMACH_e

States of the ILCK state machine

Enumerator
ILCK_STATEMACH_UNINITIALIZED 

Uninitialized state

ILCK_STATEMACH_INITIALIZATION 

Initialization state

ILCK_STATEMACH_INITIALIZED 

statemachine initialized

ILCK_STATEMACH_WAIT_FIRST_REQUEST 

wait for open/close request

ILCK_STATEMACH_OPEN 

state to open interlock

ILCK_STATEMACH_CLOSED 

state to close interlock

ILCK_STATEMACH_UNDEFINED 

undefined state

ILCK_STATEMACH_ERROR 

Error-State:

Definition at line 65 of file interlock.h.

◆ ILCK_STATEMACH_SUB_e

Substates of the ILCK state machine

Enumerator
ILCK_ENTRY 

Substate entry state

Definition at line 80 of file interlock.h.

Function Documentation

◆ ILCK_GetInterlockFeedback()

ILCK_ELECTRICAL_STATE_TYPE_e ILCK_GetInterlockFeedback ( void  )

Reads the feedback pin of the interlock and returns its current value (ILCK_SWITCH_OFF/ILCK_SWITCH_ON)

Returns
measuredInterlockState (type: ILCK_ELECTRICAL_STATE_TYPE_e)

Definition at line 287 of file interlock.c.

Here is the call graph for this function:

◆ ILCK_GetState()

ILCK_STATEMACH_e ILCK_GetState ( void  )

gets the current state.

This function is used in the functioning of the ILCK state machine.

Returns
current state, taken from ILCK_STATEMACH_e

Definition at line 302 of file interlock.c.

◆ ILCK_Init()

STD_RETURN_TYPE_e ILCK_Init ( void  )

Checks the configuration of the interlock-module.

Returns
retVal (type: STD_RETURN_TYPE_e)

◆ ILCK_SetStateRequest()

ILCK_RETURN_TYPE_e ILCK_SetStateRequest ( ILCK_STATE_REQUEST_e  statereq)

sets the current state request of the state variable ilck_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 ILCK_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.

Parameters
statereqstate request to set
Returns
retVal current state request, taken from ILCK_STATE_REQUEST_e

Definition at line 306 of file interlock.c.

Here is the call graph for this function:

◆ ILCK_Trigger()

void ILCK_Trigger ( void  )

trigger function for the ILCK driver state machine.

This function contains the sequence of events in the ILCK state machine. It must be called time-triggered, every 1ms.

Definition at line 320 of file interlock.c.

Here is the call graph for this function: