From 525dad71c3e26c076e24f587cf9c5c11e0302422 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Jul 2023 16:00:43 -0700 Subject: [PATCH] Add RuntimeError_varg and fix imx capitalization --- ports/mimxrt10xx/common-hal/busio/SPI.c | 4 ++-- py/runtime.c | 7 +++++++ py/runtime.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index e32b635611..11dea30a48 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -367,10 +367,10 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou if (len == 0) { return true; } - if (self->MOSI == NULL && data_out != NULL) { + if (self->mosi == NULL && data_out != NULL) { mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } - if (self->MISO == NULL && data_in != NULL) { + if (self->miso == NULL && data_in != NULL) { mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } diff --git a/py/runtime.c b/py/runtime.c index ebe1590484..9bc5f9a584 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1655,6 +1655,13 @@ NORETURN MP_COLD void mp_raise_RuntimeError(const compressed_string_t *msg) { mp_raise_msg(&mp_type_RuntimeError, msg); } +NORETURN MP_COLD void mp_raise_RuntimeError_varg(const compressed_string_t *fmt, ...) { + va_list argptr; + va_start(argptr,fmt); + mp_raise_msg_vlist(&mp_type_RuntimeError, fmt, argptr); + va_end(argptr); +} + NORETURN MP_COLD void mp_raise_ImportError(const compressed_string_t *msg) { mp_raise_msg(&mp_type_ImportError, msg); } diff --git a/py/runtime.h b/py/runtime.h index 196874bff9..d870bbc634 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -219,6 +219,7 @@ NORETURN void mp_raise_TypeError(const compressed_string_t *msg); NORETURN void mp_raise_TypeError_varg(const compressed_string_t *fmt, ...); NORETURN void mp_raise_AttributeError(const compressed_string_t *msg); NORETURN void mp_raise_RuntimeError(const compressed_string_t *msg); +NORETURN void mp_raise_RuntimeError_varg(const compressed_string_t *fmt, ...); NORETURN void mp_raise_ImportError(const compressed_string_t *msg); NORETURN void mp_raise_IndexError(const compressed_string_t *msg); NORETURN void mp_raise_IndexError_varg(const compressed_string_t *msg, ...);