LTC6811 Battery Management System with ADuCM3029.

Committer:
APS_Lab
Date:
Wed Feb 07 08:26:04 2018 +0000
Revision:
0:f06ed53310a3
Ver1.0;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
APS_Lab 0:f06ed53310a3 1 /*
APS_Lab 0:f06ed53310a3 2 LTC6811-1: Multicell Battery Monitor
APS_Lab 0:f06ed53310a3 3 LTC6811.h
APS_Lab 0:f06ed53310a3 4 */
APS_Lab 0:f06ed53310a3 5
APS_Lab 0:f06ed53310a3 6 #ifndef LTC6811_H
APS_Lab 0:f06ed53310a3 7 #define LTC6811_H
APS_Lab 0:f06ed53310a3 8
APS_Lab 0:f06ed53310a3 9 #include "mbed.h"
APS_Lab 0:f06ed53310a3 10 //#include <stdint.h>
APS_Lab 0:f06ed53310a3 11 #include "LTC681x.h"
APS_Lab 0:f06ed53310a3 12
APS_Lab 0:f06ed53310a3 13 #define CELL 1
APS_Lab 0:f06ed53310a3 14 #define AUX 2
APS_Lab 0:f06ed53310a3 15 #define STAT 3
APS_Lab 0:f06ed53310a3 16
APS_Lab 0:f06ed53310a3 17
APS_Lab 0:f06ed53310a3 18
APS_Lab 0:f06ed53310a3 19 void LTC6811_init_reg_limits(uint8_t total_ic, cell_asic ic[]);
APS_Lab 0:f06ed53310a3 20
APS_Lab 0:f06ed53310a3 21
APS_Lab 0:f06ed53310a3 22 /*! Starts the Mux Decoder diagnostic self test
APS_Lab 0:f06ed53310a3 23
APS_Lab 0:f06ed53310a3 24 Running this command will start the Mux Decoder Diagnostic Self Test
APS_Lab 0:f06ed53310a3 25 This test takes roughly 1mS to complete. The MUXFAIL bit will be updated,
APS_Lab 0:f06ed53310a3 26 the bit will be set to 1 for a failure and 0 if the test has been passed.
APS_Lab 0:f06ed53310a3 27
APS_Lab 0:f06ed53310a3 28 */
APS_Lab 0:f06ed53310a3 29 void LTC6811_diagn();
APS_Lab 0:f06ed53310a3 30
APS_Lab 0:f06ed53310a3 31
APS_Lab 0:f06ed53310a3 32 //! Sends the poll adc command
APS_Lab 0:f06ed53310a3 33 //! @returns 1 byte read back after a pladc command. If the byte is not 0xFF ADC conversion has completed
APS_Lab 0:f06ed53310a3 34 uint8_t LTC6811_pladc();
APS_Lab 0:f06ed53310a3 35
APS_Lab 0:f06ed53310a3 36
APS_Lab 0:f06ed53310a3 37 //! This function will block operation until the ADC has finished it's conversion
APS_Lab 0:f06ed53310a3 38 //! @returns the approximate time it took for the ADC function to complete.
APS_Lab 0:f06ed53310a3 39 uint32_t LTC6811_pollAdc();
APS_Lab 0:f06ed53310a3 40
APS_Lab 0:f06ed53310a3 41 /*! Starts cell voltage conversion
APS_Lab 0:f06ed53310a3 42 */
APS_Lab 0:f06ed53310a3 43 void LTC6811_adcv(uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 44 uint8_t DCP, //!< Controls if Discharge is permitted during conversion
APS_Lab 0:f06ed53310a3 45 uint8_t CH //!< Sets which Cell channels are converted
APS_Lab 0:f06ed53310a3 46 );
APS_Lab 0:f06ed53310a3 47
APS_Lab 0:f06ed53310a3 48 /*! Starts cell voltage and GPIO 1&2 conversion
APS_Lab 0:f06ed53310a3 49 */
APS_Lab 0:f06ed53310a3 50 void LTC6811_adcvax(
APS_Lab 0:f06ed53310a3 51 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 52 uint8_t DCP //!< Controls if Discharge is permitted during conversion
APS_Lab 0:f06ed53310a3 53 );
APS_Lab 0:f06ed53310a3 54
APS_Lab 0:f06ed53310a3 55
APS_Lab 0:f06ed53310a3 56 /*! Starts cell voltage self test conversion
APS_Lab 0:f06ed53310a3 57 */
APS_Lab 0:f06ed53310a3 58 void LTC6811_cvst(
APS_Lab 0:f06ed53310a3 59 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 60 uint8_t ST //!< Self Test Mode
APS_Lab 0:f06ed53310a3 61 );
APS_Lab 0:f06ed53310a3 62
APS_Lab 0:f06ed53310a3 63 /*! Starts cell voltage and SOC conversion
APS_Lab 0:f06ed53310a3 64 */
APS_Lab 0:f06ed53310a3 65 void LTC6811_adcvsc(
APS_Lab 0:f06ed53310a3 66 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 67 uint8_t DCP //!< Controls if Discharge is permitted during conversion
APS_Lab 0:f06ed53310a3 68 );
APS_Lab 0:f06ed53310a3 69 /*! Starts cell voltage overlap conversion
APS_Lab 0:f06ed53310a3 70 */
APS_Lab 0:f06ed53310a3 71 void LTC6811_adol(
APS_Lab 0:f06ed53310a3 72 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 73 uint8_t DCP //!< Discharge permitted during conversion
APS_Lab 0:f06ed53310a3 74 );
APS_Lab 0:f06ed53310a3 75
APS_Lab 0:f06ed53310a3 76 /*! Start an open wire Conversion
APS_Lab 0:f06ed53310a3 77 */
APS_Lab 0:f06ed53310a3 78 void LTC6811_adow(
APS_Lab 0:f06ed53310a3 79 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 80 uint8_t PUP //!< Controls if Discharge is permitted during conversion
APS_Lab 0:f06ed53310a3 81 );
APS_Lab 0:f06ed53310a3 82
APS_Lab 0:f06ed53310a3 83
APS_Lab 0:f06ed53310a3 84 /*! Start a GPIO and Vref2 Conversion
APS_Lab 0:f06ed53310a3 85 */
APS_Lab 0:f06ed53310a3 86 void LTC6811_adax(
APS_Lab 0:f06ed53310a3 87 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 88 uint8_t CHG //!< Sets which GPIO channels are converted
APS_Lab 0:f06ed53310a3 89 );
APS_Lab 0:f06ed53310a3 90
APS_Lab 0:f06ed53310a3 91 /*! Start an GPIO Redundancy test
APS_Lab 0:f06ed53310a3 92 */
APS_Lab 0:f06ed53310a3 93 void LTC6811_adaxd(
APS_Lab 0:f06ed53310a3 94 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 95 uint8_t CHG //!< Sets which GPIO channels are converted
APS_Lab 0:f06ed53310a3 96 );
APS_Lab 0:f06ed53310a3 97
APS_Lab 0:f06ed53310a3 98 /*! Start an Auxiliary Register Self Test Conversion
APS_Lab 0:f06ed53310a3 99 */
APS_Lab 0:f06ed53310a3 100 void LTC6811_axst(
APS_Lab 0:f06ed53310a3 101 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 102 uint8_t ST //!< Sets if self test 1 or 2 is run
APS_Lab 0:f06ed53310a3 103 );
APS_Lab 0:f06ed53310a3 104
APS_Lab 0:f06ed53310a3 105 /*! Start a Status ADC Conversion
APS_Lab 0:f06ed53310a3 106 */
APS_Lab 0:f06ed53310a3 107 void LTC6811_adstat(
APS_Lab 0:f06ed53310a3 108 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 109 uint8_t CHST //!< Sets which Stat channels are converted
APS_Lab 0:f06ed53310a3 110 );
APS_Lab 0:f06ed53310a3 111
APS_Lab 0:f06ed53310a3 112 /*! Start a Status register redundancy test Conversion
APS_Lab 0:f06ed53310a3 113 */
APS_Lab 0:f06ed53310a3 114 void LTC6811_adstatd(
APS_Lab 0:f06ed53310a3 115 uint8_t MD, //!< ADC Mode
APS_Lab 0:f06ed53310a3 116 uint8_t CHST //!< Sets which Status channels are converted
APS_Lab 0:f06ed53310a3 117 );
APS_Lab 0:f06ed53310a3 118
APS_Lab 0:f06ed53310a3 119
APS_Lab 0:f06ed53310a3 120 /*! Start a Status Register Self Test Conversion
APS_Lab 0:f06ed53310a3 121 */
APS_Lab 0:f06ed53310a3 122 void LTC6811_statst(
APS_Lab 0:f06ed53310a3 123 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 124 uint8_t ST //!< Sets if self test 1 or 2 is run
APS_Lab 0:f06ed53310a3 125 );
APS_Lab 0:f06ed53310a3 126
APS_Lab 0:f06ed53310a3 127 /*! Reads and parses the LTC6811 cell voltage registers.
APS_Lab 0:f06ed53310a3 128
APS_Lab 0:f06ed53310a3 129 @return int8_t, PEC Status.
APS_Lab 0:f06ed53310a3 130 0: No PEC error detected
APS_Lab 0:f06ed53310a3 131 -1: PEC error detected, retry read
APS_Lab 0:f06ed53310a3 132 */
APS_Lab 0:f06ed53310a3 133 uint8_t LTC6811_rdcv(uint8_t reg, //!< controls which cell voltage register is read back.
APS_Lab 0:f06ed53310a3 134 uint8_t total_ic, //!< the number of ICs in the daisy chain(-1 only)
APS_Lab 0:f06ed53310a3 135 cell_asic ic[] //!< array of the parsed cell codes from lowest to highest.
APS_Lab 0:f06ed53310a3 136 );
APS_Lab 0:f06ed53310a3 137
APS_Lab 0:f06ed53310a3 138
APS_Lab 0:f06ed53310a3 139
APS_Lab 0:f06ed53310a3 140 /*! Reads and parses the LTC6811 auxiliary registers.
APS_Lab 0:f06ed53310a3 141 @return int8_t, PEC Status
APS_Lab 0:f06ed53310a3 142 0: No PEC error detected
APS_Lab 0:f06ed53310a3 143 -1: PEC error detected, retry read
APS_Lab 0:f06ed53310a3 144 */
APS_Lab 0:f06ed53310a3 145 int8_t LTC6811_rdaux(uint8_t reg, //!< controls which GPIO voltage register is read back
APS_Lab 0:f06ed53310a3 146 uint8_t nIC, //!< the number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 147 cell_asic ic[] //!< A two dimensional array of the parsed gpio voltage codes
APS_Lab 0:f06ed53310a3 148 );
APS_Lab 0:f06ed53310a3 149
APS_Lab 0:f06ed53310a3 150 /*! Reads and parses the LTC6811 stat registers.
APS_Lab 0:f06ed53310a3 151
APS_Lab 0:f06ed53310a3 152 @return int8_t, PEC Status
APS_Lab 0:f06ed53310a3 153 0: No PEC error detected
APS_Lab 0:f06ed53310a3 154 -1: PEC error detected, retry read
APS_Lab 0:f06ed53310a3 155 */
APS_Lab 0:f06ed53310a3 156 int8_t LTC6811_rdstat(uint8_t reg, //Determines which Stat register is read back.
APS_Lab 0:f06ed53310a3 157 uint8_t total_ic,//the number of ICs in the system
APS_Lab 0:f06ed53310a3 158 cell_asic ic[]
APS_Lab 0:f06ed53310a3 159 );
APS_Lab 0:f06ed53310a3 160
APS_Lab 0:f06ed53310a3 161 /*! Clears the LTC6811 cell voltage registers
APS_Lab 0:f06ed53310a3 162 */
APS_Lab 0:f06ed53310a3 163 void LTC6811_clrcell();
APS_Lab 0:f06ed53310a3 164
APS_Lab 0:f06ed53310a3 165 /*! Clears the LTC6811 Auxiliary registers
APS_Lab 0:f06ed53310a3 166 */
APS_Lab 0:f06ed53310a3 167 void LTC6811_clraux();
APS_Lab 0:f06ed53310a3 168
APS_Lab 0:f06ed53310a3 169 /*! Clears the LTC6811 Stat registers
APS_Lab 0:f06ed53310a3 170 */
APS_Lab 0:f06ed53310a3 171 void LTC6811_clrstat();
APS_Lab 0:f06ed53310a3 172
APS_Lab 0:f06ed53310a3 173 /*! Clears the LTC6811 Sctrl registers
APS_Lab 0:f06ed53310a3 174 */
APS_Lab 0:f06ed53310a3 175 void LTC6811_clrsctrl();
APS_Lab 0:f06ed53310a3 176
APS_Lab 0:f06ed53310a3 177 /*! Write the LTC6811 configuration register
APS_Lab 0:f06ed53310a3 178 */
APS_Lab 0:f06ed53310a3 179 void LTC6811_wrcfg(uint8_t nIC, //!< The number of ICs being written
APS_Lab 0:f06ed53310a3 180 cell_asic ic[] //!< a two dimensional array of the configuration data that will be written
APS_Lab 0:f06ed53310a3 181 );
APS_Lab 0:f06ed53310a3 182
APS_Lab 0:f06ed53310a3 183 void LTC6811_wrcfgb(uint8_t nIC, //!< The number of ICs being written
APS_Lab 0:f06ed53310a3 184 cell_asic ic[] //!< a two dimensional array of the configuration data that will be written
APS_Lab 0:f06ed53310a3 185 );
APS_Lab 0:f06ed53310a3 186 /*! Reads configuration registers of a LTC6811 daisy chain
APS_Lab 0:f06ed53310a3 187 @return int8_t, PEC Status.
APS_Lab 0:f06ed53310a3 188 0: Data read back has matching PEC
APS_Lab 0:f06ed53310a3 189 -1: Data read back has incorrect PEC
APS_Lab 0:f06ed53310a3 190 */
APS_Lab 0:f06ed53310a3 191 int8_t LTC6811_rdcfg(uint8_t nIC, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 192 cell_asic ic[] //!< a two dimensional array that the function stores the read configuration data
APS_Lab 0:f06ed53310a3 193 );
APS_Lab 0:f06ed53310a3 194
APS_Lab 0:f06ed53310a3 195 int8_t LTC6811_rdcfgb(uint8_t nIC, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 196 cell_asic ic[] //!< a two dimensional array that the function stores the read configuration data
APS_Lab 0:f06ed53310a3 197 );
APS_Lab 0:f06ed53310a3 198 /*! Write the LTC6811 PWM register
APS_Lab 0:f06ed53310a3 199 */
APS_Lab 0:f06ed53310a3 200 void LTC6811_wrpwm(uint8_t nIC, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 201 uint8_t pwmReg,
APS_Lab 0:f06ed53310a3 202 cell_asic ic[]
APS_Lab 0:f06ed53310a3 203 );
APS_Lab 0:f06ed53310a3 204
APS_Lab 0:f06ed53310a3 205 /*! Reads pwm registers of a LTC6811 daisy chain
APS_Lab 0:f06ed53310a3 206
APS_Lab 0:f06ed53310a3 207 */
APS_Lab 0:f06ed53310a3 208 int8_t LTC6811_rdpwm(uint8_t nIC, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 209 uint8_t pwmReg,
APS_Lab 0:f06ed53310a3 210 cell_asic ic[] //!< a two dimensional array that the function stores the read pwm data
APS_Lab 0:f06ed53310a3 211 );
APS_Lab 0:f06ed53310a3 212
APS_Lab 0:f06ed53310a3 213 /*! Write the LTC6811 Sctrl register
APS_Lab 0:f06ed53310a3 214 */
APS_Lab 0:f06ed53310a3 215 void LTC6811_wrsctrl(uint8_t nIC, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 216 uint8_t sctrl_reg,
APS_Lab 0:f06ed53310a3 217 cell_asic ic[]
APS_Lab 0:f06ed53310a3 218 );
APS_Lab 0:f06ed53310a3 219
APS_Lab 0:f06ed53310a3 220
APS_Lab 0:f06ed53310a3 221 /*! Reads sctrl registers of a LTC6811 daisy chain
APS_Lab 0:f06ed53310a3 222 @return int8_t, PEC Status.
APS_Lab 0:f06ed53310a3 223 0: Data read back has matching PEC
APS_Lab 0:f06ed53310a3 224 -1: Data read back has incorrect PEC
APS_Lab 0:f06ed53310a3 225 */
APS_Lab 0:f06ed53310a3 226 int8_t LTC6811_rdsctrl(uint8_t nIC, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 227 uint8_t sctrl_reg,
APS_Lab 0:f06ed53310a3 228 cell_asic ic[] //!< a two dimensional array that the function stores the read pwm data
APS_Lab 0:f06ed53310a3 229 );
APS_Lab 0:f06ed53310a3 230
APS_Lab 0:f06ed53310a3 231
APS_Lab 0:f06ed53310a3 232 /*! Start Sctrl data communication
APS_Lab 0:f06ed53310a3 233 This command will start the sctrl pulse communication over the spins
APS_Lab 0:f06ed53310a3 234 */
APS_Lab 0:f06ed53310a3 235 void LTC6811_stsctrl();
APS_Lab 0:f06ed53310a3 236
APS_Lab 0:f06ed53310a3 237
APS_Lab 0:f06ed53310a3 238 /*! Write the LTC6811 COMM register
APS_Lab 0:f06ed53310a3 239 */
APS_Lab 0:f06ed53310a3 240 void LTC6811_wrcomm(uint8_t total_ic, //!< Number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 241 cell_asic ic[] //!< A two dimensional array of the comm data that will be written
APS_Lab 0:f06ed53310a3 242 );
APS_Lab 0:f06ed53310a3 243
APS_Lab 0:f06ed53310a3 244 /*! Reads comm registers of a LTC6811 daisy chain
APS_Lab 0:f06ed53310a3 245 @return int8_t, PEC Status.
APS_Lab 0:f06ed53310a3 246
APS_Lab 0:f06ed53310a3 247 0: Data read back has matching PEC
APS_Lab 0:f06ed53310a3 248
APS_Lab 0:f06ed53310a3 249 -1: Data read back has incorrect PEC
APS_Lab 0:f06ed53310a3 250
APS_Lab 0:f06ed53310a3 251 */
APS_Lab 0:f06ed53310a3 252 int8_t LTC6811_rdcomm(uint8_t total_ic, //!< number of ICs in the daisy chain
APS_Lab 0:f06ed53310a3 253 cell_asic ic[] //!< Two dimensional array that the function stores the read comm data.
APS_Lab 0:f06ed53310a3 254 );
APS_Lab 0:f06ed53310a3 255
APS_Lab 0:f06ed53310a3 256 /*! issues a stcomm command and clocks data out of the COMM register */
APS_Lab 0:f06ed53310a3 257 void LTC6811_stcomm();
APS_Lab 0:f06ed53310a3 258
APS_Lab 0:f06ed53310a3 259
APS_Lab 0:f06ed53310a3 260 /*! @returns returns the register data pattern for a given ADC MD and Self test */
APS_Lab 0:f06ed53310a3 261 uint16_t LTC6811_st_lookup(
APS_Lab 0:f06ed53310a3 262 uint8_t MD, //!< ADC Conversion Mode
APS_Lab 0:f06ed53310a3 263 uint8_t ST //!< Self test number
APS_Lab 0:f06ed53310a3 264 );
APS_Lab 0:f06ed53310a3 265
APS_Lab 0:f06ed53310a3 266 void LTC6811_set_discharge(int Cell,
APS_Lab 0:f06ed53310a3 267 uint8_t total_ic,
APS_Lab 0:f06ed53310a3 268 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 269
APS_Lab 0:f06ed53310a3 270 /*! Helper function that runs the ADC Self Tests*/
APS_Lab 0:f06ed53310a3 271 int16_t LTC6811_run_cell_adc_st(uint8_t adc_reg,
APS_Lab 0:f06ed53310a3 272 uint8_t total_ic,
APS_Lab 0:f06ed53310a3 273 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 274
APS_Lab 0:f06ed53310a3 275 /*! Helper function that runs the ADC Digital Redudancy commands and checks output for errors*/
APS_Lab 0:f06ed53310a3 276 int16_t LTC6811_run_adc_redundancy_st(uint8_t adc_mode,
APS_Lab 0:f06ed53310a3 277 uint8_t adc_reg,
APS_Lab 0:f06ed53310a3 278 uint8_t total_ic,
APS_Lab 0:f06ed53310a3 279 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 280
APS_Lab 0:f06ed53310a3 281 /*! Helper function that runs the datasheet open wire algorithm*/
APS_Lab 0:f06ed53310a3 282 void LTC6811_run_openwire(uint8_t total_ic,
APS_Lab 0:f06ed53310a3 283 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 284
APS_Lab 0:f06ed53310a3 285 void LTC6811_set_discharge(int Cell,
APS_Lab 0:f06ed53310a3 286 uint8_t total_ic,
APS_Lab 0:f06ed53310a3 287 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 288
APS_Lab 0:f06ed53310a3 289 /*! Helper Function that runs the ADC Overlap test*/
APS_Lab 0:f06ed53310a3 290 uint16_t LTC6811_run_adc_overlap(uint8_t total_ic,
APS_Lab 0:f06ed53310a3 291 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 292
APS_Lab 0:f06ed53310a3 293 /*! Helper Function that counts overall PEC errors and register/IC PEC errors*/
APS_Lab 0:f06ed53310a3 294 void LTC6811_check_pec(uint8_t total_ic,
APS_Lab 0:f06ed53310a3 295 uint8_t reg,
APS_Lab 0:f06ed53310a3 296 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 297
APS_Lab 0:f06ed53310a3 298 /*! Helper Function that resets the PEC error counters */
APS_Lab 0:f06ed53310a3 299 void LTC6811_reset_crc_count(uint8_t total_ic,
APS_Lab 0:f06ed53310a3 300 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 301
APS_Lab 0:f06ed53310a3 302 /*! Helper Function to initialize the CFGR data structures*/
APS_Lab 0:f06ed53310a3 303 void LTC6811_init_cfg(uint8_t total_ic,
APS_Lab 0:f06ed53310a3 304 cell_asic ic[]);
APS_Lab 0:f06ed53310a3 305
APS_Lab 0:f06ed53310a3 306 /*! Helper function to set appropriate bits in CFGR register based on bit function*/
APS_Lab 0:f06ed53310a3 307 void LTC6811_set_cfgr(uint8_t nIC,
APS_Lab 0:f06ed53310a3 308 cell_asic ic[],
APS_Lab 0:f06ed53310a3 309 bool refon,
APS_Lab 0:f06ed53310a3 310 bool adcopt,
APS_Lab 0:f06ed53310a3 311 bool gpio[5],
APS_Lab 0:f06ed53310a3 312 bool dcc[12]);
APS_Lab 0:f06ed53310a3 313
APS_Lab 0:f06ed53310a3 314 /*! Helper function to turn the refon bit HIGH or LOW*/
APS_Lab 0:f06ed53310a3 315 void LTC6811_set_cfgr_refon(uint8_t nIC,
APS_Lab 0:f06ed53310a3 316 cell_asic ic[],
APS_Lab 0:f06ed53310a3 317 bool refon);
APS_Lab 0:f06ed53310a3 318
APS_Lab 0:f06ed53310a3 319 /*! Helper function to turn the ADCOPT bit HIGH or LOW*/
APS_Lab 0:f06ed53310a3 320 void LTC6811_set_cfgr_adcopt(uint8_t nIC,
APS_Lab 0:f06ed53310a3 321 cell_asic ic[],
APS_Lab 0:f06ed53310a3 322 bool adcopt);
APS_Lab 0:f06ed53310a3 323
APS_Lab 0:f06ed53310a3 324 /*! Helper function to turn the GPIO bits HIGH or LOW*/
APS_Lab 0:f06ed53310a3 325 void LTC6811_set_cfgr_gpio(uint8_t nIC,
APS_Lab 0:f06ed53310a3 326 cell_asic ic[],
APS_Lab 0:f06ed53310a3 327 bool gpio[]);
APS_Lab 0:f06ed53310a3 328
APS_Lab 0:f06ed53310a3 329 /*! Helper function to turn the DCC bits HIGH or LOW*/
APS_Lab 0:f06ed53310a3 330 void LTC6811_set_cfgr_dis(uint8_t nIC,
APS_Lab 0:f06ed53310a3 331 cell_asic ic[],
APS_Lab 0:f06ed53310a3 332 bool dcc[]);
APS_Lab 0:f06ed53310a3 333 /*! Helper function to set uv field in CFGRA register*/
APS_Lab 0:f06ed53310a3 334 void LTC6811_set_cfgr_uv(uint8_t nIC,
APS_Lab 0:f06ed53310a3 335 cell_asic ic[],
APS_Lab 0:f06ed53310a3 336 uint16_t uv);
APS_Lab 0:f06ed53310a3 337
APS_Lab 0:f06ed53310a3 338 /*! Helper function to set ov field in CFGRA register*/
APS_Lab 0:f06ed53310a3 339 void LTC6811_set_cfgr_ov(uint8_t nIC,
APS_Lab 0:f06ed53310a3 340 cell_asic ic[],
APS_Lab 0:f06ed53310a3 341 uint16_t ov);
APS_Lab 0:f06ed53310a3 342
APS_Lab 0:f06ed53310a3 343 void LTC6811_init_max_min(uint8_t total_ic,
APS_Lab 0:f06ed53310a3 344 cell_asic ic[],
APS_Lab 0:f06ed53310a3 345 cell_asic ic_max[],
APS_Lab 0:f06ed53310a3 346 cell_asic ic_min[]);
APS_Lab 0:f06ed53310a3 347
APS_Lab 0:f06ed53310a3 348 void LTC6811_max_min(uint8_t total_ic, cell_asic ic_cells[],
APS_Lab 0:f06ed53310a3 349 cell_asic ic_min[],
APS_Lab 0:f06ed53310a3 350 cell_asic ic_max[],
APS_Lab 0:f06ed53310a3 351 cell_asic ic_delta[]);
APS_Lab 0:f06ed53310a3 352 #endif