diff options
| author | Dan Halbert <halbert@adafruit.com> | 2019-08-19 17:15:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-19 17:15:20 -0400 |
| commit | 0ddfbb0c20432458cc8020ab5ad7538e6813b60b (patch) | |
| tree | 2aac829585c9508d899e98ceea44e457be7d4f05 /shared-bindings | |
| parent | 6b54e6749e110674634143e38d3b6eb598b18ce0 (diff) | |
| parent | fc7ae2aa6f21046d58f59143752bbd5c7bc038db (diff) | |
Merge pull request #2055 from jepler/run-background-tasks
Implement and use RUN_BACKGROUND_TASKS in place of MICROPY_VM_HOOK_LOOP
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/_stage/__init__.c | 4 | ||||
| -rw-r--r-- | shared-bindings/displayio/FourWire.c | 4 | ||||
| -rw-r--r-- | shared-bindings/displayio/I2CDisplay.c | 4 | ||||
| -rw-r--r-- | shared-bindings/displayio/ParallelBus.c | 4 | ||||
| -rw-r--r-- | shared-bindings/i2cslave/I2CSlave.c | 6 |
5 files changed, 7 insertions, 15 deletions
diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 485fa80c5..6096f6b6d 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -96,9 +96,7 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { } while (!displayio_display_begin_transaction(display)) { -#ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP ; -#endif + RUN_BACKGROUND_TASKS; } displayio_area_t area; area.x1 = x0; diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index af64a2028..0d41359ee 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -119,9 +119,7 @@ STATIC mp_obj_t displayio_fourwire_obj_send(mp_obj_t self, mp_obj_t command_obj, // Wait for display bus to be available. while (!common_hal_displayio_fourwire_begin_transaction(self)) { -#ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP ; -#endif + RUN_BACKGROUND_TASKS; } common_hal_displayio_fourwire_send(self, true, &command, 1); common_hal_displayio_fourwire_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len); diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 1f74e8c9e..9ef989d71 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -111,9 +111,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob // Wait for display bus to be available. while (!common_hal_displayio_i2cdisplay_begin_transaction(self)) { -#ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP ; -#endif + RUN_BACKGROUND_TASKS; } uint8_t full_command[bufinfo.len + 1]; full_command[0] = command; diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index 00a96d230..c29c79fff 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -122,9 +122,7 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o // Wait for display bus to be available. while (!common_hal_displayio_parallelbus_begin_transaction(self)) { -#ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP ; -#endif + RUN_BACKGROUND_TASKS; } common_hal_displayio_parallelbus_send(self, true, &command, 1); common_hal_displayio_parallelbus_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len); diff --git a/shared-bindings/i2cslave/I2CSlave.c b/shared-bindings/i2cslave/I2CSlave.c index 2598accbb..c98ea52e0 100644 --- a/shared-bindings/i2cslave/I2CSlave.c +++ b/shared-bindings/i2cslave/I2CSlave.c @@ -182,7 +182,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request(size_t n_args, const mp_obj_t *pos_ar bool is_read; bool is_restart; - MICROPY_VM_HOOK_LOOP + RUN_BACKGROUND_TASKS; if (mp_hal_is_interrupted()) { return mp_const_none; } @@ -337,7 +337,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_read(size_t n_args, const mp_obj_t *p uint8_t *buffer = NULL; uint64_t timeout_end = common_hal_time_monotonic() + 10 * 1000; while (common_hal_time_monotonic() < timeout_end) { - MICROPY_VM_HOOK_LOOP + RUN_BACKGROUND_TASKS; if (mp_hal_is_interrupted()) { break; } @@ -382,7 +382,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_write(mp_obj_t self_in, mp_obj_t buf_ mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); for (size_t i = 0; i < bufinfo.len; i++) { - MICROPY_VM_HOOK_LOOP + RUN_BACKGROUND_TASKS; if (mp_hal_is_interrupted()) { break; } |
