Merge branch 'adafruit:main' into main

This commit is contained in:
dronecz 2022-11-08 01:02:46 +01:00 committed by GitHub
commit 28e4834da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 257 additions and 122 deletions

View File

@ -37,7 +37,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- name: Get CP deps - name: Get CP deps
run: python tools/ci_fetch_deps.py test ${{ github.sha }} run: python tools/ci_fetch_deps.py test ${{ github.sha }}
- name: CircuitPython version - name: CircuitPython version
@ -156,7 +156,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- name: Get CP deps - name: Get CP deps
run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }} run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }}
- name: CircuitPython version - name: CircuitPython version
@ -220,7 +220,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get update
@ -278,7 +278,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: false submodules: false
@ -331,7 +331,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: false submodules: false
@ -384,7 +384,7 @@ jobs:
id: py3 id: py3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: false submodules: false
@ -473,7 +473,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: false submodules: false

View File

@ -23,7 +23,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- name: Get CP deps - name: Get CP deps
run: python tools/ci_fetch_deps.py website ${{ github.sha }} run: python tools/ci_fetch_deps.py website ${{ github.sha }}
- name: Install deps - name: Install deps

View File

@ -20,7 +20,7 @@ jobs:
- name: Set up Python 3 - name: Set up Python 3
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.x" python-version: "3.10"
- name: Install deps - name: Install deps
run: | run: |
sudo apt-get install -y gettext uncrustify sudo apt-get install -y gettext uncrustify

View File

@ -35,6 +35,8 @@ Failing to install these will prevent from properly building.
pip3 install -r requirements-dev.txt pip3 install -r requirements-dev.txt
If you run into an error installing minify_html, you may need to install `rust`.
### mpy-cross ### mpy-cross
As part of the build process, mpy-cross is needed to compile .py files into .mpy files. As part of the build process, mpy-cross is needed to compile .py files into .mpy files.

View File

@ -83,7 +83,7 @@ STATIC mp_obj_t ticks(void) {
// shared-bindings/supervisor/__init__.c). We assume/require that // shared-bindings/supervisor/__init__.c). We assume/require that
// supervisor.ticks_ms is picked as the ticks implementation under // supervisor.ticks_ms is picked as the ticks implementation under
// CircuitPython for the Python-coded bits of asyncio. // CircuitPython for the Python-coded bits of asyncio.
#define ticks() MP_OBJ_NEW_SMALL_INT(supervisor_ticks_ms()) #define ticks() supervisor_ticks_ms()
#endif #endif
STATIC mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) { STATIC mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) {

View File

@ -16,6 +16,7 @@
#include "py/stream.h" #include "py/stream.h"
#include "py/mperrno.h" #include "py/mperrno.h"
#include "py/mphal.h" #include "py/mphal.h"
#include "shared/runtime/interrupt_char.h"
// Flags for poll() // Flags for poll()
#define FLAG_ONESHOT (1) #define FLAG_ONESHOT (1)
@ -230,6 +231,9 @@ STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
break; break;
} }
RUN_BACKGROUND_TASKS; RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
return 0;
}
} }
return n_ready; return n_ready;

View File

