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