Fixes from testing SPI

This commit is contained in:
gamblor21 2020-11-01 21:38:20 -06:00
parent 7dd53804a0
commit 8bbbb2833a
3 changed files with 5 additions and 3 deletions

View File

@ -103,7 +103,7 @@ STATIC mp_obj_t busdevice_spidevice_make_new(const mp_obj_type_t *type, size_t n
STATIC mp_obj_t busdevice_spidevice_obj___enter__(mp_obj_t self_in) {
busdevice_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_busdevice_spidevice_enter(self);
return self;
return self->spi;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(busdevice_spidevice___enter___obj, busdevice_spidevice_obj___enter__);

View File

@ -33,6 +33,7 @@
#include "shared-bindings/busdevice/__init__.h"
#include "shared-bindings/busdevice/I2CDevice.h"
#include "shared-bindings/busdevice/SPIDevice.h"
//| """Hardware accelerated external bus access
@ -46,6 +47,7 @@
STATIC const mp_rom_map_elem_t busdevice_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busdevice) },
{ MP_ROM_QSTR(MP_QSTR_I2CDevice), MP_ROM_PTR(&busdevice_i2cdevice_type) },
{ MP_ROM_QSTR(MP_QSTR_SPIDevice), MP_ROM_PTR(&busdevice_spidevice_type) },
};
STATIC MP_DEFINE_CONST_DICT(busdevice_module_globals, busdevice_module_globals_table);

View File

@ -39,8 +39,8 @@ void common_hal_busdevice_i2cdevice_lock(busdevice_i2cdevice_obj_t *self) {
bool success = false;
while (!success) {
success = common_hal_busio_i2c_try_lock(self->i2c);
RUN_BACKGROUND_TASKS;
mp_handle_pending();
//RUN_BACKGROUND_TASKS;
//mp_handle_pending();
}
}