mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
variants: XIAO NRF52: Support power-off via user button
Add the necessary code to properly power-off the Xiao + Wio companions. This way we can achieve around 15 microamps of power consumption in the off state. Signed-off-by: Frieder Schrempf <frieder@fris.de>
This commit is contained in:
parent
c76d337a00
commit
4a8dcb4906
1 changed files with 18 additions and 0 deletions
|
|
@ -46,6 +46,24 @@ public:
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void powerOff() override {
|
||||||
|
// set led on and wait for button release before poweroff
|
||||||
|
digitalWrite(PIN_LED, LOW);
|
||||||
|
#ifdef PIN_USER_BTN
|
||||||
|
while(digitalRead(PIN_USER_BTN) == LOW);
|
||||||
|
#endif
|
||||||
|
digitalWrite(LED_GREEN, HIGH);
|
||||||
|
digitalWrite(LED_BLUE, HIGH);
|
||||||
|
digitalWrite(PIN_LED, HIGH);
|
||||||
|
|
||||||
|
#ifdef PIN_USER_BTN
|
||||||
|
// configure button press to wake up when in powered off state
|
||||||
|
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(g_ADigitalPinMap[PIN_USER_BTN]), NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sd_power_system_off();
|
||||||
|
}
|
||||||
|
|
||||||
bool startOTAUpdate(const char* id, char reply[]) override;
|
bool startOTAUpdate(const char* id, char reply[]) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue