foxBMS  1.1.0
The foxBMS Battery Management System API Documentation
interlock_cfg.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file interlock_cfg.h
44  * @author foxBMS Team
45  * @date 2020-02-24 (date of creation)
46  * @updated 2020-02-24 (date of last update)
47  * @ingroup DRIVERS_CONFIGURATION
48  * @prefix ILCK
49  *
50  * @brief Header for the configuration for the driver for the interlock
51  *
52  */
53 
54 #ifndef FOXBMS__INTERLOCK_CFG_H_
55 #define FOXBMS__INTERLOCK_CFG_H_
56 
57 /*========== Includes =======================================================*/
58 #include "general.h"
59 
60 #include "HL_gio.h"
61 
62 /*========== Macros and Definitions =========================================*/
63 
64 /** IO register to which the interlock is connected */
65 #define ILCK_IO_REG (gioPORTA)
66 
67 /**
68  * The number of defines per contactor must be the same as the length
69  * of the array ilck_contactors_cfg in contactor_cfg.c
70  * Every contactor consists of 1 control pin and 1 feedback pin
71  * counting together as 1 contactor.
72  * E.g. if you have 1 contactor your define has to be:
73  * \verbatim #define ILCK_INTERLOCK_CONTROL (PIN_MCU_0_INTERLOCK_CONTROL)\endverbatim
74  * \verbatim #define ILCK_INTERLOCK_FEEDBACK (PIN_MCU_0_INTERLOCK_FEEDBACK)\endverbatim
75  */
76 #define ILCK_INTERLOCK_CONTROL (6U)
77 
78 /** Defines the pin where interlock feedback pin is connected to the mcu */
79 #define ILCK_INTERLOCK_FEEDBACK (0U)
80 
81 /**
82  * This define MUST represent the cycle time of the task in which context the
83  * functions run, e.g., if the ILCK_Trigger() is running in the 10 ms task
84  * then the define must be set to 10.
85  *
86  * This define also sets the minimum time.
87  */
88 
89 #define ILCK_TASK_CYCLE_CONTEXT_MS (10)
90 
91 /** ILCK statemachine short time definition in ms */
92 #define ILCK_STATEMACH_SHORTTIME_MS (ILCK_TASK_CYCLE_CONTEXT_MS)
93 
94 /** Symbolic names for contactors' possible states */
96  ILCK_SWITCH_OFF, /*!< Contactor off --> Contactor is open */
97  ILCK_SWITCH_ON, /*!< Contactor on --> Contactor is closed */
98  ILCK_SWITCH_UNDEF, /*!< Contactor undefined --> Contactor state not known */
100 
101 /** Symbolic names defining the electric behavior of the contactor */
102 typedef enum ILCK_FEEDBACK_TYPE {
103  ILCK_FEEDBACK_NORMALLY_OPEN, /*!< Feedback line of a contactor is normally open */
104  ILCK_FEEDBACK_NORMALLY_CLOSED, /*!< Feedback line of a contactor is normally closed */
105  ILCK_FEEDBACK_TYPE_DONT_CARE, /*!< Feedback line of the contactor is not used */
107 
108 /**
109  * struct describing the electrical state (expected and measured) of the interlock
110  */
111 typedef struct ILCK_ELECTRICAL_STATE {
115 
116 /** struct decribing the hardware configuration of the interlock */
117 typedef struct ILCK_CONFIG {
118  /* IO_PORTS_e control_pin; */
119  /* IO_PORTS_e feedback_pin; */
120  uint32_t control_pin;
121  uint32_t feedback_pin;
124 
125 /*========== Extern Constant and Variable Declarations ======================*/
126 /** configuration of the interlock */
128 /** electrical state of the interlock */
130 
131 /*========== Extern Function Prototypes =====================================*/
132 
133 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
134 
135 #endif /* FOXBMS__INTERLOCK_CFG_H_ */
General macros and definitions for the whole platform.
struct ILCK_CONFIG ILCK_CONFIG_s
enum ILCK_FEEDBACK_TYPE ILCK_FEEDBACK_TYPE_e
ILCK_FEEDBACK_TYPE
@ ILCK_FEEDBACK_TYPE_DONT_CARE
@ ILCK_FEEDBACK_NORMALLY_CLOSED
@ ILCK_FEEDBACK_NORMALLY_OPEN
ILCK_ELECTRICAL_STATE_TYPE
Definition: interlock_cfg.h:95
@ ILCK_SWITCH_ON
Definition: interlock_cfg.h:97
@ ILCK_SWITCH_UNDEF
Definition: interlock_cfg.h:98
@ ILCK_SWITCH_OFF
Definition: interlock_cfg.h:96
ILCK_ELECTRICAL_STATE_s ilck_interlock_state
Definition: interlock_cfg.c:64
enum ILCK_ELECTRICAL_STATE_TYPE ILCK_ELECTRICAL_STATE_TYPE_e
ILCK_CONFIG_s ilck_interlock_config
Definition: interlock_cfg.c:62
struct ILCK_ELECTRICAL_STATE ILCK_ELECTRICAL_STATE_s
ILCK_FEEDBACK_TYPE_e feedback_pin_type
uint32_t feedback_pin
uint32_t control_pin
ILCK_ELECTRICAL_STATE_TYPE_e feedback
ILCK_ELECTRICAL_STATE_TYPE_e set