adding CIRCUITPY_ALARM checks to port.c
This commit is contained in:
parent
5c4f903328
commit
37bddecf54
@ -65,9 +65,12 @@
|
|||||||
#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"
|
||||||
|
|
||||||
|
#if CIRCUITPY_ALARM
|
||||||
#include "common-hal/alarm/__init__.h"
|
#include "common-hal/alarm/__init__.h"
|
||||||
#include "common-hal/alarm/time/TimeAlarm.h"
|
#include "common-hal/alarm/time/TimeAlarm.h"
|
||||||
#include "common-hal/alarm/pin/PinAlarm.h"
|
#include "common-hal/alarm/pin/PinAlarm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CIRCUITPY_TOUCHIO_USE_NATIVE
|
#if CIRCUITPY_TOUCHIO_USE_NATIVE
|
||||||
#include "common-hal/touchio/TouchIn.h"
|
#include "common-hal/touchio/TouchIn.h"
|
||||||
@ -194,8 +197,10 @@ 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);
|
||||||
|
#if CIRCUITPY_ALARM
|
||||||
// Cache TAMPID for wake up cause
|
// Cache TAMPID for wake up cause
|
||||||
(void)alarm_get_wakeup_cause();
|
(void)alarm_get_wakeup_cause();
|
||||||
|
#endif
|
||||||
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) {
|
||||||
}
|
}
|
||||||
@ -493,6 +498,7 @@ void RTC_Handler(void) {
|
|||||||
// Do things common to all ports when the tick occurs
|
// Do things common to all ports when the tick occurs
|
||||||
supervisor_tick();
|
supervisor_tick();
|
||||||
}
|
}
|
||||||
|
#if CIRCUITPY_ALARM
|
||||||
if (intflag & RTC_MODE0_INTFLAG_CMP1) {
|
if (intflag & RTC_MODE0_INTFLAG_CMP1) {
|
||||||
// Likely TimeAlarm fake sleep wake
|
// Likely TimeAlarm fake sleep wake
|
||||||
time_alarm_callback();
|
time_alarm_callback();
|
||||||
@ -504,6 +510,7 @@ void RTC_Handler(void) {
|
|||||||
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_TAMPER;
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_TAMPER;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
if (intflag & RTC_MODE0_INTFLAG_CMP0) {
|
if (intflag & RTC_MODE0_INTFLAG_CMP0) {
|
||||||
// Clear the interrupt because we may have hit a sleep
|
// Clear the interrupt because we may have hit a sleep
|
||||||
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
|
||||||
|
Loading…
Reference in New Issue
Block a user