Пример #1
0
void setupPower() {

    
    Serial1.println("Entered power setup");

    Serial1.println("Initializing PMIC");
    power.begin(); 
    delay(500);

    Serial1.println("Setting input voltage limit");
    power.setInputVoltageLimit(4120);
    delay(50);

    Serial1.println("Disabling PMIC watchdog timer");
    power.disableWatchdog();
    delay(50);

    Serial1.println("Disabling DPDM detection");
    power.disableDPDM();
    delay(50);

    //Serial1.println("Setting input current limit");
    //power.setInputCurrentLimit(100);
    //delay(50);

    //Serial1.println("disabling buck regulator");
    //power.disableBuck();
    //delay(50);

    //Serial1.println("turning off battery FET");
    //power.disableBATFET();
    //delay(20);


    //power.setChargeCurrent(0,0,0,0,0,0); //512
    //delay (50);

    //Serial1.println("Forcing charge enable");
    //power.enableCharging();
    //delay(50);

}
Пример #2
0
/* This function is called once at start up ----------------------------------*/
void setup()
{
    RGB.control(true);
    RGB.color(0,0,255);
    delay(1000);
    Serial1.begin(9600);
    delay(200);
    power.begin();
    delay(500);

    Serial1.println("Disabling PMIC watchdog timer");
    power.disableWatchdog();
    delay(50);

    //Serial1.println("Enabling OTG/PMID");
    //power.enableOTG();
    //delay(50);

    //Serial1.println("disabling buck regulator");
    //power.disableBuck();
    //delay(50);


    Serial1.print("power on returned:");
    Serial1.println(electronMDM.powerOn("8934076500002587657"));
    //setupPower();
    //delay(200);
    //fuel.sleep();

    /*
    RGB.color(0,0,255);
    delay(200);
    RGB.color(0,255,0);
    delay(200);
    RGB.color(255,0,0);
    delay(200);
    RGB.color(0,0,0);
   
    power.begin();
    delay(100);

    if (fuel.getVersion() == 3) {
        RGB.color(0,255,0);
    }
    else {
        RGB.color(255,0,0);
    }
    delay(2000);
    fuel.sleep();
    delay(100);
*/
    //electronMDM.powerOff();
    
    //System.sleep(SLEEP_MODE_DEEP,60);
    //setupPower();

    //electronMDM.setDebug(3); // enable this for debugging issues

    //delay(3000);
    //DEBUG_D("\e[0;36mHello from the Electron! Boot time is: %d\r\n",millis());

    //Particle.connect(); // blocking call to connect

    //Register all the Tinker functions
    //Particle.function("digitalread", tinkerDigitalRead);
    //Particle.function("digitalwrite", tinkerDigitalWrite);

    //Particle.function("analogread", tinkerAnalogRead);
    //Particle.function("analogwrite", tinkerAnalogWrite);

    //Particle.function("sleep",sleep);
    

    //Particle.connect(); // blocking call to connect


    //Serial1.begin(9600);
    //Serial1.println("Setup complete");
    //delay(1000);

    Serial1.print("Fuel Gauge Version Number: ");
    Serial1.println(fuel.getVersion());
    delay(200);
    
    fuel.sleep();
    delay(200);

    //Serial1.print("power off returned:");
    //Serial1.println(electronMDM.powerOff());
}