mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-28 21:50:35 +00:00
M6 shutdown and LEDs work (#9065)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -805,7 +805,8 @@ void NodeDB::installDefaultModuleConfig()
|
||||
moduleConfig.external_notification.output_ms = 500;
|
||||
moduleConfig.external_notification.nag_timeout = 2;
|
||||
#endif
|
||||
#if defined(RAK4630) || defined(RAK11310) || defined(RAK3312) || defined(MUZI_BASE) || defined(ELECROW_ThinkNode_M3)
|
||||
#if defined(RAK4630) || defined(RAK11310) || defined(RAK3312) || defined(MUZI_BASE) || defined(ELECROW_ThinkNode_M3) || \
|
||||
defined(ELECROW_ThinkNode_M6)
|
||||
// Default to PIN_LED2 for external notification output (LED color depends on device variant)
|
||||
moduleConfig.external_notification.enabled = true;
|
||||
moduleConfig.external_notification.output = PIN_LED2;
|
||||
|
||||
@@ -41,3 +41,30 @@ void initVariant()
|
||||
pinMode(VDD_FLASH_EN, OUTPUT);
|
||||
digitalWrite(VDD_FLASH_EN, HIGH);
|
||||
}
|
||||
|
||||
// called from main-nrf52.cpp during the cpuDeepSleep() function
|
||||
void variant_shutdown()
|
||||
{
|
||||
// This sets the pin to OUTPUT and LOW for the pins *not* in the if block.
|
||||
for (int pin = 0; pin < 48; pin++) {
|
||||
if (pin == PIN_GPS_EN || pin == ADC_CTRL || pin == PIN_BUTTON1 || pin == PIN_SPI_MISO || pin == PIN_SPI_MOSI ||
|
||||
pin == PIN_SPI_SCK) {
|
||||
continue;
|
||||
}
|
||||
pinMode(pin, OUTPUT);
|
||||
digitalWrite(pin, LOW);
|
||||
if (pin >= 32) {
|
||||
NRF_P1->DIRCLR = (1 << (pin - 32));
|
||||
} else {
|
||||
NRF_GPIO->DIRCLR = (1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
digitalWrite(PIN_GPS_EN, LOW);
|
||||
digitalWrite(ADC_CTRL, LOW);
|
||||
// digitalWrite(RTC_POWER, LOW);
|
||||
|
||||
nrf_gpio_cfg_input(PIN_BUTTON1, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input
|
||||
nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW;
|
||||
nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense1);
|
||||
}
|
||||
|
||||
@@ -44,8 +44,10 @@ extern "C" {
|
||||
#define LED_BLUE -1
|
||||
#define LED_CHARGE (12)
|
||||
#define LED_PAIRING (7)
|
||||
#define PIN_LED2 LED_PAIRING
|
||||
|
||||
#define LED_STATE_ON 1
|
||||
#define LED_STATE_ON HIGH
|
||||
#define LED_STATE_OFF LOW
|
||||
|
||||
// USB power detection
|
||||
#define EXT_PWR_DETECT (13)
|
||||
|
||||
Reference in New Issue
Block a user