Merge pull request #2052 from kwagyeman/kwabena/fix_servicing_tiny_usb

ports/mimxrt: Service TinyUSB while waiting for sensor frames.
This commit is contained in:
Ibrahim Abdelkader 2023-12-24 15:21:09 +02:00 committed by GitHub
commit e4c0846c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -335,7 +335,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
vbuffer_t *buffer = framebuffer_get_head(FB_NO_FLAGS); vbuffer_t *buffer = framebuffer_get_head(FB_NO_FLAGS);
// Wait for the DMA to finish the transfer. // Wait for the DMA to finish the transfer.
for (mp_uint_t ticks = mp_hal_ticks_ms(); buffer == NULL;) { for (mp_uint_t ticks = mp_hal_ticks_ms(); buffer == NULL;) {
buffer = framebuffer_get_head(FB_NO_FLAGS); MICROPY_EVENT_POLL_HOOK
if ((mp_hal_ticks_ms() - ticks) > 3000) { if ((mp_hal_ticks_ms() - ticks) > 3000) {
sensor_abort(); sensor_abort();
@ -347,6 +347,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
return SENSOR_ERROR_CAPTURE_TIMEOUT; return SENSOR_ERROR_CAPTURE_TIMEOUT;
} }
buffer = framebuffer_get_head(FB_NO_FLAGS);
} }
// We're done receiving data. // We're done receiving data.