@ -110,10 +110,6 @@ msgstr ""
msgid "%q index out of range" msgid "%q index out of range"
msgstr "" msgstr ""
#: py/obj.c
msgid "%q indices must be integers, not %s"
msgstr ""
#: shared-module/bitbangio/SPI.c #: shared-module/bitbangio/SPI.c
msgid "%q init failed" msgid "%q init failed"
msgstr "" msgstr ""
@ -2341,10 +2337,6 @@ msgstr ""
msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET"
msgstr "" msgstr ""
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "WatchDogTimer.timeout must be greater than 0"
msgstr ""
#: py/builtinhelp.c #: py/builtinhelp.c
#, c-format #, c-format
msgid "" msgid ""
@ -3166,10 +3158,6 @@ msgstr ""
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
#: py/obj.c
msgid "indices must be integers"
msgstr ""
#: extmod/ulab/code/ndarray.c #: extmod/ulab/code/ndarray.c
msgid "indices must be integers, slices, or Boolean lists" msgid "indices must be integers, slices, or Boolean lists"
msgstr "" msgstr ""
@ -3586,10 +3574,6 @@ msgstr ""
msgid "no such attribute" msgid "no such attribute"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/__init__.c
msgid "non-Device in %q"
msgstr ""
#: ports/espressif/common-hal/_bleio/Connection.c #: ports/espressif/common-hal/_bleio/Connection.c
#: ports/nrf/common-hal/_bleio/Connection.c #: ports/nrf/common-hal/_bleio/Connection.c
msgid "non-UUID found in service_uuids_whitelist" msgid "non-UUID found in service_uuids_whitelist"
@ -3863,11 +3847,6 @@ msgstr ""
msgid "relative import" msgid "relative import"
msgstr "" msgstr ""
#: py/obj.c
#, c-format
msgid "requested length %d but object has length %d"
msgstr ""
#: extmod/ulab/code/ndarray_operators.c #: extmod/ulab/code/ndarray_operators.c
msgid "results cannot be cast to specified type" msgid "results cannot be cast to specified type"
msgstr "" msgstr ""
@ -3931,10 +3910,6 @@ msgstr ""
msgid "sign not allowed with integer format specifier 'c'" msgid "sign not allowed with integer format specifier 'c'"
msgstr "" msgstr ""
#: py/objstr.c
msgid "single '}' encountered in format string"
msgstr ""
#: extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/ulab_tools.c
msgid "size is defined for ndarrays only" msgid "size is defined for ndarrays only"
msgstr "" msgstr ""
@ -4047,10 +4022,6 @@ msgstr ""
msgid "syntax error in uctypes descriptor" msgid "syntax error in uctypes descriptor"
msgstr "" msgstr ""
#: shared-bindings/touchio/TouchIn.c
msgid "threshold must be in the range 0-65536"
msgstr ""
#: shared-bindings/time/__init__.c #: shared-bindings/time/__init__.c
msgid "time.struct_time() takes a 9-sequence" msgid "time.struct_time() takes a 9-sequence"
msgstr "" msgstr ""
@ -4062,10 +4033,6 @@ msgstr ""
msgid "timeout duration exceeded the maximum supported value" msgid "timeout duration exceeded the maximum supported value"
msgstr "" msgstr ""
#: shared-bindings/busio/UART.c
msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c
msgid "timeout must be < 655.35 secs" msgid "timeout must be < 655.35 secs"
msgstr "" msgstr ""
@ -4119,10 +4086,6 @@ msgstr ""
msgid "trapz is defined for 1D iterables" msgid "trapz is defined for 1D iterables"
msgstr "" msgstr ""
#: py/obj.c
msgid "tuple/list has wrong length"
msgstr ""
#: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/canio/CAN.c
#, c-format #, c-format
msgid "twai_driver_install returned esp-idf error #%d" msgid "twai_driver_install returned esp-idf error #%d"
@ -4201,7 +4164,8 @@ msgid "unknown type '%q'"
msgstr "" msgstr ""
#: py/objstr.c #: py/objstr.c
msgid "unmatched '{' in format" #, c-format
msgid "unmatched '%c' in format"
msgstr "" msgstr ""
#: py/objtype.c py/runtime.c #: py/objtype.c py/runtime.c
@ -4272,10 +4236,6 @@ msgstr ""
msgid "watchdog not initialized" msgid "watchdog not initialized"
msgstr "" msgstr ""
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/is31fl3741/FrameBuffer.c #: shared-bindings/is31fl3741/FrameBuffer.c
msgid "width must be greater than zero" msgid "width must be greater than zero"
msgstr "" msgstr ""

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n" "POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2022-10-29 22:00+0000\n" "PO-Revision-Date: 2022-11-02 09:33+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n" "Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: pt_BR\n" "Language: pt_BR\n"
@ -608,7 +608,7 @@ msgstr "Ambos os RX e TX são necessários para o controle do fluxo"
#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h
#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h #: ports/atmel-samd/boards/meowmeow/mpconfigboard.h
msgid "Both buttons were pressed at start up.\n" msgid "Both buttons were pressed at start up.\n"
msgstr "" msgstr "Ambos os botões foram pressionados na inicialização.\n"
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "Both pins must support hardware interrupts" msgid "Both pins must support hardware interrupts"
@ -678,7 +678,7 @@ msgstr "O pino bus %d já está em uso"
#: 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
msgid "Button A was pressed at start up.\n" msgid "Button A was pressed at start up.\n"
msgstr "" msgstr "O botão A foi pressionado na inicialização.\n"
#: shared-bindings/_bleio/UUID.c #: shared-bindings/_bleio/UUID.c
msgid "Byte buffer must be 16 bytes." msgid "Byte buffer must be 16 bytes."
@ -2045,7 +2045,7 @@ msgstr "A leitura da temperatura expirou"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "The BOOT button was pressed at start up.\n" msgid "The BOOT button was pressed at start up.\n"
msgstr "" msgstr "O botão BOOT foi pressionado na inicialização.\n"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "" msgid ""
@ -2058,11 +2058,11 @@ msgstr ""
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h #: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
msgid "The SW38 button was pressed at start up.\n" msgid "The SW38 button was pressed at start up.\n"
msgstr "" msgstr "O botão SW38 foi pressionado na inicialização.\n"
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h #: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
msgid "The VOLUME button was pressed at start up.\n" msgid "The VOLUME button was pressed at start up.\n"
msgstr "" msgstr "O botão VOLUME foi pressionado na inicialização.\n"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "" msgid ""
@ -2074,11 +2074,11 @@ msgstr ""
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
msgid "The central button was pressed at start up.\n" msgid "The central button was pressed at start up.\n"
msgstr "" msgstr "O botão central foi pressionado na inicialização.\n"
#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h #: ports/nrf/boards/aramcon2_badge/mpconfigboard.h
msgid "The left button was pressed at start up.\n" msgid "The left button was pressed at start up.\n"
msgstr "" msgstr "O botão esquerdo foi pressionado na inicialização.\n"
#: shared-bindings/rgbmatrix/RGBMatrix.c #: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30"
@ -2149,7 +2149,7 @@ msgstr ""
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without requesting safe mode." msgid "To exit, please reset the board without requesting safe mode."
msgstr "" msgstr "Para sair, reinicie a placa sem solicitar o modo de segurança."
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample" msgid "Too many channels in sample"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n" "POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2022-10-29 22:00+0000\n" "PO-Revision-Date: 2022-10-31 13:02+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n" "Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n" "Language: sv\n"
@ -600,7 +600,7 @@ msgstr "Både RX och TX krävs för handskakning"
#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h
#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h #: ports/atmel-samd/boards/meowmeow/mpconfigboard.h
msgid "Both buttons were pressed at start up.\n" msgid "Both buttons were pressed at start up.\n"
msgstr "" msgstr "Båda knapparna trycktes ned vid start.\n"
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "Both pins must support hardware interrupts" msgid "Both pins must support hardware interrupts"
@ -670,7 +670,7 @@ msgstr "Busspinne %d används redan"
#: 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
msgid "Button A was pressed at start up.\n" msgid "Button A was pressed at start up.\n"
msgstr "" msgstr "Knapp A trycktes ned vid start.\n"
#: shared-bindings/_bleio/UUID.c #: shared-bindings/_bleio/UUID.c
msgid "Byte buffer must be 16 bytes." msgid "Byte buffer must be 16 bytes."
@ -2024,7 +2024,7 @@ msgstr "Temperaturavläsning tog för lång tid"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "The BOOT button was pressed at start up.\n" msgid "The BOOT button was pressed at start up.\n"
msgstr "" msgstr "BOOT-knappen trycktes ner vid start.\n"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "" msgid ""
@ -2036,11 +2036,11 @@ msgstr ""
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h #: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
msgid "The SW38 button was pressed at start up.\n" msgid "The SW38 button was pressed at start up.\n"
msgstr "" msgstr "SW38-knappen trycktes ned vid start.\n"
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h #: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
msgid "The VOLUME button was pressed at start up.\n" msgid "The VOLUME button was pressed at start up.\n"
msgstr "" msgstr "VOLUME-knappen trycktes ned vid start.\n"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "" msgid ""
@ -2052,11 +2052,11 @@ msgstr ""
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
msgid "The central button was pressed at start up.\n" msgid "The central button was pressed at start up.\n"
msgstr "" msgstr "Mittknappen trycktes in vid start.\n"
#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h #: ports/nrf/boards/aramcon2_badge/mpconfigboard.h
msgid "The left button was pressed at start up.\n" msgid "The left button was pressed at start up.\n"
msgstr "" msgstr "Den vänstra knappen trycktes ned vid start.\n"
#: shared-bindings/rgbmatrix/RGBMatrix.c #: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30"
@ -2125,7 +2125,7 @@ msgstr "Åtgärden tog för lång tid: Max väntetid är %d sekunder"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without requesting safe mode." msgid "To exit, please reset the board without requesting safe mode."
msgstr "" msgstr "För att avsluta, återställ kortet utan att begära säkert läge."
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample" msgid "Too many channels in sample"

