MAX14690 Library
Dependents: MAX32630HSP3_IMU_HelloWorld MAX32630HSP3_IMU_HelloWorld max32630fthr max4146x_comp ... more
Fork of MAX14690 by
MAX14720.h@8:2c3f2da51c5d, 2016-10-19 (annotated)
- Committer:
- jessexm
- Date:
- Wed Oct 19 22:32:56 2016 +0000
- Revision:
- 8:2c3f2da51c5d
- Parent:
- 7:2e9f6e70b34f
Code review updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jbradshaw | 0:0e40db4a2b3e | 1 | /******************************************************************************* |
jessexm | 8:2c3f2da51c5d | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
jbradshaw | 0:0e40db4a2b3e | 3 | * |
jbradshaw | 0:0e40db4a2b3e | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
jbradshaw | 0:0e40db4a2b3e | 5 | * copy of this software and associated documentation files (the "Software"), |
jbradshaw | 0:0e40db4a2b3e | 6 | * to deal in the Software without restriction, including without limitation |
jbradshaw | 0:0e40db4a2b3e | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
jbradshaw | 0:0e40db4a2b3e | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
jbradshaw | 0:0e40db4a2b3e | 9 | * Software is furnished to do so, subject to the following conditions: |
jbradshaw | 0:0e40db4a2b3e | 10 | * |
jbradshaw | 0:0e40db4a2b3e | 11 | * The above copyright notice and this permission notice shall be included |
jbradshaw | 0:0e40db4a2b3e | 12 | * in all copies or substantial portions of the Software. |
jbradshaw | 0:0e40db4a2b3e | 13 | * |
jbradshaw | 0:0e40db4a2b3e | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
jbradshaw | 0:0e40db4a2b3e | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
jbradshaw | 0:0e40db4a2b3e | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
jbradshaw | 0:0e40db4a2b3e | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
jbradshaw | 0:0e40db4a2b3e | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
jbradshaw | 0:0e40db4a2b3e | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
jbradshaw | 0:0e40db4a2b3e | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
jbradshaw | 0:0e40db4a2b3e | 21 | * |
jbradshaw | 0:0e40db4a2b3e | 22 | * Except as contained in this notice, the name of Maxim Integrated |
jbradshaw | 0:0e40db4a2b3e | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
jbradshaw | 0:0e40db4a2b3e | 24 | * Products, Inc. Branding Policy. |
jbradshaw | 0:0e40db4a2b3e | 25 | * |
jbradshaw | 0:0e40db4a2b3e | 26 | * The mere transfer of this software does not imply any licenses |
jbradshaw | 0:0e40db4a2b3e | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
jbradshaw | 0:0e40db4a2b3e | 28 | * trademarks, maskwork rights, or any other form of intellectual |
jbradshaw | 0:0e40db4a2b3e | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
jbradshaw | 0:0e40db4a2b3e | 30 | * ownership rights. |
jbradshaw | 0:0e40db4a2b3e | 31 | ******************************************************************************* |
jbradshaw | 0:0e40db4a2b3e | 32 | */ |
jbradshaw | 0:0e40db4a2b3e | 33 | |
switches | 3:cdd88a3d3d24 | 34 | #ifndef _MAX14720_H_ |
switches | 3:cdd88a3d3d24 | 35 | #define _MAX14720_H_ |
jbradshaw | 0:0e40db4a2b3e | 36 | |
jbradshaw | 0:0e40db4a2b3e | 37 | #include "mbed.h" |
jbradshaw | 0:0e40db4a2b3e | 38 | |
jbradshaw | 0:0e40db4a2b3e | 39 | #define MAX14720_NO_ERROR 0 |
jbradshaw | 0:0e40db4a2b3e | 40 | #define MAX14720_ERROR -1 |
jbradshaw | 0:0e40db4a2b3e | 41 | |
switches | 3:cdd88a3d3d24 | 42 | #define MAX14720_BOOST_MIN_MV 2500 |
switches | 3:cdd88a3d3d24 | 43 | #define MAX14720_BOOST_MAX_MV 5000 |
switches | 3:cdd88a3d3d24 | 44 | #define MAX14720_BOOST_STEP_MV 100 |
switches | 3:cdd88a3d3d24 | 45 | |
switches | 5:0010586546d8 | 46 | /** |
jessexm | 8:2c3f2da51c5d | 47 | * @brief MAX14720 Power-Management Solution Driver |
jessexm | 8:2c3f2da51c5d | 48 | * |
jessexm | 8:2c3f2da51c5d | 49 | * @details The MAX14720/MAX14750 are compact power-management solutions for |
jessexm | 8:2c3f2da51c5d | 50 | * space-constrained, battery-powered applications where size and efficiency are |
jessexm | 8:2c3f2da51c5d | 51 | * critical. Both devices integrate a power switch, a linear regulator, a buck |
jessexm | 8:2c3f2da51c5d | 52 | * regulator, and a buck-boost regulator. |
jessexm | 8:2c3f2da51c5d | 53 | * <br>https://www.maximintegrated.com/en/products/power/battery-management/MAX14720.html |
switches | 5:0010586546d8 | 54 | * |
switches | 5:0010586546d8 | 55 | * @code |
switches | 5:0010586546d8 | 56 | * #include "mbed.h" |
switches | 5:0010586546d8 | 57 | * #include "MAX14720.h" |
switches | 6:06450093da48 | 58 | * |
switches | 5:0010586546d8 | 59 | * // I2C Master 2 |
switches | 5:0010586546d8 | 60 | * I2C i2c2(I2C2_SDA, I2C2_SCL); |
switches | 6:06450093da48 | 61 | * |
switches | 5:0010586546d8 | 62 | * #define I2C_ADDR_PMIC (0x54) |
jessexm | 8:2c3f2da51c5d | 63 | * MAX14720 max14720(&i2c2, I2C_ADDR_PMIC); |
switches | 6:06450093da48 | 64 | * |
jessexm | 8:2c3f2da51c5d | 65 | * DigitalOut led(LED1, 0); |
switches | 5:0010586546d8 | 66 | * InterruptIn button(SW1); |
switches | 6:06450093da48 | 67 | * |
switches | 5:0010586546d8 | 68 | * void turnOff() |
switches | 5:0010586546d8 | 69 | * { |
switches | 5:0010586546d8 | 70 | * max14720.shutdown(); |
switches | 5:0010586546d8 | 71 | * } |
switches | 6:06450093da48 | 72 | * |
switches | 5:0010586546d8 | 73 | * int main() |
switches | 5:0010586546d8 | 74 | * { |
switches | 5:0010586546d8 | 75 | * button.fall(&turnOff); |
jessexm | 8:2c3f2da51c5d | 76 | * |
switches | 5:0010586546d8 | 77 | * max14720.boostEn = MAX14720::BOOST_ENABLED; |
jessexm | 8:2c3f2da51c5d | 78 | * if (max14720.init() == MAX14720_ERROR) { |
jessexm | 8:2c3f2da51c5d | 79 | * printf("Error initializing MAX14720"); |
jessexm | 8:2c3f2da51c5d | 80 | * } |
jessexm | 8:2c3f2da51c5d | 81 | * |
switches | 5:0010586546d8 | 82 | * wait(1); |
jessexm | 8:2c3f2da51c5d | 83 | * |
switches | 5:0010586546d8 | 84 | * while(1) { |
switches | 5:0010586546d8 | 85 | * max14720.boostSetMode(MAX14720::BOOST_DISABLED); |
switches | 5:0010586546d8 | 86 | * max14720.boostEn = MAX14720::BOOST_ENABLED; |
switches | 5:0010586546d8 | 87 | * wait(0.5); |
switches | 5:0010586546d8 | 88 | * max14720.boostSetVoltage(2500); |
switches | 5:0010586546d8 | 89 | * wait(0.5); |
switches | 5:0010586546d8 | 90 | * max14720.boostSetVoltage(5000); |
switches | 5:0010586546d8 | 91 | * wait(0.5); |
switches | 5:0010586546d8 | 92 | * } |
switches | 5:0010586546d8 | 93 | * } |
switches | 5:0010586546d8 | 94 | * @endcode |
switches | 5:0010586546d8 | 95 | */ |
jbradshaw | 0:0e40db4a2b3e | 96 | class MAX14720 |
jbradshaw | 0:0e40db4a2b3e | 97 | { |
jbradshaw | 0:0e40db4a2b3e | 98 | public: |
switches | 4:2e4837c3b6e1 | 99 | |
switches | 6:06450093da48 | 100 | /** |
switches | 4:2e4837c3b6e1 | 101 | * @brief Register Addresses |
switches | 4:2e4837c3b6e1 | 102 | * @details Enumerated MAX14720 register addresses |
switches | 6:06450093da48 | 103 | */ |
switches | 6:06450093da48 | 104 | typedef enum { |
switches | 4:2e4837c3b6e1 | 105 | REG_CHIP_ID = 0x00, ///< Chip ID |
jessexm | 8:2c3f2da51c5d | 106 | REG_CHIP_REV = 0x01, ///< Chip Revision |
jessexm | 8:2c3f2da51c5d | 107 | REG_BOOST_CDIV = 0x03, ///< Boost Clock Divider |
jessexm | 8:2c3f2da51c5d | 108 | REG_BOOST_ISET = 0x04, ///< Boost Peak Current |
jessexm | 8:2c3f2da51c5d | 109 | REG_BOOST_VSET = 0x05, ///< Boost Voltage Setting |
jessexm | 8:2c3f2da51c5d | 110 | REG_BOOST_CFG = 0x06, ///< Boost Configuration |
jessexm | 8:2c3f2da51c5d | 111 | REG_BUCK_VSET = 0x07, ///< Buck Voltage Setting |
jessexm | 8:2c3f2da51c5d | 112 | REG_BUCK_CFG = 0x08, ///< Buck Configuration |
jessexm | 8:2c3f2da51c5d | 113 | REG_BUCK_ISET = 0x09, ///< Buck Peak Current and Settings |
jessexm | 8:2c3f2da51c5d | 114 | REG_LDO_VSET = 0x0A, ///< LDO Voltage Setting |
switches | 4:2e4837c3b6e1 | 115 | REG_LDO_CFG = 0x0B, ///< LDO Configuration |
jessexm | 8:2c3f2da51c5d | 116 | REG_SWITCH_CFG = 0x0C, ///< Switch Configuration |
jessexm | 8:2c3f2da51c5d | 117 | REG_BAT_TIME = 0x0D, ///< Battery Impedance Timing |
switches | 4:2e4837c3b6e1 | 118 | REG_BAT_CFG = 0x0E, ///< Battery Impedance Configuration |
switches | 4:2e4837c3b6e1 | 119 | REG_BAT_BCV = 0x0F, ///< Battery Cell Voltage |
switches | 4:2e4837c3b6e1 | 120 | REG_BAT_OCV = 0x10, ///< Open Cell Voltage |
switches | 4:2e4837c3b6e1 | 121 | REG_BAT_LCV = 0x11, ///< Loaded Cell Voltage |
switches | 4:2e4837c3b6e1 | 122 | REG_MON_CFG = 0x19, ///< Monitor Multiplexer Configuration |
jessexm | 8:2c3f2da51c5d | 123 | REG_BOOT_CFG = 0x1A, ///< Boot Configuration |
jessexm | 8:2c3f2da51c5d | 124 | REG_PIN_STAT = 0x1B, ///< Pin Status |
jessexm | 8:2c3f2da51c5d | 125 | REG_BBB_EXTRA = 0x1C, ///< Buck/Buck-Boost Extra |
switches | 4:2e4837c3b6e1 | 126 | REG_HANDSHK = 0x1D, ///< Power-On Handshake |
jessexm | 8:2c3f2da51c5d | 127 | REG_UVLO_CFG = 0x1E, ///< Under-Voltage Lock Out |
switches | 4:2e4837c3b6e1 | 128 | REG_PWR_OFF = 0x1F, ///< Power Off Command |
switches | 3:cdd88a3d3d24 | 129 | } registers_t; |
jbradshaw | 0:0e40db4a2b3e | 130 | |
switches | 6:06450093da48 | 131 | /** |
switches | 4:2e4837c3b6e1 | 132 | * @brief Boost Peak Current Settings |
switches | 4:2e4837c3b6e1 | 133 | * @details Enumerated peak current settings for boost regulator |
switches | 6:06450093da48 | 134 | */ |
switches | 4:2e4837c3b6e1 | 135 | typedef enum { |
switches | 4:2e4837c3b6e1 | 136 | BOOST_ISET_MIN, ///< Minimum On-Time |
switches | 4:2e4837c3b6e1 | 137 | BOOST_ISET_50mA, ///< 50mA Peak Current |
switches | 4:2e4837c3b6e1 | 138 | BOOST_ISET_100mA, ///< 100mA Peak Current |
switches | 4:2e4837c3b6e1 | 139 | BOOST_ISET_150mA, ///< 150mA Peak Current |
switches | 4:2e4837c3b6e1 | 140 | BOOST_ISET_200mA, ///< 200mA Peak Current |
switches | 4:2e4837c3b6e1 | 141 | BOOST_ISET_250mA, ///< 250mA Peak Current |
switches | 4:2e4837c3b6e1 | 142 | BOOST_ISET_300mA, ///< 300mA Peak Current |
switches | 4:2e4837c3b6e1 | 143 | BOOST_ISET_350mA, ///< 350mA Peak Current |
switches | 4:2e4837c3b6e1 | 144 | } boostISet_t; |
jbradshaw | 0:0e40db4a2b3e | 145 | |
switches | 6:06450093da48 | 146 | /** |
switches | 4:2e4837c3b6e1 | 147 | * @brief Boost Enable Mode |
switches | 4:2e4837c3b6e1 | 148 | * @details Enumerated enable modes for boost regulator |
switches | 6:06450093da48 | 149 | */ |
switches | 4:2e4837c3b6e1 | 150 | typedef enum { |
switches | 4:2e4837c3b6e1 | 151 | BOOST_DISABLED, ///< Boost Disabled |
switches | 4:2e4837c3b6e1 | 152 | BOOST_ENABLED, ///< Boost Enabled |
switches | 4:2e4837c3b6e1 | 153 | BOOST_EN_MPC, ///< Boost Enabled by MPC pin |
switches | 4:2e4837c3b6e1 | 154 | } boostEn_t; |
jbradshaw | 0:0e40db4a2b3e | 155 | |
switches | 6:06450093da48 | 156 | /** |
switches | 4:2e4837c3b6e1 | 157 | * @brief Buck Operating Modes |
switches | 4:2e4837c3b6e1 | 158 | * @details Enumerated operating modes for buck regulator |
switches | 6:06450093da48 | 159 | */ |
switches | 4:2e4837c3b6e1 | 160 | typedef enum { |
switches | 6:06450093da48 | 161 | BUCK_BURST, ///< Burst Mode Operation |
switches | 4:2e4837c3b6e1 | 162 | BUCK_FPWM, ///< Forced PWM Operation |
switches | 4:2e4837c3b6e1 | 163 | BUCK_MPC_FPWM, ///< MPC activated Forced PWM |
switches | 4:2e4837c3b6e1 | 164 | } buckMd_t; |
switches | 4:2e4837c3b6e1 | 165 | |
switches | 6:06450093da48 | 166 | /** |
switches | 4:2e4837c3b6e1 | 167 | * @brief Buck Peak Current Settings |
switches | 4:2e4837c3b6e1 | 168 | * @details Enumerated peak current settings for buck regulator |
switches | 6:06450093da48 | 169 | */ |
switches | 4:2e4837c3b6e1 | 170 | typedef enum { |
switches | 4:2e4837c3b6e1 | 171 | BUCK_ISET_50mA, ///< 50mA Peak Current |
switches | 4:2e4837c3b6e1 | 172 | BUCK_ISET_100mA, ///< 100mA Peak Current |
switches | 4:2e4837c3b6e1 | 173 | BUCK_ISET_150mA, ///< 150mA Peak Current |
switches | 4:2e4837c3b6e1 | 174 | BUCK_ISET_200mA, ///< 200mA Peak Current |
switches | 4:2e4837c3b6e1 | 175 | BUCK_ISET_250mA, ///< 250mA Peak Current |
switches | 4:2e4837c3b6e1 | 176 | BUCK_ISET_300mA, ///< 300mA Peak Current |
switches | 4:2e4837c3b6e1 | 177 | BUCK_ISET_350mA, ///< 350mA Peak Current |
switches | 4:2e4837c3b6e1 | 178 | BUCK_ISET_400mA, ///< 400mA Peak Current |
switches | 4:2e4837c3b6e1 | 179 | } buckISet_t; |
switches | 4:2e4837c3b6e1 | 180 | |
switches | 6:06450093da48 | 181 | /** |
switches | 4:2e4837c3b6e1 | 182 | * @brief Monitor Configurations |
switches | 4:2e4837c3b6e1 | 183 | * @details Enumerated configuration modes for monitor multiplexer |
switches | 6:06450093da48 | 184 | */ |
switches | 4:2e4837c3b6e1 | 185 | typedef enum { |
switches | 6:06450093da48 | 186 | MON_PULLDOWN = 0x00, ///< Pulled down by 100k Ohm |
jessexm | 8:2c3f2da51c5d | 187 | MON_HI_Z = 0x08, ///< High Impedance |
jessexm | 8:2c3f2da51c5d | 188 | MON_SWIN = 0x80, ///< SWIN Selected |
jessexm | 8:2c3f2da51c5d | 189 | MON_SWOUT = 0x81, ///< SWOUT Selected |
jessexm | 8:2c3f2da51c5d | 190 | MON_BIN = 0x82, ///< BIN Selected |
jessexm | 8:2c3f2da51c5d | 191 | MON_BOUT = 0x83, ///< BOUT Selected |
jessexm | 8:2c3f2da51c5d | 192 | MON_HVIN = 0x84, ///< HVIN Selected |
jessexm | 8:2c3f2da51c5d | 193 | MON_HVOUT = 0x85, ///< HVOUT Selected |
jessexm | 8:2c3f2da51c5d | 194 | MON_LIN = 0x86, ///< LIN Selected |
jessexm | 8:2c3f2da51c5d | 195 | MON_LOUT = 0x87, ///< LOUT Selected |
switches | 4:2e4837c3b6e1 | 196 | } monCfg_t; |
jbradshaw | 0:0e40db4a2b3e | 197 | |
switches | 6:06450093da48 | 198 | /** |
switches | 4:2e4837c3b6e1 | 199 | * @brief Under-Voltage Lock Out Input |
switches | 4:2e4837c3b6e1 | 200 | * @details Enumerated input selection options for UVLO |
switches | 6:06450093da48 | 201 | */ |
switches | 4:2e4837c3b6e1 | 202 | typedef enum { |
switches | 4:2e4837c3b6e1 | 203 | LIN_UVLO, ///< LIN used to determine UVLO condition |
switches | 4:2e4837c3b6e1 | 204 | BIN_UVLO, ///< BIN used to determine UVLO condition |
switches | 4:2e4837c3b6e1 | 205 | } uvloIn_t; |
switches | 4:2e4837c3b6e1 | 206 | |
switches | 4:2e4837c3b6e1 | 207 | /** |
switches | 4:2e4837c3b6e1 | 208 | * MAX14720 constructor. |
switches | 4:2e4837c3b6e1 | 209 | * |
switches | 4:2e4837c3b6e1 | 210 | * @param sda mbed pin to use for SDA line of I2C interface. |
switches | 4:2e4837c3b6e1 | 211 | * @param scl mbed pin to use for SCL line of I2C interface. |
switches | 4:2e4837c3b6e1 | 212 | * @param slaveAddress Slave Address of the device. |
switches | 4:2e4837c3b6e1 | 213 | */ |
switches | 4:2e4837c3b6e1 | 214 | MAX14720(PinName sda, PinName scl, int slaveAddress); |
switches | 4:2e4837c3b6e1 | 215 | |
switches | 4:2e4837c3b6e1 | 216 | /** |
switches | 4:2e4837c3b6e1 | 217 | * MAX14720 constructor. |
switches | 4:2e4837c3b6e1 | 218 | * |
switches | 4:2e4837c3b6e1 | 219 | * @param i2c I2C object to use. |
switches | 4:2e4837c3b6e1 | 220 | * @param slaveAddress Slave Address of the device. |
switches | 4:2e4837c3b6e1 | 221 | */ |
switches | 4:2e4837c3b6e1 | 222 | MAX14720(I2C *i2c, int slaveAddress); |
jbradshaw | 0:0e40db4a2b3e | 223 | |
switches | 4:2e4837c3b6e1 | 224 | /** |
switches | 4:2e4837c3b6e1 | 225 | * MAX14720 destructor. |
switches | 4:2e4837c3b6e1 | 226 | */ |
switches | 4:2e4837c3b6e1 | 227 | ~MAX14720(); |
switches | 4:2e4837c3b6e1 | 228 | |
switches | 4:2e4837c3b6e1 | 229 | /** |
switches | 4:2e4837c3b6e1 | 230 | * @brief Initialize MAX14720 |
switches | 6:06450093da48 | 231 | * @details Applies settings to MAX14720. |
switches | 4:2e4837c3b6e1 | 232 | * Settings are stored in public variables. |
switches | 6:06450093da48 | 233 | * The variables are pre-loaded with the most common configuation. |
switches | 4:2e4837c3b6e1 | 234 | * Assign new values to the public variables before calling init. |
switches | 6:06450093da48 | 235 | * This will update all the settings including the boost voltage |
switches | 6:06450093da48 | 236 | * from boostMillivolts and the boost enable mode from boostEn. |
switches | 4:2e4837c3b6e1 | 237 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 238 | */ |
switches | 4:2e4837c3b6e1 | 239 | int init(); |
switches | 4:2e4837c3b6e1 | 240 | |
switches | 4:2e4837c3b6e1 | 241 | /** |
switches | 4:2e4837c3b6e1 | 242 | * @brief Set the Boost Voltage |
switches | 6:06450093da48 | 243 | * @details Sets the voltage for the boost regulator. |
switches | 6:06450093da48 | 244 | * The voltage is specified in millivolts. |
switches | 4:2e4837c3b6e1 | 245 | * The MAX14720 cannot update the voltage when enabled. |
switches | 6:06450093da48 | 246 | * This function checks the local boostEn variable and if the |
switches | 6:06450093da48 | 247 | * regualtor is enabled it will send the disable command before |
switches | 4:2e4837c3b6e1 | 248 | * sending the new voltage and re-enable the boost regulator after |
switches | 4:2e4837c3b6e1 | 249 | * the new voltage is written. |
switches | 4:2e4837c3b6e1 | 250 | * @param mV voltage for boost regualtor in millivolts |
switches | 4:2e4837c3b6e1 | 251 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 252 | */ |
switches | 4:2e4837c3b6e1 | 253 | int boostSetVoltage(int mV); |
jbradshaw | 0:0e40db4a2b3e | 254 | |
switches | 4:2e4837c3b6e1 | 255 | /** |
switches | 4:2e4837c3b6e1 | 256 | * @brief Set Boost Enable Mode |
switches | 4:2e4837c3b6e1 | 257 | * @details Sets the enable mode for the boost regulator |
switches | 4:2e4837c3b6e1 | 258 | * @param mode The enable mode for the boost regulator |
switches | 4:2e4837c3b6e1 | 259 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 260 | */ |
switches | 4:2e4837c3b6e1 | 261 | int boostSetMode(boostEn_t mode); |
switches | 4:2e4837c3b6e1 | 262 | |
switches | 4:2e4837c3b6e1 | 263 | /** |
switches | 4:2e4837c3b6e1 | 264 | * @brief Configure Mon Pin |
switches | 4:2e4837c3b6e1 | 265 | * @details Configures the operating mode of the monitor multiplexer |
switches | 4:2e4837c3b6e1 | 266 | * @param monCfg The configuration mode for the monitor pin |
switches | 4:2e4837c3b6e1 | 267 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 268 | */ |
switches | 4:2e4837c3b6e1 | 269 | int monSet(monCfg_t monCfg); |
switches | 4:2e4837c3b6e1 | 270 | |
switches | 4:2e4837c3b6e1 | 271 | /** |
switches | 4:2e4837c3b6e1 | 272 | * @brief Shutdown |
switches | 4:2e4837c3b6e1 | 273 | * @details Sends the command to turn off all supplies and put the part |
switches | 4:2e4837c3b6e1 | 274 | * in battery saving shelf mode. |
switches | 4:2e4837c3b6e1 | 275 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 276 | */ |
switches | 4:2e4837c3b6e1 | 277 | int shutdown(); |
jbradshaw | 0:0e40db4a2b3e | 278 | |
switches | 4:2e4837c3b6e1 | 279 | /** |
switches | 4:2e4837c3b6e1 | 280 | * @brief Write Register |
switches | 7:2e9f6e70b34f | 281 | * @details Writes the given value to the specified register. |
switches | 7:2e9f6e70b34f | 282 | * Note, this function provides direct access to the registers |
switches | 7:2e9f6e70b34f | 283 | * without any awareness or effect on the settings stored in |
switches | 7:2e9f6e70b34f | 284 | * the public variables. This is used by the other functions to |
switches | 7:2e9f6e70b34f | 285 | * set the values inside the MAX14720. Calling this outside of the |
switches | 7:2e9f6e70b34f | 286 | * other functions can break the synchronization of the variables |
switches | 7:2e9f6e70b34f | 287 | * to the state of the MAX14720. |
switches | 4:2e4837c3b6e1 | 288 | * @param reg The register to be written |
switches | 4:2e4837c3b6e1 | 289 | * @param value The data to be written |
switches | 4:2e4837c3b6e1 | 290 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 291 | */ |
switches | 4:2e4837c3b6e1 | 292 | int writeReg(registers_t reg, char value); |
switches | 4:2e4837c3b6e1 | 293 | |
switches | 4:2e4837c3b6e1 | 294 | /** |
switches | 4:2e4837c3b6e1 | 295 | * @brief Read Register |
switches | 4:2e4837c3b6e1 | 296 | * @details Reads from the specified register |
switches | 4:2e4837c3b6e1 | 297 | * @param reg The register to be read |
switches | 4:2e4837c3b6e1 | 298 | * @param value Pointer for where to store the data |
switches | 4:2e4837c3b6e1 | 299 | * @returns 0 if no errors, -1 if error. |
switches | 4:2e4837c3b6e1 | 300 | */ |
switches | 4:2e4837c3b6e1 | 301 | int readReg(registers_t reg, char *value); |
switches | 3:cdd88a3d3d24 | 302 | |
switches | 6:06450093da48 | 303 | /// Boost Clock Divider Enable: default 0 - Disabled, 1 - Enabled |
switches | 6:06450093da48 | 304 | bool clkDivEn; |
switches | 6:06450093da48 | 305 | /// Boost Clock Divider Setting: default 0, The clock is divided by this value +10 when enabled |
switches | 6:06450093da48 | 306 | int clkDivSet; |
switches | 6:06450093da48 | 307 | /// Boost Peak Current Setting: default BOOST_ISET_100mA |
switches | 6:06450093da48 | 308 | boostISet_t boostISet; |
switches | 6:06450093da48 | 309 | /// Boost Voltage in millivolts: default 3300 |
switches | 6:06450093da48 | 310 | int boostMillivolts; |
switches | 6:06450093da48 | 311 | /// Boost Enable Mode: default BOOST_DISABLED |
switches | 6:06450093da48 | 312 | boostEn_t boostEn; |
switches | 6:06450093da48 | 313 | /// Boost EMI Setting: default 0 - EMI damping active (lower noise), 1 - Damping disabled (more efficient) |
switches | 6:06450093da48 | 314 | bool boostEMI; |
switches | 6:06450093da48 | 315 | /// Boost Inductor Setting: default 0 - 4.7uH, 1 - 3.3uH |
switches | 6:06450093da48 | 316 | bool boostInd; |
switches | 6:06450093da48 | 317 | /// Boost Hysteresis Off: default 0 - Hysteresis enabled (more efficient), 1 - Hysteresis off (lower voltage ripple) |
switches | 6:06450093da48 | 318 | bool boostHysOff; |
switches | 6:06450093da48 | 319 | /// Boost Passive Discharge: default 0 - Disabled, 1 - Enabled when boost disabled |
switches | 6:06450093da48 | 320 | bool boostPasDsc; |
switches | 6:06450093da48 | 321 | /// Boost Active Discharge: default 0 - Disabled, 1 - Enabled when boost disabled |
switches | 6:06450093da48 | 322 | bool boostActDsc; |
switches | 6:06450093da48 | 323 | /// Buck Operating Mode: default BUCK_BURST |
switches | 6:06450093da48 | 324 | buckMd_t buckMd; |
switches | 6:06450093da48 | 325 | /// Buck Fast Start: default 0 - Normal startup current limit, 1 - Double startup current for fast start |
switches | 6:06450093da48 | 326 | bool buckFst; |
switches | 6:06450093da48 | 327 | /// Buck Peak Current Setting: default BUCK_ISET_300mA |
switches | 6:06450093da48 | 328 | buckISet_t buckISet; |
switches | 6:06450093da48 | 329 | /// Buck Configuration: default 0 - For burst mode, 1 - For FPWM mode |
switches | 6:06450093da48 | 330 | bool buckCfg; |
switches | 6:06450093da48 | 331 | /// Buck Inductor Setting: default 0 - 2.2uH, 1 - 4.7uH |
switches | 6:06450093da48 | 332 | bool buckInd; |
switches | 6:06450093da48 | 333 | /// Buck Hysteresis Off: default 0 - Hysteresis enabled (more efficient), 1 - Hysteresis off (lower voltage ripple) |
switches | 6:06450093da48 | 334 | bool buckHysOff; |
switches | 6:06450093da48 | 335 | /// Buck Minimum On Time: default 1 - Disable deglitch delay (lower voltage ripple), 0 - Enable deglitch dealy (more efficient) |
switches | 6:06450093da48 | 336 | bool buckMinOT; |
switches | 6:06450093da48 | 337 | /// Buck Integrate: default 1 - Better load regulation at higher current (recommended for output capacitance >6uF), 0 - More stable operation with smaller output capacitor |
switches | 6:06450093da48 | 338 | bool buckInteg; |
switches | 6:06450093da48 | 339 | /// Buck Passive Discharge: default 0 - Disabled, 1 - Enabled when buck disabled |
switches | 6:06450093da48 | 340 | bool buckPasDsc; |
switches | 6:06450093da48 | 341 | /// Buck Active Discharge: default 0 - Disabled, 1 - Enabled when buck disabled |
switches | 6:06450093da48 | 342 | bool buckActDsc; |
switches | 6:06450093da48 | 343 | /// 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) |
switches | 6:06450093da48 | 344 | bool buckFScl; |
switches | 3:cdd88a3d3d24 | 345 | |
jbradshaw | 0:0e40db4a2b3e | 346 | private: |
switches | 4:2e4837c3b6e1 | 347 | /// I2C pointer |
switches | 4:2e4837c3b6e1 | 348 | I2C *i2c; |
switches | 4:2e4837c3b6e1 | 349 | /// Is this object the owner of the I2C object |
switches | 4:2e4837c3b6e1 | 350 | bool isOwner; |
switches | 4:2e4837c3b6e1 | 351 | /// Device slave address |
switches | 4:2e4837c3b6e1 | 352 | int slaveAddress; |
jbradshaw | 0:0e40db4a2b3e | 353 | }; |
jbradshaw | 0:0e40db4a2b3e | 354 | |
switches | 5:0010586546d8 | 355 | #endif /* _MAX14720_H_ */ |