diff --git a/locale/ID.po b/locale/ID.po index 446dcd5311..448a289a24 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2441,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." @@ -3660,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 "" @@ -4108,6 +4120,7 @@ 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 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index fca18d79f7..0ce564f1f7 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2408,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 "" @@ -3625,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 "" @@ -4072,6 +4084,7 @@ 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 diff --git a/locale/cs.po b/locale/cs.po index a441056c80..b9fa742cc1 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2417,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 "" @@ -3634,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 "" @@ -4081,6 +4093,7 @@ 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 diff --git a/locale/de_DE.po b/locale/de_DE.po index cb83ee8cb3..cefd24e805 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2458,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." @@ -3711,6 +3715,14 @@ msgstr "long int wird in diesem Build nicht unterstützt" 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 msgid "malformed f-string" msgstr "fehlformatierter f-string" @@ -4163,6 +4175,7 @@ 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 diff --git a/locale/el.po b/locale/el.po index 4b82fa06f3..7d43824e4e 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2408,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 "" @@ -3625,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 "" @@ -4072,6 +4084,7 @@ 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 diff --git a/locale/en_GB.po b/locale/en_GB.po index 4acebfbfc5..cd600837c1 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2437,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." @@ -3660,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" @@ -4107,6 +4119,7 @@ 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 diff --git a/locale/es.po b/locale/es.po index 9114372c99..995919bc8a 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2468,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." @@ -3702,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" @@ -4153,6 +4165,7 @@ 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 diff --git a/locale/fil.po b/locale/fil.po index 16099e1252..193bc0c88e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2428,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." @@ -3664,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 "" @@ -4113,6 +4125,7 @@ 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 diff --git a/locale/fr.po b/locale/fr.po index 2777ac1c76..05ec1209de 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2484,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." @@ -3732,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é" @@ -4184,6 +4196,7 @@ 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 diff --git a/locale/hi.po b/locale/hi.po index 2d3f4b569e..12671ffb38 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2408,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 "" @@ -3625,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 "" @@ -4072,6 +4084,7 @@ 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 diff --git a/locale/it_IT.po b/locale/it_IT.po index 429cb39500..29415e59f9 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2445,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." @@ -3680,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 "" @@ -4133,6 +4145,7 @@ 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 diff --git a/locale/ja.po b/locale/ja.po index b30e83fa22..20f41e546d 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2423,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に書き込みできません" @@ -3645,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" @@ -4094,6 +4106,7 @@ 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 diff --git a/locale/ko.po b/locale/ko.po index 60146837bd..9ebbf36eb1 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2412,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 "" @@ -3629,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 "" @@ -4076,6 +4088,7 @@ 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 diff --git a/locale/nl.po b/locale/nl.po index bb93eda802..098bb276ba 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2434,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." @@ -3665,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" @@ -4113,6 +4125,7 @@ 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 diff --git a/locale/pl.po b/locale/pl.po index fc48558763..054e175527 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2419,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." @@ -3637,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" @@ -4085,6 +4097,7 @@ 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 diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7e955dec3e..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-03-19 16:56+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" @@ -2479,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." @@ -3722,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" @@ -4176,6 +4188,7 @@ 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 diff --git a/locale/ru.po b/locale/ru.po index e9e0026ead..cc26975101 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2457,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 "" @@ -3674,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 "" @@ -4121,6 +4133,7 @@ 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 diff --git a/locale/sv.po b/locale/sv.po index 0414f2e457..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-03-19 16:56+0000\n" +"PO-Revision-Date: 2022-03-23 08:58+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -2450,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." @@ -3685,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" @@ -4133,6 +4145,7 @@ 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 diff --git a/locale/tr.po b/locale/tr.po index f75ff6bb50..6966ee8ae9 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2424,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 "" @@ -3641,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 "" @@ -4088,6 +4100,7 @@ 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 diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index d85a2df85d..0ad1a11f80 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2460,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." @@ -3694,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" @@ -4141,6 +4153,7 @@ 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 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/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/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/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/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 cabadb205f..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}} 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 ab1eaa8bde..d7a81502fa 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h @@ -39,9 +39,3 @@ // Serial over UART #define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX #define CIRCUITPY_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") diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h index 5889c81cf2..0b8a3b0ae8 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h @@ -39,9 +39,3 @@ // Serial over UART #define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX #define CIRCUITPY_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") 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 bd131abe5c..69c4580aba 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h @@ -39,9 +39,3 @@ // Serial over UART #define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX #define CIRCUITPY_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") 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/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/mpconfigboard.h b/ports/espressif/boards/hexky_s2/mpconfigboard.h index fb57ff8c54..31dd096beb 100644 --- a/ports/espressif/boards/hexky_s2/mpconfigboard.h +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.h @@ -32,11 +32,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/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_t8_esp32_s2_wroom/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h index c63b7bee4f..4ab6ddbda5 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.h @@ -28,9 +28,3 @@ #define MICROPY_HW_BOARD_NAME "TTGO T8 ESP32-S2-WROOM" #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/lilygo_ttgo_t8_s2/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h index d2fb6107c6..91e68a1e24 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.h @@ -28,9 +28,3 @@ #define MICROPY_HW_BOARD_NAME "LILYGO TTGO T8 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 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 d7d3238b2d..e94f14c80b 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h @@ -46,9 +46,3 @@ // Serial over UART #define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX #define CIRCUITPY_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") 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/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/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-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/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/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/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/pyb_nano_v2/mpconfigboard.h b/ports/stm/boards/pyb_nano_v2/mpconfigboard.h index b476a668a9..4425d1eeec 100644 --- a/ports/stm/boards/pyb_nano_v2/mpconfigboard.h +++ b/ports/stm/boards/pyb_nano_v2/mpconfigboard.h @@ -44,6 +44,4 @@ #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 aff15eba28..4e72668693 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h +++ b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h @@ -46,5 +46,3 @@ #define DEFAULT_I2C_BUS_SDA (&pin_PB07) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000) - -#define AUTORESET_DELAY_MS (500) 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/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index e7cbacf0a2..550396f2ba 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -214,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 @@ -401,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 \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 9de701133a..87fcc8ff60 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -263,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) 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/shared-bindings/mdns/__init__.h b/shared-bindings/mdns/__init__.h new file mode 100644 index 0000000000..d6722851c7 --- /dev/null +++ b/shared-bindings/mdns/__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/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/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-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/supervisor/serial.h b/supervisor/serial.h index 876dc9ad94..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,6 +49,14 @@ char serial_read(void); bool serial_bytes_available(void); bool serial_connected(void); +// 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/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 87c4fca14d..af90fce4d7 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -88,6 +88,26 @@ int debug_uart_printf(const char *fmt, ...) { #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(CIRCUITPY_DEBUG_UART_TX) || defined(CIRCUITPY_DEBUG_UART_RX) debug_uart.base.type = &busio_uart_type; @@ -115,7 +135,7 @@ void serial_early_init(void) { } void serial_init(void) { - // USB serial is set up separately. + port_serial_init(); } bool serial_connected(void) { @@ -144,6 +164,10 @@ bool serial_connected(void) { return true; } #endif + + if (port_serial_connected()) { + return true; + } return false; } @@ -179,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; } @@ -211,6 +239,10 @@ bool serial_bytes_available(void) { return true; } #endif + + if (port_serial_bytes_available() > 0) { + return true; + } return false; } @@ -256,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/supervisor.mk b/supervisor/supervisor.mk index 30041c402f..f4ca11db43 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -10,11 +10,13 @@ SRC_SUPERVISOR = \ 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 \ 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 a969ba9a5b..97192adee7 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -69,6 +69,7 @@ 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, diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 51eac31f03..0b84445ef1 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -51,6 +51,7 @@ DEFAULT_IGNORELIST = [ "unexpectedmaker_feathers2_prerelease", "espressif_kaluga_1", "espressif_kaluga_1.3", + "espressif_esp32s2_devkitc_1_n4", "espressif_esp32s2_devkitc_1_n4r2", "espressif_esp32s3_devkitc_1_n8", "espressif_esp32s3_devkitc_1_n8r2",