This is a library for the MAX17055 Li+ Battery Fuel Gauge.
Fork of max17055 by
Diff: max17055.h
- Revision:
- 12:519a18fc3b28
- Parent:
- 11:bdbd3104995b
--- a/max17055.h Tue Feb 27 15:53:04 2018 +0000 +++ b/max17055.h Thu Apr 19 22:34:45 2018 +0000 @@ -3,13 +3,14 @@ * * @author Felipe Neira - Maxim Integrated - TTS * -* @version 1.4 +* @version 1.5 * -* Started: 6FEB18 +* Started: 13DEC17 * -* Updated: -* Removed BATTERY CLASS. -* Add Doxygen documentations. +* Updated: 16APR18. +* Remove unnecessary code. +* Check spelling +* Error check * * /******************************************************************************* @@ -57,9 +58,9 @@ /// Model loading options #define MODEL_LOADING_OPTION1 1 //EZ Config -#define MODEL_LOADING_OPTION2 2 //Not implemented in this version of the library -#define MODEL_LOADING_OPTION3 3 //Not implemented in this version of the library - +// #define MODEL_LOADING_OPTION2 2 //Not implemented in this version of the library +// #define MODEL_LOADING_OPTION3 3 //Not implemented in this version of the library +//Remove this and leave it /** * @brief MBED Library for the MAX17055\n @@ -119,8 +120,6 @@ public: - ///7-bit slave address - static const uint8_t I2C_ADRS = 0x36; //Slave address 0x6C or 0x36 for 7 MSbit Addres ///8-bit write address static const uint8_t I2C_W_ADRS = 0x6C; ///8-bit read address @@ -135,7 +134,7 @@ VALRTTH_REG = 0x01, /*!< 0x01 */ TALRTTH_REG = 0x02, /*!< 0x02 */ SALRTTH_REG = 0x03, /*!< 0x03 */ - ATRATE_REG = 0x04, /*!< 0x04 write negative 2s comp of a 16-bit theorithical load */ + ATRATE_REG = 0x04, /*!< 0x04 write negative 2s comp of a 16-bit theoretical load */ REPCAP_REG = 0x05, /*!< 0x05 */ REPSOC_REG = 0x06, /*!< 0x06 */ TEMP_REG = 0x08, /*!< 0x08 */ @@ -187,19 +186,21 @@ IALRTTH_REG = 0xB4, /*!< 0x39 */ CURVE_REG = 0xB9, /*!< 0x39 */ - HIBCFG_REG = 0xBA, /*!< 0x39 */ + HIBCFG_REG = 0xBA, /*!< 0x39 default = 0x870C (0x890C)*/ CONFIG2_REG = 0xBB, /*!< 0xBB default = 0x3658 */ - MODELCFG_REG = 0xDB, /*!< 0x39 */ - ATTTE_REG = 0xDD, /*!< 0x39 */ + MODELCFG_REG = 0xDB, /*!< 0xDB */ + ATTTE_REG = 0xDD, /*!< 0xDD */ + ATAVSOC_REG = 0xDE, /*!< 0xDE */ + ATAVCAP_REG = 0xDF, /*!< 0xDF */ OCV_REG = 0xFB, /*!< 0x39 */ VFSOC_REG = 0xFF /*!< 0x39 */ }; /** - * @brief Saved Plataform Data for Fuel Gauge Model - * @details Struct with fuel Gauge Plataform Data for Fuel Gauge Model based on the final design. + * @brief Saved Platform Data for Fuel Gauge Model + * @details Struct with fuel Gauge Platform Data for Fuel Gauge Model based on the final design. */ struct platform_data{ //to clarify if Part of the class uint16_t designcap;/*!< struct value 1 */ @@ -286,7 +287,7 @@ int clear_POR_bit(); /** - * @brief Write and Verify a MAX17055 register + * @brief Write and Verify a MAX17055 register */ int write_and_verify_reg(Registers_e reg_addr, uint16_t reg_data); @@ -296,17 +297,17 @@ int init(platform_data des_data); /** - * @brief Get Temperature Function from the MAX17055 TEMP register. + * @brief Get Temperature Function from the MAX17055 TEMP register. */ int get_temperature(); /** - * @brief Forced Exit Hibernate Mode Function for MAX17055 + * @brief Forced Exit Hibernate Mode Function for MAX17055 */ - uint16_t forcedExitHyberMode(); + uint16_t forcedExitHiberMode();// Hibernate spelling /** - * @brief EZ Confing Initialization function + * @brief EZ Config Initialization function */ uint16_t EZconfig_init(platform_data des_data); @@ -316,19 +317,19 @@ int get_SOC(); /** - * @brief Get Average State Of Charge(SOC) Function from MAX17055 Fuel Gauge. + * @brief Get at rate Average State Of Charge(SOC) Function from MAX17055 Fuel Gauge. */ - int get_avSOC(); + int get_atAvSOC(); /** * @brief Get the Time to Empty(TTE) Function form MAX17055 Fuel Gauge. */ - int get_TTE(); + float get_TTE(); /** * @brief Get the at Time to Empty(atTTE) value Function for MAX17055 Fuel Gauge. */ - int get_atTTE(); + float get_atTTE(); /** * @brief Get mix State Of Charge(SOC) Function for MAX17055 Fuel Gauge. @@ -338,7 +339,7 @@ /** * @brief Get the Time to Full(TTE) values Function for MAX17055 Fuel Gauge. */ - int get_TTF(); + float get_TTF(); /** * @brief Get voltage of the cell Function for MAX17055 Fuel Gauge. @@ -356,12 +357,12 @@ int get_AvgCurrent(platform_data des_data); /** - * @brief lsb_to_uvolts Converssion Function + * @brief lsb_to_uvolts Conversion Function */ int lsb_to_uvolts(uint16_t lsb); /** - * @brief raw_current_to_uamp Converssion Function + * @brief raw_current_to_uamp Conversion Function */ int raw_current_to_uamps(uint32_t curr, int rsense_value); @@ -371,7 +372,7 @@ int save_Params(saved_FG_params_t FG_params); /** - * @brief Resotore Parameters Function for battery Fuel Gauge model. + * @brief Restore Parameters Function for battery Fuel Gauge model. */ int restore_Params(saved_FG_params_t FG_params);