renesas-ra/machine_spi: Consistently use machine_pin_find to get pin.

Sometimes mp_hal_get_pin_obj() was used.  machine_pin_find() is the
internal name, and the external interface is mp_hal_get_pin_obj().

Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
robert-hh 2023-06-07 20:42:25 +02:00 committed by Damien George
parent 9fea0e98b1
commit 51c2d26f15
1 changed files with 6 additions and 6 deletions

View File

@ -205,7 +205,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
if (args[ARG_sck].u_obj == MP_OBJ_NULL) {
sck = self->sck->pin;
} else {
const machine_pin_obj_t *arg_sck = mp_hal_get_pin_obj(args[ARG_sck].u_obj);
const machine_pin_obj_t *arg_sck = machine_pin_find(args[ARG_sck].u_obj);
sck = arg_sck->pin;
if (!IS_VALID_SCK(self->sck->pin, sck)) {
mp_raise_ValueError(MP_ERROR_TEXT("bad SCK pin"));
@ -214,7 +214,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
if (args[ARG_mosi].u_obj == MP_OBJ_NULL) {
mosi = self->mosi->pin;
} else {
const machine_pin_obj_t *arg_mosi = mp_hal_get_pin_obj(args[ARG_mosi].u_obj);
const machine_pin_obj_t *arg_mosi = machine_pin_find(args[ARG_mosi].u_obj);
mosi = arg_mosi->pin;
if (!IS_VALID_MOSI(self->mosi->pin, mosi)) {
mp_raise_ValueError(MP_ERROR_TEXT("bad MOSI pin"));
@ -223,7 +223,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
if (args[ARG_miso].u_obj == MP_OBJ_NULL) {
miso = self->miso->pin;
} else {
const machine_pin_obj_t *arg_miso = mp_hal_get_pin_obj(args[ARG_miso].u_obj);
const machine_pin_obj_t *arg_miso = machine_pin_find(args[ARG_miso].u_obj);
miso = arg_miso->pin;
if (!IS_VALID_MISO(self->miso->pin, miso)) {
mp_raise_ValueError(MP_ERROR_TEXT("bad MISO pin"));
@ -287,21 +287,21 @@ STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const m
}
}
if (args[ARG_sck].u_obj != MP_OBJ_NULL) {
const machine_pin_obj_t *arg_sck = mp_hal_get_pin_obj(args[ARG_sck].u_obj);
const machine_pin_obj_t *arg_sck = machine_pin_find(args[ARG_sck].u_obj);
sck = arg_sck->pin;
if (!IS_VALID_SCK(self->sck->pin, sck)) {
mp_raise_ValueError(MP_ERROR_TEXT("bad SCK pin"));
}
}
if (args[ARG_mosi].u_obj != MP_OBJ_NULL) {
const machine_pin_obj_t *arg_mosi = mp_hal_get_pin_obj(args[ARG_mosi].u_obj);
const machine_pin_obj_t *arg_mosi = machine_pin_find(args[ARG_mosi].u_obj);
mosi = arg_mosi->pin;
if (!IS_VALID_MOSI(self->mosi->pin, mosi)) {
mp_raise_ValueError(MP_ERROR_TEXT("bad MOSI pin"));
}
}
if (args[ARG_miso].u_obj != MP_OBJ_NULL) {
const machine_pin_obj_t *arg_miso = mp_hal_get_pin_obj(args[ARG_miso].u_obj);
const machine_pin_obj_t *arg_miso = machine_pin_find(args[ARG_miso].u_obj);
miso = arg_miso->pin;
if (!IS_VALID_MISO(self->miso->pin, miso)) {
mp_raise_ValueError(MP_ERROR_TEXT("bad MISO pin"));