mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
53 lines
No EOL
1.2 KiB
C++
53 lines
No EOL
1.2 KiB
C++
#pragma once
|
|
|
|
#include <MeshCore.h>
|
|
#include <Arduino.h>
|
|
#include <helpers/NRF52Board.h>
|
|
|
|
#ifdef XIAO_NRF52
|
|
|
|
class XiaoNrf52Board : public NRF52BoardDCDC {
|
|
protected:
|
|
#if NRF52_POWER_MANAGEMENT
|
|
void initiateShutdown(uint8_t reason) override;
|
|
#endif
|
|
|
|
public:
|
|
XiaoNrf52Board() : NRF52Board("XIAO_NRF52_OTA") {}
|
|
void begin();
|
|
|
|
#if defined(P_LORA_TX_LED)
|
|
void onBeforeTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED on
|
|
}
|
|
void onAfterTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED off
|
|
}
|
|
#endif
|
|
|
|
uint16_t getBattMilliVolts() override;
|
|
|
|
const char* getManufacturerName() const override {
|
|
return "Seeed Xiao-nrf52";
|
|
}
|
|
|
|
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();
|
|
}
|
|
};
|
|
|
|
#endif |