This is a library for the MAX17055 Li+ Battery Fuel Gauge.
Dependents: Low_Power_Long_Distance_IR_Vision_Robot MAX17055_EZconfig MAX17055_EZconfig_Sample Low_Power_Long_Distance_IR_Vision_Robot
Fork of max17055 by
Diff: max17055.cpp
- Revision:
- 20:dcb0e5893677
- Parent:
- 19:20590e00feab
- Child:
- 22:607f6917832a
diff -r 20590e00feab -r dcb0e5893677 max17055.cpp --- a/max17055.cpp Tue Oct 23 17:30:14 2018 +0000 +++ b/max17055.cpp Tue Oct 23 21:39:55 2018 +0000 @@ -210,7 +210,7 @@ status = readReg(VERSION_REG, read_data); if (status != F_SUCCESS_0) return status; - printf("Version REG = %X \r\n", read_data); + ///STEP 0. Check for POR (Skip load model if POR bit is cleared) if (check_POR_func() == F_ERROR_5) @@ -221,33 +221,28 @@ if (ret < F_SUCCESS_0) { return ret; } - printf("STEP 1\r\n"); ///STEP 1.2. Force exit from hibernate hibcfg_value = forcedExitHiberMode(); - printf("STEP 1.2\r\n"); ///STEP 2. Initialize configuration ///STEP 2.1. Load EZ Config EZconfig(des_data); - printf("STEP 2\r\n"); ///STEP 2.2. Poll ModelCFG.ModelRefresh bit for clear ret = poll_flag_clear(MODELCFG_REG, MAX17055_MODELCFG_REFRESH, time_out); if(ret < F_SUCCESS_0) { return ret; } - printf("STEP 2.2\r\n"); ///STEP3. Restore original HibCfg writeReg(HIBCFG_REG, hibcfg_value); - printf("STEP 3\r\n"); + /* Clear Status.POR */ ret = clear_POR_bit(); if (ret < F_SUCCESS_0) return ret; //See errors - printf("Clear POR bit\r\n"); return F_SUCCESS_0; } @@ -755,7 +750,7 @@ res |= 0xFFFF0000; } final_res = (float)res; - final_res *= 1562500 /(float)(rsense_value*1000000); + final_res *= 1562500 /(float)(rsense_value*10000); return final_res; }