Skip to content

Commit fe0f79a

Browse files
committed
Making requested modifications
1 parent 5b228a7 commit fe0f79a

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

ports/atmel-samd/common-hal/pulseio/PulseIn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void pulsein_interrupt_handler(uint8_t channel) {
112112
}
113113

114114
uint16_t i = (self->start + self->len) % self->maxlen;
115-
if (self->len <= self->maxlen) {
115+
if (self->len < self->maxlen) {
116116
self->len++;
117117
} else {
118118
self->errored_too_fast = true;
@@ -278,6 +278,7 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
278278
self->first_edge = true;
279279
self->last_overflow = 0;
280280
self->last_count = 0;
281+
self->errored_too_fast = false;
281282
gpio_set_pin_function(self->pin, GPIO_PIN_FUNCTION_A);
282283
uint32_t mask = 1 << self->channel;
283284
// Clear previous interrupt state and re-enable it.
@@ -299,7 +300,6 @@ uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
299300
mp_raise_IndexError(translate("pop from an empty PulseIn"));
300301
}
301302
if (self->errored_too_fast) {
302-
self->errored_too_fast = false;
303303
mp_raise_RuntimeError(translate("Input taking too long"));
304304
}
305305
common_hal_mcu_disable_interrupts();

ports/atmel-samd/common-hal/pulseio/PulseIn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ void pulsein_reset(void);
5050

5151
void pulsein_interrupt_handler(uint8_t channel);
5252
void pulsein_timer_interrupt_handler(uint8_t index);
53-
void update_background_ticks(void);
5453
#ifdef SAMD21
5554
void rtc_set_continuous(void);
5655
void rtc_start_pulsein(void);

supervisor/shared/background_callback.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ uint64_t get_background_ticks(void) {
4343
return last_background_tick;
4444
}
4545

46-
void update_background_ticks(void) {
47-
last_background_tick = port_get_raw_ticks(NULL);
48-
}
49-
5046
void background_callback_add_core(background_callback_t *cb) {
5147
last_background_tick = port_get_raw_ticks(NULL);
5248
CALLBACK_CRITICAL_BEGIN;

0 commit comments

Comments
 (0)