summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--stmhal/spi.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/stmhal/spi.c b/stmhal/spi.c
index 1ccc7357d9..46da05facf 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.c
@@ -868,7 +868,7 @@ STATIC void machine_hard_spi_deinit(mp_obj_t self);
STATIC mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
static const mp_arg_t allowed_args[] = {
- { MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
+ { MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} },
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 500000} },
{ MP_QSTR_polarity, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_phase, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -883,11 +883,7 @@ STATIC mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, s
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- if (args[ARG_NEW_id].u_obj == MP_OBJ_NULL) {
- // no peripheral id given
- // we use software SPI for now but should support hardware if pins allow it
- return machine_soft_spi_make_new(args);
- } else if (args[ARG_NEW_id].u_obj == MP_OBJ_NEW_SMALL_INT(-1)) {
+ if (args[ARG_NEW_id].u_obj == MP_OBJ_NEW_SMALL_INT(-1)) {
// software SPI
return machine_soft_spi_make_new(args);
} else {