File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1- #include < Wire.h>
21#include < avr/io.h>
32#include < led_ctrl.h>
43#include < log.h>
54#include < low_power.h>
65#include < lte.h>
7- #include < sequans_controller.h>
86
97#define SW0 PIN_PD2
108
119ISR (PORTD_PORT_vect) {
1210 if (PORTD.INTFLAGS & PIN2_bm) {
11+ // Reset the interupt flag so that we can process the next incoming
12+ // interrupt
1313 PORTD.INTFLAGS = PIN2_bm;
1414 }
1515}
@@ -44,6 +44,8 @@ void setup() {
4444void loop () {
4545
4646 Log.info (" Powering down..." );
47+ // Allow some time for the log message to be transmitted before we power
48+ // down
4749 delay (100 );
4850
4951 // Power down for 60 seconds
Original file line number Diff line number Diff line change @@ -331,9 +331,6 @@ static void disablePIT(void) {
331331static void powerDownPeripherals (void ) {
332332
333333 // LEDs
334- cell_led_state = digitalRead (LedCtrl.getLedPin (Led::CELL));
335- con_led_state = digitalRead (LedCtrl.getLedPin (Led::CON));
336-
337334 pinConfigure (LedCtrl.getLedPin (Led::CELL),
338335 PIN_DIR_INPUT | PIN_PULLUP_ON | PIN_INPUT_DISABLE);
339336 pinConfigure (LedCtrl.getLedPin (Led::CON),
@@ -510,6 +507,8 @@ bool LowPowerClass::configurePeriodicPowerSave(
510507}
511508
512509void LowPowerClass::powerSave (void ) {
510+ cell_led_state = digitalRead (LedCtrl.getLedPin (Led::CELL));
511+ con_led_state = digitalRead (LedCtrl.getLedPin (Led::CON));
513512
514513 powerDownPeripherals ();
515514 SLPCTRL.CTRLA |= SLPCTRL_SMODE_PDOWN_gc | SLPCTRL_SEN_bm;
@@ -556,6 +555,9 @@ void LowPowerClass::powerSave(void) {
556555
557556 SLPCTRL.CTRLA &= ~SLPCTRL_SEN_bm;
558557 powerUpPeripherals ();
558+
559+ digitalWrite (LedCtrl.getLedPin (Led::CELL), cell_led_state);
560+ digitalWrite (LedCtrl.getLedPin (Led::CON), con_led_state);
559561}
560562
561563void LowPowerClass::powerDown (const uint32_t power_down_time_seconds) {
You can’t perform that action at this time.
0 commit comments