File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
ports/atmel-samd/supervisor Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 91
91
#if CIRCUITPY_PEW
92
92
#include "common-hal/_pew/PewPew.h"
93
93
#endif
94
+ #ifdef SAMD21
95
+ volatile bool hold_interrupt = false;
96
+
97
+ void rtc_start_pulsein (void ) {
98
+ rtc_set_continuous ();
99
+ hold_interrupt = true;
100
+ }
101
+ void rtc_end_pulsein (void ) {
102
+ hold_interrupt = false;
103
+ }
104
+
105
+ void rtc_set_continuous (void ) {
106
+ while (RTC -> MODE0 .STATUS .bit .SYNCBUSY );
107
+ RTC -> MODE0 .READREQ .reg = RTC_READREQ_RREQ | RTC_READREQ_RCONT | 0x0010 ;
108
+ while (RTC -> MODE0 .STATUS .bit .SYNCBUSY );
109
+ }
110
+ #endif
94
111
95
112
extern volatile bool mp_msc_enabled ;
96
113
@@ -489,6 +506,11 @@ void port_interrupt_after_ticks(uint32_t ticks) {
489
506
// We'll interrupt sooner with an overflow.
490
507
return ;
491
508
}
509
+ #ifdef SAMD21
510
+ if (hold_interrupt == true) {
511
+ return ;
512
+ }
513
+ #endif
492
514
RTC -> MODE0 .COMP [0 ].reg = current_ticks + (ticks << 4 );
493
515
RTC -> MODE0 .INTFLAG .reg = RTC_MODE0_INTFLAG_CMP0 ;
494
516
RTC -> MODE0 .INTENSET .reg = RTC_MODE0_INTENSET_CMP0 ;
You can’t perform that action at this time.
0 commit comments