Skip to content

Commit 5763735

Browse files
committed
atmel-samd: Run the VM hook while waiting for the UART read to timeout in case nothing is received.
1 parent b09a711 commit 5763735

File tree

1 file changed

+10
-0
lines changed
  • atmel-samd/common-hal/nativeio

1 file changed

+10
-0
lines changed

atmel-samd/common-hal/nativeio/UART.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "shared-bindings/microcontroller/__init__.h"
2828
#include "shared-bindings/nativeio/UART.h"
2929

30+
#include "mpconfigport.h"
3031
#include "py/gc.h"
3132
#include "py/mperrno.h"
3233
#include "py/nlr.h"
@@ -275,6 +276,9 @@ size_t common_hal_nativeio_uart_read(nativeio_uart_obj_t *self, uint8_t *data, s
275276
total_read++;
276277
start_ticks = ticks_ms;
277278
}
279+
#ifdef MICROPY_VM_HOOK_LOOP
280+
MICROPY_VM_HOOK_LOOP
281+
#endif
278282
}
279283
if (total_read == 0) {
280284
*errcode = MP_EAGAIN;
@@ -312,6 +316,9 @@ size_t common_hal_nativeio_uart_write(nativeio_uart_obj_t *self, const uint8_t *
312316
ok = true;
313317
break;
314318
}
319+
#ifdef MICROPY_VM_HOOK_LOOP
320+
MICROPY_VM_HOOK_LOOP
321+
#endif
315322
}
316323

317324
if (!ok) {
@@ -343,6 +350,9 @@ size_t common_hal_nativeio_uart_write(nativeio_uart_obj_t *self, const uint8_t *
343350
ok = true;
344351
break;
345352
}
353+
#ifdef MICROPY_VM_HOOK_LOOP
354+
MICROPY_VM_HOOK_LOOP
355+
#endif
346356
}
347357
}
348358

0 commit comments

Comments
 (0)