foxBMS - Unit Tests
1.5.0
The foxBMS Unit Tests API Documentation
|
Driver for the interlock. More...
#include "interlock.h"
#include "database.h"
#include "diag.h"
#include "io.h"
#include "os.h"
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | ILCK_SAVELASTSTATES() |
Functions | |
static ILCK_RETURN_TYPE_e | ILCK_CheckStateRequest (ILCK_STATE_REQUEST_e statereq) |
checks the state requests that are made. More... | |
static ILCK_STATE_REQUEST_e | ILCK_TransferStateRequest (void) |
transfers the current state request to the state machine. More... | |
static uint8_t | ILCK_CheckReEntrance (void) |
re-entrance check of ILCK state machine trigger function More... | |
static void | ILCK_InitializePins (void) |
Initializes required pins for interlock evaluation. More... | |
static 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_STATEMACH_e | ILCK_GetState (void) |
gets the current state. More... | |
ILCK_RETURN_TYPE_e | ILCK_SetStateRequest (ILCK_STATE_REQUEST_e statereq) |
sets the current state request of the state variable ilck_state. More... | |
void | ILCK_Trigger (void) |
trigger function for the ILCK driver state machine. More... | |
void | TEST_ILCK_SetStateStruct (ILCK_STATE_s state) |
ILCK_ELECTRICAL_STATE_TYPE_e | TEST_ILCK_GetInterlockFeedback (void) |
Variables | |
static ILCK_STATE_s | ilck_state |
static DATA_BLOCK_INTERLOCK_FEEDBACK_s | ilck_tableFeedback = {.header.uniqueId = DATA_BLOCK_ID_INTERLOCK_FEEDBACK} |
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:
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:
The interlock driver measures the relevant hardware signals from the interlock circuit. For details on available hardware signals please refer to the section on this module in the foxBMS documentation.
In reference to the names in the foxBMS schematic, this module uses the following names:
shorthand | meaning |
---|---|
IL | interlock |
HS | high-side |
LS | low-side |
VS | voltage sense |
CS | current sense |
Definition in file interlock.c.
#define ILCK_SAVELASTSTATES | ( | ) |
Saves the last state and the last substate
Definition at line 85 of file interlock.c.
|
static |
re-entrance check of ILCK 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 ilck_state. 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 184 of file interlock.c.
|
static |
checks the state requests that are made.
This function checks the validity of the state requests. The results of the checked is returned immediately.
statereq | state request to be checked |
Definition at line 154 of file interlock.c.
|
static |
Reads the feedback pin of the interlock and returns its current value (ILCK_SWITCH_OFF/ILCK_SWITCH_ON)
Local variable containing voltages measured on TMS570 ADC1 inputs
Pin low: interlock closed, pin high: interlock open
Definition at line 207 of file interlock.c.
ILCK_STATEMACH_e ILCK_GetState | ( | void | ) |
gets the current state.
This function is used in the functioning of the ILCK state machine.
Definition at line 250 of file interlock.c.
|
static |
Initializes required pins for interlock evaluation.
Definition at line 198 of file interlock.c.
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.
statereq | state request to set |
Definition at line 254 of file interlock.c.
|
static |
transfers the current state request to the state machine.
This function takes the current state request from ilck_state and transfers it to the state machine. It resets the value from ilck_state to ILCK_STATE_NO_REQUEST
Definition at line 173 of file interlock.c.
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 268 of file interlock.c.
ILCK_ELECTRICAL_STATE_TYPE_e TEST_ILCK_GetInterlockFeedback | ( | void | ) |
void TEST_ILCK_SetStateStruct | ( | ILCK_STATE_s | state | ) |
Definition at line 325 of file interlock.c.
|
static |
contains the state of the contactor state machine
Definition at line 93 of file interlock.c.
|
static |
Local variable containing interlock feedback
Definition at line 106 of file interlock.c.