repo time

Dependencies:   mbed MAX14720 MAX30205 USBDevice

Committer:
switches
Date:
Tue Oct 04 22:27:34 2016 +0000
Revision:
14:4c4094890fde
Parent:
4:81cea7a352b0
Child:
17:9a467f9a0579
New program to demonstrate PMIC on MAX32620HSP (MAXREFDES100#)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan 0:7dec7e9ac085 1 #include "mbed.h"
switches 14:4c4094890fde 2 #include "MAX14720.h"
switches 14:4c4094890fde 3
switches 14:4c4094890fde 4 // I2C Master 2
switches 14:4c4094890fde 5 I2C i2c2(I2C2_SDA, I2C2_SCL);
dan 0:7dec7e9ac085 6
switches 14:4c4094890fde 7 #define I2C_ADDR_PMIC (0x54)
switches 14:4c4094890fde 8 MAX14720 max14720(&i2c2,I2C_ADDR_PMIC);
switches 14:4c4094890fde 9
switches 14:4c4094890fde 10 DigitalOut led(LED1);
switches 14:4c4094890fde 11 InterruptIn button(SW1);
switches 14:4c4094890fde 12
switches 14:4c4094890fde 13 void turnOff()
switches 14:4c4094890fde 14 {
switches 14:4c4094890fde 15 max14720.shutdown();
switches 14:4c4094890fde 16 }
dan 0:7dec7e9ac085 17
switches 14:4c4094890fde 18 int main()
switches 14:4c4094890fde 19 {
switches 14:4c4094890fde 20 int result;
switches 14:4c4094890fde 21 button.fall(&turnOff);
switches 14:4c4094890fde 22 led = 0;
switches 14:4c4094890fde 23 max14720.boostEn = MAX14720::BOOST_ENABLED;
switches 14:4c4094890fde 24 result = max14720.init();
switches 14:4c4094890fde 25 if (result == MAX14720_ERROR) printf("Error initializing MAX14720");
switches 14:4c4094890fde 26 wait(1);
dan 0:7dec7e9ac085 27 while(1) {
switches 14:4c4094890fde 28 max14720.boostSetMode(MAX14720::BOOST_DISABLED);
switches 14:4c4094890fde 29 max14720.boostEn = MAX14720::BOOST_ENABLED;
switches 14:4c4094890fde 30 wait(0.5);
switches 14:4c4094890fde 31 max14720.boostSetVoltage(2500);
switches 14:4c4094890fde 32 wait(0.5);
switches 14:4c4094890fde 33 max14720.boostSetVoltage(5000);
switches 14:4c4094890fde 34 wait(0.5);
stevep 4:81cea7a352b0 35 }
dan 0:7dec7e9ac085 36 }