View File

@ -553,3 +553,27 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self,
void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms) { void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms) {
self->timeout_ms = timeout_ms; self->timeout_ms = timeout_ms;
} }
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) {
struct timeval immediate = {0, 0};
fd_set fds;
FD_ZERO(&fds);
FD_SET(self->num, &fds);
int num_triggered = select(self->num + 1, &fds, NULL, &fds, &immediate);
// including returning true in the error case
return num_triggered != 0;
}
bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) {
struct timeval immediate = {0, 0};
fd_set fds;
FD_ZERO(&fds);
FD_SET(self->num, &fds);
int num_triggered = select(self->num + 1, NULL, &fds, &fds, &immediate);
// including returning true in the error case
return num_triggered != 0;
}

View File

@ -43,6 +43,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -0,0 +1,29 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -0,0 +1,14 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040 Scorpio"
#define MICROPY_HW_MCU_NAME "rp2040"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO16)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO15)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO8)
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

View File

@ -0,0 +1,9 @@
USB_VID = 0x239A
USB_PID = 0x8122
USB_PRODUCT = "Feather RP2040 Scorpio"
USB_MANUFACTURER = "Adafruit"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2
EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ"

View File

@ -0,0 +1,4 @@
// Put board-specific pico-sdk definitions here. This file must exist.
// Allow extra time for xosc to start.
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64

