repo time

Dependencies:   mbed MAX14720 MAX30205 USBDevice

main.cpp

Committer:
switches
Date:
2016-10-04
Revision:
14:4c4094890fde
Parent:
4:81cea7a352b0
Child:
17:9a467f9a0579

File content as of revision 14:4c4094890fde:

#include "mbed.h"
#include "MAX14720.h"

// I2C Master 2
I2C i2c2(I2C2_SDA, I2C2_SCL);

#define  I2C_ADDR_PMIC   (0x54)
MAX14720 max14720(&i2c2,I2C_ADDR_PMIC);

DigitalOut led(LED1);
InterruptIn button(SW1);

void turnOff()
{
    max14720.shutdown();
}

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) {
        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);
    }
}