File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
shared-module/adafruit_bus_device Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 29
29
#include "py/mperrno.h"
30
30
#include "py/nlr.h"
31
31
#include "py/runtime.h"
32
+ #include "lib/utils/interrupt_char.h"
32
33
33
34
void common_hal_adafruit_bus_device_i2cdevice_construct (adafruit_bus_device_i2cdevice_obj_t * self , busio_i2c_obj_t * i2c , uint8_t device_address ) {
34
35
self -> i2c = i2c ;
35
36
self -> device_address = device_address ;
36
37
}
37
38
38
39
void common_hal_adafruit_bus_device_i2cdevice_lock (adafruit_bus_device_i2cdevice_obj_t * self ) {
39
- bool success = false;
40
+ bool success = common_hal_busio_i2c_try_lock (self -> i2c );
41
+
40
42
while (!success ) {
43
+ RUN_BACKGROUND_TASKS ;
44
+ if (mp_hal_is_interrupted ()) {
45
+ break ;
46
+ }
47
+
41
48
success = common_hal_busio_i2c_try_lock (self -> i2c );
42
- //RUN_BACKGROUND_TASKS;
43
- //mp_handle_pending();
44
49
}
45
50
}
46
51
You can’t perform that action at this time.
0 commit comments