rearranging port.c include order for common-hal/alarm

This commit is contained in:
Max Holliday 2021-10-11 13:31:29 -07:00
parent e7324fa7c3
commit 5c4f903328
5 changed files with 6 additions and 23 deletions

View File

@ -34,6 +34,7 @@
#include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/pin/PinAlarm.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "common-hal/alarm/__init__.h"
// This variable stores whether a PinAlarm woke in light sleep or fake deep sleep // This variable stores whether a PinAlarm woke in light sleep or fake deep sleep
// It CANNOT detect if the program woke from deep sleep. // 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
// the trigger. This will only work for light sleep/fake deep // the trigger. This will only work for light sleep/fake deep
// sleep, in conjunction with the find_triggered_alarm function // sleep, in conjunction with the find_triggered_alarm function
// Turn off interrupts while in handler
// printf("Woke up from pin!!\n");
// printf("EIC Flags: %lu\n",EIC->INTFLAG.reg);
if (pinalarm_on) { if (pinalarm_on) {
// clear flag and interrupt setting // clear flag and interrupt setting
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_TAMPER; RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_TAMPER;

View File

@ -27,14 +27,6 @@
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_PINALARM_H #ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_PINALARM_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_PINALARM_H #define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_PINALARM_H
// This is the first byte of the BKUP register bank.
// We use it to store which alarms are set.
#ifndef SAMD_ALARM_FLAG
#define SAMD_ALARM_FLAG (RTC->MODE0.BKUP[0].reg)
#define SAMD_ALARM_FLAG_TIME (_U_(0x1) << 0)
#define SAMD_ALARM_FLAG_PIN (_U_(0x1) << 1)
#endif
#include "py/obj.h" #include "py/obj.h"
#include "py/objtuple.h" #include "py/objtuple.h"

View File

@ -30,6 +30,7 @@
#include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h"
#include "shared-bindings/time/__init__.h" #include "shared-bindings/time/__init__.h"
#include "common-hal/alarm/__init__.h"
#include "supervisor/port.h" #include "supervisor/port.h"
STATIC volatile bool woke_up; STATIC volatile bool woke_up;

View File

@ -27,14 +27,6 @@
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_TIMEALARM_H #ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_TIMEALARM_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_TIMEALARM_H #define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_ALARM_TIMEALARM_H
// This is the first byte of the BKUP register bank.
// We use it to store which alarms are set.
#ifndef SAMD_ALARM_FLAG
#define SAMD_ALARM_FLAG (RTC->MODE0.BKUP[0].reg)
#define SAMD_ALARM_FLAG_TIME (_U_(0x1) << 0)
#define SAMD_ALARM_FLAG_PIN (_U_(0x1) << 1)
#endif
#include "py/obj.h" #include "py/obj.h"
typedef struct { typedef struct {

View File

@ -53,7 +53,6 @@
#error Unknown chip family #error Unknown chip family
#endif #endif
#include "common-hal/alarm/__init__.h"
#include "common-hal/analogio/AnalogIn.h" #include "common-hal/analogio/AnalogIn.h"
#include "common-hal/analogio/AnalogOut.h" #include "common-hal/analogio/AnalogOut.h"
#include "common-hal/audiobusio/PDMIn.h" #include "common-hal/audiobusio/PDMIn.h"
@ -66,6 +65,9 @@
#include "common-hal/pwmio/PWMOut.h" #include "common-hal/pwmio/PWMOut.h"
#include "common-hal/ps2io/Ps2.h" #include "common-hal/ps2io/Ps2.h"
#include "common-hal/rtc/RTC.h" #include "common-hal/rtc/RTC.h"
#include "common-hal/alarm/__init__.h"
#include "common-hal/alarm/time/TimeAlarm.h"
#include "common-hal/alarm/pin/PinAlarm.h"
#if CIRCUITPY_TOUCHIO_USE_NATIVE #if CIRCUITPY_TOUCHIO_USE_NATIVE
#include "common-hal/touchio/TouchIn.h" #include "common-hal/touchio/TouchIn.h"
@ -78,8 +80,6 @@
#include "samd/dma.h" #include "samd/dma.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/rtc/__init__.h" #include "shared-bindings/rtc/__init__.h"
#include "shared-bindings/alarm/time/TimeAlarm.h"
#include "shared-bindings/alarm/pin/PinAlarm.h"
#include "shared_timers.h" #include "shared_timers.h"
#include "reset.h" #include "reset.h"
@ -194,7 +194,7 @@ static void rtc_init(void) {
#endif #endif
#ifdef SAM_D5X_E5X #ifdef SAM_D5X_E5X
hri_mclk_set_APBAMASK_RTC_bit(MCLK); hri_mclk_set_APBAMASK_RTC_bit(MCLK);
// Cache TAMPID? // Cache TAMPID for wake up cause
(void)alarm_get_wakeup_cause(); (void)alarm_get_wakeup_cause();
RTC->MODE0.CTRLA.bit.SWRST = true; RTC->MODE0.CTRLA.bit.SWRST = true;
while (RTC->MODE0.SYNCBUSY.bit.SWRST != 0) { while (RTC->MODE0.SYNCBUSY.bit.SWRST != 0) {