atmel-samd: Use RUN_BACKGROUND_TASKS

crypto-aes
Jeff Epler 3 years ago
parent 076cbcc4f8
commit d9ee2d28a0
  1. 4
      ports/atmel-samd/common-hal/audiobusio/PDMIn.c
  2. 8
      ports/atmel-samd/common-hal/audioio/AudioOut.c
  3. 8
      ports/atmel-samd/common-hal/busio/UART.c
  4. 4
      ports/atmel-samd/common-hal/pulseio/PulseOut.c
  5. 4
      ports/atmel-samd/common-hal/touchio/TouchIn.c
  6. 4
      ports/atmel-samd/mphalport.c

@ -408,9 +408,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
// If wait_counts exceeds the max count, buffer has probably stopped filling;
// DMA may have missed an I2S trigger event.
while (!event_interrupt_active(event_channel) && ++wait_counts < MAX_WAIT_COUNTS) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
}
// The mic is running all the time, so we don't need to wait the usual 10msec or 100msec

@ -69,9 +69,7 @@ static void ramp_value(uint16_t start, uint16_t end) {
DAC->DATA.reg = value;
DAC->DATABUF.reg = value;
common_hal_mcu_delay_us(50);
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
}
}
#endif
@ -94,9 +92,7 @@ static void ramp_value(uint16_t start, uint16_t end) {
DAC->DATABUF[1].reg = value;
common_hal_mcu_delay_us(50);
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
}
}
#endif

@ -291,13 +291,11 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
// Reset the timeout on every character read.
start_ticks = ticks_ms;
}
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP ;
RUN_BACKGROUND_TASKS;
// Allow user to break out of a timeout with a KeyboardInterrupt.
if (mp_hal_is_interrupted()) {
break;
}
#endif
// If we are zero timeout, make sure we don't loop again (in the event
// we read in under 1ms)
if (self->timeout_ms == 0) {
@ -339,9 +337,7 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data,
done = true;
break;
}
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
}
if (!done) {

@ -198,9 +198,7 @@ void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pu
while(pulse_index < length) {
// Do other things while we wait. The interrupts will handle sending the
// signal.
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
}
tc->COUNT16.CTRLBSET.reg = TC_CTRLBSET_CMD_STOP;

@ -51,9 +51,7 @@ static uint16_t get_raw_reading(touchio_touchin_obj_t *self) {
while (!adafruit_ptc_is_conversion_finished(PTC)) {
// wait
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
}
return adafruit_ptc_get_conversion_result(PTC);

@ -53,9 +53,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
uint64_t start_tick = ticks_ms;
uint64_t duration = 0;
while (duration < delay) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
RUN_BACKGROUND_TASKS;
// Check to see if we've been CTRL-Ced by autoreload or the user.
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)) ||
MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {

Loading…
Cancel
Save