diff --git a/fuel_gauge.c b/fuel_gauge.c index 0e32e11f58d84965fc2414e350b5e0d7c7afb7ca..5a4dd64bdb165809f20321fdebf7c2b1f9bfdf72 100755 --- a/fuel_gauge.c +++ b/fuel_gauge.c @@ -11,7 +11,7 @@ float output_current; // battery I2C slave address unsigned char battery_id; -unsigned char EEMEM ee_battery_id=0x31; +unsigned char EEMEM ee_battery_id=0x60; // remaining_capacity volatile unsigned short int remaining_capacity; @@ -102,9 +102,9 @@ void get_voltage(unsigned char *voltage) // read the voltage registers of the battery // send the read request read_cmd=0x30; - if(i2cMasterSendNI(0x62,1,&read_cmd)==I2C_OK) + if(i2cMasterSendNI(battery_id,1,&read_cmd)==I2C_OK) { - if(i2cMasterReceiveNI(0x62,18,voltage_data)==I2C_OK) + if(i2cMasterReceiveNI(battery_id,18,voltage_data)==I2C_OK) { for(i=0;i<16;i++) voltage[i]=voltage_data[i+2]; @@ -118,9 +118,9 @@ void get_temperature(unsigned char *temp1, unsigned char *temp2) unsigned char read_cmd; read_cmd=0x4A;// device start read address - if(i2cMasterSendNI(0x62,1,&read_cmd)==I2C_OK) + if(i2cMasterSendNI(battery_id,1,&read_cmd)==I2C_OK) { - if(i2cMasterReceiveNI(0x62,6,temp_data)==I2C_OK) + if(i2cMasterReceiveNI(battery_id,6,temp_data)==I2C_OK) { temp1[0]=temp_data[2]; temp1[1]=temp_data[3];