Program to demonstrate how to configure the PMIC on the MAX32620HSP (MAXREFDES100#)

Dependencies:   MAX14720 mbed

Fork of HSP_PMIC_Demo by Greg Steiert

Files at this revision

API Documentation at this revision

Comitter:
switches
Date:
Tue Oct 04 22:27:34 2016 +0000
Parent:
13:2c5a871cf571
Child:
15:842501d58a51
Commit message:
New program to demonstrate PMIC on MAX32620HSP (MAXREFDES100#)

Changed in this revision

MAX14720.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MAX14720.lib	Tue Oct 04 22:27:34 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/jbradshaw/code/MAX14720/#cdd88a3d3d24
--- a/main.cpp	Sat Sep 17 08:46:24 2016 +0000
+++ b/main.cpp	Tue Oct 04 22:27:34 2016 +0000
@@ -1,12 +1,36 @@
 #include "mbed.h"
+#include "MAX14720.h"
+
+// I2C Master 2
+I2C i2c2(I2C2_SDA, I2C2_SCL);
 
-DigitalOut myled(LED1);
+#define  I2C_ADDR_PMIC   (0x54)
+MAX14720 max14720(&i2c2,I2C_ADDR_PMIC);
+
+DigitalOut led(LED1);
+InterruptIn button(SW1);
+
+void turnOff()
+{
+    max14720.shutdown();
+}
 
-int main() {
+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");
+    wait(1);
     while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
+        max14720.boostSetMode(MAX14720::BOOST_DISABLED);
+        max14720.boostEn = MAX14720::BOOST_ENABLED;
+        wait(0.5);
+        max14720.boostSetVoltage(2500);
+        wait(0.5);
+        max14720.boostSetVoltage(5000);
+        wait(0.5);
     }
 }
--- a/mbed.bld	Sat Sep 17 08:46:24 2016 +0000
+++ b/mbed.bld	Tue Oct 04 22:27:34 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/abea610beb85
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file