Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of max20303 by
Diff: MAX20303.h
- Revision:
- 2:39e05cf7ef7d
- Parent:
- 1:d85b06dc60a3
diff -r d85b06dc60a3 -r 39e05cf7ef7d MAX20303.h --- a/MAX20303.h Thu Jan 25 15:31:43 2018 +0300 +++ b/MAX20303.h Thu Jan 03 11:03:10 2019 +0300 @@ -44,6 +44,7 @@ #define MAX20303_ERROR -1 #define MAX20303_I2C_ADDR_FUEL_GAUGE 0x6c +#define MAX20303_I2C_ADDR_FUEL_GAUGE 0x6C #define MAX20303_LDO_MIN_MV 800 #define MAX20303_LDO_MAX_MV 3600 @@ -56,37 +57,6 @@ public: /** - * @brief Constructor using reference to I2C object - * @param i2c - Reference to I2C object - * @param slaveAddress - 7-bit I2C address - */ - MAX20303(I2C *i2c); - - /** @brief Destructor */ - ~MAX20303(void); - - int led0on(void); - int BoostEnable(void); - int BuckBoostEnable(void); - - /// @brief Enable the 1.8V output rail **/ - int LDO1Config(void); - int mv2bits(int mV); - - /** @brief Power Off the board - */ - int PowerOffthePMIC(); - - /** @brief Soft reset the PMIC - */ - int SoftResetthePMIC(); - - /** @brief Hard reset the PMIC - */ - int HardResetthePMIC(); - -private: - /** * @brief Register Addresses * @details Enumerated MAX20303 register addresses */ @@ -161,6 +131,58 @@ */ }; + /** + * @brief Constructor using reference to I2C object + * @param i2c - Reference to I2C object + * @param slaveAddress - 7-bit I2C address + */ + MAX20303(I2C *i2c); + + /** @brief Destructor */ + ~MAX20303(void); + + int led0on(char enable); + int led1on(char enable); + int led2on(char enable); + int BoostEnable(void); + int BuckBoostEnable(void); + + /// @brief Enable the 1.8V output rail **/ + int LDO1Config(void); + + /// @brief Enable the 3V output rail **/ + int LDO2Config(void); + + + int mv2bits(int mV); + + /** @brief Power Off the board + */ + int PowerOffthePMIC(); + + /** @brief Power Off the board with 30ms delay + */ + int PowerOffDelaythePMIC(); + + /** @brief Soft reset the PMIC + */ + int SoftResetthePMIC(); + + /** @brief Hard reset the PMIC + */ + int HardResetthePMIC(); + + /** @brief check if can communicate with max20303 + */ + char CheckPMICHWID(); + + /** @brief CheckPMICStatusRegisters + */ + int CheckPMICStatusRegisters(unsigned char buf_results[5]); + + int Max20303_BatteryGauge(unsigned char *batterylevel); + +private: int writeReg(registers_t reg, uint8_t value); int readReg(registers_t reg, uint8_t &value);
