Skip to content

Commit 32a6d36

Browse files
committed
shared-bindings: Use RUN_BACKGROUND_TASKS
1 parent 11dd3a2 commit 32a6d36

5 files changed

Lines changed: 7 additions & 15 deletions

File tree

shared-bindings/_stage/__init__.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
9696
}
9797

9898
while (!displayio_display_begin_transaction(display)) {
99-
#ifdef MICROPY_VM_HOOK_LOOP
100-
MICROPY_VM_HOOK_LOOP ;
101-
#endif
99+
RUN_BACKGROUND_TASKS;
102100
}
103101
displayio_area_t area;
104102
area.x1 = x0;

shared-bindings/displayio/FourWire.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ STATIC mp_obj_t displayio_fourwire_obj_send(mp_obj_t self, mp_obj_t command_obj,
119119

120120
// Wait for display bus to be available.
121121
while (!common_hal_displayio_fourwire_begin_transaction(self)) {
122-
#ifdef MICROPY_VM_HOOK_LOOP
123-
MICROPY_VM_HOOK_LOOP ;
124-
#endif
122+
RUN_BACKGROUND_TASKS;
125123
}
126124
common_hal_displayio_fourwire_send(self, true, &command, 1);
127125
common_hal_displayio_fourwire_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len);

shared-bindings/displayio/I2CDisplay.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob
111111

112112
// Wait for display bus to be available.
113113
while (!common_hal_displayio_i2cdisplay_begin_transaction(self)) {
114-
#ifdef MICROPY_VM_HOOK_LOOP
115-
MICROPY_VM_HOOK_LOOP ;
116-
#endif
114+
RUN_BACKGROUND_TASKS;
117115
}
118116
uint8_t full_command[bufinfo.len + 1];
119117
full_command[0] = command;

shared-bindings/displayio/ParallelBus.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o
122122

123123
// Wait for display bus to be available.
124124
while (!common_hal_displayio_parallelbus_begin_transaction(self)) {
125-
#ifdef MICROPY_VM_HOOK_LOOP
126-
MICROPY_VM_HOOK_LOOP ;
127-
#endif
125+
RUN_BACKGROUND_TASKS;
128126
}
129127
common_hal_displayio_parallelbus_send(self, true, &command, 1);
130128
common_hal_displayio_parallelbus_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len);

shared-bindings/i2cslave/I2CSlave.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request(size_t n_args, const mp_obj_t *pos_ar
182182
bool is_read;
183183
bool is_restart;
184184

185-
MICROPY_VM_HOOK_LOOP
185+
RUN_BACKGROUND_TASKS;
186186
if (mp_hal_is_interrupted()) {
187187
return mp_const_none;
188188
}
@@ -337,7 +337,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_read(size_t n_args, const mp_obj_t *p
337337
uint8_t *buffer = NULL;
338338
uint64_t timeout_end = common_hal_time_monotonic() + 10 * 1000;
339339
while (common_hal_time_monotonic() < timeout_end) {
340-
MICROPY_VM_HOOK_LOOP
340+
RUN_BACKGROUND_TASKS;
341341
if (mp_hal_is_interrupted()) {
342342
break;
343343
}
@@ -382,7 +382,7 @@ STATIC mp_obj_t i2cslave_i2c_slave_request_write(mp_obj_t self_in, mp_obj_t buf_
382382
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
383383

384384
for (size_t i = 0; i < bufinfo.len; i++) {
385-
MICROPY_VM_HOOK_LOOP
385+
RUN_BACKGROUND_TASKS;
386386
if (mp_hal_is_interrupted()) {
387387
break;
388388
}

0 commit comments

Comments
 (0)