diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-08-16 13:34:12 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2018-08-16 17:41:35 -0700 |
| commit | 2cd166b57370ab4877ec2d9666225faeac6127ce (patch) | |
| tree | 645f851b1121ce7f52f4b4cf894844e965c4584d /extmod/machine_spi.c | |
| parent | 137a30ad75803255615a422c15ebcd35fbd31130 (diff) | |
Fix esp and samd
Diffstat (limited to 'extmod/machine_spi.c')
| -rw-r--r-- | extmod/machine_spi.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/extmod/machine_spi.c b/extmod/machine_spi.c index f0c4896c2..3bbab2824 100644 --- a/extmod/machine_spi.c +++ b/extmod/machine_spi.c @@ -30,6 +30,8 @@ #include "py/runtime.h" #include "extmod/machine_spi.h" +#include "supervisor/shared/translate.h" + #if MICROPY_PY_MACHINE_SPI // if a port didn't define MSB/LSB constants then provide them @@ -52,7 +54,7 @@ mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_ extern mp_obj_t MICROPY_PY_MACHINE_SPI_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args); return MICROPY_PY_MACHINE_SPI_MAKE_NEW(type, n_args, n_kw, args); #else - mp_raise_ValueError("invalid SPI peripheral"); + mp_raise_ValueError(translate("invalid SPI peripheral")); #endif } --n_args; @@ -119,7 +121,7 @@ STATIC mp_obj_t mp_machine_spi_write_readinto(mp_obj_t self, mp_obj_t wr_buf, mp mp_buffer_info_t dest; mp_get_buffer_raise(rd_buf, &dest, MP_BUFFER_WRITE); if (src.len != dest.len) { - mp_raise_ValueError("buffers must be the same length"); + mp_raise_ValueError(translate("buffers must be the same length")); } mp_machine_spi_transfer(self, src.len, src.buf, dest.buf); return mp_const_none; @@ -202,15 +204,15 @@ STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n self->spi.polarity = args[ARG_polarity].u_int; self->spi.phase = args[ARG_phase].u_int; if (args[ARG_bits].u_int != 8) { - mp_raise_ValueError("bits must be 8"); + mp_raise_ValueError(translate("bits must be 8")); } if (args[ARG_firstbit].u_int != MICROPY_PY_MACHINE_SPI_MSB) { - mp_raise_ValueError("firstbit must be MSB"); + mp_raise_ValueError(translate("firstbit must be MSB")); } if (args[ARG_sck].u_obj == MP_OBJ_NULL || args[ARG_mosi].u_obj == MP_OBJ_NULL || args[ARG_miso].u_obj == MP_OBJ_NULL) { - mp_raise_ValueError("must specify all of sck/mosi/miso"); + mp_raise_ValueError(translate("must specify all of sck/mosi/miso")); } self->spi.sck = mp_hal_get_pin_obj(args[ARG_sck].u_obj); self->spi.mosi = mp_hal_get_pin_obj(args[ARG_mosi].u_obj); |
