add power off to nano g2
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <MeshCore.h>
|
||||
#include "variant.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <MeshCore.h>
|
||||
|
||||
// LoRa radio module pins
|
||||
#define P_LORA_DIO_1 (32 + 10)
|
||||
@@ -32,8 +34,7 @@
|
||||
#define PIN_VBAT_READ (0 + 2)
|
||||
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
|
||||
class NanoG2Ultra : public mesh::MainBoard
|
||||
{
|
||||
class NanoG2Ultra : public mesh::MainBoard {
|
||||
protected:
|
||||
uint8_t startup_reason;
|
||||
|
||||
@@ -42,18 +43,21 @@ public:
|
||||
uint16_t getBattMilliVolts() override;
|
||||
bool startOTAUpdate(const char *id, char reply[]) override;
|
||||
|
||||
uint8_t getStartupReason() const override
|
||||
{
|
||||
return startup_reason;
|
||||
}
|
||||
uint8_t getStartupReason() const override { return startup_reason; }
|
||||
|
||||
const char *getManufacturerName() const override
|
||||
{
|
||||
return "Nano G2 Ultra";
|
||||
}
|
||||
const char *getManufacturerName() const override { return "Nano G2 Ultra"; }
|
||||
|
||||
void reboot() override
|
||||
{
|
||||
NVIC_SystemReset();
|
||||
void reboot() override { NVIC_SystemReset(); }
|
||||
|
||||
void powerOff() override {
|
||||
// put GPS chip to sleep
|
||||
digitalWrite(PIN_GPS_STANDBY, LOW);
|
||||
// unset buzzer to prevent notification circuit activating on hibernate
|
||||
#undef PIN_BUZZER
|
||||
|
||||
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(PIN_USER_BTN), NRF_GPIO_PIN_NOPULL,
|
||||
NRF_GPIO_PIN_SENSE_LOW);
|
||||
|
||||
sd_power_system_off();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user