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>
2
1
#include < avr/io.h>
3
2
#include < led_ctrl.h>
4
3
#include < log.h>
5
4
#include < low_power.h>
6
5
#include < lte.h>
7
- #include < sequans_controller.h>
8
6
9
7
#define SW0 PIN_PD2
10
8
11
9
ISR (PORTD_PORT_vect) {
12
10
if (PORTD.INTFLAGS & PIN2_bm) {
11
+ // Reset the interupt flag so that we can process the next incoming
12
+ // interrupt
13
13
PORTD.INTFLAGS = PIN2_bm;
14
14
}
15
15
}
@@ -44,6 +44,8 @@ void setup() {
44
44
void loop () {
45
45
46
46
Log.info (" Powering down..." );
47
+ // Allow some time for the log message to be transmitted before we power
48
+ // down
47
49
delay (100 );
48
50
49
51
// Power down for 60 seconds
Original file line number Diff line number Diff line change @@ -331,9 +331,6 @@ static void disablePIT(void) {
331
331
static void powerDownPeripherals (void ) {
332
332
333
333
// LEDs
334
- cell_led_state = digitalRead (LedCtrl.getLedPin (Led::CELL));
335
- con_led_state = digitalRead (LedCtrl.getLedPin (Led::CON));
336
-
337
334
pinConfigure (LedCtrl.getLedPin (Led::CELL),
338
335
PIN_DIR_INPUT | PIN_PULLUP_ON | PIN_INPUT_DISABLE);
339
336
pinConfigure (LedCtrl.getLedPin (Led::CON),
@@ -510,6 +507,8 @@ bool LowPowerClass::configurePeriodicPowerSave(
510
507
}
511
508
512
509
void LowPowerClass::powerSave (void ) {
510
+ cell_led_state = digitalRead (LedCtrl.getLedPin (Led::CELL));
511
+ con_led_state = digitalRead (LedCtrl.getLedPin (Led::CON));
513
512
514
513
powerDownPeripherals ();
515
514
SLPCTRL.CTRLA |= SLPCTRL_SMODE_PDOWN_gc | SLPCTRL_SEN_bm;
@@ -556,6 +555,9 @@ void LowPowerClass::powerSave(void) {
556
555
557
556
SLPCTRL.CTRLA &= ~SLPCTRL_SEN_bm;
558
557
powerUpPeripherals ();
558
+
559
+ digitalWrite (LedCtrl.getLedPin (Led::CELL), cell_led_state);
560
+ digitalWrite (LedCtrl.getLedPin (Led::CON), con_led_state);
559
561
}
560
562
561
563
void LowPowerClass::powerDown (const uint32_t power_down_time_seconds) {
You can’t perform that action at this time.
0 commit comments