Skip to content

Commit a2e8127

Browse files
committed
PimoroniBus: SPIBus fix unused pin arguments.
Fixes #1074.
1 parent 75f15c6 commit a2e8127

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

micropython/modules/pimoroni_bus/pimoroni_bus.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ mp_obj_t SPIPins_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
4242
{ MP_QSTR_dc, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(SPI_DEFAULT_MISO)} },
4343
{ MP_QSTR_sck, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(SPI_DEFAULT_SCK)} },
4444
{ MP_QSTR_mosi, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(SPI_DEFAULT_MOSI)} },
45-
{ MP_QSTR_miso, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(PIN_UNUSED)} },
46-
{ MP_QSTR_bl, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(PIN_UNUSED)} },
45+
{ MP_QSTR_miso, MP_ARG_OBJ, {.u_obj = mp_const_none} },
46+
{ MP_QSTR_bl, MP_ARG_OBJ, {.u_obj = mp_const_none} },
4747
};
4848

4949
// Parse args.
@@ -56,9 +56,9 @@ mp_obj_t SPIPins_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
5656
mp_hal_get_pin_obj(args[ARG_cs].u_obj),
5757
mp_hal_get_pin_obj(args[ARG_sck].u_obj),
5858
mp_hal_get_pin_obj(args[ARG_mosi].u_obj),
59-
mp_hal_get_pin_obj(args[ARG_miso].u_obj),
60-
mp_hal_get_pin_obj(args[ARG_dc].u_obj),
61-
mp_hal_get_pin_obj(args[ARG_bl].u_obj)
59+
args[ARG_miso].u_obj == mp_const_none ? PIN_UNUSED : mp_hal_get_pin_obj(args[ARG_miso].u_obj),
60+
args[ARG_dc].u_obj == mp_const_none ? PIN_UNUSED : mp_hal_get_pin_obj(args[ARG_dc].u_obj),
61+
args[ARG_bl].u_obj == mp_const_none ? PIN_UNUSED : mp_hal_get_pin_obj(args[ARG_bl].u_obj)
6262
};
6363

6464
return MP_OBJ_FROM_PTR(self);

0 commit comments

Comments
 (0)