summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml1
-rw-r--r--WEBUSB_README.md94
-rw-r--r--docs/index.rst1
-rw-r--r--locale/ID.po50
-rw-r--r--locale/circuitpython.pot40
-rw-r--r--locale/cs.po47
-rw-r--r--locale/de_DE.po108
-rw-r--r--locale/el.po47
-rw-r--r--locale/es.po76
-rw-r--r--locale/fil.po50
-rw-r--r--locale/fr.po56
-rw-r--r--locale/hi.po47
-rw-r--r--locale/it_IT.po50
-rw-r--r--locale/ja.po50
-rw-r--r--locale/ko.po47
-rw-r--r--locale/nl.po50
-rw-r--r--locale/pl.po58
-rw-r--r--locale/pt_BR.po60
-rw-r--r--locale/sv.po123
-rw-r--r--locale/zh_Latn_pinyin.po117
-rwxr-xr-xmain.c1
-rw-r--r--ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/dynalora_usb/board.c37
-rw-r--r--ports/atmel-samd/boards/dynalora_usb/mpconfigboard.h36
-rw-r--r--ports/atmel-samd/boards/dynalora_usb/mpconfigboard.mk39
-rw-r--r--ports/atmel-samd/boards/dynalora_usb/pins.c41
-rw-r--r--ports/atmel-samd/boards/seeeduino_xiao/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk11
-rw-r--r--ports/atmel-samd/common-hal/_pew/PewPew.c6
-rw-r--r--ports/atmel-samd/common-hal/_pew/PewPew.h1
-rw-r--r--ports/atmel-samd/common-hal/busio/I2C.c2
-rwxr-xr-xports/atmel-samd/common-hal/supervisor/Runtime.c4
-rwxr-xr-xports/cxd56/common-hal/supervisor/Runtime.c4
-rw-r--r--ports/esp32s2/Makefile4
-rw-r--r--ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk6
-rw-r--r--ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c106
-rw-r--r--ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c3
-rw-r--r--ports/esp32s2/common-hal/alarm/__init__.c8
-rw-r--r--ports/esp32s2/common-hal/audiobusio/I2SOut.c3
-rw-r--r--ports/esp32s2/common-hal/busio/I2C.c2
-rw-r--r--ports/esp32s2/common-hal/socketpool/Socket.c372
-rw-r--r--ports/esp32s2/common-hal/socketpool/Socket.h2
-rw-r--r--ports/esp32s2/common-hal/socketpool/SocketPool.c21
-rw-r--r--ports/esp32s2/common-hal/ssl/SSLContext.c25
-rw-r--r--ports/esp32s2/common-hal/ssl/SSLSocket.c176
-rw-r--r--ports/esp32s2/common-hal/ssl/SSLSocket.h44
-rw-r--r--ports/esp32s2/common-hal/supervisor/Runtime.c6
-rw-r--r--ports/esp32s2/mpconfigport.mk18
-rw-r--r--ports/litex/common-hal/supervisor/Runtime.c6
-rw-r--r--ports/mimxrt10xx/common-hal/busio/I2C.c2
-rw-r--r--ports/mimxrt10xx/common-hal/busio/SPI.c23
-rwxr-xr-xports/mimxrt10xx/common-hal/supervisor/Runtime.c4
-rw-r--r--ports/nrf/common-hal/busio/I2C.c2
-rw-r--r--ports/raspberrypi/Makefile2
-rw-r--r--ports/raspberrypi/background.c13
-rw-r--r--ports/raspberrypi/bindings/rp2pio/StateMachine.c2
-rw-r--r--ports/raspberrypi/boards/raspberry_pi_pico/pins.c3
-rw-r--r--ports/raspberrypi/bs2_default_padded_checksummed.S39
-rw-r--r--ports/raspberrypi/common-hal/busio/I2C.c2
-rw-r--r--ports/raspberrypi/common-hal/microcontroller/Processor.c10
-rw-r--r--ports/raspberrypi/common-hal/microcontroller/Processor.h4
-rw-r--r--ports/raspberrypi/common-hal/microcontroller/__init__.c13
-rw-r--r--ports/raspberrypi/common-hal/neopixel_write/__init__.c5
-rw-r--r--ports/raspberrypi/common-hal/pwmio/PWMOut.c4
-rw-r--r--ports/raspberrypi/common-hal/rp2pio/StateMachine.c26
-rwxr-xr-xports/raspberrypi/common-hal/supervisor/Runtime.c4
-rw-r--r--ports/raspberrypi/link.ld11
-rw-r--r--ports/raspberrypi/mpconfigport.mk2
m---------ports/raspberrypi/sdk0
-rw-r--r--ports/raspberrypi/supervisor/port.c12
-rwxr-xr-xports/stm/common-hal/supervisor/Runtime.c6
-rw-r--r--py/circuitpy_defns.mk4
-rw-r--r--py/circuitpy_mpconfig.mk5
-rw-r--r--shared-bindings/_pew/__init__.c8
-rw-r--r--shared-bindings/adafruit_bus_device/I2CDevice.c23
-rw-r--r--shared-bindings/adafruit_bus_device/SPIDevice.c34
-rw-r--r--shared-bindings/adafruit_bus_device/SPIDevice.h3
-rw-r--r--shared-bindings/sdcardio/SDCard.c6
-rw-r--r--shared-bindings/socketpool/Socket.c222
-rw-r--r--shared-bindings/socketpool/Socket.h26
-rw-r--r--shared-bindings/socketpool/SocketPool.c3
-rw-r--r--shared-bindings/ssl/SSLContext.c2
-rw-r--r--shared-bindings/ssl/SSLContext.h3
-rw-r--r--shared-bindings/ssl/SSLSocket.c326
-rw-r--r--shared-bindings/ssl/SSLSocket.h45
-rwxr-xr-xshared-bindings/supervisor/Runtime.c70
-rw-r--r--shared-module/adafruit_bus_device/SPIDevice.c7
-rw-r--r--supervisor/shared/background_callback.c3
-rw-r--r--supervisor/shared/serial.c30
-rw-r--r--supervisor/shared/usb/tusb_config.h1
-rw-r--r--supervisor/shared/usb/usb.c76
-rw-r--r--supervisor/shared/usb/usb_desc.c2
-rw-r--r--supervisor/supervisor.mk26
-rw-r--r--supervisor/usb.h3
-rw-r--r--tools/gen_display_resources.py4
-rw-r--r--tools/gen_usb_descriptor.py332
96 files changed, 2508 insertions, 1103 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 34e0b0821..adba66314 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -208,6 +208,7 @@ jobs:
- "datum_imu"
- "datum_light"
- "datum_weather"
+ - "dynalora_usb"
- "dynossat_edu_eps"
- "dynossat_edu_obc"
- "electronut_labs_blip"
diff --git a/WEBUSB_README.md b/WEBUSB_README.md
new file mode 100644
index 000000000..a257d5259
--- /dev/null
+++ b/WEBUSB_README.md
@@ -0,0 +1,94 @@
+<!--
+SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
+
+SPDX-License-Identifier: MIT
+-->
+
+# WebUSB Serial Support
+
+To date, this has only been tested on one port (esp32s2), on one board (espressif_kaluga_1).
+
+## What it does
+
+If you have ever used CircuitPython on a platform with a graphical LCD display, you have probably
+already seen multiple "consoles" in use (although the LCD console is "output only").
+
+New compile-time option CIRCUITPY_USB_VENDOR enables an additional "console" that can be used in
+parallel with the original (CDC) serial console.
+
+Web pages that support the WebUSB standard can connect to the "vendor" interface and activate
+this WebUSB serial console at any time.
+
+You can type into either console, and CircuitPython output is sent to all active consoles.
+
+One example of a web page you can use to test drive this feature can be found at:
+
+https://adafruit.github.io/Adafruit_TinyUSB_Arduino/examples/webusb-serial/index.html
+
+## How to enable
+
+Update your platform's mpconfigboard.mk file to enable and disable specific types of USB interfaces.
+
+CIRCUITPY_USB_HID = xxx
+CIRCUITPY_USB_MIDI = xxx
+CIRCUITPY_USB_VENDOR = xxx
+
+On at least some of the hardware platforms, the maximum number of USB endpoints is fixed.
+For example, on the ESP32S2, you must pick only one of the above 3 interfaces to be enabled.
+
+Original espressif_kaluga_1 mpconfigboard.mk settings:
+
+CIRCUITPY_USB_HID = 1
+CIRCUITPY_USB_MIDI = 0
+CIRCUITPY_USB_VENDOR = 0
+
+Settings to enable WebUSB instead:
+
+CIRCUITPY_USB_HID = 0
+CIRCUITPY_USB_MIDI = 0
+CIRCUITPY_USB_VENDOR = 1
+
+Notice that to enable VENDOR on ESP32-S2, we had to give up HID. There may be platforms that can have both, or even all three.
+
+## Implementation Notes
+
+CircuitPython uses the tinyusb library.
+
+The tinyusb library already has support for WebUSB serial.
+The tinyusb examples already include a "WebUSB serial" example.
+
+ Sidenote - The use of the term "vendor" instead of "WebUSB" was done to match tinyusb.
+
+Basically, this feature was ported into CircuitPython by pulling code snippets out of the
+tinyusb example, and putting them where they best belonged in the CircuitPython codebase.
+
+There was one complication:
+
+tinyusb uses C preprocessor macros to define things like USB descriptors.
+
+CircuitPython uses a Python program (tools/gen_usb_descriptor.py) to create USB descriptors (etc.)
+using "helper objects" from another repo (adafruit_usb_descriptor). This means some of the example
+code had to be adapted to the new programing model, and gen_usb_descriptor gained new command-line
+options to control the generated code.
+
+The generated files go into the "build" directory, look for autogen_usb_descriptor.c and
+genhdr/autogen_usb_descriptor.h.
+
+
+Also worth pointing out - the re-use of the CDC connect/disconnect mechanism is not actually part
+of the WebUSB standard, it's more of "common idiom". We make use of it here because we need to know
+when we should be paying attention to the WebUSB serial interface, and when we should ignore it..
+
+## Possible future work areas
+
+The current code uses the existing Python infrastructure to create the Interface descriptor, but
+simply outputs the code snippets from the original tinyusb demo code to create the WEBUSB_URL,
+BOS, and MS_OS_20 descriptors. I suppose additional work could be done to add these to the
+adafruit_usb_descriptor project, and then gen_usb_descriptor.py could be modified to make use
+of them.
+
+Program gen_usb_descriptor.py creates objects for most interface types, regardless of whether or
+not they are actually enabled. This increases the size of a generated string table. I made the
+new vendor-interface-related code not do this (because some of the ARM platforms would no longer
+build), but I did not go back and do this for the other interface types (CDC, MIDI, HID, etc.)
+Some FLASH savings are probably possible if this is done.
diff --git a/docs/index.rst b/docs/index.rst
index 6dadddfc1..3ee76fdd8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -46,6 +46,7 @@ Full Table of Contents
../BUILDING
../CODE_OF_CONDUCT
../license.rst
+ ../WEBUSB_README
Indices and tables
==================
diff --git a/locale/ID.po b/locale/ID.po
index 3e0762069..d2d1cc9ad 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -642,6 +642,10 @@ msgstr ""
"Tidak dapat melakukan reset ke bootloader karena tidak ada bootloader yang "
"terisi"
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Tidak dapat menetapkan nilai saat arah input."
@@ -884,7 +888,7 @@ msgstr "Channel EXTINT sedang digunakan"
msgid "Error in regex"
msgstr "Error pada regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -943,7 +947,7 @@ msgstr "FFT didefinisikan hanya untuk ndarrays"
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1316,7 +1320,7 @@ msgstr "security_mode tidak valid"
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1324,10 +1328,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Suara tidak valid"
@@ -1344,10 +1344,6 @@ msgstr "File wave tidak valid"
msgid "Invalid word/bit length"
msgstr "Panjang kata/bit tidak valid"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "Panjang kunci harus 16, 24, atau 32 byte"
@@ -1560,6 +1556,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Tidak ada pull-down pada pin; 1Mohm direkomendasikan"
@@ -1674,7 +1676,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1825,6 +1827,10 @@ msgstr "Kesalahan DeInit RNG"
msgid "RNG Init Error"
msgstr "Kesalahan Init RNG"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1832,6 +1838,7 @@ msgstr "Pembalikan RS485 ditentukan saat tidak dalam mode RS485"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "Kalibrasi RTC tidak didukung pada board ini"
@@ -1840,7 +1847,7 @@ msgid "RTC is not supported on this board"
msgstr "RTC tidak didukung di board ini"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS/CTS/RS485 Belum didukung pada perangkat ini"
@@ -1898,12 +1905,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA atau SCL membutuhkan pull up"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2203,7 +2204,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "Tipe urf nrfx tak sesuai"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2512,7 +2513,7 @@ msgstr ""
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3673,6 +3674,10 @@ msgstr "Muncul dari PulseIn yang kosong"
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
@@ -4202,6 +4207,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA atau SCL membutuhkan pull up"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr "pin alamat %d dan pin rgb %d menunjukkan tinggi %d, bukan %d"
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 0fd758e97..035941ff5 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -629,6 +629,10 @@ msgstr ""
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr ""
@@ -865,7 +869,7 @@ msgstr ""
msgid "Error in regex"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -924,7 +928,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1295,7 +1299,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1303,10 +1307,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1323,10 +1323,6 @@ msgstr ""
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1539,6 +1535,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1647,7 +1649,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1870,12 +1872,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr ""
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2167,7 +2163,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2466,7 +2462,7 @@ msgstr ""
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3626,6 +3622,10 @@ msgstr ""
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
diff --git a/locale/cs.po b/locale/cs.po
index e6ad0a83f..b71c491c3 100644
--- a/locale/cs.po
+++ b/locale/cs.po
@@ -632,6 +632,10 @@ msgstr ""
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr ""
@@ -868,7 +872,7 @@ msgstr ""
msgid "Error in regex"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -927,7 +931,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1298,7 +1302,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1306,10 +1310,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1326,10 +1326,6 @@ msgstr ""
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1542,6 +1538,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1650,7 +1652,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1796,6 +1798,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1803,6 +1809,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr ""
@@ -1811,7 +1818,7 @@ msgid "RTC is not supported on this board"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1868,12 +1875,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr ""
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2165,7 +2166,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2464,7 +2465,7 @@ msgstr ""
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3624,6 +3625,10 @@ msgstr ""
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index e23f27bfe..caaa28ced 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -6,14 +6,14 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
-"PO-Revision-Date: 2021-01-07 18:01+0000\n"
-"Last-Translator: Dennis Schweer <dennis.schweer@ruhr-uni-bochum.de>\n"
+"PO-Revision-Date: 2021-02-05 15:41+0000\n"
+"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.4.1-dev\n"
+"X-Generator: Weblate 4.5-dev\n"
#: main.c
msgid ""
@@ -120,7 +120,8 @@ msgstr "%q sollte ein integer sein"
#: py/bc.c py/objnamedtuple.c
msgid "%q() takes %d positional arguments but %d were given"
-msgstr "%q() nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben"
+msgstr ""
+"%q() nimmt %d Argumente ohne Schlüsselwort an, aber es wurden %d angegeben"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
#, c-format
@@ -235,7 +236,7 @@ msgstr "'await' außerhalb einer Funktion"
#: py/compile.c
msgid "'await', 'async for' or 'async with' outside async function"
-msgstr ""
+msgstr "'await', 'async for' oder 'async with' außerhalb einer async Funktion"
#: py/compile.c
msgid "'break' outside loop"
@@ -267,7 +268,7 @@ msgstr "'return' außerhalb einer Funktion"
#: py/compile.c
msgid "'yield from' inside async function"
-msgstr ""
+msgstr "'yield from' innerhalb einer async Funktion"
#: py/compile.c
msgid "'yield' outside function"
@@ -313,7 +314,7 @@ msgstr "Adresstyp außerhalb des zulässigen Bereichs"
#: ports/esp32s2/common-hal/canio/CAN.c
msgid "All CAN peripherals are in use"
-msgstr ""
+msgstr "Alle CAN Schnittstellen sind in Benutzung"
#: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
msgid "All I2C peripherals are in use"
@@ -329,7 +330,7 @@ msgstr "Alle PCNT Einheiten sind in Benutzung"
#: ports/esp32s2/common-hal/canio/Listener.c
#: ports/stm/common-hal/canio/Listener.c
msgid "All RX FIFOs in use"
-msgstr ""
+msgstr "Alle RX FIFOs sind in Benutzung"
#: ports/esp32s2/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c
msgid "All SPI peripherals are in use"
@@ -541,7 +542,7 @@ msgstr "Puffer zu groß und kann nicht reserviert werden"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
-msgstr "Buffer um %d Bytes zu kurz"
+msgstr "Puffer um %d Bytes zu kurz"
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
@@ -638,6 +639,10 @@ msgstr "Kann '/' nicht remounten when USB aktiv ist."
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "Reset zum bootloader nicht möglich da bootloader nicht vorhanden."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Der Wert kann nicht gesetzt werden, wenn die Richtung input ist."
@@ -691,7 +696,7 @@ msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
-msgstr ""
+msgstr "CircuitPython war es nicht möglich heap-Speicher zu allozieren.\n"
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
@@ -769,7 +774,7 @@ msgstr "PWM konnte nicht neu gestartet werden"
#: ports/esp32s2/common-hal/neopixel_write/__init__.c
msgid "Could not retrieve clock"
-msgstr ""
+msgstr "Clock konnte nicht ermittelt werden"
#: shared-bindings/_bleio/Adapter.c
msgid "Could not set address"
@@ -807,7 +812,7 @@ msgstr "Absturz in den HardFault_Handler."
#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
-msgstr "DAC Kanal Intialisierungs Fehler"
+msgstr "DAC Kanal Initialisierungsfehler"
#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
@@ -880,7 +885,7 @@ msgstr "EXTINT Kanal ist schon in Benutzung"
msgid "Error in regex"
msgstr "Fehler in regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -940,7 +945,7 @@ msgstr "FFT ist nur für ndarrays definiert"
msgid "FFT is implemented for linear arrays only"
msgstr "FFT ist nur für lineare Arrays implementiert"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "SSL Handshake fehlgeschlagen"
@@ -973,7 +978,7 @@ msgstr "Zuweisung des Wifi Speichers ist fehlgeschlagen"
#: ports/esp32s2/common-hal/wifi/ScannedNetworks.c
msgid "Failed to allocate wifi scan memory"
-msgstr ""
+msgstr "Zuweisung des Wifi Scan Speichers ist fehlgeschlagen"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Failed to connect: internal error"
@@ -989,7 +994,7 @@ msgstr "Wifi Initialisierung ist fehlgeschlagen"
#: shared-module/audiomp3/MP3Decoder.c
msgid "Failed to parse MP3 file"
-msgstr "Parsen der MP3 Datei fehlgeschlagen"
+msgstr "MP3-Datei konnte nicht analysiert werden"
#: ports/nrf/sd_mutex.c
#, c-format
@@ -1012,7 +1017,7 @@ msgstr "Filter zu komplex"
#: ports/esp32s2/common-hal/dualbank/__init__.c
msgid "Firmware image is invalid"
-msgstr ""
+msgstr "Firmware Image ist ungültig"
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Format not supported"
@@ -1315,7 +1320,7 @@ msgstr "Ungültiger security_mode"
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1323,10 +1328,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Ungültige Stimme"
@@ -1343,10 +1344,6 @@ msgstr "Ungültige wave Datei"
msgid "Invalid word/bit length"
msgstr "Ungültige Wort- / Bitlänge"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "Der Schlüssel muss 16, 24 oder 32 Byte lang sein"
@@ -1561,6 +1558,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Kein Pulldown Widerstand am Pin; 1Mohm wird vorgeschlagen"
@@ -1675,7 +1678,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1824,6 +1827,10 @@ msgstr "RNG DeInit-Fehler"
msgid "RNG Init Error"
msgstr "RNG Init Fehler"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1831,6 +1838,7 @@ msgstr "RS485-Inversion angegeben, wenn nicht im RS485-Modus"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "Die RTC-Kalibrierung wird auf diesem Board nicht unterstützt"
@@ -1839,7 +1847,7 @@ msgid "RTC is not supported on this board"
msgstr "Eine RTC wird auf diesem Board nicht unterstützt"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS / CTS / RS485 Wird von diesem Gerät noch nicht unterstützt"
@@ -1896,12 +1904,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA oder SCL brauchen pull up"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2207,7 +2209,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "Unerwarteter nrfx uuid-Typ"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2521,7 +2523,7 @@ msgstr "Puffersegmente müssen gleich lang sein"
msgid "buffer too small"
msgstr "Der Puffer ist zu klein"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -2902,7 +2904,7 @@ msgstr "erwarte tuple/list"
#: py/modthread.c
msgid "expecting a dict for keyword args"
-msgstr "erwarte ein dict als Keyword-Argumente"
+msgstr "erwarte ein dict als Schlüsselwort-Argumente"
#: py/compile.c
msgid "expecting an assembler instruction"
@@ -2922,11 +2924,11 @@ msgstr ""
#: py/argcheck.c
msgid "extra keyword arguments given"
-msgstr "Es wurden zusätzliche Keyword-Argumente angegeben"
+msgstr "Es wurden zusätzliche Schlüsselwort-Argumente angegeben"
#: py/argcheck.c
msgid "extra positional arguments given"
-msgstr "Es wurden zusätzliche Argumente ohne Keyword angegeben"
+msgstr "Es wurden zusätzliche Argumente ohne Schlüsselwort angegeben"
#: py/parse.c
msgid "f-string expression part cannot include a '#'"
@@ -3007,7 +3009,7 @@ msgstr "voll"
#: py/argcheck.c
msgid "function does not take keyword arguments"
-msgstr "Funktion akzeptiert keine Keyword-Argumente"
+msgstr "Funktion akzeptiert keine Schlüsselwort-Argumente"
#: py/argcheck.c
#, c-format
@@ -3029,26 +3031,27 @@ msgstr ""
#: py/argcheck.c
#, c-format
msgid "function missing %d required positional arguments"
-msgstr "Funktion vermisst %d benötigte Argumente ohne Keyword"
+msgstr "Funktion vermisst %d benötigte Argumente ohne Schlüsselwort"
#: py/bc.c
msgid "function missing keyword-only argument"
-msgstr "Funktion vermisst Keyword-only-Argument"
+msgstr "Funktion vermisst Nur-Schlüsselwort-Argument"
#: py/bc.c
msgid "function missing required keyword argument '%q'"
-msgstr "Funktion vermisst benötigtes Keyword-Argumente '%q'"
+msgstr "Funktion vermisst benötigtes Schlüsselwort-Argumente '%q'"
#: py/bc.c
#, c-format
msgid "function missing required positional argument #%d"
-msgstr "Funktion vermisst benötigtes Argumente ohne Keyword #%d"
+msgstr "Funktion vermisst benötigtes Argumente ohne Schlüsselwort #%d"
#: py/argcheck.c py/bc.c py/objnamedtuple.c shared-bindings/time/__init__.c
#, c-format
msgid "function takes %d positional arguments but %d were given"
msgstr ""
-"Funktion nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben"
+"Funktion nimmt %d Argumente ohne Schlüsselwort an, aber es wurden %d "
+"angegeben"
#: shared-bindings/time/__init__.c
msgid "function takes exactly 9 arguments"
@@ -3278,8 +3281,8 @@ msgstr ""
#: py/argcheck.c
msgid "keyword argument(s) not yet implemented - use normal args instead"
msgstr ""
-"Keyword-Argument(e) noch nicht implementiert - verwenden Sie stattdessen "
-"normale Argumente"
+"Schlüsselwort-Argument(e) noch nicht implementiert - verwenden Sie "
+"stattdessen normale Argumente"
#: py/bc.c
msgid "keywords must be strings"
@@ -3704,6 +3707,10 @@ msgstr "pop von einem leeren PulseIn"
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "pow() drittes Argument darf nicht 0 sein"
@@ -4069,11 +4076,11 @@ msgstr ""
#: py/bc.c
msgid "unexpected keyword argument"
-msgstr "unerwartetes Keyword-Argument"
+msgstr "unerwartetes Schlüsselwort-Argument"
#: py/bc.c py/objnamedtuple.c
msgid "unexpected keyword argument '%q'"
-msgstr "unerwartetes Keyword-Argument '%q'"
+msgstr "unerwartetes Schlüsselwort-Argument '%q'"
#: py/lexer.c
msgid "unicode name escapes"
@@ -4239,6 +4246,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA oder SCL brauchen pull up"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr ""
#~ "%d Adress-Pins und %d rgb-Pins zeigen eine Höhe von %d, nicht von %d"
diff --git a/locale/el.po b/locale/el.po
index 0c7cb5f6b..bf03a5d82 100644
--- a/locale/el.po
+++ b/locale/el.po
@@ -629,6 +629,10 @@ msgstr ""
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr ""
@@ -865,7 +869,7 @@ msgstr ""
msgid "Error in regex"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -924,7 +928,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1295,7 +1299,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1303,10 +1307,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1323,10 +1323,6 @@ msgstr ""
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1539,6 +1535,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1647,7 +1649,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1793,6 +1795,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1800,6 +1806,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr ""
@@ -1808,7 +1815,7 @@ msgid "RTC is not supported on this board"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1865,12 +1872,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr ""
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2162,7 +2163,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2461,7 +2462,7 @@ msgstr ""
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3621,6 +3622,10 @@ msgstr ""
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
diff --git a/locale/es.po b/locale/es.po
index b446ceb48..fbde0ce37 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -8,27 +8,31 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
-"PO-Revision-Date: 2020-12-30 22:25+0000\n"
-"Last-Translator: Hugo Dahl <hugo@code-jedi.com>\n"
+"PO-Revision-Date: 2021-02-08 21:21+0000\n"
+"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.4.1-dev\n"
+"X-Generator: Weblate 4.5-dev\n"
#: main.c
msgid ""
"\n"
"Code done running.\n"
msgstr ""
+"\n"
+"El código terminó de ejecutar.\n"
#: main.c
msgid ""
"\n"
"Code stopped by auto-reload.\n"
msgstr ""
+"\n"
+"El código fue detenido por el auto-reiniciado.\n"
#: supervisor/shared/safe_mode.c
msgid ""
@@ -50,7 +54,7 @@ msgstr " Archivo \"%q\", línea %d"
#: py/builtinhelp.c
msgid " is of type %q\n"
-msgstr ""
+msgstr " es de tipo %q\n"
#: main.c
msgid " output:\n"
@@ -126,7 +130,7 @@ msgstr "%q() toma %d argumentos posicionales pero %d fueron dados"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
#, c-format
msgid "%s error 0x%x"
-msgstr ""
+msgstr "%s error 0x%x"
#: py/argcheck.c
msgid "'%q' argument required"
@@ -292,7 +296,7 @@ msgstr "pow() con 3 argumentos no soportado"
#: shared-module/msgpack/__init__.c
msgid "64 bit types"
-msgstr ""
+msgstr "tipos de 64 bit"
#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
@@ -346,7 +350,7 @@ msgstr "Todos los canales de eventos estan siendo usados"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "All state machines in use"
-msgstr ""
+msgstr "Todas las máquinas de estado en uso"
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "All sync event channels in use"
@@ -567,7 +571,7 @@ msgstr "Los bloques CBC deben ser múltiplos de 16 bytes"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "CRC or checksum was invalid"
-msgstr ""
+msgstr "CRC o suma de comprobación inválida"
#: py/objtype.c
msgid "Call super().__init__() before accessing native object."
@@ -642,6 +646,10 @@ msgstr "No se puede volver a montar '/' cuando el USB esta activo."
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "No se puede reiniciar a bootloader porque no hay bootloader presente."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr "No se pueden definir opciones para enchufe"
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "No se puede asignar un valor cuando la dirección es input."
@@ -882,7 +890,7 @@ msgstr "El canal EXTINT ya está siendo utilizado"
msgid "Error in regex"
msgstr "Error en regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -941,7 +949,7 @@ msgstr "FFT se define solo para ndarrays"
msgid "FFT is implemented for linear arrays only"
msgstr "FFT solo esta implementado para arrays lineales"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "Fallo en saludo SSL"
@@ -1013,7 +1021,7 @@ msgstr "Filtros muy complejos"
#: ports/esp32s2/common-hal/dualbank/__init__.c
msgid "Firmware image is invalid"
-msgstr ""
+msgstr "La imagen de firmware es inválida"
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Format not supported"
@@ -1036,7 +1044,7 @@ msgstr "La función requiere lock"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Generic Failure"
-msgstr ""
+msgstr "Fallo Genérico"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
@@ -1072,7 +1080,7 @@ msgstr "I2C Error de inicio"
#: ports/raspberrypi/common-hal/busio/I2C.c
msgid "I2C peripheral in use"
-msgstr ""
+msgstr "Dispositivo I2C en uso"
#: shared-bindings/audiobusio/I2SOut.c
msgid "I2SOut not available"
@@ -1315,7 +1323,7 @@ msgstr "'security_mode' no válido"
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1323,10 +1331,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Voz inválida"
@@ -1343,10 +1347,6 @@ msgstr "Archivo wave inválido"
msgid "Invalid word/bit length"
msgstr "Tamaño no válido de palabra/bit"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "La llave debe tener 16, 24 o 32 bytes de longitud"
@@ -1559,6 +1559,12 @@ msgstr "No hay una red con ese ssid"
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "No hay pulldown en el pin; 1Mohm recomendado"
@@ -1673,7 +1679,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "Se acabaron los enchufes"
@@ -1828,6 +1834,10 @@ msgstr "Error de desinicialización de RNG"
msgid "RNG Init Error"
msgstr "Error de inicialización de RNG"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1835,6 +1845,7 @@ msgstr "Se especifica inversión de RS485 si no está en modo RS485"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "Calibración de RTC no es soportada en esta placa"
@@ -1843,7 +1854,7 @@ msgid "RTC is not supported on this board"
msgstr "RTC no soportado en esta placa"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "Sin capacidad de RTS/CTS/RS485 para este dispositivo"
@@ -1900,12 +1911,6 @@ msgstr "¡Corriendo en modo seguro! "
msgid "SD card CSD format not supported"
msgstr "Sin capacidad para formato CSD para tarjeta SD"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA o SCL necesitan una pull up"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2211,7 +2216,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "Tipo de uuid nrfx inesperado"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr "Error no manejado de ESP TLS %d %d %x %d"
@@ -2521,7 +2526,7 @@ msgstr "Las secciones del buffer necesitan tener longitud igual"
msgid "buffer too small"
msgstr "buffer demasiado pequeño"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr "búfer muy pequeño para los bytes solicitados"
@@ -3694,6 +3699,10 @@ msgstr "pop de un PulseIn vacío"
msgid "pop from empty %q"
msgstr "pop desde %q vacía"
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "el 3er argumento de pow() no puede ser 0"
@@ -4225,6 +4234,9 @@ msgstr "zi debe ser de tipo flotante"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi debe ser una forma (n_section,2)"
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA o SCL necesitan una pull up"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr ""
#~ "%d pines de dirección y %d pines rgb indican una altura de %d, no de %d"
diff --git a/locale/fil.po b/locale/fil.po
index bba9761ad..b030bd5c8 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -636,6 +636,10 @@ msgstr "Hindi ma-remount '/' kapag aktibo ang USB."
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "Hindi ma-reset sa bootloader dahil walang bootloader."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Hindi ma i-set ang value kapag ang direksyon ay input."
@@ -876,7 +880,7 @@ msgstr "Ginagamit na ang EXTINT channel"
msgid "Error in regex"
msgstr "May pagkakamali sa REGEX"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -937,7 +941,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1310,7 +1314,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1318,10 +1322,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1338,10 +1338,6 @@ msgstr "May hindi tama sa wave file"
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1554,6 +1550,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1665,7 +1667,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1812,6 +1814,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1819,6 +1825,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "RTC calibration ay hindi supportado ng board na ito"
@@ -1827,7 +1834,7 @@ msgid "RTC is not supported on this board"
msgstr "Hindi supportado ang RTC sa board na ito"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1885,12 +1892,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "Kailangan ng pull up resistors ang SDA o SCL"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2183,7 +2184,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "hindi inaasahang indent"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2492,7 +2493,7 @@ msgstr "aarehas na haba dapat ang buffer slices"
msgid "buffer too small"
msgstr "masyadong maliit ang buffer"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3670,6 +3671,10 @@ msgstr "pop mula sa walang laman na PulseIn"
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "pow() 3rd argument ay hindi maaring 0"
@@ -4204,6 +4209,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "Kailangan ng pull up resistors ang SDA o SCL"
+
#~ msgid "tuple index out of range"
#~ msgstr "indeks ng tuple wala sa sakop"
diff --git a/locale/fr.po b/locale/fr.po
index 83af1f9f7..ed7c12486 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -654,6 +654,10 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
"Ne peut être redémarré vers le bootloader car il n'y a pas de bootloader."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr ""
@@ -897,7 +901,7 @@ msgstr "Canal EXTINT déjà utilisé"
msgid "Error in regex"
msgstr "Erreur dans l'expression régulière"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr "Erreur : Impossible de lier"
@@ -957,7 +961,7 @@ msgstr "La FFT est définie uniquement pour les ndarrays"
msgid "FFT is implemented for linear arrays only"
msgstr "FFT n'est implémenté que pour les tableaux linéaires"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "Échec du handshake SSL"
@@ -1332,7 +1336,7 @@ msgstr "'security_mode' invalide"
msgid "Invalid size"
msgstr "Taille invalide"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr "Socket non valide pour TLS"
@@ -1340,10 +1344,6 @@ msgstr "Socket non valide pour TLS"
msgid "Invalid state"
msgstr "État invalide"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr "Utilisation incorrecte de socket TLS"
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Voix invalide"
@@ -1360,10 +1360,6 @@ msgstr "Fichier WAVE invalide"
msgid "Invalid word/bit length"
msgstr "Longueur de mot / bit invalide"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr "Problème en activant SO_REUSEADDR"
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "La clé doit comporter 16, 24 ou 32 octets"
@@ -1576,6 +1572,12 @@ msgstr "Aucun réseau avec ce ssid"
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Pas de pulldown sur la broche ; 1Mohm recommandé"
@@ -1690,7 +1692,7 @@ msgstr "Timeout de l'opération"
msgid "Out of memory"
msgstr "Hors de mémoire"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "Plus de sockets"
@@ -1850,6 +1852,10 @@ msgstr "Erreur de désinitiation du RNG (RNG DeInit)"
msgid "RNG Init Error"
msgstr "Erreur d'initialisation du RNG (RNG Init)"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1857,6 +1863,7 @@ msgstr "Inversion RS485 spécifiée sans être en mode RS485"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "La calibration du RTC non supportée sur cette carte"
@@ -1865,7 +1872,7 @@ msgid "RTC is not supported on this board"
msgstr "RTC non supporté sur cette carte"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS / CTS / RS485 Pas encore supporté sur cet appareil"
@@ -1922,12 +1929,6 @@ msgstr "Exécution en mode sécurisé! "
msgid "SD card CSD format not supported"
msgstr "Le format de carte SD CSD n'est pas supporté"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA ou SCL a besoin d'une résistance de tirage ('pull up')"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2234,7 +2235,7 @@ msgstr "Écriture impossible vers sleep_memory."
msgid "Unexpected nrfx uuid type"
msgstr "Type inattendu pour l'uuid nrfx"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr "Erreur ESP TLS non gérée %d %d %x %d"
@@ -2546,7 +2547,7 @@ msgstr "les tranches de tampon doivent être de longueurs égales"
msgid "buffer too small"
msgstr "tampon trop petit"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr "tampon trop petit pour le nombre d'octets demandé"
@@ -3731,6 +3732,10 @@ msgstr "'pop' d'une entrée PulseIn vide"
msgid "pop from empty %q"
msgstr "pop sur %q vide"
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "le 3e argument de pow() ne peut être 0"
@@ -4262,6 +4267,15 @@ msgstr "zi doit être de type float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi doit être de forme (n_section, 2)"
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA ou SCL a besoin d'une résistance de tirage ('pull up')"
+
+#~ msgid "Invalid use of TLS Socket"
+#~ msgstr "Utilisation incorrecte de socket TLS"
+
+#~ msgid "Issue setting SO_REUSEADDR"
+#~ msgstr "Problème en activant SO_REUSEADDR"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr ""
#~ "Les broches d'adresse %d et les broches RVB %d indiquent une hauteur de "
diff --git a/locale/hi.po b/locale/hi.po
index 5150d164e..fa57c47e5 100644
--- a/locale/hi.po
+++ b/locale/hi.po
@@ -629,6 +629,10 @@ msgstr ""
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr ""
@@ -865,7 +869,7 @@ msgstr ""
msgid "Error in regex"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -924,7 +928,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1295,7 +1299,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1303,10 +1307,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1323,10 +1323,6 @@ msgstr ""
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1539,6 +1535,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1647,7 +1649,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1793,6 +1795,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1800,6 +1806,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr ""
@@ -1808,7 +1815,7 @@ msgid "RTC is not supported on this board"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1865,12 +1872,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr ""
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2162,7 +2163,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2461,7 +2462,7 @@ msgstr ""
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3621,6 +3622,10 @@ msgstr ""
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
diff --git a/locale/it_IT.po b/locale/it_IT.po
index cecfe1129..561f9fb08 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -637,6 +637,10 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
"Impossibile resettare nel bootloader poiché nessun bootloader è presente."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "non si può impostare un valore quando direzione è input"
@@ -876,7 +880,7 @@ msgstr "Canale EXTINT già in uso"
msgid "Error in regex"
msgstr "Errore nella regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -937,7 +941,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1312,7 +1316,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1320,10 +1324,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1341,10 +1341,6 @@ msgstr "File wave non valido"
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1558,6 +1554,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1670,7 +1672,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1822,6 +1824,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1829,6 +1835,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "calibrazione RTC non supportata su questa scheda"
@@ -1837,7 +1844,7 @@ msgid "RTC is not supported on this board"
msgstr "RTC non supportato su questa scheda"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1895,12 +1902,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA o SCL necessitano un pull-up"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2195,7 +2196,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "indentazione inaspettata"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2498,7 +2499,7 @@ msgstr "slice del buffer devono essere della stessa lunghezza"
msgid "buffer too small"
msgstr "buffer troppo piccolo"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3678,6 +3679,10 @@ msgstr "pop sun un PulseIn vuoto"
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "il terzo argomento di pow() non può essere 0"
@@ -4212,6 +4217,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA o SCL necessitano un pull-up"
+
#~ msgid "tuple index out of range"
#~ msgstr "indice della tupla fuori intervallo"
diff --git a/locale/ja.po b/locale/ja.po
index c139ec3cc..c58264a7d 100644
--- a/locale/ja.po
+++ b/locale/ja.po
@@ -638,6 +638,10 @@ msgstr "USBがアクティブの時に'/'を再マウントできません"
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "ブートローダが存在しないためブートローダへとリセットできません"
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "方向がinputのときは値を設定できません"
@@ -876,7 +880,7 @@ msgstr "EXTINTチャネルはすでに使用されています"
msgid "Error in regex"
msgstr "正規表現にエラーがあります"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -935,7 +939,7 @@ msgstr "FFTはndarrayでのみ使えます"
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1308,7 +1312,7 @@ msgstr "不正なsecurity_mode"
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1316,10 +1320,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "不正なボイス"
@@ -1336,10 +1336,6 @@ msgstr "不正なwaveファイル"
msgid "Invalid word/bit length"
msgstr "不正なワード/ビット長"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "Keyの長さは、16, 24, 32バイトのいずれかでなければなりません"
@@ -1552,6 +1548,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "ピンにプルダウンがありません。1Mオーム推奨"
@@ -1662,7 +1664,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1809,6 +1811,10 @@ msgstr "RNG解体エラー"
msgid "RNG Init Error"
msgstr "乱数生成器の初期化エラー"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1816,6 +1822,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "このボードはRTCのキャリブレーションに非対応"
@@ -1824,7 +1831,7 @@ msgid "RTC is not supported on this board"
msgstr "このボードはRTCに対応していません"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS/CTS/RS485はこのデバイスでは未対応"
@@ -1881,12 +1888,6 @@ msgstr "セーフモードで実行中! "
msgid "SD card CSD format not supported"
msgstr "SDカードのCSDフォーマットは非対応"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDAとSCLにプルアップが必要"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2185,7 +2186,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "想定されていないnrfx UUID型"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2484,7 +2485,7 @@ msgstr "バッファのスライスは同じ長さでなければなりません
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3651,6 +3652,10 @@ msgstr ""
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "pow()の3つ目の引数は0にできません"
@@ -4180,6 +4185,9 @@ msgstr "ziはfloat値でなければなりません"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDAとSCLにプルアップが必要"
+
#~ msgid ""
#~ "\n"
#~ "Code done running. Waiting for reload.\n"
diff --git a/locale/ko.po b/locale/ko.po
index 54e57f191..ff1217f1c 100644
--- a/locale/ko.po
+++ b/locale/ko.po
@@ -632,6 +632,10 @@ msgstr ""
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr ""
@@ -868,7 +872,7 @@ msgstr ""
msgid "Error in regex"
msgstr "Regex에 오류가 있습니다."
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -927,7 +931,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1298,7 +1302,7 @@ msgstr ""
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1306,10 +1310,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1326,10 +1326,6 @@ msgstr ""
msgid "Invalid word/bit length"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr ""
@@ -1542,6 +1538,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1650,7 +1652,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1796,6 +1798,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1803,6 +1809,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr ""
@@ -1811,7 +1818,7 @@ msgid "RTC is not supported on this board"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1868,12 +1875,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr ""
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2166,7 +2167,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2465,7 +2466,7 @@ msgstr ""
msgid "buffer too small"
msgstr ""
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3625,6 +3626,10 @@ msgstr ""
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
diff --git a/locale/nl.po b/locale/nl.po
index de9aed9e7..451241ba5 100644
--- a/locale/nl.po
+++ b/locale/nl.po
@@ -636,6 +636,10 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
"Kan niet resetten naar bootloader omdat er geen bootloader aanwezig is."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Kan de waarde niet toewijzen als de richting input is."
@@ -876,7 +880,7 @@ msgstr "EXTINT kanaal al in gebruik"
msgid "Error in regex"
msgstr "Fout in regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -935,7 +939,7 @@ msgstr "FFT alleen voor ndarrays gedefineerd"
msgid "FFT is implemented for linear arrays only"
msgstr "FFT is alleen geïmplementeerd voor lineaire arrays"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "SSL handdruk mislukt"
@@ -1309,7 +1313,7 @@ msgstr "Ongeldige security_mode"
msgid "Invalid size"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1317,10 +1321,6 @@ msgstr ""
msgid "Invalid state"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Ongeldige stem"
@@ -1337,10 +1337,6 @@ msgstr "Ongeldig wave bestand"
msgid "Invalid word/bit length"
msgstr "Ongeldig woord/bit lengte"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "Sleutel moet 16, 24, of 32 bytes lang zijn"
@@ -1553,6 +1549,12 @@ msgstr "Geen netwerk met dat SSID gevonden"
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Geen pulldown op pin; 1MOhm aangeraden"
@@ -1667,7 +1669,7 @@ msgstr ""
msgid "Out of memory"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "Geen sockets meer beschikbaar"
@@ -1825,6 +1827,10 @@ msgstr "RNG DeInit Fout"
msgid "RNG Init Error"
msgstr "RNG Init Fout"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1832,6 +1838,7 @@ msgstr "RS485 inversie gespecificeerd terwijl niet in RS485 modus"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "RTC calibratie niet ondersteund door dit board"
@@ -1840,7 +1847,7 @@ msgid "RTC is not supported on this board"
msgstr "RTC is niet ondersteund door dit board"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS/CTS/RS485 Nog niet ondersteund door dit apparaat"
@@ -1897,12 +1904,6 @@ msgstr "Veilige modus wordt uitgevoerd! "
msgid "SD card CSD format not supported"
msgstr "SD kaart CSD formaat niet ondersteund"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA of SCL hebben een pullup nodig"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2204,7 +2205,7 @@ msgstr "Kan niet naar sleep_memory schrijven."
msgid "Unexpected nrfx uuid type"
msgstr "Onverwacht mrfx uuid type"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr "Niet behandelde ESP TLS fout %d %d %x %d"
@@ -2514,7 +2515,7 @@ msgstr "buffer slices moeten van gelijke grootte zijn"
msgid "buffer too small"
msgstr "buffer te klein"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr "buffer te klein voor gevraagde bytes"
@@ -3683,6 +3684,10 @@ msgstr "pop van een lege PulseIn"
msgid "pop from empty %q"
msgstr "pop van een lege %q"
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "derde argument van pow() mag geen 0 zijn"
@@ -4213,6 +4218,9 @@ msgstr "zi moet van type float zijn"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi moet vorm (n_section, 2) hebben"
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA of SCL hebben een pullup nodig"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr "%d adres pins en %d RGB pins geven een hoogte van %d aan, niet %d"
diff --git a/locale/pl.po b/locale/pl.po
index e9a794cac..c9fd04c38 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
-"PO-Revision-Date: 2021-01-27 01:31+0000\n"
+"PO-Revision-Date: 2021-02-10 21:50+0000\n"
"Last-Translator: Maciej Stankiewicz <tawezik@gmail.com>\n"
"Language-Team: pl\n"
"Language: pl\n"
@@ -636,6 +636,10 @@ msgstr "Nie można przemontować '/' gdy USB działa."
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "Nie można zrestartować -- nie ma bootloadera."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Nie można ustawić wartości w trybie wejścia."
@@ -876,7 +880,7 @@ msgstr "Kanał EXTINT w użyciu"
msgid "Error in regex"
msgstr "Błąd w regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
@@ -935,7 +939,7 @@ msgstr ""
msgid "FFT is implemented for linear arrays only"
msgstr ""
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr ""
@@ -1308,7 +1312,7 @@ msgstr "Nieprawidłowy security_mode"
msgid "Invalid size"
msgstr "Nieprawidłowy rozmiar"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
@@ -1316,10 +1320,6 @@ msgstr ""
msgid "Invalid state"
msgstr "Nieprawidłowy stan"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr ""
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
@@ -1336,10 +1336,6 @@ msgstr "Zły plik wave"
msgid "Invalid word/bit length"
msgstr "Niepoprawna długość słowa/bitu"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr ""
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "Klucz musi mieć długość 16, 24 lub 32 bajtów"
@@ -1553,6 +1549,12 @@ msgstr ""
msgid "No out in program"
msgstr ""
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@@ -1661,7 +1663,7 @@ msgstr ""
msgid "Out of memory"
msgstr "Brak pamięci"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
@@ -1807,6 +1809,10 @@ msgstr ""
msgid "RNG Init Error"
msgstr ""
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr ""
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1814,6 +1820,7 @@ msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "Brak obsługi kalibracji RTC"
@@ -1822,7 +1829,7 @@ msgid "RTC is not supported on this board"
msgstr "Brak obsługi RTC"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
@@ -1879,12 +1886,6 @@ msgstr ""
msgid "SD card CSD format not supported"
msgstr ""
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA lub SCL wymagają podciągnięcia"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2176,7 +2177,7 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr "Nieoczekiwany typ nrfx uuid"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
@@ -2481,7 +2482,7 @@ msgstr "fragmenty bufora muszą mieć tę samą długość"
msgid "buffer too small"
msgstr "zbyt mały bufor"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
@@ -3643,6 +3644,10 @@ msgstr "pop z pustego PulseIn"
msgid "pop from empty %q"
msgstr ""
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "trzeci argument pow() nie może być 0"
@@ -4102,7 +4107,7 @@ msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
-msgstr ""
+msgstr "szerokość musi być większa niż zero"
#: ports/esp32s2/common-hal/wifi/Radio.c
msgid "wifi is not enabled"
@@ -4122,7 +4127,7 @@ msgstr ""
#: extmod/ulab/code/vector/vectorise.c
msgid "wrong input type"
-msgstr ""
+msgstr "nieprawidłowy typ wejścia"
#: extmod/ulab/code/ulab_create.c py/objstr.c
msgid "wrong number of arguments"
@@ -4138,7 +4143,7 @@ msgstr "zły typ operandu"
#: extmod/ulab/code/vector/vectorise.c
msgid "wrong output type"
-msgstr ""
+msgstr "nieprawidłowy typ wyjścia"
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
@@ -4172,6 +4177,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA lub SCL wymagają podciągnięcia"
+
#~ msgid "tuple index out of range"
#~ msgstr "indeks krotki poza zakresem"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 2b9f9afa2..04fbb64cc 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
-"PO-Revision-Date: 2021-02-01 17:50+0000\n"
+"PO-Revision-Date: 2021-02-09 14:03+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@@ -654,6 +654,10 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
"Não é possível redefinir para o bootloader porque o mesmo não está presente."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr "Não foi possível definir as opções do socket"
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Não é possível definir o valor quando a direção é inserida."
@@ -894,7 +898,7 @@ msgstr "Canal EXTINT em uso"
msgid "Error in regex"
msgstr "Erro no regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr "Erro: Falha na vinculação"
@@ -953,7 +957,7 @@ msgstr "O FFT é definido apenas para ndarrays"
msgid "FFT is implemented for linear arrays only"
msgstr "O FFT é implementado apenas para matrizes lineares"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "Houve uma falha no handshake do SSL"
@@ -1327,7 +1331,7 @@ msgstr "O Security_mode é inválido"
msgid "Invalid size"
msgstr "Tamanho inválido"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr "Soquete inválido para o TLS"
@@ -1335,10 +1339,6 @@ msgstr "Soquete inválido para o TLS"
msgid "Invalid state"
msgstr "Estado inválido"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr "Uso inválido do soquete TLS"
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "A voz é inválida"
@@ -1355,10 +1355,6 @@ msgstr "Aqruivo de ondas inválido"
msgid "Invalid word/bit length"
msgstr "O comprimento do bit/palavra são inválidos"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr "Problema na configuração do SO_REUSEADDR"
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "A chave deve ter 16, 24 ou 32 bytes de comprimento"
@@ -1571,6 +1567,14 @@ msgstr "Não há rede com este ssid"
msgid "No out in program"
msgstr "Sem saída no programa"
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr ""
+"Nenhum pull up foi encontrado no SDA ou no SCL; verifique o fio das suas "
+"conexões"
+
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Não há pulldown no pino; É recomendável utilizar um resistor de 1M ohm"
@@ -1684,7 +1688,7 @@ msgstr "A operação expirou"
msgid "Out of memory"
msgstr "Sem memória"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "Sem soquetes"
@@ -1846,6 +1850,10 @@ msgstr "Erro DeInit RNG"
msgid "RNG Init Error"
msgstr "Houve um erro na inicialização do RNG"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr "Ainda não há suporte para o RS485 neste dispositivo"
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1853,6 +1861,7 @@ msgstr "A definição da inversão do RS485 quando não está no modo RS485"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "A calibração RTC não é suportada nesta placa"
@@ -1861,7 +1870,7 @@ msgid "RTC is not supported on this board"
msgstr "O RTC não é suportado nesta placa"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS/CTS/RS485 Ainda não é compatível neste dispositivo"
@@ -1918,12 +1927,6 @@ msgstr "Executando no modo de segurança! "
msgid "SD card CSD format not supported"
msgstr "O formato CSD do Cartão SD não é compatível"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA ou SCL precisa de um pull up"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -2230,7 +2233,7 @@ msgstr "Não foi possível escrever no sleep_memory."
msgid "Unexpected nrfx uuid type"
msgstr "Tipo uuid nrfx inesperado"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr "Erro não tratado do ESP TLS %d %d %x %d"
@@ -2541,7 +2544,7 @@ msgstr "as fatias do buffer devem ter o mesmo comprimento"
msgid "buffer too small"
msgstr "o buffer é muito pequeno"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr "o buffer é pequeno demais para os bytes requisitados"
@@ -3721,6 +3724,10 @@ msgstr "pop a partir de um PulseIn vazio"
msgid "pop from empty %q"
msgstr "pop a partir do %q vazio"
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr "a porta deve ser > = 0"
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "O terceiro argumento pow() não pode ser 0"
@@ -4251,6 +4258,15 @@ msgstr "zi deve ser de um tipo float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi deve estar na forma (n_section, 2)"
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA ou SCL precisa de um pull up"
+
+#~ msgid "Invalid use of TLS Socket"
+#~ msgstr "Uso inválido do soquete TLS"
+
+#~ msgid "Issue setting SO_REUSEADDR"
+#~ msgstr "Problema na configuração do SO_REUSEADDR"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr ""
#~ "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d"
diff --git a/locale/sv.po b/locale/sv.po
index c4c51fcc0..e9eb91b05 100644
--- a/locale/sv.po
+++ b/locale/sv.po
@@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
-"PO-Revision-Date: 2021-01-25 19:32+0000\n"
+"PO-Revision-Date: 2021-02-05 19:47+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n"
@@ -68,6 +68,7 @@ msgstr "%%c kräver int eller char"
msgid ""
"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"
msgstr ""
+"%d adresspinnar, %d rgb-stift och %d brickor anger en höjd på %d, inte %d"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
msgid "%q failure: %d"
@@ -348,7 +349,7 @@ msgstr "Alla händelsekanaler används"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "All state machines in use"
-msgstr ""
+msgstr "Alla tillståndsmaskiner används"
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "All sync event channels in use"
@@ -641,6 +642,10 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
"Det går inte att återställa till bootloader eftersom bootloader saknas."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr "Det går inte att ange socketalternativ"
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Kan inte sätta värde när riktning är input."
@@ -825,7 +830,7 @@ msgstr "Datapinne 0 måste vara bytejusterad"
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
msgid "Data 0 pin must be byte aligned."
-msgstr ""
+msgstr "Datapinne 0 måste vara byte-justerad."
#: shared-module/audiocore/WaveFile.c
msgid "Data chunk must follow fmt chunk"
@@ -881,7 +886,7 @@ msgstr "EXTINT-kanalen används redan"
msgid "Error in regex"
msgstr "Fel i regex"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr "Fel: Bind misslyckades"
@@ -940,7 +945,7 @@ msgstr "FFT är enbart definierade för ndarrays"
msgid "FFT is implemented for linear arrays only"
msgstr "FTT är enbart implementerad för linjära matriser"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "Misslyckad SSL-handskakning"
@@ -1070,7 +1075,7 @@ msgstr "I2C init-fel"
#: ports/raspberrypi/common-hal/busio/I2C.c
msgid "I2C peripheral in use"
-msgstr ""
+msgstr "I2C-enhet används redan"
#: shared-bindings/audiobusio/I2SOut.c
msgid "I2SOut not available"
@@ -1099,7 +1104,7 @@ msgstr "Fel buffertstorlek"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Init program size invalid"
-msgstr ""
+msgstr "Storlek på init-program ogiltigt"
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
msgid "Initialization failed due to lack of memory"
@@ -1116,27 +1121,27 @@ msgstr "Indata-/utdatafel"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d jumps on pin"
-msgstr ""
+msgstr "Instruktion %d hoppar på pinne"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d shifts in more bits than pin count"
-msgstr ""
+msgstr "Instruktion %d skiftar fler bitar än antalet pinnar"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d shifts out more bits than pin count"
-msgstr ""
+msgstr "Instruktion %d skiftar fler bitar än antal pinnar"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d uses extra pin"
-msgstr ""
+msgstr "Instruktion %d använder extra pinne"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d waits on input outside of count"
-msgstr ""
+msgstr "Instruktion %d väntar på inmatning utanför intervallet"
#: ports/nrf/common-hal/_bleio/__init__.c
msgid "Insufficient authentication"
@@ -1313,7 +1318,7 @@ msgstr "Ogiltigt säkerhetsläge"
msgid "Invalid size"
msgstr "Ogiltig storlek"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr "Ogiltig socket för TLS"
@@ -1321,10 +1326,6 @@ msgstr "Ogiltig socket för TLS"
msgid "Invalid state"
msgstr "Ogiltigt tillstånd"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr "Ogiltig användning av TLS Socket"
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Ogiltig kanal"
@@ -1341,10 +1342,6 @@ msgstr "Ogiltig wave-fil"
msgid "Invalid word/bit length"
msgstr "Ogiltig word-/bitlängd"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr "Misslyckades att sätta SO_REUSEADDR"
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "Nyckeln måste vara 16, 24 eller 32 byte lång"
@@ -1410,32 +1407,32 @@ msgstr "MISO- eller MOSI-pinne saknas"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d reads pin(s)"
-msgstr ""
+msgstr "Saknad first_in_pin. Instruktion %d läser pinnar"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)"
-msgstr ""
+msgstr "Saknad first_in_pin. Instruktion %d skiftar in från pinnar"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d waits based on pin"
-msgstr ""
+msgstr "Saknad first_in_pin. Instruktion %d väntar baserat på pinne"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)"
-msgstr ""
+msgstr "Saknad first_out_pin. Instruktion %d skiftar ut till pinnar"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_out_pin. Instruction %d writes pin(s)"
-msgstr ""
+msgstr "Saknad first_out_pin. Instruktion %d skriver till pinnar"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_set_pin. Instruction %d sets pin(s)"
-msgstr ""
+msgstr "Saknad first_set_pin. Instruktion %d sätter pinnar"
#: shared-bindings/displayio/Group.c
msgid "Must be a %q subclass."
@@ -1556,7 +1553,13 @@ msgstr "Inget nätverk med sådant ssid"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "No out in program"
-msgstr ""
+msgstr "Inget out i programmet"
+
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr "Ingen pull-up hittades på SDA eller SCL; kontrollera inkopplingen"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
@@ -1617,7 +1620,7 @@ msgstr "Endast 8 eller 16 bitars mono med "
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Only IN/OUT of up to 8 supported"
-msgstr ""
+msgstr "Endast IN/OUT på upp till 8 stöds"
#: ports/esp32s2/common-hal/wifi/__init__.c
msgid "Only IPv4 addresses supported"
@@ -1671,7 +1674,7 @@ msgstr "Åtgärden orsakade timeout"
msgid "Out of memory"
msgstr "Slut på minne"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "Slut på sockets"
@@ -1711,11 +1714,11 @@ msgstr "Åtkomst nekad"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Pin count must be at least 1"
-msgstr ""
+msgstr "Antalet pinnar måste vara minst 1"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Pin count too large"
-msgstr ""
+msgstr "Antal pinnar för stort"
#: ports/atmel-samd/common-hal/analogio/AnalogIn.c
#: ports/cxd56/common-hal/analogio/AnalogIn.c
@@ -1794,23 +1797,23 @@ msgstr "Fingerar djup sömn tills larm, Ctrl-C eller filskrivning.\n"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Program does IN without loading ISR"
-msgstr ""
+msgstr "Program gör IN utan att ladda ISR"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Program does OUT without loading OSR"
-msgstr ""
+msgstr "Program gör OUT utan att läsa in OSR"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program must contain at least one 16-bit instruction."
-msgstr ""
+msgstr "Programmet måste innehålla minst en 16-bitars instruktion."
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program size invalid"
-msgstr ""
+msgstr "Programstorlek ogiltig"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program too large"
-msgstr ""
+msgstr "Programmet är för stort"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
@@ -1818,7 +1821,7 @@ msgstr "Pull används inte när riktningen är output."
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
msgid "RAISE mode is not implemented"
-msgstr ""
+msgstr "RAISE-läge är inte implementerat"
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
@@ -1828,6 +1831,10 @@ msgstr "RNG DeInit-fel"
msgid "RNG Init Error"
msgstr "RNG Init-fel"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr "RS485 stöds ännu inte på den här enheten"
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1835,6 +1842,7 @@ msgstr "RS485-inversion specificerad när den inte är i RS485-läge"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "RTC-kalibrering stöds inte av detta kort"
@@ -1843,7 +1851,7 @@ msgid "RTC is not supported on this board"
msgstr "RTC stöds inte av detta kort"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS/CTS/RS485 Stöds ännu inte på den här enheten"
@@ -1900,12 +1908,6 @@ msgstr "Kör i säkert läge! "
msgid "SD card CSD format not supported"
msgstr "SD-kort CSD-format stöds inte"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA eller SCL behöver en pullup"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -1926,7 +1928,7 @@ msgstr "SPI reinitialiseringsfel"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
-msgstr ""
+msgstr "SPI-enhet används redan"
#: shared-bindings/audiomixer/Mixer.c
msgid "Sample rate must be positive"
@@ -1960,11 +1962,11 @@ msgstr "Serversidans kontext kan inte ha värdnamn"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Set pin count must be between 1 and 5"
-msgstr ""
+msgstr "Inställt antal pinnar måste vara mellan 1 och 5"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Side set pin count must be between 1 and 5"
-msgstr ""
+msgstr "Sido-setets antal pinnar måste vara mellan 1 och 5"
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Size not supported"
@@ -2142,7 +2144,7 @@ msgstr "UART reinit-fel"
#: ports/raspberrypi/common-hal/busio/UART.c
msgid "UART not yet supported"
-msgstr ""
+msgstr "UART stöds ännu inte"
#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
@@ -2207,7 +2209,7 @@ msgstr "Det gick inte att skriva till sleep_memory."
msgid "Unexpected nrfx uuid type"
msgstr "Oväntad nrfx uuid-typ"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr "Ej hanterat ESP TLS-fel %d-%d-%x-%d"
@@ -2514,7 +2516,7 @@ msgstr "buffertsegmenten måste vara lika långa"
msgid "buffer too small"
msgstr "buffert för liten"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr "buffert för liten för begärd längd"
@@ -3683,6 +3685,10 @@ msgstr "pop från en tom PulseIn"
msgid "pop from empty %q"
msgstr "pop från tom %q"
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr ""
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "pow() 3: e argument kan inte vara 0"
@@ -3719,11 +3725,11 @@ msgstr "trycka båda knapparna vid uppstart.\n"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "pull_threshold must be between 1 and 32"
-msgstr ""
+msgstr "pull_threshold måste vara mellan 1 och 32"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "push_threshold must be between 1 and 32"
-msgstr ""
+msgstr "push_threshold måste vara mellan 1 och 32"
#: extmod/modutimeq.c
msgid "queue overflow"
@@ -3922,7 +3928,7 @@ msgstr "tröskelvärdet måste ligga i intervallet 0-65536"
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "tile must be greater than zero"
-msgstr ""
+msgstr "tile måste vara större än noll"
#: shared-bindings/time/__init__.c
msgid "time.struct_time() takes a 9-sequence"
@@ -4213,6 +4219,15 @@ msgstr "zi måste vara av typ float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi måste vara i formen (n_section, 2)"
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA eller SCL behöver en pullup"
+
+#~ msgid "Invalid use of TLS Socket"
+#~ msgstr "Ogiltig användning av TLS Socket"
+
+#~ msgid "Issue setting SO_REUSEADDR"
+#~ msgstr "Misslyckades att sätta SO_REUSEADDR"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr "%d adresspinnar och %d RGB-pinnar indikerar en höjd av %d, inte %d"
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index 09def4330..f4b549777 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
-"PO-Revision-Date: 2021-01-30 02:32+0000\n"
+"PO-Revision-Date: 2021-02-09 14:03+0000\n"
"Last-Translator: hexthat <hexthat@gmail.com>\n"
"Language-Team: Chinese Hanyu Pinyin\n"
"Language: zh_Latn_pinyin\n"
@@ -351,7 +351,7 @@ msgstr "Suǒyǒu shǐyòng de shìjiàn píndào"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "All state machines in use"
-msgstr ""
+msgstr "suǒ yǒu zhèng zài shǐ yòng de zhuàng tài jī"
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "All sync event channels in use"
@@ -643,6 +643,10 @@ msgstr "USB jīhuó shí wúfǎ chóngxīn bǎng ding '/'."
msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "Wúfǎ chóng zhì wèi bootloader, yīnwèi méiyǒu bootloader cúnzài."
+#: ports/esp32s2/common-hal/socketpool/Socket.c
+msgid "Cannot set socket options"
+msgstr "wú fǎ shè zhì tào jiē zì xuǎn xiàng"
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Cannot set value when direction is input."
msgstr "Dāng fāngxiàng xiàng nèi shí, bùnéng shèzhì gāi zhí."
@@ -881,7 +885,7 @@ msgstr "EXTINT píndào yǐjīng shǐyòng"
msgid "Error in regex"
msgstr "Zhèngzé biǎodá shì cuòwù"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr "cuò wù: bǎng dìng shī bài"
@@ -940,7 +944,7 @@ msgstr "FFT jǐn wéi ndarrays dìng yì"
msgid "FFT is implemented for linear arrays only"
msgstr "FFT jǐn shì yòng yú xiàn xìng zhèn liè"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
msgstr "SSL wòshǒu shībài"
@@ -1070,7 +1074,7 @@ msgstr "I2C chūshǐhuà cuòwù"
#: ports/raspberrypi/common-hal/busio/I2C.c
msgid "I2C peripheral in use"
-msgstr ""
+msgstr "I2C wài shè zhèng zài shǐ yòng zhōng"
#: shared-bindings/audiobusio/I2SOut.c
msgid "I2SOut not available"
@@ -1099,7 +1103,7 @@ msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Init program size invalid"
-msgstr ""
+msgstr "Init chéng xù dà xiǎo wú xiào"
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
msgid "Initialization failed due to lack of memory"
@@ -1116,27 +1120,27 @@ msgstr "Shūrù/shūchū cuòwù"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d jumps on pin"
-msgstr ""
+msgstr "zhǐ lìng %d zài yǐn jiǎo shàng tiào zhuǎn"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d shifts in more bits than pin count"
-msgstr ""
+msgstr "zhǐ lìng %d yí wèi chāo guò yǐn jiǎo jì shù"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d shifts out more bits than pin count"
-msgstr ""
+msgstr "zhǐ lìng %d yí chū de wèi bǐ yǐn jiǎo shù duō"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d uses extra pin"
-msgstr ""
+msgstr "zhǐ lìng %d shǐ yòng é wài de yǐn jiǎo"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d waits on input outside of count"
-msgstr ""
+msgstr "zhǐ lìng %d děng dài jì shù zhī wài de shū rù"
#: ports/nrf/common-hal/_bleio/__init__.c
msgid "Insufficient authentication"
@@ -1313,7 +1317,7 @@ msgstr "Ānquán móshì wúxiào"
msgid "Invalid size"
msgstr "dà xiǎo wú xiào"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr "TLS de chā zuò wú xiào"
@@ -1321,10 +1325,6 @@ msgstr "TLS de chā zuò wú xiào"
msgid "Invalid state"
msgstr "wú xiào zhuàng tài"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Invalid use of TLS Socket"
-msgstr "TLS tào jiē zì de wú xiào shǐ yòng"
-
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr "Yǔyīn wúxiào"
@@ -1341,10 +1341,6 @@ msgstr "Wúxiào de làng làngcháo wénjiàn"
msgid "Invalid word/bit length"
msgstr "Wúxiào de zì/wèi chángdù"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
-msgid "Issue setting SO_REUSEADDR"
-msgstr "wèn tí shè zhì SO_REUSEADDR"
-
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
msgstr "mì yào bì xū wéi 16, 24 huò 32 zì jié cháng"
@@ -1409,32 +1405,33 @@ msgstr "Quēshǎo MISO huò MOSI yǐn jiǎo"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d reads pin(s)"
-msgstr ""
+msgstr "shǒu xiān zài yǐn jiǎo zhōng quē shī. zhǐ lìng %d dú qǔ yǐn jiǎo"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)"
-msgstr ""
+msgstr "shǒu xiān zài yǐn jiǎo zhōng quē shī. zhǐ lìng %d cóng yǐn jiǎo yí wèi"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d waits based on pin"
msgstr ""
+"shǒu xiān zài yǐn jiǎo zhōng quē shī. jī yú yǐn jiǎo de zhǐ lìng %d děng dài"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)"
-msgstr ""
+msgstr "xiān lòu chū yǐn jiǎo. zhǐ lìng %d yí chū dào yǐn jiǎo"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_out_pin. Instruction %d writes pin(s)"
-msgstr ""
+msgstr "xiān lòu chū yǐn jiǎo. zhǐ lìng %d xiě rù yǐn jiǎo"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_set_pin. Instruction %d sets pin(s)"
-msgstr ""
+msgstr "quē shǎo dì yī zǔ yǐn jiǎo. zhǐ lìng %d shè zhì yǐn jiǎo"
#: shared-bindings/displayio/Group.c
msgid "Must be a %q subclass."
@@ -1555,7 +1552,13 @@ msgstr "Méiyǒu wǎngluò yǔ gāi ssid"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "No out in program"
-msgstr ""
+msgstr "chéng xù zhōng wèi tuì chū"
+
+#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
+#: ports/raspberrypi/common-hal/busio/I2C.c
+msgid "No pull up found on SDA or SCL; check your wiring"
+msgstr "zài SDA huò SCL shàng wèi zhǎo dào shàng lā; jiǎn chá nín de xiàn lù"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
@@ -1615,7 +1618,7 @@ msgstr "Zhǐyǒu 8 huò 16 wèi dānwèi "
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Only IN/OUT of up to 8 supported"
-msgstr ""
+msgstr "jǐn zhī chí zuì duō 8 gè IN/OUT"
#: ports/esp32s2/common-hal/wifi/__init__.c
msgid "Only IPv4 addresses supported"
@@ -1670,7 +1673,7 @@ msgstr "cāo zuò yǐ fēn shí"
msgid "Out of memory"
msgstr "nèi cún bù zú"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "tào jiē zì wài"
@@ -1709,11 +1712,11 @@ msgstr "Quánxiàn bèi jùjué"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Pin count must be at least 1"
-msgstr ""
+msgstr "yǐn jiǎo jì shù bì xū zhì shǎo wéi 1"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Pin count too large"
-msgstr ""
+msgstr "yǐn jiǎo jì shù tài dà"
#: ports/atmel-samd/common-hal/analogio/AnalogIn.c
#: ports/cxd56/common-hal/analogio/AnalogIn.c
@@ -1789,23 +1792,23 @@ msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Program does IN without loading ISR"
-msgstr ""
+msgstr "chéng xù zài bù jiā zǎi ISR de qíng kuàng xià wán chéng"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Program does OUT without loading OSR"
-msgstr ""
+msgstr "chéng xù zài bù jiā zǎi Osr de qíng kuàng xià zhí xíng OUT"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program must contain at least one 16-bit instruction."
-msgstr ""
+msgstr "chéng xù bì xū zhì shǎo bāo hán yí gè 16 wèi zhǐ lìng ."
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program size invalid"
-msgstr ""
+msgstr "chéng xù dà xiǎo wú xiào"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program too large"
-msgstr ""
+msgstr "chéng xù tài dà"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
@@ -1813,7 +1816,7 @@ msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng."
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
msgid "RAISE mode is not implemented"
-msgstr ""
+msgstr "wèi shí xiàn tí shēng mó shì"
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
@@ -1823,6 +1826,10 @@ msgstr "RNG qǔxiāo chūshǐhuà cuòwù"
msgid "RNG Init Error"
msgstr "RNG chūshǐhuà cuòwù"
+#: ports/nrf/common-hal/busio/UART.c
+msgid "RS485 Not yet supported on this device"
+msgstr "RS485 cǐ shè bèi shàng bù zhī chí"
+
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "RS485 inversion specified when not in RS485 mode"
@@ -1830,6 +1837,7 @@ msgstr "Wèi chǔyú RS485 móshì shí zhǐdìngle RS485 fǎn zhuǎn"
#: ports/cxd56/common-hal/rtc/RTC.c ports/esp32s2/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c
+#: ports/raspberrypi/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
msgstr "Cǐ bǎn bù zhīchí RTC jiàozhǔn"
@@ -1838,7 +1846,7 @@ msgid "RTC is not supported on this board"
msgstr "Cǐ bǎn bù zhīchí RTC"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
-#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr "RTS/CTS/RS485 gāi shèbèi shàng bù zhīchí"
@@ -1895,12 +1903,6 @@ msgstr "Zài ānquán móshì xià yùnxíng! "
msgid "SD card CSD format not supported"
msgstr "Bù zhīchí SD kǎ CSD géshì"
-#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
-#: ports/raspberrypi/common-hal/busio/I2C.c
-msgid "SDA or SCL needs a pull up"
-msgstr "SDA huò SCL xūyào lādòng"
-
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
@@ -1921,7 +1923,7 @@ msgstr "SPI chóngxīn chūshǐhuà cuòwù"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
-msgstr ""
+msgstr "SPI wài shè zhèng zài shǐ yòng zhōng"
#: shared-bindings/audiomixer/Mixer.c
msgid "Sample rate must be positive"
@@ -1955,11 +1957,11 @@ msgstr "Fúwùqì duān shàngxiàwén bùnéng jùyǒu zhǔjī míng"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Set pin count must be between 1 and 5"
-msgstr ""
+msgstr "shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Side set pin count must be between 1 and 5"
-msgstr ""
+msgstr "cè miàn shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān"
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Size not supported"
@@ -2136,7 +2138,7 @@ msgstr "UART chóngxīn chūshǐhuà cuòwù"
#: ports/raspberrypi/common-hal/busio/UART.c
msgid "UART not yet supported"
-msgstr ""
+msgstr "UART shàng wèi shòu zhī chí"
#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
@@ -2201,7 +2203,7 @@ msgstr "wú fǎ xiě rù sleep_memory。"
msgid "Unexpected nrfx uuid type"
msgstr "Yìwài de nrfx uuid lèixíng"
-#: ports/esp32s2/common-hal/socketpool/Socket.c
+#: ports/esp32s2/common-hal/ssl/SSLSocket.c
#, c-format
msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr "Wèi chǔlǐ de ESP TLS cuòwù %d %d %x %d"
@@ -2509,7 +2511,7 @@ msgstr "huǎnchōng qū qiēpiàn bìxū chángdù xiāngděng"
msgid "buffer too small"
msgstr "huǎnchōng qū tài xiǎo"
-#: shared-bindings/socketpool/Socket.c
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr "huǎn chōng qū tài xiǎo, duì yú qǐng qiú de zì jié"
@@ -3676,6 +3678,10 @@ msgstr "cóng kōng mài chōng tán chū"
msgid "pop from empty %q"
msgstr "cóng kōng %q dànchū"
+#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
+msgid "port must be >= 0"
+msgstr "duān kǒu bì xū wéi >= 0"
+
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr "pow() 3 cān shǔ bùnéng wéi 0"
@@ -3712,11 +3718,11 @@ msgstr "zài qǐdòng shí tóngshí àn xià liǎng gè ànniǔ.\n"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "pull_threshold must be between 1 and 32"
-msgstr ""
+msgstr "lā lì yù zhí bì xū jiè yú 1 hé 32 zhī jiān"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "push_threshold must be between 1 and 32"
-msgstr ""
+msgstr "tuī sòng yù zhí bì xū jiè yú 1 hé 32 zhī jiān"
#: extmod/modutimeq.c
msgid "queue overflow"
@@ -4206,6 +4212,15 @@ msgstr "zi bìxū wèi fú diǎn xíng"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
+#~ msgid "SDA or SCL needs a pull up"
+#~ msgstr "SDA huò SCL xūyào lādòng"
+
+#~ msgid "Invalid use of TLS Socket"
+#~ msgstr "TLS tào jiē zì de wú xiào shǐ yòng"
+
+#~ msgid "Issue setting SO_REUSEADDR"
+#~ msgstr "wèn tí shè zhì SO_REUSEADDR"
+
#~ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
#~ msgstr ""
#~ "%d dìzhǐ yǐn jiǎo hé %d rgb yǐn jiǎo jiāng gāodù biǎoshì wèi %d, ér bùshì "
diff --git a/main.c b/main.c
index d9cdcca1d..7bfa565df 100755
--- a/main.c
+++ b/main.c
@@ -184,6 +184,7 @@ STATIC void stop_mp(void) {
#endif
background_callback_reset();
+ usb_background();
gc_deinit();
}
diff --git a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk
index a5722c9ad..697ec02c3 100644
--- a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk
@@ -11,3 +11,4 @@ LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0
+SUPEROPT_VM = 0
diff --git a/ports/atmel-samd/boards/dynalora_usb/board.c b/ports/atmel-samd/boards/dynalora_usb/board.c
new file mode 100644
index 000000000..84960e73c
--- /dev/null
+++ b/ports/atmel-samd/boards/dynalora_usb/board.c
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 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"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+}
diff --git a/ports/atmel-samd/boards/dynalora_usb/mpconfigboard.h b/ports/atmel-samd/boards/dynalora_usb/mpconfigboard.h
new file mode 100644
index 000000000..12359ce8f
--- /dev/null
+++ b/ports/atmel-samd/boards/dynalora_usb/mpconfigboard.h
@@ -0,0 +1,36 @@
+#define MICROPY_HW_BOARD_NAME "DynaLoRa_USB"
+#define MICROPY_HW_MCU_NAME "samd21e18"
+
+#define MICROPY_HW_LED_STATUS (&pin_PA27)
+#define MICROPY_HW_NEOPIXEL (&pin_PA19)
+
+#define SPI_FLASH_MOSI_PIN &pin_PA04
+#define SPI_FLASH_MISO_PIN &pin_PA05
+#define SPI_FLASH_SCK_PIN &pin_PA07
+#define SPI_FLASH_CS_PIN &pin_PA06
+
+// These are pins not to reset.
+#define MICROPY_PORT_A (0)
+#define MICROPY_PORT_B (0)
+#define MICROPY_PORT_C (0)
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PA01)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA00)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PA17)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA16)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA18)
+
+#define DEFAULT_UART_BUS_RX (&pin_PA00)
+#define DEFAULT_UART_BUS_TX (&pin_PA01)
+
+// USB is always used internally so skip the pin objects for it.
+#define IGNORE_PIN_PA23 1
+#define IGNORE_PIN_PA24 1
+
+// Not connected
+#define IGNORE_PIN_PA08 1
+#define IGNORE_PIN_PA14 1
+#define IGNORE_PIN_PA21 1
+#define IGNORE_PIN_PA22 1
+#define IGNORE_PIN_PA28 1
diff --git a/ports/atmel-samd/boards/dynalora_usb/mpconfigboard.mk b/ports/atmel-samd/boards/dynalora_usb/mpconfigboard.mk
new file mode 100644
index 000000000..ac14e7395
--- /dev/null
+++ b/ports/atmel-samd/boards/dynalora_usb/mpconfigboard.mk
@@ -0,0 +1,39 @@
+USB_VID = 0x04D8
+USB_PID = 0xEA2A
+USB_PRODUCT = "DynaLoRa_USB"
+USB_MANUFACTURER = "BHDynamics"
+
+CHIP_VARIANT = SAMD21E18A
+CHIP_FAMILY = samd21
+
+SPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = GD25Q32C
+LONGINT_IMPL = MPZ
+
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_GAMEPAD = 0
+CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_FULL_BUILD = 0
+
+SUPEROPT_GC = 0
+
+CFLAGS_BOARD = --param max-inline-insns-auto=15
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+RELEASE_NEEDS_CLEAN_BUILD = 1
+CFLAGS_INLINE_LIMIT = 35
+endif
+ifeq ($(TRANSLATION), ja)
+RELEASE_NEEDS_CLEAN_BUILD = 1
+CFLAGS_INLINE_LIMIT = 35
+endif
+ifeq ($(TRANSLATION), de_DE)
+RELEASE_NEEDS_CLEAN_BUILD = 1
+CFLAGS_INLINE_LIMIT = 35
+SUPEROPT_VM = 0
+endif
+
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD
diff --git a/ports/atmel-samd/boards/dynalora_usb/pins.c b/ports/atmel-samd/boards/dynalora_usb/pins.c
new file mode 100644
index 000000000..25f498543
--- /dev/null
+++ b/ports/atmel-samd/boards/dynalora_usb/pins.c
@@ -0,0 +1,41 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA30) },
+ { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA31) },
+
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA02) },
+
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA18) },
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
+ { MP_ROM_QSTR(MP_QSTR_RADIO_CS), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_RADIO_INT), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_RADIO_RESET), MP_ROM_PTR(&pin_PA10) },
+
+ { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PA03) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA00) },
+
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA00) },
+
+ { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_SCK1), MP_ROM_PTR(&pin_PA01) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA27) },
+ { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA19) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA15) },
+
+ { 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_UART), MP_ROM_PTR(&board_uart_obj) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/seeeduino_xiao/mpconfigboard.mk b/ports/atmel-samd/boards/seeeduino_xiao/mpconfigboard.mk
index bedec87f4..6bbd84235 100644
--- a/ports/atmel-samd/boards/seeeduino_xiao/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/seeeduino_xiao/mpconfigboard.mk
@@ -11,3 +11,4 @@ LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0
+SUPEROPT_VM = 0
diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
index 735d42297..1f88fbead 100644
--- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
@@ -11,14 +11,5 @@ LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0
-
-CFLAGS_BOARD = --param max-inline-insns-auto=15
-ifeq ($(TRANSLATION), zh_Latn_pinyin)
-RELEASE_NEEDS_CLEAN_BUILD = 1
-CFLAGS_INLINE_LIMIT = 35
-endif
-ifeq ($(TRANSLATION), de_DE)
-RELEASE_NEEDS_CLEAN_BUILD = 1
-CFLAGS_INLINE_LIMIT = 35
SUPEROPT_VM = 0
-endif
+CFLAGS_INLINE_LIMIT = 45
diff --git a/ports/atmel-samd/common-hal/_pew/PewPew.c b/ports/atmel-samd/common-hal/_pew/PewPew.c
index cfdfe75d8..1e7561ac8 100644
--- a/ports/atmel-samd/common-hal/_pew/PewPew.c
+++ b/ports/atmel-samd/common-hal/_pew/PewPew.c
@@ -40,6 +40,7 @@
static uint8_t pewpew_tc_index = 0xff;
+static volatile uint16_t pewpew_ticks = 0;
void pewpew_interrupt_handler(uint8_t index) {
@@ -52,6 +53,7 @@ void pewpew_interrupt_handler(uint8_t index) {
}
pew_tick();
+ ++pewpew_ticks;
// Clear the interrupt bit.
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0;
@@ -123,3 +125,7 @@ void pew_reset(void) {
}
MP_STATE_VM(pew_singleton) = NULL;
}
+
+uint16_t pew_get_ticks() {
+ return pewpew_ticks;
+}
diff --git a/ports/atmel-samd/common-hal/_pew/PewPew.h b/ports/atmel-samd/common-hal/_pew/PewPew.h
index da1cae0a2..a9c3b6626 100644
--- a/ports/atmel-samd/common-hal/_pew/PewPew.h
+++ b/ports/atmel-samd/common-hal/_pew/PewPew.h
@@ -44,5 +44,6 @@ typedef struct {
void pew_init(void);
void pewpew_interrupt_handler(uint8_t index);
void pew_reset(void);
+uint16_t pew_get_ticks(void);
#endif // MICROPY_INCLUDED_PEW_PEWPEW_H
diff --git a/ports/atmel-samd/common-hal/busio/I2C.c b/ports/atmel-samd/common-hal/busio/I2C.c
index ffe74a274..2551f7bf1 100644
--- a/ports/atmel-samd/common-hal/busio/I2C.c
+++ b/ports/atmel-samd/common-hal/busio/I2C.c
@@ -97,7 +97,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
if (!gpio_get_pin_level(sda->number) || !gpio_get_pin_level(scl->number)) {
reset_pin_number(sda->number);
reset_pin_number(scl->number);
- mp_raise_RuntimeError(translate("SDA or SCL needs a pull up"));
+ mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring"));
}
#endif
diff --git a/ports/atmel-samd/common-hal/supervisor/Runtime.c b/ports/atmel-samd/common-hal/supervisor/Runtime.c
index 6be38f216..974f26cec 100755
--- a/ports/atmel-samd/common-hal/supervisor/Runtime.c
+++ b/ports/atmel-samd/common-hal/supervisor/Runtime.c
@@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}
diff --git a/ports/cxd56/common-hal/supervisor/Runtime.c b/ports/cxd56/common-hal/supervisor/Runtime.c
index a0d9e70ab..eeeb1430f 100755
--- a/ports/cxd56/common-hal/supervisor/Runtime.c
+++ b/ports/cxd56/common-hal/supervisor/Runtime.c
@@ -27,10 +27,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}
diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile
index aac934782..b4ff0612b 100644
--- a/ports/esp32s2/Makefile
+++ b/ports/esp32s2/Makefile
@@ -164,7 +164,9 @@ LIBS += -lm
endif
# TinyUSB defines
-CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
+CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024
+CFLAGS += -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
+CFLAGS += -DCFG_TUD_VENDOR_RX_BUFSIZE=128 -DCFG_TUD_VENDOR_TX_BUFSIZE=128
######################################
diff --git a/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk b/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk
index 2dce03881..52c63cb9c 100644
--- a/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk
+++ b/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.mk
@@ -14,4 +14,10 @@ CIRCUITPY_ESP_FLASH_MODE=dio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB
+# We only have enough endpoints available in hardware to
+# enable ONE of these at a time.
+CIRCUITPY_USB_MIDI = 1
+CIRCUITPY_USB_HID = 0
+CIRCUITPY_USB_VENDOR = 0
+
CIRCUITPY_MODULE=wrover
diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c
index aaef97c7d..4aa7b3b24 100644
--- a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c
+++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/board.c
@@ -27,6 +27,109 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-module/displayio/__init__.h"
+#include "shared-module/displayio/mipi_constants.h"
+
+#define DELAY 0x80
+
+// display init sequence according to LilyGO example app
+uint8_t display_init_sequence[] = {
+ // sw reset
+ 0x01, 0 | DELAY, 150,
+ // sleep out
+ 0x11, 0 | DELAY, 255,
+ // normal display mode on
+ 0x13, 0,
+ // display and color format settings
+ 0x36, 1, 0x08,
+ 0xB6, 2, 0x0A, 0x82,
+ 0x3A, 1 | DELAY, 0x55, 10,
+ // ST7789V frame rate setting
+ 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33,
+ // voltages: VGH / VGL
+ 0xB7, 1, 0x35,
+ // ST7789V power setting
+ 0xBB, 1, 0x28,
+ 0xC0, 1, 0x0C,
+ 0xC2, 2, 0x01, 0xFF,
+ 0xC3, 1, 0x10,
+ 0xC4, 1, 0x20,
+ 0xC6, 1, 0x0F,
+ 0xD0, 2, 0xA4, 0xA1,
+ // ST7789V gamma setting
+ 0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17,
+ 0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
+ 0x21, 0,
+ // display on
+ 0x29, 0 | DELAY, 255,
+ };
+
+static void display_init(void) {
+ busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
+
+ common_hal_busio_spi_construct(
+ spi,
+ &pin_GPIO36, // CLK
+ &pin_GPIO35, // MOSI
+ NULL // MISO not connected
+ );
+
+ common_hal_busio_spi_never_reset(spi);
+
+ displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
+ bus->base.type = &displayio_fourwire_type;
+
+ common_hal_displayio_fourwire_construct(
+ bus,
+ spi,
+ &pin_GPIO37, // DC
+ &pin_GPIO34, // CS
+ &pin_GPIO38, // RST
+ 40000000, // baudrate
+ 0, // polarity
+ 0 // phase
+ );
+
+ displayio_display_obj_t* display = &displays[0].display;
+ display->base.type = &displayio_display_type;
+
+ // workaround as board_init() is called before reset_port() in main.c
+ pwmout_reset();
+
+ common_hal_displayio_display_construct(
+ display,
+ bus,
+ 240, // width (after rotation)
+ 135, // height (after rotation)
+ 52, // column start
+ 40, // row start
+ 90, // rotation
+ 16, // color depth
+ false, // grayscale
+ false, // pixels in a byte share a row. Only valid for depths < 8
+ 1, // bytes per cell. Only valid for depths < 8
+ false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
+ MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
+ MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
+ MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
+ 0x37, // set vertical scroll command
+ display_init_sequence,
+ sizeof(display_init_sequence),
+ &pin_GPIO33, // backlight pin
+ NO_BRIGHTNESS_COMMAND,
+ 1.0f, // brightness (ignored)
+ false, // auto_brightness
+ false, // single_byte_bounds
+ false, // data_as_commands
+ true, // auto_refresh
+ 60, // native_frames_per_second
+ true, // backlight_on_high
+ false // SH1107_addressing
+ );
+
+ common_hal_never_reset_pin(&pin_GPIO33); // backlight pin
+}
void board_init(void) {
// USB
@@ -38,6 +141,9 @@ void board_init(void) {
common_hal_never_reset_pin(&pin_GPIO43);
common_hal_never_reset_pin(&pin_GPIO44);
#endif /* DEBUG */
+
+ // Display
+ display_init();
}
bool board_requests_safe_mode(void) {
diff --git a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c
index bda0fd227..a30c6797a 100644
--- a/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c
+++ b/ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/pins.c
@@ -1,4 +1,5 @@
#include "shared-bindings/board/__init__.h"
+#include "shared-module/displayio/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
@@ -41,13 +42,13 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO10) },
// 1.14 inch LCD ST7789
- { MP_ROM_QSTR(MP_QSTR_LCD_MISO), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO34) },
{ MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_LCD_BCKL), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_LCD_D_C), MP_ROM_PTR(&pin_GPIO37) },
+ { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
// Peripheral Power control
{ MP_ROM_QSTR(MP_QSTR_PE_POWER), MP_ROM_PTR(&pin_GPIO14) },
diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c
index 1cec5d4ae..be435e210 100644
--- a/ports/esp32s2/common-hal/alarm/__init__.c
+++ b/ports/esp32s2/common-hal/alarm/__init__.c
@@ -150,6 +150,14 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala
void NORETURN alarm_enter_deep_sleep(void) {
alarm_pin_pinalarm_prepare_for_deep_sleep();
alarm_touch_touchalarm_prepare_for_deep_sleep();
+
+ // Disable brownout detection, which appears to be triggered sometimes when
+ // waking from deep sleep.
+ // See https://www.esp32.com/viewtopic.php?f=13&t=19208#p71084
+ // and https://github.com/adafruit/circuitpython/issues/4025#issuecomment-771027606
+ // TODO: We can remove this workaround when ESP-IDF handles this.
+ CLEAR_PERI_REG_MASK(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_RST_ENA);
+
// The ESP-IDF caches the deep sleep settings and applies them before sleep.
// We don't need to worry about resetting them in the interim.
esp_deep_sleep_start();
diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c
index 86322be86..eb9b6f8e1 100644
--- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c
+++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c
@@ -63,6 +63,9 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
self->bit_clock = bit_clock;
self->word_select = word_select;
self->data = data;
+ claim_pin(bit_clock);
+ claim_pin(word_select);
+ claim_pin(data);
}
bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) {
diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c
index 772262d0a..8372eb8c3 100644
--- a/ports/esp32s2/common-hal/busio/I2C.c
+++ b/ports/esp32s2/common-hal/busio/I2C.c
@@ -85,7 +85,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
if (gpio_get_level(sda->number) == 0 || gpio_get_level(scl->number) == 0) {
reset_pin_number(sda->number);
reset_pin_number(scl->number);
- mp_raise_RuntimeError(translate("SDA or SCL needs a pull up"));
+ mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring"));
}
#endif
diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c
index fc50ca3ab..5f93807bb 100644
--- a/ports/esp32s2/common-hal/socketpool/Socket.c
+++ b/ports/esp32s2/common-hal/socketpool/Socket.c
@@ -3,7 +3,6 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -38,16 +37,15 @@
#include "components/lwip/lwip/src/include/lwip/sys.h"
#include "components/lwip/lwip/src/include/lwip/netdb.h"
-STATIC socketpool_socket_obj_t * open_socket_handles[CONFIG_LWIP_MAX_SOCKETS]; // 4 on the wrover/wroom
+STATIC socketpool_socket_obj_t * open_socket_handles[CONFIG_LWIP_MAX_SOCKETS];
void socket_reset(void) {
for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) {
if (open_socket_handles[i]) {
if (open_socket_handles[i]->num > 0) {
+ // Close automatically clears socket handle
common_hal_socketpool_socket_close(open_socket_handles[i]);
- open_socket_handles[i] = NULL;
} else {
- // accidentally got a TCP socket in here, or something.
open_socket_handles[i] = NULL;
}
}
@@ -64,73 +62,14 @@ bool register_open_socket(socketpool_socket_obj_t* self) {
return false;
}
-STATIC void _lazy_init_LWIP(socketpool_socket_obj_t* self) {
- if (self->num != -1) {
- return; //safe to call on existing socket
- }
- if (self->tls != NULL) {
- mp_raise_RuntimeError(translate("Invalid use of TLS Socket"));
- }
- int socknum = -1;
- socknum = lwip_socket(self->family, self->type, self->ipproto);
- if (socknum < 0 || !register_open_socket(self)) {
- mp_raise_RuntimeError(translate("Out of sockets"));
- }
- self->num = socknum;
- lwip_fcntl(socknum, F_SETFL, O_NONBLOCK);
-}
-
-STATIC void _lazy_init_TLS(socketpool_socket_obj_t* self) {
- if (self->type != SOCK_STREAM || self->num != -1) {
- mp_raise_RuntimeError(translate("Invalid socket for TLS"));
- }
- esp_tls_t* tls_handle = esp_tls_init();
- if (tls_handle == NULL) {
- mp_raise_espidf_MemoryError();
- }
- self->tls = tls_handle;
-}
-
-void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms) {
- self->timeout_ms = timeout_ms;
-}
-
-bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self,
- const char* host, size_t hostlen, uint8_t port) {
- _lazy_init_LWIP(self);
-
- struct sockaddr_in bind_addr;
- bind_addr.sin_addr.s_addr = inet_addr(host);
- bind_addr.sin_family = AF_INET;
- bind_addr.sin_port = htons(port);
-
- int opt = 1;
- int err = lwip_setsockopt(self->num, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
- if (err != 0) {
- mp_raise_RuntimeError(translate("Issue setting SO_REUSEADDR"));
- }
- int result = lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) == 0;
- return result;
-}
-
-bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog) {
- return lwip_listen(self->num, backlog) == 0;
-}
-
socketpool_socket_obj_t* common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self,
- uint8_t* ip, uint *port) {
+ uint8_t* ip, uint32_t *port) {
struct sockaddr_in accept_addr;
socklen_t socklen = sizeof(accept_addr);
int newsoc = -1;
bool timed_out = false;
uint64_t start_ticks = supervisor_ticks_ms64();
- if (self->timeout_ms != (uint)-1) {
- mp_printf(&mp_plat_print, "will timeout");
- } else {
- mp_printf(&mp_plat_print, "won't timeout");
- }
-
// Allow timeouts and interrupts
while (newsoc == -1 &&
!timed_out &&
@@ -140,7 +79,7 @@ socketpool_socket_obj_t* common_hal_socketpool_socket_accept(socketpool_socket_o
}
RUN_BACKGROUND_TASKS;
newsoc = lwip_accept(self->num, (struct sockaddr *)&accept_addr, &socklen);
- // In non-blocking mode, fail instead of looping
+ // In non-blocking mode, fail instead of timing out
if (newsoc == -1 && self->timeout_ms == 0) {
mp_raise_OSError(MP_EAGAIN);
}
@@ -159,9 +98,8 @@ socketpool_socket_obj_t* common_hal_socketpool_socket_accept(socketpool_socket_o
socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t);
sock->base.type = &socketpool_socket_type;
sock->num = newsoc;
- sock->tls = NULL;
- sock->ssl_context = NULL;
sock->pool = self->pool;
+ sock->connected = true;
if (!register_open_socket(sock)) {
mp_raise_OSError(MP_EBADF);
@@ -175,72 +113,136 @@ socketpool_socket_obj_t* common_hal_socketpool_socket_accept(socketpool_socket_o
}
}
-bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self,
- const char* host, mp_uint_t hostlen, mp_int_t port) {
- // For simplicity we use esp_tls for all TCP connections. If it's not SSL, ssl_context will be
- // NULL and should still work. This makes regular TCP connections more memory expensive but TLS
- // should become more and more common. Therefore, we optimize for the TLS case.
+bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self,
+ const char* host, size_t hostlen, uint32_t port) {
+ struct sockaddr_in bind_addr;
+ bind_addr.sin_addr.s_addr = inet_addr(host);
+ bind_addr.sin_family = AF_INET;
+ bind_addr.sin_port = htons(port);
- // Todo: move to SSL Wrapper and add lwip_connect()
- _lazy_init_TLS(self);
+ int opt = 1;
+ int err = lwip_setsockopt(self->num, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+ if (err != 0) {
+ mp_raise_RuntimeError(translate("Cannot set socket options"));
+ }
+ int result = lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) == 0;
+ return result;
+}
- esp_tls_cfg_t* tls_config = NULL;
- if (self->ssl_context != NULL) {
- tls_config = &self->ssl_context->ssl_config;
+void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) {
+ self->connected = false;
+ if (self->num >= 0) {
+ lwip_shutdown(self->num, 0);
+ lwip_close(self->num);
+ self->num = -1;
}
- int result = esp_tls_conn_new_sync(host, hostlen, port, tls_config, self->tls);
- self->connected = result >= 0;
- if (result < 0) {
- int esp_tls_code;
- int flags;
- esp_err_t err = esp_tls_get_and_clear_last_error(self->tls->error_handle, &esp_tls_code, &flags);
-
- if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) {
- mp_raise_espidf_MemoryError();
- } else if (ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED) {
- mp_raise_OSError_msg_varg(translate("Failed SSL handshake"));
- } else {
- mp_raise_OSError_msg_varg(translate("Unhandled ESP TLS error %d %d %x %d"), esp_tls_code, flags, err, result);
+ // Remove socket record
+ for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) {
+ if (open_socket_handles[i] == self) {
+ open_socket_handles[i] = NULL;
}
+ }
+}
+
+bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self,
+ const char* host, size_t hostlen, uint32_t port) {
+ const struct addrinfo hints = {
+ .ai_family = AF_INET,
+ .ai_socktype = SOCK_STREAM,
+ };
+ struct addrinfo *result_i;
+ int error = lwip_getaddrinfo(host, NULL, &hints, &result_i);
+ if (error != 0 || result_i == NULL) {
+ mp_raise_OSError(EHOSTUNREACH);
+ }
+
+ // Set parameters
+ struct sockaddr_in dest_addr;
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wcast-align"
+ dest_addr.sin_addr.s_addr = ((struct sockaddr_in *)result_i->ai_addr)->sin_addr.s_addr;
+ #pragma GCC diagnostic pop
+ freeaddrinfo(result_i);
+
+ dest_addr.sin_family = AF_INET;
+ dest_addr.sin_port = htons(port);
+
+ // Replace above with function call -----
+
+ // Switch to blocking mode for this one call
+ int opts;
+ opts = lwip_fcntl(self->num,F_GETFL,0);
+ opts = opts & (~O_NONBLOCK);
+ lwip_fcntl(self->num, F_SETFL, opts);
+
+ int result = -1;
+ result = lwip_connect(self->num, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr_in));
+
+ // Switch back once complete
+ opts = opts | O_NONBLOCK;
+ lwip_fcntl(self->num, F_SETFL, opts);
+
+ if (result >= 0) {
+ self->connected = true;
+ return true;
} else {
- // Connection successful, set the timeout on the underlying socket. We can't rely on the IDF
- // to do it because the config structure is only used for TLS connections. Generally, we
- // shouldn't hit this timeout because we try to only read available data. However, there is
- // always a chance that we try to read something that is used internally.
- int fd;
- esp_tls_get_conn_sockfd(self->tls, &fd);
- struct timeval tv;
- tv.tv_sec = 2 * 60; // Two minutes
- tv.tv_usec = 0;
- setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
- setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ mp_raise_OSError(errno);
}
+}
- return self->connected;
+bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self) {
+ return self->num < 0;
}
bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self) {
return self->connected;
}
-mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) {
- int sent = -1;
- if (self->num != -1) {
- // LWIP Socket
- // TODO: deal with potential failure/add timeout?
- sent = lwip_send(self->num, buf, len, 0);
- } else if (self->tls != NULL) {
- // TLS Socket
- sent = esp_tls_conn_write(self->tls, buf, len);
+bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog) {
+ return lwip_listen(self->num, backlog) == 0;
+}
+
+mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self,
+ uint8_t* buf, uint32_t len, uint8_t* ip, uint *port) {
+
+ struct sockaddr_in source_addr;
+ socklen_t socklen = sizeof(source_addr);
+
+ // LWIP Socket
+ uint64_t start_ticks = supervisor_ticks_ms64();
+ int received = -1;
+ bool timed_out = false;
+ while (received == -1 &&
+ !timed_out &&
+ !mp_hal_is_interrupted()) {
+ if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) {
+ timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms;
+ }
+ RUN_BACKGROUND_TASKS;
+ received = lwip_recvfrom(self->num, buf, len, 0, (struct sockaddr *)&source_addr, &socklen);
+
+ // In non-blocking mode, fail instead of looping
+ if (received == -1 && self->timeout_ms == 0) {
+ mp_raise_OSError(MP_EAGAIN);
+ }
}
- if (sent < 0) {
- mp_raise_OSError(MP_ENOTCONN);
+ if (!timed_out) {
+ memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof(source_addr.sin_addr.s_addr));
+ *port = source_addr.sin_port;
+ } else {
+ mp_raise_OSError(ETIMEDOUT);
}
- return sent;
+
+ if (received < 0) {
+ mp_raise_BrokenPipeError();
+ return 0;
+ }
+
+ return received;
}
-mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) {
+mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, uint32_t len) {
int received = 0;
bool timed_out = false;
@@ -255,54 +257,14 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self,
timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms;
}
RUN_BACKGROUND_TASKS;
- received = lwip_recv(self->num, (void*) buf, len - 1, 0);
+ received = lwip_recv(self->num, (void*) buf, len, 0);
// In non-blocking mode, fail instead of looping
if (received == -1 && self->timeout_ms == 0) {
mp_raise_OSError(MP_EAGAIN);
}
}
- } else if (self->tls != NULL) {
- // TLS Socket
- int status = 0;
- uint64_t start_ticks = supervisor_ticks_ms64();
- int sockfd;
- esp_err_t err = esp_tls_get_conn_sockfd(self->tls, &sockfd);
- if (err != ESP_OK) {
- mp_raise_OSError(MP_EBADF);
- }
- while (received == 0 &&
- status >= 0 &&
- !timed_out &&
- !mp_hal_is_interrupted()) {
- if (self->timeout_ms != (uint)-1) {
- timed_out = self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks >= self->timeout_ms;
- }
- RUN_BACKGROUND_TASKS;
- size_t available = esp_tls_get_bytes_avail(self->tls);
- if (available == 0) {
- // This reads the raw socket buffer and is used for non-TLS connections
- // and between encrypted TLS blocks.
- status = lwip_ioctl(sockfd, FIONREAD, &available);
- }
- size_t remaining = len - received;
- if (available > remaining) {
- available = remaining;
- }
- if (available > 0) {
- status = esp_tls_conn_read(self->tls, (void*) buf + received, available);
- if (status == 0) {
- // Reading zero when something is available indicates a closed
- // connection. (The available bytes could have been TLS internal.)
- break;
- }
- if (status > 0) {
- received += status;
- }
- }
- }
} else {
- // Socket does not have a valid descriptor of either type
mp_raise_OSError(MP_EBADF);
}
@@ -312,29 +274,43 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self,
return received;
}
-mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self,
- const char* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len) {
+mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, uint32_t len) {
+ int sent = -1;
+ if (self->num != -1) {
+ // LWIP Socket
+ // TODO: deal with potential failure/add timeout?
+ sent = lwip_send(self->num, buf, len, 0);
+ } else {
+ mp_raise_OSError(MP_EBADF);
+ }
- _lazy_init_LWIP(self);
+ if (sent < 0) {
+ mp_raise_OSError(errno);
+ }
+ return sent;
+}
- // Get the IP address string
+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) {
+
+ // Set parameters
const struct addrinfo hints = {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
};
- struct addrinfo *result;
- int error = lwip_getaddrinfo(host, NULL, &hints, &result);
- if (error != 0 || result == NULL) {
- return 0;
+ struct addrinfo *result_i;
+ int error = lwip_getaddrinfo(host, NULL, &hints, &result_i);
+ if (error != 0 || result_i == NULL) {
+ mp_raise_OSError(EHOSTUNREACH);
}
// Set parameters
struct sockaddr_in dest_addr;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
- dest_addr.sin_addr.s_addr = ((struct sockaddr_in *)result->ai_addr)->sin_addr.s_addr;
+ dest_addr.sin_addr.s_addr = ((struct sockaddr_in *)result_i->ai_addr)->sin_addr.s_addr;
#pragma GCC diagnostic pop
- freeaddrinfo(result);
+ freeaddrinfo(result_i);
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(port);
@@ -347,66 +323,6 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self,
return bytes_sent;
}
-mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self,
- uint8_t* buf, mp_uint_t len, uint8_t* ip, uint *port) {
-
- _lazy_init_LWIP(self);
-
- struct sockaddr_in source_addr;
- socklen_t socklen = sizeof(source_addr);
-
- // LWIP Socket
- uint64_t start_ticks = supervisor_ticks_ms64();
- int received = -1;
- bool timed_out = false;
- while (received == -1 &&
- !timed_out &&
- !mp_hal_is_interrupted()) {
- if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) {
- timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms;
- }
- RUN_BACKGROUND_TASKS;
- received = lwip_recvfrom(self->num, buf, len, 0, (struct sockaddr *)&source_addr, &socklen);
-
- // In non-blocking mode, fail instead of looping
- if (received == -1 && self->timeout_ms == 0) {
- mp_raise_OSError(MP_EAGAIN);
- }
- }
-
- if (!timed_out) {
- memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof(source_addr.sin_addr.s_addr));
- *port = source_addr.sin_port;
- } else {
- mp_raise_OSError(ETIMEDOUT);
- }
-
- if (received < 0) {
- mp_raise_BrokenPipeError();
- return 0;
- }
-
- return received;
-}
-
-void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) {
- self->connected = false;
- if (self->tls != NULL) {
- esp_tls_conn_destroy(self->tls);
- self->tls = NULL;
- }
- if (self->num >= 0) {
- lwip_shutdown(self->num, 0);
- lwip_close(self->num);
- self->num = -1;
- }
-}
-
-bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self) {
- return self->tls == NULL && self->num < 0;
-}
-
-
-mp_uint_t common_hal_socketpool_socket_get_hash(socketpool_socket_obj_t* self) {
- return self->num;
+void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, uint32_t timeout_ms) {
+ self->timeout_ms = timeout_ms;
}
diff --git a/ports/esp32s2/common-hal/socketpool/Socket.h b/ports/esp32s2/common-hal/socketpool/Socket.h
index 4e6cfa5ef..b86f5597c 100644
--- a/ports/esp32s2/common-hal/socketpool/Socket.h
+++ b/ports/esp32s2/common-hal/socketpool/Socket.h
@@ -41,8 +41,6 @@ typedef struct {
int family;
int ipproto;
bool connected;
- esp_tls_t* tls;
- ssl_sslcontext_obj_t* ssl_context;
socketpool_socketpool_obj_t* pool;
mp_uint_t timeout_ms;
} socketpool_socket_obj_t;
diff --git a/ports/esp32s2/common-hal/socketpool/SocketPool.c b/ports/esp32s2/common-hal/socketpool/SocketPool.c
index 70a8b4eca..fbd6dca7a 100644
--- a/ports/esp32s2/common-hal/socketpool/SocketPool.c
+++ b/ports/esp32s2/common-hal/socketpool/SocketPool.c
@@ -25,6 +25,7 @@
*/
#include "shared-bindings/socketpool/SocketPool.h"
+#include "common-hal/socketpool/Socket.h"
#include "py/runtime.h"
#include "shared-bindings/wifi/__init__.h"
@@ -65,23 +66,23 @@ socketpool_socket_obj_t* common_hal_socketpool_socket(socketpool_socketpool_obj_
mp_raise_NotImplementedError(translate("Only IPv4 sockets supported"));
}
- // Consider LWIP and MbedTLS "variant" sockets to be incompatible (for now)
- // The variant of the socket is determined by whether the socket is wrapped
- // by SSL. If no TLS handle is set in sslcontext_wrap_socket, the first call
- // of bind() or connect() will create a LWIP socket with a corresponding
- // socketnum.
- // TODO: move MbedTLS to its own duplicate Socket or Server API, maybe?
socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t);
sock->base.type = &socketpool_socket_type;
- sock->num = -1;
sock->type = socket_type;
sock->family = addr_family;
sock->ipproto = ipproto;
+ sock->pool = self;
sock->timeout_ms = (uint)-1;
- sock->tls = NULL;
- sock->ssl_context = NULL;
- sock->pool = self;
+ // Create LWIP socket
+ int socknum = -1;
+ socknum = lwip_socket(sock->family, sock->type, sock->ipproto);
+ if (socknum < 0 || !register_open_socket(sock)) {
+ mp_raise_RuntimeError(translate("Out of sockets"));
+ }
+ sock->num = socknum;
+ // Sockets should be nonblocking in most cases
+ lwip_fcntl(socknum, F_SETFL, O_NONBLOCK);
return sock;
}
diff --git a/ports/esp32s2/common-hal/ssl/SSLContext.c b/ports/esp32s2/common-hal/ssl/SSLContext.c
index e24fd338b..afc3ecce2 100644
--- a/ports/esp32s2/common-hal/ssl/SSLContext.c
+++ b/ports/esp32s2/common-hal/ssl/SSLContext.c
@@ -25,6 +25,9 @@
*/
#include "shared-bindings/ssl/SSLContext.h"
+#include "shared-bindings/ssl/SSLSocket.h"
+
+#include "bindings/espidf/__init__.h"
#include "py/runtime.h"
@@ -32,10 +35,26 @@ void common_hal_ssl_sslcontext_construct(ssl_sslcontext_obj_t* self) {
}
-socketpool_socket_obj_t* common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t* self,
+ssl_sslsocket_obj_t* common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t* self,
socketpool_socket_obj_t* socket, bool server_side, const char* server_hostname) {
- socket->ssl_context = self;
+ if (socket->type != SOCK_STREAM) {
+ mp_raise_RuntimeError(translate("Invalid socket for TLS"));
+ }
+
+ ssl_sslsocket_obj_t *sock = m_new_obj_with_finaliser(ssl_sslsocket_obj_t);
+ sock->base.type = &ssl_sslsocket_type;
+ sock->ssl_context = self;
+ sock->sock = socket;
+
+ esp_tls_t* tls_handle = esp_tls_init();
+ if (tls_handle == NULL) {
+ mp_raise_espidf_MemoryError();
+ }
+ sock->tls = tls_handle;
+
+ // TODO: do something with the original socket? Don't call a close on the internal LWIP.
+
// Should we store server hostname on the socket in case connect is called with an ip?
- return socket;
+ return sock;
}
diff --git a/ports/esp32s2/common-hal/ssl/SSLSocket.c b/ports/esp32s2/common-hal/ssl/SSLSocket.c
new file mode 100644
index 000000000..10c29108c
--- /dev/null
+++ b/ports/esp32s2/common-hal/ssl/SSLSocket.c
@@ -0,0 +1,176 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2021 Lucian Copeland 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 "shared-bindings/ssl/SSLSocket.h"
+#include "shared-bindings/socketpool/Socket.h"
+#include "shared-bindings/ssl/SSLContext.h"
+
+#include "bindings/espidf/__init__.h"
+#include "lib/utils/interrupt_char.h"
+#include "py/mperrno.h"
+#include "py/runtime.h"
+#include "supervisor/shared/tick.h"
+
+ssl_sslsocket_obj_t* common_hal_ssl_sslsocket_accept(ssl_sslsocket_obj_t* self,
+ uint8_t* ip, uint32_t *port) {
+ socketpool_socket_obj_t * sock = common_hal_socketpool_socket_accept(self->sock, ip, port);
+ ssl_sslsocket_obj_t * sslsock = common_hal_ssl_sslcontext_wrap_socket(self->ssl_context, sock, false, NULL);
+ return sslsock;
+}
+
+bool common_hal_ssl_sslsocket_bind(ssl_sslsocket_obj_t* self,
+ const char* host, size_t hostlen, uint32_t port) {
+ return common_hal_socketpool_socket_bind(self->sock, host, hostlen, port);
+}
+
+void common_hal_ssl_sslsocket_close(ssl_sslsocket_obj_t* self) {
+ common_hal_socketpool_socket_close(self->sock);
+ esp_tls_conn_destroy(self->tls);
+ self->tls = NULL;
+}
+
+bool common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t* self,
+ const char* host, size_t hostlen, uint32_t port) {
+ esp_tls_cfg_t* tls_config = NULL;
+ tls_config = &self->ssl_context->ssl_config;
+ int result = esp_tls_conn_new_sync(host, hostlen, port, tls_config, self->tls);
+ self->sock->connected = result >= 0;
+ if (result < 0) {
+ int esp_tls_code;
+ int flags;
+ esp_err_t err = esp_tls_get_and_clear_last_error(self->tls->error_handle, &esp_tls_code, &flags);
+
+ if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) {
+ mp_raise_espidf_MemoryError();
+ } else if (ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED) {
+ mp_raise_OSError_msg_varg(translate("Failed SSL handshake"));
+ } else {
+ mp_raise_OSError_msg_varg(translate("Unhandled ESP TLS error %d %d %x %d"), esp_tls_code, flags, err, result);
+ }
+ } else {
+ // Connection successful, set the timeout on the underlying socket. We can't rely on the IDF
+ // to do it because the config structure is only used for TLS connections. Generally, we
+ // shouldn't hit this timeout because we try to only read available data. However, there is
+ // always a chance that we try to read something that is used internally.
+ int fd;
+ esp_tls_get_conn_sockfd(self->tls, &fd);
+ struct timeval tv;
+ tv.tv_sec = 2 * 60; // Two minutes
+ tv.tv_usec = 0;
+ setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ }
+
+ return self->sock->connected;
+}
+
+bool common_hal_ssl_sslsocket_get_closed(ssl_sslsocket_obj_t* self) {
+ return self->tls == NULL && self->sock->num < 0;
+}
+
+bool common_hal_ssl_sslsocket_get_connected(ssl_sslsocket_obj_t* self) {
+ return self->sock->connected;
+}
+
+bool common_hal_ssl_sslsocket_listen(ssl_sslsocket_obj_t* self, int backlog) {
+ return common_hal_socketpool_socket_listen(self->sock, backlog);
+}
+
+mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t* self, const uint8_t* buf, uint32_t len) {
+ int received = 0;
+ bool timed_out = false;
+ int status = 0;
+ uint64_t start_ticks = supervisor_ticks_ms64();
+ int sockfd;
+ esp_err_t err = esp_tls_get_conn_sockfd(self->tls, &sockfd);
+ if (err != ESP_OK) {
+ mp_raise_OSError(MP_EBADF);
+ }
+ while (received == 0 &&
+ status >= 0 &&
+ !timed_out &&
+ !mp_hal_is_interrupted()) {
+ if (self->sock->timeout_ms != (uint)-1 && self->sock->timeout_ms != 0) {
+ timed_out = self->sock->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks >= self->sock->timeout_ms;
+ }
+ RUN_BACKGROUND_TASKS;
+ size_t available = esp_tls_get_bytes_avail(self->tls);
+ if (available == 0) {
+ // This reads the raw socket buffer and is used for non-TLS connections
+ // and between encrypted TLS blocks.
+ status = lwip_ioctl(sockfd, FIONREAD, &available);
+ }
+ size_t remaining = len - received;
+ if (available > remaining) {
+ available = remaining;
+ }
+ if (available > 0) {
+ status = esp_tls_conn_read(self->tls, (void*) buf + received, available);
+ if (status == 0) {
+ // Reading zero when something is available indicates a closed
+ // connection. (The available bytes could have been TLS internal.)
+ break;
+ }
+ if (status > 0) {
+ received += status;
+ }
+ }
+ // In non-blocking mode, fail instead of timing out
+ if (received==0 && self->sock->timeout_ms == 0) {
+ mp_raise_OSError(MP_EAGAIN);
+ }
+ }
+
+ if (timed_out) {
+ mp_raise_OSError(ETIMEDOUT);
+ }
+ return received;
+}
+
+mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t* self, const uint8_t* buf, uint32_t len) {
+ int sent = -1;
+ sent = esp_tls_conn_write(self->tls, buf, len);
+
+ if (sent < 0) {
+ int esp_tls_code;
+ int flags;
+ esp_err_t err = esp_tls_get_and_clear_last_error(self->tls->error_handle, &esp_tls_code, &flags);
+
+ if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) {
+ mp_raise_espidf_MemoryError();
+ } else if (ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED) {
+ mp_raise_OSError_msg_varg(translate("Failed SSL handshake"));
+ } else {
+ mp_raise_OSError_msg_varg(translate("Unhandled ESP TLS error %d %d %x %d"), esp_tls_code, flags, err, sent);
+ }
+ }
+ return sent;
+}
+
+void common_hal_ssl_sslsocket_settimeout(ssl_sslsocket_obj_t* self, uint32_t timeout_ms) {
+ self->sock->timeout_ms = timeout_ms;
+}
diff --git a/ports/esp32s2/common-hal/ssl/SSLSocket.h b/ports/esp32s2/common-hal/ssl/SSLSocket.h
new file mode 100644
index 000000000..e9e5bff06
--- /dev/null
+++ b/ports/esp32s2/common-hal/ssl/SSLSocket.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2021 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL_SSLSOCKET_H
+#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL_SSLSOCKET_H
+
+#include "py/obj.h"
+
+#include "common-hal/ssl/SSLContext.h"
+#include "common-hal/socketpool/Socket.h"
+
+#include "components/esp-tls/esp_tls.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ socketpool_socket_obj_t * sock;
+ esp_tls_t* tls;
+ ssl_sslcontext_obj_t* ssl_context;
+} ssl_sslsocket_obj_t;
+
+#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL_SSLSOCKET_H
diff --git a/ports/esp32s2/common-hal/supervisor/Runtime.c b/ports/esp32s2/common-hal/supervisor/Runtime.c
index ea663f897..974f26cec 100644
--- a/ports/esp32s2/common-hal/supervisor/Runtime.c
+++ b/ports/esp32s2/common-hal/supervisor/Runtime.c
@@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
- return (bool) serial_bytes_available();
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
+ return (bool) serial_bytes_available();
}
diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk
index 562c60998..5073d8812 100644
--- a/ports/esp32s2/mpconfigport.mk
+++ b/ports/esp32s2/mpconfigport.mk
@@ -28,18 +28,18 @@ CIRCUITPY_FREQUENCYIO = 1
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_ROTARYIO = 1
CIRCUITPY_NVM = 1
+CIRCUITPY_PS2IO ?= 1
+CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
# We don't have enough endpoints to include MIDI.
-CIRCUITPY_USB_MIDI = 0
+CIRCUITPY_USB_MIDI ?= 0
+CIRCUITPY_USB_HID ?= 1
+# We have borrowed the VENDOR nomenclature from tinyusb. VENDOR AKA WEBUSB
+CIRCUITPY_USB_VENDOR ?= 0
CIRCUITPY_WIFI = 1
CIRCUITPY_WATCHDOG ?= 1
-CIRCUITPY_ESPIDF = 1
-
-ifndef CIRCUITPY_PS2IO
-CIRCUITPY_PS2IO = 1
-endif
-ifndef CIRCUITPY_TOUCHIO_USE_NATIVE
-CIRCUITPY_TOUCHIO_USE_NATIVE = 1
-endif
+CIRCUITPY_ESPIDF = 1
CIRCUITPY_MODULE ?= none
+
+USB_NUM_EP = 5
diff --git a/ports/litex/common-hal/supervisor/Runtime.c b/ports/litex/common-hal/supervisor/Runtime.c
index ea663f897..974f26cec 100644
--- a/ports/litex/common-hal/supervisor/Runtime.c
+++ b/ports/litex/common-hal/supervisor/Runtime.c
@@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
- return (bool) serial_bytes_available();
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
+ return (bool) serial_bytes_available();
}
diff --git a/ports/mimxrt10xx/common-hal/busio/I2C.c b/ports/mimxrt10xx/common-hal/busio/I2C.c
index aaa2549a8..c8daddc4b 100644
--- a/ports/mimxrt10xx/common-hal/busio/I2C.c
+++ b/ports/mimxrt10xx/common-hal/busio/I2C.c
@@ -110,7 +110,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
if( !GPIO_PinRead(sda->gpio, sda->number) || !GPIO_PinRead(scl->gpio, scl->number)) {
common_hal_reset_pin(sda);
common_hal_reset_pin(scl);
- mp_raise_RuntimeError(translate("SDA or SCL needs a pull up"));
+ mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring"));
}
#endif
diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c
index ce7cbea7e..00d8d9867 100644
--- a/ports/mimxrt10xx/common-hal/busio/SPI.c
+++ b/ports/mimxrt10xx/common-hal/busio/SPI.c
@@ -38,6 +38,8 @@
#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv) + 1))
+#define MAX_SPI_BUSY_RETRIES 100
+
//arrays use 0 based numbering: SPI1 is stored at index 0
#define MAX_SPI 4
STATIC bool reserved_spi[MAX_SPI];
@@ -289,7 +291,12 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
xfer.dataSize = len;
xfer.configFlags = kLPSPI_MasterPcs0;
- const status_t status = LPSPI_MasterTransferBlocking(self->spi, &xfer);
+ status_t status;
+ int retries = MAX_SPI_BUSY_RETRIES;
+ do {
+ status = LPSPI_MasterTransferBlocking(self->spi, &xfer);
+ } while (status == kStatus_LPSPI_Busy && --retries > 0);
+
if (status != kStatus_Success)
printf("%s: status %ld\r\n", __func__, status);
@@ -311,7 +318,12 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self,
xfer.rxData = data;
xfer.dataSize = len;
- const status_t status = LPSPI_MasterTransferBlocking(self->spi, &xfer);
+ status_t status;
+ int retries = MAX_SPI_BUSY_RETRIES;
+ do {
+ status = LPSPI_MasterTransferBlocking(self->spi, &xfer);
+ } while (status == kStatus_LPSPI_Busy && --retries > 0);
+
if (status != kStatus_Success)
printf("%s: status %ld\r\n", __func__, status);
@@ -333,7 +345,12 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou
xfer.rxData = data_in;
xfer.dataSize = len;
- const status_t status = LPSPI_MasterTransferBlocking(self->spi, &xfer);
+ status_t status;
+ int retries = MAX_SPI_BUSY_RETRIES;
+ do {
+ status = LPSPI_MasterTransferBlocking(self->spi, &xfer);
+ } while (status == kStatus_LPSPI_Busy && --retries > 0);
+
if (status != kStatus_Success)
printf("%s: status %ld\r\n", __func__, status);
diff --git a/ports/mimxrt10xx/common-hal/supervisor/Runtime.c b/ports/mimxrt10xx/common-hal/supervisor/Runtime.c
index 6be38f216..974f26cec 100755
--- a/ports/mimxrt10xx/common-hal/supervisor/Runtime.c
+++ b/ports/mimxrt10xx/common-hal/supervisor/Runtime.c
@@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}
diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c
index 37cb192df..654fa857f 100644
--- a/ports/nrf/common-hal/busio/I2C.c
+++ b/ports/nrf/common-hal/busio/I2C.c
@@ -131,7 +131,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
if (!nrf_gpio_pin_read(sda->number) || !nrf_gpio_pin_read(scl->number)) {
reset_pin_number(sda->number);
reset_pin_number(scl->number);
- mp_raise_RuntimeError(translate("SDA or SCL needs a pull up"));
+ mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring"));
}
#endif
diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile
index eab7deee6..e1169ce7d 100644
--- a/ports/raspberrypi/Makefile
+++ b/ports/raspberrypi/Makefile
@@ -99,6 +99,7 @@ INC += -I. \
-isystem sdk/src/rp2_common/pico_platform/include/ \
-isystem sdk/src/rp2_common/pico_runtime/printf/include/ \
-isystem sdk/src/rp2_common/pico_bootrom/include/ \
+ -isystem sdk/src/rp2_common/pico_unique_id/include/ \
-Isdk_config \
-I../../lib/tinyusb/src \
-I../../supervisor/shared/usb \
@@ -184,6 +185,7 @@ SRC_SDK := \
src/rp2_common/pico_printf/printf.c \
src/rp2_common/pico_runtime/runtime.c \
src/rp2_common/pico_stdio/stdio.c \
+ src/rp2_common/pico_unique_id/unique_id.c \
SRC_SDK := $(addprefix sdk/, $(SRC_SDK))
diff --git a/ports/raspberrypi/background.c b/ports/raspberrypi/background.c
index c85b83b41..52f2e4fb4 100644
--- a/ports/raspberrypi/background.c
+++ b/ports/raspberrypi/background.c
@@ -25,20 +25,11 @@
*/
#include "background.h"
-#include "supervisor/filesystem.h"
-#include "supervisor/shared/tick.h"
-#include "supervisor/usb.h"
-
#include "py/runtime.h"
-#include "shared-module/network/__init__.h"
-#include "supervisor/shared/stack.h"
#include "supervisor/port.h"
-#if CIRCUITPY_DISPLAYIO
-#include "shared-module/displayio/__init__.h"
-#endif
-
void port_start_background_task(void) {}
void port_finish_background_task(void) {}
-void port_background_task(void) {}
+void port_background_task(void) {
+}
diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c
index 0f6f84a56..34633949e 100644
--- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c
+++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c
@@ -189,7 +189,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n
if (bufinfo.len % 2 != 0) {
mp_raise_ValueError(translate("Program size invalid"));
}
- if (bufinfo.len > 32) {
+ if (bufinfo.len > 64) {
mp_raise_ValueError(translate("Program too large"));
}
diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/pins.c b/ports/raspberrypi/boards/raspberry_pi_pico/pins.c
index 913676ad2..e1927bc80 100644
--- a/ports/raspberrypi/boards/raspberry_pi_pico/pins.c
+++ b/ports/raspberrypi/boards/raspberry_pi_pico/pins.c
@@ -24,6 +24,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) },
+ { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) },
@@ -35,5 +36,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) },
{ 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_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/raspberrypi/bs2_default_padded_checksummed.S b/ports/raspberrypi/bs2_default_padded_checksummed.S
index d77f4867c..6b7074e3b 100644
--- a/ports/raspberrypi/bs2_default_padded_checksummed.S
+++ b/ports/raspberrypi/bs2_default_padded_checksummed.S
@@ -1,20 +1,23 @@
-// Padded and checksummed version of: /Users/graham/dev/mu/pico_sdk/cmake-build-debug-mu/src/rp2_common/boot_stage2/bs2_default.bin
+// Padded and checksummed version of: /home/pi/pico/pico-examples/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.bin
-.section .boot2, "a"
+.cpu cortex-m0plus
+.thumb
-.byte 0x00, 0xb5, 0x2f, 0x4b, 0x21, 0x20, 0x58, 0x60, 0x98, 0x68, 0x02, 0x21, 0x88, 0x43, 0x98, 0x60
-.byte 0xd8, 0x60, 0x18, 0x61, 0x58, 0x61, 0x2b, 0x4b, 0x00, 0x21, 0x99, 0x60, 0x02, 0x21, 0x59, 0x61
-.byte 0x01, 0x21, 0xf0, 0x22, 0x99, 0x50, 0x28, 0x49, 0x19, 0x60, 0x01, 0x21, 0x99, 0x60, 0x35, 0x20
-.byte 0x00, 0xf0, 0x3e, 0xf8, 0x02, 0x22, 0x90, 0x42, 0x14, 0xd0, 0x06, 0x21, 0x19, 0x66, 0x00, 0xf0
-.byte 0x2e, 0xf8, 0x19, 0x6e, 0x01, 0x21, 0x19, 0x66, 0x00, 0x20, 0x18, 0x66, 0x1a, 0x66, 0x00, 0xf0
-.byte 0x26, 0xf8, 0x19, 0x6e, 0x19, 0x6e, 0x19, 0x6e, 0x05, 0x20, 0x00, 0xf0, 0x29, 0xf8, 0x01, 0x21
-.byte 0x08, 0x42, 0xf9, 0xd1, 0x00, 0x21, 0x99, 0x60, 0x18, 0x49, 0x19, 0x60, 0x00, 0x21, 0x59, 0x60
-.byte 0x17, 0x49, 0x18, 0x48, 0x01, 0x60, 0x01, 0x21, 0x99, 0x60, 0xeb, 0x21, 0x19, 0x66, 0xa0, 0x21
-.byte 0x19, 0x66, 0x00, 0xf0, 0x0c, 0xf8, 0x00, 0x21, 0x99, 0x60, 0x13, 0x49, 0x11, 0x48, 0x01, 0x60
-.byte 0x01, 0x21, 0x99, 0x60, 0x01, 0xbc, 0x00, 0x28, 0x00, 0xd1, 0x10, 0x48, 0x00, 0x47, 0x03, 0xb5
-.byte 0x99, 0x6a, 0x04, 0x20, 0x01, 0x42, 0xfb, 0xd0, 0x01, 0x20, 0x01, 0x42, 0xf8, 0xd1, 0x03, 0xbd
-.byte 0x02, 0xb5, 0x18, 0x66, 0x18, 0x66, 0xff, 0xf7, 0xf2, 0xff, 0x18, 0x6e, 0x18, 0x6e, 0x02, 0xbd
-.byte 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x5f, 0x00
-.byte 0x21, 0x22, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x18, 0x22, 0x20, 0x00, 0xa0, 0x01, 0x01, 0x00, 0x10
-.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x27, 0x2a, 0x60
+.section .boot2, "ax"
+
+.byte 0x00, 0xb5, 0x32, 0x4b, 0x21, 0x20, 0x58, 0x60, 0x98, 0x68, 0x02, 0x21, 0x88, 0x43, 0x98, 0x60
+.byte 0xd8, 0x60, 0x18, 0x61, 0x58, 0x61, 0x2e, 0x4b, 0x00, 0x21, 0x99, 0x60, 0x02, 0x21, 0x59, 0x61
+.byte 0x01, 0x21, 0xf0, 0x22, 0x99, 0x50, 0x2b, 0x49, 0x19, 0x60, 0x01, 0x21, 0x99, 0x60, 0x35, 0x20
+.byte 0x00, 0xf0, 0x44, 0xf8, 0x02, 0x22, 0x90, 0x42, 0x14, 0xd0, 0x06, 0x21, 0x19, 0x66, 0x00, 0xf0
+.byte 0x34, 0xf8, 0x19, 0x6e, 0x01, 0x21, 0x19, 0x66, 0x00, 0x20, 0x18, 0x66, 0x1a, 0x66, 0x00, 0xf0
+.byte 0x2c, 0xf8, 0x19, 0x6e, 0x19, 0x6e, 0x19, 0x6e, 0x05, 0x20, 0x00, 0xf0, 0x2f, 0xf8, 0x01, 0x21
+.byte 0x08, 0x42, 0xf9, 0xd1, 0x00, 0x21, 0x99, 0x60, 0x1b, 0x49, 0x19, 0x60, 0x00, 0x21, 0x59, 0x60
+.byte 0x1a, 0x49, 0x1b, 0x48, 0x01, 0x60, 0x01, 0x21, 0x99, 0x60, 0xeb, 0x21, 0x19, 0x66, 0xa0, 0x21
+.byte 0x19, 0x66, 0x00, 0xf0, 0x12, 0xf8, 0x00, 0x21, 0x99, 0x60, 0x16, 0x49, 0x14, 0x48, 0x01, 0x60
+.byte 0x01, 0x21, 0x99, 0x60, 0x01, 0xbc, 0x00, 0x28, 0x00, 0xd0, 0x00, 0x47, 0x12, 0x48, 0x13, 0x49
+.byte 0x08, 0x60, 0x03, 0xc8, 0x80, 0xf3, 0x08, 0x88, 0x08, 0x47, 0x03, 0xb5, 0x99, 0x6a, 0x04, 0x20
+.byte 0x01, 0x42, 0xfb, 0xd0, 0x01, 0x20, 0x01, 0x42, 0xf8, 0xd1, 0x03, 0xbd, 0x02, 0xb5, 0x18, 0x66
+.byte 0x18, 0x66, 0xff, 0xf7, 0xf2, 0xff, 0x18, 0x6e, 0x18, 0x6e, 0x02, 0xbd, 0x00, 0x00, 0x02, 0x40
+.byte 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x5f, 0x00, 0x21, 0x22, 0x00, 0x00
+.byte 0xf4, 0x00, 0x00, 0x18, 0x22, 0x20, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x10, 0x08, 0xed, 0x00, 0xe0
+.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xb2, 0x4e, 0x7a
diff --git a/ports/raspberrypi/common-hal/busio/I2C.c b/ports/raspberrypi/common-hal/busio/I2C.c
index fa49e375e..26a7f3807 100644
--- a/ports/raspberrypi/common-hal/busio/I2C.c
+++ b/ports/raspberrypi/common-hal/busio/I2C.c
@@ -90,7 +90,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
if (!gpio_get(sda->number) || !gpio_get(scl->number)) {
reset_pin_number(sda->number);
reset_pin_number(scl->number);
- mp_raise_RuntimeError(translate("SDA or SCL needs a pull up"));
+ mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring"));
}
#endif
diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c
index 0ad3a51e2..e22286ca3 100644
--- a/ports/raspberrypi/common-hal/microcontroller/Processor.c
+++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c
@@ -25,6 +25,7 @@
*/
#include <math.h>
+#include <string.h>
#include "py/mphal.h"
#include "common-hal/microcontroller/Processor.h"
@@ -53,12 +54,9 @@ uint32_t common_hal_mcu_processor_get_frequency(void) {
}
void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
- // TODO: get the unique id from the flash. The chip itself doesn't have one.
- // for (int i=0; i<4; i++) {
- // for (int k=0; k<4; k++) {
- // raw_id[4 * i + k] = (*(id_addresses[i]) >> k * 8) & 0xff;
- // }
- // }
+ pico_unique_board_id_t retrieved_id;
+ pico_get_unique_board_id(&retrieved_id);
+ memcpy(raw_id, retrieved_id.id, COMMON_HAL_MCU_PROCESSOR_UID_LENGTH);
}
mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) {
diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.h b/ports/raspberrypi/common-hal/microcontroller/Processor.h
index b7c86e850..afb43f9bd 100644
--- a/ports/raspberrypi/common-hal/microcontroller/Processor.h
+++ b/ports/raspberrypi/common-hal/microcontroller/Processor.h
@@ -27,7 +27,9 @@
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
-#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 16
+#include "src/rp2_common/pico_unique_id/include/pico/unique_id.h"
+
+#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH PICO_UNIQUE_BOARD_ID_SIZE_BYTES
#include "py/obj.h"
diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c
index 85bfc329d..bfea8b2d9 100644
--- a/ports/raspberrypi/common-hal/microcontroller/__init__.c
+++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c
@@ -35,12 +35,16 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Processor.h"
+#include "supervisor/filesystem.h"
+#include "supervisor/port.h"
#include "supervisor/shared/safe_mode.h"
#include "supervisor/shared/translate.h"
#include "src/rp2040/hardware_structs/include/hardware/structs/sio.h"
#include "src/rp2_common/hardware_sync/include/hardware/sync.h"
+#include "hardware/watchdog.h"
+
void common_hal_mcu_delay_us(uint32_t delay) {
mp_hal_delay_us(delay);
}
@@ -66,8 +70,11 @@ void common_hal_mcu_enable_interrupts(void) {
asm volatile ("cpsie i" : : : "memory");
}
+static bool next_reset_to_bootloader = false;
+
void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
if (runmode == RUNMODE_BOOTLOADER) {
+ next_reset_to_bootloader = true;
} else {
}
if (runmode == RUNMODE_SAFE_MODE) {
@@ -76,6 +83,12 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
}
void common_hal_mcu_reset(void) {
+ filesystem_flush();
+ if (next_reset_to_bootloader) {
+ reset_to_bootloader();
+ } else {
+ reset_cpu();
+ }
}
// The singleton microcontroller.Processor object, bound to microcontroller.cpu
diff --git a/ports/raspberrypi/common-hal/neopixel_write/__init__.c b/ports/raspberrypi/common-hal/neopixel_write/__init__.c
index 10462b5a3..561d438e2 100644
--- a/ports/raspberrypi/common-hal/neopixel_write/__init__.c
+++ b/ports/raspberrypi/common-hal/neopixel_write/__init__.c
@@ -29,6 +29,7 @@
#include "bindings/rp2pio/StateMachine.h"
#include "common-hal/rp2pio/StateMachine.h"
#include "shared-bindings/microcontroller/__init__.h"
+#include "shared-bindings/digitalio/DigitalInOut.h"
#include "supervisor/port.h"
@@ -89,7 +90,11 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
// Use a private deinit of the state machine that doesn't reset the pin.
rp2pio_statemachine_deinit(&state_machine, true);
+
+ // Reset the pin and release it from the PIO
gpio_init(digitalinout->pin->number);
+ common_hal_digitalio_digitalinout_switch_to_output((digitalio_digitalinout_obj_t*)digitalinout, false, DRIVE_MODE_PUSH_PULL);
+
// Update the next start.
next_start_raw_ticks = port_get_raw_ticks(NULL) + 1;
}
diff --git a/ports/raspberrypi/common-hal/pwmio/PWMOut.c b/ports/raspberrypi/common-hal/pwmio/PWMOut.c
index 567ec5ef5..3d8979a03 100644
--- a/ports/raspberrypi/common-hal/pwmio/PWMOut.c
+++ b/ports/raspberrypi/common-hal/pwmio/PWMOut.c
@@ -107,7 +107,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self,
if (variable_frequency) {
return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE;
}
- // If the other user wants to change frequency then we can't share either.
+ // If the other user wants a variable frequency then we can't share either.
if ((slice_fixed_frequency & (1 << slice)) != 0) {
return PWMOUT_ALL_TIMERS_ON_PIN_IN_USE;
}
@@ -119,7 +119,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self,
self->slice = slice;
self->channel = channel;
channel_use |= channel_use_mask;
- if (!variable_frequency) {
+ if (variable_frequency) {
slice_fixed_frequency |= 1 << slice;
}
diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c
index 6510410b0..90c48130e 100644
--- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c
+++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c
@@ -546,15 +546,23 @@ static bool _transfer(rp2pio_statemachine_obj_t *self,
size_t tx_remaining = out_len;
while (rx_remaining || tx_remaining) {
- if (tx_remaining && !pio_sm_is_tx_fifo_full(self->pio, self->state_machine)) {
- *tx_destination = *data_out;
- data_out++;
- --tx_remaining;
- }
- if (rx_remaining && !pio_sm_is_rx_fifo_empty(self->pio, self->state_machine)) {
- *data_in = (uint8_t) *rx_source;
- data_in++;
- --rx_remaining;
+ for (int i=0; i<32; i++) {
+ bool did_transfer = false;
+ if (tx_remaining && !pio_sm_is_tx_fifo_full(self->pio, self->state_machine)) {
+ *tx_destination = *data_out;
+ data_out++;
+ --tx_remaining;
+ did_transfer = true;
+ }
+ if (rx_remaining && !pio_sm_is_rx_fifo_empty(self->pio, self->state_machine)) {
+ *data_in = (uint8_t) *rx_source;
+ data_in++;
+ --rx_remaining;
+ did_transfer = true;
+ }
+ if (!did_transfer) {
+ break;
+ }
}
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
diff --git a/ports/raspberrypi/common-hal/supervisor/Runtime.c b/ports/raspberrypi/common-hal/supervisor/Runtime.c
index 6be38f216..974f26cec 100755
--- a/ports/raspberrypi/common-hal/supervisor/Runtime.c
+++ b/ports/raspberrypi/common-hal/supervisor/Runtime.c
@@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}
diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld
index d642fd680..b83299dee 100644
--- a/ports/raspberrypi/link.ld
+++ b/ports/raspberrypi/link.ld
@@ -59,12 +59,11 @@ SECTIONS
*/
.text : {
- __reset_start = .;
- KEEP (*(.reset))
- . = ALIGN(256);
- __reset_end = .;
- ASSERT(__reset_end - __reset_start == 256, "ERROR: reset section should only be 256 bytes");
+ __logical_binary_start = .;
KEEP (*(.vectors))
+ KEEP (*(.binary_info_header))
+ __binary_info_header_end = .;
+ KEEP (*(.reset))
/* TODO revisit this now memset/memcpy/float in ROM */
/* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
* FLASH ... we will include any thing excluded here in .data below by default */
@@ -246,5 +245,7 @@ SECTIONS
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed")
+
+ ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary")
/* todo assert on extra code */
}
diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk
index 6fb4ffaae..292e509cd 100644
--- a/ports/raspberrypi/mpconfigport.mk
+++ b/ports/raspberrypi/mpconfigport.mk
@@ -42,7 +42,7 @@ CIRCUITPY_AUDIOIO = 0
INTERNAL_LIBM = 1
-USB_SERIAL_NUMBER_LENGTH = 32
+USB_SERIAL_NUMBER_LENGTH = 16
# Number of USB endpoint pairs.
USB_NUM_EP = 8
diff --git a/ports/raspberrypi/sdk b/ports/raspberrypi/sdk
-Subproject 26653ea81e340cacee55025d110c3e014a252a8
+Subproject 55346c953012ef5b32f392fea3b42814db8df2a
diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c
index b14f5173d..7c503514a 100644
--- a/ports/raspberrypi/supervisor/port.c
+++ b/ports/raspberrypi/supervisor/port.c
@@ -52,6 +52,8 @@
#include "tusb.h"
+#include "pico/bootrom.h"
+#include "hardware/watchdog.h"
extern volatile bool mp_msc_enabled;
@@ -110,13 +112,17 @@ void reset_port(void) {
}
void reset_to_bootloader(void) {
- // reset();
+ reset_usb_boot(0, 0);
while (true) {}
}
void reset_cpu(void) {
- // reset();
- while (true) {}
+ watchdog_reboot(0, SRAM_END, 0);
+ watchdog_start_tick(12);
+
+ while (true) {
+ __wfi();
+ }
}
bool port_has_fixed_stack(void) {
diff --git a/ports/stm/common-hal/supervisor/Runtime.c b/ports/stm/common-hal/supervisor/Runtime.c
index ea663f897..974f26cec 100755
--- a/ports/stm/common-hal/supervisor/Runtime.c
+++ b/ports/stm/common-hal/supervisor/Runtime.c
@@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
-bool common_hal_get_serial_connected(void) {
+bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
-bool common_hal_get_serial_bytes_available(void) {
- return (bool) serial_bytes_available();
+bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
+ return (bool) serial_bytes_available();
}
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 3ce7c0117..f907bf7ae 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -292,6 +292,9 @@ endif
ifeq ($(CIRCUITPY_USB_MIDI),1)
SRC_PATTERNS += usb_midi/%
endif
+ifeq ($(CIRCUITPY_USB_VENDOR),1)
+SRC_PATTERNS += usb_vendor/%
+endif
ifeq ($(CIRCUITPY_USTACK),1)
SRC_PATTERNS += ustack/%
endif
@@ -388,6 +391,7 @@ SRC_COMMON_HAL_ALL = \
socketpool/Socket.c \
ssl/__init__.c \
ssl/SSLContext.c \
+ ssl/SSLSocket.c \
supervisor/Runtime.c \
supervisor/__init__.c \
watchdog/WatchDogMode.c \
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index e13eca6ef..b63bbcb3e 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -346,7 +346,10 @@ CIRCUITPY_USB_MSC ?= 1
CFLAGS += -DCIRCUITPY_USB_MSC=$(CIRCUITPY_USB_MSC)
CIRCUITPY_USB_SERIAL ?= 1
-CFLAGS += -DCIRCUITPY_USB_SERIAL=$(CIRCUITPY_USB_MSC)
+CFLAGS += -DCIRCUITPY_USB_SERIAL=$(CIRCUITPY_USB_SERIAL)
+
+CIRCUITPY_USB_VENDOR ?= 0
+CFLAGS += -DCIRCUITPY_USB_VENDOR=$(CIRCUITPY_USB_VENDOR)
ifndef USB_NUM_EP
$(error "USB_NUM_EP (number of USB endpoint pairs)must be defined")
diff --git a/shared-bindings/_pew/__init__.c b/shared-bindings/_pew/__init__.c
index 498beaf1c..912d267c4 100644
--- a/shared-bindings/_pew/__init__.c
+++ b/shared-bindings/_pew/__init__.c
@@ -29,6 +29,7 @@
#include "PewPew.h"
#include "common-hal/_pew/PewPew.h"
+
STATIC mp_obj_t get_pressed(void) {
pew_obj_t *pew = MP_STATE_VM(pew_singleton);
if (!pew) {
@@ -41,12 +42,19 @@ STATIC mp_obj_t get_pressed(void) {
STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_pressed_obj, get_pressed);
+STATIC mp_obj_t get_ticks(void) {
+ return mp_obj_new_int(pew_get_ticks());
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_ticks_obj, get_ticks);
+
+
//| """LED matrix driver"""
//|
STATIC const mp_rom_map_elem_t pew_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pew) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_PewPew), MP_ROM_PTR(&pewpew_type)},
{ MP_OBJ_NEW_QSTR(MP_QSTR_get_pressed), MP_ROM_PTR(&get_pressed_obj)},
+ { MP_OBJ_NEW_QSTR(MP_QSTR_get_ticks), MP_ROM_PTR(&get_ticks_obj)},
};
STATIC MP_DEFINE_CONST_DICT(pew_module_globals,
pew_module_globals_table);
diff --git a/shared-bindings/adafruit_bus_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/I2CDevice.c
index 3c5d33f52..e6ec8c147 100644
--- a/shared-bindings/adafruit_bus_device/I2CDevice.c
+++ b/shared-bindings/adafruit_bus_device/I2CDevice.c
@@ -234,23 +234,24 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write_then_readinto(size_t n_args,
mp_obj_t dest[13];
uint8_t num_kws = 2;
+ uint8_t index = 2;
mp_load_method(self->i2c, MP_QSTR_writeto_then_readfrom, dest);
- dest[2] = MP_OBJ_NEW_SMALL_INT(self->device_address);
- dest[3] = args[ARG_out_buffer].u_obj;
- dest[4] = args[ARG_in_buffer].u_obj;
- dest[5] = MP_OBJ_NEW_QSTR(MP_QSTR_out_start);
- dest[6] = MP_OBJ_NEW_SMALL_INT(args[ARG_out_start].u_int);
+ dest[index++] = MP_OBJ_NEW_SMALL_INT(self->device_address);
+ dest[index++] = args[ARG_out_buffer].u_obj;
+ dest[index++] = args[ARG_in_buffer].u_obj;
+ dest[index++] = MP_OBJ_NEW_QSTR(MP_QSTR_out_start);
+ dest[index++] = MP_OBJ_NEW_SMALL_INT(args[ARG_out_start].u_int);
if (args[ARG_out_end].u_int != INT_MAX) {
- dest[7] = MP_OBJ_NEW_QSTR(MP_QSTR_out_end);
- dest[8] = MP_OBJ_NEW_SMALL_INT(args[ARG_out_end].u_int);
+ dest[index++] = MP_OBJ_NEW_QSTR(MP_QSTR_out_end);
+ dest[index++] = MP_OBJ_NEW_SMALL_INT(args[ARG_out_end].u_int);
num_kws++;
}
- dest[9] = MP_OBJ_NEW_QSTR(MP_QSTR_in_start);
- dest[10] = MP_OBJ_NEW_SMALL_INT(args[ARG_in_start].u_int);
+ dest[index++] = MP_OBJ_NEW_QSTR(MP_QSTR_in_start);
+ dest[index++] = MP_OBJ_NEW_SMALL_INT(args[ARG_in_start].u_int);
if (args[ARG_in_end].u_int != INT_MAX) {
- dest[11] = MP_OBJ_NEW_QSTR(MP_QSTR_in_end);
- dest[12] = MP_OBJ_NEW_SMALL_INT(args[ARG_in_end].u_int);
+ dest[index++] = MP_OBJ_NEW_QSTR(MP_QSTR_in_end);
+ dest[index++] = MP_OBJ_NEW_SMALL_INT(args[ARG_in_end].u_int);
num_kws++;
}
diff --git a/shared-bindings/adafruit_bus_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/SPIDevice.c
index e127e39b8..e37f88368 100644
--- a/shared-bindings/adafruit_bus_device/SPIDevice.c
+++ b/shared-bindings/adafruit_bus_device/SPIDevice.c
@@ -34,6 +34,7 @@
#include "lib/utils/buffer_helper.h"
#include "lib/utils/context_manager_helpers.h"
+#include "py/objproperty.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
@@ -100,22 +101,51 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type
return (mp_obj_t)self;
}
+//| def __enter__(self) -> busio.SPI:
+//| """Starts a SPI transaction by configuring the SPI and asserting chip select."""
+//| ...
+//|
STATIC mp_obj_t adafruit_bus_device_spidevice_obj___enter__(mp_obj_t self_in) {
adafruit_bus_device_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in);
- common_hal_adafruit_bus_device_spidevice_enter(self);
- return self->spi;
+ return common_hal_adafruit_bus_device_spidevice_enter(self);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(adafruit_bus_device_spidevice___enter___obj, adafruit_bus_device_spidevice_obj___enter__);
+
+//| def __exit__(self) -> None:
+//| """Ends a SPI transaction by deasserting chip select. See
+//| :ref:`lifetime-and-contextmanagers` for more info."""
+//| ...
+//|
STATIC mp_obj_t adafruit_bus_device_spidevice_obj___exit__(size_t n_args, const mp_obj_t *args) {
common_hal_adafruit_bus_device_spidevice_exit(MP_OBJ_TO_PTR(args[0]));
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_spidevice___exit___obj, 4, 4, adafruit_bus_device_spidevice_obj___exit__);
+//| spi: busio.SPI
+//| """The underlying SPI bus. Useful for weird uses like clocking an SD card without chip select.
+//|
+//| You shouldn't normally need this."""
+//|
+STATIC mp_obj_t adafruit_bus_device_spidevice_obj_get_spi(mp_obj_t self_in) {
+ adafruit_bus_device_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ return common_hal_adafruit_bus_device_spidevice_get_spi(self);
+}
+MP_DEFINE_CONST_FUN_OBJ_1(adafruit_bus_device_spidevice_get_spi_obj, adafruit_bus_device_spidevice_obj_get_spi);
+
+const mp_obj_property_t adafruit_bus_device_spidevice_spi_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&adafruit_bus_device_spidevice_get_spi_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
STATIC const mp_rom_map_elem_t adafruit_bus_device_spidevice_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&adafruit_bus_device_spidevice___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&adafruit_bus_device_spidevice___exit___obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_spi), MP_ROM_PTR(&adafruit_bus_device_spidevice_spi_obj) },
};
STATIC MP_DEFINE_CONST_DICT(adafruit_bus_device_spidevice_locals_dict, adafruit_bus_device_spidevice_locals_dict_table);
diff --git a/shared-bindings/adafruit_bus_device/SPIDevice.h b/shared-bindings/adafruit_bus_device/SPIDevice.h
index 5596b157f..baa9ec464 100644
--- a/shared-bindings/adafruit_bus_device/SPIDevice.h
+++ b/shared-bindings/adafruit_bus_device/SPIDevice.h
@@ -44,7 +44,8 @@ extern const mp_obj_type_t adafruit_bus_device_spidevice_type;
// Initializes the hardware peripheral.
extern void common_hal_adafruit_bus_device_spidevice_construct(adafruit_bus_device_spidevice_obj_t *self, busio_spi_obj_t *spi, digitalio_digitalinout_obj_t *cs,
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t extra_clocks);
-extern void common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevice_obj_t *self);
+extern mp_obj_t common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevice_obj_t *self);
extern void common_hal_adafruit_bus_device_spidevice_exit(adafruit_bus_device_spidevice_obj_t *self);
+extern mp_obj_t common_hal_adafruit_bus_device_spidevice_get_spi(adafruit_bus_device_spidevice_obj_t *self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSDEVICE_SPIDEVICE_H
diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c
index 975f8b095..35d6c1497 100644
--- a/shared-bindings/sdcardio/SDCard.c
+++ b/shared-bindings/sdcardio/SDCard.c
@@ -55,6 +55,12 @@
//| Data transfers use the specified baurate (rounded down to one that is supported by
//| the microcontroller)
//|
+//| .. important::
+//| If the same SPI bus is shared with other peripherals, it is important that
+//| the SD card be initialized before accessing any other peripheral on the bus.
+//| Failure to do so can prevent the SD card from being recognized until it is
+//| powered off or re-inserted.
+//|
//| Example usage:
//|
//| .. code-block:: python
diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c
index 007417340..da827798c 100644
--- a/shared-bindings/socketpool/Socket.c
+++ b/shared-bindings/socketpool/Socket.c
@@ -3,8 +3,8 @@
*
* The MIT License (MIT)
*
- * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
- * 2018 Nick Moore for Adafruit Industries
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2021 Lucian Copeland 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
@@ -64,6 +64,25 @@ STATIC mp_obj_t socketpool_socket___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket___exit___obj, 4, 4, socketpool_socket___exit__);
+//| def accept(self) -> Tuple[Socket, Tuple[str, int]]:
+//| """Accept a connection on a listening socket of type SOCK_STREAM,
+//| creating a new socket of type SOCK_STREAM.
+//| Returns a tuple of (new_socket, remote_address)"""
+//|
+STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) {
+ socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ uint8_t ip[4];
+ uint32_t port;
+
+ socketpool_socket_obj_t * sock = common_hal_socketpool_socket_accept(self, ip, &port);
+
+ mp_obj_t tuple_contents[2];
+ tuple_contents[0] = MP_OBJ_FROM_PTR(sock);
+ tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
+ return mp_obj_new_tuple(2, tuple_contents);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, socketpool_socket_accept);
+
//| def bind(self, address: Tuple[str, int]) -> None:
//| """Bind a socket to an address
//|
@@ -79,8 +98,11 @@ STATIC mp_obj_t socketpool_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
size_t hostlen;
const char* host = mp_obj_str_get_data(addr_items[0], &hostlen);
mp_int_t port = mp_obj_get_int(addr_items[1]);
+ if (port < 0) {
+ mp_raise_ValueError(translate("port must be >= 0"));
+ }
- bool ok = common_hal_socketpool_socket_bind(self, host, hostlen, port);
+ bool ok = common_hal_socketpool_socket_bind(self, host, hostlen, (uint32_t)port);
if (!ok) {
mp_raise_ValueError(translate("Error: Failure to bind"));
}
@@ -89,41 +111,6 @@ STATIC mp_obj_t socketpool_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_bind_obj, socketpool_socket_bind);
-//| def listen(self, backlog: int) -> None:
-//| """Set socket to listen for incoming connections
-//|
-//| :param ~int backlog: length of backlog queue for waiting connetions"""
-//| ...
-//|
-STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog_in) {
- socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
- int backlog = mp_obj_get_int(backlog_in);
-
- common_hal_socketpool_socket_listen(self, backlog);
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket_listen);
-
-//| def accept(self) -> Tuple[Socket, Tuple[str, int]]:
-//| """Accept a connection on a listening socket of type SOCK_STREAM,
-//| creating a new socket of type SOCK_STREAM.
-//| Returns a tuple of (new_socket, remote_address)"""
-//|
-STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) {
- socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
- uint8_t ip[4];
- uint port;
-
- socketpool_socket_obj_t * sock = common_hal_socketpool_socket_accept(self, ip, &port);
-
- mp_obj_t tuple_contents[2];
- tuple_contents[0] = MP_OBJ_FROM_PTR(sock);
- tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
- return mp_obj_new_tuple(2, tuple_contents);
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, socketpool_socket_accept);
-
//| def close(self) -> None:
//| """Closes this Socket and makes its resources available to its SocketPool."""
//|
@@ -149,8 +136,11 @@ STATIC mp_obj_t socketpool_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
size_t hostlen;
const char* host = mp_obj_str_get_data(addr_items[0], &hostlen);
mp_int_t port = mp_obj_get_int(addr_items[1]);
+ if (port < 0) {
+ mp_raise_ValueError(translate("port must be >= 0"));
+ }
- bool ok = common_hal_socketpool_socket_connect(self, host, hostlen, port);
+ bool ok = common_hal_socketpool_socket_connect(self, host, hostlen, (uint32_t)port);
if (!ok) {
mp_raise_OSError(0);
}
@@ -159,31 +149,47 @@ STATIC mp_obj_t socketpool_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_connect_obj, socketpool_socket_connect);
-//| def send(self, bytes: ReadableBuffer) -> int:
-//| """Send some bytes to the connected remote address.
-//| Suits sockets of type SOCK_STREAM
+//| def listen(self, backlog: int) -> None:
+//| """Set socket to listen for incoming connections
//|
-//| :param ~bytes bytes: some bytes to send"""
+//| :param ~int backlog: length of backlog queue for waiting connetions"""
//| ...
//|
-STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog_in) {
+ socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ int backlog = mp_obj_get_int(backlog_in);
+
+ common_hal_socketpool_socket_listen(self, backlog);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket_listen);
+
+//| def recvfrom_into(self, buffer: WriteableBuffer) -> Tuple[int, Tuple[str, int]]:
+//| """Reads some bytes from a remote address.
+//|
+//| Returns a tuple containing
+//| * the number of bytes received into the given buffer
+//| * a remote_address, which is a tuple of ip address and port number
+//|
+//| :param object buffer: buffer to read into"""
+//| ...
+//|
+STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t data_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
- if (common_hal_socketpool_socket_get_closed(self)) {
- // Bad file number.
- mp_raise_OSError(MP_EBADF);
- }
- if (!common_hal_socketpool_socket_get_connected(self)) {
- mp_raise_BrokenPipeError();
- }
mp_buffer_info_t bufinfo;
- mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
- mp_int_t ret = common_hal_socketpool_socket_send(self, bufinfo.buf, bufinfo.len);
- if (ret == -1) {
- mp_raise_BrokenPipeError();
- }
- return mp_obj_new_int_from_uint(ret);
+ mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_WRITE);
+
+ byte ip[4];
+ mp_uint_t port;
+ mp_int_t ret = common_hal_socketpool_socket_recvfrom_into(self,
+ (byte*)bufinfo.buf, bufinfo.len, ip, &port);
+ mp_obj_t tuple_contents[2];
+ tuple_contents[0] = mp_obj_new_int_from_uint(ret);
+ tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
+ return mp_obj_new_tuple(2, tuple_contents);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_send);
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool_socket_recvfrom_into);
//| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int:
//| """Reads some bytes from the connected remote address, writing
@@ -199,7 +205,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_s
//| :param int bufsize: optionally, a maximum number of bytes to read."""
//| ...
//|
-
STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (common_hal_socketpool_socket_get_closed(self)) {
@@ -232,6 +237,32 @@ STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3, socketpool_socket_recv_into);
+//| def send(self, bytes: ReadableBuffer) -> int:
+//| """Send some bytes to the connected remote address.
+//| Suits sockets of type SOCK_STREAM
+//|
+//| :param ~bytes bytes: some bytes to send"""
+//| ...
+//|
+STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+ socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ if (common_hal_socketpool_socket_get_closed(self)) {
+ // Bad file number.
+ mp_raise_OSError(MP_EBADF);
+ }
+ if (!common_hal_socketpool_socket_get_connected(self)) {
+ mp_raise_BrokenPipeError();
+ }
+ mp_buffer_info_t bufinfo;
+ mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
+ mp_int_t ret = common_hal_socketpool_socket_send(self, bufinfo.buf, bufinfo.len);
+ if (ret == -1) {
+ mp_raise_BrokenPipeError();
+ }
+ return mp_obj_new_int_from_uint(ret);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_send);
+
//| def sendto(self, bytes: ReadableBuffer, address: Tuple[str, int]) -> int:
//| """Send some bytes to a specific address.
//| Suits sockets of type SOCK_DGRAM
@@ -240,7 +271,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
//| ...
//|
-
STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -254,8 +284,11 @@ STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_
size_t hostlen;
const char* host = mp_obj_str_get_data(addr_items[0], &hostlen);
mp_int_t port = mp_obj_get_int(addr_items[1]);
+ if (port < 0) {
+ mp_raise_ValueError(translate("port must be >= 0"));
+ }
- mp_int_t ret = common_hal_socketpool_socket_sendto(self, host, hostlen, port, bufinfo.buf, bufinfo.len);
+ mp_int_t ret = common_hal_socketpool_socket_sendto(self, host, hostlen, (uint32_t)port, bufinfo.buf, bufinfo.len);
if (!ret) {
mp_raise_OSError(0);
}
@@ -264,37 +297,28 @@ STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(socketpool_socket_sendto_obj, socketpool_socket_sendto);
-//| def recvfrom_into(self, buffer: WriteableBuffer) -> Tuple[int, Tuple[str, int]]:
-//| """Reads some bytes from a remote address.
-//|
-//| Returns a tuple containing
-//| * the number of bytes received into the given buffer
-//| * a remote_address, which is a tuple of ip address and port number
+//| def setblocking(self, flag: bool) -> Optional[int]:
+//| """Set the blocking behaviour of this socket.
//|
-//| :param object buffer: buffer to read into"""
+//| :param ~bool flag: False means non-blocking, True means block indefinitely."""
//| ...
//|
-STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t data_in) {
+// method socket.setblocking(flag)
+STATIC mp_obj_t socketpool_socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
- mp_buffer_info_t bufinfo;
- mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_WRITE);
-
- byte ip[4];
- mp_uint_t port;
- mp_int_t ret = common_hal_socketpool_socket_recvfrom_into(self,
- (byte*)bufinfo.buf, bufinfo.len, ip, &port);
- mp_obj_t tuple_contents[2];
- tuple_contents[0] = mp_obj_new_int_from_uint(ret);
- tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
- return mp_obj_new_tuple(2, tuple_contents);
+ if (mp_obj_is_true(blocking)) {
+ common_hal_socketpool_socket_settimeout(self, -1);
+ } else {
+ common_hal_socketpool_socket_settimeout(self, 0);
+ }
+ return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool_socket_recvfrom_into);
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_setblocking_obj, socketpool_socket_setblocking);
// //| def setsockopt(self, level: int, optname: int, value: int) -> None:
// //| """Sets socket options"""
// //| ...
// //|
-
// STATIC mp_obj_t socketpool_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
@@ -324,13 +348,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, 4, socketpool_socket_setsockopt);
+
//| def settimeout(self, value: int) -> None:
//| """Set the timeout value for this socket.
//|
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
//| ...
//|
-
STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t timeout_ms;
@@ -348,24 +372,6 @@ STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_settimeout_obj, socketpool_socket_settimeout);
-// //| def setblocking(self, flag: bool) -> Optional[int]:
-// //| """Set the blocking behaviour of this socket.
-// //|
-// //| :param ~bool flag: False means non-blocking, True means block indefinitely."""
-// //| ...
-// //|
-
-// // method socket.setblocking(flag)
-// STATIC mp_obj_t socketpool_socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
-// // if (mp_obj_is_true(blocking)) {
-// // return socket_settimeout(self_in, mp_const_none);
-// // } else {
-// // return socket_settimeout(self_in, MP_OBJ_NEW_SMALL_INT(0));
-// // }
-// return mp_const_none;
-// }
-// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_setblocking_obj, socketpool_socket_setblocking);
-
//| def __hash__(self) -> int:
//| """Returns a hash for the Socket."""
//| ...
@@ -373,7 +379,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_settimeout_obj, socketpool_so
STATIC mp_obj_t socketpool_socket_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
switch (op) {
case MP_UNARY_OP_HASH: {
- return MP_OBJ_NEW_SMALL_INT(common_hal_socketpool_socket_get_hash(MP_OBJ_TO_PTR(self_in)));
+ return mp_obj_id(self_in);
}
default:
return MP_OBJ_NULL; // op not supported
@@ -384,19 +390,19 @@ STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&socketpool_socket___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&socketpool_socket_close_obj) },
- { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&socketpool_socket_close_obj) },
- { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socketpool_socket_bind_obj) },
- { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socketpool_socket_listen_obj) },
{ MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socketpool_socket_accept_obj) },
+ { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socketpool_socket_bind_obj) },
+ { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&socketpool_socket_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&socketpool_socket_connect_obj) },
- { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socketpool_socket_send_obj) },
- { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socketpool_socket_listen_obj) },
{ MP_ROM_QSTR(MP_QSTR_recvfrom_into), MP_ROM_PTR(&socketpool_socket_recvfrom_into_obj) },
{ MP_ROM_QSTR(MP_QSTR_recv_into), MP_ROM_PTR(&socketpool_socket_recv_into_obj) },
+ { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socketpool_socket_send_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socketpool_socket_setblocking_obj) },
// { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) },
{ MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socketpool_socket_settimeout_obj) },
- // { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socketpool_socket_setblocking_obj) },
};
STATIC MP_DEFINE_CONST_DICT(socketpool_socket_locals_dict, socketpool_socket_locals_dict_table);
diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h
index b5dceb50f..27173c8b3 100644
--- a/shared-bindings/socketpool/Socket.h
+++ b/shared-bindings/socketpool/Socket.h
@@ -31,22 +31,20 @@
extern const mp_obj_type_t socketpool_socket_type;
-void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms);
-
-bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint8_t port);
-bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog);
-socketpool_socket_obj_t * common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint *port);
-
-bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port);
-mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
-mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
-mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t* self,
- const char* host, size_t hostlen, uint8_t port, const uint8_t* buf, mp_uint_t len);
-mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self,
- uint8_t* buf, mp_uint_t len, uint8_t* ip, uint *port);
+socketpool_socket_obj_t * common_hal_socketpool_socket_accept(socketpool_socket_obj_t* self, uint8_t* ip, uint32_t *port);
+bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint32_t port);
void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self);
+bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, uint32_t port);
bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self);
bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self);
-mp_uint_t common_hal_socketpool_socket_get_hash(socketpool_socket_obj_t* self);
+mp_uint_t common_hal_socketpool_socket_get_timeout(socketpool_socket_obj_t* self);
+bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t* self, int backlog);
+mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* self,
+ uint8_t* buf, uint32_t len, uint8_t* ip, uint32_t *port);
+mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, uint32_t len);
+mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, uint32_t len);
+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);
+void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, uint32_t timeout_ms);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H
diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c
index 8f4069faa..6ff6d5f98 100644
--- a/shared-bindings/socketpool/SocketPool.c
+++ b/shared-bindings/socketpool/SocketPool.c
@@ -3,8 +3,7 @@
*
* The MIT License (MIT)
*
- * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
- * 2018 Nick Moore for Adafruit Industries
+ * Copyright (c) 2020 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
diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c
index 9d4df7261..44e9e6bbf 100644
--- a/shared-bindings/ssl/SSLContext.c
+++ b/shared-bindings/ssl/SSLContext.c
@@ -51,7 +51,7 @@ STATIC mp_obj_t ssl_sslcontext_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(s);
}
-//| def wrap_socket(sock: socketpool.Socket, *, server_side: bool = False, server_hostname: Optional[str] = None) -> socketpool.Socket:
+//| def wrap_socket(sock: socketpool.Socket, *, server_side: bool = False, server_hostname: Optional[str] = None) -> ssl.SSLSocket:
//| """Wraps the socket into a socket-compatible class that handles SSL negotiation.
//| The socket must be of type SOCK_STREAM."""
//| ...
diff --git a/shared-bindings/ssl/SSLContext.h b/shared-bindings/ssl/SSLContext.h
index f7f985af7..ad4d7e6a8 100644
--- a/shared-bindings/ssl/SSLContext.h
+++ b/shared-bindings/ssl/SSLContext.h
@@ -30,12 +30,13 @@
#include "common-hal/ssl/SSLContext.h"
#include "shared-bindings/socketpool/Socket.h"
+#include "shared-bindings/ssl/SSLSocket.h"
extern const mp_obj_type_t ssl_sslcontext_type;
void common_hal_ssl_sslcontext_construct(ssl_sslcontext_obj_t* self);
-socketpool_socket_obj_t* common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t* self,
+ssl_sslsocket_obj_t* common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t* self,
socketpool_socket_obj_t* sock, bool server_side, const char* server_hostname);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SSL_SSLCONTEXT_H
diff --git a/shared-bindings/ssl/SSLSocket.c b/shared-bindings/ssl/SSLSocket.c
new file mode 100644
index 000000000..0daa930ef
--- /dev/null
+++ b/shared-bindings/ssl/SSLSocket.c
@@ -0,0 +1,326 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2021 Lucian Copeland 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 "shared-bindings/ssl/SSLSocket.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include "lib/utils/context_manager_helpers.h"
+#include "py/objtuple.h"
+#include "py/objlist.h"
+#include "py/runtime.h"
+#include "py/mperrno.h"
+
+#include "lib/netutils/netutils.h"
+
+//| class SSLSocket:
+//| """Implements TLS security on a subset of `socketpool.Socket` functions. Cannot be created
+//| directly. Instead, call `wrap_socket` on an existing socket object.
+//|
+//| Provides a subset of CPython's `ssl.SSLSocket` API. It only implements the versions of
+//| recv that do not allocate bytes objects."""
+//|
+
+//| def __enter__(self) -> SSLSocket:
+//| """No-op used by Context Managers."""
+//| ...
+//|
+// Provided by context manager helper.
+
+//| def __exit__(self) -> None:
+//| """Automatically closes the Socket when exiting a context. See
+//| :ref:`lifetime-and-contextmanagers` for more info."""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket___exit__(size_t n_args, const mp_obj_t *args) {
+ (void)n_args;
+ common_hal_ssl_sslsocket_close(args[0]);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ssl_sslsocket___exit___obj, 4, 4, ssl_sslsocket___exit__);
+
+//| def accept(self) -> Tuple[SSLSocket, Tuple[str, int]]:
+//| """Accept a connection on a listening socket of type SOCK_STREAM,
+//| creating a new socket of type SOCK_STREAM.
+//| Returns a tuple of (new_socket, remote_address)"""
+//|
+STATIC mp_obj_t ssl_sslsocket_accept(mp_obj_t self_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ uint8_t ip[4];
+ uint32_t port;
+
+ ssl_sslsocket_obj_t * sslsock = common_hal_ssl_sslsocket_accept(self, ip, &port);
+
+ mp_obj_t tuple_contents[2];
+ tuple_contents[0] = MP_OBJ_FROM_PTR(sslsock);
+ tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
+ return mp_obj_new_tuple(2, tuple_contents);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(ssl_sslsocket_accept_obj, ssl_sslsocket_accept);
+
+//| def bind(self, address: Tuple[str, int]) -> None:
+//| """Bind a socket to an address
+//|
+//| :param ~tuple address: tuple of (remote_address, remote_port)"""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ mp_obj_t *addr_items;
+ mp_obj_get_array_fixed_n(addr_in, 2, &addr_items);
+
+ size_t hostlen;
+ const char* host = mp_obj_str_get_data(addr_items[0], &hostlen);
+ mp_int_t port = mp_obj_get_int(addr_items[1]);
+ if (port < 0) {
+ mp_raise_ValueError(translate("port must be >= 0"));
+ }
+
+ bool ok = common_hal_ssl_sslsocket_bind(self, host, hostlen, (uint32_t)port);
+ if (!ok) {
+ mp_raise_ValueError(translate("Error: Failure to bind"));
+ }
+
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_bind_obj, ssl_sslsocket_bind);
+
+//| def close(self) -> None:
+//| """Closes this Socket"""
+//|
+STATIC mp_obj_t ssl_sslsocket_close(mp_obj_t self_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ common_hal_ssl_sslsocket_close(self);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(ssl_sslsocket_close_obj, ssl_sslsocket_close);
+
+//| def connect(self, address: Tuple[str, int]) -> None:
+//| """Connect a socket to a remote address
+//|
+//| :param ~tuple address: tuple of (remote_address, remote_port)"""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ mp_obj_t *addr_items;
+ mp_obj_get_array_fixed_n(addr_in, 2, &addr_items);
+
+ size_t hostlen;
+ const char* host = mp_obj_str_get_data(addr_items[0], &hostlen);
+ mp_int_t port = mp_obj_get_int(addr_items[1]);
+ if (port < 0) {
+ mp_raise_ValueError(translate("port must be >= 0"));
+ }
+
+ bool ok = common_hal_ssl_sslsocket_connect(self, host, hostlen, (uint32_t)port);
+ if (!ok) {
+ mp_raise_OSError(0);
+ }
+
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_connect_obj, ssl_sslsocket_connect);
+
+//| def listen(self, backlog: int) -> None:
+//| """Set socket to listen for incoming connections
+//|
+//| :param ~int backlog: length of backlog queue for waiting connetions"""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_listen(mp_obj_t self_in, mp_obj_t backlog_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ int backlog = mp_obj_get_int(backlog_in);
+
+ common_hal_ssl_sslsocket_listen(self, backlog);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_listen_obj, ssl_sslsocket_listen);
+
+//| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int:
+//| """Reads some bytes from the connected remote address, writing
+//| into the provided buffer. If bufsize <= len(buffer) is given,
+//| a maximum of bufsize bytes will be read into the buffer. If no
+//| valid value is given for bufsize, the default is the length of
+//| the given buffer.
+//|
+//| Suits sockets of type SOCK_STREAM
+//| Returns an int of number of bytes read.
+//|
+//| :param bytearray buffer: buffer to receive into
+//| :param int bufsize: optionally, a maximum number of bytes to read."""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_recv_into(size_t n_args, const mp_obj_t *args) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
+ if (common_hal_ssl_sslsocket_get_closed(self)) {
+ // Bad file number.
+ mp_raise_OSError(MP_EBADF);
+ }
+ // if (!common_hal_ssl_sslsocket_get_connected(self)) {
+ // // not connected
+ // mp_raise_OSError(MP_ENOTCONN);
+ // }
+ mp_buffer_info_t bufinfo;
+ mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE);
+ mp_int_t len = bufinfo.len;
+ if (n_args == 3) {
+ mp_int_t given_len = mp_obj_get_int(args[2]);
+ if (given_len > len) {
+ mp_raise_ValueError(translate("buffer too small for requested bytes"));
+ }
+ if (given_len > 0 && given_len < len) {
+ len = given_len;
+ }
+ }
+
+ if (len == 0) {
+ return MP_OBJ_NEW_SMALL_INT(0);
+ }
+
+ mp_int_t ret = common_hal_ssl_sslsocket_recv_into(self, (byte*)bufinfo.buf, len);
+ return mp_obj_new_int_from_uint(ret);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ssl_sslsocket_recv_into_obj, 2, 3, ssl_sslsocket_recv_into);
+
+//| def send(self, bytes: ReadableBuffer) -> int:
+//| """Send some bytes to the connected remote address.
+//| Suits sockets of type SOCK_STREAM
+//|
+//| :param ~bytes bytes: some bytes to send"""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ if (common_hal_ssl_sslsocket_get_closed(self)) {
+ // Bad file number.
+ mp_raise_OSError(MP_EBADF);
+ }
+ if (!common_hal_ssl_sslsocket_get_connected(self)) {
+ mp_raise_BrokenPipeError();
+ }
+ mp_buffer_info_t bufinfo;
+ mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
+ mp_int_t ret = common_hal_ssl_sslsocket_send(self, bufinfo.buf, bufinfo.len);
+ if (ret == -1) {
+ mp_raise_BrokenPipeError();
+ }
+ return mp_obj_new_int_from_uint(ret);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send);
+
+// //| def setsockopt(self, level: int, optname: int, value: int) -> None:
+// //| """Sets socket options"""
+// //| ...
+// //|
+// STATIC mp_obj_t ssl_sslsocket_setsockopt(size_t n_args, const mp_obj_t *args) {
+// }
+// STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ssl_sslsocket_setsockopt_obj, 4, 4, ssl_sslsocket_setsockopt);
+
+//| def settimeout(self, value: int) -> None:
+//| """Set the timeout value for this socket.
+//|
+//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ mp_uint_t timeout_ms;
+ if (timeout_in == mp_const_none) {
+ timeout_ms = -1;
+ } else {
+ #if MICROPY_PY_BUILTINS_FLOAT
+ timeout_ms = 1000 * mp_obj_get_float(timeout_in);
+ #else
+ timeout_ms = 1000 * mp_obj_get_int(timeout_in);
+ #endif
+ }
+ common_hal_ssl_sslsocket_settimeout(self, timeout_ms);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_settimeout_obj, ssl_sslsocket_settimeout);
+
+//| def setblocking(self, flag: bool) -> Optional[int]:
+//| """Set the blocking behaviour of this socket.
+//|
+//| :param ~bool flag: False means non-blocking, True means block indefinitely."""
+//| ...
+//|
+// method socket.setblocking(flag)
+STATIC mp_obj_t ssl_sslsocket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
+ ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ if (mp_obj_is_true(blocking)) {
+ common_hal_ssl_sslsocket_settimeout(self, -1);
+ } else {
+ common_hal_ssl_sslsocket_settimeout(self, 0);
+ }
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_setblocking_obj, ssl_sslsocket_setblocking);
+
+//| def __hash__(self) -> int:
+//| """Returns a hash for the Socket."""
+//| ...
+//|
+STATIC mp_obj_t ssl_sslsocket_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+ switch (op) {
+ case MP_UNARY_OP_HASH: {
+ return mp_obj_id(self_in);
+ }
+ default:
+ return MP_OBJ_NULL; // op not supported
+ }
+}
+
+STATIC const mp_rom_map_elem_t ssl_sslsocket_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
+ { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&ssl_sslsocket___exit___obj) },
+ { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&ssl_sslsocket_close_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&ssl_sslsocket_accept_obj) },
+ { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&ssl_sslsocket_bind_obj) },
+ { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&ssl_sslsocket_close_obj) },
+ { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&ssl_sslsocket_connect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&ssl_sslsocket_listen_obj) },
+ { MP_ROM_QSTR(MP_QSTR_recv_into), MP_ROM_PTR(&ssl_sslsocket_recv_into_obj) },
+ { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&ssl_sslsocket_send_obj) },
+ { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&ssl_sslsocket_setblocking_obj) },
+ // { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&ssl_sslsocket_setsockopt_obj) },
+ { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&ssl_sslsocket_settimeout_obj) },
+};
+
+STATIC MP_DEFINE_CONST_DICT(ssl_sslsocket_locals_dict, ssl_sslsocket_locals_dict_table);
+
+const mp_obj_type_t ssl_sslsocket_type = {
+ { &mp_type_type },
+ .name = MP_QSTR_SSLSocket,
+ .locals_dict = (mp_obj_dict_t*)&ssl_sslsocket_locals_dict,
+ .unary_op = ssl_sslsocket_unary_op,
+};
diff --git a/shared-bindings/ssl/SSLSocket.h b/shared-bindings/ssl/SSLSocket.h
new file mode 100644
index 000000000..d117e5dca
--- /dev/null
+++ b/shared-bindings/ssl/SSLSocket.h
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SSL_SSLSOCKET_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_SSL_SSLSOCKET_H
+
+#include "common-hal/ssl/SSLSocket.h"
+
+extern const mp_obj_type_t ssl_sslsocket_type;
+
+ssl_sslsocket_obj_t * common_hal_ssl_sslsocket_accept(ssl_sslsocket_obj_t* self, uint8_t* ip, uint32_t *port);
+bool common_hal_ssl_sslsocket_bind(ssl_sslsocket_obj_t* self, const char* host, size_t hostlen, uint32_t port);
+void common_hal_ssl_sslsocket_close(ssl_sslsocket_obj_t* self);
+bool common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t* self, const char* host, size_t hostlen, uint32_t port);
+bool common_hal_ssl_sslsocket_get_closed(ssl_sslsocket_obj_t* self);
+bool common_hal_ssl_sslsocket_get_connected(ssl_sslsocket_obj_t* self);
+bool common_hal_ssl_sslsocket_listen(ssl_sslsocket_obj_t* self, int backlog);
+mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t* self, const uint8_t* buf, uint32_t len);
+mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t* self, const uint8_t* buf, uint32_t len);
+void common_hal_ssl_sslsocket_settimeout(ssl_sslsocket_obj_t* self, uint32_t timeout_ms);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SSL_SSLSOCKET_H
diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c
index cfda620bc..283c8a1d6 100755
--- a/shared-bindings/supervisor/Runtime.c
+++ b/shared-bindings/supervisor/Runtime.c
@@ -60,27 +60,6 @@ STATIC mp_obj_t supervisor_runtime_get_serial_connected(mp_obj_t self){
}
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial_connected_obj, supervisor_runtime_get_serial_connected);
-//| serial2: io.BytesIO
-//| """Returns the USB secondary serial communication channel.
-//| Raises `NotImplementedError` if it does not exist.
-//| """
-//|
-STATIC mp_obj_t supervisor_runtime_get_serial2(mp_obj_t self){
-#if CIRCUITPY_USB_SERIAL2
- return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial2());
-#else
- mp_raise_NotImplementedError(translate("serial2 not available"));
-#endif
-}
-MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial2_obj, supervisor_runtime_get_serial2);
-
-const mp_obj_property_t supervisor_runtime_serial2_connected_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&supervisor_runtime_get_serial2_connected_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
const mp_obj_property_t supervisor_runtime_serial_connected_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&supervisor_runtime_get_serial_connected_obj,
@@ -88,27 +67,6 @@ const mp_obj_property_t supervisor_runtime_serial_connected_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| serial2_connected: bool
-//| """Returns the USB secondary serial communication status (read-only).
-//| Raises `NotImplementedError` if there is no secondary serial channel.
-//| """
-//|
-STATIC mp_obj_t supervisor_runtime_get_serial2_connected(mp_obj_t self){
-#if CIRCUITPY_USB_SERIAL2
- return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial2_connected());
-#else
- mp_raise_NotImplementedError(translate("serial2 not available"));
-#endif
-}
-MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial2_connected_obj, supervisor_runtime_get_serial2_connected);
-
-const mp_obj_property_t supervisor_runtime_serial2_connected_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&supervisor_runtime_get_serial2_connected_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
//| serial_bytes_available: int
//| """Returns the whether any bytes are available to read
//| on the USB serial input. Allows for polling to see whether
@@ -126,30 +84,6 @@ const mp_obj_property_t supervisor_runtime_serial_bytes_available_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-
-//| serial2_bytes_available: int
-//| """Returns the whether any bytes are available to read
-//| on the secondary USB serial input (read-only).
-//| Raises `NotImplementedError` if there is no secondary serial input.
-//| """
-//|
-STATIC mp_obj_t supervisor_runtime_get_serial2_bytes_available(mp_obj_t self){
-#if CIRCUITPY_USB_SERIAL2
- return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial2_bytes_available());
-#else
- mp_raise_NotImplementedError(translate("serial2 not available"));
-#endif
-}
-MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial2_bytes_available_obj, supervisor_runtime_get_serial2_bytes_available);
-
-const mp_obj_property_t supervisor_runtime_serial2_bytes_available_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&supervisor_runtime_get_serial2_bytes_available_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-
//| run_reason: RunReason
//| """Returns why CircuitPython started running this particular time."""
//|
@@ -165,15 +99,13 @@ const mp_obj_property_t supervisor_runtime_run_reason_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-void supervisor_runtime_set_run_reason(supervisor_runtime_run_reason_t run_reason) {
+void supervisor_set_run_reason(supervisor_run_reason_t run_reason) {
_run_reason = run_reason;
}
STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_runtime_serial_connected_obj) },
- { MP_ROM_QSTR(MP_QSTR_serial2_connected), MP_ROM_PTR(&supervisor_runtime_serial2_connected_obj) },
{ MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_runtime_serial_bytes_available_obj) },
- { MP_ROM_QSTR(MP_QSTR_serial2_bytes_available), MP_ROM_PTR(&supervisor_runtime_serial2_bytes_available_obj) },
{ MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_runtime_run_reason_obj) },
};
diff --git a/shared-module/adafruit_bus_device/SPIDevice.c b/shared-module/adafruit_bus_device/SPIDevice.c
index e489fc7c0..5c1a69b12 100644
--- a/shared-module/adafruit_bus_device/SPIDevice.c
+++ b/shared-module/adafruit_bus_device/SPIDevice.c
@@ -41,7 +41,7 @@ void common_hal_adafruit_bus_device_spidevice_construct(adafruit_bus_device_spid
self->chip_select = cs;
}
-void common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevice_obj_t *self) {
+mp_obj_t common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevice_obj_t *self) {
bool success = false;
while (!success) {
success = common_hal_busio_spi_try_lock(self->spi);
@@ -54,6 +54,7 @@ void common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spidevic
if (self->chip_select != MP_OBJ_NULL) {
common_hal_digitalio_digitalinout_set_value(MP_OBJ_TO_PTR(self->chip_select), false);
}
+ return self->spi;
}
void common_hal_adafruit_bus_device_spidevice_exit(adafruit_bus_device_spidevice_obj_t *self) {
@@ -83,3 +84,7 @@ void common_hal_adafruit_bus_device_spidevice_exit(adafruit_bus_device_spidevice
common_hal_busio_spi_unlock(self->spi);
}
+
+mp_obj_t common_hal_adafruit_bus_device_spidevice_get_spi(adafruit_bus_device_spidevice_obj_t *self) {
+ return self->spi;
+}
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c
index 288c9a4df..68a0a9667 100644
--- a/supervisor/shared/background_callback.c
+++ b/supervisor/shared/background_callback.c
@@ -33,7 +33,7 @@
#include "supervisor/shared/tick.h"
#include "shared-bindings/microcontroller/__init__.h"
-STATIC volatile background_callback_t *callback_head, *callback_tail;
+STATIC volatile background_callback_t * volatile callback_head, * volatile callback_tail;
#define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts())
#define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts())
@@ -50,7 +50,6 @@ void background_callback_add_core(background_callback_t *cb) {
cb->prev = (background_callback_t*)callback_tail;
if (callback_tail) {
callback_tail->next = cb;
- cb->prev = (background_callback_t*)callback_tail;
}
if (!callback_head) {
callback_head = cb;
diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c
index 6199af379..40151cbf6 100644
--- a/supervisor/shared/serial.c
+++ b/supervisor/shared/serial.c
@@ -47,6 +47,10 @@ busio_uart_obj_t debug_uart;
byte buf_array[64];
#endif
+#if CIRCUITPY_USB_VENDOR
+bool tud_vendor_connected(void);
+#endif
+
void serial_early_init(void) {
#if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX)
debug_uart.base.type = &busio_uart_type;
@@ -66,6 +70,12 @@ void serial_init(void) {
}
bool serial_connected(void) {
+#if CIRCUITPY_USB_VENDOR
+ if (tud_vendor_connected()) {
+ return true;
+ }
+#endif
+
#if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX)
return true;
#else
@@ -74,6 +84,14 @@ bool serial_connected(void) {
}
char serial_read(void) {
+#if CIRCUITPY_USB_VENDOR
+ if (tud_vendor_connected() && tud_vendor_available() > 0) {
+ char tiny_buffer;
+ tud_vendor_read(&tiny_buffer, 1);
+ return tiny_buffer;
+ }
+#endif
+
#if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX)
if (tud_cdc_connected() && tud_cdc_available() > 0) {
return (char) tud_cdc_read_char();
@@ -88,6 +106,12 @@ char serial_read(void) {
}
bool serial_bytes_available(void) {
+#if CIRCUITPY_USB_VENDOR
+ if (tud_vendor_connected() && tud_vendor_available() > 0) {
+ return true;
+ }
+#endif
+
#if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX)
return common_hal_busio_uart_rx_characters_available(&debug_uart) || (tud_cdc_available() > 0);
#else
@@ -103,6 +127,12 @@ void serial_write_substring(const char* text, uint32_t length) {
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
#endif
+#if CIRCUITPY_USB_VENDOR
+ if (tud_vendor_connected()) {
+ tud_vendor_write(text, length);
+ }
+#endif
+
uint32_t count = 0;
while (count < length && tud_cdc_connected()) {
count += tud_cdc_write(text + count, length - count);
diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h
index 0e70367d0..bff7bd6b5 100644
--- a/supervisor/shared/usb/tusb_config.h
+++ b/supervisor/shared/usb/tusb_config.h
@@ -73,6 +73,7 @@
#define CFG_TUD_MSC 1
#define CFG_TUD_HID CIRCUITPY_USB_HID
#define CFG_TUD_MIDI CIRCUITPY_USB_MIDI
+#define CFG_TUD_VENDOR CIRCUITPY_USB_VENDOR
#define CFG_TUD_CUSTOM_CLASS 0
/*------------------------------------------------------------------*/
diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c
index 07c6aee6c..43564d5d5 100644
--- a/supervisor/shared/usb/usb.c
+++ b/supervisor/shared/usb/usb.c
@@ -37,6 +37,19 @@
#include "tusb.h"
+#if CIRCUITPY_USB_VENDOR
+#include "genhdr/autogen_usb_descriptor.h"
+
+// The WebUSB support being conditionally added to this file is based on the
+// tinyusb demo examples/device/webusb_serial.
+
+extern const tusb_desc_webusb_url_t desc_webusb_url;
+
+static bool web_serial_connected = false;
+#endif
+
+
+
// Serial number as hex characters. This writes directly to the USB
// descriptor.
extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2];
@@ -98,9 +111,14 @@ static void usb_background_do(void* unused) {
usb_background();
}
+void usb_background_schedule(void)
+{
+ background_callback_add(&usb_callback, usb_background_do, NULL);
+}
+
void usb_irq_handler(void) {
tud_int_handler(0);
- background_callback_add(&usb_callback, usb_background_do, NULL);
+ usb_background_schedule();
}
//--------------------------------------------------------------------+
@@ -145,6 +163,62 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
}
}
+#if CIRCUITPY_USB_VENDOR
+//--------------------------------------------------------------------+
+// WebUSB use vendor class
+//--------------------------------------------------------------------+
+
+bool tud_vendor_connected(void)
+{
+ return web_serial_connected;
+}
+
+// Invoked when a control transfer occurred on an interface of this class
+// Driver response accordingly to the request and the transfer stage (setup/data/ack)
+// return false to stall control endpoint (e.g unsupported request)
+bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request)
+{
+ // nothing to with DATA & ACK stage
+ if (stage != CONTROL_STAGE_SETUP ) return true;
+
+ switch (request->bRequest)
+ {
+ case VENDOR_REQUEST_WEBUSB:
+ // match vendor request in BOS descriptor
+ // Get landing page url
+ return tud_control_xfer(rhport, request, (void*) &desc_webusb_url, desc_webusb_url.bLength);
+
+ case VENDOR_REQUEST_MICROSOFT:
+ if ( request->wIndex == 7 )
+ {
+ // Get Microsoft OS 2.0 compatible descriptor
+ uint16_t total_len;
+ memcpy(&total_len, desc_ms_os_20+8, 2);
+
+ return tud_control_xfer(rhport, request, (void*) desc_ms_os_20, total_len);
+ } else
+ {
+ return false;
+ }
+
+ case 0x22:
+ // Webserial simulate the CDC_REQUEST_SET_CONTROL_LINE_STATE (0x22) to
+ // connect and disconnect.
+ web_serial_connected = (request->wValue != 0);
+
+ // response with status OK
+ return tud_control_status(rhport, request);
+
+ default:
+ // stall unknown request
+ return false;
+ }
+
+ return true;
+}
+#endif CIRCUITPY_USB_VENDOR
+
+
#if MICROPY_KBD_EXCEPTION
/**
diff --git a/supervisor/shared/usb/usb_desc.c b/supervisor/shared/usb/usb_desc.c
index 080187ebc..419a70ab3 100644
--- a/supervisor/shared/usb/usb_desc.c
+++ b/supervisor/shared/usb/usb_desc.c
@@ -43,12 +43,14 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index) {
return usb_desc_cfg;
}
+#if CIRCUITPY_USB_HID
// Invoked when received GET HID REPORT DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_hid_descriptor_report_cb(void) {
return hid_report_descriptor;
}
+#endif
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk
index 8fd32fa0b..b36b9bc00 100644
--- a/supervisor/supervisor.mk
+++ b/supervisor/supervisor.mk
@@ -22,7 +22,7 @@ CFLAGS += -DINTERNAL_FLASH_FILESYSTEM=$(INTERNAL_FLASH_FILESYSTEM)
QSPI_FLASH_FILESYSTEM ?= 0
CFLAGS += -DQSPI_FLASH_FILESYSTEM=$(QSPI_FLASH_FILESYSTEM)
-SPI_FLASH_FILESYSTEM = 0
+SPI_FLASH_FILESYSTEM ?= 0
CFLAGS += -DSPI_FLASH_FILESYSTEM=$(SPI_FLASH_FILESYSTEM)
ifeq ($(CIRCUITPY_BLEIO),1)
@@ -94,6 +94,11 @@ else
shared-module/usb_midi/PortOut.c
endif
+ ifeq ($(CIRCUITPY_USB_VENDOR), 1)
+ SRC_SUPERVISOR += \
+ lib/tinyusb/src/class/vendor/vendor_device.c
+ endif
+
CFLAGS += -DUSB_AVAILABLE
endif
@@ -117,10 +122,10 @@ CFLAGS += -DUSB_MANUFACTURER=$(USB_MANUFACTURER)
CFLAGS += -DUSB_PRODUCT=$(USB_PRODUCT)
endif
-USB_DEVICES =
-ifeq ($(CIRCUITPY_USB_HID),1)
-USB_DEVICES += HID
-endif
+# In the following URL, don't include the https:// prefix.
+# It gets added automatically.
+USB_WEBUSB_URL ?= "circuitpython.org"
+
ifeq ($(CIRCUITPY_USB_MIDI),1)
USB_DEVICES += AUDIO
endif
@@ -135,6 +140,9 @@ ifeq ($(CIRCUITPY_USB_SERIAL2),1)
CFLAGS += -DCFG_TUD_CDC=2
USB_DEVICES += CDC2
endif
+ifeq ($(CIRCUITPY_USB_VENDOR),1)
+USB_DEVICES += VENDOR
+endif
USB_HID_DEVICES =
ifeq ($(CIRCUITPY_USB_HID_CONSUMER),1)
@@ -163,7 +171,7 @@ endif
ifeq ($(CIRCUITPY_USB_HID_RAW),1)
ifneq ($(CIRCUITPY_USB_HID_DEVICES,)
$(error HID RAW must not be combined with other HID devices)
- endif
+endif
USB_HID_DEVICES += MOUSE
endif
@@ -202,6 +210,12 @@ USB_DESCRIPTOR_ARGS = \
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
+ifeq ($(CIRCUITPY_USB_VENDOR), 1)
+USB_DESCRIPTOR_ARGS += \
+ --vendor_ep_num_out 0 --vendor_ep_num_in 0 \
+ --webusb_url $(USB_WEBUSB_URL)
+endif
+
ifeq ($(USB_RENUMBER_ENDPOINTS), 0)
USB_DESCRIPTOR_ARGS += --no-renumber_endpoints
endif
diff --git a/supervisor/usb.h b/supervisor/usb.h
index ccb35470c..1c709926a 100644
--- a/supervisor/usb.h
+++ b/supervisor/usb.h
@@ -35,6 +35,9 @@
// it may be necessary to call it directly.
void usb_background(void);
+// Schedule usb background
+void usb_background_schedule(void);
+
// Ports must call this from their particular USB IRQ handler
void usb_irq_handler(void);
diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py
index 6657b6a27..141e6ee2a 100644
--- a/tools/gen_display_resources.py
+++ b/tools/gen_display_resources.py
@@ -8,8 +8,8 @@ import os
import struct
import sys
-sys.path.append("bitmap_font")
-sys.path.append("../../tools/bitmap_font")
+sys.path.insert(0, "bitmap_font")
+sys.path.insert(0, "../../tools/bitmap_font")
from adafruit_bitmap_font import bitmap_font
diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py
index 199cdf9cf..b056f853a 100644
--- a/tools/gen_usb_descriptor.py
+++ b/tools/gen_usb_descriptor.py
@@ -13,7 +13,7 @@ from adafruit_usb_descriptor import audio, audio10, cdc, hid, midi, msc, standar
import hid_report_descriptors
DEFAULT_INTERFACE_NAME = "CircuitPython"
-ALL_DEVICES = "CDC CDC2 MSC AUDIO HID"
+ALL_DEVICES = "CDC CDC2 MSC AUDIO HID VENDOR"
ALL_DEVICES_SET = frozenset(ALL_DEVICES.split())
DEFAULT_DEVICES = "CDC MSC AUDIO HID"
@@ -24,6 +24,11 @@ ALL_HID_DEVICES_SET = frozenset(ALL_HID_DEVICES.split())
# Digitizer works on Linux but conflicts with mouse, so omit it.
DEFAULT_HID_DEVICES = "KEYBOARD MOUSE CONSUMER GAMEPAD"
+# In the following URL, don't include the https:// because that prefix gets added automatically
+DEFAULT_WEBUSB_URL = (
+ "circuitpython.org" # In the future, this may become a specific landing page
+)
+
parser = argparse.ArgumentParser(description="Generate USB descriptors.")
parser.add_argument(
"--highspeed",
@@ -99,6 +104,18 @@ parser.add_argument(
"--max_ep", type=int, default=0, help="total number of endpoints available"
)
parser.add_argument(
+ "--webusb_url",
+ type=str,
+ help="The URL to include in the WebUSB URL Descriptor",
+ default=DEFAULT_WEBUSB_URL,
+)
+parser.add_argument(
+ "--vendor_ep_num_out", type=int, default=0, help="endpoint number of VENDOR OUT"
+)
+parser.add_argument(
+ "--vendor_ep_num_in", type=int, default=0, help="endpoint number of VENDOR IN"
+)
+parser.add_argument(
"--output_c_file", type=argparse.FileType("w", encoding="UTF-8"), required=True
)
parser.add_argument(
@@ -120,6 +137,7 @@ include_cdc2 = "CDC2" in args.devices
include_msc = "MSC" in args.devices
include_hid = "HID" in args.devices
include_audio = "AUDIO" in args.devices
+include_vendor = "VENDOR" in args.devices
if not include_cdc and include_cdc2:
raise ValueError("CDC2 requested without CDC")
@@ -154,6 +172,12 @@ if not args.renumber_endpoints:
elif args.midi_ep_num_in == 0:
raise ValueError("MIDI endpoint IN number must not be 0")
+ if include_vendor:
+ if args.vendor_ep_num_out == 0:
+ raise ValueError("VENDOR endpoint OUT number must not be 0")
+ elif args.vendor_ep_num_in == 0:
+ raise ValueError("VENDOR endpoint IN number must not be 0")
+
class StringIndex:
"""Assign a monotonically increasing index to each unique string. Start with 0."""
@@ -273,7 +297,7 @@ if include_cdc:
cdc_comm_interface = make_cdc_comm_interface("CDC", cdc_union)
cdc_data_interface = make_cdc_data_interface("CDC")
- cdc_interfaces = [cdc_comm_interface, cdc_data_interface]
+cdc_interfaces = [cdc_comm_interface, cdc_data_interface]
if include_cdc2:
cdc2_union = make_cdc_union("CDC2")
@@ -472,6 +496,38 @@ if include_audio:
+ cs_ac_interface.midi_streaming_interfaces
)
+if include_vendor:
+ # Vendor-specific interface, for example WebUSB
+ vendor_endpoint_in_descriptor = standard.EndpointDescriptor(
+ description="VENDOR in",
+ bEndpointAddress=args.vendor_ep_num_in
+ | standard.EndpointDescriptor.DIRECTION_IN,
+ bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
+ bInterval=16,
+ )
+
+ vendor_endpoint_out_descriptor = standard.EndpointDescriptor(
+ description="VENDOR out",
+ bEndpointAddress=args.vendor_ep_num_out
+ | standard.EndpointDescriptor.DIRECTION_OUT,
+ bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
+ bInterval=16,
+ )
+
+ vendor_interface = standard.InterfaceDescriptor(
+ description="VENDOR",
+ bInterfaceClass=0xFF, # Vendor-specific
+ bInterfaceSubClass=0x00,
+ bInterfaceProtocol=0x00,
+ iInterface=StringIndex.index("{} VENDOR".format(args.interface_name)),
+ subdescriptors=[
+ vendor_endpoint_in_descriptor,
+ vendor_endpoint_out_descriptor,
+ ],
+ )
+
+ vendor_interfaces = [vendor_interface]
+
interfaces_to_join = []
if include_cdc:
@@ -489,6 +545,9 @@ if include_hid:
if include_audio:
interfaces_to_join.append(audio_interfaces)
+if include_vendor:
+ interfaces_to_join.append(vendor_interfaces)
+
# util.join_interfaces() will renumber the endpoints to make them unique across descriptors,
# and renumber the interfaces in order. But we still need to fix up certain
# interface cross-references.
@@ -502,7 +561,7 @@ if args.max_ep != 0:
endpoint_address = getattr(subdescriptor, "bEndpointAddress", 0) & 0x7F
if endpoint_address >= args.max_ep:
raise ValueError(
- "Endpoint address %d of %s must be less than %d"
+ "Endpoint address %d of '%s' must be less than %d; you have probably run out of endpoints"
% (endpoint_address & 0x7F, interface.description, args.max_ep)
)
else:
@@ -569,6 +628,9 @@ if include_audio:
# correct ordering.
descriptor_list.append(audio_control_interface)
+if include_vendor:
+ descriptor_list.extend(vendor_interfaces)
+
# Finally, build the composite descriptor.
configuration = standard.ConfigurationDescriptor(
@@ -594,6 +656,7 @@ c_file.write(
"""\
#include <stdint.h>
+#include "tusb.h"
#include "py/objtuple.h"
#include "shared-bindings/usb_hid/Device.h"
#include "{H_FILE_NAME}"
@@ -732,9 +795,12 @@ c_file.write(
c_file.write("\n")
-hid_descriptor_length = len(bytes(combined_hid_report_descriptor))
+if include_hid:
+ hid_descriptor_length = len(bytes(combined_hid_report_descriptor))
+else:
+ hid_descriptor_length = 0
-# Now we values we need for the .h file.
+# Now the values we need for the .h file.
h_file.write(
"""\
#ifndef MICROPY_INCLUDED_AUTOGEN_USB_DESCRIPTOR_H
@@ -747,12 +813,8 @@ extern const uint8_t usb_desc_cfg[{configuration_length}];
extern uint16_t usb_serial_number[{serial_number_length}];
extern uint16_t const * const string_desc_arr [{string_descriptor_length}];
-extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
-
#define CFG_TUSB_RHPORT0_MODE ({rhport0_mode})
-#define USB_HID_NUM_DEVICES {hid_num_devices}
-
// Vendor name included in Inquiry response, max 8 bytes
#define CFG_TUD_MSC_VENDOR "{msc_vendor}"
@@ -765,7 +827,6 @@ extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
configuration_length=descriptor_length,
max_configuration_length=max(hid_descriptor_length, descriptor_length),
string_descriptor_length=len(pointers_to_strings),
- hid_report_descriptor_length=len(bytes(combined_hid_report_descriptor)),
rhport0_mode="OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED"
if args.highspeed
else "OPT_MODE_DEVICE",
@@ -775,62 +836,96 @@ extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
)
)
-# Write out the report descriptor and info
-c_file.write(
- """\
-const uint8_t hid_report_descriptor[{HID_DESCRIPTOR_LENGTH}] = {{
+if include_hid:
+ h_file.write(
+ """\
+extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
+
+#define USB_HID_NUM_DEVICES {hid_num_devices}
""".format(
- HID_DESCRIPTOR_LENGTH=hid_descriptor_length
+ hid_report_descriptor_length=len(bytes(combined_hid_report_descriptor)),
)
)
-for b in bytes(combined_hid_report_descriptor):
- c_file.write("0x{:02x}, ".format(b))
-c_file.write(
- """\
+if include_vendor:
+ h_file.write(
+ """\
+enum
+{
+ VENDOR_REQUEST_WEBUSB = 1,
+ VENDOR_REQUEST_MICROSOFT = 2
};
+extern uint8_t const desc_ms_os_20[];
+
+// Currently getting compile-time errors in files like tusb_fifo.c
+// if we try do define this here (TODO figure this out!)
+//extern const tusb_desc_webusb_url_t desc_webusb_url;
+
+"""
+ )
+
+h_file.write(
+ """\
+#endif // MICROPY_INCLUDED_AUTOGEN_USB_DESCRIPTOR_H
"""
)
-# Write out USB HID report buffer definitions.
-for name in args.hid_devices:
+if include_hid:
+ # Write out the report descriptor and info
c_file.write(
"""\
-static uint8_t {name}_report_buffer[{report_length}];
-""".format(
- name=name.lower(),
- report_length=hid_report_descriptors.HID_DEVICE_DATA[name].report_length,
- )
+const uint8_t hid_report_descriptor[{HID_DESCRIPTOR_LENGTH}] = {{
+""".format(HID_DESCRIPTOR_LENGTH=hid_descriptor_length))
+
+ for b in bytes(combined_hid_report_descriptor):
+ c_file.write("0x{:02x}, ".format(b))
+
+ c_file.write(
+ """\
+};
+
+"""
)
- if hid_report_descriptors.HID_DEVICE_DATA[name].out_report_length > 0:
+ # Write out USB HID report buffer definitions.
+ for name in args.hid_devices:
c_file.write(
"""\
-static uint8_t {name}_out_report_buffer[{report_length}];
+static uint8_t {name}_report_buffer[{report_length}];
""".format(
name=name.lower(),
- report_length=hid_report_descriptors.HID_DEVICE_DATA[
- name
- ].out_report_length,
+ report_length=hid_report_descriptors.HID_DEVICE_DATA[name].report_length,
)
)
-# Write out table of device objects.
-c_file.write(
- """
+ if hid_report_descriptors.HID_DEVICE_DATA[name].out_report_length > 0:
+ c_file.write(
+ """\
+static uint8_t {name}_out_report_buffer[{report_length}];
+""".format(
+ name=name.lower(),
+ report_length=hid_report_descriptors.HID_DEVICE_DATA[
+ name
+ ].out_report_length,
+ )
+ )
+
+ # Write out table of device objects.
+ c_file.write(
+ """\
usb_hid_device_obj_t usb_hid_devices[] = {
"""
-)
-for name in args.hid_devices:
- device_data = hid_report_descriptors.HID_DEVICE_DATA[name]
- out_report_buffer = (
- "{}_out_report_buffer".format(name.lower())
- if device_data.out_report_length > 0
- else "NULL"
)
- c_file.write(
- """\
+ for name in args.hid_devices:
+ device_data = hid_report_descriptors.HID_DEVICE_DATA[name]
+ out_report_buffer = (
+ "{}_out_report_buffer".format(name.lower())
+ if device_data.out_report_length > 0
+ else "NULL"
+ )
+ c_file.write(
+ """\
{{
.base = {{ .type = &usb_hid_device_type }},
.report_buffer = {name}_report_buffer,
@@ -842,24 +937,24 @@ for name in args.hid_devices:
.out_report_length = {out_report_length},
}},
""".format(
- name=name.lower(),
- report_id=report_ids[name],
- report_length=device_data.report_length,
- usage_page=device_data.usage_page,
- usage=device_data.usage,
- out_report_buffer=out_report_buffer,
- out_report_length=device_data.out_report_length,
+ name=name.lower(),
+ report_id=report_ids[name],
+ report_length=device_data.report_length,
+ usage_page=device_data.usage_page,
+ usage=device_data.usage,
+ out_report_buffer=out_report_buffer,
+ out_report_length=device_data.out_report_length,
+ )
)
- )
-c_file.write(
- """\
+ c_file.write(
+ """\
};
"""
-)
+ )
-# Write out tuple of device objects.
-c_file.write(
- """
+ # Write out tuple of device objects.
+ c_file.write(
+ """
mp_obj_tuple_t common_hal_usb_hid_devices = {{
.base = {{
.type = &mp_type_tuple,
@@ -867,26 +962,119 @@ mp_obj_tuple_t common_hal_usb_hid_devices = {{
.len = {num_devices},
.items = {{
""".format(
- num_devices=len(args.hid_devices)
+ num_devices=len(args.hid_devices)
+ )
)
-)
-for idx in range(len(args.hid_devices)):
- c_file.write(
- """\
+ for idx in range(len(args.hid_devices)):
+ c_file.write(
+ """\
(mp_obj_t) &usb_hid_devices[{idx}],
""".format(
- idx=idx
+ idx=idx
+ )
)
- )
-c_file.write(
- """\
+ c_file.write(
+ """\
},
};
"""
-)
+ )
-h_file.write(
- """\
-#endif // MICROPY_INCLUDED_AUTOGEN_USB_DESCRIPTOR_H
-"""
-)
+if include_vendor:
+ # Mimic what the tinyusb webusb demo does in its main.c file
+ c_file.write(
+ """
+#define URL "{webusb_url}"
+
+const tusb_desc_webusb_url_t desc_webusb_url =
+{{
+ .bLength = 3 + sizeof(URL) - 1,
+ .bDescriptorType = 3, // WEBUSB URL type
+ .bScheme = 1, // 0: http, 1: https, 255: ""
+ .url = URL
+}};
+
+// These next two hardcoded descriptors were pulled from the usb_descriptor.c file
+// of the tinyusb webusb_serial demo. TODO - this is probably something else to
+// integrate into the adafruit_usb_descriptors project...
+
+//--------------------------------------------------------------------+
+// BOS Descriptor
+//--------------------------------------------------------------------+
+
+/* Microsoft OS 2.0 registry property descriptor
+Per MS requirements https://msdn.microsoft.com/en-us/library/windows/hardware/hh450799(v=vs.85).aspx
+device should create DeviceInterfaceGUIDs. It can be done by driver and
+in case of real PnP solution device should expose MS "Microsoft OS 2.0
+registry property descriptor". Such descriptor can insert any record
+into Windows registry per device/configuration/interface. In our case it
+will insert "DeviceInterfaceGUIDs" multistring property.
+
+GUID is freshly generated and should be OK to use.
+
+https://developers.google.com/web/fundamentals/native-hardware/build-for-webusb/
+(Section Microsoft OS compatibility descriptors)
+*/
+
+#define BOS_TOTAL_LEN (TUD_BOS_DESC_LEN + TUD_BOS_WEBUSB_DESC_LEN + TUD_BOS_MICROSOFT_OS_DESC_LEN)
+
+#define MS_OS_20_DESC_LEN 0xB2
+
+// BOS Descriptor is required for webUSB
+uint8_t const desc_bos[] =
+{{
+ // total length, number of device caps
+ TUD_BOS_DESCRIPTOR(BOS_TOTAL_LEN, 2),
+
+ // Vendor Code, iLandingPage
+ TUD_BOS_WEBUSB_DESCRIPTOR(VENDOR_REQUEST_WEBUSB, 1),
+
+ // Microsoft OS 2.0 descriptor
+ TUD_BOS_MS_OS_20_DESCRIPTOR(MS_OS_20_DESC_LEN, VENDOR_REQUEST_MICROSOFT)
+}};
+
+uint8_t const * tud_descriptor_bos_cb(void)
+{{
+ return desc_bos;
+}}
+
+
+#define ITF_NUM_VENDOR {webusb_interface} // used in this next descriptor
+
+uint8_t const desc_ms_os_20[] =
+{{
+ // Set header: length, type, windows version, total length
+ U16_TO_U8S_LE(0x000A), U16_TO_U8S_LE(MS_OS_20_SET_HEADER_DESCRIPTOR), U32_TO_U8S_LE(0x06030000), U16_TO_U8S_LE(MS_OS_20_DESC_LEN),
+
+ // Configuration subset header: length, type, configuration index, reserved, configuration total length
+ U16_TO_U8S_LE(0x0008), U16_TO_U8S_LE(MS_OS_20_SUBSET_HEADER_CONFIGURATION), 0, 0, U16_TO_U8S_LE(MS_OS_20_DESC_LEN-0x0A),
+
+ // Function Subset header: length, type, first interface, reserved, subset length
+ U16_TO_U8S_LE(0x0008), U16_TO_U8S_LE(MS_OS_20_SUBSET_HEADER_FUNCTION), ITF_NUM_VENDOR, 0, U16_TO_U8S_LE(MS_OS_20_DESC_LEN-0x0A-0x08),
+
+ // MS OS 2.0 Compatible ID descriptor: length, type, compatible ID, sub compatible ID
+ U16_TO_U8S_LE(0x0014), U16_TO_U8S_LE(MS_OS_20_FEATURE_COMPATBLE_ID), 'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sub-compatible
+
+ // MS OS 2.0 Registry property descriptor: length, type
+ U16_TO_U8S_LE(MS_OS_20_DESC_LEN-0x0A-0x08-0x08-0x14), U16_TO_U8S_LE(MS_OS_20_FEATURE_REG_PROPERTY),
+ U16_TO_U8S_LE(0x0007), U16_TO_U8S_LE(0x002A), // wPropertyDataType, wPropertyNameLength and PropertyName "DeviceInterfaceGUIDs\0" in UTF-16
+ 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00,
+ 'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, 'D', 0x00, 's', 0x00, 0x00, 0x00,
+ U16_TO_U8S_LE(0x0050), // wPropertyDataLength
+ //bPropertyData: “{{975F44D9-0D08-43FD-8B3E-127CA8AFFF9D}}”.
+ '{{', 0x00, '9', 0x00, '7', 0x00, '5', 0x00, 'F', 0x00, '4', 0x00, '4', 0x00, 'D', 0x00, '9', 0x00, '-', 0x00,
+ '0', 0x00, 'D', 0x00, '0', 0x00, '8', 0x00, '-', 0x00, '4', 0x00, '3', 0x00, 'F', 0x00, 'D', 0x00, '-', 0x00,
+ '8', 0x00, 'B', 0x00, '3', 0x00, 'E', 0x00, '-', 0x00, '1', 0x00, '2', 0x00, '7', 0x00, 'C', 0x00, 'A', 0x00,
+ '8', 0x00, 'A', 0x00, 'F', 0x00, 'F', 0x00, 'F', 0x00, '9', 0x00, 'D', 0x00, '}}', 0x00, 0x00, 0x00, 0x00, 0x00
+}};
+
+TU_VERIFY_STATIC(sizeof(desc_ms_os_20) == MS_OS_20_DESC_LEN, "Incorrect size");
+
+// End of section about desc_ms_os_20
+
+""".format(
+ webusb_url=args.webusb_url,
+ webusb_interface=vendor_interface.bInterfaceNumber,
+ )
+ )