View File

@ -0,0 +1,48 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) },
{ MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL0), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL1), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL2), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL3), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL4), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL5), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL6), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL7), MP_ROM_PTR(&pin_GPIO23) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -1163,3 +1163,46 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *socket,
void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms) { void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms) {
self->timeout = timeout_ms; self->timeout = timeout_ms;
} }
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) {
MICROPY_PY_LWIP_ENTER;
bool result = self->incoming.pbuf != NULL;
if (self->state == STATE_PEER_CLOSED) {
result = true;
}
if (self->type == SOCKETPOOL_SOCK_STREAM && self->pcb.tcp->state == LISTEN) {
struct tcp_pcb *volatile *incoming_connection = &lwip_socket_incoming_array(self)[self->incoming.connection.iget];
result = (incoming_connection != NULL);
}
MICROPY_PY_LWIP_EXIT;
return result;
}
bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) {
bool result = false;
MICROPY_PY_LWIP_ENTER;
switch (self->type) {
case SOCKETPOOL_SOCK_STREAM: {
result = tcp_sndbuf(self->pcb.tcp) != 0;
break;
}
case SOCKETPOOL_SOCK_DGRAM:
#if MICROPY_PY_LWIP_SOCK_RAW
case SOCKETPOOL_SOCK_RAW:
#endif
result = true;
break;
}
MICROPY_PY_LWIP_EXIT;
return result;
}

