diff --git a/.gitmodules b/.gitmodules index 43fc7672ad..4d67837a2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -145,8 +145,8 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git [submodule "ports/espressif/esp-idf"] path = ports/espressif/esp-idf - url = https://github.com/adafruit/esp-idf.git - branch = circuitpython-v4.4 + url = https://github.com/espressif/esp-idf.git + branch = release/v4.4 [submodule "ports/espressif/certificates/nina-fw"] path = ports/espressif/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git diff --git a/docs/library/binascii.rst b/docs/library/binascii.rst index 6a59e9135d..f43eeb83c4 100644 --- a/docs/library/binascii.rst +++ b/docs/library/binascii.rst @@ -36,3 +36,9 @@ Functions Encode binary data in base64 format, as in `RFC 3548 `_. Returns the encoded data followed by a newline character, as a bytes object. + +.. function:: crc32(data, value=0, /) + + Compute CRC-32, the 32-bit checksum of the bytes in *data* starting with an + initial CRC of *value*. The default initial CRC is 0. The algorithm is + consistent with the ZIP file checksum. diff --git a/lib/tinyusb b/lib/tinyusb index 3b09b82123..73896a3b71 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 3b09b82123a50bef6b18cf90c2734ae7581da4a3 +Subproject commit 73896a3b71c525a3ee4cefa7e35ce3b3a93786ef diff --git a/locale/ID.po b/locale/ID.po index a4579f0846..448a289a24 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -27,10 +27,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Kode berhenti oleh auto-reload.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -594,10 +592,6 @@ msgstr "Kedua pin harus mendukung hardware interrut" msgid "Brightness must be 0-1.0" msgstr "Kecerahan harus di antara 0-1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Brightness harus di antara 0 dan 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -698,6 +692,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal" @@ -1450,7 +1445,8 @@ msgstr "Pin untuk channel kanan tidak valid" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1626,6 +1622,7 @@ msgstr "Nama terlalu panjang" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Tidak ada CCCD untuk Karakteristik ini" @@ -2193,7 +2190,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2445,6 +2441,10 @@ msgstr "Tidak dapat memulai parser" msgid "Unable to read color palette data" msgstr "Tidak dapat membaca data palet warna" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Tidak dapat menulis ke nvm." @@ -2482,6 +2482,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "Kesalahan gatt tidak dikenal: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Alasan yang tidak diketahui." @@ -3663,6 +3664,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4103,6 +4112,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4110,11 +4120,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4126,6 +4138,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4697,6 +4713,16 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Kode berhenti oleh auto-reload.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Brightness harus di antara 0 dan 255" + #~ msgid "cannot perform relative import" #~ msgstr "tidak dapat melakukan relative import" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 58e842598b..0ce564f1f7 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -25,7 +25,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -584,10 +584,6 @@ msgstr "" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -688,6 +684,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1429,7 +1426,8 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1605,6 +1603,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2158,7 +2157,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2410,6 +2408,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2447,6 +2449,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3626,6 +3629,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4065,6 +4076,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4072,11 +4084,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4088,6 +4102,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h diff --git a/locale/cs.po b/locale/cs.po index 2fb94b8586..b9fa742cc1 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -27,10 +27,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Program byl zastaven automatickým načtením.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -593,10 +591,6 @@ msgstr "" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -697,6 +691,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1438,7 +1433,8 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1614,6 +1610,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2169,7 +2166,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2421,6 +2417,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2458,6 +2458,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3637,6 +3638,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4076,6 +4085,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4083,11 +4093,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4099,6 +4111,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4670,6 +4686,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Program byl zastaven automatickým načtením.\n" + #~ msgid "%q list must be a list" #~ msgstr "Seznam %q musí být seznam" diff --git a/locale/de_DE.po b/locale/de_DE.po index 58e2557c5f..cefd24e805 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: 2022-02-25 21:58+0000\n" +"PO-Revision-Date: 2022-03-18 00:02+0000\n" "Last-Translator: Fabian Affolter \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.11.1-dev\n" +"X-Generator: Weblate 4.12-dev\n" #: main.c msgid "" @@ -26,10 +26,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Code durch automatisches neuladen gestoppt\n" #: supervisor/shared/safe_mode.c msgid "" @@ -71,7 +69,8 @@ msgstr "%%c erwartet Int oder Char" msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" -"%d Adress-Pins, %d RGB-Pins und %d Tiles indiziert eine Höhe von %d, nicht %d" +"%d Adress-Pins, %d RGB-Pins und %d Kacheln indizieren eine Höhe von %d, " +"nicht %d" #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" @@ -594,10 +593,6 @@ msgstr "Beide Pins müssen Hardware-Interrupts unterstützen" msgid "Brightness must be 0-1.0" msgstr "Die Helligkeit muss zwischen 0 und 1.0 liegen" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Die Helligkeit muss zwischen 0 und 255 liegen" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -700,6 +695,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "Kann nur auf zwei Pins Alarm als low aus Deep Sleep auslösen." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "CCCD kann nicht auf lokales Merkmal eingestellt werden" @@ -928,7 +924,7 @@ msgstr "Dem fmt Block muss ein Datenblock folgen" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data not supported with directed advertising" -msgstr "" +msgstr "Daten werden nicht mit direkter Ankündigung unsterstützt" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -937,7 +933,7 @@ msgstr "Zu vielen Daten für das advertisement packet" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Deep sleep pins must use a rising edge with pulldown" -msgstr "" +msgstr "Deep Sleep Pins müssen eine steigende Flanke mit Pulldown verwenden" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -1015,7 +1011,7 @@ msgstr "Habe ein Tupel der Länge %d erwartet aber %d erhalten" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Extended advertisements with scan response not supported." msgstr "" -"Erweiterte Werbung (advertising) mit Scanantwort wird nicht unterstützt." +"Erweiterte Ankündigung (advertising) mit Scan-Antwort wird nicht unterstützt." #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is defined for ndarrays only" @@ -1112,11 +1108,11 @@ msgstr "Firmware Image ist ungültig" #: shared-bindings/bitmaptools/__init__.c msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" -msgstr "" +msgstr "Für den L8-Farbraum muss die Eingabe-Bitmap 8 Bit pro Pixel aufweisen" #: shared-bindings/bitmaptools/__init__.c msgid "For RGB colorspaces, input bitmap must have 16 bits per pixel" -msgstr "" +msgstr "Für RGB-Farbräume muss die Eingabe-Bitmap 16 Bit pro Pixel haben" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1163,7 +1159,7 @@ msgstr "Hardware beschäftigt, versuchen Sie alternative Pins" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Hardware in use, try alternative pins" -msgstr "Hardware in benutzung, probiere alternative Pins" +msgstr "Hardware in Benutzung, probiere alternative Pins" #: shared-bindings/wifi/Radio.c msgid "Hostname must be between 1 and 253 characters" @@ -1242,12 +1238,12 @@ msgstr "Eingabe-/Ausgabefehler" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts in more bits than pin count" -msgstr "" +msgstr "Anweisung %d verschiebt mehr Bits als die Anzahl der Pins" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts out more bits than pin count" -msgstr "" +msgstr "Der Befehl %d verschiebt mehr Bits als die Anzahl der Pins" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1257,7 +1253,7 @@ msgstr "Instruktion %d benötigt extra Pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d waits on input outside of count" -msgstr "" +msgstr "Anweisung %d wartet auf Eingaben außerhalb der vorhandenen Anzahl" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" @@ -1371,7 +1367,7 @@ msgstr "Ungültige Puffergröße" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c msgid "Invalid byteorder string" -msgstr "Ungültige Byteorder String" +msgstr "Ungültige Byteorder-String" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/espressif/common-hal/frequencyio/FrequencyIn.c @@ -1454,7 +1450,8 @@ msgstr "Ungültiger Pin für rechten Kanal" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1570,17 +1567,17 @@ msgstr "Fehlender first_in_pin. Instruktion %d liest Pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "" +msgstr "Fehlende first_in_pin. Anweisung %d verschiebt sich um Pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "" +msgstr "Fehlende first_in_pin. Anweisung %d wartet basierend auf Pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "" +msgstr "First_out_pin fehlt. Befehl %d verschiebt sich zu Pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1595,12 +1592,12 @@ msgstr "Fehlender first_set_pin. Instruktion %d setzt Pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "" +msgstr "jmp_pin fehlt. Befehl %d springt auf Pin" #: shared-module/usb_hid/Device.c #, c-format msgid "More than %d report ids not supported" -msgstr "" +msgstr "Mehr als %d Berichts-IDs werden nicht unterstützt" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -1617,7 +1614,7 @@ msgstr "Muss ein Vielfaches von 6 RGB-Pins verwenden, nicht %d" #: supervisor/shared/safe_mode.c msgid "NLR jump failed. Likely memory corruption." -msgstr "NLR-Sprung fehlgeschlagen. Mögliche Speicherbeschädigung" +msgstr "NLR-Sprung fehlgeschlagen. Mögliche Speicher-Beschädigung." #: ports/espressif/common-hal/nvm/ByteArray.c msgid "NVS Error" @@ -1629,8 +1626,9 @@ msgstr "Name zu lang" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" -msgstr "" +msgstr "Kein Speicher mehr für Nible vorhanden" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Kein CCCD für diese Charakteristik" @@ -2004,7 +2002,7 @@ msgstr "Polygone brauchen mindestens 3 Punkte" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" -msgstr "Der Präfixbuffer muss sich auf dem Heap befinden" +msgstr "Der Präfix-Puffer muss sich auf dem Heap befinden" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" @@ -2014,7 +2012,8 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" -msgstr "Vortäuschen von Deep Sleep bis Alarm, Strg-C oder Schreiben in Datei.\n" +msgstr "" +"Vortäuschen von Deep Sleep bis Alarm, Strg-C oder Schreiben in Datei.\n" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does IN without loading ISR" @@ -2195,7 +2194,6 @@ msgstr "Die Anzahl der Pins für Side set muss zwischen 1 und 5 liegen" msgid "Size not supported" msgstr "Größe nicht unterstützt" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "Sleep-Speicher nicht verfügbar" @@ -2221,7 +2219,7 @@ msgstr "Quell- und Zielbuffer müssen gleich lang sein" #: shared-bindings/paralleldisplay/ParallelBus.c msgid "Specify exactly one of data0 or data_pins" -msgstr "" +msgstr "Geben Sie genau einen von data0 oder data_pins an" #: extmod/modure.c msgid "Splitting with sub-captures" @@ -2233,11 +2231,11 @@ msgstr "Die Stackgröße sollte mindestens 256 sein" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" -msgstr "" +msgstr "Stereo links muss sich auf PWM-Kanal A befinden" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo right must be on PWM channel B" -msgstr "" +msgstr "Stereo rechts muss sich auf PWM-Kanal B befinden" #: shared-bindings/multiterminal/__init__.c msgid "Stream missing readinto() or write() method." @@ -2249,7 +2247,7 @@ msgstr "Geben Sie mindestens einen UART-Pin an" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Geben Sie entweder monotonic_time oder epoch_time an" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -2264,6 +2262,8 @@ msgid "" "The CircuitPython heap was corrupted because the stack was too small.\n" "Increase the stack size if you know how. If not:" msgstr "" +"Der Heap von CircuitPython wurde beschädigt, weil der Stack zu klein war.\n" +"Vergrößern Sie den Stack, wenn Sie wissen, wie. Wenn nicht:" #: supervisor/shared/safe_mode.c msgid "" @@ -2315,6 +2315,8 @@ msgid "" "This microcontroller only supports data0=, not data_pins=, because it " "requires contiguous pins." msgstr "" +"Dieser Mikrocontroller unterstützt nur data0=, nicht data_pins=, da er " +"zusammenhängende Pins benötigt." #: shared-bindings/displayio/TileGrid.c msgid "Tile height must exactly divide bitmap height" @@ -2334,7 +2336,7 @@ msgstr "Die Kachelbreite muss die Bitmap-Breite genau teilen" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "Zeit liegt in der Vergangenheit" +msgstr "Zeit liegt in der Vergangenheit." #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -2405,11 +2407,11 @@ msgstr "USB beschäftigt" #: supervisor/shared/safe_mode.c msgid "USB devices need more endpoints than are available." -msgstr "USB Geräte brauchen mehr Endpunkte als verfügbar sind" +msgstr "USB-Geräte brauchen mehr Endpunkte als verfügbar sind." #: supervisor/shared/safe_mode.c msgid "USB devices specify too many interface names." -msgstr "USB Geräte haben zu viele Schnittstellennamen festgelegt" +msgstr "USB-Geräte haben zu viele Schnittstellen-Namen festgelegt." #: shared-module/usb_hid/Device.c msgid "USB error" @@ -2456,6 +2458,10 @@ msgstr "Parser konnte nicht gestartet werden" msgid "Unable to read color palette data" msgstr "Konnte Farbpalettendaten nicht lesen" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Schreiben in nvm nicht möglich." @@ -2493,6 +2499,7 @@ msgstr "Unbekannter Fehler %d" msgid "Unknown gatt error: 0x%04x" msgstr "Unbekannter Gatt-Fehler: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Unbekannter Grund." @@ -2590,6 +2597,8 @@ msgstr "" #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" +"WatchDogTimer kann nicht deinitialisiert werden, wenn der Modus auf RESET " +"gesetzt ist" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer is not currently running" @@ -2850,7 +2859,7 @@ msgstr "Kalibrierwert nicht im Bereich von +/-127" #: shared-module/vectorio/Rectangle.c msgid "can only be registered in one parent" -msgstr "" +msgstr "kann nur bei einem Elternteil registriert werden" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" @@ -2998,11 +3007,11 @@ msgstr "Kann neue shape nicht zuweisen" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "Kann die Ausgabe nicht mit der Umwandlungsregel umwandeln" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex to dtype" -msgstr "" +msgstr "kann Komplex nicht in dtype konvertieren" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" @@ -3300,15 +3309,15 @@ msgstr "Das Dateisystem muss eine Mount-Methode bereitstellen" #: extmod/ulab/code/numpy/vector.c msgid "first argument must be a callable" -msgstr "" +msgstr "das erste Argument muss ein aufrufbares sein" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "first argument must be a function" -msgstr "" +msgstr "das erste Argument muss eine Funktion sein" #: extmod/ulab/code/numpy/create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "das erste Argument muss ein Tupel von ndarrays sein" #: extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" @@ -3320,7 +3329,7 @@ msgstr "Das erste Argument für super() muss type sein" #: extmod/ulab/code/scipy/linalg/linalg.c msgid "first two arguments must be ndarrays" -msgstr "" +msgstr "die ersten beiden Argumente müssen ndarrays sein" #: extmod/ulab/code/ndarray.c msgid "flattening order must be either 'C', or 'F'" @@ -3352,7 +3361,7 @@ msgstr "voll" #: py/argcheck.c msgid "function doesn't take keyword arguments" -msgstr "" +msgstr "Funktion nimmt keine Schlüsselwortargumente an" #: py/argcheck.c #, c-format @@ -3365,15 +3374,15 @@ msgstr "Funktion hat mehrere Werte für Argument '%q'" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "function has the same sign at the ends of interval" -msgstr "" +msgstr "Funktion hat an den Enden des Intervalls das gleiche Vorzeichen" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "Funktion ist nur für ndarrays definiert" #: extmod/ulab/code/numpy/carray/carray.c msgid "function is implemented for ndarrays only" -msgstr "" +msgstr "Funktion ist nur für ndarrays implementiert" #: py/argcheck.c #, c-format @@ -3414,7 +3423,7 @@ msgstr "Generator ignoriert GeneratorExit" #: py/objgenerator.c py/runtime.c msgid "generator raised StopIteration" -msgstr "" +msgstr "Generator hat StopIteration ausgelöst" #: shared-bindings/_stage/Layer.c msgid "graphic must be 2048 bytes long" @@ -3422,7 +3431,7 @@ msgstr "graphic muss 2048 Byte lang sein" #: extmod/moduhashlib.c msgid "hash is final" -msgstr "" +msgstr "Hash ist endgültig" #: extmod/moduheapq.c msgid "heap must be a list" @@ -3438,11 +3447,11 @@ msgstr "Bezeichner als nonlocal definiert" #: py/compile.c msgid "import * not at module level" -msgstr "" +msgstr "import * nicht auf Modulebene" #: py/persistentcode.c msgid "incompatible native .mpy architecture" -msgstr "" +msgstr "inkompatible native .mpy-Architektur" #: py/objstr.c msgid "incomplete format" @@ -3488,7 +3497,7 @@ msgstr "inline assembler muss eine function sein" #: extmod/ulab/code/ndarray.c msgid "input and output shapes are not compatible" -msgstr "" +msgstr "Eingabe- und Ausgabeformen sind nicht kompatibel" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" @@ -3508,7 +3517,7 @@ msgstr "Eingabedaten müssen iterierbar sein" #: extmod/ulab/code/numpy/vector.c msgid "input dtype must be float or complex" -msgstr "" +msgstr "Eingabe dtype muss float oder complex sein" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" @@ -3521,23 +3530,23 @@ msgstr "Eingabematrix ist singulär" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" -msgstr "" +msgstr "Eingabe muss ein 1D ndarray sein" #: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "Eingabe muss ein dichtes ndarray sein" #: extmod/ulab/code/numpy/create.c msgid "input must be a tensor of rank 2" -msgstr "" +msgstr "Eingabe muss ein Tensor von Rang 2 sein" #: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "Eingabe muss ein ndarray sein" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be an ndarray, or a scalar" -msgstr "" +msgstr "Eingabe muss ein ndarray oder ein Skalar sein" #: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" @@ -3557,7 +3566,7 @@ msgstr "Eingabevektoren müssen gleich lang sein" #: extmod/ulab/code/numpy/poly.c msgid "inputs are not iterable" -msgstr "" +msgstr "Eingaben sind nicht iterierbar" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -3565,7 +3574,7 @@ msgstr "int() arg 2 muss >= 2 und <= 36 sein" #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" -msgstr "" +msgstr "interp ist für 1D-Iterables gleicher Länge definiert" #: shared-bindings/_bleio/Adapter.c #, c-format @@ -3579,21 +3588,21 @@ msgstr "ungültige Architektur" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" -msgstr "" +msgstr "ungültige Bits_pro_Pixel %d, muss 1, 2, 4, 8, 16, 24 oder 32 sein" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" -msgstr "" +msgstr "Ungültige Elementgröße %d für bits_per_pixel %d\n" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element_size %d, must be, 1, 2, or 4" -msgstr "" +msgstr "ungültige Elementgröße %d, muss 1, 2 oder 4 sein" #: shared-bindings/traceback/__init__.c msgid "invalid exception" -msgstr "" +msgstr "ungültige Ausnahme" #: extmod/modframebuf.c msgid "invalid format" @@ -3605,7 +3614,7 @@ msgstr "ungültiger Formatbezeichner" #: shared-bindings/wifi/Radio.c msgid "invalid hostname" -msgstr "" +msgstr "ungültiger Hostname" #: py/compile.c msgid "invalid micropython decorator" @@ -3634,7 +3643,7 @@ msgstr "ungültige Syntax für number" #: py/objexcept.c msgid "invalid traceback" -msgstr "" +msgstr "ungültiger Traceback" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3704,6 +3713,14 @@ msgstr "long int wird in diesem Build nicht unterstützt" #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" +msgstr "Loopback + Silent Mode wird vom Peripheriegerät nicht unterstützt" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" msgstr "" #: py/parse.c @@ -3724,7 +3741,7 @@ msgstr "Matrix ist nicht positiv definitiv" #: ports/espressif/common-hal/wifi/Radio.c msgid "max_connections must be between 0 and 10" -msgstr "" +msgstr "max_connections muss zwischen 0 und 10 liegen" #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c @@ -3735,11 +3752,11 @@ msgstr "max_length muss 0-%d sein, wenn fixed_length %s ist" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "max_length must be >= 0" -msgstr "" +msgstr "max_length muss >= 0 sein" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is 4" -msgstr "" +msgstr "die maximale Anzahl der Dimensionen beträgt 4" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3747,15 +3764,15 @@ msgstr "maximale Rekursionstiefe überschritten" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter muss > 0 sein" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "maxiter should be > 0" -msgstr "" +msgstr "maxiter sollte > 0 sein" #: extmod/ulab/code/numpy/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "Median-Argument muss ein ndarray sein" #: py/runtime.c #, c-format @@ -3768,11 +3785,11 @@ msgstr "Speicherzuweisung fehlgeschlagen, der Heap ist gesperrt" #: py/objarray.c msgid "memoryview: length is not a multiple of itemsize" -msgstr "" +msgstr "memoryview: length ist kein Vielfaches von itemize" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "mode must be complete, or reduced" -msgstr "" +msgstr "Modus muss vollständig oder reduziert sein" #: py/builtinimport.c msgid "module not found" @@ -3780,7 +3797,7 @@ msgstr "Modul nicht gefunden" #: ports/espressif/common-hal/wifi/Monitor.c msgid "monitor init failed" -msgstr "" +msgstr "monitor init fehlgeschlagen" #: extmod/ulab/code/numpy/poly.c msgid "more degrees of freedom than data points" @@ -3816,7 +3833,7 @@ msgstr "Dieser Name ist nirgends definiert worden (Schreibweise kontrollieren)" #: py/asmthumb.c msgid "native method too big" -msgstr "" +msgstr "native Methode zu groß" #: py/emitnative.c msgid "native yield" @@ -3829,7 +3846,7 @@ msgstr "Zum Entpacken sind mehr als %d Werte erforderlich" #: py/modmath.c msgid "negative factorial" -msgstr "" +msgstr "negative Fakultät" #: py/objint_longlong.c py/objint_mpz.c py/runtime.c msgid "negative power with no float support" @@ -3841,7 +3858,7 @@ msgstr "Negative shift Anzahl" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "" +msgstr "keine SD-Karte" #: py/vm.c msgid "no active exception to reraise" @@ -3853,11 +3870,11 @@ msgstr "Kein Binding für nonlocal gefunden" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "kein Standard-Packer" #: extmod/modurandom.c msgid "no default seed" -msgstr "" +msgstr "kein Standard-Seed" #: py/builtinimport.c msgid "no module named '%q'" @@ -3870,7 +3887,7 @@ msgstr "kein Reset Pin verfügbar" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "" +msgstr "keine Antwort von der SD-Karte" #: py/objobject.c py/runtime.c msgid "no such attribute" @@ -3878,7 +3895,7 @@ msgstr "kein solches Attribut" #: shared-bindings/usb_hid/__init__.c msgid "non-Device in %q" -msgstr "" +msgstr "Nicht-Gerät in %q" #: ports/espressif/common-hal/_bleio/Connection.c #: ports/nrf/common-hal/_bleio/Connection.c @@ -3903,11 +3920,11 @@ msgstr "Nicht-Schlüsselwort Argument nach Schlüsselwort Argument" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "Timeout ungleich Null muss > 0,01 sein" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "Timeout ungleich Null muss >= Intervall sein" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" @@ -3924,7 +3941,7 @@ msgstr "Nicht genügend Argumente für den Formatierungs-String" #: extmod/ulab/code/numpy/carray/carray_tools.c msgid "not implemented for complex dtype" -msgstr "" +msgstr "nicht implementiert für komplexe dtype" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3932,20 +3949,20 @@ msgstr "Die Anzahl der Punkte muss mindestens 2 betragen" #: py/builtinhelp.c msgid "object " -msgstr "" +msgstr "Objekt " #: py/obj.c #, c-format msgid "object '%s' isn't a tuple or list" -msgstr "" +msgstr "Objekt '%s' ist'kein Tupel oder Liste" #: py/obj.c msgid "object doesn't support item assignment" -msgstr "" +msgstr "Das Objekt unterstützt keine Elementzuweisung" #: py/obj.c msgid "object doesn't support item deletion" -msgstr "" +msgstr "Objekt unterstützt das Löschen von Elementen nicht" #: py/obj.c msgid "object has no len" @@ -3953,7 +3970,7 @@ msgstr "Objekt hat keine len" #: py/obj.c msgid "object isn't subscriptable" -msgstr "" +msgstr "Objekt ist nicht subskribierbar" #: py/runtime.c msgid "object not an iterator" @@ -3986,15 +4003,16 @@ msgstr "String mit ungerader Länge" #: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c msgid "offset is too large" -msgstr "" +msgstr "Offset ist zu groß" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "Offset muss >= 0 sein" #: extmod/ulab/code/numpy/create.c msgid "offset must be non-negative and no greater than buffer length" msgstr "" +"Offset muss nicht negativ sein und darf nicht größer als die Pufferlänge sein" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -4016,7 +4034,7 @@ msgstr "" #: py/vm.c msgid "opcode" -msgstr "" +msgstr "Opcode" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c #: extmod/ulab/code/numpy/vector.c @@ -4025,15 +4043,15 @@ msgstr "Operanden konnten nicht zusammen gesendet werden" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for 2D arrays only" -msgstr "" +msgstr "Operation ist nur für 2D-Arrays definiert" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for ndarrays only" -msgstr "" +msgstr "Operation ist nur für ndarrays definiert" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "Operation wird nur für boolesche 1D-Arrays implementiert" #: extmod/ulab/code/numpy/numerical.c msgid "operation is not implemented on ndarrays" @@ -4056,11 +4074,11 @@ msgstr "" #: extmod/ulab/code/utils/utils.c msgid "out array is too small" -msgstr "" +msgstr "Ausgabe-Array ist zu klein" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" -msgstr "" +msgstr "Ausgabe muss ein floatdichtes Array sein" #: shared-bindings/displayio/Bitmap.c msgid "out of range of source" @@ -4077,7 +4095,7 @@ msgstr "Überlauf beim konvertieren von long int zu machine word" #: py/modstruct.c #, c-format msgid "pack expected %d items for packing (got %d)" -msgstr "" +msgstr "pack erwartete %d Artikel zum Packen (erhalten %d)" #: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c msgid "palette must be 32 bytes long" @@ -4109,7 +4127,7 @@ msgstr "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein" #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" -msgstr "" +msgstr "Abfrage der Datei unter Win32 nicht verfügbar" #: shared-module/vectorio/Polygon.c msgid "polygon can only be registered in one parent" @@ -4126,11 +4144,11 @@ msgstr "pop von einem leeren PulseIn" #: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c #: shared-bindings/ps2io/Ps2.c msgid "pop from empty %q" -msgstr "" +msgstr "Pop aus leerem %q" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "port must be >= 0" -msgstr "" +msgstr "Port muss >= 0 sein" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4149,6 +4167,7 @@ msgstr "pow() mit 3 Argumenten erfordert Integer" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4156,11 +4175,13 @@ msgstr "pow() mit 3 Argumenten erfordert Integer" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4172,6 +4193,10 @@ msgstr "pow() mit 3 Argumenten erfordert Integer" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4191,7 +4216,7 @@ msgstr "pow() mit 3 Argumenten erfordert Integer" #: ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.h #: ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.h msgid "pressing boot button at start up.\n" -msgstr "" +msgstr "Drücken der Boot-Taste beim Start.\n" #: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h @@ -4199,23 +4224,23 @@ msgstr "" #: ports/atmel-samd/boards/escornabot_makech/mpconfigboard.h #: ports/atmel-samd/boards/meowmeow/mpconfigboard.h msgid "pressing both buttons at start up.\n" -msgstr "" +msgstr "Drücken Sie beim Start beide Tasten.\n" #: ports/nrf/boards/aramcon2_badge/mpconfigboard.h msgid "pressing the left button at start up\n" -msgstr "" +msgstr "Drücken der linken Taste beim Einschalten\n" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "pull masks conflict with direction masks" -msgstr "" +msgstr "Pull-Masken kollidieren mit Richtungsmasken" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "pull_threshold must be between 1 and 32" -msgstr "" +msgstr "pull_threshold muss zwischen 1 und 32 liegen" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "push_threshold must be between 1 and 32" -msgstr "" +msgstr "push_threshold muss zwischen 1 und 32 liegen" #: extmod/modutimeq.c msgid "queue overflow" @@ -4223,7 +4248,7 @@ msgstr "Warteschlangenüberlauf" #: py/parse.c msgid "raw f-strings are not supported" -msgstr "" +msgstr "unformatierte F-Strings werden nicht unterstützt" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "real and imaginary parts must be of equal length" @@ -4240,7 +4265,7 @@ msgstr "die ersuchte Länge ist %d, aber das Objekt hat eine Länge von %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "Ergebnisse können nicht in den angegebenen Typ umgewandelt werden" #: py/compile.c msgid "return annotation must be an identifier" @@ -4262,7 +4287,7 @@ msgstr "rgb_pins [%d] befindet sich nicht am selben Port wie clock" #: extmod/ulab/code/numpy/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "Roll-Argument muss ein ndarray sein" #: py/objstr.c msgid "rsplit(None,n)" @@ -4283,7 +4308,7 @@ msgstr "Abtastrate außerhalb der Reichweite" #: py/modmicropython.c msgid "schedule queue full" -msgstr "" +msgstr "Warteschlange voll" #: py/builtinimport.c msgid "script compilation not supported" @@ -4291,15 +4316,15 @@ msgstr "kompilieren von Skripten nicht unterstützt" #: py/nativeglue.c msgid "set unsupported" -msgstr "" +msgstr "nicht unterstützt" #: extmod/ulab/code/ndarray.c msgid "shape must be a tuple" -msgstr "" +msgstr "Form muss ein Tupel sein" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "kurze Lektüre" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -4323,7 +4348,7 @@ msgstr "Die Schlafdauer darf nicht negativ sein" #: extmod/ulab/code/ndarray.c msgid "slice step can't be zero" -msgstr "" +msgstr "Slice-Schritt darf nicht Null sein" #: py/objslice.c msgid "slice step cannot be zero" @@ -4331,7 +4356,7 @@ msgstr "Der Slice-Schritt kann nicht Null sein" #: py/nativeglue.c msgid "slice unsupported" -msgstr "" +msgstr "Slice nicht unterstützt" #: py/objint.c py/sequence.c msgid "small int overflow" @@ -4347,15 +4372,15 @@ msgstr "sortierungs Argument muss ein ndarray sein" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos array must be of shape (n_section, 6)" -msgstr "" +msgstr "sos-Array muss die Form haben (n_section, 6)" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos[:, 3] should be all ones" -msgstr "" +msgstr "sos[:, 3] sollten alle Einsen sein" #: extmod/ulab/code/scipy/signal/signal.c msgid "sosfilt requires iterable arguments" -msgstr "" +msgstr "sosfilt erfordert iterierbare Argumente" #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c msgid "source palette too large" @@ -4363,19 +4388,19 @@ msgstr "Quell-Palette zu groß" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 2 or 65536" -msgstr "" +msgstr "source_bitmap muss value_count von 2 oder 65536 haben" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 65536" -msgstr "" +msgstr "source_bitmap muss value_count von 65536 haben" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 8" -msgstr "" +msgstr "source_bitmap muss value_count von 8 haben" #: shared-bindings/wifi/Radio.c msgid "ssid can't be more than 32 bytes" -msgstr "" +msgstr "ssid kann nicht mehr als 32 Bytes lang sein" #: py/objstr.c msgid "start/end indices" @@ -4412,7 +4437,7 @@ msgstr "" #: extmod/moductypes.c msgid "struct: can't index" -msgstr "" +msgstr "struct: kann nicht indiziert werden" #: extmod/moductypes.c msgid "struct: index out of range" @@ -4444,7 +4469,7 @@ msgstr "threshold muss im Intervall 0-65536 liegen" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "tile must be greater than zero" -msgstr "" +msgstr "Kachel muss größer als Null sein" #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" @@ -4483,7 +4508,7 @@ msgstr "Zeitstempel außerhalb des Bereichs für Plattform time_t" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "tobytes kann nur für dichte Arrays aufgerufen werden" #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" @@ -4499,7 +4524,7 @@ msgstr "zu viele Indizes" #: py/asmthumb.c msgid "too many locals for native method" -msgstr "" +msgstr "zu viele Lokale für die native Methode" #: py/runtime.c #, c-format @@ -4508,11 +4533,11 @@ msgstr "zu viele Werte zum Auspacken (erwartet %d)" #: extmod/ulab/code/numpy/approx.c msgid "trapz is defined for 1D arrays of equal length" -msgstr "" +msgstr "trapz ist für 1D-Arrays gleicher Länge definiert" #: extmod/ulab/code/numpy/approx.c msgid "trapz is defined for 1D iterables" -msgstr "" +msgstr "trapz ist für 1D-Iterables definiert" #: py/obj.c msgid "tuple/list has wrong length" @@ -4521,12 +4546,12 @@ msgstr "tupel/list hat falsche Länge" #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install gab esp-idf-Fehler zurück #%d" #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start gab esp-idf-Fehler zurück #%d" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -4582,7 +4607,7 @@ msgstr "Unicode Name ausgebrochen (escaped)" #: py/parse.c msgid "unindent doesn't match any outer indent level" -msgstr "" +msgstr "unindent stimmt mit keiner äußeren Einrückungsebene überein" #: py/objstr.c #, c-format @@ -4746,7 +4771,17 @@ msgstr "zi muss eine Gleitkommazahl sein" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of shape (n_section, 2)" -msgstr "" +msgstr "zi muss die Form (n_section, 2) haben" + +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Code durch automatisches neuladen gestoppt\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Die Helligkeit muss zwischen 0 und 255 liegen" #~ msgid "cannot perform relative import" #~ msgstr "kann keinen relativen Import durchführen" diff --git a/locale/el.po b/locale/el.po index 902f7a35b6..7d43824e4e 100644 --- a/locale/el.po +++ b/locale/el.po @@ -25,7 +25,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -584,10 +584,6 @@ msgstr "" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -688,6 +684,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1429,7 +1426,8 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1605,6 +1603,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2158,7 +2157,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2410,6 +2408,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2447,6 +2449,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3626,6 +3629,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4065,6 +4076,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4072,11 +4084,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4088,6 +4102,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h diff --git a/locale/en_GB.po b/locale/en_GB.po index ba24b0fa86..cd600837c1 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -28,10 +28,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Code stopped by auto-reload.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -595,10 +593,6 @@ msgstr "Both pins must support hardware interrupts" msgid "Brightness must be 0-1.0" msgstr "Brightness must be 0-1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Brightness must be between 0 and 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -699,6 +693,7 @@ msgstr "Can only alarm on one low pin while others alarm high from deep sleep." msgid "Can only alarm on two low pins from deep sleep." msgstr "Can only alarm on two low pins from deep sleep." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Can't set CCCD on local Characteristic" @@ -1444,7 +1439,8 @@ msgstr "Invalid pin for right channel" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1620,6 +1616,7 @@ msgstr "Name too long" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "No CCCD for this Characteristic" @@ -2182,7 +2179,6 @@ msgstr "Side set pin count must be between 1 and 5" msgid "Size not supported" msgstr "Size not supported" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "Sleep Memory not available" @@ -2441,6 +2437,10 @@ msgstr "Unable to init parser" msgid "Unable to read color palette data" msgstr "Unable to read colour palette data" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Unable to write to nvm." @@ -2478,6 +2478,7 @@ msgstr "Unknown failure %d" msgid "Unknown gatt error: 0x%04x" msgstr "Unknown gatt error: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Unknown reason." @@ -3663,6 +3664,14 @@ msgstr "long int not supported in this build" msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode not supported by peripheral" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "malformed f-string" @@ -4102,6 +4111,7 @@ msgstr "pow() with 3 arguments requires integers" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4109,11 +4119,13 @@ msgstr "pow() with 3 arguments requires integers" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4125,6 +4137,10 @@ msgstr "pow() with 3 arguments requires integers" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4698,6 +4714,16 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Brightness must be between 0 and 255" + #~ msgid "cannot perform relative import" #~ msgstr "can't perform relative import" diff --git a/locale/es.po b/locale/es.po index e13bac9cc5..995919bc8a 100644 --- a/locale/es.po +++ b/locale/es.po @@ -29,10 +29,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"El código fue detenido por el auto-reiniciado.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -599,10 +597,6 @@ msgstr "Ambos pines deben soportar interrupciones por hardware" msgid "Brightness must be 0-1.0" msgstr "El brillo debe ser 0-1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "El brillo debe estar entro 0 y 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -706,6 +700,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "Solo puede alerta en dos low pines viniendo de deep sleep." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "No se puede configurar CCCD en la característica local" @@ -1462,7 +1457,8 @@ msgstr "Pin inválido para canal derecho" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1642,6 +1638,7 @@ msgstr "Nombre muy largo" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "No hay CCCD para esta característica" @@ -2210,7 +2207,6 @@ msgstr "El conteo de pines de Side set debe estar entre 1 y 5" msgid "Size not supported" msgstr "Sin capacidades para el tamaño" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "Memoria de sueño no disponible" @@ -2472,6 +2468,10 @@ msgstr "Incapaz de inicializar el parser" msgid "Unable to read color palette data" msgstr "No se pudo leer los datos de la paleta de colores" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Imposible escribir en nvm." @@ -2509,6 +2509,7 @@ msgstr "Fallo desconocido %d" msgid "Unknown gatt error: 0x%04x" msgstr "Error de gatt desconocido: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Razón desconocida." @@ -3705,6 +3706,14 @@ msgstr "long int no soportado en esta compilación" msgid "loopback + silent mode not supported by peripheral" msgstr "Loopback + modo silencioso no están soportados por periférico" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "cadena-f mal formada" @@ -4148,6 +4157,7 @@ msgstr "pow() con 3 argumentos requiere enteros" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4155,11 +4165,13 @@ msgstr "pow() con 3 argumentos requiere enteros" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4171,6 +4183,10 @@ msgstr "pow() con 3 argumentos requiere enteros" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4745,6 +4761,16 @@ 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 "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "El código fue detenido por el auto-reiniciado.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "El brillo debe estar entro 0 y 255" + #~ msgid "cannot perform relative import" #~ msgstr "no se puedo realizar importación relativa" diff --git a/locale/fil.po b/locale/fil.po index ca9a65df37..193bc0c88e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -26,7 +26,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -591,10 +591,6 @@ msgstr "Ang parehong mga pin ay dapat na sumusuporta sa hardware interrupts" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Ang liwanag ay dapat sa gitna ng 0 o 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -696,6 +692,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1444,7 +1441,8 @@ msgstr "Mali ang pin para sa kanang channel" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1620,6 +1618,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2178,7 +2177,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2430,6 +2428,10 @@ msgstr "Hindi ma-init ang parser" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Hindi ma i-sulat sa NVM." @@ -2468,6 +2470,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3665,6 +3668,14 @@ msgstr "long int hindi sinusuportahan sa build na ito" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4106,6 +4117,7 @@ msgstr "pow() na may 3 argumento kailangan ng integers" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4113,11 +4125,13 @@ msgstr "pow() na may 3 argumento kailangan ng integers" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4129,6 +4143,10 @@ msgstr "pow() na may 3 argumento kailangan ng integers" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4706,6 +4724,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Ang liwanag ay dapat sa gitna ng 0 o 255" + #~ msgid "cannot perform relative import" #~ msgstr "hindi maaring isagawa ang relative import" diff --git a/locale/fr.po b/locale/fr.po index e07fca2007..05ec1209de 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -28,10 +28,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Exécution du code arrêté par l'auto-rechargement.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -601,10 +599,6 @@ msgstr "Les deux broches doivent supporter les interruptions matérielles" msgid "Brightness must be 0-1.0" msgstr "La luminosité doit être de 0 à 1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "La luminosité doit être entre 0 et 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -709,6 +703,7 @@ msgstr "" "L'alarme peut seulement être sur deux broches basses depuis le someil " "profond." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Impossible de définir CCCD sur une caractéristique locale" @@ -1475,7 +1470,8 @@ msgstr "Broche invalide pour le canal droit" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1653,6 +1649,7 @@ msgstr "Nom trop long" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Pas de CCCD pour cette caractéristique" @@ -2222,7 +2219,6 @@ msgstr "Nombre de broches Side configurées doit être entre 1 et 5" msgid "Size not supported" msgstr "Taille n'est pas supportée" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "La mémoire de sommeil n'est pas disponible" @@ -2488,6 +2484,10 @@ msgstr "Impossible d'initialiser le parser" msgid "Unable to read color palette data" msgstr "Impossible de lire les données de la palette de couleurs" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Écriture impossible vers nvm." @@ -2525,6 +2525,7 @@ msgstr "Échec inconnu %d" msgid "Unknown gatt error: 0x%04x" msgstr "Erreur gatt inconnue : 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Raison inconnue." @@ -3735,6 +3736,14 @@ msgstr "entiers longs non supportés dans cette build" msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode non pris en charge par le périphérique" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "f-string mal formé" @@ -4179,6 +4188,7 @@ msgstr "pow() avec 3 arguments nécessite des entiers" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4186,11 +4196,13 @@ msgstr "pow() avec 3 arguments nécessite des entiers" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4202,6 +4214,10 @@ msgstr "pow() avec 3 arguments nécessite des entiers" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4776,6 +4792,16 @@ 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 "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Exécution du code arrêté par l'auto-rechargement.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "La luminosité doit être entre 0 et 255" + #~ msgid "cannot perform relative import" #~ msgstr "ne peut pas réaliser un import relatif" diff --git a/locale/hi.po b/locale/hi.po index df890a9bf1..12671ffb38 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -25,7 +25,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -584,10 +584,6 @@ msgstr "" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -688,6 +684,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1429,7 +1426,8 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1605,6 +1603,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2158,7 +2157,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2410,6 +2408,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2447,6 +2449,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3626,6 +3629,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4065,6 +4076,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4072,11 +4084,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4088,6 +4102,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h diff --git a/locale/it_IT.po b/locale/it_IT.po index aada2ef9fa..29415e59f9 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -28,10 +28,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Codice fermato dall'auto-ricarica.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -599,10 +597,6 @@ msgstr "Entrambi i pin devono supportare gli interrupt hardware" msgid "Brightness must be 0-1.0" msgstr "La luminosità deve essere tra 0-1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "La luminosità deve essere compresa tra 0 e 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -703,6 +697,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1453,7 +1448,8 @@ msgstr "Pin non valido per il canale destro" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1631,6 +1627,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2197,7 +2194,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2449,6 +2445,10 @@ msgstr "Inizilizzazione del parser non possibile" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Imposibile scrivere su nvm." @@ -2487,6 +2487,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3683,6 +3684,14 @@ msgstr "long int non supportata in questa build" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4128,6 +4137,7 @@ msgstr "pow() con 3 argomenti richiede interi" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4135,11 +4145,13 @@ msgstr "pow() con 3 argomenti richiede interi" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4151,6 +4163,10 @@ msgstr "pow() con 3 argomenti richiede interi" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4728,6 +4744,16 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Codice fermato dall'auto-ricarica.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "La luminosità deve essere compresa tra 0 e 255" + #~ msgid "cannot perform relative import" #~ msgstr "impossibile effettuare l'importazione relativa" diff --git a/locale/ja.po b/locale/ja.po index b35e3a22c0..20f41e546d 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -27,7 +27,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -591,10 +591,6 @@ msgstr "両方のピンにハードウェア割り込み対応が必要" msgid "Brightness must be 0-1.0" msgstr "brightnessは0から1.0まででなければなりません" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Brightnessは0から255の間でなければなりません" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -697,6 +693,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "ローカルのCharacteristicにはCCCDを設定できません" @@ -1440,7 +1437,8 @@ msgstr "右チャネルのピンが不正" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1616,6 +1614,7 @@ msgstr "名前が長すぎます" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2172,7 +2171,6 @@ msgstr "" msgid "Size not supported" msgstr "サイズは対応していません" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2425,6 +2423,10 @@ msgstr "パーザを初期化できません" msgid "Unable to read color palette data" msgstr "カラーパレットデータを読み込めません" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "nvmに書き込みできません" @@ -2462,6 +2464,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "不明なGATTエラー: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "理由不明" @@ -3646,6 +3649,14 @@ msgstr "このビルドはlong intに非対応" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "不正な形式のf-string" @@ -4087,6 +4098,7 @@ msgstr "pow()の第3引数には整数が必要" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4094,11 +4106,13 @@ msgstr "pow()の第3引数には整数が必要" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4110,6 +4124,10 @@ msgstr "pow()の第3引数には整数が必要" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4682,6 +4700,9 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Brightnessは0から255の間でなければなりません" + #~ msgid "cannot perform relative import" #~ msgstr "相対インポートはできません" diff --git a/locale/ko.po b/locale/ko.po index e77a66c1d9..9ebbf36eb1 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -26,7 +26,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -587,10 +587,6 @@ msgstr "" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "밝기는 0에서 255 사이 여야합니다" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -691,6 +687,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1432,7 +1429,8 @@ msgstr "오른쪽 채널 핀이 잘못되었습니다" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1608,6 +1606,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2161,7 +2160,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2414,6 +2412,10 @@ msgstr "파서를 초기화(init) 할 수 없습니다" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2451,6 +2453,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3630,6 +3633,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4069,6 +4080,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4076,11 +4088,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4092,6 +4106,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4663,6 +4681,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "밝기는 0에서 255 사이 여야합니다" + #~ msgid "integer required" #~ msgstr "정수가 필요합니다" diff --git a/locale/nl.po b/locale/nl.po index cf119a8356..098bb276ba 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -25,7 +25,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -589,10 +589,6 @@ msgstr "Beide pinnen moeten hardware interrupts ondersteunen" msgid "Brightness must be 0-1.0" msgstr "Helderheid moet tussen de 0 en 1.0 liggen" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Helderheid moet tussen de 0 en 255 liggen" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -693,6 +689,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic" @@ -1441,7 +1438,8 @@ msgstr "Ongeldige pin voor rechter kanaal" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1617,6 +1615,7 @@ msgstr "Naam te lang" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Geen CCCD voor deze Characteristic" @@ -2184,7 +2183,6 @@ msgstr "" msgid "Size not supported" msgstr "Afmeting niet ondersteund" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2436,6 +2434,10 @@ msgstr "Niet in staat om de parser te initialiseren" msgid "Unable to read color palette data" msgstr "Niet in staat kleurenpalet data te lezen" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Niet in staat om naar nvm te schrijven." @@ -2473,6 +2475,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "Onbekende gatt fout: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Onbekende reden." @@ -3666,6 +3669,14 @@ msgstr "long int wordt niet ondersteund in deze build" msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode wordt niet ondersteund door randapparaat" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "onjuist gevormde f-string" @@ -4106,6 +4117,7 @@ msgstr "pow() met 3 argumenten vereist integers" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4113,11 +4125,13 @@ msgstr "pow() met 3 argumenten vereist integers" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4129,6 +4143,10 @@ msgstr "pow() met 3 argumenten vereist integers" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4702,6 +4720,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 "Brightness must be between 0 and 255" +#~ msgstr "Helderheid moet tussen de 0 en 255 liggen" + #~ msgid "cannot perform relative import" #~ msgstr "kan geen relatieve import uitvoeren" diff --git a/locale/pl.po b/locale/pl.po index d8158be537..054e175527 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -27,7 +27,7 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" #: supervisor/shared/safe_mode.c @@ -591,10 +591,6 @@ msgstr "Obie nóżki muszą wspierać przerwania sprzętowe" msgid "Brightness must be 0-1.0" msgstr "Jasność musi wynosić 0-1,0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Jasność musi być pomiędzy 0 a 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -695,6 +691,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1440,7 +1437,8 @@ msgstr "Zła nóżka dla prawego kanału" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1616,6 +1614,7 @@ msgstr "Za długa nazwa" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2169,7 +2168,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2421,6 +2419,10 @@ msgstr "Błąd ustawienia parsera" msgid "Unable to read color palette data" msgstr "Nie można odczytać danych palety" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Błąd zapisu do NVM." @@ -2458,6 +2460,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3638,6 +3641,14 @@ msgstr "long int jest nieobsługiwany" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "źle sformatowany f-string" @@ -4078,6 +4089,7 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4085,11 +4097,13 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4101,6 +4115,10 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4673,6 +4691,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Jasność musi być pomiędzy 0 a 255" + #~ msgid "cannot perform relative import" #~ msgstr "nie można wykonać relatywnego importu" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d4e939b6c7..ea3ffae29f 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: 2022-02-21 08:55+0000\n" +"PO-Revision-Date: 2022-03-21 22:57+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "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.11-dev\n" +"X-Generator: Weblate 4.12-dev\n" #: main.c msgid "" @@ -27,10 +27,10 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" "\n" -"O código parou através do auto-reload.\n" +"O código parou pela recarga automática. Recarregando em breve.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -604,10 +604,6 @@ msgstr "Ambos os pinos devem suportar interrupções de hardware" msgid "Brightness must be 0-1.0" msgstr "O brilho deve ser 0-1,0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "O brilho deve estar entre 0 e 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -711,6 +707,7 @@ msgid "Can only alarm on two low pins from deep sleep." msgstr "" "O alarme só é possível nos dois pinos com sinal baixo a partir do deep sleep." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Não é possível definir o CCCD com a característica local" @@ -1466,7 +1463,8 @@ msgstr "Pino inválido para canal direito" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1642,6 +1640,7 @@ msgstr "Nome muito longo" msgid "Nimble out of memory" msgstr "Ágil fora da memória" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Não há nenhum CCCD para esta característica" @@ -2215,7 +2214,6 @@ msgstr "" msgid "Size not supported" msgstr "O tamanho não é suportado" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "Sleep memory não está disponível" @@ -2481,6 +2479,10 @@ msgstr "Não foi possível iniciar o analisador" msgid "Unable to read color palette data" msgstr "Não foi possível ler os dados da paleta de cores" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "Não é possível iniciar a consulta mDNS" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Não é possível gravar no nvm." @@ -2518,6 +2520,7 @@ msgstr "Falha desconhecida %d" msgid "Unknown gatt error: 0x%04x" msgstr "Erro gatt desconhecido: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Motivo desconhecido." @@ -3723,6 +3726,14 @@ msgstr "o long int não é suportado nesta compilação" msgid "loopback + silent mode not supported by peripheral" msgstr "o loopback + o modo silencioso não é suportado pelo periférico" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "O mDNS já foi inicializado" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "O mDNS só funciona com WiFi integrado" + #: py/parse.c msgid "malformed f-string" msgstr "f-string malformado" @@ -4169,6 +4180,7 @@ msgstr "o pow() com 3 argumentos requer números inteiros" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4176,11 +4188,13 @@ msgstr "o pow() com 3 argumentos requer números inteiros" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4192,6 +4206,10 @@ msgstr "o pow() com 3 argumentos requer números inteiros" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4765,6 +4783,16 @@ 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 "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "O código parou através do auto-reload.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "O brilho deve estar entre 0 e 255" + #~ msgid "cannot perform relative import" #~ msgstr "não pode executar a importação relativa" diff --git a/locale/ru.po b/locale/ru.po index c5cacfb4f4..cc26975101 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -29,10 +29,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Программа остановлена автоматической перезагрузкой.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -600,10 +598,6 @@ msgstr "Оба пина должны поддерживать аппаратны msgid "Brightness must be 0-1.0" msgstr "Яркость должна быть в диапазоне от 0 до 1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Яркость должна быть в диапазоне от 0 до 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -708,6 +702,7 @@ msgstr "" "Сигнал из глубокого сна может подаваться только на двух пинах по низкому " "уровню." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Невозможно установить CCCD на локальную Characteristic" @@ -1467,7 +1462,8 @@ msgstr "Недопустимый пин для правого канала" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1644,6 +1640,7 @@ msgstr "Имя слишком длинное" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Нет CCCD для этой Characteristic" @@ -2207,7 +2204,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2461,6 +2457,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2498,6 +2498,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3677,6 +3678,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4116,6 +4125,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4123,11 +4133,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4139,6 +4151,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4710,6 +4726,16 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Программа остановлена автоматической перезагрузкой.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Яркость должна быть в диапазоне от 0 до 255" + #, c-format #~ msgid "No I2C device at address: %x" #~ msgstr "Нет устройства I2C по адресу: %x" diff --git a/locale/sv.po b/locale/sv.po index 3f34ba0218..9a2925f6f6 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: 2022-02-19 20:22+0000\n" +"PO-Revision-Date: 2022-03-23 08:58+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "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.11-dev\n" +"X-Generator: Weblate 4.12-dev\n" #: main.c msgid "" @@ -27,10 +27,10 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" "\n" -"Koden stoppades av auto-omladdning.\n" +"Koden stoppades av automatisk laddning. Omladdning sker strax.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -594,10 +594,6 @@ msgstr "Båda pinnarna måste stödja maskinvaruavbrott" msgid "Brightness must be 0-1.0" msgstr "Ljusstyrkan måste vara mellan 0 och 1,0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "Ljusstyrka måste vara mellan 0 och 255" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -699,6 +695,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "Kan bara larma från djup sömn på två låga pinnar." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Kan inte ställa in CCCD på lokal karaktäristik" @@ -1448,7 +1445,8 @@ msgstr "Ogiltig pinne för höger kanal" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1625,6 +1623,7 @@ msgstr "Name är för långt" msgid "Nimble out of memory" msgstr "Nimble har inget minne kvar" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Ingen CCCD för denna karaktäristik" @@ -2190,7 +2189,6 @@ msgstr "Sido-setets antal pinnar måste vara mellan 1 och 5" msgid "Size not supported" msgstr "Storleken stöds inte" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "Sömnminne inte tillgängligt" @@ -2452,6 +2450,10 @@ msgstr "Kan inte initiera tolken" msgid "Unable to read color palette data" msgstr "Det går inte att läsa färgpalettdata" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "Det gick inte att starta mDNS-frågan" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Det gick inte att skriva till nvm." @@ -2489,6 +2491,7 @@ msgstr "Okänt fel %d" msgid "Unknown gatt error: 0x%04x" msgstr "Okänt gatt-fel: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Okänd anledning." @@ -3686,6 +3689,14 @@ msgstr "long int stöds inte i denna build" msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + tyst läge stöds inte av kringutrustning" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "mDNS har redan initierats" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "mDNS fungerar bara med inbyggt WiFi" + #: py/parse.c msgid "malformed f-string" msgstr "f-sträng har felaktigt format" @@ -4126,6 +4137,7 @@ msgstr "pow() med 3 argument kräver heltal" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4133,11 +4145,13 @@ msgstr "pow() med 3 argument kräver heltal" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4149,6 +4163,10 @@ msgstr "pow() med 3 argument kräver heltal" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4722,6 +4740,16 @@ 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 "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Koden stoppades av auto-omladdning.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "Ljusstyrka måste vara mellan 0 och 255" + #~ msgid "cannot perform relative import" #~ msgstr "kan inte utföra relativ import" diff --git a/locale/tr.po b/locale/tr.po index a4bc023646..6966ee8ae9 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -28,10 +28,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"Program otomatik yeniden yükleme tarafından sonlandırıldı.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -599,10 +597,6 @@ msgstr "" msgid "Brightness must be 0-1.0" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -703,6 +697,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -1444,7 +1439,8 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1620,6 +1616,7 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -2176,7 +2173,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" @@ -2428,6 +2424,10 @@ msgstr "" msgid "Unable to read color palette data" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" @@ -2465,6 +2465,7 @@ msgstr "" msgid "Unknown gatt error: 0x%04x" msgstr "" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "" @@ -3644,6 +3645,14 @@ msgstr "" msgid "loopback + silent mode not supported by peripheral" msgstr "" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "" @@ -4083,6 +4092,7 @@ msgstr "" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4090,11 +4100,13 @@ msgstr "" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4106,6 +4118,10 @@ msgstr "" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4676,3 +4692,10 @@ msgstr "" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of shape (n_section, 2)" msgstr "" + +#~ msgid "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "Program otomatik yeniden yükleme tarafından sonlandırıldı.\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index f58dd12cdb..0ad1a11f80 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -28,10 +28,8 @@ msgstr "" #: main.c msgid "" "\n" -"Code stopped by auto-reload.\n" +"Code stopped by auto-reload. Reloading soon.\n" msgstr "" -"\n" -"dàimǎ de yùnxíng yīnwéi zìdòng chóngxīn jiāzǎi ér tíngzhǐ.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -601,10 +599,6 @@ msgstr "liǎnggè yǐnjiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn" msgid "Brightness must be 0-1.0" msgstr "Liàngdù bìxū wèi 0-1.0" -#: shared-bindings/supervisor/__init__.c -msgid "Brightness must be between 0 and 255" -msgstr "liàngdù bìxū jièyú 0 dào 255 zhījiān" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -710,6 +704,7 @@ msgstr "" msgid "Can only alarm on two low pins from deep sleep." msgstr "zhǐ néng cóng shēn dù shuì mián zhōng bào jǐng liǎng gè dī yǐn jiǎo." +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng" @@ -1462,7 +1457,8 @@ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" #: ports/espressif/common-hal/canio/CAN.c #: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c #: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/I2C.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c @@ -1639,6 +1635,7 @@ msgstr "Míngchēng tài zhǎng" msgid "Nimble out of memory" msgstr "líng huó de bǎi tuō jì yì" +#: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "Zhège tèzhēng méiyǒu CCCD" @@ -2203,7 +2200,6 @@ msgstr "cè miàn shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān" msgid "Size not supported" msgstr "bù zhī chí dà xiǎo" -#: ports/atmel-samd/common-hal/alarm/SleepMemory.c #: ports/raspberrypi/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "shuì mián jì yì bù kě yòng" @@ -2464,6 +2460,10 @@ msgstr "Wúfǎ chūshǐhuà jiěxī qì" msgid "Unable to read color palette data" msgstr "Wúfǎ dúqǔ tiáosèbǎn shùjù" +#: ports/espressif/common-hal/mdns/Server.c +msgid "Unable to start mDNS query" +msgstr "" + #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Wúfǎ xiě rù nvm." @@ -2501,6 +2501,7 @@ msgstr "wèi zhī gù zhàng %d" msgid "Unknown gatt error: 0x%04x" msgstr "Wèizhī de gatt cuòwù: 0x%04x" +#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." msgstr "Yuányīn bùmíng." @@ -3697,6 +3698,14 @@ msgstr "cǐ bǎnběn bù zhīchí zhǎng zhěngshù" msgid "loopback + silent mode not supported by peripheral" msgstr "Wài shè bù zhī chí huán huí + jìng yīn mó shì" +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS already initialized" +msgstr "" + +#: ports/espressif/common-hal/mdns/Server.c +msgid "mDNS only works with built-in WiFi" +msgstr "" + #: py/parse.c msgid "malformed f-string" msgstr "jīxíng de f-string" @@ -4136,6 +4145,7 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +#: ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -4143,11 +4153,13 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h #: ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h #: ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4159,6 +4171,10 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" #: ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h #: ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +#: ports/espressif/boards/hexky_s2/mpconfigboard.h +#: ports/espressif/boards/hiibot_iots2/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +#: ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h #: ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h #: ports/espressif/boards/lolin_s2_mini/mpconfigboard.h #: ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -4735,6 +4751,16 @@ 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 "" +#~ "\n" +#~ "Code stopped by auto-reload.\n" +#~ msgstr "" +#~ "\n" +#~ "dàimǎ de yùnxíng yīnwéi zìdòng chóngxīn jiāzǎi ér tíngzhǐ.\n" + +#~ msgid "Brightness must be between 0 and 255" +#~ msgstr "liàngdù bìxū jièyú 0 dào 255 zhījiān" + #~ msgid "cannot perform relative import" #~ msgstr "wúfǎ zhíxíng xiāngguān dǎorù" diff --git a/main.c b/main.c index 9bfdb37cc1..ba6950e34c 100644 --- a/main.c +++ b/main.c @@ -52,7 +52,7 @@ #include "supervisor/memory.h" #include "supervisor/port.h" #include "supervisor/serial.h" -#include "supervisor/shared/autoreload.h" +#include "supervisor/shared/reload.h" #include "supervisor/shared/safe_mode.h" #include "supervisor/shared/stack.h" #include "supervisor/shared/status_leds.h" @@ -124,7 +124,6 @@ static void reset_devices(void) { } STATIC void start_mp(supervisor_allocation *heap, bool first_run) { - autoreload_stop(); supervisor_workflow_reset(); // Stack limit should be less than real stack size, so we have a chance @@ -329,14 +328,20 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re result.exception = MP_OBJ_NULL; result.exception_line = 0; - bool skip_repl; + bool skip_repl = false; bool skip_wait = false; bool found_main = false; uint8_t next_code_options = 0; // Collects stickiness bits that apply in the current situation. uint8_t next_code_stickiness_situation = SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET; + // Do the filesystem flush check before reload in case another write comes + // in while we're doing the flush. if (safe_mode == NO_SAFE_MODE) { + stack_resize(); + filesystem_flush(); + } + if (safe_mode == NO_SAFE_MODE && !autoreload_pending()) { static const char *const supported_filenames[] = STRING_LIST( "code.txt", "code.py", "main.py", "main.txt"); #if CIRCUITPY_FULL_BUILD @@ -345,8 +350,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re "main.txt.py", "main.py.txt", "main.txt.txt","main.py.py"); #endif - stack_resize(); - filesystem_flush(); supervisor_allocation *heap = allocate_remaining_memory(); // Prepare the VM state. Includes an alarm check/reset for sleep. @@ -389,13 +392,14 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re // Print done before resetting everything so that we get the message over // BLE before it is reset and we have a delay before reconnect. - if (reload_requested && result.return_code == PYEXEC_EXCEPTION) { - serial_write_compressed(translate("\nCode stopped by auto-reload.\n")); + if ((result.return_code & PYEXEC_RELOAD) && supervisor_get_run_reason() == RUN_REASON_AUTO_RELOAD) { + serial_write_compressed(translate("\nCode stopped by auto-reload. Reloading soon.\n")); } else { serial_write_compressed(translate("\nCode done running.\n")); } - // Finished executing python code. Cleanup includes a board reset. + + // Finished executing python code. Cleanup includes filesystem flush and a board reset. cleanup_after_vm(heap, result.exception); // If a new next code file was set, that is a reason to keep it (obviously). Stuff this into @@ -407,8 +411,14 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re next_code_options |= SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET; } - if (reload_requested) { + if (result.return_code & PYEXEC_RELOAD) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD; + // Reload immediately unless the reload is due to autoreload. In that + // case, we wait below to see if any other writes occur. + if (supervisor_get_run_reason() != RUN_REASON_AUTO_RELOAD) { + skip_repl = true; + skip_wait = true; + } } else if (result.return_code == 0) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_SUCCESS; if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS) { @@ -426,7 +436,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re } } if (result.return_code & PYEXEC_FORCED_EXIT) { - skip_repl = reload_requested; + skip_repl = false; skip_wait = true; } } @@ -466,22 +476,27 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re size_t total_time = blink_time + LED_SLEEP_TIME_MS; #endif + // This loop is waits after code completes. It waits for fake sleeps to + // finish, user input or autoreloads. #if CIRCUITPY_ALARM bool fake_sleeping = false; #endif while (!skip_wait) { RUN_BACKGROUND_TASKS; - // If a reload was requested by the supervisor or autoreload, return - if (reload_requested) { + // If a reload was requested by the supervisor or autoreload, return. + if (autoreload_ready()) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD; // Should the STICKY_ON_SUCCESS and STICKY_ON_ERROR bits be cleared in // next_code_stickiness_situation? I can see arguments either way, but I'm deciding // "no" for now, mainly because it's a bit less code. At this point, we have both a // success or error and a reload, so let's have both of the respective options take // effect (in OR combination). - reload_requested = false; skip_repl = true; + // We're kicking off the autoreload process so reset now. If any + // other reloads trigger after this, then we'll want another wait + // period. + autoreload_reset(); break; } @@ -508,7 +523,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re #endif // If messages haven't been printed yet, print them - if (!printed_press_any_key && serial_connected()) { + if (!printed_press_any_key && serial_connected() && !autoreload_pending()) { if (!serial_connected_at_start) { print_code_py_status_message(safe_mode); } @@ -627,13 +642,14 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re } } + // Done waiting, start the board back up. + // free code allocation if unused if ((next_code_options & next_code_stickiness_situation) == 0) { free_memory(next_code_allocation); next_code_allocation = NULL; } - // Done waiting, start the board back up. #if CIRCUITPY_STATUS_LED if (led_active) { new_status_color(BLACK); @@ -757,7 +773,7 @@ STATIC int run_repl(bool first_run) { usb_setup_with_vm(); #endif - autoreload_suspend(AUTORELOAD_LOCK_REPL); + autoreload_suspend(AUTORELOAD_SUSPEND_REPL); // Set the status LED to the REPL color before running the REPL. For // NeoPixels and DotStars this will be sticky but for PWM or single LED it @@ -787,7 +803,7 @@ STATIC int run_repl(bool first_run) { status_led_deinit(); #endif - autoreload_resume(AUTORELOAD_LOCK_REPL); + autoreload_resume(AUTORELOAD_SUSPEND_REPL); return exit_code; } diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index b9bc363448..b529751f7f 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -197,7 +197,11 @@ CFLAGS += \ -DSAM_D5X_E5X -DSAME51 endif - +# GCC 11 adds stringop bounds checks that trigger when writing a memory region +# we know is ok. It's not clear how to give the compiler the info it needs so +# disable the checks for now. +# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 +CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs LDFLAGS += -flto=$(shell $(NPROC)) diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h index 72d3709c91..2f4abe7191 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h @@ -9,7 +9,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_PB03) // BC needed? -// #define AUTORESET_DELAY_MS 500 // If you change this, then make sure to update the linker scripts as well to // make sure you don't overwrite code diff --git a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk index 5ee22c59ad..5d0734f69d 100644 --- a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk @@ -9,3 +9,6 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +CIRCUITPY_ONEWIREIO = 0 +CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h index 38c6d1e559..ce5b43cf44 100755 --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h @@ -5,8 +5,6 @@ #define MICROPY_HW_LED_STATUS (&pin_PB13) -#define AUTORESET_DELAY_MS 500 - #define BOARD_HAS_CRYSTAL 1 #define DEFAULT_I2C_BUS_SCL (&pin_PB03) diff --git a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk index c09005dba3..1770fabc69 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk @@ -10,14 +10,14 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ -CIRCUITPY_BLEIO = 0 -CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_AESIO = 0 CIRCUITPY_ONEWIREIO = 0 +CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_SDCARDIO = 0 CIRCUITPY_SHARPDISPLAY = 0 +CIRCUITPY_TRACEBACK = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.h b/ports/atmel-samd/boards/pycubed/mpconfigboard.h index 2d4d489d21..2024b242a7 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.h @@ -6,8 +6,6 @@ #define MICROPY_HW_LED_STATUS (&pin_PA16) #define MICROPY_HW_NEOPIXEL (&pin_PA21) -#define AUTORESET_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h index bd45a814fb..284fd36d1f 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h @@ -9,8 +9,6 @@ #define EXTERNAL_FLASH_QSPI_SINGLE #define EXTERNAL_FLASH_NO_JEDEC -#define AUTORESET_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.h b/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.h index 9332966dd4..8e0a2ec2d0 100644 --- a/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.h @@ -9,8 +9,6 @@ #define EXTERNAL_FLASH_QSPI_SINGLE #define EXTERNAL_FLASH_NO_JEDEC -#define AUTORESET_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.h b/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.h index eed590fda4..4cab70365f 100644 --- a/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.h @@ -5,8 +5,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_PA21) -#define AUTORESET_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/atmel-samd/boards/seeeduino_xiao_kb/pins.c b/ports/atmel-samd/boards/seeeduino_xiao_kb/pins.c index e2c10330a9..b5a43f022b 100644 --- a/ports/atmel-samd/boards/seeeduino_xiao_kb/pins.c +++ b/ports/atmel-samd/boards/seeeduino_xiao_kb/pins.c @@ -1,7 +1,8 @@ #include "shared-bindings/board/__init__.h" -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_board_id), MP_ROM_PTR(&board_module_id_obj) }, +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + // Analog pins { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, @@ -28,11 +29,32 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA05) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - // LED pins - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA17) }, // status - { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_PA17) }, + // UART pins + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB09) }, + // SPI pins + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA05) }, + + // I2C pins + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + + { MP_ROM_QSTR(MP_QSTR_LED_INVERTED), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_YELLOW_LED_INVERTED), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_RX_LED_INVERTED), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_BLUE_LED1_INVERTED), MP_ROM_PTR(&pin_PA18) }, + + { MP_ROM_QSTR(MP_QSTR_TX_LED_INVERTED), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_BLUE_LED2_INVERTED), MP_ROM_PTR(&pin_PA19) }, + + // Comm objects + { 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); +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk b/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk index 568503afe9..ea14f63ad9 100644 --- a/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk @@ -11,4 +11,6 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 # There are many pin definitions on this board; it doesn't quite fit on very large translations. +CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_RAINBOWIO = 0 +CIRCUITPY_USB_MIDI = 0 diff --git a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.h b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.h index c022dd5daa..958d6417ba 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.h +++ b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.h @@ -6,8 +6,6 @@ #define MICROPY_HW_LED_STATUS (&pin_PA23) #define MICROPY_HW_NEOPIXEL (&pin_PB03) -#define AUTORESET_DELAY_MS 500 - #define BOARD_HAS_CRYSTAL 1 #define DEFAULT_SPI_BUS_SCK (&pin_PA17) diff --git a/ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c b/ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c index 490c595e74..10407d3b3a 100644 --- a/ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c @@ -69,9 +69,13 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu common_hal_digitalio_digitalinout_construct(&self->write, write); common_hal_digitalio_digitalinout_switch_to_output(&self->write, true, DRIVE_MODE_PUSH_PULL); - self->read.base.type = &digitalio_digitalinout_type; - common_hal_digitalio_digitalinout_construct(&self->read, read); - common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL); + self->read.base.type = &mp_type_NoneType; + if (read != NULL) { + self->read.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->read, read); + common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL); + never_reset_pin_number(read->number); + } self->data0_pin = data_pin; self->write_group = &PORT->Group[write->number / 32]; @@ -89,7 +93,6 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu never_reset_pin_number(command->number); never_reset_pin_number(chip_select->number); never_reset_pin_number(write->number); - never_reset_pin_number(read->number); for (uint8_t i = 0; i < 8; i++) { never_reset_pin_number(data_pin + i); } diff --git a/ports/atmel-samd/mphalport.c b/ports/atmel-samd/mphalport.c index e196312ca3..a039b5d258 100644 --- a/ports/atmel-samd/mphalport.c +++ b/ports/atmel-samd/mphalport.c @@ -34,7 +34,6 @@ #include "py/smallint.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/autoreload.h" #include "hal/include/hal_atomic.h" #include "hal/include/hal_delay.h" diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 7be1fdb535..cccef8be53 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -129,8 +129,9 @@ #include "common-hal/_pew/PewPew.h" #endif static volatile bool sleep_ok = true; + #ifdef SAMD21 -static uint8_t _tick_event_channel = 0; +uint8_t _tick_event_channel; // Sleeping requires a register write that can stall interrupt handling. Turning // off sleeps allows for more accurate interrupt timing. (Python still thinks @@ -142,7 +143,13 @@ void rtc_start_pulse(void) { void rtc_end_pulse(void) { sleep_ok = true; } -#endif +#endif // SAMD21 + +static void reset_ticks(void) { + #ifdef SAMD21 + _tick_event_channel = EVSYS_SYNCH_NUM; + #endif +} extern volatile bool mp_msc_enabled; @@ -426,9 +433,7 @@ void reset_port(void) { #endif reset_event_system(); - #ifdef SAMD21 - _tick_event_channel = EVSYS_SYNCH_NUM; - #endif + reset_ticks(); reset_all_pins(); @@ -498,7 +503,7 @@ uint32_t port_get_saved_word(void) { static volatile uint64_t overflowed_ticks = 0; static uint32_t _get_count(uint64_t *overflow_count) { - while(1) { + while (1) { // Disable interrupts so we can grab the count and the overflow atomically. common_hal_mcu_disable_interrupts(); @@ -521,7 +526,7 @@ static uint32_t _get_count(uint64_t *overflow_count) { return count; } - // Try again if overflow hasn't been processed yet. + // Try again if overflow hasn't been processed yet. } } @@ -620,7 +625,7 @@ void port_enable_tick(void) { RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_PER2; #endif #ifdef SAMD21 - // SAMD21 ticks won't survive port_reset(). This *should* be ok since it'll + // SAMD21 ticks won't survive reset_port(). This *should* be ok since it'll // be triggered by ticks and no Python will be running. if (_tick_event_channel >= EVSYS_SYNCH_NUM) { turn_on_event_system(); @@ -653,6 +658,7 @@ void port_disable_tick(void) { uint8_t value = 1 << _tick_event_channel; EVSYS->INTENCLR.reg = EVSYS_INTENSET_EVD(value); } + _tick_event_channel = EVSYS_SYNCH_NUM; #endif } diff --git a/ports/atmel-samd/supervisor/usb.c b/ports/atmel-samd/supervisor/usb.c index 2a4c2d4f78..63ceaa9a33 100644 --- a/ports/atmel-samd/supervisor/usb.c +++ b/ports/atmel-samd/supervisor/usb.c @@ -63,24 +63,25 @@ void init_usb_hardware(void) { #ifdef SAMD21 void USB_Handler(void) { - usb_irq_handler(); + usb_irq_handler(0); } #endif #ifdef SAM_D5X_E5X +// These are different subsets of USB interrupts, *NOT* different USB peripherals. void USB_0_Handler(void) { - usb_irq_handler(); + usb_irq_handler(0); } void USB_1_Handler(void) { - usb_irq_handler(); + usb_irq_handler(0); } void USB_2_Handler(void) { - usb_irq_handler(); + usb_irq_handler(0); } void USB_3_Handler(void) { - usb_irq_handler(); + usb_irq_handler(0); } #endif diff --git a/ports/broadcom/mpconfigport.h b/ports/broadcom/mpconfigport.h index abd0580999..4fce84c973 100644 --- a/ports/broadcom/mpconfigport.h +++ b/ports/broadcom/mpconfigport.h @@ -60,7 +60,7 @@ #define MICROPY_PORT_ROOT_POINTERS \ CIRCUITPY_COMMON_ROOT_POINTERS -#define DEBUG_UART_TX (&pin_GPIO14) -#define DEBUG_UART_RX (&pin_GPIO15) +#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO14) +#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO15) #endif // __INCLUDED_MPCONFIGPORT_H diff --git a/ports/broadcom/supervisor/usb.c b/ports/broadcom/supervisor/usb.c index 5430b6f943..7c38b1a4c0 100644 --- a/ports/broadcom/supervisor/usb.c +++ b/ports/broadcom/supervisor/usb.c @@ -35,7 +35,7 @@ uint32_t SystemCoreClock = 700 * 1000 * 1000; void USB_IRQHandler(void) { - usb_irq_handler(); + usb_irq_handler(0); } void init_usb_hardware(void) { diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index afbb51bbad..4c834397b9 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -6,7 +6,7 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # The component list here determines what options we get in menuconfig and what the ninja file # can build. -set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos bt) +set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos bt) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(circuitpython) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index beb0ccd679..96360d06bd 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -262,6 +262,11 @@ SRC_C += \ endif endif +ifeq ($(IDF_TARGET),esp32c3) +SRC_C += \ + supervisor/usb_serial_jtag.c +endif + $(BUILD)/i2s_lcd_esp32s2_driver.o: CFLAGS += -Wno-sign-compare ifneq ($(CIRCUITPY_USB),0) @@ -360,7 +365,7 @@ $(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) -ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant +ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) ESP_IDF_COMPONENTS_LINK += bt BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h index f7f988b861..793b675784 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h @@ -32,12 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) #define MICROPY_HW_NEOPIXEL_COUNT (6) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h index 2eb3344029..0be1357939 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h @@ -32,12 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h index a68593a308..bafb280014 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h @@ -32,12 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h index 9c759ac1ca..6cbe314f42 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -32,12 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c new file mode 100644 index 0000000000..d4d55c2e23 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c @@ -0,0 +1,50 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * 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 + * 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" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { + reset_board(); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + // Turn on I2C power by default. + + gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(7, true); +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h new file mode 100644 index 0000000000..b6477c766b --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32S3 No PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO38) +#define DEFAULT_UART_BUS_TX (&pin_GPIO39) + +#define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk new file mode 100644 index 0000000000..7c768eb51c --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x239A +USB_PID = 0x8114 +USB_PRODUCT = "Adafruit Feather ESP32S3 No PSRAM" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=8MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/pins.c b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/pins.c new file mode 100644 index 0000000000..cf4c915e7f --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/pins.c @@ -0,0 +1,73 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig new file mode 100644 index 0000000000..9d924272ec --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig @@ -0,0 +1,7 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=n + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h index a268020b7c..a6f46af978 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h @@ -33,12 +33,6 @@ #define MICROPY_HW_APA102_SCK (&pin_GPIO15) #define MICROPY_HW_APA102_COUNT (5) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO33) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index ad81cc2ca7..9f08ca330c 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -34,12 +34,6 @@ #define CIRCUITPY_STATUS_LED_POWER_INVERTED (1) #define MICROPY_HW_NEOPIXEL_COUNT (4) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h index 51d93224a4..3d9250bec1 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h @@ -31,12 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c b/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c new file mode 100644 index 0000000000..7a9ff98fcb --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * Copyright (c) 2021 skieast/Bruce Segal + * + * 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/microcontroller/Pin.h" +#include "supervisor/board.h" + +#include "components/driver/include/driver/gpio.h" +#include "soc/usb_serial_jtag_struct.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h new file mode 100644 index 0000000000..0cc6509647 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h @@ -0,0 +1,50 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * Copyright (c) 2021 skieast/Bruce Segal + * + * 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. + */ + +// Board setup +#define MICROPY_HW_BOARD_NAME "Adafruit QT Py ESP32C3" +#define MICROPY_HW_MCU_NAME "ESP32-C3FN4" + +// Status LED +#define MICROPY_HW_NEOPIXEL (&pin_GPIO2) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO5}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO7, .miso = &pin_GPIO8}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk new file mode 100644 index 0000000000..36d9c3b5d6 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0x0000239A +CIRCUITPY_CREATION_ID = 0x00010001 + +IDF_TARGET = esp32c3 + +INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/pins.c b/ports/espressif/boards/adafruit_qtpy_esp32c3/pins.c new file mode 100644 index 0000000000..0eb3ddecd2 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/pins.c @@ -0,0 +1,85 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * Copyright (c) 2021 skieast/Bruce Segal + * + * 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/board/__init__.h" + +#include "shared-bindings/board/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig new file mode 100644 index 0000000000..f9b0292400 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig @@ -0,0 +1,62 @@ +# Automatically generated file. DO NOT EDIT. +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +# Bootloader config +# +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set +CONFIG_BOOTLOADER_LOG_LEVEL=0 +# end of Bootloader config + +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# end of Serial flasher config + +# +# Partition Table +# +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" +# end of Partition Table + +# +# Compiler options +# +# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set +# end of Compiler options + +# +# Component config +# +# +# ESP System Settings +# +# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set +CONFIG_ESP_CONSOLE_SECONDARY_NONE=y +# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +# end of ESP System Settings + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-QTPy-ESP32C3" +# end of LWIP + +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set +# end of SPI Flash driver + +# end of Component config + +# +# Deprecated options for backward compatibility +# +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set +CONFIG_LOG_BOOTLOADER_LEVEL=0 +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +# end of Deprecated options for backward compatibility diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h index 4afce4c042..b580cce450 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h @@ -32,12 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO39) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO38) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define CIRCUITPY_BOARD_I2C (2) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO7}, \ {.scl = &pin_GPIO40, .sda = &pin_GPIO41}} @@ -49,8 +43,3 @@ #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO5, .rx = &pin_GPIO16}} #define DOUBLE_TAP_PIN (&pin_GPIO10) - -#ifdef DEBUG -#define DEBUG_UART_RX (&pin_GPIO16) -#define DEBUG_UART_TX (&pin_GPIO5) -#endif diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h index 68a2a482f3..24aa81fb79 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h @@ -32,12 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO38) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO37) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define CIRCUITPY_BOARD_I2C (2) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO7}, \ {.scl = &pin_GPIO40, .sda = &pin_GPIO41}} diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h index 36a0125ca4..d7a81502fa 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h @@ -37,11 +37,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define DEBUG_UART_TX DEFAULT_UART_BUS_TX - -// For entering safe mode -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - -// Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") +#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h index 026e06312a..0b8a3b0ae8 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h @@ -37,11 +37,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define DEBUG_UART_TX DEFAULT_UART_BUS_TX - -// For entering safe mode -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - -// Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") +#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h index 1af2d2420c..04b2daf7cc 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h @@ -32,9 +32,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" // #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/artisense_rd00/mpconfigboard.h b/ports/espressif/boards/artisense_rd00/mpconfigboard.h index 0ee8c48ab8..afac8d9f92 100644 --- a/ports/espressif/boards/artisense_rd00/mpconfigboard.h +++ b/ports/espressif/boards/artisense_rd00/mpconfigboard.h @@ -33,11 +33,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_UART_BUS_RX (&pin_GPIO17) #define DEFAULT_UART_BUS_TX (&pin_GPIO18) diff --git a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.h b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.h index 18fa67d245..8dae596d7c 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.h @@ -29,11 +29,6 @@ #define MICROPY_HW_BOARD_NAME "ATMegaZero ESP32-S2" #define MICROPY_HW_MCU_NAME "ESP32S2" -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h index cda4e0e534..ca5d782036 100644 --- a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h +++ b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h @@ -28,8 +28,3 @@ #define MICROPY_HW_BOARD_NAME "CrumpS2" #define MICROPY_HW_MCU_NAME "ESP32S2" - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h index cc4fd40df2..229af1c865 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h @@ -28,9 +28,3 @@ #define MICROPY_HW_BOARD_NAME "BastWiFi" #define MICROPY_HW_MCU_NAME "ESP32S2" - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h index 28c2ea11eb..69c4580aba 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h @@ -37,11 +37,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define DEBUG_UART_TX DEFAULT_UART_BUS_TX - -// For entering safe mode -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO2) - -// Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") +#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c new file mode 100644 index 0000000000..0432485111 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * 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 + * 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" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h new file mode 100644 index 0000000000..c4264f1a84 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.h @@ -0,0 +1,35 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "ESP32-S2-DevKitC-1-N4" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO18) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk new file mode 100644 index 0000000000..e902c3975a --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x303A +USB_PID = 0x7009 +USB_PRODUCT = "ESP32-S2-DevKitC-1-N4" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s2 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/pins.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/pins.c new file mode 100644 index 0000000000..435f251c80 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/pins.c @@ -0,0 +1,53 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig new file mode 100644 index 0000000000..1aad0eadd1 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s2" +# end of LWIP diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h index 66214ed214..0efa168d5d 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk index 7644ce232c..d007558640 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x239A -USB_PID = 0x80A6 +USB_VID = 0x303A +USB_PID = 0x7009 USB_PRODUCT = "ESP32-S2-DevKitC-1-N4R2" USB_MANUFACTURER = "Espressif" diff --git a/ports/espressif/boards/espressif_esp32s3_box/board.c b/ports/espressif/boards/espressif_esp32s3_box/board.c index 7111c90578..8e93c31e07 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box/board.c @@ -37,9 +37,8 @@ uint8_t display_init_sequence[] = { 0x01, 0x80, 0x96, // _SWRESET and Delay 150ms 0x11, 0x80, 0xFF, // _SLPOUT and Delay 500ms 0x3A, 0x81, 0x55, 0x0A, // _COLMOD and Delay 10ms - 0x36, 0x01, 0x08, // _MADCTL 0x13, 0x80, 0x0A, // _NORON and Delay 10ms - 0x36, 0x01, 0xC0, // _MADCTL + 0x36, 0x01, 0xC8, // _MADCTL 0x29, 0x80, 0xFF, // _DISPON and Delay 500ms }; diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h index b8a2207f93..b38a0305e4 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h @@ -28,9 +28,3 @@ #define MICROPY_HW_BOARD_NAME "ESP32-S3-Box-2.5" #define MICROPY_HW_MCU_NAME "ESP32S3" - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h index 4c584e96cd..ecd705d282 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO48) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h index eb6cae949f..bb9bd07eef 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO48) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig index e3a4d6ce68..3e366f0172 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig @@ -1,3 +1,9 @@ +# +# Component config +# +# +# ESP32S3-Specific +# CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config @@ -9,12 +15,10 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_DEFAULT_PSRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # +CONFIG_DEFAULT_PSRAM_CLK_IO=30 CONFIG_DEFAULT_PSRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 @@ -30,8 +34,14 @@ CONFIG_SPIRAM_USE_MEMMAP=y # CONFIG_SPIRAM_USE_CAPS_ALLOC is not set # CONFIG_SPIRAM_USE_MALLOC is not set CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h index f3a2941655..afbdf826c5 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO48) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h index b1b8170702..0058da1a4c 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO48) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h index 9379c015b2..ea13170239 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h +++ b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h @@ -31,12 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO39) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO40) diff --git a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h index 21f6ae2456..8f89bfcbc4 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h +++ b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h index 21f6ae2456..8f89bfcbc4 100644 --- a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h +++ b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.h b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.h index 2aac10fe79..faa3a74bf6 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.h +++ b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.h b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.h index a5aa83814d..e467387447 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.h +++ b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.h b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.h index c0a8659b1d..a3a3d42efd 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.h +++ b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.h b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.h index b17a65c10c..2950804c2b 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.h +++ b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h index 5406f88f01..a20ea362f2 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) diff --git a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h index c0b6fee029..17719c6f40 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h @@ -31,12 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO40) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO41) diff --git a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h index 5d51ff002f..53409cf263 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) diff --git a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h index 14bc06f0e3..ee19f54ca5 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h @@ -31,12 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO40) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO41) diff --git a/ports/espressif/boards/hexky_s2/board.c b/ports/espressif/boards/hexky_s2/board.c new file mode 100644 index 0000000000..88ac4fc661 --- /dev/null +++ b/ports/espressif/boards/hexky_s2/board.c @@ -0,0 +1,148 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * 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 + * 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" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/board/__init__.h" + +displayio_fourwire_obj_t board_display_obj; + +#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, 0x68, + 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, +}; + + +void board_init(void) { + busio_spi_obj_t *spi = common_hal_board_create_spi(0); + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + + common_hal_displayio_fourwire_construct( + bus, + spi, + &pin_GPIO34, // DC + &pin_GPIO33, // CS + &pin_GPIO41, // 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) + 240, // height (after rotation) + 0, // column start + 0, // 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 + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO45, // 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_GPIO45); // backlight pin +} + +bool board_requests_safe_mode(void) { + return false; +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Override the I2C/TFT power pin reset to prevent resetting the display. + if (pin_number == 21) { + // Turn on TFT and I2C + gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(21, true); + return true; + } + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { + // TODO: Should we turn off the display when asleep? +} diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.h b/ports/espressif/boards/hexky_s2/mpconfigboard.h new file mode 100644 index 0000000000..31dd096beb --- /dev/null +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 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. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "HexKyS2" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO40) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.mk b/ports/espressif/boards/hexky_s2/mpconfigboard.mk new file mode 100644 index 0000000000..726bd3bb51 --- /dev/null +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.mk @@ -0,0 +1,20 @@ +USB_VID = 0x303A +USB_PID = 0x80D9 + +USB_PRODUCT = "HexKy_S2" +USB_MANUFACTURER = "FutureKeys" + +IDF_TARGET = esp32s2 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/hexky_s2/pins.c b/ports/espressif/boards/hexky_s2/pins.c new file mode 100644 index 0000000000..3c8d677f0b --- /dev/null +++ b/ports/espressif/boards/hexky_s2/pins.c @@ -0,0 +1,56 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + // ANALOG PINS + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO18) }, + // DIGITAL PINS + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO10) }, + // USER Buttons + { MP_ROM_QSTR(MP_QSTR_SW1), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SW2), MP_ROM_PTR(&pin_GPIO42) }, + // Not broken out - LED + { MP_ROM_QSTR(MP_QSTR_D13_LED), MP_ROM_PTR(&pin_GPIO39) }, + // Not broken out - NEOPIXEL + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) }, + // Not broken out - VBAT_SENSE + { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO13) }, + // Not broken out - ST7789 LCD PINS + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_GPIO41) }, + // UART + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + // I2C + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + // SPI + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + // DFU Button + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + + { 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_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/hexky_s2/sdkconfig b/ports/espressif/boards/hexky_s2/sdkconfig new file mode 100644 index 0000000000..f19afafa3d --- /dev/null +++ b/ports/espressif/boards/hexky_s2/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM clock and cs IO for ESP32S2 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM clock and cs IO for ESP32S2 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_26M is not set +# CONFIG_SPIRAM_SPEED_20M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# end of LWIP diff --git a/ports/espressif/boards/hiibot_iots2/mpconfigboard.h b/ports/espressif/boards/hiibot_iots2/mpconfigboard.h index e847b8ebaa..61696716ee 100644 --- a/ports/espressif/boards/hiibot_iots2/mpconfigboard.h +++ b/ports/espressif/boards/hiibot_iots2/mpconfigboard.h @@ -34,7 +34,3 @@ #define MICROPY_HW_BUTTON (&pin_GPIO21) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO21) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c new file mode 100644 index 0000000000..deeb8041ea --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c @@ -0,0 +1,38 @@ +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/board.h" + +#include "components/driver/include/driver/gpio.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO20); + common_hal_never_reset_pin(&pin_GPIO21); + #endif +} + +bool board_requests_safe_mode(void) { + return false; +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Pull LED down on reset rather than the default up + if (pin_number == MICROPY_HW_LED_STATUS->number) { + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = true, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); + return true; + } + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h new file mode 100644 index 0000000000..e0eebc9754 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h @@ -0,0 +1,10 @@ +#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T-01C3" +#define MICROPY_HW_MCU_NAME "ESP32-C3" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO3) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO20) +#define DEFAULT_UART_BUS_TX (&pin_GPIO21) + +#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk new file mode 100644 index 0000000000..d40c9b6722 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0xC3C30000 +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/pins.c b/ports/espressif/boards/lilygo_ttgo_t-01c3/pins.c new file mode 100644 index 0000000000..887d85ef2f --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/pins.c @@ -0,0 +1,20 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig new file mode 100644 index 0000000000..9d906d3c3b --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="LILYGO TTGO T-01C3" +# end of LWIP diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c new file mode 100644 index 0000000000..d522720629 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Fabian Affolter + * + * 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" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h new file mode 100644 index 0000000000..4ab6ddbda5 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h @@ -0,0 +1,30 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Fabian Affolter + * + * 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. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "TTGO T8 ESP32-S2-WROOM" +#define MICROPY_HW_MCU_NAME "ESP32S2" diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk new file mode 100644 index 0000000000..528938f7ac --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk @@ -0,0 +1,19 @@ +USB_VID = 0x303a +USB_PID = 0x80EA +USB_PRODUCT = "TTGO T8 ESP32-S2-WROOM" +USB_MANUFACTURER = "LILYGO" + +IDF_TARGET = esp32s2 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_MODULE=wroom diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/pins.c b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/pins.c new file mode 100644 index 0000000000..ab080dc50e --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/pins.c @@ -0,0 +1,47 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig new file mode 100644 index 0000000000..5b9c86dcc3 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig @@ -0,0 +1,6 @@ +# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# end of LWIP diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c new file mode 100644 index 0000000000..d522720629 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Fabian Affolter + * + * 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" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h new file mode 100644 index 0000000000..91e68a1e24 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h @@ -0,0 +1,30 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Fabian Affolter + * + * 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. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T8 ESP32-S2" +#define MICROPY_HW_MCU_NAME "ESP32S2" diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk new file mode 100644 index 0000000000..f0c9eb5c0b --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk @@ -0,0 +1,19 @@ +USB_VID = 0x303a +USB_PID = 0x80ED +USB_PRODUCT = "TTGO T8 ESP32-S2" +USB_MANUFACTURER = "LILYGO" + +IDF_TARGET = esp32s2 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_MODULE = wroom diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/pins.c b/ports/espressif/boards/lilygo_ttgo_t8_s2/pins.c new file mode 100644 index 0000000000..f462fa25e3 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/pins.c @@ -0,0 +1,51 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + + // SD Card + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO10) }, + + // Peripheral Power control + { MP_ROM_QSTR(MP_QSTR_PE_POWER), MP_ROM_PTR(&pin_GPIO14) }, + + // Battery Sense + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO9) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig new file mode 100644 index 0000000000..8c401a6ff3 --- /dev/null +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM clock and cs IO for ESP32S2 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM clock and cs IO for ESP32S2 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_26M is not set +# CONFIG_SPIRAM_SPEED_20M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="TTGO-T8-ESP32-S2" +# end of LWIP diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h index c9159b6f32..faa01ff3e1 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h @@ -28,9 +28,3 @@ #define MICROPY_HW_BOARD_NAME "LILYGO TTGO T8 ESP32-S2 w/Display" #define MICROPY_HW_MCU_NAME "ESP32S2" - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h index 18d8234c72..c490cd8ceb 100644 --- a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h @@ -29,11 +29,6 @@ #define MICROPY_HW_BOARD_NAME "S2Mini" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Wemos MP #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Wemos MP diff --git a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h index 408b15ac16..19c41f84e4 100644 --- a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -29,11 +29,6 @@ #define MICROPY_HW_BOARD_NAME "S2Pico" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) // JST SH Connector Pin 3 NOT STEMMA QT / Feather pinout #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) // JST SH Connector Pin 2 NOT STEMMA QT / Feather pinout diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h index c1d9e1b0b2..e94f14c80b 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h @@ -44,11 +44,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define DEBUG_UART_TX DEFAULT_UART_BUS_TX - -// For entering safe mode -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - -// Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") +#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h index 065ecdc39d..c9354cabcc 100644 --- a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h @@ -41,9 +41,3 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) - -// For entering safe mode -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -// Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") diff --git a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.h b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.h index 6a18f996bb..1c36e78ccf 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.h +++ b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.h @@ -30,11 +30,6 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO16) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 #define DEFAULT_I2C_BUS_SCL (&pin_GPIO7) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO6) diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h index 41ce41c238..0fac8c199a 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.h b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.h index c5c05676f1..1badf7fabb 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.h +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.h @@ -30,9 +30,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h index 46d1084d19..9d7a480228 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h @@ -31,11 +31,5 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.h b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.h index fe57007a94..37644ddaed 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.h +++ b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.h @@ -32,9 +32,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" // #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.h b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.h index c36ab50d11..1cbc5a23e0 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.h +++ b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.h @@ -32,9 +32,3 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" // #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) - -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h index 57f35018da..d10ab94223 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -29,11 +29,6 @@ #define MICROPY_HW_BOARD_NAME "FeatherS2" #define MICROPY_HW_MCU_NAME "ESP32S2" -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h index e6abbf2339..af61a67fbb 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h @@ -31,10 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h index 7304512aa8..a2fadd85ea 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h @@ -29,11 +29,6 @@ #define MICROPY_HW_BOARD_NAME "FeatherS2 PreRelease" #define MICROPY_HW_MCU_NAME "ESP32S2" -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 - // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h index 3c9f8f25c1..a341cf0464 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h @@ -31,10 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.h index 8c578e5e49..b1a2ea1c96 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.h @@ -31,10 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO17) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.h index 7662289b84..0637109c15 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.h @@ -31,10 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO2) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.h index c4853f4709..e1ac3b2791 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.h @@ -31,10 +31,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO17) -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") - -#define AUTORESET_DELAY_MS 500 #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/common-hal/alarm/__init__.c b/ports/espressif/common-hal/alarm/__init__.c index b24a91a03e..d65ab0bbb2 100644 --- a/ports/espressif/common-hal/alarm/__init__.c +++ b/ports/espressif/common-hal/alarm/__init__.c @@ -166,13 +166,6 @@ void NORETURN common_hal_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/espressif/common-hal/busio/I2C.c b/ports/espressif/common-hal/busio/I2C.c index 454432ab91..0706de1df5 100644 --- a/ports/espressif/common-hal/busio/I2C.c +++ b/ports/espressif/common-hal/busio/I2C.c @@ -50,6 +50,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, gpio_set_direction(sda->number, GPIO_MODE_DEF_INPUT); gpio_set_direction(scl->number, GPIO_MODE_DEF_INPUT); + gpio_pullup_dis(sda->number); + gpio_pullup_dis(scl->number); gpio_pulldown_en(sda->number); gpio_pulldown_en(scl->number); diff --git a/ports/espressif/common-hal/mdns/RemoteService.c b/ports/espressif/common-hal/mdns/RemoteService.c new file mode 100644 index 0000000000..1d80c738bd --- /dev/null +++ b/ports/espressif/common-hal/mdns/RemoteService.c @@ -0,0 +1,67 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-bindings/mdns/RemoteService.h" + +const char *common_hal_mdns_remoteservice_get_service_type(mdns_remoteservice_obj_t *self) { + if (self->result == NULL) { + return ""; + } + return self->result->service_type; +} + +const char *common_hal_mdns_remoteservice_get_protocol(mdns_remoteservice_obj_t *self) { + if (self->result == NULL) { + return ""; + } + return self->result->proto; +} + +const char *common_hal_mdns_remoteservice_get_instance_name(mdns_remoteservice_obj_t *self) { + if (self->result == NULL) { + return ""; + } + return self->result->instance_name; +} + +const char *common_hal_mdns_remoteservice_get_hostname(mdns_remoteservice_obj_t *self) { + if (self->result == NULL) { + return ""; + } + return self->result->hostname; +} + +mp_int_t common_hal_mdns_remoteservice_get_port(mdns_remoteservice_obj_t *self) { + if (self->result == NULL) { + return 0; + } + return self->result->port; +} + +void common_hal_mdns_remoteservice_deinit(mdns_remoteservice_obj_t *self) { + mdns_query_results_free(self->result); + self->result = NULL; +} diff --git a/ports/espressif/common-hal/mdns/RemoteService.h b/ports/espressif/common-hal/mdns/RemoteService.h new file mode 100644 index 0000000000..ca59f5ece6 --- /dev/null +++ b/ports/espressif/common-hal/mdns/RemoteService.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include "components/mdns/include/mdns.h" + +typedef struct { + mp_obj_base_t base; + mdns_result_t *result; +} mdns_remoteservice_obj_t; diff --git a/ports/espressif/common-hal/mdns/Server.c b/ports/espressif/common-hal/mdns/Server.c new file mode 100644 index 0000000000..2f260bbde0 --- /dev/null +++ b/ports/espressif/common-hal/mdns/Server.c @@ -0,0 +1,149 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-bindings/mdns/Server.h" + +#include "py/gc.h" +#include "py/runtime.h" +#include "shared-bindings/mdns/RemoteService.h" +#include "shared-bindings/wifi/__init__.h" + +#include "components/mdns/include/mdns.h" + +STATIC bool inited = false; + +void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_interface) { + if (network_interface != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) { + mp_raise_ValueError(translate("mDNS only works with built-in WiFi")); + return; + } + if (inited) { + mp_raise_RuntimeError(translate("mDNS already initialized")); + } + mdns_init(); + + uint8_t mac[6]; + esp_netif_get_mac(common_hal_wifi_radio_obj.netif, mac); + snprintf(self->default_hostname, sizeof(self->default_hostname), "cpy-%02x%02x%02x", mac[3], mac[4], mac[5]); + common_hal_mdns_server_set_hostname(self, self->default_hostname); + + // Set a delegated entry to ourselves. This allows us to respond to "circuitpython.local" + // queries as well. + // TODO: Allow for disabling this with `supervisor.disable_web_workflow()`. + mdns_ip_addr_t our_ip; + esp_netif_get_ip_info(common_hal_wifi_radio_obj.netif, &common_hal_wifi_radio_obj.ip_info); + our_ip.next = NULL; + our_ip.addr.type = ESP_IPADDR_TYPE_V4; + our_ip.addr.u_addr.ip4 = common_hal_wifi_radio_obj.ip_info.ip; + our_ip.addr.u_addr.ip6.addr[1] = 0; + our_ip.addr.u_addr.ip6.addr[2] = 0; + our_ip.addr.u_addr.ip6.addr[3] = 0; + our_ip.addr.u_addr.ip6.zone = 0; + mdns_delegate_hostname_add("circuitpython", &our_ip); +} + +void common_hal_mdns_server_deinit(mdns_server_obj_t *self) { + inited = false; + mdns_free(); +} + +bool common_hal_mdns_server_deinited(mdns_server_obj_t *self) { + // This returns INVALID_STATE when not initialized and INVALID_PARAM when it + // is. + return mdns_instance_name_set(NULL) == ESP_ERR_INVALID_STATE; +} + +const char *common_hal_mdns_server_get_hostname(mdns_server_obj_t *self) { + return self->hostname; +} + +void common_hal_mdns_server_set_hostname(mdns_server_obj_t *self, const char *hostname) { + mdns_hostname_set(hostname); + self->hostname = hostname; +} + +const char *common_hal_mdns_server_get_instance_name(mdns_server_obj_t *self) { + if (self->instance_name == NULL) { + return self->hostname; + } + return self->instance_name; +} + +void common_hal_mdns_server_set_instance_name(mdns_server_obj_t *self, const char *instance_name) { + mdns_instance_name_set(instance_name); + self->instance_name = instance_name; +} + +mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_float_t timeout) { + mdns_search_once_t *search = mdns_query_async_new(NULL, service_type, protocol, MDNS_TYPE_PTR, timeout * 1000, 255, NULL); + if (search == NULL) { + mp_raise_RuntimeError(translate("Unable to start mDNS query")); + } + mdns_result_t *results; + while (!mdns_query_async_get_results(search, 1, &results)) { + RUN_BACKGROUND_TASKS; + } + mdns_query_async_delete(search); + // Count how many results we got. + // TODO: Remove this loop when moving off 4.4. Newer APIs will give us num_results + // back directly. + mdns_result_t *next = results; + uint8_t num_results = 0; + while (next != NULL) { + num_results++; + next = next->next; + } + mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(num_results, NULL)); + next = results; + // Don't error if we're out of memory. Instead, truncate the tuple. + uint8_t added = 0; + while (next != NULL) { + mdns_remoteservice_obj_t *service = gc_alloc(sizeof(mdns_remoteservice_obj_t), GC_ALLOC_FLAG_HAS_FINALISER, false); + if (service == NULL) { + if (added == 0) { + m_malloc_fail(sizeof(mdns_remoteservice_obj_t)); + } + // Free the remaining results from the IDF because we don't have + // enough space in Python. + mdns_query_results_free(next); + break; + } + service->result = next; + service->base.type = &mdns_remoteservice_type; + next = next->next; + // Break the linked list so we free each result separately. + service->result->next = NULL; + tuple->items[added] = MP_OBJ_FROM_PTR(service); + added++; + } + tuple->len = added; + + return MP_OBJ_FROM_PTR(tuple); +} + +void common_hal_mdns_server_advertise_service(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_int_t port) { + mdns_service_add(NULL, service_type, protocol, port, NULL, 0); +} diff --git a/ports/espressif/common-hal/mdns/Server.h b/ports/espressif/common-hal/mdns/Server.h new file mode 100644 index 0000000000..770f55ece4 --- /dev/null +++ b/ports/espressif/common-hal/mdns/Server.h @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const char *hostname; + const char *instance_name; + // "cpy-" "XXXXXX" "\0" + char default_hostname[4 + 6 + 1]; +} mdns_server_obj_t; diff --git a/ports/espressif/common-hal/mdns/__init__.c b/ports/espressif/common-hal/mdns/__init__.c new file mode 100644 index 0000000000..57740777c8 --- /dev/null +++ b/ports/espressif/common-hal/mdns/__init__.c @@ -0,0 +1 @@ +// No mdns module functions. diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 828d85d5ee..1323c9ae5d 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -78,6 +78,11 @@ STATIC void _reset_pin(gpio_num_t pin_number) { if (11 <= pin_number && pin_number <= 17) { return; } + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + if (pin_number == 18 || pin_number == 19) { + return; + } + #endif #endif // Give the board a chance to reset the pin in a particular way. diff --git a/ports/espressif/common-hal/paralleldisplay/ParallelBus.c b/ports/espressif/common-hal/paralleldisplay/ParallelBus.c index b9ee1f055d..1b6ee41c40 100644 --- a/ports/espressif/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -72,13 +72,6 @@ void common_hal_paralleldisplay_parallelbus_construct_nonsequential(paralleldisp .buffer_size = 512, }; - if (reset != NULL) { - common_hal_never_reset_pin(reset); - self->reset_pin_number = reset->number; - } else { - self->reset_pin_number = NO_PIN; - } - for (uint8_t i = 0; i < n_pins; i++) { common_hal_never_reset_pin(data_pins[i]); config.pin_data_num[i] = common_hal_mcu_pin_number(data_pins[i]); @@ -98,10 +91,14 @@ void common_hal_paralleldisplay_parallelbus_construct_nonsequential(paralleldisp gpio_set_level(read->number, true); } + self->reset_pin_number = NO_PIN; + if (reset != NULL) { + common_hal_never_reset_pin(reset); + self->reset_pin_number = reset->number; + } + common_hal_never_reset_pin(chip_select); common_hal_never_reset_pin(command); - common_hal_never_reset_pin(read); - common_hal_never_reset_pin(reset); common_hal_never_reset_pin(write); self->config = config; @@ -140,8 +137,8 @@ void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_o reset_pin_number(self->config.pin_num_cs); reset_pin_number(self->config.pin_num_wr); - reset_pin_number(self->read_pin_number); reset_pin_number(self->config.pin_num_rs); + reset_pin_number(self->read_pin_number); reset_pin_number(self->reset_pin_number); port_i2s_reset_instance(0); diff --git a/ports/espressif/common-hal/paralleldisplay/ParallelBus.h b/ports/espressif/common-hal/paralleldisplay/ParallelBus.h index 1c84d9b421..c46d3cb0b8 100644 --- a/ports/espressif/common-hal/paralleldisplay/ParallelBus.h +++ b/ports/espressif/common-hal/paralleldisplay/ParallelBus.h @@ -32,8 +32,8 @@ typedef struct { mp_obj_base_t base; - uint8_t read_pin_number; - uint8_t reset_pin_number; + gpio_num_t read_pin_number; + gpio_num_t reset_pin_number; i2s_lcd_config_t config; i2s_lcd_handle_t handle; } paralleldisplay_parallelbus_obj_t; diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 5d4fcab417..4f92425c87 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -42,6 +42,10 @@ #include "components/esp_wifi/include/esp_wifi.h" #include "components/lwip/include/apps/ping/ping_sock.h" +#if CIRCUITPY_MDNS +#include "components/mdns/include/mdns.h" +#endif + #define MAC_ADDRESS_LENGTH 6 static void set_mode_station(wifi_radio_obj_t *self, bool state) { @@ -91,6 +95,9 @@ void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { if (self->current_scan != NULL) { common_hal_wifi_radio_stop_scanning_networks(self); } + #if CIRCUITPY_MDNS + mdns_free(); + #endif ESP_ERROR_CHECK(esp_wifi_stop()); self->started = false; return; diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 2775b6e213..121ddb87e5 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 2775b6e213a1876dd1abe4923097ca5b437397e3 +Subproject commit 121ddb87e5130314e4fcc5e9cb260a81b7d30d36 diff --git a/ports/espressif/esp-idf-config/sdkconfig-8MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-8MB.defaults index b1506206df..1ecb1b4c16 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-8MB.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-8MB.defaults @@ -10,9 +10,9 @@ CONFIG_ESPTOOLPY_FLASHSIZE="8MB" CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB.csv" # # Partition Table # +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB.csv" CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB.csv" # end of Partition Table diff --git a/ports/espressif/esp-idf-config/sdkconfig-ble.defaults b/ports/espressif/esp-idf-config/sdkconfig-ble.defaults index 476b6a32d9..8180786fbf 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-ble.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-ble.defaults @@ -1,24 +1,24 @@ # +# Component config +# +# # Bluetooth # CONFIG_BT_ENABLED=y -# end of Bluetooth - -CONFIG_BT_CTRL_MODE_EFF=1 # # Bluetooth controller # +CONFIG_BT_CTRL_MODE_EFF=1 CONFIG_BT_CTRL_BLE_MAX_ACT=10 CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=10 CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 -CONFIG_BT_CTRL_PINNED_TO_CORE_0=y -# CONFIG_BT_CTRL_PINNED_TO_CORE_1 is not set CONFIG_BT_CTRL_PINNED_TO_CORE=0 CONFIG_BT_CTRL_HCI_MODE_VHCI=y # CONFIG_BT_CTRL_HCI_MODE_UART_H4 is not set CONFIG_BT_CTRL_HCI_TL=1 CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 # CONFIG_BT_CTRL_HW_CCA is not set +CONFIG_BT_CTRL_HW_CCA_VAL=20 CONFIG_BT_CTRL_HW_CCA_EFF=0 CONFIG_BT_CTRL_CE_LENGTH_TYPE_ORIG=y # CONFIG_BT_CTRL_CE_LENGTH_TYPE_CE is not set @@ -54,12 +54,12 @@ CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 # CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN is not set CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS=y CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 -# end of Bluetooth controller - +# +# MODEM SLEEP Options +# # CONFIG_BT_CTRL_MODEM_SLEEP is not set -# -# Bluetooth controller -# +# end of MODEM SLEEP Options + CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 CONFIG_BT_CTRL_HCI_TL_EFF=1 @@ -67,17 +67,12 @@ CONFIG_BT_CTRL_HCI_TL_EFF=1 # end of Bluetooth controller # CONFIG_BT_BLUEDROID_ENABLED is not set -# -# Bluetooth -# CONFIG_BT_NIMBLE_ENABLED=y # CONFIG_BT_CONTROLLER_ONLY is not set -# end of Bluetooth - -CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y # # NimBLE Options # +CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y # CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set # CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set # CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set @@ -89,9 +84,6 @@ CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3 CONFIG_BT_NIMBLE_MAX_BONDS=3 CONFIG_BT_NIMBLE_MAX_CCCDS=8 CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0 -# CONFIG_BT_NIMBLE_PINNED_TO_CORE_0 is not set -CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y -CONFIG_BT_NIMBLE_PINNED_TO_CORE=1 CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096 CONFIG_BT_NIMBLE_ROLE_CENTRAL=y CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y @@ -129,10 +121,14 @@ CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS=1 CONFIG_BT_NIMBLE_USE_ESP_TIMER=y # end of NimBLE Options -# CONFIG_BLUEDROID_ENABLED is not set +# end of Bluetooth + +# end of Component config + # # Deprecated options for backward compatibility # +# CONFIG_BLUEDROID_ENABLED is not set CONFIG_NIMBLE_ENABLED=y CONFIG_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y # CONFIG_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set @@ -140,9 +136,6 @@ CONFIG_NIMBLE_MAX_CONNECTIONS=3 CONFIG_NIMBLE_MAX_BONDS=3 CONFIG_NIMBLE_MAX_CCCDS=8 CONFIG_NIMBLE_L2CAP_COC_MAX_NUM=0 -CONFIG_NIMBLE_PINNED_TO_CORE_0=y -# CONFIG_NIMBLE_PINNED_TO_CORE_1 is not set -CONFIG_NIMBLE_PINNED_TO_CORE=0 CONFIG_NIMBLE_TASK_STACK_SIZE=4096 CONFIG_NIMBLE_ROLE_CENTRAL=y CONFIG_NIMBLE_ROLE_PERIPHERAL=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index a39afeb505..5b5df1837c 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -1,23 +1,38 @@ -# -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# CONFIG_IDF_TARGET_ARCH_RISCV=y CONFIG_IDF_TARGET="esp32c3" CONFIG_IDF_TARGET_ESP32C3=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0005 -# end of Espressif IoT Development Framework (ESP-IDF) Project Configuration - +# +# SDK tool configuration +# CONFIG_SDK_TOOLPREFIX="riscv32-esp-elf-" +# end of SDK tool configuration + # # Bootloader config # CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 # end of Bootloader config -# CONFIG_ESP32C3_DEFAULT_CPU_FREQ_80 is not set +# +# Component config +# +# +# Bluetooth +# +CONFIG_BT_SOC_SUPPORT_5_0=y +# +# NimBLE Options +# +CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 +# end of NimBLE Options + +# end of Bluetooth + # # ESP32C3-Specific # +# CONFIG_ESP32C3_DEFAULT_CPU_FREQ_80 is not set CONFIG_ESP32C3_DEFAULT_CPU_FREQ_160=y CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ=160 # CONFIG_ESP32C3_REV_MIN_0 is not set @@ -26,7 +41,6 @@ CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ=160 CONFIG_ESP32C3_REV_MIN_3=y CONFIG_ESP32C3_REV_MIN=3 CONFIG_ESP32C3_DEBUG_OCDAWARE=y -# CONFIG_ESP32C3_DEBUG_STUBS_ENABLE is not set CONFIG_ESP32C3_BROWNOUT_DET=y CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=y # CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_6 is not set @@ -44,24 +58,31 @@ CONFIG_ESP32C3_RTC_CLK_SRC_INT_RC=y # CONFIG_ESP32C3_RTC_CLK_SRC_EXT_OSC is not set # CONFIG_ESP32C3_RTC_CLK_SRC_INT_8MD256 is not set CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=1024 -# CONFIG_ESP32C3_NO_BLOBS is not set # end of ESP32C3-Specific -# CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO is not set +# +# Hardware Settings +# # # MAC Config # +# CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO is not set CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR=y CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES=4 # end of MAC Config -CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y # # Sleep Config # +CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y # end of Sleep Config +# end of Hardware Settings + +# +# ESP System Settings +# CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y # # Memory protection @@ -76,10 +97,13 @@ CONFIG_ESP_SYSTEM_MEMPROT_MEM_ALIGN_SIZE=512 CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y # CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +# end of ESP System Settings + # # Wi-Fi # CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set @@ -97,37 +121,35 @@ CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 CONFIG_ESP32_WIFI_IRAM_OPT=y CONFIG_ESP32_WIFI_RX_IRAM_OPT=y # CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE is not set -# CONFIG_ESP_WIFI_EXTERNAL_COEXIST_ENABLE is not set # end of Wi-Fi -CONFIG_FREERTOS_UNICORE=y # # FreeRTOS # +CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y # end of FreeRTOS -CONFIG_TOOLPREFIX="riscv32-esp-elf-" +# end of Component config + # # Deprecated options for backward compatibility # +CONFIG_TOOLPREFIX="riscv32-esp-elf-" # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +CONFIG_NIMBLE_PINNED_TO_CORE=0 CONFIG_ESP_SYSTEM_PD_FLASH=y CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -# CONFIG_ESP32S2_PANIC_PRINT_REBOOT is not set -CONFIG_ESP32S2_PANIC_SILENT_REBOOT=y -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y CONFIG_ESP32H2_MEMPROT_FEATURE=y CONFIG_ESP32H2_MEMPROT_FEATURE_LOCK=y -# CONFIG_EXTERNAL_COEX_ENABLE is not set +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index e8583facbe..bfb867d923 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -1,38 +1,47 @@ -# -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# CONFIG_IDF_TARGET_ARCH_XTENSA=y CONFIG_IDF_TARGET="esp32s3" CONFIG_IDF_TARGET_ESP32S3=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0009 -# end of Espressif IoT Development Framework (ESP-IDF) Project Configuration - # -# LWIP sdkconfig.defaults override +# SDK tool configuration # -CONFIG_LWIP_MAX_SOCKETS=8 -# end of LWIP sdkconfig.defaults override - CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" +# end of SDK tool configuration + # # Bootloader config # CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 # end of Bootloader config +# +# Component config +# +# +# Bluetooth +# CONFIG_BT_SOC_SUPPORT_5_0=y +# +# NimBLE Options +# +# CONFIG_BT_NIMBLE_PINNED_TO_CORE_0 is not set +CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y +CONFIG_BT_NIMBLE_PINNED_TO_CORE=1 +# end of NimBLE Options + +# end of Bluetooth + # # ESP32S3-Specific # +# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240 -# end of ESP32S3-Specific - -CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y # # Cache config # +CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y # CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB is not set CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x4000 # CONFIG_ESP32S3_INSTRUCTION_CACHE_4WAYS is not set @@ -60,7 +69,6 @@ CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=32 CONFIG_ESP32S3_TRACEMEM_RESERVE_DRAM=0x0 # CONFIG_ESP32S3_ULP_COPROC_ENABLED is not set CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=0 -# CONFIG_ESP32S3_DEBUG_STUBS_ENABLE is not set CONFIG_ESP32S3_BROWNOUT_DET=y CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_7=y # CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_6 is not set @@ -80,9 +88,13 @@ CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC=y # CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024 CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000 -# CONFIG_ESP32S3_NO_BLOBS is not set # CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM is not set # CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set +# end of ESP32S3-Specific + +# +# Hardware Settings +# # # MAC Config # @@ -91,17 +103,34 @@ CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR=y CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES=4 # end of MAC Config +# +# Sleep Config +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y +# end of Sleep Config +# end of Hardware Settings + +# +# PHY +# CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + +# +# ESP System Settings +# # CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0 is not set CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y # CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set CONFIG_ESP_MAIN_TASK_AFFINITY=0x1 +# end of ESP System Settings + # # Wi-Fi # CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set @@ -125,7 +154,14 @@ CONFIG_ESP32_WIFI_RX_IRAM_OPT=y # CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE is not set # end of Wi-Fi +# +# FreeRTOS +# # CONFIG_FREERTOS_UNICORE is not set +# end of FreeRTOS + +# end of Component config + # # Deprecated options for backward compatibility # @@ -133,12 +169,16 @@ CONFIG_TOOLPREFIX="xtensa-esp32s3-elf-" # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +# CONFIG_NIMBLE_PINNED_TO_CORE_0 is not set +CONFIG_NIMBLE_PINNED_TO_CORE_1=y +CONFIG_NIMBLE_PINNED_TO_CORE=1 CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP32_PHY_MAX_TX_POWER=20 CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults index 273303446e..e9b91113d5 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults @@ -7,10 +7,10 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set # end of Bootloader config -# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set # # Compiler options # +# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set CONFIG_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_COMPILER_OPTIMIZATION_NONE is not set @@ -21,22 +21,28 @@ CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=1 # CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set # end of Compiler options +# +# Component config +# +# +# ESP32S3-Specific +# CONFIG_ESP32S3_DEBUG_OCDAWARE=y +# end of ESP32S3-Specific + # # Common ESP-related # # CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set # end of Common ESP-related -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set # # ESP System Settings # +# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set # CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT is not set CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -# end of ESP System Settings - # CONFIG_ESP_CONSOLE_UART_DEFAULT is not set # CONFIG_ESP_CONSOLE_USB_CDC is not set # CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is not set @@ -46,6 +52,8 @@ CONFIG_ESP_CONSOLE_NONE=y CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y CONFIG_ESP_CONSOLE_MULTIPLE_UART=y CONFIG_ESP_CONSOLE_UART_NUM=-1 +# end of ESP System Settings + # # FreeRTOS # @@ -56,16 +64,23 @@ CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y CONFIG_FREERTOS_DEBUG_OCDAWARE=y # end of FreeRTOS -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y # # Hardware Abstraction Layer (HAL) and Low Level (LL) # +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y # CONFIG_HAL_ASSERTION_DISABLE is not set # CONFIG_HAL_ASSERTION_SILIENT is not set CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=1 # end of Hardware Abstraction Layer (HAL) and Low Level (LL) +# +# LWIP +# CONFIG_LWIP_ESP_LWIP_ASSERT=y +# end of LWIP + +# end of Component config + # # Deprecated options for backward compatibility # diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index f4efac4063..5fb49faa82 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -1,10 +1,10 @@ -# -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# CONFIG_IDF_CMAKE=y -# end of Espressif IoT Development Framework (ESP-IDF) Project Configuration - +# +# SDK tool configuration +# # CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set +# end of SDK tool configuration + # # Build type # @@ -15,20 +15,20 @@ CONFIG_APP_BUILD_BOOTLOADER=y CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y # end of Build type -CONFIG_APP_COMPILE_TIME_DATE=y # # Application manager # +CONFIG_APP_COMPILE_TIME_DATE=y # CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set # CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set # CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 # end of Application manager -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # # Bootloader config # +# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y @@ -51,29 +51,29 @@ CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # end of Bootloader config -CONFIG_SECURE_BOOT_SUPPORTS_RSA=y # # Security features # +CONFIG_SECURE_BOOT_SUPPORTS_RSA=y CONFIG_SECURE_TARGET_HAS_SECURE_ROM_DL_MODE=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features -CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y # # Boot ROM Behavior # +CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y # CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set # CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set # CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set # end of Boot ROM Behavior -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # # Serial flasher config # +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_NO_STUB is not set # CONFIG_ESPTOOLPY_OCT_FLASH is not set # CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set @@ -105,10 +105,10 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # end of Serial flasher config -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set # # Partition Table # +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set CONFIG_PARTITION_TABLE_CUSTOM=y @@ -116,10 +116,10 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table -CONFIG_COMPILER_HIDE_PATHS_MACROS=y # # Compiler options # +CONFIG_COMPILER_HIDE_PATHS_MACROS=y # CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_CXX_RTTI is not set CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y @@ -131,22 +131,34 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options -# CONFIG_APPTRACE_DEST_JTAG is not set +# +# Component config +# # # Application Level Tracing # +# CONFIG_APPTRACE_DEST_JTAG is not set CONFIG_APPTRACE_DEST_NONE=y CONFIG_APPTRACE_LOCK_ENABLE=y # end of Application Level Tracing -# CONFIG_ADC_FORCE_XPD_FSM is not set +# CONFIG_BLE_MESH is not set +# +# Driver configurations +# # # ADC configuration # +# CONFIG_ADC_FORCE_XPD_FSM is not set CONFIG_ADC_DISABLE_DAC=y # end of ADC configuration +# +# MCPWM configuration +# # CONFIG_MCPWM_ISR_IN_IRAM is not set +# end of MCPWM configuration + # # SPI configuration # @@ -156,32 +168,39 @@ CONFIG_SPI_MASTER_ISR_IN_IRAM=y CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # end of SPI configuration +# +# TWAI configuration +# # CONFIG_TWAI_ISR_IN_IRAM is not set +# end of TWAI configuration + # # UART configuration # # CONFIG_UART_ISR_IN_IRAM is not set # end of UART configuration -# CONFIG_GDMA_CTRL_FUNC_IN_IRAM is not set # # GDMA Configuration # +# CONFIG_GDMA_CTRL_FUNC_IN_IRAM is not set # CONFIG_GDMA_ISR_IRAM_SAFE is not set # end of GDMA Configuration -# CONFIG_EFUSE_CUSTOM_TABLE is not set +# end of Driver configurations + # # eFuse Bit Manager # +# CONFIG_EFUSE_CUSTOM_TABLE is not set # CONFIG_EFUSE_VIRTUAL is not set CONFIG_EFUSE_MAX_BLK_LEN=256 # end of eFuse Bit Manager -CONFIG_ESP_TLS_USING_MBEDTLS=y # # ESP-TLS # +CONFIG_ESP_TLS_USING_MBEDTLS=y CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y CONFIG_ESP_TLS_SERVER=y # CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set @@ -190,80 +209,89 @@ CONFIG_ESP_TLS_SERVER=y # CONFIG_ESP_TLS_INSECURE is not set # end of ESP-TLS -# CONFIG_ETH_USE_SPI_ETHERNET is not set # # Ethernet # +# CONFIG_ETH_USE_SPI_ETHERNET is not set # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set # # Event Loop Library # +# CONFIG_ESP_EVENT_LOOP_PROFILING is not set CONFIG_ESP_EVENT_POST_FROM_ISR=y CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y # end of Event Loop Library -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +# +# Hardware Settings +# # # MAC Config # +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y # end of MAC Config -CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y # # Sleep Config # +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y # CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set # CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set # end of Sleep Config -CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 +# +# RTC Clock Config +# +CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB=y +# end of RTC Clock Config + +# end of Hardware Settings + # # IPC (Inter-Processor Call) # +CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y CONFIG_ESP_IPC_ISR_ENABLE=y # end of IPC (Inter-Processor Call) -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 # # ESP NETIF Adapter # +CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 CONFIG_ESP_NETIF_TCPIP_LWIP=y # CONFIG_ESP_NETIF_LOOPBACK is not set # CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER is not set # end of ESP NETIF Adapter -CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y # # PHY # +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP_PHY_MAX_TX_POWER=20 # end of PHY -# CONFIG_PM_ENABLE is not set # # Power Management # +# CONFIG_PM_ENABLE is not set CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y CONFIG_PM_POWER_DOWN_TAGMEM_IN_LIGHT_SLEEP=y # end of Power Management -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set # # ESP System Settings # +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y -# end of ESP System Settings - CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 @@ -273,7 +301,10 @@ CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 CONFIG_ESP_INT_WDT_CHECK_CPU1=y # CONFIG_ESP_TASK_WDT is not set # CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y +# end of ESP System Settings + # # High resolution timer (esp_timer) # @@ -286,10 +317,10 @@ CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 CONFIG_ESP_TIMER_IMPL_SYSTIMER=y # end of High resolution timer (esp_timer) -# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # # Wi-Fi # +# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_FTM_ENABLE is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set # CONFIG_ESP_WIFI_GCMP_SUPPORT is not set @@ -297,18 +328,18 @@ CONFIG_ESP_TIMER_IMPL_SYSTIMER=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # end of Wi-Fi -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set # # Core dump # +# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set # CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y # end of Core dump -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF # # FreeRTOS # +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF CONFIG_FREERTOS_TICK_SUPPORT_SYSTIMER=y CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y # CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set @@ -339,10 +370,10 @@ CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y # CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set # end of FreeRTOS -CONFIG_HEAP_POISONING_DISABLED=y # # Heap memory debugging # +CONFIG_HEAP_POISONING_DISABLED=y # CONFIG_HEAP_POISONING_LIGHT is not set # CONFIG_HEAP_POISONING_COMPREHENSIVE is not set CONFIG_HEAP_TRACING_OFF=y @@ -351,10 +382,10 @@ CONFIG_HEAP_TRACING_OFF=y # CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set # end of Heap memory debugging -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set # # Log output # +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set CONFIG_LOG_DEFAULT_LEVEL_INFO=y @@ -370,16 +401,16 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set # end of Log output -# CONFIG_LWIP_NETIF_API is not set # # LWIP # +# CONFIG_LWIP_NETIF_API is not set # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=8 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set # CONFIG_LWIP_SO_LINGER is not set CONFIG_LWIP_SO_REUSE=y @@ -401,12 +432,10 @@ CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set CONFIG_LWIP_DHCP_OPTIONS_LEN=68 -# end of LWIP - -CONFIG_LWIP_DHCPS=y # # DHCP server # +CONFIG_LWIP_DHCPS=y CONFIG_LWIP_DHCPS_LEASE_UNIT=60 CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 # end of DHCP server @@ -442,17 +471,17 @@ CONFIG_LWIP_TCP_OVERSIZE_MSS=y CONFIG_LWIP_TCP_RTO_TIME=3000 # end of TCP -CONFIG_LWIP_MAX_UDP_PCBS=16 # # UDP # +CONFIG_LWIP_MAX_UDP_PCBS=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set # # Checksums # +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set # CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y # end of Checksums @@ -474,7 +503,12 @@ CONFIG_LWIP_ICMP=y # CONFIG_LWIP_BROADCAST_PING is not set # end of ICMP +# +# LWIP RAW API +# CONFIG_LWIP_MAX_RAW_PCBS=16 +# end of LWIP RAW API + # # SNTP # @@ -483,10 +517,10 @@ CONFIG_LWIP_SNTP_MAX_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set # # Hooks # +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y # CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y @@ -501,6 +535,8 @@ CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # end of Hooks # CONFIG_LWIP_DEBUG is not set +# end of LWIP + # # mbedTLS # @@ -511,12 +547,27 @@ CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 # CONFIG_MBEDTLS_DEBUG is not set -# end of mbedTLS +# +# mbedTLS v2.28.x related +# +# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y +# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set +# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set +CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y +# +# DTLS-based configurations +# +# CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID is not set +# CONFIG_MBEDTLS_SSL_DTLS_SRTP is not set +# end of DTLS-based configurations + +# end of mbedTLS v2.28.x related -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y # # Certificate Bundle # +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y @@ -524,8 +575,8 @@ CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="certificates/nina-fw/data/roots.pem" # end of Certificate Bundle -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_ECP_RESTARTABLE=y +CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_HARDWARE_MPI=y @@ -622,6 +673,25 @@ CONFIG_MBEDTLS_ECP_NIST_OPTIM=y # CONFIG_MBEDTLS_THREADING_C is not set # CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set # CONFIG_MBEDTLS_SECURITY_RISKS is not set +# end of mbedTLS + +# +# mDNS +# +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_TASK_STACK_SIZE=4096 +# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_MDNS_TASK_AFFINITY_CPU0=y +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x0 +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +# CONFIG_MDNS_STRICT_MODE is not set +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# CONFIG_MDNS_NETWORKING_SOCKET is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y +# end of mDNS + # # Newlib # @@ -634,7 +704,12 @@ CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y # CONFIG_NEWLIB_NANO_FORMAT is not set # end of Newlib +# +# OpenThread +# # CONFIG_OPENTHREAD_ENABLED is not set +# end of OpenThread + # # PThreads # @@ -648,10 +723,10 @@ CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of PThreads -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set # # SPI Flash driver # +# CONFIG_SPI_FLASH_VERIFY_WRITE is not set # CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y # CONFIG_SPI_FLASH_ROM_IMPL is not set @@ -666,20 +741,21 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set # CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set -# end of SPI Flash driver - -CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y # # Auto-detect flash chips # +CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP=y # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y +# end of SPI Flash driver + # # Virtual file system # @@ -688,19 +764,19 @@ CONFIG_VFS_SUPPORT_DIR=y CONFIG_VFS_SUPPORT_SELECT=y CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_VFS_SUPPORT_TERMIOS=y -# end of Virtual file system - -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 # # Host File System I/O (Semihosting) # +CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # end of Host File System I/O (Semihosting) -CONFIG_WPA_MBEDTLS_CRYPTO=y +# end of Virtual file system + # # Supplicant # +CONFIG_WPA_MBEDTLS_CRYPTO=y # CONFIG_WPA_WAPI_PSK is not set # CONFIG_WPA_SUITE_B_192 is not set # CONFIG_WPA_DEBUG_PRINT is not set @@ -709,7 +785,14 @@ CONFIG_WPA_MBEDTLS_CRYPTO=y # CONFIG_WPA_11KV_SUPPORT is not set # end of Supplicant +# end of Component config + +# +# Compatibility options +# # CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set +# end of Compatibility options + # # Deprecated options for backward compatibility # diff --git a/ports/espressif/mpconfigport.h b/ports/espressif/mpconfigport.h index 1c5f1b1463..f390112387 100644 --- a/ports/espressif/mpconfigport.h +++ b/ports/espressif/mpconfigport.h @@ -51,6 +51,15 @@ #define MICROPY_NLR_SETJMP (1) #define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000 +// Nearly all boards have this because it is used to enter the ROM bootloader. +#ifndef CIRCUITPY_BOOT_BUTTON +#ifdef CONFIG_IDF_TARGET_ESP32C3 +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) +#else +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) +#endif +#endif + #define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x9000) // 20kB is statically allocated to nvs, but when overwriting an existing @@ -73,4 +82,10 @@ #define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP (0) #endif +// Define to (1) in mpconfigboard.h if the board uses the internal USB to +// Serial/JTAG to connect do USB. +#ifndef CIRCUITPY_ESP_USB_SERIAL_JTAG +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (0) +#endif + #endif // MICROPY_INCLUDED_ESPRESSIF_MPCONFIGPORT_H diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 46e5bd3bb7..2eeb86e49d 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -34,18 +34,21 @@ CIRCUITPY_ESPIDF ?= 1 CIRCUITPY_MODULE ?= none ifeq ($(IDF_TARGET),esp32c3) -CIRCUITPY_USB = 0 +CIRCUITPY_AESIO = 0 CIRCUITPY_ALARM = 0 +CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BLEIO = 1 CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_COUNTIO = 0 -CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_DUALBANK = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_PARALLELDISPLAY = 0 +CIRCUITPY_PS2IO = 0 +CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO_USE_NATIVE = 0 +CIRCUITPY_USB = 0 else ifeq ($(IDF_TARGET),esp32s3) CIRCUITPY_BLEIO = 1 CIRCUITPY_BLEIO_HCI = 0 diff --git a/ports/espressif/supervisor/serial.c b/ports/espressif/supervisor/serial.c new file mode 100644 index 0000000000..9a0ecee4df --- /dev/null +++ b/ports/espressif/supervisor/serial.c @@ -0,0 +1,73 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "py/mpconfig.h" +#include "supervisor/serial.h" + +#if CIRCUITPY_ESP_USB_SERIAL_JTAG +#include "supervisor/usb_serial_jtag.h" +#endif + +void port_serial_init(void) { + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + usb_serial_jtag_init(); + #endif +} + +bool port_serial_connected(void) { + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + if (usb_serial_jtag_connected()) { + return true; + } + #endif + + return false; +} + +char port_serial_read(void) { + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + if (usb_serial_jtag_bytes_available() > 0) { + return usb_serial_jtag_read_char(); + } + #endif + return -1; +} + +bool port_serial_bytes_available(void) { + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + if (usb_serial_jtag_bytes_available()) { + return true; + } + #endif + + return false; +} + +void port_serial_write_substring(const char *text, uint32_t length) { + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + usb_serial_jtag_write(text, length); + #endif +} diff --git a/ports/espressif/supervisor/usb_serial_jtag.c b/ports/espressif/supervisor/usb_serial_jtag.c new file mode 100644 index 0000000000..064d7d668c --- /dev/null +++ b/ports/espressif/supervisor/usb_serial_jtag.c @@ -0,0 +1,111 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Patrick Van Oosterwijck + * Copyright (c) 2022 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 "py/ringbuf.h" +#include "py/runtime.h" +#include "py/mphal.h" +#include "usb_serial_jtag.h" + +#include "hal/usb_serial_jtag_ll.h" +#include "esp_intr_alloc.h" +#include "soc/periph_defs.h" + +#include "supervisor/esp_port.h" + +#define USB_SERIAL_JTAG_BUF_SIZE (64) + +STATIC ringbuf_t ringbuf; +STATIC uint8_t buf[128]; +STATIC bool connected; + +static void usb_serial_jtag_isr_handler(void *arg) { + uint32_t flags = usb_serial_jtag_ll_get_intsts_mask(); + + if (flags & USB_SERIAL_JTAG_INTR_SOF) { + usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF); + } + + if (flags & USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT) { + usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + size_t req_len = ringbuf_num_empty(&ringbuf); + if (req_len > USB_SERIAL_JTAG_BUF_SIZE) { + req_len = USB_SERIAL_JTAG_BUF_SIZE; + } + uint8_t rx_buf[USB_SERIAL_JTAG_BUF_SIZE]; + size_t len = usb_serial_jtag_ll_read_rxfifo(rx_buf, req_len); + for (size_t i = 0; i < len; ++i) { + if (rx_buf[i] == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + } else { + ringbuf_put(&ringbuf, rx_buf[i]); + } + } + vTaskNotifyGiveFromISR(circuitpython_task, NULL); + } +} + +void usb_serial_jtag_init(void) { + ringbuf_init(&ringbuf, buf, sizeof(buf)); + usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + ESP_ERROR_CHECK(esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, ESP_INTR_FLAG_LEVEL1, + usb_serial_jtag_isr_handler, NULL, NULL)); +} + +bool usb_serial_jtag_connected(void) { + // Make connected sticky. Otherwise we'll be disconnected every time the SOF + // index is 0. (It's only ~15 bits so it wraps around frequently.) + if (connected) { + return true; + } + connected = USB_SERIAL_JTAG.fram_num.sof_frame_index > 0; + return connected; +} + +char usb_serial_jtag_read_char(void) { + if (ringbuf_num_filled(&ringbuf) == 0) { + return -1; + } + return ringbuf_get(&ringbuf); +} + +bool usb_serial_jtag_bytes_available(void) { + return ringbuf_num_filled(&ringbuf); +} + +void usb_serial_jtag_write(const char *text, uint32_t length) { + if (USB_SERIAL_JTAG.fram_num.sof_frame_index > 0) { + size_t total_written = 0; + uint32_t start_time = supervisor_ticks_ms32(); + // Time out after 5 milliseconds in case usb isn't actually reading CDC. + while (total_written < length && start_time - supervisor_ticks_ms32() < 5) { + total_written += usb_serial_jtag_ll_write_txfifo((const uint8_t *)(text + total_written), length - total_written); + RUN_BACKGROUND_TASKS; + } + usb_serial_jtag_ll_txfifo_flush(); + } +} diff --git a/ports/espressif/supervisor/usb_serial_jtag.h b/ports/espressif/supervisor/usb_serial_jtag.h new file mode 100644 index 0000000000..4f88e74921 --- /dev/null +++ b/ports/espressif/supervisor/usb_serial_jtag.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +void usb_serial_jtag_init(void); +bool usb_serial_jtag_connected(void); +char usb_serial_jtag_read_char(void); +bool usb_serial_jtag_bytes_available(void); +void usb_serial_jtag_write(const char *text, uint32_t length); diff --git a/ports/espressif/tools/build_memory_info.py b/ports/espressif/tools/build_memory_info.py index 94fd07bb52..b26c007741 100644 --- a/ports/espressif/tools/build_memory_info.py +++ b/ports/espressif/tools/build_memory_info.py @@ -5,6 +5,7 @@ # # SPDX-License-Identifier: MIT +import csv import os import re import sys @@ -13,27 +14,70 @@ from elftools.elf.elffile import ELFFile print() -internal_memory = [ - # Name, Start, Length - ("RTC Fast Memory", (0x3FF9_E000, 0x4007_0000), 8 * 1024), - ("RTC Slow Memory", (0x5000_0000,), 8 * 1024), - ("Internal SRAM 0", (0x3FFB_0000, 0x4002_0000), 32 * 1024), - ("Internal SRAM 1", (0x3FFB_8000, 0x4002_8000), 288 * 1024), -] - - -def partition_size(arg): - if "4MB" in arg: - return 1408 * 1024 - else: - return 2048 * 1024 +internal_memory = { + "esp32s2": [ + # Name, Start, Length + ("RTC Fast Memory", (0x3FF9_E000, 0x4007_0000), 8 * 1024), + ("RTC Slow Memory", (0x5000_0000,), 8 * 1024), + ("Internal SRAM 0", (0x3FFB_0000, 0x4002_0000), 32 * 1024), + ("Internal SRAM 1", (0x3FFB_8000, 0x4002_8000), 288 * 1024), + ], + "esp32s3": [ + # Name, Start, Length + ("RTC Fast Memory", (0x600F_E000,), 8 * 1024), + ("RTC Slow Memory", (0x5000_0000,), 8 * 1024), + ("Internal SRAM 0", (0x4037_0000,), 32 * 1024), + ("Internal SRAM 1", (0x3FC8_0000, 0x4037_8000), 416 * 1024), + ("Internal SRAM 2", (0x3FCF_0000,), 64 * 1024), + ], + "esp32c3": [ + # Name, Start, Length + ("RTC Fast Memory", (0x5000_0000,), 8 * 1024), + ("Internal SRAM 0", (0x4037_C000,), 16 * 1024), + ("Internal SRAM 1", (0x3FC8_0000, 0x4038_0000), 384 * 1024), + ], +} def align(n, m): return m * ((n + m - 1) // m) -regions = dict((name, 0) for name, _, _ in internal_memory) +def find_region(start_address): + for name, starts, length in internal_memory[target]: + for mem_start in starts: + mem_end = mem_start + length + if mem_start <= start_address < mem_end: + return (name, mem_start + length) + + +target = None + +# This file is the sdkconfig +with open(sys.argv[2], "r") as f: + for line in f: + line = line.strip() + if line.startswith("CONFIG_IDF_TARGET="): + target = line.split('"')[1] + elif line.startswith("CONFIG_PARTITION_TABLE_FILENAME"): + partitions_file = line.split('"')[1] + with open(partitions_file, "r") as f: + ota = None + app = None + for partition in csv.reader(f): + if partition[0][0] == "#": + continue + subtype = partition[2].strip() + if subtype == "factory": + app = partition[4].strip() + elif subtype == "ota_0": + ota = partition[4].strip() + size = app if ota is None else ota + if size[-1] not in ("k", "K"): + raise RuntimeError("Unhandled partition size suffix") + firmware_region = int(size[:-1]) * 1024 + +regions = dict((name, 0) for name, _, _ in internal_memory[target]) # This file is the elf with open(sys.argv[1], "rb") as stream: @@ -44,19 +88,20 @@ with open(sys.argv[1], "rb") as stream: offset = section["sh_offset"] if not size or not start: continue - for name, starts, length in internal_memory: - for mem_start in starts: - mem_end = mem_start + length - if start >= mem_start and start < mem_end: - regions[name] = max(regions.get(name, 0), size) - # print("# putting %s in %s (start=0x%x, size=%d)" % (section.name, name, start, size)) - -# This file is the sdkconfig -with open(sys.argv[2], "r") as f: - for line in f: - line = line.strip() - if line.startswith("CONFIG_PARTITION_TABLE_FILENAME"): - firmware_region = int(partition_size(line.split("=")[-1])) + # This handles sections that span two memory regions, not more than that. + # print(start, size, offset, section.name) + region = find_region(start) + if region is None: + continue + name, region_end = region + region_size = min(size, region_end - start) + regions[name] += region_size + # print("# putting %s in %s (start=0x%x, size=%d)" % (section.name, name, start, region_size)) + if region_size < size: + name, _ = find_region(region_end) + remaining_size = size - region_size + regions[name] += remaining_size + # print("# putting %s in %s (start=0x%x, size=%d)" % (section.name, name, region_end, remaining_size)) # This file is the bin used_flash = os.stat(sys.argv[3]).st_size @@ -67,7 +112,7 @@ print( used_flash, free_flash, firmware_region, firmware_region / 1024 ) ) -for name, mem_start, length in internal_memory: +for name, mem_start, length in internal_memory[target]: if name in regions: print( "{:7} bytes used, {:7} bytes free in '{}' out of {} bytes ({}kB).".format( diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index e89f7ab00d..9639e06435 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -3,6 +3,7 @@ import pathlib import click +import copy OPT_SETTINGS = [ "CONFIG_ESP_ERR_TO_NAME_LOOKUP", @@ -50,6 +51,9 @@ TARGET_SETTINGS = [ "ESP_SLEEP_GPIO_RESET_WORKAROUND", "CONFIG_ESP_PHY_ENABLE_USB", "CONFIG_BT_SOC_SUPPORT_5_0", + "CONFIG_NIMBLE_PINNED_TO_CORE", + "CONFIG_BT_NIMBLE_PINNED_TO_CORE", + "CONFIG_BT_CTRL_PINNED_TO_CORE", ] BOARD_SETTINGS = [ @@ -83,17 +87,18 @@ def matches_group(line, group): def add_group(lines, last_group, current_group): - # TODO: Properly handle nested groups - if last_group != current_group[-1]: - if last_group: - lines.append("# end of " + last_group) + if not current_group or last_group != current_group: + while last_group and last_group[-1] not in current_group: + lines.append("# end of " + last_group[-1]) lines.append("") - return None - if current_group: + last_group.pop() + for category in current_group: + if last_group and category in last_group: + continue lines.append("#") - lines.append("# " + current_group[-1]) + lines.append("# " + category) lines.append("#") - return current_group[-1] + return copy.copy(current_group) return last_group @@ -107,7 +112,8 @@ def add_group(lines, last_group, current_group): help="Updates the sdkconfigs outside of the board directory.", ) def update(debug, board, update_all): - """Simple program that greets NAME for a total of COUNT times.""" + """Updates related sdkconfig files based on the build directory version that + was likely modified by menuconfig.""" board_make = pathlib.Path(f"boards/{board}/mpconfigboard.mk") for line in board_make.read_text().split("\n"): @@ -147,7 +153,16 @@ def update(debug, board, update_all): last_default_group = None current_group = [] for line in input_config.read_text().split("\n"): - if line.startswith("# ") and "CONFIG_" not in line and len(line) > 3: + # Normalize the deprecated section labels. + if line == "# End of deprecated options": + line = "# end of Deprecated options for backward compatibility" + if ( + line.startswith("# ") + and "CONFIG_" not in line + and "DO NOT EDIT" not in line + and "Project Configuration" not in line + and len(line) > 3 + ): if line.startswith("# end of"): current_group.pop() else: diff --git a/ports/litex/boards/fomu/mpconfigboard.h b/ports/litex/boards/fomu/mpconfigboard.h index fd627c0b05..17f77f9993 100644 --- a/ports/litex/boards/fomu/mpconfigboard.h +++ b/ports/litex/boards/fomu/mpconfigboard.h @@ -33,5 +33,4 @@ #define FLASH_PAGE_SIZE (0x1000) #define FLASH_PARTITION_OFFSET_BYTES (1024 * 1024) -#define AUTORESET_DELAY_MS 500 #define BOARD_FLASH_SIZE (FLASH_SIZE) diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c index 0747c12190..a2f5786040 100644 --- a/ports/litex/mphalport.c +++ b/ports/litex/mphalport.c @@ -64,7 +64,7 @@ void isr(void) { nesting_count += 1; #ifdef CFG_TUSB_MCU if (irqs & (1 << USB_INTERRUPT)) { - usb_irq_handler(); + usb_irq_handler(0); } #endif if (irqs & (1 << TIMER0_INTERRUPT)) { diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 0ac74579a7..4a74b8fce5 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -164,6 +164,13 @@ SRC_C += \ reset.c \ supervisor/flexspi_nor_flash_ops.c +ifeq ($(CIRCUITPY_USB_HOST), 1) +SRC_C += \ + lib/tinyusb/src/portable/chipidea/ci_hs/hcd_ci_hs.c \ + lib/tinyusb/src/portable/ehci/ehci.c \ + +endif + # TODO #ifeq ($(CIRCUITPY_AUDIOBUSIO),1) #SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c @@ -219,3 +226,13 @@ include $(TOP)/py/mkrules.mk # https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile print-%: @echo $* = $($*) + +ifeq ($(CHIP_FAMILY), MIMXRT1062) +PYOCD_TARGET = mimxrt1060 +endif + +# Flash using pyocd +PYOCD_OPTION ?= +flash: $(BUILD)/firmware.hex + pyocd flash -t $(PYOCD_TARGET) $(PYOCD_OPTION) $< + pyocd reset -t $(PYOCD_TARGET) diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h index 8eccd8aee4..8e026fa7ce 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h @@ -7,8 +7,20 @@ #define BOARD_FLASH_SIZE (8 * 1024 * 1024) +#define MICROPY_HW_LED_STATUS (&pin_GPIO_AD_B0_09) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01) #define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07) #define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06) + +#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO_AD_B0_12) +#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO_AD_B0_13) + + +// Put host on the first USB so that right angle OTG adapters can fit. This is +// the right port when looking at the board. +#define CIRCUITPY_USB_DEVICE_INSTANCE 1 +#define CIRCUITPY_USB_HOST_INSTANCE 0 diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.mk index e82d8ee743..27bb35acf5 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.mk @@ -6,3 +6,5 @@ USB_MANUFACTURER = "NXP" CHIP_VARIANT = MIMXRT1062DVJ6A CHIP_FAMILY = MIMXRT1062 FLASH = IS25WP064A + +CIRCUITPY_USB_HOST = 1 diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c index 9febc3dae8..2f38931573 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/pins.c @@ -125,6 +125,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, { MP_ROM_QSTR(MP_QSTR_CAN_STBY), MP_ROM_PTR(&pin_GPIO_AD_B0_05) }, + // USB + #if CIRCUITPY_USB_HOST_INSTANCE == 0 + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG1_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG1_DN) }, + #elif CIRCUITPY_USB_HOST_INSTANCE == 1 + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG2_DN) }, + #endif + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; diff --git a/ports/mimxrt10xx/boards/teensy41/mpconfigboard.h b/ports/mimxrt10xx/boards/teensy41/mpconfigboard.h index 15b8c0f34a..4ba34692c6 100644 --- a/ports/mimxrt10xx/boards/teensy41/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/teensy41/mpconfigboard.h @@ -16,3 +16,6 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B0_03) #define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B0_02) + +#define CIRCUITPY_USB_DEVICE_INSTANCE 0 +#define CIRCUITPY_USB_HOST_INSTANCE 1 diff --git a/ports/mimxrt10xx/boards/teensy41/mpconfigboard.mk b/ports/mimxrt10xx/boards/teensy41/mpconfigboard.mk index 035c51b553..9f214a22a2 100644 --- a/ports/mimxrt10xx/boards/teensy41/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/teensy41/mpconfigboard.mk @@ -7,3 +7,4 @@ CHIP_VARIANT = MIMXRT1062DVJ6A CHIP_FAMILY = MIMXRT1062 FLASH = W25Q64JV CIRCUITPY__EVE = 1 +CIRCUITPY_USB_HOST = 1 diff --git a/ports/mimxrt10xx/boards/teensy41/pins.c b/ports/mimxrt10xx/boards/teensy41/pins.c index 32e57b1a14..46604a933d 100644 --- a/ports/mimxrt10xx/boards/teensy41/pins.c +++ b/ports/mimxrt10xx/boards/teensy41/pins.c @@ -142,6 +142,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D54), MP_ROM_PTR(&pin_GPIO_EMC_29) }, { MP_OBJ_NEW_QSTR(MP_QSTR_QSPI_IO3), MP_ROM_PTR(&pin_GPIO_EMC_29) }, + // USB Host + { MP_ROM_QSTR(MP_QSTR_USB_HOST_POWER), MP_ROM_PTR(&pin_GPIO_EMC_40) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG2_DN) }, + { 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) }, diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 7933975322..77a2f97974 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -43,6 +43,7 @@ // arrays use 0 based numbering: UART1 is stored at index 0 #define MAX_UART 8 STATIC bool reserved_uart[MAX_UART]; +STATIC bool never_reset_uart[MAX_UART]; #define UART_CLOCK_FREQ (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U) @@ -75,11 +76,22 @@ STATIC void LPUART_UserCallback(LPUART_Type *base, lpuart_handle_t *handle, stat void uart_reset(void) { for (uint i = 0; i < MP_ARRAY_SIZE(mcu_uart_banks); i++) { + if (never_reset_uart[i]) { + continue; + } reserved_uart[i] = false; LPUART_Deinit(mcu_uart_banks[i]); } } +void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) { + never_reset_uart[self->index] = true; + common_hal_never_reset_pin(self->tx); + common_hal_never_reset_pin(self->rx); + common_hal_never_reset_pin(self->rts); + common_hal_never_reset_pin(self->cts); +} + void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t *tx, const mcu_pin_obj_t *rx, const mcu_pin_obj_t *rts, const mcu_pin_obj_t *cts, @@ -103,6 +115,11 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, const uint32_t rx_count = MP_ARRAY_SIZE(mcu_uart_rx_list); const uint32_t tx_count = MP_ARRAY_SIZE(mcu_uart_tx_list); + const mcu_periph_obj_t *tx_config = NULL; + const mcu_periph_obj_t *rx_config = NULL; + const mcu_periph_obj_t *rts_config = NULL; + const mcu_periph_obj_t *cts_config = NULL; + // RX loop handles rx only, or both rx and tx if (rx != NULL) { for (uint32_t i = 0; i < rx_count; ++i) { @@ -121,11 +138,11 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uart_taken = true; break; } - self->rx = &mcu_uart_rx_list[i]; - self->tx = &mcu_uart_tx_list[j]; + rx_config = &mcu_uart_rx_list[i]; + tx_config = &mcu_uart_tx_list[j]; break; } - if (self->tx != NULL || uart_taken) { + if (tx_config != NULL || uart_taken) { break; } } else { @@ -133,7 +150,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uart_taken = true; break; } - self->rx = &mcu_uart_rx_list[i]; + rx_config = &mcu_uart_rx_list[i]; } } } else if (tx != NULL) { @@ -146,17 +163,17 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uart_taken = true; break; } - self->tx = &mcu_uart_tx_list[i]; + tx_config = &mcu_uart_tx_list[i]; break; } } else { mp_raise_ValueError(translate("Supply at least one UART pin")); } - if (rx && !self->rx) { + if (rx && !rx_config) { mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_RX); } - if (tx && !self->tx) { + if (tx && !tx_config) { mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_TX); } @@ -187,52 +204,58 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (rts != NULL) { for (uint32_t i = 0; i < rts_count; ++i) { - if (mcu_uart_rts_list[i].bank_idx == self->rx->bank_idx) { + if (mcu_uart_rts_list[i].bank_idx == rx_config->bank_idx) { if (mcu_uart_rts_list[i].pin == rts) { - self->rts = &mcu_uart_rts_list[i]; + rts_config = &mcu_uart_rts_list[i]; break; } } } - if (self->rts == NULL) { + if (rts_config == NULL) { mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_RTS); } } if (cts != NULL) { for (uint32_t i = 0; i < cts_count; ++i) { - if (mcu_uart_cts_list[i].bank_idx == self->rx->bank_idx) { + if (mcu_uart_cts_list[i].bank_idx == tx_config->bank_idx) { if (mcu_uart_cts_list[i].pin == cts) { - self->cts = &mcu_uart_cts_list[i]; + cts_config = &mcu_uart_cts_list[i]; break; } } } - if (self->cts == NULL) { + if (cts == NULL) { mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_CTS); } } + if (self->rx) { - self->uart = mcu_uart_banks[self->rx->bank_idx - 1]; + self->index = rx_config->bank_idx - 1; } else { assert(self->tx); - self->uart = mcu_uart_banks[self->tx->bank_idx - 1]; + self->index = tx_config->bank_idx - 1; } + self->uart = mcu_uart_banks[self->index]; assert(self->uart); - if (self->rx) { - config_periph_pin(self->rx); + if (rx_config) { + config_periph_pin(rx_config); + self->rx = rx; } - if (self->tx) { - config_periph_pin(self->tx); + if (tx_config) { + config_periph_pin(tx_config); + self->tx = tx; } - if (self->rts) { - config_periph_pin(self->rts); + if (rts_config) { + config_periph_pin(rts_config); + self->rts = rts; } - if (self->cts) { - config_periph_pin(self->cts); + if (cts_config) { + config_periph_pin(cts_config); + self->cts = cts; } lpuart_config_t config = { 0 }; @@ -245,10 +268,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, config.enableRxRTS = self->rts != NULL; config.enableTxCTS = self->cts != NULL; if (self->rts != NULL) { - claim_pin(self->rts->pin); + claim_pin(self->rts); } if (self->cts != NULL) { - claim_pin(self->cts->pin); + claim_pin(self->cts); } LPUART_Init(self->uart, &config, UART_CLOCK_FREQ); @@ -265,12 +288,16 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->uart->MODIR = modir; if (self->tx != NULL) { - claim_pin(self->tx->pin); + claim_pin(self->tx); } if (self->rx != NULL) { - // The LPUART ring buffer wastes one byte to distinguish between full and empty. - self->ringbuf = gc_alloc(receiver_buffer_size + 1, false, true /*long-lived*/); + if (receiver_buffer == NULL) { + self->ringbuf = gc_alloc(receiver_buffer_size, false, true /*long-lived*/); + } else { + self->ringbuf = receiver_buffer; + } + if (!self->ringbuf) { LPUART_Deinit(self->uart); @@ -280,9 +307,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, LPUART_TransferCreateHandle(self->uart, &self->handle, LPUART_UserCallback, self); // Pass actual allocated size; the LPUART routines are cognizant that // the capacity is one less than the size. - LPUART_TransferStartRingBuffer(self->uart, &self->handle, self->ringbuf, receiver_buffer_size + 1); + LPUART_TransferStartRingBuffer(self->uart, &self->handle, self->ringbuf, receiver_buffer_size); - claim_pin(self->rx->pin); + claim_pin(self->rx); } } @@ -294,19 +321,15 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { if (common_hal_busio_uart_deinited(self)) { return; } - if (self->rx) { - reserved_uart[self->rx->bank_idx - 1] = false; - } else { - reserved_uart[self->tx->bank_idx - 1] = false; - } + + reserved_uart[self->index] = false; + never_reset_uart[self->index] = false; LPUART_Deinit(self->uart); gc_free(self->ringbuf); - - common_hal_reset_pin(self->rx->pin); - common_hal_reset_pin(self->tx->pin); - + common_hal_reset_pin(self->rx); + common_hal_reset_pin(self->tx); self->rx = NULL; self->tx = NULL; diff --git a/ports/mimxrt10xx/common-hal/busio/UART.h b/ports/mimxrt10xx/common-hal/busio/UART.h index 78c91173a3..fb3fd3245a 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.h +++ b/ports/mimxrt10xx/common-hal/busio/UART.h @@ -41,14 +41,15 @@ typedef struct { LPUART_Type *uart; lpuart_handle_t handle; uint8_t *ringbuf; - bool rx_ongoing; uint32_t baudrate; - uint8_t character_bits; uint32_t timeout_ms; - const mcu_periph_obj_t *rx; - const mcu_periph_obj_t *tx; - const mcu_periph_obj_t *cts; - const mcu_periph_obj_t *rts; + bool rx_ongoing; + uint8_t character_bits; + uint8_t index; + const mcu_pin_obj_t *rx; + const mcu_pin_obj_t *tx; + const mcu_pin_obj_t *cts; + const mcu_pin_obj_t *rts; } busio_uart_obj_t; void uart_reset(void); diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 53e92d4105..06a2a34fe1 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -40,10 +40,12 @@ void reset_all_pins(void) { claimed_pins[i] = never_reset_pins[i]; } for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { - if (!never_reset_pins[i]) { - IOMUXC->SW_MUX_CTL_PAD[i] = ((mcu_pin_obj_t *)(mcu_pin_globals.map.table[i].value))->mux_reset; - IOMUXC->SW_PAD_CTL_PAD[i] = ((mcu_pin_obj_t *)(mcu_pin_globals.map.table[i].value))->pad_reset; + mcu_pin_obj_t *pin = mcu_pin_globals.map.table[i].value; + if (never_reset_pins[pin->mux_idx]) { + continue; } + *(uint32_t *)pin->mux_reg = pin->mux_reset; + *(uint32_t *)pin->cfg_reg = pin->pad_reset; } } @@ -60,6 +62,9 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { } void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { + if (pin == NULL) { + return; + } never_reset_pins[pin->mux_idx] = true; } diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 3f638dc039..e6edd6dfc9 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -286,6 +286,12 @@ STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_09), MP_ROM_PTR(&pin_GPIO_SD_B1_09) }, { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_10), MP_ROM_PTR(&pin_GPIO_SD_B1_10) }, { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_11), MP_ROM_PTR(&pin_GPIO_SD_B1_11) }, + #ifdef MIMXRT1062_SERIES + { MP_ROM_QSTR(MP_QSTR_USB_OTG1_DN), MP_ROM_PTR(&pin_USB_OTG1_DN) }, + { MP_ROM_QSTR(MP_QSTR_USB_OTG1_DP), MP_ROM_PTR(&pin_USB_OTG1_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_OTG2_DN), MP_ROM_PTR(&pin_USB_OTG2_DN) }, + { MP_ROM_QSTR(MP_QSTR_USB_OTG2_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) }, + #endif #endif }; MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table); diff --git a/ports/mimxrt10xx/common-hal/usb_host/Port.c b/ports/mimxrt10xx/common-hal/usb_host/Port.c new file mode 100644 index 0000000000..52ac12dc86 --- /dev/null +++ b/ports/mimxrt10xx/common-hal/usb_host/Port.c @@ -0,0 +1,59 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-bindings/usb_host/Port.h" + +#include "shared-bindings/microcontroller/Pin.h" + +#include "py/runtime.h" + +bool usb_host_init; + +void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm) { + const mcu_pin_obj_t *supported_dp; + const mcu_pin_obj_t *supported_dm; + if (CIRCUITPY_USB_HOST_INSTANCE == 0) { + supported_dp = &pin_USB_OTG1_DP; + supported_dm = &pin_USB_OTG1_DN; + } else if (CIRCUITPY_USB_HOST_INSTANCE == 1) { + supported_dp = &pin_USB_OTG2_DP; + supported_dm = &pin_USB_OTG2_DN; + } + if (dp != supported_dp || dm != supported_dm) { + mp_raise_ValueError(translate("Invalid pins")); + } + self->init = true; + usb_host_init = true; +} + +void common_hal_usb_host_port_deinit(usb_host_port_obj_t *self) { + self->init = false; + usb_host_init = false; +} + +bool common_hal_usb_host_port_deinited(usb_host_port_obj_t *self) { + return !self->init; +} diff --git a/ports/mimxrt10xx/common-hal/usb_host/Port.h b/ports/mimxrt10xx/common-hal/usb_host/Port.h new file mode 100644 index 0000000000..dad1adf3a2 --- /dev/null +++ b/ports/mimxrt10xx/common-hal/usb_host/Port.h @@ -0,0 +1,41 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#ifndef MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_USB_HOST_PORT_H +#define MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_USB_HOST_PORT_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + bool init; +} usb_host_port_obj_t; + +// Cheater state so that the usb module knows if it should return the TinyUSB +// state. +extern bool usb_host_init; + +#endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_USB_HOST_PORT_H diff --git a/ports/mimxrt10xx/common-hal/usb_host/__init__.c b/ports/mimxrt10xx/common-hal/usb_host/__init__.c new file mode 100644 index 0000000000..3b54bd6a5d --- /dev/null +++ b/ports/mimxrt10xx/common-hal/usb_host/__init__.c @@ -0,0 +1,27 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +// Nothing diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c index 0e440b6b63..7fb5e7a9be 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c @@ -153,3 +153,8 @@ const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 8, GPIO_SD_B1_08, NO_ADC, 0, const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 9, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 10, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 11, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t pin_USB_OTG1_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG1_DP = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG2_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG2_DP = { { &mcu_pin_type }, }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h index 6a72eaa7b2..109882df93 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h @@ -158,6 +158,11 @@ extern const mcu_pin_obj_t pin_GPIO_SD_B1_09; extern const mcu_pin_obj_t pin_GPIO_SD_B1_10; extern const mcu_pin_obj_t pin_GPIO_SD_B1_11; +extern const mcu_pin_obj_t pin_USB_OTG1_DN; +extern const mcu_pin_obj_t pin_USB_OTG1_DP; +extern const mcu_pin_obj_t pin_USB_OTG2_DN; +extern const mcu_pin_obj_t pin_USB_OTG2_DP; + extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; #endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1062_PINS_H diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index 0b25bb6d2a..fe10b73116 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -408,7 +408,11 @@ void port_idle_until_interrupt(void) { common_hal_mcu_disable_interrupts(); if (!background_callback_pending()) { NVIC_ClearPendingIRQ(SNVS_HP_WRAPPER_IRQn); + // Don't down clock on debug builds because it prevents the DAP from + // reading memory + #if CIRCUITPY_DEBUG == 0 CLOCK_SetMode(kCLOCK_ModeWait); + #endif __WFI(); CLOCK_SetMode(kCLOCK_ModeRun); } diff --git a/ports/mimxrt10xx/supervisor/serial.c b/ports/mimxrt10xx/supervisor/serial.c index ea706d8a8c..b3c37b077d 100644 --- a/ports/mimxrt10xx/supervisor/serial.c +++ b/ports/mimxrt10xx/supervisor/serial.c @@ -33,6 +33,8 @@ #include "fsl_clock.h" #include "fsl_lpuart.h" +// TODO: Switch this to using DEBUG_UART. + // static LPUART_Type *uart_instance = LPUART1; // evk static LPUART_Type *uart_instance = LPUART4; // feather 1011 // static LPUART_Type *uart_instance = LPUART2; // feather 1062 @@ -52,7 +54,7 @@ static uint32_t UartSrcFreq(void) { return freq; } -void serial_init(void) { +void port_serial_init(void) { lpuart_config_t config; LPUART_GetDefaultConfig(&config); @@ -63,11 +65,11 @@ void serial_init(void) { LPUART_Init(uart_instance, &config, UartSrcFreq()); } -bool serial_connected(void) { +bool port_serial_connected(void) { return true; } -char serial_read(void) { +char port_serial_read(void) { uint8_t data; LPUART_ReadBlocking(uart_instance, &data, sizeof(data)); @@ -75,15 +77,11 @@ char serial_read(void) { return data; } -bool serial_bytes_available(void) { +bool port_serial_bytes_available(void) { return LPUART_GetStatusFlags(uart_instance) & kLPUART_RxDataRegFullFlag; } -void serial_write(const char *text) { - LPUART_WriteBlocking(uart_instance, (uint8_t *)text, strlen(text)); -} - -void serial_write_substring(const char *text, uint32_t len) { +void port_serial_write_substring(const char *text, uint32_t len) { if (len == 0) { return; } diff --git a/ports/mimxrt10xx/supervisor/usb.c b/ports/mimxrt10xx/supervisor/usb.c index c00ff44acd..2094a943b5 100644 --- a/ports/mimxrt10xx/supervisor/usb.c +++ b/ports/mimxrt10xx/supervisor/usb.c @@ -29,30 +29,62 @@ #include "tusb.h" #include "supervisor/usb.h" -void init_usb_hardware(void) { - CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U); - CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U); - - #ifdef USBPHY - USBPHY_Type *usb_phy = USBPHY; +STATIC void init_usb_instance(mp_int_t instance) { + if (instance < 0) { + return; + } + USBPHY_Type *usb_phy; + #ifdef USBPHY2 + if (instance == 0) { + usb_phy = USBPHY1; #else - USBPHY_Type *usb_phy = USBPHY1; + (void)instance; + usb_phy = USBPHY; + #endif + CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U); + CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U); + + #ifdef USBPHY2 + } else if (instance == 1) { + CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usbphy480M, 480000000U); + CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, 480000000U); + usb_phy = USBPHY2; + } else { + // Unsupported instance + return; + } #endif - // Enable PHY support for Low speed device + LS via FS Hub - usb_phy->CTRL |= USBPHY_CTRL_SET_ENUTMILEVEL2_MASK | USBPHY_CTRL_SET_ENUTMILEVEL3_MASK; + // Enable PHY support for Low speed device + LS via FS Hub + usb_phy->CTRL |= USBPHY_CTRL_SET_ENUTMILEVEL2_MASK | USBPHY_CTRL_SET_ENUTMILEVEL3_MASK; - // Enable all power for normal operation - usb_phy->PWD = 0; + // Enable all power for normal operation + usb_phy->PWD = 0; - // TX Timing - uint32_t phytx = usb_phy->TX; - phytx &= ~(USBPHY_TX_D_CAL_MASK | USBPHY_TX_TXCAL45DM_MASK | USBPHY_TX_TXCAL45DP_MASK); - phytx |= USBPHY_TX_D_CAL(0x0C) | USBPHY_TX_TXCAL45DP(0x06) | USBPHY_TX_TXCAL45DM(0x06); - usb_phy->TX = phytx; -} + // TX Timing + uint32_t phytx = usb_phy->TX; + phytx &= ~(USBPHY_TX_D_CAL_MASK | USBPHY_TX_TXCAL45DM_MASK | USBPHY_TX_TXCAL45DP_MASK); + phytx |= USBPHY_TX_D_CAL(0x0C) | USBPHY_TX_TXCAL45DP(0x06) | USBPHY_TX_TXCAL45DM(0x06); + usb_phy->TX = phytx; + } -void USB_OTG1_IRQHandler(void); -void USB_OTG1_IRQHandler(void) { - usb_irq_handler(); -} + void init_usb_hardware(void) { + init_usb_instance(CIRCUITPY_USB_DEVICE_INSTANCE); + // We can't dynamically start the USB Host port at the moment, so do it + // up front. + init_usb_instance(CIRCUITPY_USB_HOST_INSTANCE); + } + +// Provide the prototypes for the interrupt handlers. The iMX RT SDK doesn't. +// The SDK only links to them from assembly. + void USB_OTG1_IRQHandler(void); + void USB_OTG1_IRQHandler(void) { + usb_irq_handler(0); + } + + #ifdef USBPHY2 + void USB_OTG2_IRQHandler(void); + void USB_OTG2_IRQHandler(void) { + usb_irq_handler(1); + } + #endif diff --git a/ports/nrf/boards/aramcon2_badge/mpconfigboard.h b/ports/nrf/boards/aramcon2_badge/mpconfigboard.h index 7691d1e461..517ad7324b 100644 --- a/ports/nrf/boards/aramcon2_badge/mpconfigboard.h +++ b/ports/nrf/boards/aramcon2_badge/mpconfigboard.h @@ -54,8 +54,6 @@ #define BOARD_USER_SAFE_MODE_ACTION translate("pressing the left button at start up\n") -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/nrf/boards/arduino_nano_33_ble/mpconfigboard.h b/ports/nrf/boards/arduino_nano_33_ble/mpconfigboard.h index d34a862439..851632f860 100644 --- a/ports/nrf/boards/arduino_nano_33_ble/mpconfigboard.h +++ b/ports/nrf/boards/arduino_nano_33_ble/mpconfigboard.h @@ -3,8 +3,6 @@ #define MICROPY_HW_BOARD_NAME "Arduino Nano 33 BLE" #define MICROPY_HW_MCU_NAME "nRF52840" -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #define DEFAULT_I2C_BUS_SCL (&pin_P0_02) #define DEFAULT_I2C_BUS_SDA (&pin_P0_31) diff --git a/ports/nrf/boards/bastble/mpconfigboard.h b/ports/nrf/boards/bastble/mpconfigboard.h index e36227c6bc..e97fa429ee 100644 --- a/ports/nrf/boards/bastble/mpconfigboard.h +++ b/ports/nrf/boards/bastble/mpconfigboard.h @@ -3,8 +3,6 @@ #define MICROPY_HW_BOARD_NAME "BastBLE" #define MICROPY_HW_MCU_NAME "nRF52840" -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #if QSPI_FLASH_FILESYSTEM #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 30) #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 29) diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.mk b/ports/nrf/boards/bluemicro833/mpconfigboard.mk index b7594f0d89..23c04ed47c 100644 --- a/ports/nrf/boards/bluemicro833/mpconfigboard.mk +++ b/ports/nrf/boards/bluemicro833/mpconfigboard.mk @@ -36,7 +36,9 @@ CIRCUITPY_RE = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_SDCARDIO = 0 CIRCUITPY_SYNTHIO = 0 +CIRCUITPY_TRACEBACK = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_TRACEBACK = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_VECTORIO = 0 diff --git a/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h index 65d8a642e8..558f66bf7b 100644 --- a/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h +++ b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h @@ -53,8 +53,6 @@ #define SPI_FLASH_CS_PIN &pin_P0_20 #endif -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h b/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h index 14798aeee2..49ef2b93be 100644 --- a/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h +++ b/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h @@ -5,8 +5,6 @@ #define MICROPY_HW_LED_STATUS (&pin_P0_27) -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.h index 629463e4e2..47220bb474 100644 --- a/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.h +++ b/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.h @@ -24,8 +24,6 @@ #define SPI_FLASH_CS_PIN &pin_P0_23 #endif -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.h b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.h index 684b2c501a..c7a7e522d4 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.h @@ -33,3 +33,8 @@ #define MICROPY_HW_MCU_NAME "nRF52840" #define BOARD_HAS_CRYSTAL 1 // according to the schematic we do + +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_P0_23) +#define CIRCUITPY_RGB_STATUS_G (&pin_P0_22) +#define CIRCUITPY_RGB_STATUS_B (&pin_P0_24) diff --git a/ports/nrf/boards/microbit_v2/mpconfigboard.h b/ports/nrf/boards/microbit_v2/mpconfigboard.h index 48b9ea8699..bae49dfae2 100644 --- a/ports/nrf/boards/microbit_v2/mpconfigboard.h +++ b/ports/nrf/boards/microbit_v2/mpconfigboard.h @@ -52,5 +52,5 @@ #define BOOTLOADER_SETTING_SIZE (0) #define BOARD_HAS_32KHZ_XTAL (0) -#define DEBUG_UART_TX (&pin_P0_06) -#define DEBUG_UART_RX (&pin_P1_08) +#define CIRCUITPY_DEBUG_UART_TX (&pin_P0_06) +#define CIRCUITPY_DEBUG_UART_RX (&pin_P1_08) diff --git a/ports/nrf/boards/ssci_isp1807_dev_board/board.c b/ports/nrf/boards/ssci_isp1807_dev_board/board.c new file mode 100644 index 0000000000..8d8e531d47 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_dev_board/board.c @@ -0,0 +1,43 @@ +/* + * 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" +#include "nrf.h" +#include "nrf_rtc.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/nrf/boards/ssci_isp1807_dev_board/mpconfigboard.h b/ports/nrf/boards/ssci_isp1807_dev_board/mpconfigboard.h new file mode 100644 index 0000000000..bfa6abf481 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_dev_board/mpconfigboard.h @@ -0,0 +1,14 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "SSCI ISP1807 Dev Board" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_23) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_19) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_10) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_12) + +#define DEFAULT_UART_BUS_RX (&pin_P0_25) +#define DEFAULT_UART_BUS_TX (&pin_P0_11) diff --git a/ports/nrf/boards/ssci_isp1807_dev_board/mpconfigboard.mk b/ports/nrf/boards/ssci_isp1807_dev_board/mpconfigboard.mk new file mode 100644 index 0000000000..34b39d1321 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_dev_board/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x2786 +USB_PID = 0x920D +USB_PRODUCT = "SSCI ISP1807 Dev Board" +USB_MANUFACTURER = "Switch Science, Inc." + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/ssci_isp1807_dev_board/pins.c b/ports/nrf/boards/ssci_isp1807_dev_board/pins.c new file mode 100644 index 0000000000..d3188c3644 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_dev_board/pins.c @@ -0,0 +1,58 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_P0_27), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_P0_03), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_P0_05), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_P0_06), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_P0_08), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) }, + + { MP_ROM_QSTR(MP_QSTR_P0_25), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P0_09), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_P0_10), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON),MP_ROM_PTR(&pin_P1_06) }, + + { MP_ROM_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_P0_23) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_25) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/ssci_isp1807_micro_board/board.c b/ports/nrf/boards/ssci_isp1807_micro_board/board.c new file mode 100644 index 0000000000..8d8e531d47 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_micro_board/board.c @@ -0,0 +1,43 @@ +/* + * 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" +#include "nrf.h" +#include "nrf_rtc.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/nrf/boards/ssci_isp1807_micro_board/mpconfigboard.h b/ports/nrf/boards/ssci_isp1807_micro_board/mpconfigboard.h new file mode 100644 index 0000000000..7ff5d41630 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_micro_board/mpconfigboard.h @@ -0,0 +1,14 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "SSCI ISP1807 Micro Board" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_23) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_29) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_06) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_08) + +#define DEFAULT_UART_BUS_RX (&pin_P0_19) +#define DEFAULT_UART_BUS_TX (&pin_P0_30) diff --git a/ports/nrf/boards/ssci_isp1807_micro_board/mpconfigboard.mk b/ports/nrf/boards/ssci_isp1807_micro_board/mpconfigboard.mk new file mode 100644 index 0000000000..ae3a750f80 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_micro_board/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x2786 +USB_PID = 0x920F +USB_PRODUCT = "SSCI ISP1807 Micro Board" +USB_MANUFACTURER = "Switch Science, Inc." + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/ssci_isp1807_micro_board/pins.c b/ports/nrf/boards/ssci_isp1807_micro_board/pins.c new file mode 100644 index 0000000000..7b7b8833a4 --- /dev/null +++ b/ports/nrf/boards/ssci_isp1807_micro_board/pins.c @@ -0,0 +1,51 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D10),MP_ROM_PTR(&pin_P0_17) }, + { MP_ROM_QSTR(MP_QSTR_D14),MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D15),MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D16),MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_D17),MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_D18),MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_D19),MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_D20),MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_D21),MP_ROM_PTR(&pin_P0_05) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) }, + + { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_P0_23) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_06) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_19) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/warmbit_bluepixel/mpconfigboard.h b/ports/nrf/boards/warmbit_bluepixel/mpconfigboard.h index 224bdd5e90..484032f9c3 100644 --- a/ports/nrf/boards/warmbit_bluepixel/mpconfigboard.h +++ b/ports/nrf/boards/warmbit_bluepixel/mpconfigboard.h @@ -5,8 +5,6 @@ #define MICROPY_HW_LED_STATUS (&pin_P0_12) -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 - #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/nrf/supervisor/usb.c b/ports/nrf/supervisor/usb.c index 8651b008f0..d2d05ee312 100644 --- a/ports/nrf/supervisor/usb.c +++ b/ports/nrf/supervisor/usb.c @@ -93,5 +93,5 @@ void init_usb_hardware(void) { extern void USBD_IRQHandler(void); void USBD_IRQHandler(void) { - usb_irq_handler(); + usb_irq_handler(0); } diff --git a/ports/raspberrypi/boards/melopero_shake_rp2040/pins.c b/ports/raspberrypi/boards/melopero_shake_rp2040/pins.c index c3bc3f6d6f..ca28c1078b 100644 --- a/ports/raspberrypi/boards/melopero_shake_rp2040/pins.c +++ b/ports/raspberrypi/boards/melopero_shake_rp2040/pins.c @@ -1,6 +1,8 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/board.c b/ports/raspberrypi/boards/pimoroni_badger2040/board.c index de6e424ed9..6daf4c52b2 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040/board.c @@ -26,7 +26,284 @@ #include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/board.h" + +#define DELAY 0x80 + +enum reg { + PSR = 0x00, + PWR = 0x01, + POF = 0x02, + PFS = 0x03, + PON = 0x04, + PMES = 0x05, + BTST = 0x06, + DSLP = 0x07, + DTM1 = 0x10, + DSP = 0x11, + DRF = 0x12, + DTM2 = 0x13, + LUT_VCOM = 0x20, + LUT_WW = 0x21, + LUT_BW = 0x22, + LUT_WB = 0x23, + LUT_BB = 0x24, + PLL = 0x30, + TSC = 0x40, + TSE = 0x41, + TSR = 0x43, + TSW = 0x42, + CDI = 0x50, + LPD = 0x51, + TCON = 0x60, + TRES = 0x61, + REV = 0x70, + FLG = 0x71, + AMV = 0x80, + VV = 0x81, + VDCS = 0x82, + PTL = 0x90, + PTIN = 0x91, + PTOU = 0x92, + PGM = 0xa0, + APG = 0xa1, + ROTP = 0xa2, + CCSET = 0xe0, + PWS = 0xe3, + TSSET = 0xe5 +}; + +enum PSR_FLAGS { + RES_96x230 = 0b00000000, + RES_96x252 = 0b01000000, + RES_128x296 = 0b10000000, + RES_160x296 = 0b11000000, + + LUT_OTP = 0b00000000, + LUT_REG = 0b00100000, + + FORMAT_BWR = 0b00000000, + FORMAT_BW = 0b00010000, + + SCAN_DOWN = 0b00000000, + SCAN_UP = 0b00001000, + + SHIFT_LEFT = 0b00000000, + SHIFT_RIGHT = 0b00000100, + + BOOSTER_OFF = 0b00000000, + BOOSTER_ON = 0b00000010, + + RESET_SOFT = 0b00000000, + RESET_NONE = 0b00000001 +}; + +enum PWR_FLAGS_1 { + VDS_EXTERNAL = 0b00000000, + VDS_INTERNAL = 0b00000010, + + VDG_EXTERNAL = 0b00000000, + VDG_INTERNAL = 0b00000001 +}; + +enum PWR_FLAGS_2 { + VCOM_VD = 0b00000000, + VCOM_VG = 0b00000100, + + VGHL_16V = 0b00000000, + VGHL_15V = 0b00000001, + VGHL_14V = 0b00000010, + VGHL_13V = 0b00000011 +}; + +enum BOOSTER_FLAGS { + START_10MS = 0b00000000, + START_20MS = 0b01000000, + START_30MS = 0b10000000, + START_40MS = 0b11000000, + + STRENGTH_1 = 0b00000000, + STRENGTH_2 = 0b00001000, + STRENGTH_3 = 0b00010000, + STRENGTH_4 = 0b00011000, + STRENGTH_5 = 0b00100000, + STRENGTH_6 = 0b00101000, + STRENGTH_7 = 0b00110000, + STRENGTH_8 = 0b00111000, + + OFF_0_27US = 0b00000000, + OFF_0_34US = 0b00000001, + OFF_0_40US = 0b00000010, + OFF_0_54US = 0b00000011, + OFF_0_80US = 0b00000100, + OFF_1_54US = 0b00000101, + OFF_3_34US = 0b00000110, + OFF_6_58US = 0b00000111 +}; + +enum PFS_FLAGS { + FRAMES_1 = 0b00000000, + FRAMES_2 = 0b00010000, + FRAMES_3 = 0b00100000, + FRAMES_4 = 0b00110000 +}; + +enum TSE_FLAGS { + TEMP_INTERNAL = 0b00000000, + TEMP_EXTERNAL = 0b10000000, + + OFFSET_0 = 0b00000000, + OFFSET_1 = 0b00000001, + OFFSET_2 = 0b00000010, + OFFSET_3 = 0b00000011, + OFFSET_4 = 0b00000100, + OFFSET_5 = 0b00000101, + OFFSET_6 = 0b00000110, + OFFSET_7 = 0b00000111, + + OFFSET_MIN_8 = 0b00001000, + OFFSET_MIN_7 = 0b00001001, + OFFSET_MIN_6 = 0b00001010, + OFFSET_MIN_5 = 0b00001011, + OFFSET_MIN_4 = 0b00001100, + OFFSET_MIN_3 = 0b00001101, + OFFSET_MIN_2 = 0b00001110, + OFFSET_MIN_1 = 0b00001111 +}; + +enum PLL_FLAGS { + // other frequency options exist but there doesn't seem to be much + // point in including them - this is a fair range of options... + HZ_29 = 0b00111111, + HZ_33 = 0b00111110, + HZ_40 = 0b00111101, + HZ_50 = 0b00111100, + HZ_67 = 0b00111011, + HZ_100 = 0b00111010, + HZ_200 = 0b00111001 +}; + +// This is an UC8151 control chip. The display is a 2.9" grayscale EInk. +const uint8_t display_start_sequence[] = { + PWR, 5, VDS_INTERNAL | VDG_INTERNAL, VCOM_VD | VGHL_16V, 0b101011, 0b101011, 0b101011, // power setting + PON, DELAY, 200, // power on and wait 200 ms + BTST, 3, (START_10MS | STRENGTH_3 | OFF_6_58US), (START_10MS | STRENGTH_3 | OFF_6_58US), (START_10MS | STRENGTH_3 | OFF_6_58US), + PSR, 1, (RES_128x296 | LUT_REG | FORMAT_BW | SCAN_UP | SHIFT_RIGHT | BOOSTER_ON | RESET_NONE), + PFS, 1, FRAMES_1, + TSE, 1, TEMP_INTERNAL | OFFSET_0, + TCON, 1, 0x22, // tcon setting + CDI, 1, 0b01001100, // vcom and data interval + PLL, 1, HZ_100, // PLL set to 100 Hz + + // Look up tables for voltage sequence for pixel transition + // Common voltage + LUT_VCOM, 44, + 0x00, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x23, 0x23, 0x00, 0x00, 0x02, + 0x00, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + + // White to white + LUT_WW, 42, + 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, + 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Black to white + LUT_BW, 42, + 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, + 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // White to black + LUT_WB, 42, + 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, + 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Black to black + LUT_BB, 42, + 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, + 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +const uint8_t display_stop_sequence[] = { + POF, 0x00 // Power off +}; + void board_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false); + 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_GPIO20, // EPD_DC Command or data + &pin_GPIO17, // EPD_CS Chip select + &pin_GPIO21, // EPD_RST Reset + 1200000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; + display->base.type = &displayio_epaperdisplay_type; + common_hal_displayio_epaperdisplay_construct( + display, + bus, + display_start_sequence, sizeof(display_start_sequence), + display_stop_sequence, sizeof(display_stop_sequence), + 296, // width + 128, // height + 160, // ram_width + 296, // ram_height + 0, // colstart + 0, // rowstart + 270, // rotation + NO_COMMAND, // set_column_window_command + NO_COMMAND, // set_row_window_command + NO_COMMAND, // set_current_column_command + NO_COMMAND, // set_current_row_command + DTM2, // write_black_ram_command + true, // black_bits_inverted + DTM1, // write_color_ram_command + false, // color_bits_inverted + 0x000000, // highlight_color + DRF, // refresh_display_command + 1.0, // refresh_time + &pin_GPIO26, // busy_pin + false, // busy_state + 2.0, // seconds_per_frame + false, // always_toggle_chip_select + false, // grayscale + false); // two_byte_sequence_length } bool board_requests_safe_mode(void) { @@ -37,4 +314,13 @@ void reset_board(void) { } void board_deinit(void) { + displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; + if (display->base.type == &displayio_epaperdisplay_type) { + size_t i = 0; + while (common_hal_displayio_epaperdisplay_get_busy(display)) { + RUN_BACKGROUND_TASKS; + i++; + } + } + common_hal_displayio_release_displays(); } diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_badger2040/mpconfigboard.h index d169395a7d..f73acd1dd6 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/mpconfigboard.h +++ b/ports/raspberrypi/boards/pimoroni_badger2040/mpconfigboard.h @@ -1,2 +1,15 @@ #define MICROPY_HW_BOARD_NAME "Pimoroni Badger 2040" #define MICROPY_HW_MCU_NAME "rp2040" + +// Status LED +#define MICROPY_HW_LED_STATUS (&pin_GPIO25) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) + +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO5) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/pins.c b/ports/raspberrypi/boards/pimoroni_badger2040/pins.c index b2808bb693..ea90853202 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/pins.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040/pins.c @@ -1,5 +1,7 @@ #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -23,7 +25,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_INKY_CS), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_INKY_DC), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_INKY_RST), MP_ROM_PTR(&pin_GPIO21) }, @@ -39,6 +41,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].epaper_display)}, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c b/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c index 2e0ae4def2..51187a3429 100644 --- a/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c @@ -67,9 +67,13 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu common_hal_digitalio_digitalinout_construct(&self->chip_select, chip_select); common_hal_digitalio_digitalinout_switch_to_output(&self->chip_select, true, DRIVE_MODE_PUSH_PULL); - self->read.base.type = &digitalio_digitalinout_type; - common_hal_digitalio_digitalinout_construct(&self->read, read); - common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL); + self->read.base.type = &mp_type_NoneType; + if (read != NULL) { + self->read.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->read, read); + common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL); + never_reset_pin_number(read->number); + } self->data0_pin = data_pin; self->write = write_pin; @@ -86,7 +90,6 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu never_reset_pin_number(command->number); never_reset_pin_number(chip_select->number); never_reset_pin_number(write_pin); - never_reset_pin_number(read->number); for (uint8_t i = 0; i < 8; i++) { never_reset_pin_number(data_pin + i); } @@ -121,8 +124,12 @@ void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_o reset_pin_number(self->command.pin->number); reset_pin_number(self->chip_select.pin->number); reset_pin_number(self->write); - reset_pin_number(self->read.pin->number); - reset_pin_number(self->reset.pin->number); + if (self->read.base.type != &mp_type_NoneType) { + reset_pin_number(self->read.pin->number); + } + if (self->reset.base.type != &mp_type_NoneType) { + reset_pin_number(self->reset.pin->number); + } } bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) { diff --git a/ports/raspberrypi/mphalport.c b/ports/raspberrypi/mphalport.c index 51d82a0514..b4ecbca49d 100644 --- a/ports/raspberrypi/mphalport.c +++ b/ports/raspberrypi/mphalport.c @@ -34,7 +34,6 @@ #include "py/smallint.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/autoreload.h" #include "mpconfigboard.h" #include "mphalport.h" diff --git a/ports/raspberrypi/supervisor/usb.c b/ports/raspberrypi/supervisor/usb.c index 2fc07a20a9..d0e9b2e466 100644 --- a/ports/raspberrypi/supervisor/usb.c +++ b/ports/raspberrypi/supervisor/usb.c @@ -34,6 +34,10 @@ void init_usb_hardware(void) { } +STATIC void _usb_irq_wrapper(void) { + usb_irq_handler(0); +} + void post_usb_init(void) { irq_set_enabled(USBCTRL_IRQ, false); @@ -41,7 +45,7 @@ void post_usb_init(void) { if (usb_handler) { irq_remove_handler(USBCTRL_IRQ, usb_handler); } - irq_set_exclusive_handler(USBCTRL_IRQ, usb_irq_handler); + irq_set_exclusive_handler(USBCTRL_IRQ, _usb_irq_wrapper); irq_set_enabled(USBCTRL_IRQ, true); diff --git a/ports/stm/boards/espruino_pico/mpconfigboard.h b/ports/stm/boards/espruino_pico/mpconfigboard.h index cd5cd23255..9d695abef9 100644 --- a/ports/stm/boards/espruino_pico/mpconfigboard.h +++ b/ports/stm/boards/espruino_pico/mpconfigboard.h @@ -32,7 +32,6 @@ #define FLASH_SIZE (0x60000) #define FLASH_PAGE_SIZE (0x4000) -#define AUTORESET_DELAY_MS (500) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000) #define HSE_VALUE ((uint32_t)8000000) diff --git a/ports/stm/boards/meowbit_v121/mpconfigboard.h b/ports/stm/boards/meowbit_v121/mpconfigboard.h index 7807437941..f0e087e8b0 100644 --- a/ports/stm/boards/meowbit_v121/mpconfigboard.h +++ b/ports/stm/boards/meowbit_v121/mpconfigboard.h @@ -32,7 +32,6 @@ #define FLASH_SIZE (0x80000) #define FLASH_PAGE_SIZE (0x4000) -#define AUTORESET_DELAY_MS 500 #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000) #define HSE_VALUE ((uint32_t)12000000U) diff --git a/ports/stm/boards/nucleo_f746zg/mpconfigboard.h b/ports/stm/boards/nucleo_f746zg/mpconfigboard.h index ef8f84ceba..c4399f5a3d 100644 --- a/ports/stm/boards/nucleo_f746zg/mpconfigboard.h +++ b/ports/stm/boards/nucleo_f746zg/mpconfigboard.h @@ -46,5 +46,5 @@ #define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) // ST boards use the STLink clock signal #define BOARD_HAS_LOW_SPEED_CRYSTAL (1) -#define DEBUG_UART_TX (&pin_PD08) -#define DEBUG_UART_RX (&pin_PD09) +#define CIRCUITPY_DEBUG_UART_TX (&pin_PD08) +#define CIRCUITPY_DEBUG_UART_RX (&pin_PD09) diff --git a/ports/stm/boards/pyb_nano_v2/mpconfigboard.h b/ports/stm/boards/pyb_nano_v2/mpconfigboard.h index f85d27d4b1..4425d1eeec 100644 --- a/ports/stm/boards/pyb_nano_v2/mpconfigboard.h +++ b/ports/stm/boards/pyb_nano_v2/mpconfigboard.h @@ -42,10 +42,6 @@ #define SPI_FLASH_SCK_PIN (&pin_PB13) #define SPI_FLASH_CS_PIN (&pin_PB12) -#define CIRCUITPY_AUTORELOAD_DELAY_MS (500) - #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) -#define AUTORESET_DELAY_MS (500) - #define MICROPY_FATFS_EXFAT 0 diff --git a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h index 400e7bb2c1..4e72668693 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h +++ b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h @@ -45,8 +45,4 @@ #define DEFAULT_I2C_BUS_SCL (&pin_PB06) #define DEFAULT_I2C_BUS_SDA (&pin_PB07) -#define CIRCUITPY_AUTORELOAD_DELAY_MS (500) - #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) - -#define AUTORESET_DELAY_MS (500) diff --git a/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.h index b86bdc1ee7..ef00f95e0e 100644 --- a/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.h +++ b/ports/stm/boards/stm32f411ce_blackpill_with_flash/mpconfigboard.h @@ -45,10 +45,6 @@ #define DEFAULT_I2C_BUS_SCL (&pin_PB06) #define DEFAULT_I2C_BUS_SDA (&pin_PB07) -#define CIRCUITPY_AUTORELOAD_DELAY_MS (500) - #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) -#define AUTORESET_DELAY_MS (500) - #define MICROPY_FATFS_EXFAT 0 diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index a158ade6eb..e4cce571ea 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -346,8 +346,6 @@ void port_enable_tick(void) { stm32_peripherals_rtc_assign_wkup_callback(supervisor_tick); stm32_peripherals_rtc_enable_wakeup_timer(); } -// TODO: what is this? can I get rid of it? -extern volatile uint32_t autoreload_delay_ms; // Disable 1/1024 second tick. void port_disable_tick(void) { diff --git a/ports/stm/supervisor/serial.c b/ports/stm/supervisor/serial.c index ac6f69bbb4..013381e4e3 100644 --- a/ports/stm/supervisor/serial.c +++ b/ports/stm/supervisor/serial.c @@ -28,12 +28,16 @@ #include "py/mphal.h" #include #include "supervisor/serial.h" +#if CPY_STM32F4 #include "stm32f4xx_hal.h" #include "stm32f4/gpio.h" +// TODO: Switch this to using DEBUG_UART. UART_HandleTypeDef huart2; +#endif -void serial_init(void) { +void port_serial_init(void) { + #if CPY_STM32F4 huart2.Instance = USART2; huart2.Init.BaudRate = 115200; huart2.Init.WordLength = UART_WORDLENGTH_8B; @@ -45,29 +49,33 @@ void serial_init(void) { if (HAL_UART_Init(&huart2) == HAL_OK) { stm32f4_peripherals_status_led(1,1); } + #endif } -bool serial_connected(void) { +bool port_serial_connected(void) { return true; } -char serial_read(void) { +char port_serial_read(void) { + #if CPY_STM32F4 uint8_t data; HAL_UART_Receive(&huart2, &data, 1,500); return data; + #else + return -1; + #endif } -bool serial_bytes_available(void) { +bool port_serial_bytes_available(void) { + #if CPY_STM32F4 return __HAL_UART_GET_FLAG(&huart2, UART_FLAG_RXNE); + #else + return false; + #endif } -void serial_write(const char *text) { - serial_write_substring(text, strlen(text)); -} - -void serial_write_substring(const char *text, uint32_t len) { - if (len == 0) { - return; - } +void port_serial_write_substring(const char *text, uint32_t len) { + #if CPY_STM32F4 HAL_UART_Transmit(&huart2, (uint8_t *)text, len, 5000); + #endif } diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index 882f74e8bc..168bacc569 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -149,5 +149,5 @@ void init_usb_hardware(void) { } void OTG_FS_IRQHandler(void) { - usb_irq_handler(); + usb_irq_handler(0); } diff --git a/py/bc.h b/py/bc.h index e901f7bb34..eeccc3412f 100644 --- a/py/bc.h +++ b/py/bc.h @@ -124,6 +124,11 @@ D |= (z & 0x1) << n; \ } \ S += 1; \ + (void)E; \ + (void)F; \ + (void)A; \ + (void)K; \ + (void)D; \ } while (0) #define MP_BC_PRELUDE_SIG_DECODE(ip) \ diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 15828f6616..550396f2ba 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -174,6 +174,10 @@ ifeq ($(CIRCUITPY_FREQUENCYIO),1) SRC_PATTERNS += frequencyio/% endif +ifeq ($(CIRCUITPY_FUTURE),1) +SRC_PATTERNS += __future__/% +endif + ifeq ($(CIRCUITPY_GAMEPADSHIFT),1) SRC_PATTERNS += gamepadshift/% endif @@ -210,6 +214,9 @@ endif ifeq ($(CIRCUITPY_MICROCONTROLLER),1) SRC_PATTERNS += microcontroller/% endif +ifeq ($(CIRCUITPY_MDNS),1) +SRC_PATTERNS += mdns/% +endif ifeq ($(CIRCUITPY_NEOPIXEL_WRITE),1) SRC_PATTERNS += neopixel_write/% endif @@ -312,6 +319,9 @@ endif ifeq ($(CIRCUITPY_USB_HID),1) SRC_PATTERNS += usb_hid/% endif +ifeq ($(CIRCUITPY_USB_HOST),1) +SRC_PATTERNS += usb_host/% usb/% +endif ifeq ($(CIRCUITPY_USB_MIDI),1) SRC_PATTERNS += usb_midi/% endif @@ -394,6 +404,9 @@ SRC_COMMON_HAL_ALL = \ microcontroller/Pin.c \ microcontroller/Processor.c \ microcontroller/__init__.c \ + mdns/__init__.c \ + mdns/Server.c \ + mdns/RemoteService.c \ neopixel_write/__init__.c \ nvm/ByteArray.c \ nvm/__init__.c \ @@ -422,6 +435,8 @@ SRC_COMMON_HAL_ALL = \ ssl/SSLSocket.c \ supervisor/Runtime.c \ supervisor/__init__.c \ + usb_host/__init__.c \ + usb_host/Port.c \ watchdog/WatchDogMode.c \ watchdog/WatchDogTimer.c \ watchdog/__init__.c \ @@ -451,6 +466,7 @@ $(filter $(SRC_PATTERNS), \ _bleio/Attribute.c \ _bleio/ScanEntry.c \ _eve/__init__.c \ + __future__/__init__.c \ camera/ImageFormat.c \ canio/Match.c \ countio/Edge.c \ @@ -577,6 +593,9 @@ SRC_SHARED_MODULE_ALL = \ time/__init__.c \ traceback/__init__.c \ uheap/__init__.c \ + usb/__init__.c \ + usb/core/__init__.c \ + usb/core/Device.c \ ustack/__init__.c \ vectorio/Circle.c \ vectorio/Polygon.c \ @@ -638,6 +657,7 @@ endif SRC_SHARED_MODULE_INTERNAL = \ $(filter $(SRC_PATTERNS), \ displayio/display_core.c \ + usb/utf16le.c \ ) SRC_COMMON_HAL_INTERNAL = \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 5533fe31c5..ec9274464b 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -437,7 +437,7 @@ void supervisor_run_background_tasks_if_tick(void); // CIRCUITPY_AUTORELOAD_DELAY_MS = 0 will completely disable autoreload. #ifndef CIRCUITPY_AUTORELOAD_DELAY_MS -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 +#define CIRCUITPY_AUTORELOAD_DELAY_MS 750 #endif #ifndef CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS @@ -487,6 +487,20 @@ void supervisor_run_background_tasks_if_tick(void); // USB settings +// Debug level for TinyUSB. Only outputs over debug UART so it doesn't cause +// additional USB logging. +#ifndef CIRCUITPY_DEBUG_TINYUSB +#define CIRCUITPY_DEBUG_TINYUSB 0 +#endif + +#ifndef CIRCUITPY_USB_DEVICE_INSTANCE +#define CIRCUITPY_USB_DEVICE_INSTANCE 0 +#endif + +#ifndef CIRCUITPY_USB_HOST_INSTANCE +#define CIRCUITPY_USB_HOST_INSTANCE -1 +#endif + // If the port requires certain USB endpoint numbers, define these in mpconfigport.h. #ifndef USB_CDC_EP_NUM_NOTIFICATION diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index d47b591a5e..87fcc8ff60 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -217,6 +217,9 @@ CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE) CIRCUITPY_FREQUENCYIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_FREQUENCYIO=$(CIRCUITPY_FREQUENCYIO) +CIRCUITPY_FUTURE ?= 1 +CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE) + CIRCUITPY_GAMEPADSHIFT ?= 0 CFLAGS += -DCIRCUITPY_GAMEPADSHIFT=$(CIRCUITPY_GAMEPADSHIFT) @@ -260,6 +263,9 @@ CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR) CIRCUITPY_MICROCONTROLLER ?= 1 CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER) +CIRCUITPY_MDNS ?= $(CIRCUITPY_WIFI) +CFLAGS += -DCIRCUITPY_MDNS=$(CIRCUITPY_MDNS) + CIRCUITPY_MSGPACK ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) @@ -415,6 +421,9 @@ CFLAGS += -DCIRCUITPY_USB_HID=$(CIRCUITPY_USB_HID) CIRCUITPY_USB_HID_ENABLED_DEFAULT ?= $(USB_NUM_ENDPOINT_PAIRS_5_OR_GREATER) CFLAGS += -DCIRCUITPY_USB_HID_ENABLED_DEFAULT=$(CIRCUITPY_USB_HID_ENABLED_DEFAULT) +CIRCUITPY_USB_HOST ?= 0 +CFLAGS += -DCIRCUITPY_USB_HOST=$(CIRCUITPY_USB_HOST) + # MIDI is available by default, but is not turned on if there are fewer than 8 endpoints. CIRCUITPY_USB_MIDI ?= $(CIRCUITPY_USB) CFLAGS += -DCIRCUITPY_USB_MIDI=$(CIRCUITPY_USB_MIDI) diff --git a/py/py.mk b/py/py.mk index 13765dee80..f1864e58b3 100644 --- a/py/py.mk +++ b/py/py.mk @@ -159,7 +159,6 @@ PY_CORE_O_BASENAME = $(addprefix py/,\ objzip.o \ opmethods.o \ proto.o \ - reload.o \ sequence.o \ stream.o \ binary.o \ diff --git a/shared-bindings/__future__/__init__.c b/shared-bindings/__future__/__init__.c new file mode 100644 index 0000000000..ad1bb3b283 --- /dev/null +++ b/shared-bindings/__future__/__init__.c @@ -0,0 +1,60 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Dan Halbert 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 "extmod/vfs.h" +#include "py/mpstate.h" +#include "py/obj.h" +#include "py/objstr.h" +#include "py/runtime.h" +#include "shared-bindings/__future__/__init__.h" + +//| """Language features module +//| +//| The `__future__` module is used by other Python implementations to +//| enable forward compatibility for features enabled by default in an upcoming version. +//| """ +//| +//| annotations: Any +//| """In CPython, ``from __future import annotations`` +//| indicates that evaluation of annotations is postponed, as described in PEP 563. +//| CircuitPython (and MicroPython) ignore annotations entirely, whether or not this feature is imported. +//| This is a limitation of CircuitPython and MicroPython for efficiency reasons. +//| """ + +STATIC const mp_rom_map_elem_t future_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR___future__) }, + + { MP_ROM_QSTR(MP_QSTR_annotations), mp_const_true }, +}; + +STATIC MP_DEFINE_CONST_DICT(future_module_globals, future_module_globals_table); + +const mp_obj_module_t future_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&future_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR___future__, future_module, CIRCUITPY_FUTURE); diff --git a/shared-bindings/__future__/__init__.h b/shared-bindings/__future__/__init__.h new file mode 100644 index 0000000000..c1dd0e192e --- /dev/null +++ b/shared-bindings/__future__/__init__.h @@ -0,0 +1,30 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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___FUTURE_____INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS___FUTURE_____INIT___H + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS___FUTURE_____INIT___H diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 85b6dd0f76..2d532664b9 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -25,7 +25,6 @@ */ #include "py/obj.h" -#include "py/reload.h" #include "py/runtime.h" #include "shared-bindings/alarm/__init__.h" @@ -35,7 +34,6 @@ #include "shared-bindings/alarm/touch/TouchAlarm.h" #include "shared-bindings/supervisor/Runtime.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/autoreload.h" #include "supervisor/shared/workflow.h" //| """Alarms and sleep diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index 077cfd8c97..f165eda202 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -14,14 +14,14 @@ //| """Count the number of rising- and/or falling-edge transitions on a given pin. //| """ //| -//| def __init__(self, pin: microcontroller.Pin, *, edge: Edge = Edge.FALL, pull: Optional[digitalio.Pull]) -> None: +//| def __init__(self, pin: microcontroller.Pin, *, edge: Edge = Edge.FALL, pull: Optional[digitalio.Pull] = None) -> None: //| """Create a Counter object associated with the given pin that counts //| rising- and/or falling-edge transitions. At least one of ``rise`` and ``fall`` must be True. //| The default is to count only falling edges, and is for historical backward compatibility. //| //| :param ~microcontroller.Pin pin: pin to monitor -//| :param Edge: which edge transitions to count -//| :param digitalio.Pull: enable a pull-up or pull-down if not None +//| :param Edge edge: which edge transitions to count +//| :param Optional[digitalio.Pull] pull: enable a pull-up or pull-down if not None //| //| //| For example:: diff --git a/shared-bindings/mdns/RemoteService.c b/shared-bindings/mdns/RemoteService.c new file mode 100644 index 0000000000..ecded5561f --- /dev/null +++ b/shared-bindings/mdns/RemoteService.c @@ -0,0 +1,156 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Dan Halbert for Adafruit Industries + * Copyright (c) 2018 Artur Pacholec + * Copyright (c) 2017 Glenn Ruben Bakke + * + * 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 + +#include "py/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/mdns/RemoteService.h" + +//| class RemoteService: +//| """Encapsulates information about a remote service that was found during a search. This +//| object may only be created by a `mdns.Server`. It has no user-visible constructor.""" +//| + +//| def __init__(self) -> None: +//| """Cannot be instantiated directly. Use `mdns.Server.find`.""" +//| ... +//| + +//| hostname: str +//| """The hostname of the device (read-only),.""" +//| +STATIC mp_obj_t mdns_remoteservice_get_hostname(mp_obj_t self_in) { + mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); + const char *hostname = common_hal_mdns_remoteservice_get_hostname(self); + return mp_obj_new_str(hostname, strlen(hostname)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_hostname_obj, mdns_remoteservice_get_hostname); + +const mp_obj_property_t mdns_remoteservice_hostname_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_remoteservice_get_hostname_obj, + MP_ROM_NONE, + MP_ROM_NONE }, +}; + +//| instance_name: str +//| """The human readable instance name for the service. (read-only)""" +//| +STATIC mp_obj_t remoteservice_get_instance_name(mp_obj_t self_in) { + mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); + const char *instance_name = common_hal_mdns_remoteservice_get_instance_name(self); + return mp_obj_new_str(instance_name, strlen(instance_name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_instance_name_obj, remoteservice_get_instance_name); + +const mp_obj_property_t mdns_remoteservice_instance_name_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_remoteservice_get_instance_name_obj, + MP_ROM_NONE, + MP_ROM_NONE }, +}; + +//| service_type: str +//| """The service type string such as ``_http``. (read-only)""" +//| +STATIC mp_obj_t remoteservice_get_service_type(mp_obj_t self_in) { + mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); + const char *service_type = common_hal_mdns_remoteservice_get_service_type(self); + return mp_obj_new_str(service_type, strlen(service_type)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_service_type_obj, remoteservice_get_service_type); + +const mp_obj_property_t mdns_remoteservice_service_type_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_remoteservice_get_service_type_obj, + MP_ROM_NONE, + MP_ROM_NONE }, +}; + +//| protocol: str +//| """The protocol string such as ``_tcp``. (read-only)""" +//| +STATIC mp_obj_t remoteservice_get_protocol(mp_obj_t self_in) { + mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); + const char *protocol = common_hal_mdns_remoteservice_get_protocol(self); + return mp_obj_new_str(protocol, strlen(protocol)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_protocol_obj, remoteservice_get_protocol); + +const mp_obj_property_t mdns_remoteservice_protocol_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_remoteservice_get_protocol_obj, + MP_ROM_NONE, + MP_ROM_NONE }, +}; + +//| port: int +//| """Port number used for the service. (read-only)""" +//| +STATIC mp_obj_t remoteservice_get_port(mp_obj_t self_in) { + mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_mdns_remoteservice_get_port(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_port_obj, remoteservice_get_port); + +const mp_obj_property_t mdns_remoteservice_port_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_remoteservice_get_port_obj, + MP_ROM_NONE, + MP_ROM_NONE }, +}; + +//| def __del__(self) -> None: +//| """Deletes the RemoteService object.""" +//| ... +//| +STATIC mp_obj_t mdns_remoteservice_obj_deinit(mp_obj_t self_in) { + mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_mdns_remoteservice_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_deinit_obj, mdns_remoteservice_obj_deinit); + +STATIC const mp_rom_map_elem_t mdns_remoteservice_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_hostname), MP_ROM_PTR(&mdns_remoteservice_hostname_obj) }, + { MP_ROM_QSTR(MP_QSTR_instance_name), MP_ROM_PTR(&mdns_remoteservice_instance_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_service_type), MP_ROM_PTR(&mdns_remoteservice_service_type_obj) }, + { MP_ROM_QSTR(MP_QSTR_protocol), MP_ROM_PTR(&mdns_remoteservice_protocol_obj) }, + { MP_ROM_QSTR(MP_QSTR_port), MP_ROM_PTR(&mdns_remoteservice_port_obj) }, + + { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mdns_remoteservice_deinit_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(mdns_remoteservice_locals_dict, mdns_remoteservice_locals_dict_table); + +const mp_obj_type_t mdns_remoteservice_type = { + { &mp_type_type }, + .name = MP_QSTR_RemoteService, + .locals_dict = (mp_obj_dict_t *)&mdns_remoteservice_locals_dict +}; diff --git a/shared-bindings/mdns/RemoteService.h b/shared-bindings/mdns/RemoteService.h new file mode 100644 index 0000000000..f751b683ed --- /dev/null +++ b/shared-bindings/mdns/RemoteService.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Dan Halbert for Adafruit Industries + * Copyright (c) 2018 Artur Pacholec + * Copyright (c) 2017 Glenn Ruben Bakke + * + * 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. + */ + +#pragma once + +#include "py/obj.h" +#include "common-hal/mdns/RemoteService.h" + +extern const mp_obj_type_t mdns_remoteservice_type; + +const char *common_hal_mdns_remoteservice_get_service_type(mdns_remoteservice_obj_t *self); +const char *common_hal_mdns_remoteservice_get_protocol(mdns_remoteservice_obj_t *self); +const char *common_hal_mdns_remoteservice_get_instance_name(mdns_remoteservice_obj_t *self); +const char *common_hal_mdns_remoteservice_get_hostname(mdns_remoteservice_obj_t *self); +mp_int_t common_hal_mdns_remoteservice_get_port(mdns_remoteservice_obj_t *self); +void common_hal_mdns_remoteservice_deinit(mdns_remoteservice_obj_t *self); diff --git a/shared-bindings/mdns/Server.c b/shared-bindings/mdns/Server.c new file mode 100644 index 0000000000..132d218aeb --- /dev/null +++ b/shared-bindings/mdns/Server.c @@ -0,0 +1,214 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * Copyright (c) 2018 Artur Pacholec + * + * 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 + +#include "py/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/mdns/__init__.h" +#include "shared-bindings/mdns/Server.h" +#include "shared-bindings/util.h" + +//| class Server: +//| """The MDNS Server responds to queries for this device's information and allows for querying +//| other devices.""" +//| + +//| def __init__(self, network_interface: wifi.Radio) -> None: +//| """ +//| Constructs or returns the mdns.Server for the given network_interface. (CircuitPython +//| may already be using it.) Only native interfaces are currently supported. +//| """ +//| ... +//| +STATIC mp_obj_t mdns_server_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_network_interface }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_network_interface, MP_ARG_REQUIRED | MP_ARG_OBJ }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mdns_server_obj_t *self = m_new_obj(mdns_server_obj_t); + self->base.type = &mdns_server_type; + common_hal_mdns_server_construct(self, args[ARG_network_interface].u_obj); + + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Stops the server""" +//| ... +//| +STATIC mp_obj_t mdns_server_obj_deinit(mp_obj_t self_in) { + mdns_server_obj_t *self = (mdns_server_obj_t *)self_in; + common_hal_mdns_server_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_server_deinit_obj, mdns_server_obj_deinit); + +STATIC void check_for_deinit(mdns_server_obj_t *self) { + if (common_hal_mdns_server_deinited(self)) { + raise_deinited_error(); + } +} + +//| +//| hostname: str +//| """Hostname resolvable as ``.local`` in addition to ``circuitpython.local``. Make +//| sure this is unique across all devices on the network. It defaults to ``cpy-######`` +//| where ``######`` is the hex digits of the last three bytes of the mac address.""" +//| +STATIC mp_obj_t mdns_server_get_hostname(mp_obj_t self) { + check_for_deinit(self); + const char *hostname = common_hal_mdns_server_get_hostname(self); + return mp_obj_new_str(hostname, strlen(hostname)); +} +MP_DEFINE_CONST_FUN_OBJ_1(mdns_server_get_hostname_obj, mdns_server_get_hostname); + +static mp_obj_t mdns_server_set_hostname(mp_obj_t self, mp_obj_t hostname) { + check_for_deinit(self); + common_hal_mdns_server_set_hostname(self, mp_obj_str_get_str(hostname)); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mdns_server_set_hostname_obj, mdns_server_set_hostname); + +const mp_obj_property_t mdns_server_hostname_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_server_get_hostname_obj, + (mp_obj_t)&mdns_server_set_hostname_obj, + MP_ROM_NONE }, +}; + +//| instance_name: str +//| """Human readable name to describe the device.""" +//| +STATIC mp_obj_t mdns_server_get_instance_name(mp_obj_t self) { + check_for_deinit(self); + const char *instance_name = common_hal_mdns_server_get_instance_name(self); + return mp_obj_new_str(instance_name, strlen(instance_name)); +} +MP_DEFINE_CONST_FUN_OBJ_1(mdns_server_get_instance_name_obj, mdns_server_get_instance_name); + +STATIC mp_obj_t mdns_server_set_instance_name(mp_obj_t self, mp_obj_t new_instance_name) { + check_for_deinit(self); + common_hal_mdns_server_set_instance_name(self, mp_obj_str_get_str(new_instance_name)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mdns_server_set_instance_name_obj, mdns_server_set_instance_name); + +const mp_obj_property_t mdns_server_instance_name_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&mdns_server_get_instance_name_obj, + (mp_obj_t)&mdns_server_set_instance_name_obj, + MP_ROM_NONE }, +}; + + +//| def find(self, service_type: str, protocol: str, *, timeout: float = 1) -> Tuple[RemoteService]: +//| """Find all locally available remote services with the given service type and protocol. +//| +//| This doesn't allow for direct hostname lookup. To do that, use +//| `socketpool.SocketPool.getaddrinfo()`. +//| +//| :param str service_type: The service type such as "_http" +//| :param str protocol: The service protocol such as "_tcp" +//| :param float/int timeout: Time to wait for responses""" +//| ... +//| +STATIC mp_obj_t mdns_server_find(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mdns_server_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_service_type, ARG_protocol, ARG_timeout }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_service_type, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_protocol, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj); + const char *service_type = mp_obj_str_get_str(args[ARG_service_type].u_obj); + const char *protocol = mp_obj_str_get_str(args[ARG_protocol].u_obj); + + return common_hal_mdns_server_find(self, service_type, protocol, timeout); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_find_obj, 1, mdns_server_find); + +//| def advertise_service(self, *, service_type: str, protocol: str, port: int) -> None: +//| """Respond to queries for the given service with the given port. +//| +//| :param str service_type: The service type such as "_http" +//| :param str protocol: The service protocol such as "_tcp" +//| :param int port: The port used by the service""" +//| ... +//| +STATIC mp_obj_t mdns_server_advertise_service(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mdns_server_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_service_type, ARG_protocol, ARG_port }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_service_type, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_protocol, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_port, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const char *service_type = mp_obj_str_get_str(args[ARG_service_type].u_obj); + const char *protocol = mp_obj_str_get_str(args[ARG_protocol].u_obj); + + common_hal_mdns_server_advertise_service(self, service_type, protocol, args[ARG_port].u_int); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_advertise_service_obj, 1, mdns_server_advertise_service); + +STATIC const mp_rom_map_elem_t mdns_server_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_hostname), MP_ROM_PTR(&mdns_server_hostname_obj) }, + { MP_ROM_QSTR(MP_QSTR_instance_name), MP_ROM_PTR(&mdns_server_instance_name_obj) }, + + { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&mdns_server_find_obj) }, + { MP_ROM_QSTR(MP_QSTR_advertise_service), MP_ROM_PTR(&mdns_server_advertise_service_obj) }, + + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&mdns_server_deinit_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(mdns_server_locals_dict, mdns_server_locals_dict_table); + +const mp_obj_type_t mdns_server_type = { + .base = { &mp_type_type }, + .name = MP_QSTR_Server, + .make_new = mdns_server_make_new, + .locals_dict = (mp_obj_t)&mdns_server_locals_dict, +}; diff --git a/shared-bindings/mdns/Server.h b/shared-bindings/mdns/Server.h new file mode 100644 index 0000000000..a178e9bd2d --- /dev/null +++ b/shared-bindings/mdns/Server.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include + +#include "common-hal/mdns/Server.h" + +extern const mp_obj_type_t mdns_server_type; + +void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_interface); +void common_hal_mdns_server_deinit(mdns_server_obj_t *self); +bool common_hal_mdns_server_deinited(mdns_server_obj_t *self); +const char *common_hal_mdns_server_get_hostname(mdns_server_obj_t *self); +void common_hal_mdns_server_set_hostname(mdns_server_obj_t *self, const char *hostname); +const char *common_hal_mdns_server_get_instance_name(mdns_server_obj_t *self); +void common_hal_mdns_server_set_instance_name(mdns_server_obj_t *self, const char *instance_name); +mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_float_t timeout); +void common_hal_mdns_server_advertise_service(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_int_t port); diff --git a/shared-bindings/mdns/__init__.c b/shared-bindings/mdns/__init__.c new file mode 100644 index 0000000000..9752a3b7ff --- /dev/null +++ b/shared-bindings/mdns/__init__.c @@ -0,0 +1,56 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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 + +#include "py/objexcept.h" +#include "py/runtime.h" +#include "shared-bindings/mdns/__init__.h" +#include "shared-bindings/mdns/Server.h" +#include "shared-bindings/mdns/RemoteService.h" + +//| """Multicast Domain Name Service +//| +//| The `mdns` module provides basic support for multicast domain name services. +//| Basic use provides hostname resolution under the .local TLD. This module +//| also supports DNS Service Discovery that allows for discovering other hosts +//| that provide a desired service.""" +//| + +STATIC const mp_rom_map_elem_t mdns_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_mdns) }, + { MP_ROM_QSTR(MP_QSTR_Server), MP_ROM_PTR(&mdns_server_type) }, + { MP_ROM_QSTR(MP_QSTR_RemoteService), MP_ROM_PTR(&mdns_remoteservice_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(mdns_module_globals, mdns_module_globals_table); + +const mp_obj_module_t mdns_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&mdns_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_mdns, mdns_module, CIRCUITPY_MDNS); diff --git a/py/reload.c b/shared-bindings/mdns/__init__.h similarity index 62% rename from py/reload.c rename to shared-bindings/mdns/__init__.h index 996826b930..d6722851c7 100644 --- a/py/reload.c +++ b/shared-bindings/mdns/__init__.h @@ -3,7 +3,13 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 by Roy Hooper + * Copyright (c) 2022 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 @@ -18,15 +24,4 @@ * THE SOFTWARE. */ -#include "reload.h" -#include "py/mpstate.h" - -void mp_raise_reload_exception(void) { - MP_STATE_THREAD(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)); - #if MICROPY_ENABLE_SCHEDULER - if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { - MP_STATE_VM(sched_state) = MP_SCHED_PENDING; - } - #endif - -} +#pragma once diff --git a/shared-bindings/paralleldisplay/ParallelBus.c b/shared-bindings/paralleldisplay/ParallelBus.c index be69ce1f95..6e6e778259 100644 --- a/shared-bindings/paralleldisplay/ParallelBus.c +++ b/shared-bindings/paralleldisplay/ParallelBus.c @@ -42,7 +42,7 @@ //| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle //| display initialization.""" //| -//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin, frequency: int = 30_000_000) -> None: +//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: Optional[microcontroller.Pin], reset: Optional[microcontroller.Pin] = None, frequency: int = 30_000_000) -> None: //| """Create a ParallelBus object associated with the given pins. The bus is inferred from data0 //| by implying the next 7 additional pins on a given GPIO port. //| @@ -56,8 +56,8 @@ //| :param microcontroller.Pin command: Data or command pin //| :param microcontroller.Pin chip_select: Chip select pin //| :param microcontroller.Pin write: Write pin -//| :param microcontroller.Pin read: Read pin -//| :param microcontroller.Pin reset: Reset pin +//| :param microcontroller.Pin read: Read pin, optional +//| :param microcontroller.Pin reset: Reset pin, optional //| :param int frequency: The communication frequency in Hz for the display on the bus""" //| ... //| @@ -69,8 +69,8 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, { MP_QSTR_command, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_chip_select, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_write, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_read, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_reset, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_read, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, + { MP_QSTR_reset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, { MP_QSTR_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 30000000 } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; @@ -79,8 +79,8 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, const mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj); const mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj); const mcu_pin_obj_t *write = validate_obj_is_free_pin(args[ARG_write].u_obj); - const mcu_pin_obj_t *read = validate_obj_is_free_pin(args[ARG_read].u_obj); - const mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj); + const mcu_pin_obj_t *read = validate_obj_is_free_pin_or_none(args[ARG_read].u_obj); + const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj); paralleldisplay_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus; self->base.type = ¶lleldisplay_parallelbus_type; diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index f427c759a4..447d2d7d78 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -91,13 +91,13 @@ STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_ } MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_socket_obj, 1, socketpool_socketpool_socket); -//| def getaddrinfo(host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> Tuple[int, int, int, str, Tuple[str, int]]: -//| """Gets the address information for a hostname and port +//| def getaddrinfo(self, host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> Tuple[int, int, int, str, Tuple[str, int]]: +//| """Gets the address information for a hostname and port //| -//| Returns the appropriate family, socket type, socket protocol and -//| address information to call socket.socket() and socket.connect() with, -//| as a tuple.""" -//| ... +//| Returns the appropriate family, socket type, socket protocol and +//| address information to call socket.socket() and socket.connect() with, +//| as a tuple.""" +//| ... //| STATIC mp_obj_t socketpool_socketpool_getaddrinfo(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_host, ARG_port, ARG_family, ARG_type, ARG_proto, ARG_flags }; diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 1ed11a2ec5..08d68ec93f 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -108,6 +108,14 @@ const mp_obj_property_t supervisor_runtime_serial_bytes_available_obj = { MP_ROM_NONE}, }; +supervisor_run_reason_t supervisor_get_run_reason(void) { + return _run_reason; +} + +void supervisor_set_run_reason(supervisor_run_reason_t run_reason) { + _run_reason = run_reason; +} + //| run_reason: RunReason //| """Returns why CircuitPython started running this particular time.""" //| @@ -123,10 +131,6 @@ const mp_obj_property_t supervisor_runtime_run_reason_obj = { MP_ROM_NONE}, }; -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_usb_connected), MP_ROM_PTR(&supervisor_runtime_usb_connected_obj) }, { MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_runtime_serial_connected_obj) }, diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h index 3a94a8fd5d..debc5ec79c 100644 --- a/shared-bindings/supervisor/Runtime.h +++ b/shared-bindings/supervisor/Runtime.h @@ -34,6 +34,7 @@ extern const mp_obj_type_t supervisor_runtime_type; +supervisor_run_reason_t supervisor_get_run_reason(void); void supervisor_set_run_reason(supervisor_run_reason_t run_reason); bool common_hal_supervisor_runtime_get_serial_connected(void); diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index c69f0e4174..0b86b7b2a6 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -27,14 +27,13 @@ #include "py/obj.h" #include "py/runtime.h" -#include "py/reload.h" #include "py/objstr.h" #include "shared/runtime/interrupt_char.h" -#include "supervisor/shared/autoreload.h" #include "supervisor/shared/bluetooth/bluetooth.h" #include "supervisor/shared/display.h" #include "supervisor/shared/status_leds.h" +#include "supervisor/shared/reload.h" #include "supervisor/shared/stack.h" #include "supervisor/shared/traceback.h" #include "supervisor/shared/translate.h" @@ -95,9 +94,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_s //| ... //| STATIC mp_obj_t supervisor_reload(void) { - reload_requested = true; - supervisor_set_run_reason(RUN_REASON_SUPERVISOR_RELOAD); - mp_raise_reload_exception(); + reload_initiate(RUN_REASON_SUPERVISOR_RELOAD); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload); diff --git a/shared-bindings/usb/__init__.c b/shared-bindings/usb/__init__.c new file mode 100644 index 0000000000..bae72da1f7 --- /dev/null +++ b/shared-bindings/usb/__init__.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "py/obj.h" +#include "py/mphal.h" +#include "py/runtime.h" + +#include "shared-bindings/usb/__init__.h" +#include "shared-bindings/usb/core/__init__.h" + +//| """PyUSB-compatible USB host API +//| +//| The `usb` is a subset of PyUSB that allows you to communicate to USB devices. +//| """ +//| + +STATIC mp_rom_map_elem_t usb_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb) }, + { MP_ROM_QSTR(MP_QSTR_core), MP_OBJ_FROM_PTR(&usb_core_module) }, +}; + +STATIC MP_DEFINE_CONST_DICT(usb_module_globals, usb_module_globals_table); + +const mp_obj_module_t usb_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&usb_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_usb, usb_module, CIRCUITPY_USB_HOST); diff --git a/py/reload.h b/shared-bindings/usb/__init__.h similarity index 62% rename from py/reload.h rename to shared-bindings/usb/__init__.h index 8e68ea3253..d6722851c7 100644 --- a/py/reload.h +++ b/shared-bindings/usb/__init__.h @@ -3,7 +3,13 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 by Roy Hooper + * Copyright (c) 2022 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 @@ -18,9 +24,4 @@ * THE SOFTWARE. */ -#ifndef CIRCUITPYTHON_RELOAD_H -#define CIRCUITPYTHON_RELOAD_H - -void mp_raise_reload_exception(void); - -#endif // CIRCUITPYTHON_RELOAD_H +#pragma once diff --git a/shared-bindings/usb/core/Device.c b/shared-bindings/usb/core/Device.c new file mode 100644 index 0000000000..6828a6b6f7 --- /dev/null +++ b/shared-bindings/usb/core/Device.c @@ -0,0 +1,332 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +// This file uses method signatures and comments derived from the PyUSB code +// that has the below BSD-3 license. +/* Copyright 2009-2017 Wander Lairson Costa + * Copyright 2009-2021 PyUSB contributors + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "py/objproperty.h" +#include "shared-bindings/usb/core/Device.h" +#include "py/runtime.h" + +//| class Device: +//| +//| def __init__(self) -> None: +//| """User code cannot create Device objects. Instead, get them from +//| `usb.core.find`. +//| """ +//| ... +//| + +//| idVendor: int +//| """The USB vendor ID of the device""" +//| +STATIC mp_obj_t usb_core_device_obj_get_idVendor(mp_obj_t self_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_usb_core_device_get_idVendor(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_idVendor_obj, usb_core_device_obj_get_idVendor); + +const mp_obj_property_t usb_core_device_idVendor_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&usb_core_device_get_idVendor_obj, + MP_ROM_NONE, + MP_ROM_NONE}, +}; + +//| idProduct: int +//| """The USB product ID of the device""" +//| +STATIC mp_obj_t usb_core_device_obj_get_idProduct(mp_obj_t self_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_usb_core_device_get_idProduct(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_idProduct_obj, usb_core_device_obj_get_idProduct); + +const mp_obj_property_t usb_core_device_idProduct_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&usb_core_device_get_idProduct_obj, + MP_ROM_NONE, + MP_ROM_NONE}, +}; + +//| serial_number: str +//| """The USB device's serial number string.""" +//| +STATIC mp_obj_t usb_core_device_obj_get_serial_number(mp_obj_t self_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_usb_core_device_get_serial_number(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_serial_number_obj, usb_core_device_obj_get_serial_number); + +const mp_obj_property_t usb_core_device_serial_number_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&usb_core_device_get_serial_number_obj, + MP_ROM_NONE, + MP_ROM_NONE}, +}; + +//| product: str +//| """The USB device's product string.""" +//| +STATIC mp_obj_t usb_core_device_obj_get_product(mp_obj_t self_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_usb_core_device_get_product(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_product_obj, usb_core_device_obj_get_product); + +const mp_obj_property_t usb_core_device_product_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&usb_core_device_get_product_obj, + MP_ROM_NONE, + MP_ROM_NONE}, +}; + +//| manufacturer: str +//| """The USB device's manufacturer string.""" +//| +STATIC mp_obj_t usb_core_device_obj_get_manufacturer(mp_obj_t self_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_usb_core_device_get_manufacturer(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_manufacturer_obj, usb_core_device_obj_get_manufacturer); + +const mp_obj_property_t usb_core_device_manufacturer_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&usb_core_device_get_manufacturer_obj, + MP_ROM_NONE, + MP_ROM_NONE}, +}; + +//| def write(self, endpoint: int, data: ReadableBuffer, timeout = None) -> int: +//| """Write data to a specific endpoint on the device. +//| +//| :param int endpoint: the bEndpointAddress you want to communicate with. +//| :param ReadableBuffer data: the data to send +//| :param int timeout: Time to wait specified in milliseconds. (Different from most CircuitPython!) +//| :returns: the number of bytes written +//| """ +//| ... +//| +STATIC mp_obj_t usb_core_device_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_endpoint, ARG_data, ARG_timeout }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_endpoint, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_timeout, MP_ARG_INT, {.u_int = 0} }, + }; + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_data].u_obj, &bufinfo, MP_BUFFER_READ); + + return MP_OBJ_NEW_SMALL_INT(common_hal_usb_core_device_write(self, args[ARG_endpoint].u_int, bufinfo.buf, bufinfo.len, args[ARG_timeout].u_int)); +} +MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_write_obj, 2, usb_core_device_write); + + +//| def read(self, endpoint: int, size_or_buffer: array.array, timeout = None) -> int: +//| """Read data from the endpoint. +//| +//| :param int endpoint: the bEndpointAddress you want to communicate with. +//| :param array.array size_or_buffer: the array to read data into. PyUSB also allows size but CircuitPython only support array to force deliberate memory use. +//| :param int timeout: Time to wait specified in milliseconds. (Different from most CircuitPython!) +//| :returns: the number of bytes read +//| """ +//| ... +STATIC mp_obj_t usb_core_device_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_endpoint, ARG_size_or_buffer, ARG_timeout }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_endpoint, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_size_or_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_timeout, MP_ARG_INT, {.u_int = 0} }, + }; + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_size_or_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); + + return MP_OBJ_NEW_SMALL_INT(common_hal_usb_core_device_read(self, args[ARG_endpoint].u_int, bufinfo.buf, bufinfo.len, args[ARG_timeout].u_int)); +} +MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_read_obj, 2, usb_core_device_read); + +//| def ctrl_transfer(self, bmRequestType, bRequest, wValue=0, wIndex=0, +//| data_or_wLength: array.array = None, timeout = None) -> int: +//| """Do a control transfer on the endpoint 0. The parameters bmRequestType, +//| bRequest, wValue and wIndex are the same of the USB Standard Control +//| Request format. +//| +//| Control requests may or may not have a data payload to write/read. +//| In cases which it has, the direction bit of the bmRequestType +//| field is used to infer the desired request direction. +//| +//| For host to device requests (OUT), data_or_wLength parameter is +//| the data payload to send, and it must be a sequence type convertible +//| to an array object. In this case, the return value is the number +//| of bytes written in the data payload. +//| +//| For device to host requests (IN), data_or_wLength is an array +//| object which the data will be read to, and the return value is the +//| number of bytes read. +//| """ +//| ... +//| +STATIC mp_obj_t usb_core_device_ctrl_transfer(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_bmRequestType, ARG_bRequest, ARG_wValue, ARG_wIndex, ARG_data_or_wLength, ARG_timeout }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_bmRequestType, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_bRequest, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_wValue, MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_wIndex, MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_data_or_wLength, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_timeout, MP_ARG_INT, {.u_int = 0} }, + }; + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_buffer_info_t bufinfo; + // check request type + if ((args[ARG_bmRequestType].u_int & 0x80) != 0) { + mp_get_buffer_raise(args[ARG_data_or_wLength].u_obj, &bufinfo, MP_BUFFER_WRITE); + } else { + mp_get_buffer_raise(args[ARG_data_or_wLength].u_obj, &bufinfo, MP_BUFFER_READ); + } + + mp_int_t result = common_hal_usb_core_device_ctrl_transfer(self, + args[ARG_bmRequestType].u_int, args[ARG_bRequest].u_int, + args[ARG_wValue].u_int, args[ARG_wIndex].u_int, + bufinfo.buf, bufinfo.len, args[ARG_timeout].u_int); + + return MP_OBJ_NEW_SMALL_INT(result); +} +MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_ctrl_transfer_obj, 2, usb_core_device_ctrl_transfer); + +//| def is_kernel_driver_active(self, interface: int) -> bool: +//| """Determine if CircuitPython is using the interface. If it is, the +//| object will be unable to perform I/O. +//| +//| :param int interface: the device interface number to check +//| """ +//| ... +//| +STATIC mp_obj_t usb_core_device_is_kernel_driver_active(mp_obj_t self_in, mp_obj_t interface_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_int_t interface = mp_obj_get_int(interface_in); + bool active = common_hal_usb_core_device_is_kernel_driver_active(self, interface); + return mp_obj_new_bool(active); +} +MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_is_kernel_driver_active_obj, usb_core_device_is_kernel_driver_active); + +//| def detach_kernel_driver(self, interface: int): +//| """Stop CircuitPython from using the interface. If successful, you +//| will then be able to perform I/O. CircuitPython will automatically +//| re-start using the interface on reload. +//| +//| :param int interface: the device interface number to stop CircuitPython on +//| """ +//| ... +//| +STATIC mp_obj_t usb_core_device_detach_kernel_driver(mp_obj_t self_in, mp_obj_t interface_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_int_t interface = mp_obj_get_int(interface_in); + common_hal_usb_core_device_detach_kernel_driver(self, interface); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_detach_kernel_driver_obj, usb_core_device_detach_kernel_driver); + +//| def attach_kernel_driver(self, interface: int): +//| """Allow CircuitPython to use the interface if it wants to. +//| +//| :param int interface: the device interface number to allow CircuitPython to use +//| """ +//| ... +//| +STATIC mp_obj_t usb_core_device_attach_kernel_driver(mp_obj_t self_in, mp_obj_t interface_in) { + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_int_t interface = mp_obj_get_int(interface_in); + common_hal_usb_core_device_attach_kernel_driver(self, interface); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_attach_kernel_driver_obj, usb_core_device_attach_kernel_driver); + + +STATIC const mp_rom_map_elem_t usb_core_device_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_idVendor), MP_ROM_PTR(&usb_core_device_idVendor_obj) }, + { MP_ROM_QSTR(MP_QSTR_idProduct), MP_ROM_PTR(&usb_core_device_idProduct_obj) }, + { MP_ROM_QSTR(MP_QSTR_serial_number), MP_ROM_PTR(&usb_core_device_serial_number_obj) }, + { MP_ROM_QSTR(MP_QSTR_product), MP_ROM_PTR(&usb_core_device_product_obj) }, + { MP_ROM_QSTR(MP_QSTR_manufacturer), MP_ROM_PTR(&usb_core_device_manufacturer_obj) }, + + { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&usb_core_device_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&usb_core_device_read_obj) }, + { MP_ROM_QSTR(MP_QSTR_ctrl_transfer), MP_ROM_PTR(&usb_core_device_ctrl_transfer_obj) }, + + { MP_ROM_QSTR(MP_QSTR_is_kernel_driver_active), MP_ROM_PTR(&usb_core_device_is_kernel_driver_active_obj) }, + { MP_ROM_QSTR(MP_QSTR_detach_kernel_driver), MP_ROM_PTR(&usb_core_device_detach_kernel_driver_obj) }, + { MP_ROM_QSTR(MP_QSTR_attach_kernel_driver), MP_ROM_PTR(&usb_core_device_attach_kernel_driver_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(usb_core_device_locals_dict, usb_core_device_locals_dict_table); + +const mp_obj_type_t usb_core_device_type = { + { &mp_type_type }, + .name = MP_QSTR_Device, + .locals_dict = (mp_obj_t)&usb_core_device_locals_dict, +}; diff --git a/shared-bindings/usb/core/Device.h b/shared-bindings/usb/core/Device.h new file mode 100644 index 0000000000..c7086e99ff --- /dev/null +++ b/shared-bindings/usb/core/Device.h @@ -0,0 +1,53 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_USB_CORE_DEVICE_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_USB_CORE_DEVICE_H + +#include "py/objarray.h" + +#include "shared-module/usb/core/Device.h" + +extern const mp_obj_type_t usb_core_device_type; + +bool common_hal_usb_core_device_construct(usb_core_device_obj_t *self, uint8_t device_number); +uint16_t common_hal_usb_core_device_get_idVendor(usb_core_device_obj_t *self); +uint16_t common_hal_usb_core_device_get_idProduct(usb_core_device_obj_t *self); +mp_obj_t common_hal_usb_core_device_get_serial_number(usb_core_device_obj_t *self); +mp_obj_t common_hal_usb_core_device_get_product(usb_core_device_obj_t *self); +mp_obj_t common_hal_usb_core_device_get_manufacturer(usb_core_device_obj_t *self); +mp_obj_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t endpoint, const uint8_t *buffer, mp_int_t len, mp_int_t timeout); +mp_obj_t common_hal_usb_core_device_read(usb_core_device_obj_t *self, mp_int_t endpoint, uint8_t *buffer, mp_int_t len, mp_int_t timeout); +mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, + mp_int_t bmRequestType, mp_int_t bRequest, + mp_int_t wValue, mp_int_t wIndex, + uint8_t *buffer, mp_int_t len, mp_int_t timeout); + +bool common_hal_usb_core_device_is_kernel_driver_active(usb_core_device_obj_t *self, mp_int_t interface); +void common_hal_usb_core_device_detach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface); +void common_hal_usb_core_device_attach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_USB_CORE_DEVICE_H diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c new file mode 100644 index 0000000000..0e0d409ede --- /dev/null +++ b/shared-bindings/usb/core/__init__.c @@ -0,0 +1,193 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 +#include + +#include "py/obj.h" +#include "py/objexcept.h" +#include "py/misc.h" +#include "py/mphal.h" +#include "py/runtime.h" + +#include "shared-bindings/usb/core/__init__.h" +#include "shared-bindings/usb/core/Device.h" + +//| """USB Core +//| +//| This is a subset of the PyUSB core module. +//| """ +//| + +//| class USBError(OSError): +//| """Catchall exception for USB related errors.""" +//| ... +MP_DEFINE_USB_CORE_EXCEPTION(USBError, OSError) +NORETURN void mp_raise_usb_core_USBError(const compressed_string_t *fmt, ...) { + va_list argptr; + va_start(argptr,fmt); + mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_usb_core_USBError, fmt, argptr); + va_end(argptr); + nlr_raise(exception); +} + +//| class USBTimeoutError(USBError): +//| """Raised when a USB transfer times out.""" +//| ... +//| +MP_DEFINE_USB_CORE_EXCEPTION(USBTimeoutError, usb_core_USBError) +NORETURN void mp_raise_usb_core_USBTimeoutError(void) { + mp_raise_type(&mp_type_usb_core_USBTimeoutError); +} + + +//| def find(find_all=False, *, idVendor=None, idProduct=None): +//| """Find the first device that matches the given requirements or, if +//| find_all is True, return a generator of all matching devices. +//| +//| Returns None if no device matches. +//| """ +//| +typedef struct { + mp_obj_base_t base; + mp_int_t vid; + mp_int_t pid; + mp_int_t next_index; +} usb_core_devices_obj_t; + +// This is an internal iterator type to use with find. +STATIC mp_obj_t _next_device(usb_core_devices_obj_t *iter) { + // Brute force check all possible device numbers for one that matches. + usb_core_device_obj_t temp_device; + for (size_t i = iter->next_index; i < 256; i++) { + if (!common_hal_usb_core_device_construct(&temp_device, i)) { + continue; + } + if (iter->vid < 0x10000 && iter->vid != common_hal_usb_core_device_get_idVendor(&temp_device)) { + continue; + } + if (iter->pid < 0x10000 && iter->pid != common_hal_usb_core_device_get_idProduct(&temp_device)) { + continue; + } + + // We passed the filters. Now make a properly allocated object to + // return to the user. + usb_core_device_obj_t *self = m_new_obj(usb_core_device_obj_t); + self->base.type = &usb_core_device_type; + + common_hal_usb_core_device_construct(self, i); + iter->next_index = i + 1; + return MP_OBJ_FROM_PTR(self); + } + // Iter is done. + iter->next_index = 256; + return mp_const_none; +} + +STATIC mp_obj_t usb_core_devices_iternext(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &usb_core_devices_type)); + usb_core_devices_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_obj_t device = _next_device(self); + if (device != mp_const_none) { + return device; + } + return MP_OBJ_STOP_ITERATION; +} + +const mp_obj_type_t usb_core_devices_type = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_USBDevices, + MP_TYPE_EXTENDED_FIELDS( + .getiter = mp_identity_getiter, + .iternext = usb_core_devices_iternext, + ), +}; + +STATIC mp_obj_t usb_core_find(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_find_all, ARG_idVendor, ARG_idProduct }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_find_all, MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_idVendor, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_idProduct, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const bool find_all = args[ARG_find_all].u_bool; + usb_core_devices_obj_t temp_iter; + temp_iter.base.type = &usb_core_devices_type; + temp_iter.next_index = 1; + if (!mp_obj_get_int_maybe(args[ARG_idVendor].u_obj, &temp_iter.vid)) { + temp_iter.vid = 0x10000; + } + if (!mp_obj_get_int_maybe(args[ARG_idProduct].u_obj, &temp_iter.pid)) { + temp_iter.pid = 0x10000; + } + if (find_all) { + // Copy the temp iter contents to a heap object before we return it. + // We could do this up front but GCC falsely detects that we may return + // the stack copy. + usb_core_devices_obj_t *iter = m_new_obj(usb_core_devices_obj_t); + memcpy(iter, &temp_iter, sizeof(usb_core_devices_obj_t)); + return MP_OBJ_FROM_PTR(iter); + } + return _next_device(&temp_iter); +} +MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_find_obj, 0, usb_core_find); + + +STATIC mp_rom_map_elem_t usb_core_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb_dot_core) }, + // Functions + { MP_ROM_QSTR(MP_QSTR_find), MP_OBJ_FROM_PTR(&usb_core_find_obj) }, + + // Classes + { MP_ROM_QSTR(MP_QSTR_Device), MP_OBJ_FROM_PTR(&usb_core_device_type) }, + + // Errors + { MP_ROM_QSTR(MP_QSTR_USBError), MP_OBJ_FROM_PTR(&mp_type_usb_core_USBError) }, + { MP_ROM_QSTR(MP_QSTR_USBTimeoutError), MP_OBJ_FROM_PTR(&mp_type_usb_core_USBTimeoutError) }, +}; + +STATIC MP_DEFINE_CONST_DICT(usb_core_module_globals, usb_core_module_globals_table); + +void usb_core_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { + mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS; + bool is_subclass = kind & PRINT_EXC_SUBCLASS; + if (!is_subclass && (k == PRINT_EXC)) { + mp_print_str(print, qstr_str(MP_OBJ_QSTR_VALUE(usb_core_module_globals_table[0].value))); + mp_print_str(print, "."); + } + mp_obj_exception_print(print, o_in, kind); +} + +const mp_obj_module_t usb_core_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&usb_core_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_usb_dot_core, usb_core_module, CIRCUITPY_USB_HOST); diff --git a/shared-bindings/usb/core/__init__.h b/shared-bindings/usb/core/__init__.h new file mode 100644 index 0000000000..2067c4cd18 --- /dev/null +++ b/shared-bindings/usb/core/__init__.h @@ -0,0 +1,54 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include + +#include "py/obj.h" + +extern const mp_obj_module_t usb_core_module; + +void usb_core_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); + +#define MP_DEFINE_USB_CORE_EXCEPTION(exc_name, base_name) \ + const mp_obj_type_t mp_type_usb_core_##exc_name = { \ + { &mp_type_type }, \ + .name = MP_QSTR_##exc_name, \ + .print = usb_core_exception_print, \ + .make_new = mp_obj_exception_make_new, \ + .attr = mp_obj_exception_attr, \ + .parent = &mp_type_##base_name, \ + }; + +extern const mp_obj_type_t mp_type_usb_core_USBError; +extern const mp_obj_type_t mp_type_usb_core_USBTimeoutError; + +NORETURN void mp_raise_usb_core_USBError(const compressed_string_t *fmt, ...); +NORETURN void mp_raise_usb_core_USBTimeoutError(void); + +// Find is all Python object oriented so we don't need a separate common-hal API +// for it. It uses the device common-hal instead. diff --git a/shared-bindings/usb_host/Port.c b/shared-bindings/usb_host/Port.c new file mode 100644 index 0000000000..8f54246584 --- /dev/null +++ b/shared-bindings/usb_host/Port.c @@ -0,0 +1,103 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared/runtime/context_manager_helpers.h" +#include "shared-bindings/usb_host/Port.h" +#include "shared-bindings/util.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +//| class Port: +//| """USB host port. Also known as a root hub port.""" +//| +//| def __init__(self, dp: microcontroller.Pin, dm: microcontroller.Pin) -> None: +//| """Create a USB host port on the given pins. Access attached devices +//| through the `usb` module. Keep this object referenced while +//| interacting with devices, otherwise they will be disconnected. +//| +//| :param ~microcontroller.Pin dp: The data plus pin +//| :param ~microcontroller.Pin dm: The data minus pin +//| """ +//| ... +//| +STATIC mp_obj_t usb_host_port_make_new(const mp_obj_type_t *type, + size_t n_args, size_t n_kw, const mp_obj_t *args) { + // check number of arguments + mp_arg_check_num(n_args, n_kw, 2, 2, false); + + const mcu_pin_obj_t *dp = validate_obj_is_free_pin(args[0]); + const mcu_pin_obj_t *dm = validate_obj_is_free_pin(args[1]); + + usb_host_port_obj_t *self = m_new_obj(usb_host_port_obj_t); + self->base.type = &usb_host_port_type; + common_hal_usb_host_port_construct(self, dp, dm); + + return (mp_obj_t)self; +} + +//| def deinit(self) -> None: +//| """Turn off the USB host port and release the pins for other use.""" +//| ... +//| +STATIC mp_obj_t usb_host_port_obj_deinit(mp_obj_t self_in) { + usb_host_port_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_usb_host_port_deinit(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(usb_host_port_deinit_obj, usb_host_port_obj_deinit); + +//| def __enter__(self) -> Port: +//| """No-op used by Context Managers.""" +//| ... +//| +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t usb_host_port_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + common_hal_usb_host_port_deinit(MP_OBJ_TO_PTR(args[0])); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(usb_host_port_obj___exit___obj, 4, 4, usb_host_port_obj___exit__); + +STATIC const mp_rom_map_elem_t usb_host_port_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&usb_host_port_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&usb_host_port_obj___exit___obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(usb_host_port_locals_dict, usb_host_port_locals_dict_table); + +const mp_obj_type_t usb_host_port_type = { + { &mp_type_type }, + .name = MP_QSTR_Port, + .make_new = usb_host_port_make_new, + .locals_dict = (mp_obj_t)&usb_host_port_locals_dict, +}; diff --git a/shared-bindings/usb_host/Port.h b/shared-bindings/usb_host/Port.h new file mode 100644 index 0000000000..68645d1146 --- /dev/null +++ b/shared-bindings/usb_host/Port.h @@ -0,0 +1,42 @@ +/* + * This file is part of the Micro Python 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_USB_HOST_PORT_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_USB_HOST_PORT_H + +#include "py/objarray.h" + +#include "shared-bindings/microcontroller/Pin.h" + +#include "common-hal/usb_host/Port.h" + +extern const mp_obj_type_t usb_host_port_type; + +void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm); +void common_hal_usb_host_port_deinit(usb_host_port_obj_t *self); +bool common_hal_usb_host_port_deinited(usb_host_port_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_USB_HOST_PORT_H diff --git a/shared-bindings/usb_host/__init__.c b/shared-bindings/usb_host/__init__.c new file mode 100644 index 0000000000..c689a2521a --- /dev/null +++ b/shared-bindings/usb_host/__init__.c @@ -0,0 +1,53 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "py/obj.h" +#include "py/mphal.h" +#include "py/runtime.h" + +#include "shared-bindings/usb_host/__init__.h" +#include "shared-bindings/usb_host/Port.h" + +//| """USB Host +//| +//| The `usb_host` module allows you to manage USB host ports. To communicate +//| with devices use the `usb` module that is a subset of PyUSB's API. +//| """ +//| + +STATIC mp_map_elem_t usb_host_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb_host) }, + { MP_ROM_QSTR(MP_QSTR_Port), MP_OBJ_FROM_PTR(&usb_host_port_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(usb_host_module_globals, usb_host_module_globals_table); + +const mp_obj_module_t usb_host_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&usb_host_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_usb_host, usb_host_module, CIRCUITPY_USB_HOST); diff --git a/shared-bindings/usb_host/__init__.h b/shared-bindings/usb_host/__init__.h new file mode 100644 index 0000000000..d6722851c7 --- /dev/null +++ b/shared-bindings/usb_host/__init__.h @@ -0,0 +1,27 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 9711c53e0d..289bab031c 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -18,15 +18,17 @@ //| :param Union[~displayio.ColorConverter,~displayio.Palette] pixel_shader: The pixel shader that produces colors from values //| :param int radius: The radius of the circle in pixels //| :param int x: Initial x position of the axis. -//| :param int y: Initial y position of the axis.""" +//| :param int y: Initial y position of the axis. +//| :param int color_index: Initial color_index to use when selecting color from the palette.""" //| static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y }; + enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_radius, MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_color_index, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -38,7 +40,8 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg vectorio_circle_t *self = m_new_obj(vectorio_circle_t); self->base.type = &vectorio_circle_type; - common_hal_vectorio_circle_construct(self, radius); + uint16_t color_index = args[ARG_color_index].u_int; + common_hal_vectorio_circle_construct(self, radius, color_index); // VectorShape parts mp_obj_t pixel_shader = args[ARG_pixel_shader].u_obj; @@ -80,6 +83,29 @@ const mp_obj_property_t vectorio_circle_radius_obj = { MP_ROM_NONE}, }; +//| color_index : int +//| """The color_index of the circle as 0 based index of the palette.""" +//| +STATIC mp_obj_t vectorio_circle_obj_get_color_index(mp_obj_t self_in) { + vectorio_circle_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_int(common_hal_vectorio_circle_get_color_index(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(vectorio_circle_get_color_index_obj, vectorio_circle_obj_get_color_index); + +STATIC mp_obj_t vectorio_circle_obj_set_color_index(mp_obj_t self_in, mp_obj_t color_index) { + vectorio_circle_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_vectorio_circle_set_color_index(self, mp_obj_get_int(color_index)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(vectorio_circle_set_color_index_obj, vectorio_circle_obj_set_color_index); + +const mp_obj_property_t vectorio_circle_color_index_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&vectorio_circle_get_color_index_obj, + (mp_obj_t)&vectorio_circle_set_color_index_obj, + MP_ROM_NONE}, +}; + // Documentation for properties inherited from VectorShape. @@ -103,6 +129,7 @@ STATIC const mp_rom_map_elem_t vectorio_circle_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_radius), MP_ROM_PTR(&vectorio_circle_radius_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) }, + { MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_circle_color_index_obj) }, { MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) }, { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) }, }; diff --git a/shared-bindings/vectorio/Circle.h b/shared-bindings/vectorio/Circle.h index 37bbe9e65b..8f169795d2 100644 --- a/shared-bindings/vectorio/Circle.h +++ b/shared-bindings/vectorio/Circle.h @@ -7,7 +7,7 @@ extern const mp_obj_type_t vectorio_circle_type; -void common_hal_vectorio_circle_construct(vectorio_circle_t *self, uint16_t radius); +void common_hal_vectorio_circle_construct(vectorio_circle_t *self, uint16_t radius, uint16_t color_index); void common_hal_vectorio_circle_set_on_dirty(vectorio_circle_t *self, vectorio_event_t notification); @@ -19,6 +19,9 @@ void common_hal_vectorio_circle_get_area(void *circle, displayio_area_t *out_are int16_t common_hal_vectorio_circle_get_radius(void *circle); void common_hal_vectorio_circle_set_radius(void *circle, int16_t radius); +uint16_t common_hal_vectorio_circle_get_color_index(void *obj); +void common_hal_vectorio_circle_set_color_index(void *obj, uint16_t color_index); + mp_obj_t common_hal_vectorio_circle_get_draw_protocol(void *circle); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_CIRCLE_H diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index dfe50ffd01..ea33baad55 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -25,15 +25,17 @@ //| shader that produces colors from values //| :param List[Tuple[int,int]] points: Vertices for the polygon //| :param int x: Initial screen x position of the 0,0 origin in the points list. -//| :param int y: Initial screen y position of the 0,0 origin in the points list.""" +//| :param int y: Initial screen y position of the 0,0 origin in the points list. +//| :param int color_index: Initial color_index to use when selecting color from the palette.""" //| static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y }; + enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_points, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_color_index, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -43,7 +45,8 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar vectorio_polygon_t *self = m_new_obj(vectorio_polygon_t); self->base.type = &vectorio_polygon_type; - common_hal_vectorio_polygon_construct(self, points_list); + uint16_t color_index = args[ARG_color_index].u_int; + common_hal_vectorio_polygon_construct(self, points_list, color_index); // VectorShape parts mp_obj_t pixel_shader = args[ARG_pixel_shader].u_obj; @@ -86,6 +89,29 @@ const mp_obj_property_t vectorio_polygon_points_obj = { MP_ROM_NONE}, }; +//| color_index : int +//| """The color_index of the polygon as 0 based index of the palette.""" +//| +STATIC mp_obj_t vectorio_polygon_obj_get_color_index(mp_obj_t self_in) { + vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_int(common_hal_vectorio_polygon_get_color_index(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(vectorio_polygon_get_color_index_obj, vectorio_polygon_obj_get_color_index); + +STATIC mp_obj_t vectorio_polygon_obj_set_color_index(mp_obj_t self_in, mp_obj_t color_index) { + vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_vectorio_polygon_set_color_index(self, mp_obj_get_int(color_index)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(vectorio_polygon_set_color_index_obj, vectorio_polygon_obj_set_color_index); + +const mp_obj_property_t vectorio_polygon_color_index_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&vectorio_polygon_get_color_index_obj, + (mp_obj_t)&vectorio_polygon_set_color_index_obj, + MP_ROM_NONE}, +}; + // Documentation for properties inherited from VectorShape. @@ -109,6 +135,7 @@ STATIC const mp_rom_map_elem_t vectorio_polygon_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_points), MP_ROM_PTR(&vectorio_polygon_points_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) }, + { MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_polygon_color_index_obj) }, { MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) }, { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) }, }; diff --git a/shared-bindings/vectorio/Polygon.h b/shared-bindings/vectorio/Polygon.h index 68136be6bd..9d3ce2dcc7 100644 --- a/shared-bindings/vectorio/Polygon.h +++ b/shared-bindings/vectorio/Polygon.h @@ -7,7 +7,7 @@ extern const mp_obj_type_t vectorio_polygon_type; -void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list); +void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list, uint16_t color_index); void common_hal_vectorio_polygon_set_on_dirty(vectorio_polygon_t *self, vectorio_event_t notification); @@ -20,6 +20,9 @@ void common_hal_vectorio_polygon_get_area(void *polygon, displayio_area_t *out_a mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self); void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t points_list); +uint16_t common_hal_vectorio_polygon_get_color_index(void *obj); +void common_hal_vectorio_polygon_set_color_index(void *obj, uint16_t color_index); + mp_obj_t common_hal_vectorio_polygon_get_draw_protocol(void *polygon); diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index 67367eb538..739a1ba9d1 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -17,16 +17,18 @@ //| :param int width: The number of pixels wide //| :param int height: The number of pixels high //| :param int x: Initial x position of the top left corner. -//| :param int y: Initial y position of the top left corner.""" +//| :param int y: Initial y position of the top left corner. +//| :param int color_index: Initial color_index to use when selecting color from the palette.""" //| static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y }; + enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, { MP_QSTR_width, MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_height, MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_color_index, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -42,7 +44,8 @@ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_ vectorio_rectangle_t *self = m_new_obj(vectorio_rectangle_t); self->base.type = &vectorio_rectangle_type; - common_hal_vectorio_rectangle_construct(self, width, height); + uint16_t color_index = args[ARG_color_index].u_int; + common_hal_vectorio_rectangle_construct(self, width, height, color_index); // VectorShape parts mp_obj_t pixel_shader = args[ARG_pixel_shader].u_obj; @@ -106,6 +109,29 @@ const mp_obj_property_t vectorio_rectangle_height_obj = { MP_ROM_NONE}, }; +//| color_index : int +//| """The color_index of the rectangle in 1 based index of the palette.""" +//| +STATIC mp_obj_t vectorio_rectangle_obj_get_color_index(mp_obj_t self_in) { + vectorio_rectangle_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_int(common_hal_vectorio_rectangle_get_color_index(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(vectorio_rectangle_get_color_index_obj, vectorio_rectangle_obj_get_color_index); + +STATIC mp_obj_t vectorio_rectangle_obj_set_color_index(mp_obj_t self_in, mp_obj_t color_index) { + vectorio_rectangle_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_vectorio_rectangle_set_color_index(self, mp_obj_get_int(color_index)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(vectorio_rectangle_set_color_index_obj, vectorio_rectangle_obj_set_color_index); + +const mp_obj_property_t vectorio_rectangle_color_index_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&vectorio_rectangle_get_color_index_obj, + (mp_obj_t)&vectorio_rectangle_set_color_index_obj, + MP_ROM_NONE}, +}; + // Documentation for properties inherited from VectorShape. //| x : int @@ -127,6 +153,7 @@ STATIC const mp_rom_map_elem_t vectorio_rectangle_locals_dict_table[] = { // Properties { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) }, + { MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_rectangle_color_index_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&vectorio_rectangle_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&vectorio_rectangle_height_obj) }, { MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) }, diff --git a/shared-bindings/vectorio/Rectangle.h b/shared-bindings/vectorio/Rectangle.h index d50b811624..907ae68690 100644 --- a/shared-bindings/vectorio/Rectangle.h +++ b/shared-bindings/vectorio/Rectangle.h @@ -7,7 +7,7 @@ extern const mp_obj_type_t vectorio_rectangle_type; -void common_hal_vectorio_rectangle_construct(vectorio_rectangle_t *self, uint32_t width, uint32_t height); +void common_hal_vectorio_rectangle_construct(vectorio_rectangle_t *self, uint32_t width, uint32_t height, uint16_t color_index); void common_hal_vectorio_rectangle_set_on_dirty(vectorio_rectangle_t *self, vectorio_event_t on_dirty); uint32_t common_hal_vectorio_rectangle_get_pixel(void *rectangle, int16_t x, int16_t y); @@ -19,6 +19,9 @@ mp_obj_t common_hal_vectorio_rectangle_get_draw_protocol(void *rectangle); int16_t common_hal_vectorio_rectangle_get_width(void *obj); void common_hal_vectorio_rectangle_set_width(void *obj, int16_t width); +uint16_t common_hal_vectorio_rectangle_get_color_index(void *obj); +void common_hal_vectorio_rectangle_set_color_index(void *obj, uint16_t color_index); + int16_t common_hal_vectorio_rectangle_get_height(void *obj); void common_hal_vectorio_rectangle_set_height(void *obj, int16_t height); diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index bb8ef18be1..119ab66c97 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -76,7 +76,7 @@ const mp_obj_property_t wifi_radio_enabled_obj = { MP_ROM_NONE }, }; -//| hostname: ReadableBuffer +//| hostname: Union[str | ReadableBuffer] //| """Hostname for wifi interface. When the hostname is altered after interface started/connected //| the changes would only be reflected once the interface restarts/reconnects.""" //| @@ -226,8 +226,8 @@ STATIC mp_obj_t wifi_radio_stop_station(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| def start_ap(self, -//| ssid: ReadableBuffer, -//| password: ReadableBuffer = b"", +//| ssid: Union[str | ReadableBuffer], +//| password: Union[str | ReadableBuffer] = "", //| *, //| channel: Optional[int] = 1, //| authmode: Optional[AuthMode], @@ -304,11 +304,11 @@ STATIC mp_obj_t wifi_radio_stop_ap(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_ap_obj, wifi_radio_stop_ap); //| def connect(self, -//| ssid: ReadableBuffer, -//| password: ReadableBuffer = b"", +//| ssid: Union[str | ReadableBuffer], +//| password: Union[str | ReadableBuffer] = "", //| *, //| channel: Optional[int] = 0, -//| bssid: Optional[ReadableBuffer] = b"", +//| bssid: Optional[Union[str | ReadableBuffer]] = "", //| timeout: Optional[float] = None) -> None: //| """Connects to the given ssid and waits for an ip address. Reconnections are handled //| automatically once one connection succeeds. diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index d026d9f766..87962dfc60 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -29,7 +29,6 @@ #include "shared-module/displayio/__init__.h" #include "shared/runtime/interrupt_char.h" -#include "py/reload.h" #include "py/runtime.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/displayio/Bitmap.h" @@ -37,8 +36,8 @@ #include "shared-bindings/displayio/Group.h" #include "shared-bindings/displayio/Palette.h" #include "shared-module/displayio/area.h" -#include "supervisor/shared/autoreload.h" #include "supervisor/shared/display.h" +#include "supervisor/shared/reload.h" #include "supervisor/memory.h" #include "supervisor/spi_flash_api.h" @@ -83,7 +82,7 @@ void displayio_background(void) { if (mp_hal_is_interrupted()) { return; } - if (reload_requested) { + if (autoreload_ready()) { // Reload is about to happen, so don't redisplay. return; } diff --git a/shared-module/usb/__init__.c b/shared-module/usb/__init__.c new file mode 100644 index 0000000000..2b3a4c5d6c --- /dev/null +++ b/shared-module/usb/__init__.c @@ -0,0 +1,27 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +// Nothing here diff --git a/shared-module/usb/core/Device.c b/shared-module/usb/core/Device.c new file mode 100644 index 0000000000..81431d5d7a --- /dev/null +++ b/shared-module/usb/core/Device.c @@ -0,0 +1,185 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-bindings/usb/core/Device.h" + +#include "tusb_config.h" + +#include "lib/tinyusb/src/host/usbh.h" +#include "py/runtime.h" +#include "shared/runtime/interrupt_char.h" +#include "shared-bindings/usb/core/__init__.h" +#include "shared-module/usb/utf16le.h" +#include "supervisor/shared/tick.h" + +bool common_hal_usb_core_device_construct(usb_core_device_obj_t *self, uint8_t device_number) { + if (device_number == 0 || device_number > CFG_TUH_DEVICE_MAX + CFG_TUH_HUB) { + return false; + } + if (!tuh_ready(device_number)) { + return false; + } + self->device_number = device_number; + return true; +} + +uint16_t common_hal_usb_core_device_get_idVendor(usb_core_device_obj_t *self) { + uint16_t vid; + uint16_t pid; + tuh_vid_pid_get(self->device_number, &vid, &pid); + return vid; +} + +uint16_t common_hal_usb_core_device_get_idProduct(usb_core_device_obj_t *self) { + uint16_t vid; + uint16_t pid; + tuh_vid_pid_get(self->device_number, &vid, &pid); + return pid; +} + +STATIC xfer_result_t _get_string_result; +STATIC bool _transfer_done_cb(uint8_t daddr, tusb_control_request_t const *request, xfer_result_t result) { + // Store the result so we stop waiting for the transfer. We don't need the other data for now. + (void)daddr; + (void)request; + _get_string_result = result; + return true; +} + +STATIC void _wait_for_callback(void) { + while (!mp_hal_is_interrupted() && + _get_string_result == 0xff) { + // The background tasks include TinyUSB which will call the function + // we provided above. In other words, the callback isn't in an interrupt. + RUN_BACKGROUND_TASKS; + } +} + +STATIC mp_obj_t _get_string(const uint16_t *temp_buf) { + size_t utf16_len = ((temp_buf[0] & 0xff) - 2) / sizeof(uint16_t); + if (utf16_len == 0) { + return mp_const_none; + } + return utf16le_to_string(temp_buf + 1, utf16_len); +} + +mp_obj_t common_hal_usb_core_device_get_serial_number(usb_core_device_obj_t *self) { + _get_string_result = 0xff; + uint16_t temp_buf[127]; + if (!tuh_descriptor_string_serial_get(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb)) { + return mp_const_none; + } + _wait_for_callback(); + return _get_string(temp_buf); +} + +mp_obj_t common_hal_usb_core_device_get_product(usb_core_device_obj_t *self) { + _get_string_result = 0xff; + uint16_t temp_buf[127]; + if (!tuh_descriptor_string_product_get(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb)) { + return mp_const_none; + } + _wait_for_callback(); + return _get_string(temp_buf); +} + +mp_obj_t common_hal_usb_core_device_get_manufacturer(usb_core_device_obj_t *self) { + _get_string_result = 0xff; + uint16_t temp_buf[127]; + if (!tuh_descriptor_string_manufacturer_get(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb)) { + return mp_const_none; + } + _wait_for_callback(); + return _get_string(temp_buf); +} + +mp_obj_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t endpoint, const uint8_t *buffer, mp_int_t len, mp_int_t timeout) { + return mp_const_none; +} + +mp_obj_t common_hal_usb_core_device_read(usb_core_device_obj_t *self, mp_int_t endpoint, uint8_t *buffer, mp_int_t len, mp_int_t timeout) { + return mp_const_none; +} + +xfer_result_t control_result; +STATIC bool _control_complete_cb(uint8_t dev_addr, tusb_control_request_t const *request, xfer_result_t result) { + (void)dev_addr; + (void)request; + control_result = result; + return true; +} + +mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, + mp_int_t bmRequestType, mp_int_t bRequest, + mp_int_t wValue, mp_int_t wIndex, + uint8_t *buffer, mp_int_t len, mp_int_t timeout) { + // Timeout is in ms. + + tusb_control_request_t request = { + .bmRequestType = bmRequestType, + .bRequest = bRequest, + .wValue = wValue, + .wIndex = wIndex, + .wLength = len + }; + control_result = XFER_RESULT_STALLED; + bool result = tuh_control_xfer(self->device_number, + &request, + buffer, + _control_complete_cb); + if (!result) { + mp_raise_usb_core_USBError(NULL); + } + uint32_t start_time = supervisor_ticks_ms32(); + while (supervisor_ticks_ms32() - start_time < (uint32_t)timeout && + !mp_hal_is_interrupted() && + control_result == XFER_RESULT_STALLED) { + // The background tasks include TinyUSB which will call the function + // we provided above. In other words, the callback isn't in an interrupt. + RUN_BACKGROUND_TASKS; + } + if (control_result == XFER_RESULT_STALLED) { + mp_raise_usb_core_USBTimeoutError(); + } + if (control_result == XFER_RESULT_SUCCESS) { + return len; + } + + return 0; +} + +bool common_hal_usb_core_device_is_kernel_driver_active(usb_core_device_obj_t *self, mp_int_t interface) { + // TODO: Implement this when CP natively uses a keyboard. + return false; +} + +void common_hal_usb_core_device_detach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface) { + // TODO: Implement this when CP natively uses a keyboard. +} + +void common_hal_usb_core_device_attach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface) { + // TODO: Implement this when CP natively uses a keyboard. +} diff --git a/shared-module/usb/core/Device.h b/shared-module/usb/core/Device.h new file mode 100644 index 0000000000..5959639fc8 --- /dev/null +++ b/shared-module/usb/core/Device.h @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_USB_CORE_DEVICE_H +#define MICROPY_INCLUDED_SHARED_MODULE_USB_CORE_DEVICE_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t device_number; +} usb_core_device_obj_t; + +#endif // MICROPY_INCLUDED_SHARED_MODULE_USB_CORE_DEVICE_H diff --git a/shared-module/usb/core/__init__.c b/shared-module/usb/core/__init__.c new file mode 100644 index 0000000000..a108f5fa05 --- /dev/null +++ b/shared-module/usb/core/__init__.c @@ -0,0 +1,27 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +// Nothing implementation specific. diff --git a/shared-module/usb/utf16le.c b/shared-module/usb/utf16le.c new file mode 100644 index 0000000000..24ccd09360 --- /dev/null +++ b/shared-module/usb/utf16le.c @@ -0,0 +1,85 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-module/usb/utf16le.h" + +STATIC void _convert_utf16le_to_utf8(const uint16_t *utf16, size_t utf16_len, uint8_t *utf8, size_t utf8_len) { + // TODO: Check for runover. + (void)utf8_len; + + for (size_t i = 0; i < utf16_len; i++) { + uint16_t chr = utf16[i]; + if (chr < 0x80) { + *utf8++ = chr & 0xff; + } else if (chr < 0x800) { + *utf8++ = (uint8_t)(0xC0 | (chr >> 6 & 0x1F)); + *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F)); + } else if (chr < 0x10000) { + // TODO: Verify surrogate. + *utf8++ = (uint8_t)(0xE0 | (chr >> 12 & 0x0F)); + *utf8++ = (uint8_t)(0x80 | (chr >> 6 & 0x3F)); + *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F)); + } else { + // TODO: Handle UTF-16 code points that take two entries. + uint32_t hc = ((chr & 0xFFFF0000) - 0xD8000000) >> 6; /* Get high 10 bits */ + chr = (chr & 0xFFFF) - 0xDC00; /* Get low 10 bits */ + chr = (hc | chr) + 0x10000; + *utf8++ = (uint8_t)(0xF0 | (chr >> 18 & 0x07)); + *utf8++ = (uint8_t)(0x80 | (chr >> 12 & 0x3F)); + *utf8++ = (uint8_t)(0x80 | (chr >> 6 & 0x3F)); + *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F)); + } + } +} + +// Count how many bytes a utf-16-le encoded string will take in utf-8. +STATIC mp_int_t _count_utf8_bytes(const uint16_t *buf, size_t len) { + size_t total_bytes = 0; + for (size_t i = 0; i < len; i++) { + uint16_t chr = buf[i]; + if (chr < 0x80) { + total_bytes += 1; + } else if (chr < 0x800) { + total_bytes += 2; + } else if (chr < 0x10000) { + total_bytes += 3; + } else { + total_bytes += 4; + } + } + return total_bytes; +} + +mp_obj_t utf16le_to_string(const uint16_t *buf, size_t utf16_len) { + size_t size = _count_utf8_bytes(buf, utf16_len); + vstr_t vstr; + vstr_init_len(&vstr, size + 1); + byte *p = (byte *)vstr.buf; + // Null terminate. + p[size] = '\0'; + _convert_utf16le_to_utf8(buf, utf16_len, p, size); + return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); +} diff --git a/shared-module/usb/utf16le.h b/shared-module/usb/utf16le.h new file mode 100644 index 0000000000..7305a1ad31 --- /dev/null +++ b/shared-module/usb/utf16le.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_USB_UTF16LE_H +#define MICROPY_INCLUDED_SHARED_MODULE_USB_UTF16LE_H + +#include "py/obj.h" + +mp_obj_t utf16le_to_string(const uint16_t *buf, size_t utf16_len); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_USB_UTF16LE_H diff --git a/shared-module/vectorio/Circle.c b/shared-module/vectorio/Circle.c index 6b4c441620..2ec11fe1bb 100644 --- a/shared-module/vectorio/Circle.c +++ b/shared-module/vectorio/Circle.c @@ -7,9 +7,10 @@ #include "stdlib.h" -void common_hal_vectorio_circle_construct(vectorio_circle_t *self, uint16_t radius) { +void common_hal_vectorio_circle_construct(vectorio_circle_t *self, uint16_t radius, uint16_t color_index) { self->radius = radius; self->on_dirty.obj = NULL; + self->color_index = color_index + 1; } void common_hal_vectorio_circle_set_on_dirty(vectorio_circle_t *self, vectorio_event_t on_dirty) { @@ -26,7 +27,7 @@ uint32_t common_hal_vectorio_circle_get_pixel(void *obj, int16_t x, int16_t y) { x = abs(x); y = abs(y); if (x + y <= radius) { - return 1; + return self->color_index; } if (x > radius) { return 0; @@ -35,7 +36,7 @@ uint32_t common_hal_vectorio_circle_get_pixel(void *obj, int16_t x, int16_t y) { return 0; } const bool pythagorasSmallerThanRadius = (int32_t)x * x + (int32_t)y * y <= (int32_t)radius * radius; - return pythagorasSmallerThanRadius ? 1 : 0; + return pythagorasSmallerThanRadius ? self->color_index : 0; } @@ -60,6 +61,19 @@ void common_hal_vectorio_circle_set_radius(void *obj, int16_t radius) { } } +uint16_t common_hal_vectorio_circle_get_color_index(void *obj) { + vectorio_circle_t *self = obj; + return self->color_index - 1; +} + +void common_hal_vectorio_circle_set_color_index(void *obj, uint16_t color_index) { + vectorio_circle_t *self = obj; + self->color_index = abs(color_index + 1); + if (self->on_dirty.obj != NULL) { + self->on_dirty.event(self->on_dirty.obj); + } +} + mp_obj_t common_hal_vectorio_circle_get_draw_protocol(void *circle) { vectorio_circle_t *self = circle; return self->draw_protocol_instance; diff --git a/shared-module/vectorio/Circle.h b/shared-module/vectorio/Circle.h index 106bca6a71..6ebd9af25f 100644 --- a/shared-module/vectorio/Circle.h +++ b/shared-module/vectorio/Circle.h @@ -10,6 +10,7 @@ typedef struct { mp_obj_base_t base; uint16_t radius; + uint16_t color_index; vectorio_event_t on_dirty; mp_obj_t draw_protocol_instance; } vectorio_circle_t; diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c index f0b241e351..10ebdf1edd 100644 --- a/shared-module/vectorio/Polygon.c +++ b/shared-module/vectorio/Polygon.c @@ -61,11 +61,12 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple -void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list) { +void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list, uint16_t color_index) { VECTORIO_POLYGON_DEBUG("%p polygon_construct: ", self); self->points_list = NULL; self->len = 0; self->on_dirty.obj = NULL; + self->color_index = color_index + 1; _clobber_points_list(self, points_list); VECTORIO_POLYGON_DEBUG("\n"); } @@ -181,10 +182,23 @@ uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y) x1 = x2; y1 = y2; } - return winding_number == 0 ? 0 : 1; + return winding_number == 0 ? 0 : self->color_index; } mp_obj_t common_hal_vectorio_polygon_get_draw_protocol(void *polygon) { vectorio_polygon_t *self = polygon; return self->draw_protocol_instance; } + +uint16_t common_hal_vectorio_polygon_get_color_index(void *obj) { + vectorio_polygon_t *self = obj; + return self->color_index - 1; +} + +void common_hal_vectorio_polygon_set_color_index(void *obj, uint16_t color_index) { + vectorio_polygon_t *self = obj; + self->color_index = abs(color_index + 1); + if (self->on_dirty.obj != NULL) { + self->on_dirty.event(self->on_dirty.obj); + } +} diff --git a/shared-module/vectorio/Polygon.h b/shared-module/vectorio/Polygon.h index e1d94f9f97..795e33561b 100644 --- a/shared-module/vectorio/Polygon.h +++ b/shared-module/vectorio/Polygon.h @@ -11,6 +11,7 @@ typedef struct { // An int array[ x, y, ... ] int16_t *points_list; uint16_t len; + uint16_t color_index; vectorio_event_t on_dirty; mp_obj_t draw_protocol_instance; } vectorio_polygon_t; diff --git a/shared-module/vectorio/Rectangle.c b/shared-module/vectorio/Rectangle.c index 9092a2e078..fbd3d6bdf5 100644 --- a/shared-module/vectorio/Rectangle.c +++ b/shared-module/vectorio/Rectangle.c @@ -6,9 +6,10 @@ #include "stdlib.h" -void common_hal_vectorio_rectangle_construct(vectorio_rectangle_t *self, uint32_t width, uint32_t height) { +void common_hal_vectorio_rectangle_construct(vectorio_rectangle_t *self, uint32_t width, uint32_t height, uint16_t color_index) { self->width = width; self->height = height; + self->color_index = color_index + 1; } void common_hal_vectorio_rectangle_set_on_dirty(vectorio_rectangle_t *self, vectorio_event_t on_dirty) { @@ -21,7 +22,7 @@ void common_hal_vectorio_rectangle_set_on_dirty(vectorio_rectangle_t *self, vect uint32_t common_hal_vectorio_rectangle_get_pixel(void *obj, int16_t x, int16_t y) { vectorio_rectangle_t *self = obj; if (x >= 0 && y >= 0 && x < self->width && y < self->height) { - return 1; + return self->color_index; } return 0; } @@ -66,3 +67,16 @@ void common_hal_vectorio_rectangle_set_height(void *obj, int16_t height) { self->on_dirty.event(self->on_dirty.obj); } } + +uint16_t common_hal_vectorio_rectangle_get_color_index(void *obj) { + vectorio_rectangle_t *self = obj; + return self->color_index - 1; +} + +void common_hal_vectorio_rectangle_set_color_index(void *obj, uint16_t color_index) { + vectorio_rectangle_t *self = obj; + self->color_index = abs(color_index + 1); + if (self->on_dirty.obj != NULL) { + self->on_dirty.event(self->on_dirty.obj); + } +} diff --git a/shared-module/vectorio/Rectangle.h b/shared-module/vectorio/Rectangle.h index ec6d2107be..2b1decca04 100644 --- a/shared-module/vectorio/Rectangle.h +++ b/shared-module/vectorio/Rectangle.h @@ -10,6 +10,7 @@ typedef struct { mp_obj_base_t base; uint16_t width; uint16_t height; + uint16_t color_index; vectorio_event_t on_dirty; mp_obj_t draw_protocol_instance; } vectorio_rectangle_t; diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 3c42459aba..b1f94db5e5 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -175,12 +175,13 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input } else if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(mp_obj_get_type((mp_obj_t)nlr.ret_val)), &mp_type_DeepSleepRequest)) { ret = PYEXEC_DEEP_SLEEP; #endif + } else if ((mp_obj_t)nlr.ret_val == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) { + ret = PYEXEC_RELOAD; } else { - if ((mp_obj_t)nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) { - mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); - } + mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); ret = PYEXEC_EXCEPTION; } + } if (result != NULL) { result->return_code = ret; diff --git a/shared/runtime/pyexec.h b/shared/runtime/pyexec.h index 3d3c2d6c53..d31a7fe816 100644 --- a/shared/runtime/pyexec.h +++ b/shared/runtime/pyexec.h @@ -49,6 +49,7 @@ extern int pyexec_system_exit; #define PYEXEC_FORCED_EXIT (0x100) #define PYEXEC_EXCEPTION (0x200) #define PYEXEC_DEEP_SLEEP (0x400) +#define PYEXEC_RELOAD (0x800) int pyexec_raw_repl(void); int pyexec_friendly_repl(void); diff --git a/supervisor/serial.h b/supervisor/serial.h index a9f45a8e38..a6646e9542 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -39,6 +39,7 @@ extern vstr_t *boot_output; #endif + void serial_early_init(void); void serial_init(void); void serial_write(const char *text); @@ -48,7 +49,14 @@ char serial_read(void); bool serial_bytes_available(void); bool serial_connected(void); -// XXX used in nrf52-sleep debug -int dbg_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +// These have no-op versions that are weak and the port can override. They work +// in tandem with the cross-port mechanics like USB and BLE. +void port_serial_init(void); +bool port_serial_connected(void); +char port_serial_read(void); +bool port_serial_bytes_available(void); +void port_serial_write_substring(const char *text, uint32_t length); + +int debug_uart_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); #endif // MICROPY_INCLUDED_SUPERVISOR_SERIAL_H diff --git a/supervisor/shared/autoreload.c b/supervisor/shared/autoreload.c deleted file mode 100644 index 5c66c44298..0000000000 --- a/supervisor/shared/autoreload.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 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 "autoreload.h" - -#include "py/mphal.h" -#include "py/reload.h" -#include "supervisor/shared/tick.h" - -supervisor_allocation *next_code_allocation; -#include "shared-bindings/supervisor/Runtime.h" - -static volatile uint32_t autoreload_delay_ms = 0; -static bool autoreload_enabled = false; -static size_t autoreload_suspended = 0; - -volatile bool reload_requested = false; - -inline void autoreload_tick() { - if (autoreload_delay_ms == 0) { - return; - } - if (autoreload_delay_ms == 1 && autoreload_enabled && - autoreload_suspended == 0 && !reload_requested) { - mp_raise_reload_exception(); - reload_requested = true; - supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD); - supervisor_disable_tick(); - } - autoreload_delay_ms--; -} - -void autoreload_enable() { - autoreload_enabled = true; - reload_requested = false; -} - -void autoreload_disable() { - autoreload_enabled = false; -} - -void autoreload_suspend(size_t lock_mask) { - autoreload_suspended |= lock_mask; -} - -void autoreload_resume(size_t lock_mask) { - autoreload_suspended &= ~lock_mask; -} - -inline bool autoreload_is_enabled() { - return autoreload_enabled; -} - -void autoreload_start() { - // Enable ticks if we haven't been tracking an autoreload delay. We check - // our current state so that we only turn ticks on once. Multiple starts - // can occur before we reload and then turn ticks off. - if (autoreload_delay_ms == 0) { - supervisor_enable_tick(); - } - autoreload_delay_ms = CIRCUITPY_AUTORELOAD_DELAY_MS; -} - -void autoreload_stop() { - autoreload_delay_ms = 0; - reload_requested = false; -} - -void autoreload_now() { - if (!autoreload_enabled || autoreload_suspended || reload_requested) { - return; - } - mp_raise_reload_exception(); - reload_requested = true; - supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD); -} diff --git a/supervisor/shared/bluetooth/file_transfer.c b/supervisor/shared/bluetooth/file_transfer.c index bf42326275..6c206f35c0 100644 --- a/supervisor/shared/bluetooth/file_transfer.c +++ b/supervisor/shared/bluetooth/file_transfer.c @@ -43,7 +43,7 @@ #include "common-hal/_bleio/__init__.h" #include "supervisor/fatfs_port.h" -#include "supervisor/shared/autoreload.h" +#include "supervisor/shared/reload.h" #include "supervisor/shared/bluetooth/file_transfer.h" #include "supervisor/shared/bluetooth/file_transfer_protocol.h" #include "supervisor/shared/tick.h" @@ -325,8 +325,7 @@ STATIC uint8_t _process_write(const uint8_t *raw_buf, size_t command_len) { if (chunk_size == 0) { // Don't reload until everything is written out of the packet buffer. common_hal_bleio_packet_buffer_flush(&_transfer_packet_buffer); - // Trigger an autoreload - autoreload_start(); + autoreload_trigger(); return ANY_COMMAND; } @@ -383,8 +382,7 @@ STATIC uint8_t _process_write_data(const uint8_t *raw_buf, size_t command_len) { #endif // Don't reload until everything is written out of the packet buffer. common_hal_bleio_packet_buffer_flush(&_transfer_packet_buffer); - // Trigger an autoreload - autoreload_start(); + autoreload_trigger(); return ANY_COMMAND; } return WRITE_DATA; @@ -465,8 +463,7 @@ STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) { if (result == FR_OK) { // Don't reload until everything is written out of the packet buffer. common_hal_bleio_packet_buffer_flush(&_transfer_packet_buffer); - // Trigger an autoreload - autoreload_start(); + autoreload_trigger(); } return ANY_COMMAND; } @@ -520,8 +517,7 @@ STATIC uint8_t _process_mkdir(const uint8_t *raw_buf, size_t command_len) { if (result == FR_OK) { // Don't reload until everything is written out of the packet buffer. common_hal_bleio_packet_buffer_flush(&_transfer_packet_buffer); - // Trigger an autoreload - autoreload_start(); + autoreload_trigger(); } return ANY_COMMAND; } @@ -668,8 +664,7 @@ STATIC uint8_t _process_move(const uint8_t *raw_buf, size_t command_len) { if (result == FR_OK) { // Don't reload until everything is written out of the packet buffer. common_hal_bleio_packet_buffer_flush(&_transfer_packet_buffer); - // Trigger an autoreload - autoreload_start(); + autoreload_trigger(); } return ANY_COMMAND; } @@ -692,7 +687,7 @@ void supervisor_bluetooth_file_transfer_background(void) { if (size == 0) { break; } - autoreload_suspend(AUTORELOAD_LOCK_BLE); + autoreload_suspend(AUTORELOAD_SUSPEND_BLE); // TODO: If size < 0 return an error. current_offset += size; #if CIRCUITPY_VERBOSE_BLE @@ -710,7 +705,7 @@ void supervisor_bluetooth_file_transfer_background(void) { response[0] = next_command; response[1] = STATUS_ERROR_PROTOCOL; common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, response, 2, NULL, 0); - autoreload_resume(AUTORELOAD_LOCK_BLE); + autoreload_resume(AUTORELOAD_SUSPEND_BLE); break; } switch (current_state) { @@ -744,7 +739,7 @@ void supervisor_bluetooth_file_transfer_background(void) { current_offset = 0; } if (next_command == ANY_COMMAND) { - autoreload_resume(AUTORELOAD_LOCK_BLE); + autoreload_resume(AUTORELOAD_SUSPEND_BLE); } } running = false; @@ -754,5 +749,5 @@ void supervisor_bluetooth_file_transfer_disconnected(void) { next_command = ANY_COMMAND; current_offset = 0; f_close(&active_file); - autoreload_resume(AUTORELOAD_LOCK_BLE); + autoreload_resume(AUTORELOAD_SUSPEND_BLE); } diff --git a/supervisor/shared/flash.c b/supervisor/shared/flash.c index 333c6467d4..dfd7cf2050 100644 --- a/supervisor/shared/flash.c +++ b/supervisor/shared/flash.c @@ -113,7 +113,7 @@ static mp_uint_t flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t n return supervisor_flash_read_blocks(dest, block_num - PART1_START_BLOCK, num_blocks); } -volatile bool filesystem_dirty = false; +static volatile bool filesystem_dirty = false; static mp_uint_t flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) { if (block_num == 0) { diff --git a/supervisor/shared/reload.c b/supervisor/shared/reload.c new file mode 100644 index 0000000000..e1ae2e6764 --- /dev/null +++ b/supervisor/shared/reload.c @@ -0,0 +1,113 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 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 "reload.h" + +#include "py/mphal.h" +#include "py/mpstate.h" +#include "supervisor/shared/reload.h" +#include "supervisor/shared/tick.h" + +supervisor_allocation *next_code_allocation; +#include "shared-bindings/supervisor/Runtime.h" + +// True if user has disabled autoreload. +static bool autoreload_enabled = false; + +// Non-zero if autoreload is temporarily off, due to an AUTORELOAD_SUSPEND_... reason. +static uint32_t autoreload_suspended = 0; + +volatile uint32_t last_autoreload_trigger = 0; + +void reload_initiate(supervisor_run_reason_t run_reason) { + supervisor_set_run_reason(run_reason); + + // Raise reload exception, in case code is running. + MP_STATE_THREAD(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)); + #if MICROPY_ENABLE_SCHEDULER + if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { + MP_STATE_VM(sched_state) = MP_SCHED_PENDING; + } + #endif +} + +void autoreload_reset() { + last_autoreload_trigger = 0; +} + +void autoreload_enable() { + autoreload_enabled = true; + last_autoreload_trigger = 0; +} + +void autoreload_disable() { + autoreload_enabled = false; +} + +void autoreload_suspend(uint32_t suspend_reason_mask) { + autoreload_suspended |= suspend_reason_mask; +} + +void autoreload_resume(uint32_t suspend_reason_mask) { + autoreload_suspended &= ~suspend_reason_mask; +} + +inline bool autoreload_is_enabled() { + return autoreload_enabled; +} + +void autoreload_trigger() { + if (autoreload_enabled & !autoreload_suspended) { + last_autoreload_trigger = supervisor_ticks_ms32(); + // Guard against the rare time that ticks is 0; + if (last_autoreload_trigger == 0) { + last_autoreload_trigger += 1; + } + // Initiate a reload of the VM immediately. Later code will pause to + // wait for the autoreload to become ready. Doing the VM exit + // immediately is clearer for the user. + reload_initiate(RUN_REASON_AUTO_RELOAD); + } +} + +bool autoreload_ready() { + if (last_autoreload_trigger == 0 || autoreload_suspended != 0) { + return false; + } + // Wait for autoreload interval before reloading + uint32_t now = supervisor_ticks_ms32(); + uint32_t diff; + if (now >= last_autoreload_trigger) { + diff = now - last_autoreload_trigger; + } else { + diff = now + (0xffffffff - last_autoreload_trigger); + } + return diff > CIRCUITPY_AUTORELOAD_DELAY_MS; +} + +bool autoreload_pending(void) { + return last_autoreload_trigger != 0; +} diff --git a/supervisor/shared/autoreload.h b/supervisor/shared/reload.h similarity index 62% rename from supervisor/shared/autoreload.h rename to supervisor/shared/reload.h index 7282b11a69..cb3385e7ca 100644 --- a/supervisor/shared/autoreload.h +++ b/supervisor/shared/reload.h @@ -27,9 +27,9 @@ #ifndef MICROPY_INCLUDED_SUPERVISOR_AUTORELOAD_H #define MICROPY_INCLUDED_SUPERVISOR_AUTORELOAD_H -#include - #include "supervisor/memory.h" +#include "py/obj.h" +#include "shared-bindings/supervisor/RunReason.h" enum { SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS = 0x1, @@ -41,8 +41,9 @@ enum { }; enum { - AUTORELOAD_LOCK_REPL = 0x1, - AUTORELOAD_LOCK_BLE = 0x2 + AUTORELOAD_SUSPEND_REPL = 0x1, + AUTORELOAD_SUSPEND_BLE = 0x2, + AUTORELOAD_SUSPEND_USB = 0x4 }; typedef struct { @@ -52,20 +53,32 @@ typedef struct { extern supervisor_allocation *next_code_allocation; -extern volatile bool reload_requested; +// Helper for exiting the VM and reloading immediately. +void reload_initiate(supervisor_run_reason_t run_reason); -void autoreload_tick(void); - -void autoreload_start(void); -void autoreload_stop(void); +// Enabled state is user controllable and very sticky. We don't reset it. void autoreload_enable(void); void autoreload_disable(void); bool autoreload_is_enabled(void); -// Temporarily turn it off. Used during the REPL. -void autoreload_suspend(size_t lock_mask); -void autoreload_resume(size_t lock_mask); +// Start the autoreload process. +void autoreload_trigger(void); +// True when the autoreload should occur. (A trigger happened and the delay has +// passed.) +bool autoreload_ready(void); +// Reset the autoreload timer in preparation for another trigger. Call when the +// last trigger starts being executed. +void autoreload_reset(void); +// True when a trigger has occurred but we're still delaying in case another +// trigger occurs. +bool autoreload_pending(void); -void autoreload_now(void); +// Temporarily turn autoreload off, for the given reason(s). Autoreload triggers +// will still be tracked so resuming with autoreload ready with cause an +// immediate reload. +// Used during the REPL or during parts of BLE workflow. +void autoreload_suspend(uint32_t suspend_reason_mask); +// Allow autoreloads again, for the given reason(s). +void autoreload_resume(uint32_t suspend_reason_mask); #endif // MICROPY_INCLUDED_SUPERVISOR_AUTORELOAD_H diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 4cb9d7ad61..7922cffc2b 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -147,12 +147,17 @@ void print_safe_mode_message(safe_mode_t reason) { switch (reason) { case USER_SAFE_MODE: #ifdef BOARD_USER_SAFE_MODE_ACTION - // Output a user safe mode string if it's set. - serial_write_compressed(translate("You requested starting safe mode by ")); - serial_write_compressed(BOARD_USER_SAFE_MODE_ACTION); - serial_write_compressed(translate("To exit, please reset the board without ")); message = BOARD_USER_SAFE_MODE_ACTION; + #elif defined(CIRCUITPY_BOOT_BUTTON) + message = translate("pressing boot button at start up.\n"); #endif + if (message != NULL) { + // Output a user safe mode string if it's set. + serial_write_compressed(translate("You requested starting safe mode by ")); + serial_write_compressed(message); + serial_write_compressed(translate("To exit, please reset the board without ")); + // The final piece is printed below. + } break; case MANUAL_SAFE_MODE: message = translate("You pressed the reset button during boot. Press again to exit safe mode."); diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index ddb614d133..af90fce4d7 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include #include #include "py/mpconfig.h" @@ -49,7 +50,8 @@ * Enabling on another platform will cause a crash. */ -#if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) +#if defined(CIRCUITPY_DEBUG_UART_TX) || defined(CIRCUITPY_DEBUG_UART_RX) +#include "py/mpprint.h" #include "shared-bindings/busio/UART.h" busio_uart_obj_t debug_uart; byte buf_array[64]; @@ -59,22 +61,81 @@ byte buf_array[64]; bool tud_vendor_connected(void); #endif +#if defined(CIRCUITPY_DEBUG_UART_TX) +STATIC void debug_uart_print_strn(void *env, const char *str, size_t len) { + (void)env; + int uart_errcode; + common_hal_busio_uart_write(&debug_uart, (const uint8_t *)str, len, &uart_errcode); +} + +const mp_print_t debug_uart_print = {NULL, debug_uart_print_strn}; +#endif + +int debug_uart_printf(const char *fmt, ...) { + #if defined(CIRCUITPY_DEBUG_UART_TX) + // Skip prints that occur before debug serial is started. It's better than + // crashing. + if (common_hal_busio_uart_deinited(&debug_uart)) { + return 0; + } + va_list ap; + va_start(ap, fmt); + int ret = mp_vprintf(&debug_uart_print, fmt, ap); + va_end(ap); + return ret; + #else + return 0; + #endif +} + +MP_WEAK void port_serial_init(void) { +} + +MP_WEAK bool port_serial_connected(void) { + return false; +} + +MP_WEAK char port_serial_read(void) { + return -1; +} + +MP_WEAK bool port_serial_bytes_available(void) { + return false; +} + +MP_WEAK void port_serial_write_substring(const char *text, uint32_t length) { + (void)text; + (void)length; +} + void serial_early_init(void) { - #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) + #if defined(CIRCUITPY_DEBUG_UART_TX) || defined(CIRCUITPY_DEBUG_UART_RX) debug_uart.base.type = &busio_uart_type; - const mcu_pin_obj_t *rx = MP_OBJ_TO_PTR(DEBUG_UART_RX); - const mcu_pin_obj_t *tx = MP_OBJ_TO_PTR(DEBUG_UART_TX); + #if defined(CIRCUITPY_DEBUG_UART_RX) + const mcu_pin_obj_t *rx = MP_OBJ_TO_PTR(CIRCUITPY_DEBUG_UART_RX); + #else + const mcu_pin_obj_t *rx = NULL; + #endif + + #if defined(CIRCUITPY_DEBUG_UART_TX) + const mcu_pin_obj_t *tx = MP_OBJ_TO_PTR(CIRCUITPY_DEBUG_UART_TX); + #else + const mcu_pin_obj_t *tx = NULL; + #endif common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL, false, 115200, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, 64, buf_array, true); common_hal_busio_uart_never_reset(&debug_uart); + + // Do an initial print so that we can confirm the serial output is working. + debug_uart_printf("Serial debug setup\r\n"); #endif } void serial_init(void) { - // USB serial is set up separately. + port_serial_init(); } bool serial_connected(void) { @@ -84,7 +145,7 @@ bool serial_connected(void) { } #endif - #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) + #if defined(CIRCUITPY_DEBUG_UART_TX) && defined(CIRCUITPY_DEBUG_UART_RX) return true; #endif @@ -103,6 +164,10 @@ bool serial_connected(void) { return true; } #endif + + if (port_serial_connected()) { + return true; + } return false; } @@ -115,7 +180,7 @@ char serial_read(void) { } #endif - #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) + #if defined(CIRCUITPY_DEBUG_UART_RX) if (common_hal_busio_uart_rx_characters_available(&debug_uart)) { int uart_errcode; char text; @@ -138,6 +203,10 @@ char serial_read(void) { #if CIRCUITPY_USB return (char)tud_cdc_read_char(); #endif + + if (port_serial_bytes_available() > 0) { + return port_serial_read(); + } return -1; } @@ -148,7 +217,7 @@ bool serial_bytes_available(void) { } #endif - #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) + #if defined(CIRCUITPY_DEBUG_UART_RX) if (common_hal_busio_uart_rx_characters_available(&debug_uart)) { return true; } @@ -170,6 +239,10 @@ bool serial_bytes_available(void) { return true; } #endif + + if (port_serial_bytes_available() > 0) { + return true; + } return false; } @@ -188,7 +261,7 @@ void serial_write_substring(const char *text, uint32_t length) { } #endif - #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) + #if defined(CIRCUITPY_DEBUG_UART_TX) int uart_errcode; common_hal_busio_uart_write(&debug_uart, (const uint8_t *)text, length, &uart_errcode); @@ -215,6 +288,8 @@ void serial_write_substring(const char *text, uint32_t length) { usb_background(); } #endif + + port_serial_write_substring(text, length); } void serial_write(const char *text) { diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 94b9d4d15e..104083fb20 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -34,7 +34,6 @@ #include "supervisor/filesystem.h" #include "supervisor/background_callback.h" #include "supervisor/port.h" -#include "supervisor/shared/autoreload.h" #include "supervisor/shared/stack.h" #if CIRCUITPY_BLEIO_HCI @@ -66,7 +65,9 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); static background_callback_t tick_callback; -volatile uint64_t last_finished_tick = 0; +static volatile uint64_t last_finished_tick = 0; + +static volatile size_t tick_enable_count = 0; static void supervisor_background_tasks(void *unused) { port_start_background_task(); @@ -101,10 +102,6 @@ void supervisor_tick(void) { filesystem_tick(); #endif - #ifdef CIRCUITPY_AUTORELOAD_DELAY_MS - autoreload_tick(); - #endif - #ifdef CIRCUITPY_GAMEPAD_TICKS if (!(port_get_raw_ticks(NULL) & CIRCUITPY_GAMEPAD_TICKS)) { #if CIRCUITPY_GAMEPADSHIFT @@ -160,8 +157,7 @@ void mp_hal_delay_ms(mp_uint_t delay_ms) { } } -volatile size_t tick_enable_count = 0; -extern void supervisor_enable_tick(void) { +void supervisor_enable_tick(void) { common_hal_mcu_disable_interrupts(); if (tick_enable_count == 0) { port_enable_tick(); @@ -170,7 +166,7 @@ extern void supervisor_enable_tick(void) { common_hal_mcu_enable_interrupts(); } -extern void supervisor_disable_tick(void) { +void supervisor_disable_tick(void) { common_hal_mcu_disable_interrupts(); if (tick_enable_count > 0) { tick_enable_count--; diff --git a/supervisor/shared/tick.h b/supervisor/shared/tick.h index 3a01bd6222..d805aeb099 100644 --- a/supervisor/shared/tick.h +++ b/supervisor/shared/tick.h @@ -37,20 +37,23 @@ * interrupt context. */ extern void supervisor_tick(void); + /** @brief Get the lower 32 bits of the time in milliseconds * * This can be more efficient than supervisor_ticks_ms64, for sites where a wraparound * of ~49.5 days is not harmful. */ extern uint32_t supervisor_ticks_ms32(void); + /** @brief Get the full time in milliseconds * * Because common ARM mcus cannot atomically work with 64-bit quantities, this * function must briefly disable interrupts in order to return the value. If * only relative durations of less than about ~49.5 days need to be considered, - * then it may be possible to use supervisor_ticks_ms64 instead. + * then it may be possible to use supervisor_ticks_ms32() instead. */ extern uint64_t supervisor_ticks_ms64(void); + /** @brief Run background ticks, but only about every millisecond. * * Normally, this is not called directly. Instead use the RUN_BACKGROUND_TASKS diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index 15d539c450..13b4367f47 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -38,6 +38,8 @@ #ifndef _TUSB_CONFIG_H_ #define _TUSB_CONFIG_H_ +#include "py/mpconfig.h" + #ifdef __cplusplus extern "C" { #endif @@ -45,8 +47,11 @@ extern "C" { // --------------------------------------------------------------------+ // COMMON CONFIGURATION // --------------------------------------------------------------------+ -#ifndef CFG_TUSB_DEBUG -#define CFG_TUSB_DEBUG 0 + +// When debugging TinyUSB, only output to the UART debug link. +#if CIRCUITPY_DEBUG_TINYUSB > 0 && defined(CIRCUITPY_DEBUG_UART_TX) +#define CFG_TUSB_DEBUG CIRCUITPY_DEBUG_TINYUSB +#define CFG_TUSB_DEBUG_PRINTF debug_uart_printf #endif /*------------- RTOS -------------*/ @@ -59,11 +64,19 @@ extern "C" { // DEVICE CONFIGURATION // --------------------------------------------------------------------+ +#if CIRCUITPY_USB_DEVICE_INSTANCE == 0 #if USB_HIGHSPEED #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) #else #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE) #endif +#elif CIRCUITPY_USB_DEVICE_INSTANCE == 1 +#if USB_HIGHSPEED +#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) +#else +#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE) +#endif +#endif // Vendor name included in Inquiry response, max 8 bytes #define CFG_TUD_MSC_VENDOR USB_MANUFACTURER_8 @@ -109,6 +122,43 @@ extern "C" { #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(CIRCUITPY_TUSB_MEM_ALIGN))) +// -------------------------------------------------------------------- +// HOST CONFIGURATION +// -------------------------------------------------------------------- + +#if CIRCUITPY_USB_HOST + +#if CIRCUITPY_USB_HOST_INSTANCE == 0 +#if USB_HIGHSPEED +#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED) +#else +#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST) +#endif +#elif CIRCUITPY_USB_HOST_INSTANCE == 1 +#if USB_HIGHSPEED +#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED) +#else +#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_HOST) +#endif +#endif + +// Size of buffer to hold descriptors and other data used for enumeration +#ifndef CFG_TUH_ENUMERATION_BUFSIZE +#define CFG_TUH_ENUMERATION_BUFSIZE 256 +#endif + +#define CFG_TUH_HUB 1 +#define CFG_TUH_CDC 0 +#define CFG_TUH_MSC 0 +#define CFG_TUH_VENDOR 0 + +// max device support (excluding hub device) +#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports + +// Number of endpoints per device +#define CFG_TUH_ENDPOINT_MAX 8 + +#endif #ifdef __cplusplus } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 815773fa2c..a1885448de 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -165,6 +165,9 @@ void usb_background(void) { if (usb_enabled()) { #if CFG_TUSB_OS == OPT_OS_NONE tud_task(); + #if CIRCUITPY_USB_HOST + tuh_task(); + #endif #endif // No need to flush if there's no REPL. #if CIRCUITPY_USB_CDC @@ -185,8 +188,15 @@ void usb_background_schedule(void) { background_callback_add(&usb_callback, usb_background_do, NULL); } -void usb_irq_handler(void) { - tud_int_handler(0); +void usb_irq_handler(int instance) { + if (instance == CIRCUITPY_USB_DEVICE_INSTANCE) { + tud_int_handler(instance); + } else if (instance == CIRCUITPY_USB_HOST_INSTANCE) { + #if CIRCUITPY_USB_HOST + tuh_int_handler(instance); + #endif + } + usb_background_schedule(); } diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index fe88f8c831..f1830332d4 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -36,7 +36,7 @@ #include "shared-module/storage/__init__.h" #include "supervisor/filesystem.h" -#include "supervisor/shared/autoreload.h" +#include "supervisor/shared/reload.h" #define MSC_FLASH_BLOCK_SIZE 512 @@ -170,7 +170,6 @@ bool tud_msc_is_writable_cb(uint8_t lun) { // Callback invoked when received READ10 command. // Copy disk's data to buffer (up to bufsize) and return number of copied bytes. int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) { - (void)lun; (void)offset; const uint32_t block_count = bufsize / MSC_FLASH_BLOCK_SIZE; @@ -186,6 +185,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void *buff int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t *buffer, uint32_t bufsize) { (void)lun; (void)offset; + autoreload_suspend(AUTORELOAD_SUSPEND_USB); const uint32_t block_count = bufsize / MSC_FLASH_BLOCK_SIZE; @@ -215,8 +215,9 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t * void tud_msc_write10_complete_cb(uint8_t lun) { (void)lun; - // This write is complete, start the autoreload clock. - autoreload_start(); + // This write is complete; initiate an autoreload. + autoreload_resume(AUTORELOAD_SUSPEND_USB); + autoreload_trigger(); } // Invoked when received SCSI_CMD_INQUIRY diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index eed9f4dc47..f4ca11db43 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -1,7 +1,6 @@ SRC_SUPERVISOR = \ main.c \ supervisor/port.c \ - supervisor/shared/autoreload.c \ supervisor/shared/background_callback.c \ supervisor/shared/board.c \ supervisor/shared/cpu.c \ @@ -9,12 +8,15 @@ SRC_SUPERVISOR = \ supervisor/shared/lock.c \ supervisor/shared/memory.c \ supervisor/shared/micropython.c \ + supervisor/shared/reload.c \ supervisor/shared/safe_mode.c \ + supervisor/shared/serial.c \ supervisor/shared/stack.c \ supervisor/shared/status_leds.c \ supervisor/shared/tick.c \ supervisor/shared/traceback.c \ - supervisor/shared/translate.c + supervisor/shared/translate.c \ + supervisor/shared/workflow.c ifeq ($(DISABLE_FILESYSTEM),1) SRC_SUPERVISOR += supervisor/stub/filesystem.c @@ -76,23 +78,17 @@ $(BUILD)/supervisor/shared/external_flash/external_flash.o: $(HEADER_BUILD)/devi endif -ifeq ($(CIRCUITPY_USB),0) - ifeq ($(wildcard supervisor/serial.c),) - SRC_SUPERVISOR += supervisor/shared/serial.c \ - supervisor/shared/workflow.c \ +ifneq ($(wildcard supervisor/serial.c),) + SRC_SUPERVISOR += supervisor/serial.c +endif - else - SRC_SUPERVISOR += supervisor/serial.c - endif -else +ifeq ($(CIRCUITPY_USB),1) SRC_SUPERVISOR += \ lib/tinyusb/src/class/cdc/cdc_device.c \ lib/tinyusb/src/common/tusb_fifo.c \ lib/tinyusb/src/device/usbd.c \ lib/tinyusb/src/device/usbd_control.c \ lib/tinyusb/src/tusb.c \ - supervisor/shared/serial.c \ - supervisor/shared/workflow.c \ supervisor/usb.c \ supervisor/shared/usb/usb_desc.c \ supervisor/shared/usb/usb.c \ @@ -140,6 +136,14 @@ else lib/tinyusb/src/class/vendor/vendor_device.c \ endif + + ifeq ($(CIRCUITPY_USB_HOST), 1) + SRC_SUPERVISOR += \ + lib/tinyusb/src/host/hub.c \ + lib/tinyusb/src/host/usbh.c \ + lib/tinyusb/src/host/usbh_control.c \ + + endif endif SRC_TINYUSB = $(filter lib/tinyusb/%.c, $(SRC_SUPERVISOR)) diff --git a/supervisor/usb.h b/supervisor/usb.h index 19180ef758..420f42391b 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -41,7 +41,7 @@ void usb_background(void); void usb_background_schedule(void); // Ports must call this from their particular USB IRQ handler -void usb_irq_handler(void); +void usb_irq_handler(int instance); // Only inits the USB peripheral clocks and pins. The peripheral will be initialized by // TinyUSB. diff --git a/tests/circuitpython-manual/usb/basic_keyboard.py b/tests/circuitpython-manual/usb/basic_keyboard.py new file mode 100644 index 0000000000..fdc46799b8 --- /dev/null +++ b/tests/circuitpython-manual/usb/basic_keyboard.py @@ -0,0 +1,34 @@ +import array +import usb.core +import sys + +# This is a WASD Code Keyboard with a generic controller in it. +USB_VID = 0x04D9 +USB_PID = 0x0169 +# This is ordered by bit position. +MODIFIERS = [] + +device = usb.core.find(idVendor=USB_VID, idProduct=USB_PID) + +print(device.manufacturer, device.product) + +# Test to see if the kernel is using the device and detach it. +if device.is_kernel_driver_active(0): + device.detach_kernel_driver(0) + +# Boot keyboards have 8 byte reports +buf = array.array("B", [0] * 8) +report_count = 0 +while True: + try: + count = device.read(0x81, buf) + except usb.core.USBTimeoutError: + continue + if report_count % 15 == 0: + print("modifiers keys") + print(buf[0], end=" ") + for i in range(2, 8): + if buf[i] > 0: + print(buf[i], end=" ") + print() + report_count += 1 diff --git a/tests/circuitpython-manual/usb/basic_mouse.py b/tests/circuitpython-manual/usb/basic_mouse.py new file mode 100644 index 0000000000..a3228610a4 --- /dev/null +++ b/tests/circuitpython-manual/usb/basic_mouse.py @@ -0,0 +1,35 @@ +import array +import usb.core +import sys + +# This is a basic Microsoft optical mouse with two buttons and a wheel that can +# also be pressed. +USB_VID = 0x045E +USB_PID = 0x0040 +# This is ordered by bit position. +BUTTONS = ["left", "right", "middle"] + +device = usb.core.find(idVendor=USB_VID, idProduct=USB_PID) + +print(device.manufacturer, device.product) + +# Test to see if the kernel is using the device and detach it. +if device.is_kernel_driver_active(0): + device.detach_kernel_driver(0) + +# Boot mice have 4 byte reports +buf = array.array("b", [0] * 4) +report_count = 0 +while True: + try: + count = device.read(0x81, buf) + except usb.core.USBTimeoutError: + continue + if report_count % 15 == 0: + print("x y wheel buttons") + print(buf[1], buf[2], buf[3], end=" ") + for i, button in enumerate(BUTTONS): + if buf[0] & (1 << i) != 0: + print(button, end=" ") + print() + report_count += 1 diff --git a/tests/circuitpython-manual/usb/device_info.py b/tests/circuitpython-manual/usb/device_info.py new file mode 100644 index 0000000000..7b8631a8f8 --- /dev/null +++ b/tests/circuitpython-manual/usb/device_info.py @@ -0,0 +1,20 @@ +import usb_host +import board +import digitalio +import usb.core +import time + +if hasattr(board, "USB_HOST_POWER"): + d = digitalio.DigitalInOut(board.USB_HOST_POWER) + d.switch_to_output(value=True) + print("USB power on") + +h = usb_host.Port(board.USB_HOST_DP, board.USB_HOST_DM) + +while True: + for device in usb.core.find(find_all=True): + print(f"{device.idVendor:04x}:{device.idProduct:04x}") + print(device.manufacturer, device.product) + print(device.serial_number) + print() + time.sleep(10) diff --git a/tests/vectorio/color_index.py b/tests/vectorio/color_index.py new file mode 100644 index 0000000000..cc31ae46c8 --- /dev/null +++ b/tests/vectorio/color_index.py @@ -0,0 +1,50 @@ +import time +import board +import displayio +import vectorio + + +def increment_color(shape): + if shape.color_index + 1 < len(shape.pixel_shader): + shape.color_index += 1 + else: + shape.color_index = 0 + + +display = board.DISPLAY +main_group = displayio.Group() + +palette = displayio.Palette(4) +palette[0] = 0x125690 +palette[1] = 0x34BB90 +palette[2] = 0xAA1220 +palette[3] = 0xAA04BA + +circle = vectorio.Circle(pixel_shader=palette, radius=25, x=25, y=25) +main_group.append(circle) + +rectangle = vectorio.Rectangle(pixel_shader=palette, width=50, height=50, x=25, y=75) +main_group.append(rectangle) + +points = [(5, 5), (70, 20), (35, 35), (20, 70)] +polygon = vectorio.Polygon(pixel_shader=palette, points=points, x=145, y=55) +main_group.append(polygon) + +display.show(main_group) + +while True: + for x in range(25, display.width - 25): + circle.x = x + time.sleep(0.01) + + increment_color(circle) + increment_color(rectangle) + increment_color(polygon) + + for x in range(display.width - 25, 25, -1): + circle.x = x + time.sleep(0.01) + + increment_color(circle) + increment_color(rectangle) + increment_color(polygon) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 364bcefe7b..97192adee7 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -69,9 +69,11 @@ extension_by_board = { # stm32 "meowbit_v121": UF2, # esp32c3 + "adafruit_qtpy_esp32c3": BIN, "ai_thinker_esp32-c3s": BIN, "ai_thinker_esp32-c3s-2m": BIN, "espressif_esp32c3_devkitm_1_n4": BIN, + "lilygo_ttgo_t-01c3": BIN, "microdev_micro_c3": BIN, # broadcom "raspberrypi_zero": KERNEL_IMG, diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 6becd5bd7e..d9e7d99687 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -55,6 +55,7 @@ DEFAULT_CLUSTERLIST = { "espressif_esp32s3_devkitc_1_n8r2", "espressif_esp32s3_devkitc_1_n8r8", ], + "0x303A:0x7009": ["espressif_esp32s2_devkitc_1_n4", "espressif_esp32s2_devkitc_1_n4r2"], } cli_parser = argparse.ArgumentParser(description="USB VID/PID Duplicate Checker") diff --git a/tools/diff_nm_sizes.py b/tools/diff_nm_sizes.py new file mode 100644 index 0000000000..241355ea18 --- /dev/null +++ b/tools/diff_nm_sizes.py @@ -0,0 +1,53 @@ +"""This script diffs two dumps of symbol sizes by matching up the symbol names + +To generate the input files do something like: + +arm-none-eabi-nm --size-sort build-bluemicro833/firmware.elf > new_sizes.txt + +The command will vary by board and along with git state. + +To print the diff do: + +python diff_nm_sizes.py old_sizes.txt new_sizes.txt +""" + +import sys +import pathlib + +old = pathlib.Path(sys.argv[-2]) +new = pathlib.Path(sys.argv[-1]) +old_symbols = {} +old_total_size = 0 +longest_symbol = 0 +for line in old.read_text().split("\n"): + if not line: + continue + size, t, name = line.split() + old_size = int(size, 16) + old_total_size += old_size + old_symbols[name] = old_size + longest_symbol = max(longest_symbol, len(name)) + +new_total_size = 0 +for line in new.read_text().split("\n"): + if not line: + continue + size, t, name = line.split() + size = int(size, 16) + new_total_size += size + if name not in old_symbols: + print(f"{name:<{longest_symbol}}{size:>+6}") + else: + old_size = old_symbols[name] + del old_symbols[name] + if size == old_size: + continue + print(f"{name:<{longest_symbol}}{size - old_size:>+6}") + +for name in old_symbols: + old_size = old_symbols[name] + print(f"{name:<{longest_symbol}}{-old_size:>+6}") + +print() +total_label = f"Total {new_total_size} - {old_total_size}" +print(f"{total_label:<{longest_symbol}}{new_total_size - old_total_size:>+6}") diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 3b2e7b72ee..7b87404fbc 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -20,8 +20,9 @@ import black import circuitpython_typing import circuitpython_typing.socket +PATHS_IGNORE = frozenset({"shared-bindings/__future__"}) -IMPORTS_IGNORE = frozenset( +TYPE_MODULE_IMPORTS_IGNORE = frozenset( { "array", "bool", @@ -115,7 +116,7 @@ def extract_imports(tree): return for node in ast.walk(anno_tree): if isinstance(node, ast.Name): - if node.id in IMPORTS_IGNORE: + if node.id in TYPE_MODULE_IMPORTS_IGNORE: continue for module, imports in AVAILABLE_TYPE_MODULE_IMPORTS.items(): if node.id in imports: @@ -158,6 +159,9 @@ def convert_folder(top_level, stub_directory): for filename in filenames: full_path = os.path.join(top_level, filename) + if full_path in PATHS_IGNORE: + continue + file_lines = [] if os.path.isdir(full_path): (mok, mtotal) = convert_folder(full_path, os.path.join(stub_directory, filename))