mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-30 12:10:03 +02:00
[ion] No led when charging in sleep mode
Change-Id: I8cdea4d435226fbc877e398909926c83642e0e55
This commit is contained in:
@@ -14,6 +14,7 @@ void USBTimer::fire() {
|
||||
if (!m_previousPluggedState && GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
|
||||
m_container->displayExamModePopUp(false, true);
|
||||
}
|
||||
#if LED_WHILE_CHARGING
|
||||
KDColor LEDColor = Ion::Battery::isCharging() ? KDColorYellow : KDColorGreen;
|
||||
Ion::LED::setColor(LEDColor);
|
||||
m_previousPluggedState = true;
|
||||
@@ -22,5 +23,6 @@ void USBTimer::fire() {
|
||||
Ion::LED::setColor(KDColorBlack);
|
||||
m_previousPluggedState = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ void Ion::Power::suspend() {
|
||||
PWR.CR()->setFPDS(true); // Put the flash to sleep. Takes longer to wake up.
|
||||
CM4.SCR()->setSLEEPDEEP(true);
|
||||
|
||||
WakeUp::Device::onChargingEvent();
|
||||
WakeUp::Device::onUSBPlugging();
|
||||
#if LED_WHILE_CHARGING
|
||||
WakeUp::Device::onChargingEvent();
|
||||
|
||||
while (1) {
|
||||
/* Update LEDS
|
||||
@@ -24,9 +25,15 @@ void Ion::Power::suspend() {
|
||||
* a while to be sure that the plug state of the USB is up-to-date. */
|
||||
msleep(200);
|
||||
LED::Device::enforceState(Battery::isCharging(), USB::isPlugged(), false);
|
||||
#endif
|
||||
|
||||
WakeUp::Device::onPowerKeyDown();
|
||||
|
||||
#if LED_WHILE_CHARGING
|
||||
#else
|
||||
msleep(200);
|
||||
#endif
|
||||
|
||||
Device::shutdownClocks();
|
||||
|
||||
/* To enter sleep, we need to issue a WFE instruction, which waits for the
|
||||
@@ -39,6 +46,7 @@ void Ion::Power::suspend() {
|
||||
msleep(1);
|
||||
asm("wfe");
|
||||
|
||||
#if LED_WHILE_CHARGING
|
||||
Device::initClocks();
|
||||
|
||||
Keyboard::Device::init();
|
||||
@@ -51,7 +59,7 @@ void Ion::Power::suspend() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Device::initClocks();
|
||||
|
||||
Device::initPeripherals();
|
||||
|
||||
@@ -31,7 +31,9 @@ void onUSBPlugging() {
|
||||
SYSCFG.EXTICR3()->setEXTI(USB::Device::VbusPin.pin(), USB::Device::VbusPin.group());
|
||||
|
||||
EXTI.EMR()->set(USB::Device::VbusPin.pin(), true);
|
||||
#if LED_WHILE_CHARGING
|
||||
EXTI.FTSR()->set(USB::Device::VbusPin.pin(), true);
|
||||
#endif
|
||||
EXTI.RTSR()->set(USB::Device::VbusPin.pin(), true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user