@@ -368,20 +368,30 @@ static void powerDownPeripherals(void) {
368
368
PIN_DIR_INPUT | PIN_PULLUP_ON | PIN_INPUT_DISABLE);
369
369
}
370
370
371
- static void powerUpPeripherals (void ) {
371
+ static void powerUpPeripherals (const bool return_leds_to_previous_state ) {
372
372
373
- pinConfigure (LedCtrl.getLedPin (Led::CELL), PIN_DIR_OUTPUT);
374
- pinConfigure (LedCtrl.getLedPin (Led::CON), PIN_DIR_OUTPUT);
375
- pinConfigure (LedCtrl.getLedPin (Led::DATA), PIN_DIR_OUTPUT);
376
- pinConfigure (LedCtrl.getLedPin (Led::ERROR), PIN_DIR_OUTPUT);
377
- pinConfigure (LedCtrl.getLedPin (Led::USER), PIN_DIR_OUTPUT);
373
+ pinConfigure (LedCtrl.getLedPin (Led::CELL),
374
+ PIN_DIR_OUTPUT | PIN_INPUT_ENABLE);
375
+ pinConfigure (LedCtrl.getLedPin (Led::CON),
376
+ PIN_DIR_OUTPUT | PIN_INPUT_ENABLE);
377
+ pinConfigure (LedCtrl.getLedPin (Led::DATA),
378
+ PIN_DIR_OUTPUT | PIN_INPUT_ENABLE);
379
+ pinConfigure (LedCtrl.getLedPin (Led::ERROR),
380
+ PIN_DIR_OUTPUT | PIN_INPUT_ENABLE);
381
+ pinConfigure (LedCtrl.getLedPin (Led::USER),
382
+ PIN_DIR_OUTPUT | PIN_INPUT_ENABLE);
378
383
379
- if (cell_led_state) {
380
- LedCtrl.on (Led::CELL, true );
381
- }
384
+ if (return_leds_to_previous_state) {
385
+ if (cell_led_state) {
386
+ LedCtrl.on (Led::CELL, true );
387
+ }
382
388
383
- if (con_led_state) {
384
- LedCtrl.on (Led::CON, true );
389
+ if (con_led_state) {
390
+ LedCtrl.on (Led::CON, true );
391
+ }
392
+ } else {
393
+ LedCtrl.off (Led::CELL, true );
394
+ LedCtrl.off (Led::CON, true );
385
395
}
386
396
387
397
// Make sure that I2C pins are pulled up and there won't be a voltage drop
@@ -553,7 +563,7 @@ void LowPowerClass::powerSave(void) {
553
563
disableLDO ();
554
564
555
565
SLPCTRL.CTRLA &= ~SLPCTRL_SEN_bm;
556
- powerUpPeripherals ();
566
+ powerUpPeripherals (true );
557
567
558
568
modem_is_in_power_save = false ;
559
569
}
@@ -594,9 +604,9 @@ void LowPowerClass::powerDown(const uint32_t power_down_time_seconds) {
594
604
595
605
disableLDO ();
596
606
disablePIT ();
597
-
598
607
SLPCTRL.CTRLA &= ~SLPCTRL_SEN_bm;
599
- powerUpPeripherals ();
608
+
609
+ powerUpPeripherals (false );
600
610
601
611
Lte.begin ();
602
612
}
0 commit comments