LTC6811
LTC6811.cpp File Reference
Go to the source code of this file.
Functions | |
void | LTC6811_adcv (uint8_t MD, uint8_t DCP, uint8_t CH) |
void | LTC6811_adcvsc (uint8_t MD, uint8_t DCP) |
void | LTC6811_adcvax (uint8_t MD, uint8_t DCP) |
void | LTC6811_adol (uint8_t MD, uint8_t DCP) |
void | LTC6811_cvst (uint8_t MD, uint8_t ST) |
void | LTC6811_axst (uint8_t MD, uint8_t ST) |
void | LTC6811_statst (uint8_t MD, uint8_t ST) |
uint8_t | LTC6811_pladc () |
Sends the poll adc command. | |
uint32_t | LTC6811_pollAdc () |
This function will block operation until the ADC has finished it's conversion. | |
void | LTC6811_adax (uint8_t MD, uint8_t CHG) |
void | LTC6811_adaxd (uint8_t MD, uint8_t CHG) |
void | LTC6811_adstat (uint8_t MD, uint8_t CHST) |
void | LTC6811_adstatd (uint8_t MD, uint8_t CHST) |
void | LTC6811_adow (uint8_t MD, uint8_t PUP) |
uint8_t | LTC6811_rdcv (uint8_t reg, uint8_t total_ic, cell_asic ic[]) |
int8_t | LTC6811_rdaux (uint8_t reg, uint8_t total_ic, cell_asic ic[]) |
int8_t | LTC6811_rdstat (uint8_t reg, uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_clrcell () |
void | LTC6811_clraux () |
void | LTC6811_clrstat () |
void | LTC6811_clrsctrl () |
void | LTC6811_diagn () |
void | LTC6811_wrcfg (uint8_t total_ic, cell_asic ic[]) |
int8_t | LTC6811_rdcfg (uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_wrpwm (uint8_t total_ic, uint8_t pwmReg, cell_asic ic[]) |
int8_t | LTC6811_rdpwm (uint8_t total_ic, uint8_t pwmReg, cell_asic ic[]) |
void | LTC6811_wrcomm (uint8_t total_ic, cell_asic ic[]) |
int8_t | LTC6811_rdcomm (uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_stcomm () |
int16_t | LTC6811_run_cell_adc_st (uint8_t adc_reg, uint8_t total_ic, cell_asic ic[]) |
int16_t | LTC6811_run_adc_redundancy_st (uint8_t adc_mode, uint8_t adc_reg, uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_run_openwire (uint8_t total_ic, cell_asic ic[]) |
uint16_t | LTC6811_run_adc_overlap (uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_check_pec (uint8_t total_ic, uint8_t reg, cell_asic ic[]) |
void | LTC6811_reset_crc_count (uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_init_cfg (uint8_t total_ic, cell_asic ic[]) |
void | LTC6811_set_cfgr (uint8_t nIC, cell_asic ic[], bool refon, bool adcopt, bool gpio[5], bool dcc[12]) |
void | LTC6811_set_cfgr_refon (uint8_t nIC, cell_asic ic[], bool refon) |
void | LTC6811_set_cfgr_adcopt (uint8_t nIC, cell_asic ic[], bool adcopt) |
void | LTC6811_set_cfgr_uv (uint8_t nIC, cell_asic ic[], uint16_t uv) |
void | LTC6811_set_cfgr_ov (uint8_t nIC, cell_asic ic[], uint16_t ov) |
Detailed Description
Library for LTC6811-1 Multicell Battery Monitor
Definition in file LTC6811.cpp.
Function Documentation
void LTC6811_adax | ( | uint8_t | MD, |
uint8_t | CHG | ||
) |
Start a GPIO and Vref2 Conversion
- Parameters:
-
MD ADC Conversion Mode CHG Sets which GPIO channels are converted
Definition at line 167 of file LTC6811.cpp.
void LTC6811_adaxd | ( | uint8_t | MD, |
uint8_t | CHG | ||
) |
Start an GPIO Redundancy test
- Parameters:
-
MD ADC Conversion Mode CHG Sets which GPIO channels are converted
Definition at line 176 of file LTC6811.cpp.
void LTC6811_adcv | ( | uint8_t | MD, |
uint8_t | DCP, | ||
uint8_t | CH | ||
) |
Starts cell voltage conversion
- Parameters:
-
MD ADC Conversion Mode DCP Controls if Discharge is permitted during conversion CH Sets which Cell channels are converted
Definition at line 91 of file LTC6811.cpp.
void LTC6811_adcvax | ( | uint8_t | MD, |
uint8_t | DCP | ||
) |
Starts cell voltage and GPIO 1&2 conversion
- Parameters:
-
MD ADC Conversion Mode DCP Controls if Discharge is permitted during conversion
Definition at line 110 of file LTC6811.cpp.
void LTC6811_adcvsc | ( | uint8_t | MD, |
uint8_t | DCP | ||
) |
Starts cell voltage and SOC conversion
- Parameters:
-
MD ADC Conversion Mode DCP Controls if Discharge is permitted during conversion
Definition at line 101 of file LTC6811.cpp.
void LTC6811_adol | ( | uint8_t | MD, |
uint8_t | DCP | ||
) |
Starts cell voltage overlap conversion
- Parameters:
-
MD ADC Conversion Mode DCP Discharge permitted during conversion
Definition at line 119 of file LTC6811.cpp.
void LTC6811_adow | ( | uint8_t | MD, |
uint8_t | PUP | ||
) |
Start an open wire Conversion
- Parameters:
-
MD ADC Conversion Mode PUP Controls if Discharge is permitted during conversion
Definition at line 204 of file LTC6811.cpp.
void LTC6811_adstat | ( | uint8_t | MD, |
uint8_t | CHST | ||
) |
Start a Status ADC Conversion
- Parameters:
-
MD ADC Conversion Mode CHST Sets which Stat channels are converted
Definition at line 185 of file LTC6811.cpp.
void LTC6811_adstatd | ( | uint8_t | MD, |
uint8_t | CHST | ||
) |
Start a Status register redundancy test Conversion
- Parameters:
-
MD ADC Mode CHST Sets which Status channels are converted
Definition at line 194 of file LTC6811.cpp.
void LTC6811_axst | ( | uint8_t | MD, |
uint8_t | ST | ||
) |
Start an Auxiliary Register Self Test Conversion
- Parameters:
-
MD ADC Conversion Mode ST Sets if self test 1 or 2 is run
Definition at line 137 of file LTC6811.cpp.
void LTC6811_check_pec | ( | uint8_t | total_ic, |
uint8_t | reg, | ||
cell_asic | ic[] | ||
) |
Helper Function that counts overall PEC errors and register/IC PEC errors
Definition at line 460 of file LTC6811.cpp.
void LTC6811_clraux | ( | ) |
Clears the LTC6811 Auxiliary registers
Definition at line 270 of file LTC6811.cpp.
void LTC6811_clrcell | ( | ) |
Clears the LTC6811 cell voltage registers
Definition at line 260 of file LTC6811.cpp.
void LTC6811_clrsctrl | ( | ) |
Clears the LTC6811 Sctrl registers
Definition at line 291 of file LTC6811.cpp.
void LTC6811_clrstat | ( | ) |
Clears the LTC6811 Stat registers
Definition at line 281 of file LTC6811.cpp.
void LTC6811_cvst | ( | uint8_t | MD, |
uint8_t | ST | ||
) |
Starts cell voltage self test conversion
- Parameters:
-
MD ADC Conversion Mode ST Self Test Mode
Definition at line 128 of file LTC6811.cpp.
void LTC6811_diagn | ( | ) |
Starts the Mux Decoder diagnostic self test
Running this command will start the Mux Decoder Diagnostic Self Test This test takes roughly 1mS to complete. The MUXFAIL bit will be updated, the bit will be set to 1 for a failure and 0 if the test has been passed.
Definition at line 297 of file LTC6811.cpp.
void LTC6811_init_cfg | ( | uint8_t | total_ic, |
cell_asic | ic[] | ||
) |
Helper Function to initialize the CFGR data structures
Definition at line 472 of file LTC6811.cpp.
uint8_t LTC6811_pladc | ( | ) |
Sends the poll adc command.
- Returns:
- 1 byte read back after a pladc command. If the byte is not 0xFF ADC conversion has completed
Definition at line 155 of file LTC6811.cpp.
uint32_t LTC6811_pollAdc | ( | ) |
This function will block operation until the ADC has finished it's conversion.
- Returns:
- the approximate time it took for the ADC function to complete.
Definition at line 161 of file LTC6811.cpp.
int8_t LTC6811_rdaux | ( | uint8_t | reg, |
uint8_t | nIC, | ||
cell_asic | ic[] | ||
) |
Reads and parses the LTC6811 auxiliary registers.
- Returns:
- int8_t, PEC Status 0: No PEC error detected -1: PEC error detected, retry read
- Parameters:
-
reg controls which GPIO voltage register is read back total_ic the number of ICs in the daisy chain ic A two dimensional array of the parsed gpio voltage codes
Definition at line 229 of file LTC6811.cpp.
int8_t LTC6811_rdcfg | ( | uint8_t | nIC, |
cell_asic | ic[] | ||
) |
Reads configuration registers of a LTC6811 daisy chain
- Returns:
- int8_t, PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
- Parameters:
-
total_ic number of ICs in the daisy chain ic a two dimensional array that the function stores the read configuration data
Definition at line 318 of file LTC6811.cpp.
int8_t LTC6811_rdcomm | ( | uint8_t | total_ic, |
cell_asic | ic[] | ||
) |
Reads comm registers of a LTC6811 daisy chain
- Returns:
- int8_t, PEC Status.
0: Data read back has matching PEC
-1: Data read back has incorrect PEC
- Parameters:
-
total_ic number of ICs in the daisy chain ic Two dimensional array that the function stores the read comm data.
Definition at line 365 of file LTC6811.cpp.
uint8_t LTC6811_rdcv | ( | uint8_t | reg, |
uint8_t | total_ic, | ||
cell_asic | ic[] | ||
) |
Reads and parses the LTC6811 cell voltage registers.
- Returns:
- int8_t, PEC Status. 0: No PEC error detected -1: PEC error detected, retry read
- Parameters:
-
reg controls which cell voltage register is read back. total_ic the number of ICs in the daisy chain(-1 only) ic array of the parsed cell codes from lowest to highest.
Definition at line 213 of file LTC6811.cpp.
int8_t LTC6811_rdpwm | ( | uint8_t | nIC, |
uint8_t | pwmReg, | ||
cell_asic | ic[] | ||
) |
Reads pwm registers of a LTC6811 daisy chain
- Parameters:
-
total_ic number of ICs in the daisy chain ic a two dimensional array that the function stores the read pwm data
Definition at line 342 of file LTC6811.cpp.
int8_t LTC6811_rdstat | ( | uint8_t | reg, |
uint8_t | total_ic, | ||
cell_asic | ic[] | ||
) |
Reads and parses the LTC6811 stat registers.
- Returns:
- int8_t, PEC Status 0: No PEC error detected -1: PEC error detected, retry read
Definition at line 245 of file LTC6811.cpp.
void LTC6811_reset_crc_count | ( | uint8_t | total_ic, |
cell_asic | ic[] | ||
) |
Helper Function that resets the PEC error counters
Definition at line 466 of file LTC6811.cpp.
uint16_t LTC6811_run_adc_overlap | ( | uint8_t | total_ic, |
cell_asic | ic[] | ||
) |
Helper Function that runs the ADC Overlap test
Definition at line 419 of file LTC6811.cpp.
int16_t LTC6811_run_adc_redundancy_st | ( | uint8_t | adc_mode, |
uint8_t | adc_reg, | ||
uint8_t | total_ic, | ||
cell_asic | ic[] | ||
) |
Helper function that runs the ADC Digital Redudancy commands and checks output for errors
Definition at line 407 of file LTC6811.cpp.
int16_t LTC6811_run_cell_adc_st | ( | uint8_t | adc_reg, |
uint8_t | total_ic, | ||
cell_asic | ic[] | ||
) |
Helper function that runs the ADC Self Tests
Definition at line 399 of file LTC6811.cpp.
void LTC6811_run_openwire | ( | uint8_t | total_ic, |
cell_asic | ic[] | ||
) |
Helper function that runs the datasheet open wire algorithm
Definition at line 414 of file LTC6811.cpp.
void LTC6811_set_cfgr | ( | uint8_t | nIC, |
cell_asic | ic[], | ||
bool | refon, | ||
bool | adcopt, | ||
bool | gpio[5], | ||
bool | dcc[12] | ||
) |
Helper function to set appropriate bits in CFGR register based on bit function
Definition at line 477 of file LTC6811.cpp.
void LTC6811_set_cfgr_adcopt | ( | uint8_t | nIC, |
cell_asic | ic[], | ||
bool | adcopt | ||
) |
Helper function to turn the ADCOPT bit HIGH or LOW
Definition at line 490 of file LTC6811.cpp.
void LTC6811_set_cfgr_ov | ( | uint8_t | nIC, |
cell_asic | ic[], | ||
uint16_t | ov | ||
) |
Helper function to set ov field in CFGRA register
Definition at line 510 of file LTC6811.cpp.
void LTC6811_set_cfgr_refon | ( | uint8_t | nIC, |
cell_asic | ic[], | ||
bool | refon | ||
) |
Helper function to turn the refon bit HIGH or LOW
Definition at line 485 of file LTC6811.cpp.
void LTC6811_set_cfgr_uv | ( | uint8_t | nIC, |
cell_asic | ic[], | ||
uint16_t | uv | ||
) |
Helper function to set uv field in CFGRA register
Definition at line 505 of file LTC6811.cpp.
void LTC6811_statst | ( | uint8_t | MD, |
uint8_t | ST | ||
) |
Start a Status Register Self Test Conversion
- Parameters:
-
MD ADC Conversion Mode ST Sets if self test 1 or 2 is run
Definition at line 146 of file LTC6811.cpp.
void LTC6811_stcomm | ( | ) |
issues a stcomm command and clocks data out of the COMM register
Definition at line 377 of file LTC6811.cpp.
void LTC6811_wrcfg | ( | uint8_t | nIC, |
cell_asic | ic[] | ||
) |
Write the LTC6811 configuration register
- Parameters:
-
total_ic The number of ICs being written ic a two dimensional array of the configuration data that will be written
Definition at line 307 of file LTC6811.cpp.
void LTC6811_wrcomm | ( | uint8_t | total_ic, |
cell_asic | ic[] | ||
) |
Write the LTC6811 COMM register
- Parameters:
-
total_ic Number of ICs in the daisy chain ic A two dimensional array of the comm data that will be written
Definition at line 355 of file LTC6811.cpp.
void LTC6811_wrpwm | ( | uint8_t | nIC, |
uint8_t | pwmReg, | ||
cell_asic | ic[] | ||
) |
Write the LTC6811 PWM register
- Parameters:
-
total_ic number of ICs in the daisy chain
Definition at line 330 of file LTC6811.cpp.
Generated on Wed Jul 13 2022 11:08:21 by
