foxBMS - Unit Tests  1.3.0
The foxBMS Unit Tests API Documentation
ltc_6813-1_cfg.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2022, 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 ltc_6813-1_cfg.c
44  * @author foxBMS Team
45  * @date 2015-02-18 (date of creation)
46  * @updated 2022-05-30 (date of last update)
47  * @version v1.3.0
48  * @ingroup DRIVERS_CONFIGURATION
49  * @prefix LTC
50  *
51  * @brief Configuration for the LTC monitoring chip
52  *
53  */
54 
55 /*========== Includes =======================================================*/
56 #include "ltc_6813-1_cfg.h"
57 
58 #include "tsi.h"
59 
60 /*========== Macros and Definitions =========================================*/
61 
62 /*========== Static Constant and Variable Definitions =======================*/
63 
64 /*========== Extern Constant and Variable Definitions =======================*/
65 /**
66  * Default multiplexer measurement sequence
67  * Must be adapted to the application
68  */
70  /* multiplexer 0 measurement */
71  {
72  .muxID = 0,
73  .muxCh = 0,
74  },
75  {
76  .muxID = 0,
77  .muxCh = 1,
78  },
79  {
80  .muxID = 0,
81  .muxCh = 2,
82  },
83  {
84  .muxID = 0,
85  .muxCh = 3,
86  },
87  {
88  .muxID = 0,
89  .muxCh = 4,
90  },
91  {
92  .muxID = 0,
93  .muxCh = 5,
94  },
95  {
96  .muxID = 0,
97  .muxCh = 6,
98  },
99  {
100  .muxID = 0,
101  .muxCh = 7,
102  },
103  /* ,
104  multiplexer 2 and 3 measurement
105  {
106  .muxID = 0,
107  .muxCh = 0xFF, disable enabled mux
108  },
109  {
110  .muxID = 1,
111  .muxCh = 0,
112  },
113  {
114  .muxID = 1,
115  .muxCh = 1,
116  },
117  {
118  .muxID = 1,
119  .muxCh = 2,
120  },
121  {
122  .muxID = 1,
123  .muxCh = 3,
124  },
125  {
126  .muxID = 1,
127  .muxCh = 4,
128  },
129  {
130  .muxID = 1,
131  .muxCh = 5,
132  },
133  {
134  .muxID = 1,
135  .muxCh = 6,
136  },
137  {
138  .muxID = 1,
139  .muxCh = 7,
140  },
141  {
142  .muxID = 1,
143  .muxCh = 0xFF, disable enabled mux
144  },
145 
146  {
147  .muxID = 2,
148  .muxCh = 0,
149  },
150  {
151  .muxID = 2,
152  .muxCh = 1,
153  },
154  {
155  .muxID = 2,
156  .muxCh = 2,
157  },
158  {
159  .muxID = 2,
160  .muxCh = 3,
161  },
162  {
163  .muxID = 2,
164  .muxCh = 4,
165  },
166  {
167  .muxID = 2,
168  .muxCh = 5,
169  },
170  {
171  .muxID = 2,
172  .muxCh = 6,
173  },
174  {
175  .muxID = 2,
176  .muxCh = 7,
177  }*/
178 };
179 
182  .nr_of_steps = (sizeof(ltc_mux_seq_main_ch1) / sizeof(LTC_MUX_CH_CFG_s))};
183 
185  1 - 1, /*!< index 0 = mux 0, ch 0 */
186  2 - 1, /*!< index 1 = mux 0, ch 1 */
187  3 - 1, /*!< index 2 = mux 0, ch 2 */
188  4 - 1, /*!< index 3 = mux 0, ch 3 */
189  5 - 1, /*!< index 4 = mux 0, ch 4 */
190  6 - 1, /*!< index 5 = mux 0, ch 5 */
191  7 - 1, /*!< index 6 = mux 0, ch 6 */
192  8 - 1, /*!< index 7 = mux 0, ch 7 */
193  /* 9-1 , !< index 8 = mux 1, ch 0 */
194  /* 10-1 , !< index 9 = mux 1, ch 1 */
195  /* 11-1 , !< index 10 = mux 1, ch 2 */
196  /* 12-1 , !< index 11 = mux 1, ch 3 */
197  /* 13-1 , !< index 12 = mux 1, ch 4 */
198  /* 14-1 , !< index 13 = mux 1, ch 5 */
199  /* 15-1 , !< index 14 = mux 1, ch 6 */
200  /* 16-1 !< index 15 = mux 1, ch 7 */
201 };
202 
204 #if (BS_MAX_SUPPORTED_CELLS == 12) || (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || \
205  (BS_MAX_SUPPORTED_CELLS == 36)
206  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
207 #endif
208 #if (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36)
209  1, 1, 1,
210 #endif
211 #if (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36)
212  1, 1, 1,
213 #endif
214 #if (BS_MAX_SUPPORTED_CELLS == 36)
215  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
216 
217 #endif
218 };
219 
220 /*========== Static Function Prototypes =====================================*/
221 
222 /*========== Static Function Implementations ================================*/
223 
224 /*========== Extern Function Implementations ================================*/
225 
226 int16_t LTC_ConvertMuxVoltagesToTemperatures(uint16_t adcVoltage_mV) {
227  return TSI_GetTemperature(adcVoltage_mV); /* Convert degree celsius to deci degree celsius */
228 }
229 
230 /*========== Externalized Static Function Implementations (Unit Test) =======*/
#define BS_MAX_SUPPORTED_CELLS
Defines the maximal number of supported cells per module.
#define BS_NR_OF_TEMP_SENSORS_PER_MODULE
number of temperature sensors per battery module
const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE]
const uint8_t ltc_voltage_input_used[BS_MAX_SUPPORTED_CELLS]
LTC_MUX_SEQUENCE_s ltc_mux_seq
LTC_MUX_CH_CFG_s ltc_mux_seq_main_ch1[]
int16_t LTC_ConvertMuxVoltagesToTemperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
Header for the configuration for the LTC 6804-1 6811-1, 6812-1, and 6813-1 monitoring IC.
uint8_t muxID
Definition: ltc_defs.h:423
LTC_MUX_CH_CFG_s * seqptr
Definition: ltc_defs.h:430
Temperature Sensor Interface on Slave Unit driver header.
int16_t TSI_GetTemperature(uint16_t adcVoltage_mV)
translate a voltage to a temperature