View File

@ -488,14 +488,7 @@ void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items) {
void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items) { void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items) {
size_t seq_len; size_t seq_len;
mp_obj_get_array(o, &seq_len, items); mp_obj_get_array(o, &seq_len, items);
if (seq_len != len) { mp_arg_validate_length(seq_len, len, mp_obj_get_type(o)->name);
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
mp_raise_ValueError(MP_ERROR_TEXT("tuple/list has wrong length"));
#else
mp_raise_ValueError_varg(
MP_ERROR_TEXT("requested length %d but object has length %d"), (int)len, (int)seq_len);
#endif
}
} }
// is_slice determines whether the index is a slice index // is_slice determines whether the index is a slice index
@ -504,13 +497,7 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool
if (mp_obj_is_small_int(index)) { if (mp_obj_is_small_int(index)) {
i = MP_OBJ_SMALL_INT_VALUE(index); i = MP_OBJ_SMALL_INT_VALUE(index);
} else if (!mp_obj_get_int_maybe(index, &i)) { } else if (!mp_obj_get_int_maybe(index, &i)) {
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE mp_raise_TypeError_varg(translate("%q must be of type %q"), MP_QSTR_index, MP_QSTR_int);
mp_raise_TypeError(MP_ERROR_TEXT("indices must be integers"));
#else
mp_raise_TypeError_varg(
MP_ERROR_TEXT("%q indices must be integers, not %s"),
type->name, mp_obj_get_type_str(index));
#endif
} }
if (i < 0) { if (i < 0) {
@ -523,14 +510,7 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool
i = len; i = len;
} }
} else { } else {
if (i < 0 || (mp_uint_t)i >= len) { mp_arg_validate_index_range(i, 0, len - 1, MP_QSTR_index);
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
mp_raise_IndexError(MP_ERROR_TEXT("index out of range"));
#else
mp_raise_msg_varg(&mp_type_IndexError,
MP_ERROR_TEXT("%q index out of range"), type->name);
#endif
}
} }
// By this point 0 <= i <= len and so fits in a size_t // By this point 0 <= i <= len and so fits in a size_t

View File

