[Nexus One Android Development] theloginwithnoname:
reference: w1_ defines - code analysis

edit1: added ratios from http://pdfserv.maxim-ic.com/en/an/AN4043.pdf

edit2: realised this needed a spreadsheet - https://spreadsheets.google.com/ccc...VNzdXpqWVdFejNGM1pLWmc&hl=en&authkey=CJ_ItagO - it's read-only at present, shout/PM if you see anything that needs updating.

the following is a quick tot up of some of the interesting "registers" and the current "state":

#define DS2784_REG_STS 0x01 // register status
#define DS2784_REG_RAAC_MSB 0x02 // charge_uAh
#define DS2784_REG_RAAC_LSB 0x03
#define DS2784_REG_RSAC_MSB 0x04 // (not used)
#define DS2784_REG_RSAC_LSB 0x05
#define DS2784_REG_RARC 0x06 // percentage
#define DS2784_REG_RSRC 0x07 // (not used)
#define DS2784_REG_AVG_CURR_MSB 0x08 // current_avg_mAh
#define DS2784_REG_AVG_CURR_LSB 0x09
#define DS2784_REG_TEMP_MSB 0x0A // temperature
#define DS2784_REG_TEMP_LSB 0x0B
#define DS2784_REG_VOLT_MSB 0x0C // voltage_uV
#define DS2784_REG_VOLT_LSB 0x0D
#define DS2784_REG_CURR_MSB 0x0E // current_uA
#define DS2784_REG_CURR_LSB 0x0F
#define DS2784_REG_ACCUMULATE_CURR_MSB 0x10 // (write only)
#define DS2784_REG_ACCUMULATE_CURR_LSB 0x11
#define DS2784_REG_ACCUMULATE_CURR_LSB1 0x12 // (not used)
#define DS2784_REG_ACCUMULATE_CURR_LSB2 0x13
#define DS2784_REG_AGE_SCALAR 0x14 //
#define DS2784_REG_SPECIALL_FEATURE 0x15 // (not used)
#define DS2784_REG_FULL_MSB 0x16 // (not used)
#define DS2784_REG_FULL_LSB 0x17
#define DS2784_REG_ACTIVE_EMPTY_MSB 0x18 // active_empty - HTC: *625/100)*67)/1000
#define DS2784_REG_ACTIVE_EMPTY_LSB 0x19
#define DS2784_REG_STBY_EMPTY_MSB 0x1A // (not used)
#define DS2784_REG_STBY_EMPTY_LSB 0x1B
#define DS2784_REG_EEPROM 0x1F
#define DS2784_REG_MFG_GAIN_RSGAIN_MSB 0xB0
#define DS2784_REG_MFG_GAIN_RSGAIN_LSB 0xB1

#define DS2784_REG_CTRL 0x60
#define DS2784_REG_ACCUMULATE_BIAS 0x61 // (not used) - 0.006250 mV
#define DS2784_REG_AGE_CAPA_MSB 0x62 // (not used) - 24.4 mVh
#define DS2784_REG_AGE_CAPA_LSB 0x63
#define DS2784_REG_CHARGE_VOLT 0x64 // (not used) 4.17728 V
#define DS2784_REG_MIN_CHARGE_CURR 0x65 // (not used) - 1.6 mV
#define DS2784_REG_ACTIVE_EMPTY_VOLT 0x66 // (not used) - 3.31840 V
#define DS2784_REG_ACTIVE_EMPTY_CURR 0x67 // (not used) - 4.8 mV
#define DS2784_REG_ACTIVE_EMPTY_40 0x68 // (not used) - 0.0058594
#define DS2784_REG_RSNSP 0x69 // #define BATT_RSNSP (67) - // passion battery source 1 - 20.0 mOhms
#define DS2784_REG_FULL_40_MSB 0x6A // detailed code - HTC - 21.01875 mVh
#define DS2784_REG_FULL_40_LSB 0x6B
#define DS2784_REG_FULL_SEG_4_SLOPE 0x6C // detailed code - HTC - 854ppm
#define DS2784_REG_FULL_SEG_3_SLOPE 0x6D // detailed code - HTC - 1038 ppm
#define DS2784_REG_FULL_SEG_2_SLOPE 0x6E // detailed code - HTC - 2991 ppm
#define DS2784_REG_FULL_SEG_1_SLOPE 0x6F // detailed code - HTC - 3296 ppm
...
#define DS2784_REG_RSGAIN_MSB 0x78 // (not used) - 1.03027
#define DS2784_REG_RSGAIN_LSB 0x79
#define DS2784_REG_RSTC 0x7A // (not used) - 0 (WTF!)
#define DS2784_REG_CURR_OFFSET_BIAS 0x7B // (not used) - -0.006250 mV
#

It is my intention to try and read all of the ones with comments (//) after them.

legend:

(not used) - not currently used in ds2784_battery.c

(write only) - never read

(detailed code) - refer to the actual code

HTC - custom HTC code