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 MAX14690 by
MAX14690.h@10:32c7e2ab67aa, 2016-11-18 (annotated)
- Committer:
- switches
- Date:
- Fri Nov 18 22:06:28 2016 +0000
- Revision:
- 10:32c7e2ab67aa
- Parent:
- 9:8fb54367ceb5
- Child:
- 11:022bcd2ea263
New library for MAX14690N
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 | 9:8fb54367ceb5 | 34 | #ifndef _MAX14690_H_ |
| switches | 9:8fb54367ceb5 | 35 | #define _MAX14690_H_ |
| jbradshaw | 0:0e40db4a2b3e | 36 | |
| jbradshaw | 0:0e40db4a2b3e | 37 | #include "mbed.h" |
| jbradshaw | 0:0e40db4a2b3e | 38 | |
| switches | 9:8fb54367ceb5 | 39 | #define MAX14690_NO_ERROR 0 |
| switches | 9:8fb54367ceb5 | 40 | #define MAX14690_ERROR -1 |
| jbradshaw | 0:0e40db4a2b3e | 41 | |
| switches | 10:32c7e2ab67aa | 42 | #define MAX14690_I2C_ADDR 0x50 |
| switches | 10:32c7e2ab67aa | 43 | |
| switches | 10:32c7e2ab67aa | 44 | #define MAX14690_LDO_MIN_MV 800 |
| switches | 10:32c7e2ab67aa | 45 | #define MAX14690_LDO_MAX_MV 3600 |
| switches | 10:32c7e2ab67aa | 46 | #define MAX14690_LDO_STEP_MV 100 |
| switches | 10:32c7e2ab67aa | 47 | |
| switches | 10:32c7e2ab67aa | 48 | #define MAX14690_OFF_COMMAND 0xB2 |
| switches | 3:cdd88a3d3d24 | 49 | |
| switches | 5:0010586546d8 | 50 | /** |
| switches | 9:8fb54367ceb5 | 51 | * @brief MAX14690 Power-Management Solution Driver |
| jessexm | 8:2c3f2da51c5d | 52 | * |
| switches | 9:8fb54367ceb5 | 53 | * @details The MAX14690/MAX14750 are compact power-management solutions for |
| jessexm | 8:2c3f2da51c5d | 54 | * space-constrained, battery-powered applications where size and efficiency are |
| jessexm | 8:2c3f2da51c5d | 55 | * critical. Both devices integrate a power switch, a linear regulator, a buck |
| jessexm | 8:2c3f2da51c5d | 56 | * regulator, and a buck-boost regulator. |
| switches | 9:8fb54367ceb5 | 57 | * <br>https://www.maximintegrated.com/en/products/power/battery-management/MAX14690.html |
| switches | 5:0010586546d8 | 58 | * |
| switches | 5:0010586546d8 | 59 | * @code |
| switches | 5:0010586546d8 | 60 | * #include "mbed.h" |
| switches | 9:8fb54367ceb5 | 61 | * #include "MAX14690.h" |
| switches | 6:06450093da48 | 62 | * |
| switches | 5:0010586546d8 | 63 | * // I2C Master 2 |
| switches | 5:0010586546d8 | 64 | * I2C i2c2(I2C2_SDA, I2C2_SCL); |
| switches | 6:06450093da48 | 65 | * |
| switches | 5:0010586546d8 | 66 | * #define I2C_ADDR_PMIC (0x54) |
| switches | 9:8fb54367ceb5 | 67 | * MAX14690 max14690(&i2c2, I2C_ADDR_PMIC); |
| switches | 6:06450093da48 | 68 | * |
| jessexm | 8:2c3f2da51c5d | 69 | * DigitalOut led(LED1, 0); |
| switches | 5:0010586546d8 | 70 | * InterruptIn button(SW1); |
| switches | 6:06450093da48 | 71 | * |
| switches | 5:0010586546d8 | 72 | * void turnOff() |
| switches | 5:0010586546d8 | 73 | * { |
| switches | 9:8fb54367ceb5 | 74 | * max14690.shutdown(); |
| switches | 5:0010586546d8 | 75 | * } |
| switches | 6:06450093da48 | 76 | * |
| switches | 5:0010586546d8 | 77 | * int main() |
| switches | 5:0010586546d8 | 78 | * { |
| switches | 5:0010586546d8 | 79 | * button.fall(&turnOff); |
| jessexm | 8:2c3f2da51c5d | 80 | * |
| switches | 9:8fb54367ceb5 | 81 | * max14690.boostEn = MAX14690::BOOST_ENABLED; |
| switches | 9:8fb54367ceb5 | 82 | * if (max14690.init() == MAX14690_ERROR) { |
| switches | 9:8fb54367ceb5 | 83 | * printf("Error initializing MAX14690"); |
| jessexm | 8:2c3f2da51c5d | 84 | * } |
| jessexm | 8:2c3f2da51c5d | 85 | * |
| switches | 5:0010586546d8 | 86 | * wait(1); |
| jessexm | 8:2c3f2da51c5d | 87 | * |
| switches | 5:0010586546d8 | 88 | * while(1) { |
| switches | 9:8fb54367ceb5 | 89 | * max14690.boostSetMode(MAX14690::BOOST_DISABLED); |
| switches | 9:8fb54367ceb5 | 90 | * max14690.boostEn = MAX14690::BOOST_ENABLED; |
| switches | 5:0010586546d8 | 91 | * wait(0.5); |
| switches | 9:8fb54367ceb5 | 92 | * max14690.boostSetVoltage(2500); |
| switches | 5:0010586546d8 | 93 | * wait(0.5); |
| switches | 9:8fb54367ceb5 | 94 | * max14690.boostSetVoltage(5000); |
| switches | 5:0010586546d8 | 95 | * wait(0.5); |
| switches | 5:0010586546d8 | 96 | * } |
| switches | 5:0010586546d8 | 97 | * } |
| switches | 5:0010586546d8 | 98 | * @endcode |
| switches | 5:0010586546d8 | 99 | */ |
| switches | 9:8fb54367ceb5 | 100 | class MAX14690 |
| jbradshaw | 0:0e40db4a2b3e | 101 | { |
| jbradshaw | 0:0e40db4a2b3e | 102 | public: |
| switches | 4:2e4837c3b6e1 | 103 | |
| switches | 6:06450093da48 | 104 | /** |
| switches | 4:2e4837c3b6e1 | 105 | * @brief Register Addresses |
| switches | 9:8fb54367ceb5 | 106 | * @details Enumerated MAX14690 register addresses |
| switches | 6:06450093da48 | 107 | */ |
| switches | 6:06450093da48 | 108 | typedef enum { |
| switches | 4:2e4837c3b6e1 | 109 | REG_CHIP_ID = 0x00, ///< Chip ID |
| jessexm | 8:2c3f2da51c5d | 110 | REG_CHIP_REV = 0x01, ///< Chip Revision |
| switches | 9:8fb54367ceb5 | 111 | REG_STATUS_A = 0x02, ///< |
| switches | 9:8fb54367ceb5 | 112 | REG_STATUS_B = 0x03, ///< |
| switches | 9:8fb54367ceb5 | 113 | REG_STATUS_C = 0x04, ///< |
| switches | 9:8fb54367ceb5 | 114 | REG_INT_A = 0x05, ///< |
| switches | 9:8fb54367ceb5 | 115 | REG_INT_B = 0x06, ///< |
| switches | 9:8fb54367ceb5 | 116 | REG_INT_MASK_A = 0x07, ///< |
| switches | 9:8fb54367ceb5 | 117 | REG_INT_MASK_B = 0x08, ///< |
| switches | 9:8fb54367ceb5 | 118 | REG_I_LIM_CNTL = 0x09, ///< |
| switches | 9:8fb54367ceb5 | 119 | REG_CHG_CNTL_A = 0x0A, ///< |
| switches | 9:8fb54367ceb5 | 120 | REG_CHG_CNTL_B = 0x0B, ///< |
| switches | 9:8fb54367ceb5 | 121 | REG_CHG_TMR = 0x0C, ///< |
| switches | 9:8fb54367ceb5 | 122 | REG_BUCK1_CFG = 0x0D, ///< |
| switches | 9:8fb54367ceb5 | 123 | REG_BUCK1_VSET = 0x0E, ///< |
| switches | 9:8fb54367ceb5 | 124 | REG_BUCK2_CFG = 0x0F, ///< |
| switches | 10:32c7e2ab67aa | 125 | REG_BUCK2_VSET = 0x10, ///< |
| switches | 9:8fb54367ceb5 | 126 | REG_RSVD_11 = 0x11, ///< |
| switches | 9:8fb54367ceb5 | 127 | REG_LDO1_CFG = 0x12, ///< |
| switches | 9:8fb54367ceb5 | 128 | REG_LDO1_VSET = 0x13, ///< |
| switches | 9:8fb54367ceb5 | 129 | REG_LDO2_CFG = 0x14, ///< |
| switches | 9:8fb54367ceb5 | 130 | REG_LDO2_VSET = 0x15, ///< |
| switches | 9:8fb54367ceb5 | 131 | REG_LDO3_CFG = 0x16, ///< |
| switches | 9:8fb54367ceb5 | 132 | REG_LDO3_VSET = 0x17, ///< |
| switches | 9:8fb54367ceb5 | 133 | REG_THRM_CFG = 0x18, ///< |
| switches | 9:8fb54367ceb5 | 134 | REG_MON_CFG = 0x19, ///< |
| switches | 9:8fb54367ceb5 | 135 | REG_BOOT_CFG = 0x1A, ///< |
| switches | 9:8fb54367ceb5 | 136 | REG_PIN_STATUS = 0x1B, ///< |
| switches | 9:8fb54367ceb5 | 137 | REG_BUCK_EXTRA = 0x1C, ///< |
| switches | 9:8fb54367ceb5 | 138 | REG_PWR_CFG = 0x1D, ///< |
| switches | 9:8fb54367ceb5 | 139 | REG_NULL = 0x1E, ///< |
| switches | 9:8fb54367ceb5 | 140 | REG_PWR_OFF = 0x1F, ///< |
| switches | 3:cdd88a3d3d24 | 141 | } registers_t; |
| jbradshaw | 0:0e40db4a2b3e | 142 | |
| switches | 6:06450093da48 | 143 | /** |
| switches | 10:32c7e2ab67aa | 144 | * @brief Thermal Status |
| switches | 10:32c7e2ab67aa | 145 | * @details Thermal status determined by thermistor |
| switches | 9:8fb54367ceb5 | 146 | */ |
| switches | 9:8fb54367ceb5 | 147 | typedef enum { |
| switches | 9:8fb54367ceb5 | 148 | THMSTAT_000, ///< T < T1 |
| switches | 9:8fb54367ceb5 | 149 | THMSTAT_001, ///< T1 < T < T2 |
| switches | 9:8fb54367ceb5 | 150 | THMSTAT_010, ///< T2 < T < T3 |
| switches | 9:8fb54367ceb5 | 151 | THMSTAT_011, ///< T3 < T < T4 |
| switches | 9:8fb54367ceb5 | 152 | THMSTAT_100, ///< T > T4 |
| switches | 9:8fb54367ceb5 | 153 | THMSTAT_101, ///< No theremistor detected |
| switches | 9:8fb54367ceb5 | 154 | THMSTAT_110, ///< Thermistor Disabled by ThermEn |
| switches | 9:8fb54367ceb5 | 155 | THMSTAT_111, ///< CHGIN not present |
| switches | 9:8fb54367ceb5 | 156 | } thermStat_t; |
| switches | 9:8fb54367ceb5 | 157 | |
| switches | 9:8fb54367ceb5 | 158 | /** |
| switches | 10:32c7e2ab67aa | 159 | * @brief Charge Status |
| switches | 10:32c7e2ab67aa | 160 | * @details Current operating mode of charger |
| switches | 9:8fb54367ceb5 | 161 | */ |
| switches | 9:8fb54367ceb5 | 162 | typedef enum { |
| switches | 9:8fb54367ceb5 | 163 | CHGSTAT_000, ///< Charger off |
| switches | 9:8fb54367ceb5 | 164 | CHGSTAT_001, ///< Charging suspended by temperature |
| switches | 9:8fb54367ceb5 | 165 | CHGSTAT_010, ///< Pre-charge |
| switches | 9:8fb54367ceb5 | 166 | CHGSTAT_011, ///< Fast-charge constant current |
| switches | 9:8fb54367ceb5 | 167 | CHGSTAT_100, ///< Fast-charge constant voltage |
| switches | 9:8fb54367ceb5 | 168 | CHGSTAT_101, ///< Maintain charge |
| switches | 9:8fb54367ceb5 | 169 | CHGSTAT_110, ///< Done |
| switches | 9:8fb54367ceb5 | 170 | CHGSTAT_111, ///< Charger fault |
| switches | 9:8fb54367ceb5 | 171 | } chgStat_t; |
| switches | 9:8fb54367ceb5 | 172 | |
| switches | 9:8fb54367ceb5 | 173 | /** |
| switches | 10:32c7e2ab67aa | 174 | * @brief Input Current Limit |
| switches | 10:32c7e2ab67aa | 175 | * @details CHGIN input current limit values |
| switches | 9:8fb54367ceb5 | 176 | */ |
| switches | 9:8fb54367ceb5 | 177 | typedef enum { |
| switches | 9:8fb54367ceb5 | 178 | ILIM_0mA, ///< 0mA |
| switches | 9:8fb54367ceb5 | 179 | ILIM_100mA, ///< 100mA |
| switches | 9:8fb54367ceb5 | 180 | ILIM_500mA, ///< 500mA |
| switches | 9:8fb54367ceb5 | 181 | ILIM_1000mA, ///< 1000mA |
| switches | 9:8fb54367ceb5 | 182 | } iLimCntl_t; |
| switches | 9:8fb54367ceb5 | 183 | |
| switches | 9:8fb54367ceb5 | 184 | /** |
| switches | 10:32c7e2ab67aa | 185 | * @brief Recharge Threshold |
| switches | 10:32c7e2ab67aa | 186 | * @details Battery recharge voltage threshold |
| switches | 9:8fb54367ceb5 | 187 | */ |
| switches | 9:8fb54367ceb5 | 188 | typedef enum { |
| switches | 9:8fb54367ceb5 | 189 | BAT_RECHG_70mV, ///< 70mV |
| switches | 9:8fb54367ceb5 | 190 | BAT_RECHG_120mV, ///< 120mV |
| switches | 9:8fb54367ceb5 | 191 | BAT_RECHG_170mV, ///< 170mV |
| switches | 9:8fb54367ceb5 | 192 | BAT_RECHG_220mV, ///< 220mV |
| switches | 9:8fb54367ceb5 | 193 | } batReChg_t; |
| switches | 9:8fb54367ceb5 | 194 | |
| switches | 9:8fb54367ceb5 | 195 | /** |
| switches | 10:32c7e2ab67aa | 196 | * @brief Battery Regulation Voltage |
| switches | 10:32c7e2ab67aa | 197 | * @details Battery regulation voltages set point |
| switches | 9:8fb54367ceb5 | 198 | */ |
| switches | 9:8fb54367ceb5 | 199 | typedef enum { |
| switches | 9:8fb54367ceb5 | 200 | BAT_REG_4050mV, ///< 4.05V |
| switches | 9:8fb54367ceb5 | 201 | BAT_REG_4100mV, ///< 4.10V |
| switches | 9:8fb54367ceb5 | 202 | BAT_REG_4150mV, ///< 4.15V |
| switches | 9:8fb54367ceb5 | 203 | BAT_REG_4200mV, ///< 4.20V |
| switches | 9:8fb54367ceb5 | 204 | BAT_REG_4250mV, ///< 4.25V |
| switches | 9:8fb54367ceb5 | 205 | BAT_REG_4300mV, ///< 4.30V |
| switches | 9:8fb54367ceb5 | 206 | BAT_REG_4350mV, ///< 4.35V |
| switches | 9:8fb54367ceb5 | 207 | BAT_REG_RSVD, ///< reserved |
| switches | 9:8fb54367ceb5 | 208 | } batReg_t; |
| switches | 9:8fb54367ceb5 | 209 | |
| switches | 9:8fb54367ceb5 | 210 | /** |
| switches | 10:32c7e2ab67aa | 211 | * @brief Precharge Voltage |
| switches | 10:32c7e2ab67aa | 212 | * @details Battery precharge voltage threshold |
| switches | 9:8fb54367ceb5 | 213 | */ |
| switches | 9:8fb54367ceb5 | 214 | typedef enum { |
| switches | 9:8fb54367ceb5 | 215 | VPCHG_2100mV, ///< 2.10V |
| switches | 9:8fb54367ceb5 | 216 | VPCHG_2250mV, ///< 2.25V |
| switches | 9:8fb54367ceb5 | 217 | VPCHG_2400mV, ///< 2.40V |
| switches | 9:8fb54367ceb5 | 218 | VPCHG_2550mV, ///< 2.55V |
| switches | 9:8fb54367ceb5 | 219 | VPCHG_2700mV, ///< 2.70V |
| switches | 9:8fb54367ceb5 | 220 | VPCHG_2850mV, ///< 2.85V |
| switches | 9:8fb54367ceb5 | 221 | VPCHG_3000mV, ///< 3.00V |
| switches | 9:8fb54367ceb5 | 222 | VPCHG_3150mV, ///< 3.15V |
| switches | 9:8fb54367ceb5 | 223 | } vPChg_t; |
| switches | 9:8fb54367ceb5 | 224 | |
| switches | 9:8fb54367ceb5 | 225 | /** |
| switches | 10:32c7e2ab67aa | 226 | * @brief Precharge Current |
| switches | 10:32c7e2ab67aa | 227 | * @details Battery precharge current value |
| switches | 9:8fb54367ceb5 | 228 | */ |
| switches | 9:8fb54367ceb5 | 229 | typedef enum { |
| switches | 9:8fb54367ceb5 | 230 | IPCHG_5, ///< 5% of Ifchg |
| switches | 9:8fb54367ceb5 | 231 | IPCHG_10, ///< 10% of Ifchg |
| switches | 9:8fb54367ceb5 | 232 | IPCHG_20, ///< 20% of Ifchg |
| switches | 9:8fb54367ceb5 | 233 | IPCHG_30, ///< 30% of Ifchg |
| switches | 9:8fb54367ceb5 | 234 | } iPChg_t; |
| switches | 9:8fb54367ceb5 | 235 | |
| switches | 9:8fb54367ceb5 | 236 | /** |
| switches | 10:32c7e2ab67aa | 237 | * @brief Done Current |
| switches | 10:32c7e2ab67aa | 238 | * @details Charger done current where charging stops |
| switches | 9:8fb54367ceb5 | 239 | */ |
| switches | 9:8fb54367ceb5 | 240 | typedef enum { |
| switches | 9:8fb54367ceb5 | 241 | CHGDONE_5, ///< 5% of Ifchg |
| switches | 9:8fb54367ceb5 | 242 | CHGDONE_10, ///< 10% of Ifchg |
| switches | 9:8fb54367ceb5 | 243 | CHGDONE_20, ///< 20% of Ifchg |
| switches | 9:8fb54367ceb5 | 244 | CHGDONE_30, ///< 30% of Ifchg |
| switches | 9:8fb54367ceb5 | 245 | } chgDone_t; |
| switches | 9:8fb54367ceb5 | 246 | |
| switches | 9:8fb54367ceb5 | 247 | /** |
| switches | 10:32c7e2ab67aa | 248 | * @brief Maintain Charge Timer |
| switches | 10:32c7e2ab67aa | 249 | * @details Timeout settings for maintain charge mode |
| switches | 9:8fb54367ceb5 | 250 | */ |
| switches | 9:8fb54367ceb5 | 251 | typedef enum { |
| switches | 9:8fb54367ceb5 | 252 | MTCHGTMR_0min, ///< 0 min |
| switches | 9:8fb54367ceb5 | 253 | MTCHGTMR_15min, ///< 15 min |
| switches | 9:8fb54367ceb5 | 254 | MTCHGTMR_30min, ///< 30 min |
| switches | 9:8fb54367ceb5 | 255 | MTCHGTMR_60min, ///< 60 min |
| switches | 9:8fb54367ceb5 | 256 | } mtChgTmr_t; |
| switches | 9:8fb54367ceb5 | 257 | |
| switches | 9:8fb54367ceb5 | 258 | /** |
| switches | 10:32c7e2ab67aa | 259 | * @brief Fast Charge Timer |
| switches | 10:32c7e2ab67aa | 260 | * @details Timeout settings for fast charge mode |
| switches | 9:8fb54367ceb5 | 261 | */ |
| switches | 9:8fb54367ceb5 | 262 | typedef enum { |
| switches | 9:8fb54367ceb5 | 263 | FCHGTMR_75min, ///< 75 min |
| switches | 9:8fb54367ceb5 | 264 | FCHGTMR_150min, ///< 150 min |
| switches | 9:8fb54367ceb5 | 265 | FCHGTMR_300min, ///< 300 min |
| switches | 9:8fb54367ceb5 | 266 | FCHGTMR_600min, ///< 600 min |
| switches | 9:8fb54367ceb5 | 267 | } fChgTmr_t; |
| switches | 9:8fb54367ceb5 | 268 | |
| switches | 9:8fb54367ceb5 | 269 | /** |
| switches | 10:32c7e2ab67aa | 270 | * @brief Precharge Timer |
| switches | 10:32c7e2ab67aa | 271 | * @details Timeout settings for precharge mode |
| switches | 9:8fb54367ceb5 | 272 | */ |
| switches | 9:8fb54367ceb5 | 273 | typedef enum { |
| switches | 9:8fb54367ceb5 | 274 | PCHGTMR_30min, ///< 30 min |
| switches | 9:8fb54367ceb5 | 275 | PCHGTMR_60min, ///< 60 min |
| switches | 9:8fb54367ceb5 | 276 | PCHGTMR_120min, ///< 120 min |
| switches | 9:8fb54367ceb5 | 277 | PCHGTMR_240min, ///< 240 min |
| switches | 9:8fb54367ceb5 | 278 | } pChgTmr_t; |
| switches | 9:8fb54367ceb5 | 279 | |
| switches | 9:8fb54367ceb5 | 280 | /** |
| switches | 10:32c7e2ab67aa | 281 | * @brief LDO Enable Mode |
| switches | 9:8fb54367ceb5 | 282 | * @details Enumerated enable modes for voltage regulators |
| switches | 9:8fb54367ceb5 | 283 | */ |
| switches | 9:8fb54367ceb5 | 284 | typedef enum { |
| switches | 10:32c7e2ab67aa | 285 | LDO_DISABLED, ///< Disabled, Regulator Mode |
| switches | 10:32c7e2ab67aa | 286 | SW_DISABLED, ///< Disabled, Switch Mode |
| switches | 10:32c7e2ab67aa | 287 | LDO_ENABLED, ///< Enabled, Regulator Mode |
| switches | 10:32c7e2ab67aa | 288 | SW_ENABLED, ///< Enabled, Switch Mode |
| switches | 10:32c7e2ab67aa | 289 | LDO_EN_MPC0, ///< Regulator Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 290 | SW_EN_MPC0, ///< Switch Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 291 | LDO_EN_MPC1, ///< Regulator Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 292 | SW_EN_MPC1, ///< Switch Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 293 | LDO_DISABLED_DSC, ///< Regulator Disabled |
| switches | 10:32c7e2ab67aa | 294 | SW_DISABLED_DSC, ///< Switch Disabled |
| switches | 10:32c7e2ab67aa | 295 | LDO_ENABLED_DSC, ///< Regulator Enabled |
| switches | 10:32c7e2ab67aa | 296 | SW_ENABLED_DSC, ///< Switch Enabled |
| switches | 10:32c7e2ab67aa | 297 | LDO_EN_MPC0_DSC, ///< Regulator Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 298 | SW_EN_MPC0_DSC, ///< Switch Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 299 | LDO_EN_MPC1_DSC, ///< Regulator Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 300 | SW_EN_MPC1_DSC, ///< Switch Enabled by MPC pin |
| switches | 10:32c7e2ab67aa | 301 | } ldoMode_t; |
| switches | 9:8fb54367ceb5 | 302 | |
| switches | 9:8fb54367ceb5 | 303 | /** |
| switches | 9:8fb54367ceb5 | 304 | * @brief Buck Operating Modes |
| switches | 9:8fb54367ceb5 | 305 | * @details Enumerated operating modes for buck regulator |
| switches | 9:8fb54367ceb5 | 306 | */ |
| switches | 9:8fb54367ceb5 | 307 | typedef enum { |
| switches | 9:8fb54367ceb5 | 308 | BUCK_BURST, ///< Burst Mode Operation |
| switches | 9:8fb54367ceb5 | 309 | BUCK_FPWM, ///< Forced PWM Operation |
| switches | 9:8fb54367ceb5 | 310 | BUCK_MPC0_FPWM, ///< MPC activated Forced PWM |
| switches | 9:8fb54367ceb5 | 311 | BUCK_MPC1_FPWM, ///< MPC activated Forced PWM |
| switches | 9:8fb54367ceb5 | 312 | } buckMd_t; |
| switches | 9:8fb54367ceb5 | 313 | |
| switches | 9:8fb54367ceb5 | 314 | /** |
| switches | 10:32c7e2ab67aa | 315 | * @brief Thermistor Configuration |
| switches | 10:32c7e2ab67aa | 316 | * @details Enumerated thermistor operating modes |
| switches | 9:8fb54367ceb5 | 317 | */ |
| switches | 10:32c7e2ab67aa | 318 | typedef enum { |
| switches | 10:32c7e2ab67aa | 319 | THRM_DISABLED, ///< Thermistor monitoring disabled |
| switches | 10:32c7e2ab67aa | 320 | THRM_ENABLED, ///< Basic thermistor monitoring |
| switches | 10:32c7e2ab67aa | 321 | THRM_RSVD, ///< reserved, do not use |
| switches | 10:32c7e2ab67aa | 322 | THRM_JEITA, ///< JEITA thermistor monitoring |
| switches | 10:32c7e2ab67aa | 323 | } thrmCfg_t; |
| switches | 4:2e4837c3b6e1 | 324 | |
| switches | 6:06450093da48 | 325 | /** |
| switches | 4:2e4837c3b6e1 | 326 | * @brief Monitor Configurations |
| switches | 4:2e4837c3b6e1 | 327 | * @details Enumerated configuration modes for monitor multiplexer |
| switches | 6:06450093da48 | 328 | */ |
| switches | 4:2e4837c3b6e1 | 329 | typedef enum { |
| switches | 10:32c7e2ab67aa | 330 | MON_PULLDOWN = 0x0, ///< Pulled down by 100k Ohm |
| switches | 10:32c7e2ab67aa | 331 | MON_BAT = 0x1, ///< BAT Selected |
| switches | 10:32c7e2ab67aa | 332 | MON_SYS = 0x2, ///< SYS Selected |
| switches | 10:32c7e2ab67aa | 333 | MON_BUCK1 = 0x3, ///< BUCK1 Selected |
| switches | 10:32c7e2ab67aa | 334 | MON_BUCK2 = 0x4, ///< BUCK2 Selected |
| switches | 10:32c7e2ab67aa | 335 | MON_LDO1 = 0x5, ///< LDO1 Selected |
| switches | 10:32c7e2ab67aa | 336 | MON_LDO2 = 0x6, ///< LDO2 Selected |
| switches | 10:32c7e2ab67aa | 337 | MON_LDO3 = 0x7, ///< LDO3nSelected |
| switches | 10:32c7e2ab67aa | 338 | MON_HI_Z = 0x8, ///< High Impedance |
| switches | 4:2e4837c3b6e1 | 339 | } monCfg_t; |
| jbradshaw | 0:0e40db4a2b3e | 340 | |
| switches | 6:06450093da48 | 341 | /** |
| switches | 10:32c7e2ab67aa | 342 | * @brief Monitor Divide Ratio |
| switches | 10:32c7e2ab67aa | 343 | * @details Ratio settings for monitor divider |
| switches | 6:06450093da48 | 344 | */ |
| switches | 10:32c7e2ab67aa | 345 | typedef enum { |
| switches | 10:32c7e2ab67aa | 346 | MON_DIV4, ///< 4:1 Monitor Ratio |
| switches | 10:32c7e2ab67aa | 347 | MON_DIV3, ///< 3:1 Monitor Ratio |
| switches | 10:32c7e2ab67aa | 348 | MON_DIV2, ///< 2:1 Monitor Ratio |
| switches | 10:32c7e2ab67aa | 349 | MON_DIV1, ///< 1:1 Monitor Ratio |
| switches | 10:32c7e2ab67aa | 350 | } monRatio_t; |
| switches | 4:2e4837c3b6e1 | 351 | |
| switches | 4:2e4837c3b6e1 | 352 | /** |
| switches | 9:8fb54367ceb5 | 353 | * MAX14690 constructor. |
| switches | 4:2e4837c3b6e1 | 354 | * |
| switches | 4:2e4837c3b6e1 | 355 | * @param sda mbed pin to use for SDA line of I2C interface. |
| switches | 4:2e4837c3b6e1 | 356 | * @param scl mbed pin to use for SCL line of I2C interface. |
| switches | 4:2e4837c3b6e1 | 357 | */ |
| switches | 10:32c7e2ab67aa | 358 | MAX14690(PinName sda, PinName scl); |
| switches | 4:2e4837c3b6e1 | 359 | |
| switches | 4:2e4837c3b6e1 | 360 | /** |
| switches | 9:8fb54367ceb5 | 361 | * MAX14690 constructor. |
| switches | 4:2e4837c3b6e1 | 362 | * |
| switches | 4:2e4837c3b6e1 | 363 | * @param i2c I2C object to use. |
| switches | 4:2e4837c3b6e1 | 364 | */ |
| switches | 10:32c7e2ab67aa | 365 | MAX14690(I2C *i2c); |
| jbradshaw | 0:0e40db4a2b3e | 366 | |
| switches | 4:2e4837c3b6e1 | 367 | /** |
| switches | 9:8fb54367ceb5 | 368 | * MAX14690 destructor. |
| switches | 4:2e4837c3b6e1 | 369 | */ |
| switches | 9:8fb54367ceb5 | 370 | ~MAX14690(); |
| switches | 4:2e4837c3b6e1 | 371 | |
| switches | 4:2e4837c3b6e1 | 372 | /** |
| switches | 9:8fb54367ceb5 | 373 | * @brief Initialize MAX14690 |
| switches | 9:8fb54367ceb5 | 374 | * @details Applies settings to MAX14690. |
| switches | 4:2e4837c3b6e1 | 375 | * Settings are stored in public variables. |
| switches | 6:06450093da48 | 376 | * The variables are pre-loaded with the most common configuation. |
| switches | 4:2e4837c3b6e1 | 377 | * Assign new values to the public variables before calling init. |
| switches | 10:32c7e2ab67aa | 378 | * This will update all the settings including the LDO voltages |
| switches | 10:32c7e2ab67aa | 379 | * and modes. |
| switches | 4:2e4837c3b6e1 | 380 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 381 | */ |
| switches | 4:2e4837c3b6e1 | 382 | int init(); |
| switches | 4:2e4837c3b6e1 | 383 | |
| switches | 4:2e4837c3b6e1 | 384 | /** |
| switches | 10:32c7e2ab67aa | 385 | * @brief Set the LDO Voltage |
| switches | 6:06450093da48 | 386 | * @details Sets the voltage for the boost regulator. |
| switches | 6:06450093da48 | 387 | * The voltage is specified in millivolts. |
| switches | 9:8fb54367ceb5 | 388 | * The MAX14690 cannot update the voltage when enabled. |
| switches | 10:32c7e2ab67aa | 389 | * This function checks the local ldoMode variable and if the |
| switches | 6:06450093da48 | 390 | * regualtor is enabled it will send the disable command before |
| switches | 10:32c7e2ab67aa | 391 | * sending the new voltage and re-enable the LDO after |
| switches | 4:2e4837c3b6e1 | 392 | * the new voltage is written. |
| switches | 4:2e4837c3b6e1 | 393 | * @param mV voltage for boost regualtor in millivolts |
| switches | 4:2e4837c3b6e1 | 394 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 395 | */ |
| switches | 10:32c7e2ab67aa | 396 | int ldo2SetVoltage(int mV); |
| switches | 10:32c7e2ab67aa | 397 | |
| switches | 10:32c7e2ab67aa | 398 | /** |
| switches | 10:32c7e2ab67aa | 399 | * @brief Set LDO Enable Mode |
| switches | 10:32c7e2ab67aa | 400 | * @details Sets the enable mode for the LDO/SW |
| switches | 10:32c7e2ab67aa | 401 | * @param mode The enable mode for the LDO/SW |
| switches | 10:32c7e2ab67aa | 402 | * @returns 0 if no errors, -1 if error. |
| switches | 10:32c7e2ab67aa | 403 | */ |
| switches | 10:32c7e2ab67aa | 404 | int ldo2SetMode(ldoMode_t mode); |
| jbradshaw | 0:0e40db4a2b3e | 405 | |
| switches | 4:2e4837c3b6e1 | 406 | /** |
| switches | 10:32c7e2ab67aa | 407 | * @brief Set the LDO Voltage |
| switches | 10:32c7e2ab67aa | 408 | * @details Sets the voltage for the boost regulator. |
| switches | 10:32c7e2ab67aa | 409 | * The voltage is specified in millivolts. |
| switches | 10:32c7e2ab67aa | 410 | * The MAX14690 cannot update the voltage when enabled. |
| switches | 10:32c7e2ab67aa | 411 | * This function checks the local ldoMode variable and if the |
| switches | 10:32c7e2ab67aa | 412 | * regualtor is enabled it will send the disable command before |
| switches | 10:32c7e2ab67aa | 413 | * sending the new voltage and re-enable the LDO after |
| switches | 10:32c7e2ab67aa | 414 | * the new voltage is written. |
| switches | 10:32c7e2ab67aa | 415 | * @param mV voltage for boost regualtor in millivolts |
| switches | 4:2e4837c3b6e1 | 416 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 417 | */ |
| switches | 10:32c7e2ab67aa | 418 | int ldo3SetVoltage(int mV); |
| switches | 10:32c7e2ab67aa | 419 | |
| switches | 10:32c7e2ab67aa | 420 | /** |
| switches | 10:32c7e2ab67aa | 421 | * @brief Set LDO Enable Mode |
| switches | 10:32c7e2ab67aa | 422 | * @details Sets the enable mode for the LDO/SW |
| switches | 10:32c7e2ab67aa | 423 | * @param mode The enable mode for the LDO/SW |
| switches | 10:32c7e2ab67aa | 424 | * @returns 0 if no errors, -1 if error. |
| switches | 10:32c7e2ab67aa | 425 | */ |
| switches | 10:32c7e2ab67aa | 426 | int ldo3SetMode(ldoMode_t mode); |
| switches | 4:2e4837c3b6e1 | 427 | |
| switches | 4:2e4837c3b6e1 | 428 | /** |
| switches | 4:2e4837c3b6e1 | 429 | * @brief Configure Mon Pin |
| switches | 4:2e4837c3b6e1 | 430 | * @details Configures the operating mode of the monitor multiplexer |
| switches | 4:2e4837c3b6e1 | 431 | * @param monCfg The configuration mode for the monitor pin |
| switches | 4:2e4837c3b6e1 | 432 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 433 | */ |
| switches | 10:32c7e2ab67aa | 434 | int monSet(monCfg_t monCfg, monRatio_t monRatio); |
| switches | 4:2e4837c3b6e1 | 435 | |
| switches | 4:2e4837c3b6e1 | 436 | /** |
| switches | 4:2e4837c3b6e1 | 437 | * @brief Shutdown |
| switches | 4:2e4837c3b6e1 | 438 | * @details Sends the command to turn off all supplies and put the part |
| switches | 4:2e4837c3b6e1 | 439 | * in battery saving shelf mode. |
| switches | 4:2e4837c3b6e1 | 440 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 441 | */ |
| switches | 4:2e4837c3b6e1 | 442 | int shutdown(); |
| jbradshaw | 0:0e40db4a2b3e | 443 | |
| switches | 4:2e4837c3b6e1 | 444 | /** |
| switches | 10:32c7e2ab67aa | 445 | * @brief Reset settings to default values |
| switches | 10:32c7e2ab67aa | 446 | * @details Resets all local variables to the default value. |
| switches | 10:32c7e2ab67aa | 447 | * Note: this only resets the local variables and has no effect |
| switches | 10:32c7e2ab67aa | 448 | * on the part until they are applied by another functions such as |
| switches | 10:32c7e2ab67aa | 449 | * init(); |
| switches | 10:32c7e2ab67aa | 450 | * @returns 0 if no errors, -1 if error. |
| switches | 10:32c7e2ab67aa | 451 | */ |
| switches | 10:32c7e2ab67aa | 452 | void resetToDefaults(); |
| switches | 10:32c7e2ab67aa | 453 | |
| switches | 10:32c7e2ab67aa | 454 | /** |
| switches | 4:2e4837c3b6e1 | 455 | * @brief Write Register |
| switches | 7:2e9f6e70b34f | 456 | * @details Writes the given value to the specified register. |
| switches | 7:2e9f6e70b34f | 457 | * Note, this function provides direct access to the registers |
| switches | 7:2e9f6e70b34f | 458 | * without any awareness or effect on the settings stored in |
| switches | 7:2e9f6e70b34f | 459 | * the public variables. This is used by the other functions to |
| switches | 9:8fb54367ceb5 | 460 | * set the values inside the MAX14690. Calling this outside of the |
| switches | 7:2e9f6e70b34f | 461 | * other functions can break the synchronization of the variables |
| switches | 9:8fb54367ceb5 | 462 | * to the state of the MAX14690. |
| switches | 4:2e4837c3b6e1 | 463 | * @param reg The register to be written |
| switches | 4:2e4837c3b6e1 | 464 | * @param value The data to be written |
| switches | 4:2e4837c3b6e1 | 465 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 466 | */ |
| switches | 4:2e4837c3b6e1 | 467 | int writeReg(registers_t reg, char value); |
| switches | 4:2e4837c3b6e1 | 468 | |
| switches | 4:2e4837c3b6e1 | 469 | /** |
| switches | 4:2e4837c3b6e1 | 470 | * @brief Read Register |
| switches | 4:2e4837c3b6e1 | 471 | * @details Reads from the specified register |
| switches | 4:2e4837c3b6e1 | 472 | * @param reg The register to be read |
| switches | 4:2e4837c3b6e1 | 473 | * @param value Pointer for where to store the data |
| switches | 4:2e4837c3b6e1 | 474 | * @returns 0 if no errors, -1 if error. |
| switches | 4:2e4837c3b6e1 | 475 | */ |
| switches | 4:2e4837c3b6e1 | 476 | int readReg(registers_t reg, char *value); |
| switches | 3:cdd88a3d3d24 | 477 | |
| switches | 10:32c7e2ab67aa | 478 | /// Thermal Status Change Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 479 | bool intEnThermStatus; |
| switches | 10:32c7e2ab67aa | 480 | /// Charger Status Change Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 481 | bool intEnChgStatus; |
| switches | 10:32c7e2ab67aa | 482 | /// Input Limit Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 483 | bool intEnILim; |
| switches | 10:32c7e2ab67aa | 484 | /// USB Over Voltage Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 485 | bool intEnUSBOVP; |
| switches | 10:32c7e2ab67aa | 486 | /// USB OK Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 487 | bool intEnUSBOK; |
| switches | 10:32c7e2ab67aa | 488 | /// Charger Thermal Shutdown Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 489 | bool intEnChgThmSD; |
| switches | 10:32c7e2ab67aa | 490 | /// Thermal Regulation Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 491 | bool intEnThermReg; |
| switches | 10:32c7e2ab67aa | 492 | /// Charger Timeout Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 493 | bool intEnChgTimeOut; |
| switches | 10:32c7e2ab67aa | 494 | /// Buck1 Thermal Error Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 495 | bool intEnThermBuck1; |
| switches | 10:32c7e2ab67aa | 496 | /// Buck2 Thermal Error Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 497 | bool intEnThermBuck2; |
| switches | 10:32c7e2ab67aa | 498 | /// LDO1 Thermal Error Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 499 | bool intEnThermLDO1; |
| switches | 10:32c7e2ab67aa | 500 | /// LDO2 Thermal Error Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 501 | bool intEnThermLDO2; |
| switches | 10:32c7e2ab67aa | 502 | /// LDO3 Thermal Error Interrupt Enable: default 0 - Disabled, 1 - Enabled |
| switches | 10:32c7e2ab67aa | 503 | bool intEnThermLDO3; |
| switches | 10:32c7e2ab67aa | 504 | /// CHGIN Input Current Limit Setting: default 500mA |
| switches | 10:32c7e2ab67aa | 505 | iLimCntl_t iLimCntl; |
| switches | 10:32c7e2ab67aa | 506 | /// Charger Auto Stop: default 1 - move to Charge Done when charging complete, 0 - remain in Maintain Charge mode |
| switches | 10:32c7e2ab67aa | 507 | bool chgAutoStp; |
| switches | 10:32c7e2ab67aa | 508 | /// Charger Auto Restart: default 1 - restart charging when Vbat drops below threshold, 0 - stay in Charge Done until charging disabled |
| switches | 10:32c7e2ab67aa | 509 | bool chgAutoReSta; |
| switches | 10:32c7e2ab67aa | 510 | /// Charger Battery Recharge Threshold: default -120mV |
| switches | 10:32c7e2ab67aa | 511 | batReChg_t batReChg; |
| switches | 10:32c7e2ab67aa | 512 | /// Charger Battery Regulation Voltage: default 4.20V |
| switches | 10:32c7e2ab67aa | 513 | batReg_t batReg; |
| switches | 10:32c7e2ab67aa | 514 | /// Charger Enable: default 1 - Enabled, 0 - Disabled |
| switches | 10:32c7e2ab67aa | 515 | bool chgEn; |
| switches | 10:32c7e2ab67aa | 516 | /// Charger Precharge Voltage Threshold: default 3.00V |
| switches | 10:32c7e2ab67aa | 517 | vPChg_t vPChg; |
| switches | 10:32c7e2ab67aa | 518 | /// Charger Precharge Current Setting: default 10% of fast charge current |
| switches | 10:32c7e2ab67aa | 519 | iPChg_t iPChg; |
| switches | 10:32c7e2ab67aa | 520 | /// Charger Done Threshold, stop charging when charge current drops to this level: default 10% of fast charge current |
| switches | 10:32c7e2ab67aa | 521 | chgDone_t chgDone; |
| switches | 10:32c7e2ab67aa | 522 | /// Maintain Charge Timer, time to wait after reaching done current before disabling charger: default 0 min |
| switches | 10:32c7e2ab67aa | 523 | mtChgTmr_t mtChgTmr; |
| switches | 10:32c7e2ab67aa | 524 | /// Fast Charge Timer, timeout for fast charge duration: default 300 min |
| switches | 10:32c7e2ab67aa | 525 | fChgTmr_t fChgTmr; |
| switches | 10:32c7e2ab67aa | 526 | /// Precharge Timer, timeout for precharge duration: default 60 min |
| switches | 10:32c7e2ab67aa | 527 | pChgTmr_t pChgTmr; |
| switches | 10:32c7e2ab67aa | 528 | /// Buck 1 Mode Select: default Burst mode |
| switches | 10:32c7e2ab67aa | 529 | buckMd_t buck1Md; |
| switches | 10:32c7e2ab67aa | 530 | /// Buck 1 Inductor Select: default 0 - 2.2uH, 1 - 4.7uH |
| switches | 10:32c7e2ab67aa | 531 | bool buck1Ind; |
| switches | 10:32c7e2ab67aa | 532 | /// Buck 2 Mode Select: default BUCK_BURST |
| switches | 10:32c7e2ab67aa | 533 | buckMd_t buck2Md; |
| switches | 10:32c7e2ab67aa | 534 | /// Buck 2 Inductor Select: default 0 - 2.2uH, 1 - 4.7uH |
| switches | 10:32c7e2ab67aa | 535 | bool buck2Ind; |
| switches | 10:32c7e2ab67aa | 536 | /// LDO 2 Mode Select: default LDO_DISABLED |
| switches | 10:32c7e2ab67aa | 537 | ldoMode_t ldo2Mode; |
| switches | 10:32c7e2ab67aa | 538 | /// LDO 2 Voltage in millivolts: default 3200 |
| switches | 10:32c7e2ab67aa | 539 | int ldo2Millivolts; |
| switches | 10:32c7e2ab67aa | 540 | /// LDO 3 Mode Select: default LDO_DISABLED |
| switches | 10:32c7e2ab67aa | 541 | ldoMode_t ldo3Mode; |
| switches | 10:32c7e2ab67aa | 542 | /// LDO 3 Voltage in millivolts: default 3000 |
| switches | 10:32c7e2ab67aa | 543 | int ldo3Millivolts; |
| switches | 10:32c7e2ab67aa | 544 | /// Thermistor Configuration: default THRM_ENABLED |
| switches | 10:32c7e2ab67aa | 545 | thrmCfg_t thrmCfg; |
| switches | 10:32c7e2ab67aa | 546 | /// Monitor Multiplexer Divider Ratio Select: default MON_DIV4 |
| switches | 10:32c7e2ab67aa | 547 | monRatio_t monRatio; |
| switches | 10:32c7e2ab67aa | 548 | /// Monitor Multiplexer Configuration: default MON_PULLDOWN |
| switches | 10:32c7e2ab67aa | 549 | monCfg_t monCfg; |
| switches | 10:32c7e2ab67aa | 550 | /// Buck 2 Active Discharge: default 0 - discharge only during hard reset, 1 - discharge when regulator is disabled |
| switches | 10:32c7e2ab67aa | 551 | bool buck2ActDsc; |
| switches | 10:32c7e2ab67aa | 552 | /// Buck 2 Force FET Scaling: default 0 - full FET for better active efficiency, 1 - reduced FET for lower quiescent current |
| switches | 10:32c7e2ab67aa | 553 | bool buck2FFET; |
| switches | 10:32c7e2ab67aa | 554 | /// Buck 1 Active Discharge: default 0 - discharge only during hard reset, 1 - discharge when regulator is disabled |
| switches | 10:32c7e2ab67aa | 555 | bool buck1ActDsc; |
| switches | 10:32c7e2ab67aa | 556 | /// Buck 1 Force FET Scaling: default 0 - full FET for better active efficiency, 1 - reduced FET for lower quiescent current |
| switches | 10:32c7e2ab67aa | 557 | bool buck1FFET; |
| switches | 10:32c7e2ab67aa | 558 | /// PFN pin resistor enable: default 1 - internal pullup/pulldown enabled, 0 - internal pullup/pulldown disabled |
| switches | 10:32c7e2ab67aa | 559 | bool pfnResEna; |
| switches | 10:32c7e2ab67aa | 560 | /// Stay On Handshake: default 1 - remain on, 0 - turn off if not set within 5s of power-on |
| switches | 10:32c7e2ab67aa | 561 | bool stayOn; |
| switches | 3:cdd88a3d3d24 | 562 | |
| jbradshaw | 0:0e40db4a2b3e | 563 | private: |
| switches | 4:2e4837c3b6e1 | 564 | /// I2C pointer |
| switches | 4:2e4837c3b6e1 | 565 | I2C *i2c; |
| switches | 4:2e4837c3b6e1 | 566 | /// Is this object the owner of the I2C object |
| switches | 4:2e4837c3b6e1 | 567 | bool isOwner; |
| switches | 10:32c7e2ab67aa | 568 | |
| switches | 10:32c7e2ab67aa | 569 | /** |
| switches | 10:32c7e2ab67aa | 570 | * @brief Converts mV to register bits |
| switches | 10:32c7e2ab67aa | 571 | * @details Converts integer representing the desired voltage |
| switches | 10:32c7e2ab67aa | 572 | * in millivolts to the coresponding 8 bit register value. |
| switches | 10:32c7e2ab67aa | 573 | * This will check to ensure the voltage is within the allowed |
| switches | 10:32c7e2ab67aa | 574 | * range and return an error (-1) if it is out of range. |
| switches | 10:32c7e2ab67aa | 575 | * @param mV voltage for LDO regulator in millivolts |
| switches | 10:32c7e2ab67aa | 576 | * @returns 8 bit register value if no errors, -1 if error. |
| switches | 10:32c7e2ab67aa | 577 | */ |
| switches | 10:32c7e2ab67aa | 578 | int mv2bits(int mV); |
| jbradshaw | 0:0e40db4a2b3e | 579 | }; |
| jbradshaw | 0:0e40db4a2b3e | 580 | |
| switches | 9:8fb54367ceb5 | 581 | #endif /* _MAX14690_H_ */ |
