mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-26 19:57:20 +00:00
Move device specific shutdown code from main-nrf52.cpp to the appropriate cariant.cpp files
This commit is contained in:
@@ -430,15 +430,6 @@ void cpuDeepSleep(uint32_t msecToWake)
|
||||
Serial1.end();
|
||||
#endif
|
||||
|
||||
#ifdef TTGO_T_ECHO
|
||||
// To power off the T-Echo, the display must be set
|
||||
// as an input pin; otherwise, there will be leakage current.
|
||||
pinMode(PIN_EINK_CS, INPUT);
|
||||
pinMode(PIN_EINK_DC, INPUT);
|
||||
pinMode(PIN_EINK_RES, INPUT);
|
||||
pinMode(PIN_EINK_BUSY, INPUT);
|
||||
#endif
|
||||
|
||||
setBluetoothEnable(false);
|
||||
|
||||
#ifdef RAK4630
|
||||
@@ -449,57 +440,8 @@ void cpuDeepSleep(uint32_t msecToWake)
|
||||
// RAK-12039 set pin for Air quality sensor
|
||||
digitalWrite(AQ_SET_PIN, LOW);
|
||||
#endif
|
||||
#ifdef RAK14014
|
||||
// GPIO restores input status, otherwise there will be leakage current
|
||||
nrf_gpio_cfg_default(TFT_BL);
|
||||
nrf_gpio_cfg_default(TFT_DC);
|
||||
nrf_gpio_cfg_default(TFT_CS);
|
||||
nrf_gpio_cfg_default(TFT_SCLK);
|
||||
nrf_gpio_cfg_default(TFT_MOSI);
|
||||
nrf_gpio_cfg_default(TFT_MISO);
|
||||
nrf_gpio_cfg_default(SCREEN_TOUCH_INT);
|
||||
nrf_gpio_cfg_default(WB_I2C1_SCL);
|
||||
nrf_gpio_cfg_default(WB_I2C1_SDA);
|
||||
|
||||
// nrf_gpio_cfg_default(WB_I2C2_SCL);
|
||||
// nrf_gpio_cfg_default(WB_I2C2_SDA);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MESHLINK
|
||||
#ifdef PIN_WD_EN
|
||||
digitalWrite(PIN_WD_EN, LOW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_MESH_SOLAR)
|
||||
nrf_gpio_cfg_default(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_BUTTON1);
|
||||
#endif
|
||||
|
||||
#ifdef ELECROW_ThinkNode_M1
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||
continue;
|
||||
}
|
||||
pinMode(pin, OUTPUT);
|
||||
}
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||
continue;
|
||||
}
|
||||
digitalWrite(pin, LOW);
|
||||
}
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||
continue;
|
||||
}
|
||||
NRF_GPIO->DIRCLR = (1 << pin);
|
||||
}
|
||||
#endif
|
||||
// Run shutdown code if specified in variant.cpp
|
||||
variant_shutdown();
|
||||
|
||||
// Sleepy trackers or sensors can low power "sleep"
|
||||
|
||||
@@ -42,3 +42,28 @@ void initVariant()
|
||||
pinMode(PIN_LED3, OUTPUT);
|
||||
ledOff(PIN_LED3);
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||
continue;
|
||||
}
|
||||
pinMode(pin, OUTPUT);
|
||||
}
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||
continue;
|
||||
}
|
||||
digitalWrite(pin, LOW);
|
||||
}
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||
continue;
|
||||
}
|
||||
NRF_GPIO->DIRCLR = (1 << pin);
|
||||
}
|
||||
}
|
||||
@@ -36,3 +36,10 @@ void initVariant()
|
||||
pinMode(PIN_LED1, OUTPUT);
|
||||
ledOff(PIN_LED1);
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
nrf_gpio_cfg_default(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_BUTTON1);
|
||||
}
|
||||
@@ -36,3 +36,10 @@ void initVariant()
|
||||
pinMode(PIN_LED1, OUTPUT);
|
||||
ledOff(PIN_LED1);
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
nrf_gpio_cfg_default(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_BUTTON1);
|
||||
}
|
||||
@@ -38,3 +38,10 @@ void initVariant()
|
||||
digitalWrite(PIN_SCREEN_VDD_CTL, LOW); // Start with power on
|
||||
#endif
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
nrf_gpio_cfg_default(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_GPS_PPS);
|
||||
detachInterrupt(PIN_BUTTON1);
|
||||
}
|
||||
@@ -20,4 +20,11 @@ void initVariant()
|
||||
pinMode(PIN_WD_EN, OUTPUT);
|
||||
digitalWrite(PIN_WD_EN, HIGH); // Enable the Watchdog at boot
|
||||
#endif
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
#ifdef PIN_WD_EN
|
||||
digitalWrite(PIN_WD_EN, LOW);
|
||||
#endif
|
||||
}
|
||||
@@ -42,4 +42,21 @@ void initVariant()
|
||||
// 3V3 Power Rail
|
||||
pinMode(PIN_3V3_EN, OUTPUT);
|
||||
digitalWrite(PIN_3V3_EN, HIGH);
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
// GPIO restores input status, otherwise there will be leakage current
|
||||
nrf_gpio_cfg_default(TFT_BL);
|
||||
nrf_gpio_cfg_default(TFT_DC);
|
||||
nrf_gpio_cfg_default(TFT_CS);
|
||||
nrf_gpio_cfg_default(TFT_SCLK);
|
||||
nrf_gpio_cfg_default(TFT_MOSI);
|
||||
nrf_gpio_cfg_default(TFT_MISO);
|
||||
nrf_gpio_cfg_default(SCREEN_TOUCH_INT);
|
||||
nrf_gpio_cfg_default(WB_I2C1_SCL);
|
||||
nrf_gpio_cfg_default(WB_I2C1_SDA);
|
||||
|
||||
// nrf_gpio_cfg_default(WB_I2C2_SCL);
|
||||
// nrf_gpio_cfg_default(WB_I2C2_SDA);
|
||||
}
|
||||
@@ -42,3 +42,13 @@ void initVariant()
|
||||
pinMode(PIN_LED3, OUTPUT);
|
||||
ledOff(PIN_LED3);
|
||||
}
|
||||
|
||||
void variant_shutdown()
|
||||
{
|
||||
// To power off the T-Echo, the display must be set
|
||||
// as an input pin; otherwise, there will be leakage current.
|
||||
pinMode(PIN_EINK_CS, INPUT);
|
||||
pinMode(PIN_EINK_DC, INPUT);
|
||||
pinMode(PIN_EINK_RES, INPUT);
|
||||
pinMode(PIN_EINK_BUSY, INPUT);
|
||||
}
|
||||
Reference in New Issue
Block a user