foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Driver for the interlock. More...
Go to the source code of this file.
Macros | |
#define | ILCK_SAVELASTSTATES() |
#define | ILCK_CLOSEINTERLOCK() ILCK_SwitchInterlockOn() |
#define | ILCK_OPENINTERLOCK() ILCK_SwitchInterlockOff() |
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) |
gets the current state request. More... | |
static uint8_t | ILCK_CheckReEntrance (void) |
re-entrance check of ILCK state machine trigger function More... | |
static void | ILCK_CheckFeedback (void) |
checks interlock feedback More... | |
static ILCK_ELECTRICAL_STATE_TYPE_e | ILCK_GetInterlockSetValue () |
Gets the latest value (ILCK_SWITCH_ON, ILCK_SWITCH_OFF) the interlock was set to. More... | |
static STD_RETURN_TYPE_e | ILCK_SetInterlockState (ILCK_ELECTRICAL_STATE_TYPE_e requestedInterlockState) |
Sets the interlock state to its requested state, if the interlock is at that time not in the requested state. It returns STD_OK if the requested state was successfully set or if the interlock was at the requested state before. More... | |
static STD_RETURN_TYPE_e | ILCK_SwitchInterlockOff (void) |
Switches the interlock off and returns STD_NOT_OK on success. More... | |
static STD_RETURN_TYPE_e | ILCK_SwitchInterlockOn (void) |
Switches the interlock on and returns STD_OK on success. More... | |
static void | ILCK_Init_Pins (void) |
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) |
Variables | |
static ILCK_STATE_s | ilck_state |
Driver for the interlock.
BSD 3-Clause License 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:
″This product uses parts of foxBMS®″
″This product includes parts of foxBMS®″
″This product is derived from foxBMS®″
Definition in file interlock.c.
#define ILCK_CLOSEINTERLOCK | ( | ) | ILCK_SwitchInterlockOn() |
provides more clear name for ILCK_SwitchInterlockOn()
Definition at line 72 of file interlock.c.
#define ILCK_OPENINTERLOCK | ( | ) | ILCK_SwitchInterlockOff() |
provides more clear name for ILCK_SwitchInterlockOff()
Definition at line 74 of file interlock.c.
#define ILCK_SAVELASTSTATES | ( | ) |
Saves the last state and the last substate
Definition at line 67 of file interlock.c.
|
static |
checks interlock feedback
This function is used to check interlock feedback.
Definition at line 206 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 188 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 117 of file interlock.c.
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)
Definition at line 287 of file interlock.c.
|
static |
Gets the latest value (ILCK_SWITCH_ON, ILCK_SWITCH_OFF) the interlock was set to.
Meaning of the return value:
Definition at line 230 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 302 of file interlock.c.
|
static |
initializes the pins of the interlock to default state
Definition at line 281 of file interlock.c.
|
static |
Sets the interlock state to its requested state, if the interlock is at that time not in the requested state. It returns STD_OK if the requested state was successfully set or if the interlock was at the requested state before.
requestedInterlockState | open or close interlock |
Definition at line 244 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 306 of file interlock.c.
|
static |
Switches the interlock off and returns STD_NOT_OK on success.
Definition at line 264 of file interlock.c.
|
static |
Switches the interlock on and returns STD_OK on success.
Definition at line 274 of file interlock.c.
|
static |
gets the current state request.
This function is used in the functioning of the ILCK state machine. It is kept as comment for compatibility.
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 167 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 320 of file interlock.c.
void TEST_ILCK_SetStateStruct | ( | ILCK_STATE_s | state | ) |
Definition at line 432 of file interlock.c.
|
static |
contains the state of the contactor state machine
Definition at line 80 of file interlock.c.