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