MAX14690 Library
Dependents: MAX32630HSP3_IMU_HelloWorld MAX32630HSP3_IMU_HelloWorld max32630fthr max4146x_comp ... more
Fork of MAX14690 by
Diff: MAX14720.h
- Revision:
- 6:06450093da48
- Parent:
- 5:0010586546d8
- Child:
- 7:2e9f6e70b34f
diff -r 0010586546d8 -r 06450093da48 MAX14720.h --- a/MAX14720.h Wed Oct 05 00:05:14 2016 +0000 +++ b/MAX14720.h Thu Oct 06 17:10:56 2016 +0000 @@ -49,21 +49,21 @@ * @code * #include "mbed.h" * #include "MAX14720.h" - * + * * // I2C Master 2 * I2C i2c2(I2C2_SDA, I2C2_SCL); - * + * * #define I2C_ADDR_PMIC (0x54) * MAX14720 max14720(&i2c2,I2C_ADDR_PMIC); - * + * * DigitalOut led(LED1); * InterruptIn button(SW1); - * + * * void turnOff() * { * max14720.shutdown(); * } - * + * * int main() * { * int result; @@ -87,14 +87,14 @@ */ class MAX14720 { - + public: - /** + /** * @brief Register Addresses * @details Enumerated MAX14720 register addresses - */ - typedef enum { + */ + typedef enum { REG_CHIP_ID = 0x00, ///< Chip ID REG_CHIP_REV = 0x01, ///< Chip Revision REG_BOOST_CDIV = 0x03, ///< Boost Clock Divider @@ -117,14 +117,14 @@ REG_PIN_STAT = 0x1B, ///< Pin Status REG_BBB_EXTRA = 0x1C, ///< Buck/Buck-Boost Extra REG_HANDSHK = 0x1D, ///< Power-On Handshake - REG_UVLO_CFG = 0x1E, ///< Under-Voltage Lock Out + REG_UVLO_CFG = 0x1E, ///< Under-Voltage Lock Out REG_PWR_OFF = 0x1F, ///< Power Off Command } registers_t; - /** + /** * @brief Boost Peak Current Settings * @details Enumerated peak current settings for boost regulator - */ + */ typedef enum { BOOST_ISET_MIN, ///< Minimum On-Time BOOST_ISET_50mA, ///< 50mA Peak Current @@ -136,30 +136,30 @@ BOOST_ISET_350mA, ///< 350mA Peak Current } boostISet_t; - /** + /** * @brief Boost Enable Mode * @details Enumerated enable modes for boost regulator - */ + */ typedef enum { BOOST_DISABLED, ///< Boost Disabled BOOST_ENABLED, ///< Boost Enabled BOOST_EN_MPC, ///< Boost Enabled by MPC pin } boostEn_t; - /** + /** * @brief Buck Operating Modes * @details Enumerated operating modes for buck regulator - */ + */ typedef enum { - BUCK_BURST, ///< Burst Mode Operation + BUCK_BURST, ///< Burst Mode Operation BUCK_FPWM, ///< Forced PWM Operation BUCK_MPC_FPWM, ///< MPC activated Forced PWM } buckMd_t; - /** + /** * @brief Buck Peak Current Settings * @details Enumerated peak current settings for buck regulator - */ + */ typedef enum { BUCK_ISET_50mA, ///< 50mA Peak Current BUCK_ISET_100mA, ///< 100mA Peak Current @@ -171,12 +171,12 @@ BUCK_ISET_400mA, ///< 400mA Peak Current } buckISet_t; - /** + /** * @brief Monitor Configurations * @details Enumerated configuration modes for monitor multiplexer - */ + */ typedef enum { - MON_PULLDOWN = 0x00, ///< Pulled down by 100k Ohm + MON_PULLDOWN = 0x00, ///< Pulled down by 100k Ohm MON_HI_Z = 0x08, ///< High Impedance MON_SWIN = 0x80, ///< SWIN Selected MON_SWOUT = 0x81, ///< SWOUT Selected @@ -188,10 +188,10 @@ MON_LOUT = 0x87, ///< LOUT Selected } monCfg_t; - /** + /** * @brief Under-Voltage Lock Out Input * @details Enumerated input selection options for UVLO - */ + */ typedef enum { LIN_UVLO, ///< LIN used to determine UVLO condition BIN_UVLO, ///< BIN used to determine UVLO condition @@ -221,21 +221,23 @@ /** * @brief Initialize MAX14720 - * @details Applies settings to MAX14720. + * @details Applies settings to MAX14720. * Settings are stored in public variables. - * The variables are pre-loaded with the most common configuation. + * The variables are pre-loaded with the most common configuation. * Assign new values to the public variables before calling init. + * This will update all the settings including the boost voltage + * from boostMillivolts and the boost enable mode from boostEn. * @returns 0 if no errors, -1 if error. */ int init(); /** * @brief Set the Boost Voltage - * @details Sets the voltage for the boost regulator. - * The voltage is specified in millivoltst. + * @details Sets the voltage for the boost regulator. + * The voltage is specified in millivolts. * The MAX14720 cannot update the voltage when enabled. - * This function checks the local boostEn variable and if the - * regualtor is enabled it will send the disable command before + * This function checks the local boostEn variable and if the + * regualtor is enabled it will send the disable command before * sending the new voltage and re-enable the boost regulator after * the new voltage is written. * @param mV voltage for boost regualtor in millivolts @@ -285,27 +287,48 @@ */ int readReg(registers_t reg, char *value); - bool clkDivEn; /// Boost Clock Divider Enable - int clkDivSet; /// Boost Clock Divider Setting - boostISet_t boostISet; /// Boost Peak Current Setting - int boostMillivolts; /// Boost Voltage in millivolts - boostEn_t boostEn; /// Boost Enable Mode - bool boostEMI, /// Boost EMI Setting - boostInd, /// Boost Inductor Setting - boostHysOff, /// Boost Hysteresis Off - boostPasDsc, /// Boost Passive Discharge - boostActDsc; /// Boost Active Discharge - buckMd_t buckMd; /// Buck Operating Mode - bool buckFst; /// Buck Fast Start - buckISet_t buckISet; /// Buck Peak Current Setting - bool buckCfg, /// Buck Configuration (Set to 1 when using FPWM mode) - buckInd, /// Buck Inductor Setting - buckHysOff, /// Buck Hysteresis Off - buckMinOT, /// Buck Minimum On Time - buckInteg, /// Buck Integrate - buckPasDsc, /// Buck Passive Discharge - buckActDsc, /// Buck Active Discharge - buckFScl; /// Buck Fet Scaling + /// Boost Clock Divider Enable: default 0 - Disabled, 1 - Enabled + bool clkDivEn; + /// Boost Clock Divider Setting: default 0, The clock is divided by this value +10 when enabled + int clkDivSet; + /// Boost Peak Current Setting: default BOOST_ISET_100mA + boostISet_t boostISet; + /// Boost Voltage in millivolts: default 3300 + int boostMillivolts; + /// Boost Enable Mode: default BOOST_DISABLED + boostEn_t boostEn; + /// Boost EMI Setting: default 0 - EMI damping active (lower noise), 1 - Damping disabled (more efficient) + bool boostEMI; + /// Boost Inductor Setting: default 0 - 4.7uH, 1 - 3.3uH + bool boostInd; + /// Boost Hysteresis Off: default 0 - Hysteresis enabled (more efficient), 1 - Hysteresis off (lower voltage ripple) + bool boostHysOff; + /// Boost Passive Discharge: default 0 - Disabled, 1 - Enabled when boost disabled + bool boostPasDsc; + /// Boost Active Discharge: default 0 - Disabled, 1 - Enabled when boost disabled + bool boostActDsc; + /// Buck Operating Mode: default BUCK_BURST + buckMd_t buckMd; + /// Buck Fast Start: default 0 - Normal startup current limit, 1 - Double startup current for fast start + bool buckFst; + /// Buck Peak Current Setting: default BUCK_ISET_300mA + buckISet_t buckISet; + /// Buck Configuration: default 0 - For burst mode, 1 - For FPWM mode + bool buckCfg; + /// Buck Inductor Setting: default 0 - 2.2uH, 1 - 4.7uH + bool buckInd; + /// Buck Hysteresis Off: default 0 - Hysteresis enabled (more efficient), 1 - Hysteresis off (lower voltage ripple) + bool buckHysOff; + /// Buck Minimum On Time: default 1 - Disable deglitch delay (lower voltage ripple), 0 - Enable deglitch dealy (more efficient) + bool buckMinOT; + /// Buck Integrate: default 1 - Better load regulation at higher current (recommended for output capacitance >6uF), 0 - More stable operation with smaller output capacitor + bool buckInteg; + /// Buck Passive Discharge: default 0 - Disabled, 1 - Enabled when buck disabled + bool buckPasDsc; + /// Buck Active Discharge: default 0 - Disabled, 1 - Enabled when buck disabled + bool buckActDsc; + /// Buck Fet Scaling: default 0 - Full buck FET after soft start (more efficient for larger loads), 1 - Reduced buck FET while active (lower quiescent current for light loads) + bool buckFScl; private: /// I2C pointer