File tree 1 file changed +4
-0
lines changed
ports/atmel-samd/common-hal/pulseio 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ static void pulsein_set_config(pulseio_pulsein_obj_t* self, bool first_edge) {
77
77
}
78
78
79
79
void pulsein_interrupt_handler (uint8_t channel ) {
80
+ // turn off interrupts while in the handler
81
+ common_hal_mcu_disable_interrupts ();
80
82
// Grab the current time first.
81
83
uint32_t current_overflow = overflow_count ;
82
84
Tc * tc = tc_insts [pulsein_tc_index ];
@@ -89,6 +91,7 @@ void pulsein_interrupt_handler(uint8_t channel) {
89
91
90
92
pulseio_pulsein_obj_t * self = get_eic_channel_data (channel );
91
93
if (!supervisor_background_tasks_ok () ) {
94
+ common_hal_mcu_enable_interrupts ();
92
95
mp_raise_RuntimeError (translate ("Input taking too long" ));
93
96
return ;
94
97
}
@@ -122,6 +125,7 @@ void pulsein_interrupt_handler(uint8_t channel) {
122
125
}
123
126
self -> last_overflow = current_overflow ;
124
127
self -> last_count = current_count ;
128
+ common_hal_mcu_enable_interrupts ();
125
129
}
126
130
127
131
void pulsein_reset () {
You can’t perform that action at this time.
0 commit comments