@ -986,7 +986,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE #if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
terse_str_format_value_error(); terse_str_format_value_error();
#else #else
mp_raise_ValueError(MP_ERROR_TEXT("single '}' encountered in format string")); mp_raise_ValueError_varg(MP_ERROR_TEXT("unmatched '%c' in format"), '}');
#endif #endif
} }
if (*str != '{') { if (*str != '{') {
@ -1063,7 +1063,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE #if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
terse_str_format_value_error(); terse_str_format_value_error();
#else #else
mp_raise_ValueError(MP_ERROR_TEXT("unmatched '{' in format")); mp_raise_ValueError_varg(MP_ERROR_TEXT("unmatched '%c' in format"), '{');
#endif #endif
} }
if (*str != '}') { if (*str != '}') {

View File

@ -1181,9 +1181,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
mp_obj_t *bases_items; mp_obj_t *bases_items;
mp_obj_tuple_get(bases_tuple, &bases_len, &bases_items); mp_obj_tuple_get(bases_tuple, &bases_len, &bases_items);
for (size_t i = 0; i < bases_len; i++) { for (size_t i = 0; i < bases_len; i++) {
if (!mp_obj_is_type(bases_items[i], &mp_type_type)) { mp_arg_validate_type(bases_items[i], &mp_type_type, MP_QSTR___class__);
mp_raise_TypeError(MP_ERROR_TEXT("type is not an acceptable base type"));
}
mp_obj_type_t *t = MP_OBJ_TO_PTR(bases_items[i]); mp_obj_type_t *t = MP_OBJ_TO_PTR(bases_items[i]);
// TODO: Verify with CPy, tested on function type // TODO: Verify with CPy, tested on function type
if (t->make_new == NULL) { if (t->make_new == NULL) {

View File

@ -38,8 +38,6 @@
//| The `adafruit_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate //| The `adafruit_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate
//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel. //| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.
//| //|
//| Also available as ``_pixelbuf``. This usage has been deprecated.
//|
//| Byteorders are configured with strings, such as "RGB" or "RGBD".""" //| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
// TODO: Pull in docs from adafruit_pixelbuf. // TODO: Pull in docs from adafruit_pixelbuf.

View File

@ -91,9 +91,7 @@ extern const busio_uart_parity_obj_t busio_uart_parity_odd_obj;
#if CIRCUITPY_BUSIO_UART #if CIRCUITPY_BUSIO_UART
STATIC void validate_timeout(mp_float_t timeout) { STATIC void validate_timeout(mp_float_t timeout) {
if (timeout < (mp_float_t)0.0f || timeout > (mp_float_t)100.0f) { mp_arg_validate_int_range((int)timeout, 0, 100, MP_QSTR_timeout);
mp_raise_ValueError(translate("timeout must be 0.0-100.0 seconds"));
}
} }
#endif // CIRCUITPY_BUSIO_UART #endif // CIRCUITPY_BUSIO_UART

View File

@ -30,13 +30,14 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "shared/runtime/context_manager_helpers.h"
#include "py/objtuple.h"
#include "py/objlist.h"
#include "py/runtime.h"
#include "py/mperrno.h" #include "py/mperrno.h"
#include "py/objlist.h"
#include "py/objtuple.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "shared/netutils/netutils.h" #include "shared/netutils/netutils.h"
#include "shared/runtime/context_manager_helpers.h"
#include "shared/runtime/interrupt_char.h" #include "shared/runtime/interrupt_char.h"
//| class Socket: //| class Socket:
@ -422,6 +423,31 @@ STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(socketpool_socket_locals_dict, socketpool_socket_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(socketpool_socket_locals_dict, socketpool_socket_locals_dict_table);
STATIC mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
mp_uint_t flags = arg;
ret = 0;
if ((flags & MP_STREAM_POLL_RD) && common_hal_socketpool_readable(self) > 0) {
ret |= MP_STREAM_POLL_RD;
}
if ((flags & MP_STREAM_POLL_WR) && common_hal_socketpool_writable(self)) {
ret |= MP_STREAM_POLL_WR;
}
} else {
*errcode = MP_EINVAL;
ret = MP_STREAM_ERROR;
}
return ret;
}
STATIC const mp_stream_p_t socket_stream_p = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.ioctl = socket_ioctl,
.is_text = false,
};
const mp_obj_type_t socketpool_socket_type = { const mp_obj_type_t socketpool_socket_type = {
{ &mp_type_type }, { &mp_type_type },
.flags = MP_TYPE_FLAG_EXTENDED, .flags = MP_TYPE_FLAG_EXTENDED,
@ -429,5 +455,6 @@ const mp_obj_type_t socketpool_socket_type = {
.locals_dict = (mp_obj_dict_t *)&socketpool_socket_locals_dict, .locals_dict = (mp_obj_dict_t *)&socketpool_socket_locals_dict,
MP_TYPE_EXTENDED_FIELDS( MP_TYPE_EXTENDED_FIELDS(
.unary_op = mp_generic_unary_op, .unary_op = mp_generic_unary_op,
.protocol = &socket_stream_p,
) )
}; };

View File

@ -46,6 +46,8 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t *self, const
mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self, mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self,
const char *host, size_t hostlen, uint32_t port, const uint8_t *buf, uint32_t len); const char *host, size_t hostlen, uint32_t port, const uint8_t *buf, uint32_t len);
void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms); void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms);
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self);
bool common_hal_socketpool_writable(socketpool_socket_obj_t *self);
// Non-allocating versions for internal use. // Non-allocating versions for internal use.
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port); int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port);
@ -53,5 +55,4 @@ void socketpool_socket_close(socketpool_socket_obj_t *self);
int socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len); int socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len);
int socketpool_socket_recv_into(socketpool_socket_obj_t *self, int socketpool_socket_recv_into(socketpool_socket_obj_t *self,
const uint8_t *buf, uint32_t len); const uint8_t *buf, uint32_t len);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H

