connect(m_activityConsumer, SIGNAL(currentActivityChanged(QString)), this, SLOT(loadProfile())); // Set up the policy agent PowerDevil::PolicyAgent::instance()->init(); // Initialize the action pool, which will also load the needed startup actions. PowerDevil::ActionPool::instance()->init(this); // Set up the critical battery timer m_criticalBatteryTimer->setSingleShot(true); m_criticalBatteryTimer->setInterval(30000); connect(m_criticalBatteryTimer, SIGNAL(timeout()), this, SLOT(onCriticalBatteryTimerExpired())); // In 30 seconds (so we are sure the user sees eventual notifications), check the battery state QTimer::singleShot(30000, this, SLOT(checkBatteryStatus())); // All systems up Houston, let's go! emit coreReady(); refreshStatus(); } bool Core::isActionSupported(const QString& actionName) { Action *action = ActionPool::instance()->loadAction(actionName, KConfigGroup(), this); if (!action) { return false; } else { return action->isSupported(); } }
int main (void) { uint8_t i; dc.stat = 0; dc.count = 0; switch_flag = 0; /* misc I/Os Direction regs */ gpioSetDir(3, 0, 1); // DC-DC Convertor EN gpioSetDir(3, 1, 1); // Chg Disable pin gpioSetDir(3, 2, 1); // Low Chg pin gpioSetDir(1, 11, 0); // Switch /* LED Array Direction regs set to output */ gpioSetDir(2, 0, 1); // led no.0 the most left led. gpioSetDir(2, 1, 1); // led no.1 gpioSetDir(2, 2, 1); // led no.2 gpioSetDir(2, 3, 1); // led no.3 gpioSetDir(2, 4, 1); // led no.4 gpioSetDir(2, 5, 1); // led no.5 gpioSetDir(2, 6, 1); // led no.6 gpioSetDir(2, 7, 1); // led no.7 gpioSetDir(2, 8, 1); // led no.8 gpioSetDir(2, 9, 1); // led no.9 setChgPin(1); /* charge circuit off */ setLowChgPin(0); /* low charge off */ /* Enable SysTick timer in interval of 1 ms */ SYST_RVR = F_CPU / 1000 - 1; SYST_CSR = 0x07; initBQ29312A(); /* Initialize BQ29312A */ /* DON'T DSG FET TURN TO OFF WHEN DCIN DOESN'T CONNECT */ setDsgFet(1); // DSG FET turn to ON /* DON'T CHG FET TURN TO ON WHEN CONNECTING BATTERY */ setChgFet(0); // CHG FET turn to OFF GPIO2DATA = 0xffffff; /* all leds off */ setDCDC(1); /* Start DC5V output */ /* flash all LEDs */ for(i = 0; i <= 5; i++) { GPIO2DATA ^= ( _BV(0) | _BV(1) | _BV(2) | _BV(3) | _BV(4) | _BV(5) | _BV(6) | _BV(7) | _BV(8) | _BV(9) ); systickDelay(100); } /* Initialize ADC module */ adcInit(); checkBatteryStatus(); /* Call setBatteryFlag() 2000ms interval */ setTimer32Interval(1, 2000, setBatteryFlag); __enable_irqn(CT32B1_IRQn); /* Enale GPIO1-11 interrupt for battery check switch */ GPIO1IS &= ~(_BV(11)); /* Interrupt is Edge Sense */ GPIO1IBE &= ~(_BV(11)); /* Interrupt is Single Triger */ GPIO1IEV &= ~(_BV(11)); /* Select interrupt source (falling edge of P1.11 pin) */ GPIO1IE = _BV(11); /* Unmask interrupt of P1.11 pin */ __enable_irqn(PIO_1_IRQn); /* Enable PIO1 interrupt */ for (;;) { if(battery.checkBattery) checkBatteryStatus(); if(switch_flag) showBatteryLevel(); __WFI(); /* Wait for interrupt */ } }