commit
66a76d034e
@ -126,8 +126,10 @@ msgstr ""
|
|||||||
|
|
||||||
#: ports/espressif/common-hal/espulp/ULP.c
|
#: ports/espressif/common-hal/espulp/ULP.c
|
||||||
#: ports/mimxrt10xx/common-hal/audiobusio/__init__.c
|
#: ports/mimxrt10xx/common-hal/audiobusio/__init__.c
|
||||||
|
#: ports/mimxrt10xx/common-hal/usb_host/Port.c
|
||||||
#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c
|
#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c
|
||||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||||
|
#: ports/raspberrypi/common-hal/usb_host/Port.c
|
||||||
#: shared-bindings/digitalio/DigitalInOut.c
|
#: shared-bindings/digitalio/DigitalInOut.c
|
||||||
#: shared-bindings/microcontroller/Pin.c
|
#: shared-bindings/microcontroller/Pin.c
|
||||||
msgid "%q in use"
|
msgid "%q in use"
|
||||||
@ -182,6 +184,7 @@ msgid "%q must be 1 when %q is True"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: py/argcheck.c shared-bindings/gifio/GifWriter.c
|
#: py/argcheck.c shared-bindings/gifio/GifWriter.c
|
||||||
|
#: shared-module/gifio/OnDiskGif.c
|
||||||
msgid "%q must be <= %d"
|
msgid "%q must be <= %d"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -779,10 +782,6 @@ msgstr ""
|
|||||||
msgid "Cannot subclass slice"
|
msgid "Cannot subclass slice"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: shared-module/bitbangio/SPI.c
|
|
||||||
msgid "Cannot transfer without MOSI and MISO pins"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: shared-bindings/pwmio/PWMOut.c
|
#: shared-bindings/pwmio/PWMOut.c
|
||||||
msgid "Cannot vary frequency on a timer that is already in use"
|
msgid "Cannot vary frequency on a timer that is already in use"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -1090,13 +1089,10 @@ msgstr ""
|
|||||||
msgid "Half duplex SPI is not implemented"
|
msgid "Half duplex SPI is not implemented"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c
|
#: ports/mimxrt10xx/common-hal/busio/SPI.c
|
||||||
#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c
|
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c
|
||||||
#: ports/stm/common-hal/sdioio/SDCard.c
|
#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c
|
||||||
msgid "Hardware busy, try alternative pins"
|
#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
|
|
||||||
msgid "Hardware in use, try alternative pins"
|
msgid "Hardware in use, try alternative pins"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1355,14 +1351,6 @@ msgstr ""
|
|||||||
msgid "Mismatched swap flag"
|
msgid "Mismatched swap flag"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/SPI.c
|
|
||||||
msgid "Missing MISO or MOSI Pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/stm/common-hal/busio/SPI.c
|
|
||||||
msgid "Missing MISO or MOSI pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Missing first_in_pin. Instruction %d reads pin(s)"
|
msgid "Missing first_in_pin. Instruction %d reads pin(s)"
|
||||||
@ -1436,6 +1424,14 @@ msgid "Nimble out of memory"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ports/atmel-samd/common-hal/busio/UART.c
|
#: ports/atmel-samd/common-hal/busio/UART.c
|
||||||
|
#: ports/espressif/common-hal/busio/SPI.c
|
||||||
|
#: ports/espressif/common-hal/busio/UART.c
|
||||||
|
#: ports/mimxrt10xx/common-hal/busio/SPI.c
|
||||||
|
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
|
||||||
|
#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c
|
||||||
|
#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c
|
||||||
|
#: shared-bindings/displayio/I2CDisplay.c
|
||||||
|
#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c
|
||||||
msgid "No %q pin"
|
msgid "No %q pin"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1469,36 +1465,6 @@ msgstr ""
|
|||||||
msgid "No IP"
|
msgid "No IP"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ports/espressif/common-hal/busio/SPI.c
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/SPI.c
|
|
||||||
msgid "No MISO Pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
|
|
||||||
msgid "No MISO pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/espressif/common-hal/busio/SPI.c
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/SPI.c
|
|
||||||
msgid "No MOSI Pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
|
|
||||||
msgid "No MOSI pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/espressif/common-hal/busio/UART.c
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
|
|
||||||
#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
|
|
||||||
msgid "No RX pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/espressif/common-hal/busio/UART.c
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
|
|
||||||
#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
|
|
||||||
msgid "No TX pin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
|
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
|
||||||
msgid "No available clocks"
|
msgid "No available clocks"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -2405,6 +2371,7 @@ msgstr ""
|
|||||||
#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h
|
#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h
|
||||||
#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h
|
#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h
|
||||||
#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h
|
#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h
|
||||||
|
#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h
|
||||||
msgid "You pressed button A at start up."
|
msgid "You pressed button A at start up."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -3628,11 +3595,6 @@ msgstr ""
|
|||||||
msgid "no module named '%q'"
|
msgid "no module named '%q'"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
|
|
||||||
#: shared-bindings/paralleldisplay/ParallelBus.c
|
|
||||||
msgid "no reset pin available"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: shared-module/sdcardio/SDCard.c
|
#: shared-module/sdcardio/SDCard.c
|
||||||
msgid "no response from SD card"
|
msgid "no response from SD card"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -352,7 +352,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||||||
// Write characters.
|
// Write characters.
|
||||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->tx_pin == NULL) {
|
if (self->tx_pin == NULL) {
|
||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
COMPLETE_MEMORY_READS;
|
COMPLETE_MEMORY_READS;
|
||||||
@ -400,7 +400,7 @@ STATIC void enable_interrupt(busio_uart_obj_t *self) {
|
|||||||
// Read characters.
|
// Read characters.
|
||||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->rx_pin == NULL) {
|
if (self->rx_pin == NULL) {
|
||||||
mp_raise_ValueError(translate("No RX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
|
@ -186,7 +186,7 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
|
|||||||
bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
||||||
const uint8_t *data, size_t len) {
|
const uint8_t *data, size_t len) {
|
||||||
if (self->MOSI == NULL) {
|
if (self->MOSI == NULL) {
|
||||||
mp_raise_ValueError(translate("No MOSI Pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
}
|
}
|
||||||
return common_hal_busio_spi_transfer(self, data, NULL, len);
|
return common_hal_busio_spi_transfer(self, data, NULL, len);
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
|||||||
bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
||||||
uint8_t *data, size_t len, uint8_t write_value) {
|
uint8_t *data, size_t len, uint8_t write_value) {
|
||||||
if (self->MISO == NULL) {
|
if (self->MISO == NULL) {
|
||||||
mp_raise_ValueError(translate("No MISO Pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
if (self->MOSI == NULL) {
|
if (self->MOSI == NULL) {
|
||||||
return common_hal_busio_spi_transfer(self, NULL, data, len);
|
return common_hal_busio_spi_transfer(self, NULL, data, len);
|
||||||
@ -210,10 +210,10 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (self->MOSI == NULL && data_out != NULL) {
|
if (self->MOSI == NULL && data_out != NULL) {
|
||||||
mp_raise_ValueError(translate("No MOSI Pin"));
|
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(translate("No MISO Pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
|
|
||||||
spi_transaction_t transactions[MAX_SPI_TRANSACTIONS];
|
spi_transaction_t transactions[MAX_SPI_TRANSACTIONS];
|
||||||
|
@ -304,7 +304,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||||||
// Read characters.
|
// Read characters.
|
||||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->rx_pin == NULL) {
|
if (self->rx_pin == NULL) {
|
||||||
mp_raise_ValueError(translate("No RX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx);
|
||||||
}
|
}
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
// Nothing to read.
|
// Nothing to read.
|
||||||
@ -357,7 +357,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
|
|||||||
// Write characters.
|
// Write characters.
|
||||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->tx_pin == NULL) {
|
if (self->tx_pin == NULL) {
|
||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t left_to_write = len;
|
size_t left_to_write = len;
|
||||||
|
@ -182,7 +182,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||||||
self->spi = mcu_spi_banks[self->clock->bank_idx - 1];
|
self->spi = mcu_spi_banks[self->clock->bank_idx - 1];
|
||||||
} else {
|
} else {
|
||||||
if (spi_taken) {
|
if (spi_taken) {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pins();
|
raise_ValueError_invalid_pins();
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (self->mosi == NULL) {
|
if (self->mosi == NULL) {
|
||||||
mp_raise_ValueError(translate("No MOSI Pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
}
|
}
|
||||||
|
|
||||||
lpspi_transfer_t xfer = { 0 };
|
lpspi_transfer_t xfer = { 0 };
|
||||||
@ -349,7 +349,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (self->miso == NULL) {
|
if (self->miso == NULL) {
|
||||||
mp_raise_ValueError(translate("No MISO Pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
|
|
||||||
LPSPI_SetDummyData(self->spi, write_value);
|
LPSPI_SetDummyData(self->spi, write_value);
|
||||||
@ -367,8 +367,11 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou
|
|||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (self->miso == NULL || self->mosi == NULL) {
|
if (self->mosi == NULL && data_out != NULL) {
|
||||||
mp_raise_ValueError(translate("Missing MISO or MOSI Pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
|
}
|
||||||
|
if (self->miso == NULL && data_in != NULL) {
|
||||||
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
|
|
||||||
LPSPI_SetDummyData(self->spi, 0xFF);
|
LPSPI_SetDummyData(self->spi, 0xFF);
|
||||||
|
@ -401,7 +401,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||||||
// Read characters.
|
// Read characters.
|
||||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->rx == NULL) {
|
if (self->rx == NULL) {
|
||||||
mp_raise_ValueError(translate("No RX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@ -458,7 +458,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
|
|||||||
// Write characters.
|
// Write characters.
|
||||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->tx == NULL) {
|
if (self->tx == NULL) {
|
||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx);
|
||||||
}
|
}
|
||||||
if (self->rs485_dir && len) {
|
if (self->rs485_dir && len) {
|
||||||
GPIO_PinWrite(self->rs485_dir->gpio, self->rs485_dir->number, !self->rs485_invert);
|
GPIO_PinWrite(self->rs485_dir->gpio, self->rs485_dir->number, !self->rs485_invert);
|
||||||
|
@ -37,7 +37,6 @@ extern uint8_t _ld_filesystem_start;
|
|||||||
extern uint8_t _ld_filesystem_end;
|
extern uint8_t _ld_filesystem_end;
|
||||||
extern uint8_t _ld_default_stack_size;
|
extern uint8_t _ld_default_stack_size;
|
||||||
|
|
||||||
// 20kiB stack
|
|
||||||
#define CIRCUITPY_DEFAULT_STACK_SIZE ((uint32_t)&_ld_default_stack_size)
|
#define CIRCUITPY_DEFAULT_STACK_SIZE ((uint32_t)&_ld_default_stack_size)
|
||||||
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
|
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
|
||||||
#define MICROPY_PY_FUNCTION_ATTRS (0)
|
#define MICROPY_PY_FUNCTION_ATTRS (0)
|
||||||
@ -47,6 +46,10 @@ extern uint8_t _ld_default_stack_size;
|
|||||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR ((uint32_t)&_ld_filesystem_start)
|
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR ((uint32_t)&_ld_filesystem_start)
|
||||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE ((uint32_t)(&_ld_filesystem_end - &_ld_filesystem_start))
|
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE ((uint32_t)(&_ld_filesystem_end - &_ld_filesystem_start))
|
||||||
|
|
||||||
|
// Allocate 32 bytes at a time instead of the default 16 so that allocated buffers
|
||||||
|
// are aligned to cache lines.
|
||||||
|
#define MICROPY_BYTES_PER_GC_BLOCK (32)
|
||||||
|
|
||||||
#include "py/circuitpy_mpconfig.h"
|
#include "py/circuitpy_mpconfig.h"
|
||||||
|
|
||||||
#define MICROPY_PORT_ROOT_POINTERS \
|
#define MICROPY_PORT_ROOT_POINTERS \
|
||||||
|
@ -297,7 +297,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||||||
// Read characters.
|
// Read characters.
|
||||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||||
if (nrf_uarte_rx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED) {
|
if (nrf_uarte_rx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED) {
|
||||||
mp_raise_ValueError(translate("No RX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t start_ticks = supervisor_ticks_ms64();
|
uint64_t start_ticks = supervisor_ticks_ms64();
|
||||||
@ -347,7 +347,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
|
|||||||
// Write characters.
|
// Write characters.
|
||||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||||
if (nrf_uarte_tx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED) {
|
if (nrf_uarte_tx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED) {
|
||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
|
@ -211,7 +211,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||||||
// Write characters.
|
// Write characters.
|
||||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->tx_pin == NO_PIN) {
|
if (self->tx_pin == NO_PIN) {
|
||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->rs485_dir_pin != NO_PIN) {
|
if (self->rs485_dir_pin != NO_PIN) {
|
||||||
@ -239,7 +239,7 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data,
|
|||||||
// Read characters.
|
// Read characters.
|
||||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->rx_pin == NO_PIN) {
|
if (self->rx_pin == NO_PIN) {
|
||||||
mp_raise_ValueError(translate("No RX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
|
@ -72,7 +72,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
|||||||
common_hal_mcu_pin_claim(sda);
|
common_hal_mcu_pin_claim(sda);
|
||||||
in_used = true;
|
in_used = true;
|
||||||
} else {
|
} else {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pins();
|
raise_ValueError_invalid_pins();
|
||||||
|
@ -95,7 +95,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||||||
mp_raise_ValueError(translate("SPI init error"));
|
mp_raise_ValueError(translate("SPI init error"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pins();
|
raise_ValueError_invalid_pins();
|
||||||
|
@ -131,7 +131,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||||||
context = self;
|
context = self;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,7 +117,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
|||||||
I2Cx = mcu_i2c_banks[self->sda->periph_index - 1];
|
I2Cx = mcu_i2c_banks[self->sda->periph_index - 1];
|
||||||
} else {
|
} else {
|
||||||
if (i2c_taken) {
|
if (i2c_taken) {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pins();
|
raise_ValueError_invalid_pins();
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ STATIC int check_pins(busio_spi_obj_t *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (spi_taken) {
|
if (spi_taken) {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pin();
|
raise_ValueError_invalid_pin();
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
|
|||||||
bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
||||||
const uint8_t *data, size_t len) {
|
const uint8_t *data, size_t len) {
|
||||||
if (self->mosi == NULL) {
|
if (self->mosi == NULL) {
|
||||||
mp_raise_ValueError(translate("No MOSI pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
}
|
}
|
||||||
HAL_StatusTypeDef result = HAL_SPI_Transmit(&self->handle, (uint8_t *)data, (uint16_t)len, HAL_MAX_DELAY);
|
HAL_StatusTypeDef result = HAL_SPI_Transmit(&self->handle, (uint8_t *)data, (uint16_t)len, HAL_MAX_DELAY);
|
||||||
return result == HAL_OK;
|
return result == HAL_OK;
|
||||||
@ -356,9 +356,9 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
|||||||
bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
||||||
uint8_t *data, size_t len, uint8_t write_value) {
|
uint8_t *data, size_t len, uint8_t write_value) {
|
||||||
if (self->miso == NULL && !self->half_duplex) {
|
if (self->miso == NULL && !self->half_duplex) {
|
||||||
mp_raise_ValueError(translate("No MISO pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
} else if (self->half_duplex && self->mosi == NULL) {
|
} else if (self->half_duplex && self->mosi == NULL) {
|
||||||
mp_raise_ValueError(translate("No MOSI pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
}
|
}
|
||||||
HAL_StatusTypeDef result = HAL_OK;
|
HAL_StatusTypeDef result = HAL_OK;
|
||||||
if ((!self->half_duplex && self->mosi == NULL) || (self->half_duplex && self->mosi != NULL && self->miso == NULL)) {
|
if ((!self->half_duplex && self->mosi == NULL) || (self->half_duplex && self->mosi != NULL && self->miso == NULL)) {
|
||||||
@ -372,8 +372,11 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
|||||||
|
|
||||||
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
|
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
|
||||||
const uint8_t *data_out, uint8_t *data_in, size_t len) {
|
const uint8_t *data_out, uint8_t *data_in, size_t len) {
|
||||||
if (self->miso == NULL || self->mosi == NULL) {
|
if (self->mosi == NULL && data_out != NULL) {
|
||||||
mp_raise_ValueError(translate("Missing MISO or MOSI pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
|
}
|
||||||
|
if (self->miso == NULL && data_in != NULL) {
|
||||||
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
HAL_StatusTypeDef result = HAL_SPI_TransmitReceive(&self->handle,
|
HAL_StatusTypeDef result = HAL_SPI_TransmitReceive(&self->handle,
|
||||||
(uint8_t *)data_out, data_in, (uint16_t)len,HAL_MAX_DELAY);
|
(uint8_t *)data_out, data_in, (uint16_t)len,HAL_MAX_DELAY);
|
||||||
|
@ -293,7 +293,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||||||
|
|
||||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->rx == NULL) {
|
if (self->rx == NULL) {
|
||||||
mp_raise_ValueError(translate("No RX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t start_ticks = supervisor_ticks_ms64();
|
uint64_t start_ticks = supervisor_ticks_ms64();
|
||||||
@ -327,7 +327,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
|
|||||||
// Write characters.
|
// Write characters.
|
||||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||||
if (self->tx == NULL) {
|
if (self->tx == NULL) {
|
||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable UART IRQ to avoid resource hazards in Rx IRQ handler
|
// Disable UART IRQ to avoid resource hazards in Rx IRQ handler
|
||||||
|
@ -69,7 +69,7 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, const mcu_pin_obj_t *
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reserved_can[periph_index]) {
|
if (reserved_can[periph_index]) {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t can_frequency = 42000000;
|
const uint32_t can_frequency = 42000000;
|
||||||
|
@ -113,7 +113,7 @@ STATIC int check_pins(sdioio_sdcard_obj_t *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sdio_taken) {
|
if (sdio_taken) {
|
||||||
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
|
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pin();
|
raise_ValueError_invalid_pin();
|
||||||
}
|
}
|
||||||
|
@ -289,18 +289,18 @@ mp_uint_t PLACE_IN_ITCM(qstr_hash)(qstr q) {
|
|||||||
return attr.hash;
|
return attr.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t qstr_len(qstr q) {
|
size_t PLACE_IN_ITCM(qstr_len)(qstr q) {
|
||||||
qstr_attr_t attr;
|
qstr_attr_t attr;
|
||||||
find_qstr(q, &attr);
|
find_qstr(q, &attr);
|
||||||
return attr.len;
|
return attr.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *qstr_str(qstr q) {
|
const char *PLACE_IN_ITCM(qstr_str)(qstr q) {
|
||||||
qstr_attr_t attr;
|
qstr_attr_t attr;
|
||||||
return find_qstr(q, &attr);
|
return find_qstr(q, &attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte *qstr_data(qstr q, size_t *len) {
|
const byte *PLACE_IN_ITCM(qstr_data)(qstr q, size_t *len) {
|
||||||
qstr_attr_t attr;
|
qstr_attr_t attr;
|
||||||
const char *qd = find_qstr(q, &attr);
|
const char *qd = find_qstr(q, &attr);
|
||||||
*len = attr.len;
|
*len = attr.len;
|
||||||
|
@ -1655,6 +1655,13 @@ NORETURN MP_COLD void mp_raise_RuntimeError(const compressed_string_t *msg) {
|
|||||||
mp_raise_msg(&mp_type_RuntimeError, 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) {
|
NORETURN MP_COLD void mp_raise_ImportError(const compressed_string_t *msg) {
|
||||||
mp_raise_msg(&mp_type_ImportError, msg);
|
mp_raise_msg(&mp_type_ImportError, msg);
|
||||||
}
|
}
|
||||||
|
@ -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_TypeError_varg(const compressed_string_t *fmt, ...);
|
||||||
NORETURN void mp_raise_AttributeError(const compressed_string_t *msg);
|
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(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_ImportError(const compressed_string_t *msg);
|
||||||
NORETURN void mp_raise_IndexError(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, ...);
|
NORETURN void mp_raise_IndexError_varg(const compressed_string_t *msg, ...);
|
||||||
|
@ -114,7 +114,7 @@ STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) {
|
|||||||
displayio_fourwire_obj_t *self = self_in;
|
displayio_fourwire_obj_t *self = self_in;
|
||||||
|
|
||||||
if (!common_hal_displayio_fourwire_reset(self)) {
|
if (!common_hal_displayio_fourwire_reset(self)) {
|
||||||
mp_raise_RuntimeError(translate("no reset pin available"));
|
mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset);
|
||||||
}
|
}
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) {
|
|||||||
displayio_i2cdisplay_obj_t *self = self_in;
|
displayio_i2cdisplay_obj_t *self = self_in;
|
||||||
|
|
||||||
if (!common_hal_displayio_i2cdisplay_reset(self)) {
|
if (!common_hal_displayio_i2cdisplay_reset(self)) {
|
||||||
mp_raise_RuntimeError(translate("no reset pin available"));
|
mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset);
|
||||||
}
|
}
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ STATIC mp_obj_t paralleldisplay_parallelbus_obj_reset(mp_obj_t self_in) {
|
|||||||
paralleldisplay_parallelbus_obj_t *self = self_in;
|
paralleldisplay_parallelbus_obj_t *self = self_in;
|
||||||
|
|
||||||
if (!common_hal_paralleldisplay_parallelbus_reset(self)) {
|
if (!common_hal_paralleldisplay_parallelbus_reset(self)) {
|
||||||
mp_raise_RuntimeError(translate("no reset pin available"));
|
mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset);
|
||||||
}
|
}
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ void shared_module_bitbangio_spi_unlock(bitbangio_spi_obj_t *self) {
|
|||||||
// Writes out the given data.
|
// Writes out the given data.
|
||||||
bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t *data, size_t len) {
|
bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t *data, size_t len) {
|
||||||
if (len > 0 && !self->has_mosi) {
|
if (len > 0 && !self->has_mosi) {
|
||||||
mp_raise_ValueError(translate("No MOSI pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
}
|
}
|
||||||
uint32_t delay_half = self->delay_half;
|
uint32_t delay_half = self->delay_half;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t
|
|||||||
// Reads in len bytes while outputting zeroes.
|
// Reads in len bytes while outputting zeroes.
|
||||||
bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_data) {
|
bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_data) {
|
||||||
if (len > 0 && !self->has_miso) {
|
if (len > 0 && !self->has_miso) {
|
||||||
mp_raise_ValueError(translate("No MISO pin"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t delay_half = self->delay_half;
|
uint32_t delay_half = self->delay_half;
|
||||||
@ -245,8 +245,11 @@ bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data,
|
|||||||
|
|
||||||
// transfer
|
// transfer
|
||||||
bool shared_module_bitbangio_spi_transfer(bitbangio_spi_obj_t *self, const uint8_t *dout, uint8_t *din, size_t len) {
|
bool shared_module_bitbangio_spi_transfer(bitbangio_spi_obj_t *self, const uint8_t *dout, uint8_t *din, size_t len) {
|
||||||
if (len > 0 && (!self->has_mosi || !self->has_miso)) {
|
if (!self->has_mosi && dout != NULL) {
|
||||||
mp_raise_ValueError(translate("Cannot transfer without MOSI and MISO pins"));
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi);
|
||||||
|
}
|
||||||
|
if (!self->has_miso && din != NULL) {
|
||||||
|
mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso);
|
||||||
}
|
}
|
||||||
uint32_t delay_half = self->delay_half;
|
uint32_t delay_half = self->delay_half;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user