MAX14690 library

Fork of MAX14690 by Maxim Integrated

Revision:
8:2c3f2da51c5d
Parent:
7:2e9f6e70b34f
--- a/MAX14720.h	Thu Oct 06 21:33:25 2016 +0000
+++ b/MAX14720.h	Wed Oct 19 22:32:56 2016 +0000
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
+ * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -44,7 +44,13 @@
 #define MAX14720_BOOST_STEP_MV 100
 
 /**
- * MAX14720 PMIC Driver
+ * @brief MAX14720 Power-Management Solution Driver
+ *
+ * @details The MAX14720/MAX14750 are compact power-management solutions for
+ * space-constrained, battery-powered applications where size and efficiency are
+ * critical. Both devices integrate a power switch, a linear regulator, a buck
+ * regulator, and a buck-boost regulator.
+ * <br>https://www.maximintegrated.com/en/products/power/battery-management/MAX14720.html
  *
  * @code
  * #include "mbed.h"
@@ -54,9 +60,9 @@
  * I2C i2c2(I2C2_SDA, I2C2_SCL);
  *
  * #define  I2C_ADDR_PMIC   (0x54)
- * MAX14720 max14720(&i2c2,I2C_ADDR_PMIC);
+ * MAX14720 max14720(&i2c2, I2C_ADDR_PMIC);
  *
- * DigitalOut led(LED1);
+ * DigitalOut led(LED1, 0);
  * InterruptIn button(SW1);
  *
  * void turnOff()
@@ -66,13 +72,15 @@
  *
  * int main()
  * {
- *     int result;
  *     button.fall(&turnOff);
- *     led = 0;
+ *
  *     max14720.boostEn = MAX14720::BOOST_ENABLED;
- *     result = max14720.init();
- *     if (result == MAX14720_ERROR) printf("Error initializing MAX14720");
+ *     if (max14720.init() == MAX14720_ERROR) {
+ *         printf("Error initializing MAX14720");
+ *     }
+ *
  *     wait(1);
+ *
  *     while(1) {
  *         max14720.boostSetMode(MAX14720::BOOST_DISABLED);
  *         max14720.boostEn = MAX14720::BOOST_ENABLED;
@@ -87,7 +95,6 @@
  */
 class MAX14720
 {
-
 public:
 
     /**
@@ -96,28 +103,28 @@
      */
     typedef enum {
         REG_CHIP_ID = 0x00,		///< Chip ID
-        REG_CHIP_REV = 0x01,		///< Chip Revision
-        REG_BOOST_CDIV = 0x03,		///< Boost Clock Divider
-        REG_BOOST_ISET = 0x04,		///< Boost Peak Current
-        REG_BOOST_VSET = 0x05,		///< Boost Voltage Setting
-        REG_BOOST_CFG = 0x06,		///< Boost Configuration
-        REG_BUCK_VSET = 0x07,		///< Buck Voltage Setting
-        REG_BUCK_CFG = 0x08,		///< Buck Configuration
-        REG_BUCK_ISET = 0x09,		///< Buck Peak Current and Settings
-        REG_LDO_VSET = 0x0A,		///< LDO Voltage Setting
+        REG_CHIP_REV = 0x01,	///< Chip Revision
+        REG_BOOST_CDIV = 0x03,	///< Boost Clock Divider
+        REG_BOOST_ISET = 0x04,	///< Boost Peak Current
+        REG_BOOST_VSET = 0x05,	///< Boost Voltage Setting
+        REG_BOOST_CFG = 0x06,	///< Boost Configuration
+        REG_BUCK_VSET = 0x07,	///< Buck Voltage Setting
+        REG_BUCK_CFG = 0x08,	///< Buck Configuration
+        REG_BUCK_ISET = 0x09,	///< Buck Peak Current and Settings
+        REG_LDO_VSET = 0x0A,	///< LDO Voltage Setting
         REG_LDO_CFG = 0x0B,		///< LDO Configuration
-        REG_SWITCH_CFG = 0x0C,		///< Switch Configuration
-        REG_BAT_TIME = 0x0D,		///< Battery Impedance Timing
+        REG_SWITCH_CFG = 0x0C,	///< Switch Configuration
+        REG_BAT_TIME = 0x0D,	///< Battery Impedance Timing
         REG_BAT_CFG = 0x0E,		///< Battery Impedance Configuration
         REG_BAT_BCV = 0x0F,		///< Battery Cell Voltage
         REG_BAT_OCV = 0x10,		///< Open Cell Voltage
         REG_BAT_LCV = 0x11,		///< Loaded Cell Voltage
         REG_MON_CFG = 0x19,		///< Monitor Multiplexer Configuration
-        REG_BOOT_CFG = 0x1A,		///< Boot Configuration
-        REG_PIN_STAT = 0x1B,		///< Pin Status
-        REG_BBB_EXTRA = 0x1C,		///< Buck/Buck-Boost Extra
+        REG_BOOT_CFG = 0x1A,	///< Boot Configuration
+        REG_PIN_STAT = 0x1B,	///< Pin Status
+        REG_BBB_EXTRA = 0x1C,	///< Buck/Buck-Boost Extra
         REG_HANDSHK = 0x1D,		///< Power-On Handshake
-        REG_UVLO_CFG = 0x1E,		///< Under-Voltage Lock Out
+        REG_UVLO_CFG = 0x1E,	///< Under-Voltage Lock Out
         REG_PWR_OFF = 0x1F,		///< Power Off Command
     } registers_t;
 
@@ -177,15 +184,15 @@
      */
     typedef enum {
         MON_PULLDOWN = 0x00,	///< Pulled down by 100k Ohm
-        MON_HI_Z = 0x08,	///< High Impedance
-        MON_SWIN = 0x80,	///< SWIN Selected
-        MON_SWOUT = 0x81,	///< SWOUT Selected
-        MON_BIN = 0x82,	///< BIN Selected
-        MON_BOUT = 0x83,	///< BOUT Selected
-        MON_HVIN = 0x84,	///< HVIN Selected
-        MON_HVOUT = 0x85,	///< HVOUT Selected
-        MON_LIN = 0x86,	///< LIN Selected
-        MON_LOUT = 0x87,	///< LOUT Selected
+        MON_HI_Z = 0x08,		///< High Impedance
+        MON_SWIN = 0x80,		///< SWIN Selected
+        MON_SWOUT = 0x81,		///< SWOUT Selected
+        MON_BIN = 0x82,			///< BIN Selected
+        MON_BOUT = 0x83,		///< BOUT Selected
+        MON_HVIN = 0x84,		///< HVIN Selected
+        MON_HVOUT = 0x85,		///< HVOUT Selected
+        MON_LIN = 0x86,			///< LIN Selected
+        MON_LOUT = 0x87,		///< LOUT Selected
     } monCfg_t;
 
     /**
@@ -343,7 +350,6 @@
     bool isOwner;
     /// Device slave address
     int slaveAddress;
-
 };
 
 #endif /* _MAX14720_H_ */