Lucas Lim / Mbed 2 deprecated HSP_Temperature_Barometer_CS3237

Dependencies:   mbed

Committer:
lucaslwl
Date:
Mon Aug 26 08:11:41 2019 +0000
Revision:
22:5c07298d3383
add library folder

Who changed what in which revision?

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