Skip to content

Commit 5c4f903

Browse files
committed
rearranging port.c include order for common-hal/alarm
1 parent e7324fa commit 5c4f903

File tree

5 files changed

+6
-23
lines changed

5 files changed

+6
-23
lines changed

ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "shared-bindings/alarm/pin/PinAlarm.h"
3535
#include "shared-bindings/microcontroller/__init__.h"
3636
#include "shared-bindings/microcontroller/Pin.h"
37+
#include "common-hal/alarm/__init__.h"
3738

3839
// This variable stores whether a PinAlarm woke in light sleep or fake deep sleep
3940
// It CANNOT detect if the program woke from deep sleep.
@@ -52,9 +53,6 @@ void pin_alarm_callback(uint8_t num) { // parameters can be changed
5253
// the trigger. This will only work for light sleep/fake deep
5354
// sleep, in conjunction with the find_triggered_alarm function
5455

55-
// Turn off interrupts while in handler
56-
// printf("Woke up from pin!!\n");
57-
// printf("EIC Flags: %lu\n",EIC->INTFLAG.reg);
5856
if (pinalarm_on) {
5957
// clear flag and interrupt setting
6058
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_TAMPER;

ports/atmel-samd/common-hal/alarm/pin/PinAlarm.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@
2727
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_PINALARM_H
2828
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_PINALARM_H
2929

30-
// This is the first byte of the BKUP register bank.
31-
// We use it to store which alarms are set.
32-
#ifndef SAMD_ALARM_FLAG
33-
#define SAMD_ALARM_FLAG (RTC->MODE0.BKUP[0].reg)
34-
#define SAMD_ALARM_FLAG_TIME (_U_(0x1) << 0)
35-
#define SAMD_ALARM_FLAG_PIN (_U_(0x1) << 1)
36-
#endif
37-
3830
#include "py/obj.h"
3931
#include "py/objtuple.h"
4032

ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "shared-bindings/alarm/time/TimeAlarm.h"
3232
#include "shared-bindings/time/__init__.h"
33+
#include "common-hal/alarm/__init__.h"
3334
#include "supervisor/port.h"
3435

3536
STATIC volatile bool woke_up;

ports/atmel-samd/common-hal/alarm/time/TimeAlarm.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@
2727
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_TIMEALARM_H
2828
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_TIMEALARM_H
2929

30-
// This is the first byte of the BKUP register bank.
31-
// We use it to store which alarms are set.
32-
#ifndef SAMD_ALARM_FLAG
33-
#define SAMD_ALARM_FLAG (RTC->MODE0.BKUP[0].reg)
34-
#define SAMD_ALARM_FLAG_TIME (_U_(0x1) << 0)
35-
#define SAMD_ALARM_FLAG_PIN (_U_(0x1) << 1)
36-
#endif
37-
3830
#include "py/obj.h"
3931

4032
typedef struct {

ports/atmel-samd/supervisor/port.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#error Unknown chip family
5454
#endif
5555

56-
#include "common-hal/alarm/__init__.h"
5756
#include "common-hal/analogio/AnalogIn.h"
5857
#include "common-hal/analogio/AnalogOut.h"
5958
#include "common-hal/audiobusio/PDMIn.h"
@@ -66,6 +65,9 @@
6665
#include "common-hal/pwmio/PWMOut.h"
6766
#include "common-hal/ps2io/Ps2.h"
6867
#include "common-hal/rtc/RTC.h"
68+
#include "common-hal/alarm/__init__.h"
69+
#include "common-hal/alarm/time/TimeAlarm.h"
70+
#include "common-hal/alarm/pin/PinAlarm.h"
6971

7072
#if CIRCUITPY_TOUCHIO_USE_NATIVE
7173
#include "common-hal/touchio/TouchIn.h"
@@ -78,8 +80,6 @@
7880
#include "samd/dma.h"
7981
#include "shared-bindings/microcontroller/__init__.h"
8082
#include "shared-bindings/rtc/__init__.h"
81-
#include "shared-bindings/alarm/time/TimeAlarm.h"
82-
#include "shared-bindings/alarm/pin/PinAlarm.h"
8383
#include "shared_timers.h"
8484
#include "reset.h"
8585

@@ -194,7 +194,7 @@ static void rtc_init(void) {
194194
#endif
195195
#ifdef SAM_D5X_E5X
196196
hri_mclk_set_APBAMASK_RTC_bit(MCLK);
197-
// Cache TAMPID?
197+
// Cache TAMPID for wake up cause
198198
(void)alarm_get_wakeup_cause();
199199
RTC->MODE0.CTRLA.bit.SWRST = true;
200200
while (RTC->MODE0.SYNCBUSY.bit.SWRST != 0) {

0 commit comments

Comments
 (0)