foxBMS-UnitTests  1.0.0
The foxBMS Unit Tests API Documentation
interlock_cfg.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der
4  * angewandten Forschung e.V. All rights reserved.
5  *
6  * BSD 3-Clause License
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * We kindly request you to use one or more of the following phrases to refer
31  * to foxBMS in your hardware, software, documentation or advertising
32  * materials:
33  *
34  * ″This product uses parts of foxBMS®″
35  *
36  * ″This product includes parts of foxBMS®″
37  *
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_ */
ILCK_SWITCH_ON
@ ILCK_SWITCH_ON
Definition: interlock_cfg.h:97
ILCK_CONFIG::feedback_pin
uint32_t feedback_pin
Definition: interlock_cfg.h:121
general.h
TODO.
ILCK_SWITCH_UNDEF
@ ILCK_SWITCH_UNDEF
Definition: interlock_cfg.h:98
ILCK_ELECTRICAL_STATE
Definition: interlock_cfg.h:111
ILCK_CONFIG::control_pin
uint32_t control_pin
Definition: interlock_cfg.h:120
ILCK_CONFIG_s
struct ILCK_CONFIG ILCK_CONFIG_s
ILCK_FEEDBACK_NORMALLY_CLOSED
@ ILCK_FEEDBACK_NORMALLY_CLOSED
Definition: interlock_cfg.h:104
ILCK_FEEDBACK_TYPE_DONT_CARE
@ ILCK_FEEDBACK_TYPE_DONT_CARE
Definition: interlock_cfg.h:105
ILCK_ELECTRICAL_STATE::feedback
ILCK_ELECTRICAL_STATE_TYPE_e feedback
Definition: interlock_cfg.h:113
ILCK_SWITCH_OFF
@ ILCK_SWITCH_OFF
Definition: interlock_cfg.h:96
ILCK_ELECTRICAL_STATE_s
struct ILCK_ELECTRICAL_STATE ILCK_ELECTRICAL_STATE_s
ilck_interlock_config
ILCK_CONFIG_s ilck_interlock_config
Definition: interlock_cfg.c:62
ILCK_FEEDBACK_NORMALLY_OPEN
@ ILCK_FEEDBACK_NORMALLY_OPEN
Definition: interlock_cfg.h:103
ILCK_CONFIG::feedback_pin_type
ILCK_FEEDBACK_TYPE_e feedback_pin_type
Definition: interlock_cfg.h:122
ILCK_ELECTRICAL_STATE_TYPE
ILCK_ELECTRICAL_STATE_TYPE
Definition: interlock_cfg.h:95
ILCK_ELECTRICAL_STATE::set
ILCK_ELECTRICAL_STATE_TYPE_e set
Definition: interlock_cfg.h:112
ILCK_ELECTRICAL_STATE_TYPE_e
enum ILCK_ELECTRICAL_STATE_TYPE ILCK_ELECTRICAL_STATE_TYPE_e
ILCK_CONFIG
Definition: interlock_cfg.h:117
ilck_interlock_state
ILCK_ELECTRICAL_STATE_s ilck_interlock_state
Definition: interlock_cfg.c:64
ILCK_FEEDBACK_TYPE
ILCK_FEEDBACK_TYPE
Definition: interlock_cfg.h:102
ILCK_FEEDBACK_TYPE_e
enum ILCK_FEEDBACK_TYPE ILCK_FEEDBACK_TYPE_e