View File

@ -61,7 +61,7 @@
//| scroll_area: displayio.TileGrid, //| scroll_area: displayio.TileGrid,
//| font: fontio.BuiltinFont, //| font: fontio.BuiltinFont,
//| *, //| *,
//| status_bar: displayio.TileGrid = None //| status_bar: Optional[displayio.TileGrid] = None
//| ) -> None: //| ) -> None:
//| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be //| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be
//| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap.""" //| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap."""

View File

@ -159,10 +159,7 @@ STATIC mp_obj_t touchio_touchin_obj_set_threshold(mp_obj_t self_in, mp_obj_t thr
touchio_touchin_obj_t *self = MP_OBJ_TO_PTR(self_in); touchio_touchin_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self); check_for_deinit(self);
uint32_t new_threshold = mp_obj_get_int(threshold_obj); uint32_t new_threshold = mp_obj_get_int(threshold_obj);
if (new_threshold < 0 || new_threshold > UINT16_MAX) { mp_arg_validate_int_range(new_threshold, 0, UINT16_MAX, MP_QSTR_threshold);
// I would use MP_STRINGIFY(UINT16_MAX), but that prints "0xffff" instead of 65536.
mp_raise_ValueError(translate("threshold must be in the range 0-65536"));
}
common_hal_touchio_touchin_set_threshold(self, new_threshold); common_hal_touchio_touchin_set_threshold(self, new_threshold);
return mp_const_none; return mp_const_none;
} }

View File

@ -123,9 +123,7 @@ STATIC mp_obj_t usb_hid_enable(size_t n_args, const mp_obj_t *pos_args, mp_map_t
const mp_int_t len = mp_obj_get_int(mp_obj_len(devices)); const mp_int_t len = mp_obj_get_int(mp_obj_len(devices));
for (mp_int_t i = 0; i < len; i++) { for (mp_int_t i = 0; i < len; i++) {
mp_obj_t item = mp_obj_subscr(devices, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL); mp_obj_t item = mp_obj_subscr(devices, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL);
if (!mp_obj_is_type(item, &usb_hid_device_type)) { mp_arg_validate_type(item, &usb_hid_device_type, MP_QSTR___class__);
mp_raise_ValueError_varg(translate("non-Device in %q"), MP_QSTR_devices);
}
} }
uint8_t boot_device = uint8_t boot_device =

View File

@ -94,9 +94,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_obj_set_timeout(mp_obj_t self_in, mp_obj_
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in); watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_float_t timeout = mp_obj_get_float(timeout_obj); mp_float_t timeout = mp_obj_get_float(timeout_obj);
if (timeout <= 0) { mp_arg_validate_int_min((int)timeout, 0, MP_QSTR_timeout);
mp_raise_ValueError(translate("watchdog timeout must be greater than 0"));
}
common_hal_watchdog_set_timeout(self, timeout); common_hal_watchdog_set_timeout(self, timeout);
return mp_const_none; return mp_const_none;
@ -136,9 +134,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_obj_set_mode(mp_obj_t self_in, mp_obj_t m
// When setting the mode, the timeout value must be greater than zero // When setting the mode, the timeout value must be greater than zero
if (new_mode == WATCHDOGMODE_RESET || new_mode == WATCHDOGMODE_RAISE) { if (new_mode == WATCHDOGMODE_RESET || new_mode == WATCHDOGMODE_RAISE) {
if (current_timeout <= 0) { mp_arg_validate_int_min((int)current_timeout, 0, MP_QSTR_timeout);
mp_raise_ValueError(translate("WatchDogTimer.timeout must be greater than 0"));
}
} }
// Don't allow changing the mode once the watchdog timer has been started // Don't allow changing the mode once the watchdog timer has been started