Definition in file analog.c.
#include <iom406.h>
#include <inavr.h>
#include "main.h"
#include "pack.h"
#include "analog.h"
#include "calibration.h"
#include "smbus.h"
#include "timer.h"
#include "pwrmgmt.h"
#include "ee.h"
Go to the source code of this file.
Defines | |
| #define | ADC0_HI_CAL (sig_array[0x19]) |
| #define | ADC0_LO_CAL (sig_array[0x18]) |
| #define | BG_C_CAL (sig_array[0x09]) |
| #define | CCI_CAL 172 |
| #define | CELL1_HI_CAL (sig_array[0x11]) |
| #define | CELL1_LO_CAL (sig_array[0x10]) |
| #define | CELL2_HI_CAL (sig_array[0x13]) |
| #define | CELL2_LO_CAL (sig_array[0x12]) |
| #define | CELL3_HI_CAL (sig_array[0x15]) |
| #define | CELL3_LO_CAL (sig_array[0x14]) |
| #define | CELL4_HI_CAL (sig_array[0x17]) |
| #define | CELL4_LO_CAL (sig_array[0x16]) |
| #define | FAST_RC_CAL (sig_array[0x01]) |
| #define | FixedThermistorPullup 1000 |
| #define | MODULE_ANALOG |
| #define | MODULE_CALIBRATION |
| #define | SLOW_RC_HI_CAL (sig_array[0x07]) |
| #define | SLOW_RC_LO_CAL (sig_array[0x06]) |
| #define | VPTAT_HI_CAL (sig_array[0x1B]) |
| #define | VPTAT_LO_CAL (sig_array[0x1A]) |
Functions | |
| unsigned int | AbsoluteSOC (void) |
| __interrupt void | ADC_INT (void) |
| void | ADCinit (void) |
| unsigned int | AtRateOK (void) |
| unsigned int | AtRateTTE (void) |
| unsigned int | AtRateTTF (void) |
| unsigned int | AvgTimeToFull (void) |
| void | CalculateADCresults (void) |
| unsigned char | CalibrateCCoffset (void) |
| unsigned char | CalibrateVREF (void) |
| __interrupt void | CC_Accumulator_ISR (void) |
| __interrupt void | CC_Instantaneous_ISR (void) |
| __interrupt void | CC_RegularCurrent_ISR (void) |
| void | CCarray_AddSample (signed int newsample) |
| signed int | CCarray_Average (void) |
| void | CCarray_Init (void) |
| void | CCinit (void) |
| void | CCmode (unsigned char mode) |
| signed int | Current1Sec (void) |
| void | DisableCellBalancing (void) |
| void | EnableCellBalancing (void) |
| void | FullChargeReached (void) |
| unsigned int | FullChgCap (void) |
| void | FullDischargeReached (void) |
| long | GetCharge (void) |
| long | GetCharge_mAmins (void) |
| long | GetChgUntilFull_mAmins (void) |
| unsigned int | GetMaxChg (void) |
| unsigned int | GetTemperature (void) |
| unsigned int | GetVoltage (void) |
| unsigned char | ReadCCOffsetCalibration (void) |
| unsigned int | ReadCell (char cell) |
| void | ReadFactoryCalibration (void) |
| unsigned int | ReadTemperature (unsigned char channel) |
| unsigned char | ReadVrefCalibration (void) |
| unsigned char | RelativeSOC (void) |
| unsigned int | RemainingCap (void) |
| void | SetMaxTopAcc (long value) |
| void | StartAdc (unsigned char select) |
| unsigned int | TimeToEmpty (unsigned char avgd) |
Variables | |
| unsigned int | ADCbuffer [10] |
| unsigned char | ADCchannel |
| unsigned int | ADCgain [4] |
| unsigned char | CC_delay_acc = 0 |
| unsigned char | CC_delay_inst = 0 |
| signed int | CCarray [64] |
| char | CCindex = 0 |
| char | CCvalidsamples = 0 |
| unsigned int | CellV [4] = {0} |
| signed long | MaxBottomAcc = 0 |
| signed long | MaxTopAcc = 0 |
| unsigned int | OnChipTemp = 0 |
| unsigned int | Thermistor [4] = {0} |
| unsigned int | VPA4 = 0 |
| unsigned int | VTgain |
| #define BG_C_CAL (sig_array[0x09]) |
| #define CCI_CAL 172 |
| #define CELL1_HI_CAL (sig_array[0x11]) |
| #define CELL1_LO_CAL (sig_array[0x10]) |
| #define CELL2_HI_CAL (sig_array[0x13]) |
| #define CELL2_LO_CAL (sig_array[0x12]) |
| #define CELL3_HI_CAL (sig_array[0x15]) |
| #define CELL3_LO_CAL (sig_array[0x14]) |
| #define CELL4_HI_CAL (sig_array[0x17]) |
| #define CELL4_LO_CAL (sig_array[0x16]) |
| #define FAST_RC_CAL (sig_array[0x01]) |
Definition at line 456 of file analog.c.
Referenced by ReadFactoryCalibration().
| #define SLOW_RC_HI_CAL (sig_array[0x07]) |
| #define SLOW_RC_LO_CAL (sig_array[0x06]) |
| #define VPTAT_HI_CAL (sig_array[0x1B]) |
| #define VPTAT_LO_CAL (sig_array[0x1A]) |
| unsigned int AbsoluteSOC | ( | void | ) |
| __interrupt void ADC_INT | ( | void | ) |
Definition at line 1126 of file analog.c.
References ADC0_READINGS, ADCbuffer, cell_current, DisableCellBalancing(), EnableCellBalancing(), LatestCCI, SetADCScanDone, and VPTAT_READINGS.
| unsigned int AtRateOK | ( | void | ) |
| unsigned int AtRateTTE | ( | void | ) |
| unsigned int AtRateTTF | ( | void | ) |
| unsigned int AvgTimeToFull | ( | void | ) |
| void CalculateADCresults | ( | void | ) |
| unsigned char CalibrateCCoffset | ( | void | ) |
| unsigned char CalibrateVREF | ( | void | ) |
| __interrupt void CC_Accumulator_ISR | ( | void | ) |
Definition at line 1019 of file analog.c.
References CC_delay_acc, and RunningAcc.
| __interrupt void CC_Instantaneous_ISR | ( | void | ) |
Definition at line 909 of file analog.c.
References CCarray_AddSample(), CCI_CAL, LatestCCI, PowerMode, POWERMODE_IDLE, and RunningAcc.
| __interrupt void CC_RegularCurrent_ISR | ( | void | ) |
| void CCarray_AddSample | ( | signed int | newsample | ) |
Definition at line 809 of file analog.c.
References CC_delay_inst, CCarray, CCindex, and CCvalidsamples.
Referenced by CC_Instantaneous_ISR().
| signed int CCarray_Average | ( | void | ) |
| void CCarray_Init | ( | void | ) |
Definition at line 801 of file analog.c.
References CCindex, and CCvalidsamples.
Referenced by CCmode().
| void CCmode | ( | unsigned char | mode | ) |
Definition at line 742 of file analog.c.
Referenced by CCinit(), SetActiveMode(), SetIdleMode(), and SetPowerSaveMode().
| signed int Current1Sec | ( | void | ) |
Definition at line 826 of file analog.c.
Referenced by AtRateOK(), AvgTimeToFull(), ChargeCheck(), SMBR_Current(), and TimeToEmpty().
| void DisableCellBalancing | ( | void | ) |
Definition at line 1261 of file analog.c.
Referenced by ADC_INT(), BalanceCheck(), and DoCalibrate().
| void EnableCellBalancing | ( | void | ) |
Definition at line 1267 of file analog.c.
Referenced by ADC_INT(), BalanceCheck(), and DoCalibrate().
| void FullChargeReached | ( | void | ) |
| unsigned int FullChgCap | ( | void | ) |
Definition at line 357 of file analog.c.
Referenced by SMBR_FullChgCap().
| void FullDischargeReached | ( | void | ) |
| long GetCharge | ( | void | ) |
Definition at line 174 of file analog.c.
References RunningAcc.
Referenced by AbsoluteSOC(), and RemainingCap().
| long GetCharge_mAmins | ( | void | ) |
Definition at line 181 of file analog.c.
References RunningAcc.
Referenced by AtRateOK(), AtRateTTE(), AtRateTTF(), and TimeToEmpty().
| long GetChgUntilFull_mAmins | ( | void | ) |
Definition at line 188 of file analog.c.
References MaxTopAcc, and RunningAcc.
Referenced by AvgTimeToFull().
| unsigned int GetMaxChg | ( | void | ) |
| unsigned int GetTemperature | ( | void | ) |
| unsigned int GetVoltage | ( | void | ) |
Definition at line 160 of file analog.c.
Referenced by AtRateOK(), AvgTimeToFull(), RemainingCap(), SMBR_Voltage(), and TimeToEmpty().
| unsigned char ReadCCOffsetCalibration | ( | void | ) |
| unsigned int ReadCell | ( | char | cell | ) |
Definition at line 1252 of file analog.c.
Referenced by BalanceCheck(), ChargeCheck(), and GetVoltage().
| void ReadFactoryCalibration | ( | void | ) |
Definition at line 488 of file analog.c.
References ADCgain, BG_C_CAL, BGCCRCal, CAL_CC_MASK, CAL_CC_OK, CAL_VREF_MASK, CAL_VREF_OK, calibration_state, CELL1_HI_CAL, CELL1_LO_CAL, CELL2_HI_CAL, CELL2_LO_CAL, CELL3_HI_CAL, CELL3_LO_CAL, CELL4_HI_CAL, CELL4_LO_CAL, FAST_RC_CAL, FastRCCal, ReadCCOffsetCalibration(), ReadVrefCalibration(), SLOW_RC_HI_CAL, SLOW_RC_LO_CAL, SlowRCCal, VPTAT_HI_CAL, VPTAT_LO_CAL, and VTgain.
Referenced by ADCinit().
| unsigned int ReadTemperature | ( | unsigned char | channel | ) |
Definition at line 1229 of file analog.c.
Referenced by GetTemperature().
| unsigned char ReadVrefCalibration | ( | void | ) |
| unsigned char RelativeSOC | ( | void | ) |
| unsigned int RemainingCap | ( | void | ) |
Definition at line 341 of file analog.c.
Referenced by AlarmConditionsCheck(), and SMBR_RemCap().
| void SetMaxTopAcc | ( | long | value | ) |
| void StartAdc | ( | unsigned char | select | ) |
| unsigned int TimeToEmpty | ( | unsigned char | avgd | ) |
Definition at line 372 of file analog.c.
Referenced by AlarmConditionsCheck(), SMBR_AvgTTE(), and SMBR_RunTTE().
| unsigned int ADCbuffer[10] |
| unsigned char ADCchannel |
| unsigned int ADCgain[4] |
Definition at line 112 of file analog.c.
Referenced by CalculateADCresults(), and ReadFactoryCalibration().
| unsigned char CC_delay_acc = 0 |
Definition at line 87 of file analog.c.
Referenced by CalibrateCCoffset(), CC_Accumulator_ISR(), and CCmode().
| unsigned char CC_delay_inst = 0 |
| signed int CCarray[64] |
Definition at line 103 of file analog.c.
Referenced by CalibrateCCoffset(), CCarray_AddSample(), CCarray_Average(), and Current1Sec().
| char CCindex = 0 |
Definition at line 104 of file analog.c.
Referenced by CalibrateCCoffset(), CCarray_AddSample(), CCarray_Init(), and Current1Sec().
| char CCvalidsamples = 0 |
Definition at line 105 of file analog.c.
Referenced by CCarray_AddSample(), CCarray_Average(), and CCarray_Init().
| unsigned int CellV[4] = {0} |
| signed long MaxBottomAcc = 0 |
Definition at line 85 of file analog.c.
Referenced by FullChargeReached(), and FullDischargeReached().
| signed long MaxTopAcc = 0 |
Definition at line 84 of file analog.c.
Referenced by FullChargeReached(), FullDischargeReached(), GetChgUntilFull_mAmins(), GetMaxChg(), RelativeSOC(), and SetMaxTopAcc().
| unsigned int OnChipTemp = 0 |
| unsigned int Thermistor[4] = {0} |
| unsigned int VPA4 = 0 |
| unsigned int VTgain |
Definition at line 113 of file analog.c.
Referenced by CalculateADCresults(), and ReadFactoryCalibration().
1.5.3