Merge remote-tracking branch 'upstream/main' into esp32-displayio-fix

This commit is contained in:
Lucian Copeland 2020-09-14 10:44:31 -04:00
commit ecc219fe50
135 changed files with 5354 additions and 477 deletions

View File

@ -275,6 +275,7 @@ jobs:
- "pyportal"
- "pyportal_titano"
- "pyruler"
- "qtpy_m0"
- "raytac_mdbt50q-db-40"
- "robohatmm1_m4"
- "sam32"

3
.gitmodules vendored
View File

@ -150,3 +150,6 @@
[submodule "frozen/Adafruit_CircuitPython_RFM9x"]
path = frozen/Adafruit_CircuitPython_RFM9x
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git
[submodule "frozen/Adafruit_CircuitPython_RFM69"]
path = frozen/Adafruit_CircuitPython_RFM69
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git

View File

@ -146,6 +146,7 @@ version = release = final_version
# directories to ignore when looking for source files.
exclude_patterns = ["**/build*",
".git",
".env",
".venv",
".direnv",
"docs/autoapi",

View File

@ -1748,6 +1748,7 @@ void check_att_err(uint8_t err) {
break;
case BT_ATT_ERR_ENCRYPTION_KEY_SIZE:
msg = translate("Encryption key size");
break;
case BT_ATT_ERR_INVALID_ATTRIBUTE_LEN:
msg = translate("Invalid attribute length");
break;

View File

@ -22,6 +22,7 @@ recursiveloop(char *pc, const char *sp, Subject *input, const char **subp, int n
case Char:
if(*sp != *pc++)
return 0;
/* FALLTHROUGH */
case Any:
sp++;
continue;

@ -0,0 +1 @@
Subproject commit c0b9bdf22997552396abb514a6304d33460c2912

@ -1 +1 @@
Subproject commit 22100b252fc2eb8f51ed407949645653c4880fd9
Subproject commit e90cf7a676eddcbd9c35d2d99a0a9cd14686e2ce

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-07-06 18:10+0000\n"
"Last-Translator: oon arfiandwi <oon.arfiandwi@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -34,14 +34,6 @@ msgstr ""
"Harap ajukan masalah dengan konten drive CIRCUITPY Anda di\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Untuk keluar, harap setel ulang papan tanpa"
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
@ -279,7 +271,7 @@ msgstr "pow() 3-arg tidak didukung"
msgid "A hardware interrupt channel is already in use"
msgstr "Sebuah channel hardware interrupt sedang digunakan"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "Alamat harus sepanjang %d byte"
@ -377,6 +369,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "Mencoba alokasi heap ketika MicroPython VM tidak berjalan."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Auto-reload tidak aktif.\n"
@ -596,6 +592,10 @@ msgstr ""
"CircuitPython dalam mode aman karena Anda menekan tombol reset saat boot. "
"Tekan lagi untuk keluar dari mode aman.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Init pin clock gagal."
@ -1244,6 +1244,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1264,6 +1268,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@ -1309,6 +1317,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -1508,6 +1520,10 @@ msgstr ""
msgid "Serializer in use"
msgstr "Serializer sedang digunakan"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr ""
@ -1608,6 +1624,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Untuk keluar, silahkan reset board tanpa "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Terlalu banyak channel dalam sampel"
@ -1703,6 +1723,10 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1813,6 +1837,10 @@ msgstr ""
"\n"
"Untuk menampilkan modul built-in silahkan ketik `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1927,7 +1955,7 @@ msgstr ""
msgid "bad format string"
msgstr ""
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "typecode buruk"
@ -1981,6 +2009,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr "byte > 8 bit tidak didukung"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr ""
@ -2947,6 +2979,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr ""
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr ""
@ -3421,6 +3458,13 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Untuk keluar, harap setel ulang papan tanpa"
#~ msgid "%q indices must be integers, not %s"
#~ msgstr "indeks %q harus bilangan bulat, bukan %s"
@ -3680,9 +3724,6 @@ msgstr ""
#~ "Tegangan dari mikrokontroler turun atau mati. Pastikan sumber tegangan "
#~ "memberikan daya\n"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Untuk keluar, silahkan reset board tanpa "
#~ msgid "UART(%d) does not exist"
#~ msgstr "UART(%d) tidak ada"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -30,12 +30,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr ""
@ -273,7 +267,7 @@ msgstr ""
msgid "A hardware interrupt channel is already in use"
msgstr ""
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr ""
@ -371,6 +365,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr ""
@ -578,6 +576,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr ""
@ -1221,6 +1223,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1241,6 +1247,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1285,6 +1295,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -1481,6 +1495,10 @@ msgstr ""
msgid "Serializer in use"
msgstr ""
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr ""
@ -1581,6 +1599,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr ""
@ -1676,6 +1698,10 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1779,6 +1805,10 @@ msgid ""
"To list built-in modules please do `help(\"modules\")`.\n"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1893,7 +1923,7 @@ msgstr ""
msgid "bad format string"
msgstr ""
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr ""
@ -1946,6 +1976,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr ""
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr ""
@ -2911,6 +2945,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr ""
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-05-24 03:22+0000\n"
"Last-Translator: dronecz <mzuzelka@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -34,25 +34,17 @@ msgstr ""
"Založte prosím problém s obsahem vaší jednotky CIRCUITPY na adrese\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Pro ukončení, prosím resetujte desku bez "
#: py/obj.c
msgid " File \"%q\""
msgstr "  Soubor \"%q\""
msgstr " Soubor \"%q\""
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr "  Soubor \"%q\", řádek %d"
msgstr " Soubor \"%q\", řádek %d"
#: main.c
msgid " output:\n"
msgstr " výstup:\n"
msgstr " výstup:\n"
#: py/objstr.c
#, c-format
@ -279,7 +271,7 @@ msgstr ""
msgid "A hardware interrupt channel is already in use"
msgstr ""
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr ""
@ -377,6 +369,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr ""
@ -584,6 +580,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr ""
@ -1227,6 +1227,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1247,6 +1251,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1291,6 +1299,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -1487,6 +1499,10 @@ msgstr ""
msgid "Serializer in use"
msgstr ""
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr ""
@ -1587,6 +1603,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr ""
@ -1682,6 +1702,10 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1785,6 +1809,10 @@ msgid ""
"To list built-in modules please do `help(\"modules\")`.\n"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1899,7 +1927,7 @@ msgstr ""
msgid "bad format string"
msgstr ""
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr ""
@ -1952,6 +1980,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr ""
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr ""
@ -2917,6 +2949,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr ""
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr ""
@ -3390,5 +3427,12 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Pro ukončení, prosím resetujte desku bez "
#~ msgid "%q indices must be integers, not %s"
#~ msgstr "Indexy %q musí být celá čísla, nikoli %s"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-06-16 18:24+0000\n"
"Last-Translator: Andreas Buchen <andreas.buchen@gmail.com>\n"
"Language: de_DE\n"
@ -33,14 +33,6 @@ msgstr ""
"Bitte melden Sie ein Problem mit dem Inhalt Ihres CIRCUITPY-Laufwerks unter\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Zum Beenden, resete bitte das Board ohne "
#: py/obj.c
msgid " File \"%q\""
msgstr " Datei \"%q\""
@ -278,7 +270,7 @@ msgstr "3-arg pow() wird nicht unterstützt"
msgid "A hardware interrupt channel is already in use"
msgstr "Ein Hardware Interrupt Kanal wird schon benutzt"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "Die Adresse muss %d Bytes lang sein"
@ -378,6 +370,10 @@ msgstr ""
"Versuch einer Heap Reservierung, wenn die MicroPython-VM nicht ausgeführt "
"wird."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Automatisches Neuladen ist deaktiviert.\n"
@ -592,6 +588,10 @@ msgstr ""
"Reset-Taste gedrückt haben. Drücken Sie erneut, um den abgesicherten Modus "
"zu verlassen.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Clock pin init fehlgeschlagen."
@ -1246,6 +1246,10 @@ msgstr "Keine langen Integer (long) unterstützt"
msgid "No more timers available on this pin."
msgstr "An diesem Pin sind keine Timer mehr verfügbar."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Kein Pulldown Widerstand am Pin; 1Mohm wird vorgeschlagen"
@ -1266,6 +1270,10 @@ msgstr "Kein Timer verfügbar"
msgid "Nordic Soft Device failure assertion."
msgstr "Fehlerbehauptung für Nordic Soft Device."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1316,6 +1324,10 @@ msgstr ""
"Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs "
"unterstützt: %d bpp wurden gegeben"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Oversample muss ein Vielfaches von 8 sein."
@ -1517,6 +1529,10 @@ msgstr "Ausgewählter RTS-Pin ungültig"
msgid "Serializer in use"
msgstr "Serializer wird benutzt"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Slice und Wert (value) haben unterschiedliche Längen."
@ -1629,6 +1645,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Zum beenden, resette bitte das board ohne "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Zu viele Kanäle im sample."
@ -1726,6 +1746,10 @@ msgstr "Schreiben in nvm nicht möglich."
msgid "Unexpected nrfx uuid type"
msgstr "Unerwarteter nrfx uuid-Typ"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1840,6 +1864,10 @@ msgstr ""
"Um die integrierten Module aufzulisten, führe bitte `help(\"modules\")` "
"aus.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "Schreiben nicht unterstüzt für die Characteristic"
@ -1956,7 +1984,7 @@ msgstr "schlechter Konvertierungsspezifizierer"
msgid "bad format string"
msgstr "Falscher Formatstring"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "Falscher Typcode"
@ -2009,6 +2037,10 @@ msgstr "Byteorder ist kein String"
msgid "bytes > 8 bits not supported"
msgstr "bytes mit mehr als 8 bits werden nicht unterstützt"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "Byte-Wert außerhalb des Bereichs"
@ -2998,6 +3030,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "Überlauf beim konvertieren von long int zu machine word"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "Die Palette muss 32 Byte lang sein"
@ -3478,6 +3515,13 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Zum Beenden, resete bitte das Board ohne "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "PulseOut wird auf diesem Chip nicht unterstützt"
@ -3900,9 +3944,6 @@ msgstr ""
#~ "Die Reset-Taste wurde beim Booten von CircuitPython gedrückt. Drücke sie "
#~ "erneut um den abgesicherten Modus zu verlassen. \n"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Zum beenden, resette bitte das board ohne "
#~ msgid "UART(%d) does not exist"
#~ msgstr "UART(%d) existiert nicht"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-08-17 21:11+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
@ -36,14 +36,6 @@ msgstr ""
"Reporte un problema con el contenido de su unidad CIRCUITPY en\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Para salir, favor reinicie la tarjeta sin "
#: py/obj.c
msgid " File \"%q\""
msgstr " Archivo \"%q\""
@ -282,7 +274,7 @@ msgstr "pow() con 3 argumentos no soportado"
msgid "A hardware interrupt channel is already in use"
msgstr "El canal EXTINT ya está siendo utilizado"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "La dirección debe ser %d bytes de largo"
@ -384,6 +376,10 @@ msgstr ""
"Se intentó asignación del montículo, sin que la VM de MicroPython esté "
"ejecutando."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Auto-recarga deshabilitada.\n"
@ -597,6 +593,10 @@ msgstr ""
"CircuitPython está en modo seguro porque presionó el botón de reinicio "
"durante el arranque. Presione nuevamente para salir del modo seguro.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Iniciado de pin de reloj fallido."
@ -1245,6 +1245,10 @@ msgstr "No hay soporte de entero largo"
msgid "No more timers available on this pin."
msgstr "No hay más temporizadores disponibles en este pin."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "No hay pulldown en el pin; 1Mohm recomendado"
@ -1265,6 +1269,10 @@ msgstr "No hay temporizador disponible"
msgid "Nordic Soft Device failure assertion."
msgstr "fallo de aserción de dispositivo Nordic Soft."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1315,6 +1323,10 @@ msgstr ""
"Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o "
"más: %d bpp proporcionados"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "El sobremuestreo debe ser un múltiplo de 8."
@ -1516,6 +1528,10 @@ msgstr "Pin RTS seleccionado no válido"
msgid "Serializer in use"
msgstr "Serializer está siendo utilizado"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Slice y value tienen tamaños diferentes."
@ -1629,6 +1645,10 @@ msgstr ""
"El temporizador es utilizado para uso interno - declare los pines para PWM "
"más temprano en el programa"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Para salir, por favor reinicia la tarjeta sin "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Demasiados canales en sample."
@ -1725,6 +1745,10 @@ msgstr "Imposible escribir en nvm."
msgid "Unexpected nrfx uuid type"
msgstr "Tipo de uuid nrfx inesperado"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1839,6 +1863,10 @@ msgstr ""
"\n"
"Para listar los módulos incorporados por favor haga `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "Escrituras no admitidas en la característica"
@ -1953,7 +1981,7 @@ msgstr "especificador de conversion erroneo"
msgid "bad format string"
msgstr "formato de string erroneo"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "typecode erroneo"
@ -2006,6 +2034,10 @@ msgstr "byteorder no es una cadena"
msgid "bytes > 8 bits not supported"
msgstr "bytes > 8 bits no soportados"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "valor de bytes fuera de rango"
@ -2984,6 +3016,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "desbordamiento convirtiendo long int a palabra de máquina"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "palette debe ser 32 bytes de largo"
@ -3460,6 +3497,13 @@ msgstr "zi debe ser de tipo flotante"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi debe ser una forma (n_section,2)"
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Para salir, favor reinicie la tarjeta sin "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "PulseOut no es compatible con este chip"
@ -3909,9 +3953,6 @@ msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "Tile indices must be 0 - 255"
#~ msgstr "Los índices de Tile deben ser 0 - 255"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Para salir, por favor reinicia la tarjeta sin "
#~ msgid "UART(%d) does not exist"
#~ msgstr "UART(%d) no existe"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -28,12 +28,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
@ -274,7 +268,7 @@ msgstr "3-arg pow() hindi suportado"
msgid "A hardware interrupt channel is already in use"
msgstr "Isang channel ng hardware interrupt ay ginagamit na"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, fuzzy, c-format
msgid "Address must be %d bytes long"
msgstr "ang palette ay dapat 32 bytes ang haba"
@ -373,6 +367,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Awtomatikong pag re-reload ay OFF.\n"
@ -584,6 +582,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Nabigo sa pag init ng Clock pin."
@ -1235,6 +1237,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1255,6 +1261,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@ -1302,6 +1312,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Oversample ay dapat multiple ng 8."
@ -1502,6 +1516,10 @@ msgstr ""
msgid "Serializer in use"
msgstr "Serializer ginagamit"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Slice at value iba't ibang haba."
@ -1602,6 +1620,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Para lumabas, paki-reset ang board na wala ang "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Sobra ang channels sa sample."
@ -1698,6 +1720,10 @@ msgstr "Hindi ma i-sulat sa NVM."
msgid "Unexpected nrfx uuid type"
msgstr "hindi inaasahang indent"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1810,6 +1836,10 @@ msgstr ""
"\n"
"Para makita ang listahan ng modules, `help(“modules”)`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1924,7 +1954,7 @@ msgstr "masamang pag convert na specifier"
msgid "bad format string"
msgstr "maling format ang string"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "masamang typecode"
@ -1978,6 +2008,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr "hindi sinusuportahan ang bytes > 8 bits"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "bytes value wala sa sakop"
@ -2960,6 +2994,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "overflow nagcoconvert ng long int sa machine word"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "ang palette ay dapat 32 bytes ang haba"
@ -3810,9 +3849,6 @@ msgstr ""
#~ "Ang reset button ay pinindot habang nag boot ang CircuitPython. Pindutin "
#~ "ulit para lumabas sa safe mode.\n"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Para lumabas, paki-reset ang board na wala ang "
#~ msgid "UART(%d) does not exist"
#~ msgstr "Walang UART(%d)"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-07-27 21:27+0000\n"
"Last-Translator: Nathan <bonnemainsnathan@gmail.com>\n"
"Language: fr\n"
@ -36,14 +36,6 @@ msgstr ""
"l'adresse\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Pour quitter, veuillez réinitialiser la carte sans "
#: py/obj.c
msgid " File \"%q\""
msgstr " Fichier \"%q\""
@ -283,7 +275,7 @@ msgstr "pow() non supporté avec 3 arguments"
msgid "A hardware interrupt channel is already in use"
msgstr "Un canal d'interruptions matérielles est déjà utilisé"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "L'adresse doit être longue de %d octets"
@ -384,6 +376,10 @@ msgstr ""
"Tentative d'allocation de segments lorsque la machine virtuelle MicroPython "
"n'est pas en cours d'exécution."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "L'auto-chargement est désactivé.\n"
@ -600,6 +596,10 @@ msgstr ""
"réinitialisation pendant le démarrage. Appuyez à nouveau pour quitter le "
"mode sans échec.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Echec de l'init. de la broche d'horloge."
@ -1249,6 +1249,10 @@ msgstr "Pas de support entier long"
msgid "No more timers available on this pin."
msgstr "Plus de minuteurs disponibles sur cette broche."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Pas de pulldown sur la broche ; 1Mohm recommandé"
@ -1269,6 +1273,10 @@ msgstr "Pas de minuterie disponible"
msgid "Nordic Soft Device failure assertion."
msgstr "Affirmation de défaillance du Nordic Soft Device."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1319,6 +1327,10 @@ msgstr ""
"Prise en charge uniquement des monochromes, 4 bpp ou 8 bpp indexés et 16 bpp "
"ou plus : %d bpp fournis"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Le sur-échantillonage doit être un multiple de 8."
@ -1522,6 +1534,10 @@ msgstr "Broche RTS sélectionnée non valide"
msgid "Serializer in use"
msgstr "Sérialiseur en cours d'utilisation"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Tranche et valeur de tailles différentes."
@ -1631,6 +1647,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Pour quitter, redémarrez la carte SVP sans "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Trop de canaux dans l'échantillon."
@ -1730,6 +1750,10 @@ msgstr "Impossible d'écrire sur la mémoire non-volatile."
msgid "Unexpected nrfx uuid type"
msgstr "Type inattendu pour l'uuid nrfx"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1846,6 +1870,10 @@ msgstr ""
"\n"
"Pour lister les modules inclus, tapez `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "Écritures non prises en charge sur la caractéristique"
@ -1960,7 +1988,7 @@ msgstr "mauvaise spécification de conversion"
msgid "bad format string"
msgstr "chaîne mal-formée"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "mauvais code type"
@ -2013,6 +2041,10 @@ msgstr "byteorder n'est pas une chaîne"
msgid "bytes > 8 bits not supported"
msgstr "octets > 8 bits non supporté"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "valeur des octets hors bornes"
@ -3004,6 +3036,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "dépassement de capacité en convertissant un entier long en mot machine"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "la palette doit être longue de 32 octets"
@ -3481,6 +3518,13 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Pour quitter, veuillez réinitialiser la carte sans "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "PulseOut non pris en charge sur cette puce"
@ -3938,9 +3982,6 @@ msgstr ""
#~ msgid "Tile indices must be 0 - 255"
#~ msgstr "Les indices des tuiles doivent être compris entre 0 et 255 "
#~ msgid "To exit, please reset the board without "
#~ msgstr "Pour quitter, redémarrez la carte SVP sans "
#~ msgid "UART(%d) does not exist"
#~ msgstr "UART(%d) n'existe pas"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@ -29,12 +29,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr ""
@ -272,7 +266,7 @@ msgstr ""
msgid "A hardware interrupt channel is already in use"
msgstr ""
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr ""
@ -370,6 +364,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr ""
@ -577,6 +575,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr ""
@ -1220,6 +1222,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1240,6 +1246,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1284,6 +1294,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -1480,6 +1494,10 @@ msgstr ""
msgid "Serializer in use"
msgstr ""
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr ""
@ -1580,6 +1598,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr ""
@ -1675,6 +1697,10 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1778,6 +1804,10 @@ msgid ""
"To list built-in modules please do `help(\"modules\")`.\n"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1892,7 +1922,7 @@ msgstr ""
msgid "bad format string"
msgstr ""
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr ""
@ -1945,6 +1975,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr ""
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr ""
@ -2910,6 +2944,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr ""
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -28,12 +28,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
@ -273,7 +267,7 @@ msgstr "pow() con tre argmomenti non supportata"
msgid "A hardware interrupt channel is already in use"
msgstr "Un canale di interrupt hardware è già in uso"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, fuzzy, c-format
msgid "Address must be %d bytes long"
msgstr "la palette deve essere lunga 32 byte"
@ -372,6 +366,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Auto-reload disattivato.\n"
@ -585,6 +583,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Inizializzazione del pin di clock fallita."
@ -1239,6 +1241,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1259,6 +1265,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@ -1307,6 +1317,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "L'oversampling deve essere multiplo di 8."
@ -1513,6 +1527,10 @@ msgstr ""
msgid "Serializer in use"
msgstr "Serializer in uso"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr ""
@ -1613,6 +1631,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Per uscire resettare la scheda senza "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr ""
@ -1709,6 +1731,10 @@ msgstr "Imposibile scrivere su nvm."
msgid "Unexpected nrfx uuid type"
msgstr "indentazione inaspettata"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1813,6 +1839,10 @@ msgid ""
"To list built-in modules please do `help(\"modules\")`.\n"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1927,7 +1957,7 @@ msgstr "specificatore di conversione scorretto"
msgid "bad format string"
msgstr "stringa di formattazione scorretta"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr ""
@ -1983,6 +2013,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr "byte > 8 bit non supportati"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "valore byte fuori intervallo"
@ -2966,6 +3000,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "overflow convertendo long int in parola"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "la palette deve essere lunga 32 byte"
@ -3801,9 +3840,6 @@ msgstr ""
#~ "La potenza del microcontrollore è calata. Assicurati che l'alimentazione "
#~ "sia attaccata correttamente\n"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Per uscire resettare la scheda senza "
#~ msgid "UART(%d) does not exist"
#~ msgstr "UART(%d) non esistente"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-27 11:21-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-09-01 18:44+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: none\n"
@ -36,14 +36,6 @@ msgstr ""
"CIRCUITPYドライブの内容を添えて問題を以下で報告してください\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"終了するには、次の操作をせずにリセットしてください: "
#: py/obj.c
msgid " File \"%q\""
msgstr " ファイル \"%q\""
@ -282,7 +274,7 @@ msgstr "引数3つのpow()はサポートされていません"
msgid "A hardware interrupt channel is already in use"
msgstr "ハードウェア割り込みチャネルは使用中"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "アドレスは、%dバイト長でなければなりません"
@ -380,6 +372,10 @@ msgstr "%d個のブロックの確保を試みました"
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "MicroPython VM 非実行時にヒープの確保を試みました"
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "オートリロードはオフです。\n"
@ -503,6 +499,10 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr "ローカルのCharacteristicにはCCCDを設定できません"
#: shared-bindings/_bleio/Adapter.c
msgid "Cannot create a new Adapter; use _bleio.adapter;"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
@ -589,6 +589,10 @@ msgstr ""
"起動中にリセットボタンを押したためCircuitPythonはセーフモードにいます。もう一"
"度押すとセーフモードを終了します。\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "クロックピンの初期化に失敗"
@ -757,8 +761,8 @@ msgstr "EXTINTチャネルはすでに使用されています"
msgid "Error in regex"
msgstr "正規表現にエラーがあります"
#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c
#: shared-bindings/microcontroller/Pin.c
#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c
#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c
#: shared-bindings/neopixel_write/__init__.c
#: shared-bindings/terminalio/Terminal.c
msgid "Expected a %q"
@ -769,10 +773,18 @@ msgstr "%qが必要"
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Expected a DigitalInOut"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Expected a UART"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
#: shared-bindings/_bleio/Service.c
msgid "Expected a UUID"
@ -900,7 +912,9 @@ msgstr "IVは%dバイト長でなければなりません"
msgid ""
"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/"
"mpy-update for more info."
msgstr "非互換の.mpyファイルです。全ての.mpyファイルを更新してください。詳細は http://adafru.it/mpy-update を参照"
msgstr ""
"非互換の.mpyファイルです。全ての.mpyファイルを更新してください。詳細は "
"http://adafru.it/mpy-update を参照"
#: shared-bindings/_pew/PewPew.c
msgid "Incorrect buffer size"
@ -1224,6 +1238,10 @@ msgstr "long integerサポートがありません"
msgid "No more timers available on this pin."
msgstr "このピンに利用可能なタイマーがもうありません"
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "ピンにプルダウンがありません。1Mオーム推奨"
@ -1244,6 +1262,10 @@ msgstr "利用できるタイマーなし"
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1258,6 +1280,10 @@ msgstr "再生していません"
msgid "Not running saved code.\n"
msgstr "保存されたコードは実行していません。\n"
#: shared-bindings/_bleio/__init__.c
msgid "Not settable"
msgstr ""
#: shared-bindings/util.c
msgid ""
"Object has been deinitialized and can no longer be used. Create a new object."
@ -1286,6 +1312,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "オーバーサンプルは8の倍数が必要"
@ -1293,7 +1323,8 @@ msgstr "オーバーサンプルは8の倍数が必要"
#: shared-bindings/pwmio/PWMOut.c
msgid ""
"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)"
msgstr "PWMのduty_cycle値は0から65535の間でなければなりません16ビット解像度"
msgstr ""
"PWMのduty_cycle値は0から65535の間でなければなりません16ビット解像度"
#: shared-bindings/pwmio/PWMOut.c
msgid ""
@ -1367,10 +1398,6 @@ msgstr "いずれかのキーを押すとREPLに入ります。リロードはCT
msgid "Pull not used when direction is output."
msgstr "方向がoutputのときpullは使われません"
#: ports/stm/ref/pulseout-pre-timeralloc.c
msgid "PulseOut not supported on this chip"
msgstr "PulseOutはこのチップでサポートされていません"
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr "RNG解体エラー"
@ -1487,6 +1514,10 @@ msgstr "選択されたRTSピンが正しくありません"
msgid "Serializer in use"
msgstr "シリアライザは使用中"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "スライスと値の長さが一致しません"
@ -1595,6 +1626,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "サンプルのチャンネル数が多すぎます"
@ -1692,6 +1727,10 @@ msgstr "nvm に書き込みできません"
msgid "Unexpected nrfx uuid type"
msgstr "想定されていないnrfx UUID型"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1795,6 +1834,10 @@ msgid ""
"To list built-in modules please do `help(\"modules\")`.\n"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1909,7 +1952,7 @@ msgstr ""
msgid "bad format string"
msgstr "不正な書式化文字列"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "不正なtypecode"
@ -1962,6 +2005,10 @@ msgstr "byteorderが文字列ではありません"
msgid "bytes > 8 bits not supported"
msgstr ""
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "範囲外のバイト値"
@ -2483,6 +2530,10 @@ msgstr ""
msgid "initial values must be iterable"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
msgid "initial_value length is wrong"
msgstr ""
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "インラインアセンブラは関数でなければなりません"
@ -2675,6 +2726,10 @@ msgstr "正定値行列ではありません"
msgid "max_length must be 0-%d when fixed_length is %s"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
msgid "max_length must be > 0"
msgstr ""
#: py/runtime.c
msgid "maximum recursion depth exceeded"
msgstr "最大の再帰深度を超えました"
@ -2921,6 +2976,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "long intをマシンのwordに変換する際にオーバーフローしました"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "パレットの長さは32バイトでなければなりません"
@ -3024,7 +3084,8 @@ msgstr "rsplit(None,n)"
msgid ""
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
"'B'"
msgstr "sample_source バッファには bytearray または 'h','H','b','B'型のarrayが必要"
msgstr ""
"sample_source バッファには bytearray または 'h','H','b','B'型のarrayが必要"
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "sampling rate out of range"
@ -3394,6 +3455,16 @@ msgstr "ziはfloat値が必要"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "終了するには、次の操作をせずにリセットしてください: "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "PulseOutはこのチップでサポートされていません"
#~ msgid "Invalid I2C pin selection"
#~ msgstr "I2Cピンの選択が不正です"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -30,12 +30,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr " 파일 \"%q\""
@ -273,7 +267,7 @@ msgstr ""
msgid "A hardware interrupt channel is already in use"
msgstr ""
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr ""
@ -371,6 +365,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "자동 재 장전이 꺼져 있습니다\n"
@ -580,6 +578,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr ""
@ -1223,6 +1225,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1243,6 +1249,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1287,6 +1297,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -1483,6 +1497,10 @@ msgstr ""
msgid "Serializer in use"
msgstr ""
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr ""
@ -1583,6 +1601,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr ""
@ -1679,6 +1701,10 @@ msgstr ""
msgid "Unexpected nrfx uuid type"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1782,6 +1808,10 @@ msgid ""
"To list built-in modules please do `help(\"modules\")`.\n"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1896,7 +1926,7 @@ msgstr ""
msgid "bad format string"
msgstr ""
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr ""
@ -1949,6 +1979,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr ""
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr ""
@ -2914,6 +2948,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr ""
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr ""

View File

@ -5,16 +5,16 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"PO-Revision-Date: 2020-08-10 19:59+0000\n"
"Last-Translator: _fonzlate <vooralfred@gmail.com>\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-09-09 16:05+0000\n"
"Last-Translator: Jelle Jager <jell@jjc.id.au>\n"
"Language-Team: none\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.2-dev\n"
"X-Generator: Weblate 4.3-dev\n"
#: main.c
msgid ""
@ -34,14 +34,6 @@ msgstr ""
"Meld een probleem met de inhoud van de CIRCUITPY drive op:\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Om te verlaten, herstart de module zonder "
#: py/obj.c
msgid " File \"%q\""
msgstr " Bestand"
@ -279,7 +271,7 @@ msgstr "3-arg pow() niet ondersteund"
msgid "A hardware interrupt channel is already in use"
msgstr "Een hardware interrupt kanaal is al in gebruik"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "Adres moet %d bytes lang zijn"
@ -377,6 +369,10 @@ msgstr "Poging om %d blokken toe te wijzen"
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "heap allocatie geprobeerd terwijl MicroPython VM niet draait."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Auto-herlaad staat uit.\n"
@ -456,10 +452,8 @@ msgid "Buffer length must be a multiple of 512"
msgstr "Buffer lengte moet een veelvoud van 512 zijn"
#: ports/stm/common-hal/sdioio/SDCard.c
#, fuzzy
#| msgid "Buffer length must be a multiple of 512"
msgid "Buffer must be a multiple of 512 bytes"
msgstr "Buffer lengte moet een veelvoud van 512 zijn"
msgstr "Buffer moet een veelvoud van 512 zijn"
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
@ -502,7 +496,7 @@ msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic"
#: shared-bindings/_bleio/Adapter.c
msgid "Cannot create a new Adapter; use _bleio.adapter;"
msgstr ""
msgstr "Kan geen nieuwe Adapter creëren; gebruik _bleio.adapter;"
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
@ -592,6 +586,10 @@ msgstr ""
"CircuitPython is in veilige modus omdat de rest knop werd ingedrukt tijdens "
"het opstarten. Druk nogmaals om veilige modus te verlaten\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Clock pin init mislukt."
@ -662,10 +660,8 @@ msgid "Could not restart PWM"
msgstr "Kan PWM niet herstarten"
#: shared-bindings/_bleio/Adapter.c
#, fuzzy
#| msgid "Could not start PWM"
msgid "Could not set address"
msgstr "Kan PWM niet starten"
msgstr "Kan adres niet zetten"
#: ports/stm/common-hal/pwmio/PWMOut.c
msgid "Could not start PWM"
@ -778,7 +774,7 @@ msgstr "Verwachtte een Characteristic"
#: shared-bindings/_bleio/Adapter.c
msgid "Expected a DigitalInOut"
msgstr ""
msgstr "Verwachtte een DigitalInOut"
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
@ -786,7 +782,7 @@ msgstr "Verwachtte een Service"
#: shared-bindings/_bleio/Adapter.c
msgid "Expected a UART"
msgstr ""
msgstr "Verwachtte een UART"
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
#: shared-bindings/_bleio/Service.c
@ -860,7 +856,7 @@ msgstr "Bestand bestaat"
#: shared-module/framebufferio/FramebufferDisplay.c
#, c-format
msgid "Framebuffer requires %d bytes"
msgstr ""
msgstr "Framebuffer benodigd %d bytes"
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
msgid "Frequency captured is above capability. Capture Paused."
@ -957,10 +953,8 @@ msgstr "Ongeldige %q pin"
#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/sdioio/SDCard.c
#, fuzzy
#| msgid "Invalid I2C pin selection"
msgid "Invalid %q pin selection"
msgstr "Ongeldige I2C pin selectie"
msgstr "Ongeldige %q pin selectie"
#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
@ -1245,6 +1239,10 @@ msgstr "Geen lange integer ondersteuning"
msgid "No more timers available on this pin."
msgstr "Geen timers meer beschikbaar op deze pin."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Geen pulldown op pin; 1MOhm aangeraden"
@ -1265,6 +1263,10 @@ msgstr "Geen timer beschikbaar"
msgid "Nordic Soft Device failure assertion."
msgstr "Nordic Soft Device assertion mislukt."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1315,6 +1317,10 @@ msgstr ""
"Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's "
"zijn ondersteund: %d bpp is gegeven"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Oversample moet een meervoud van 8 zijn."
@ -1478,13 +1484,12 @@ msgstr "SDA of SCL hebben een pullup nodig"
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO GetCardInfo Error %d"
msgstr ""
msgstr "SDIO GetCardInfo Fout %d"
#: ports/stm/common-hal/sdioio/SDCard.c
#, fuzzy, c-format
#| msgid "SPI Init Error"
#, c-format
msgid "SDIO Init Error %d"
msgstr "SPI Init Fout"
msgstr "SDIO Init Fout %d"
#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
@ -1520,6 +1525,10 @@ msgstr "Geselecteerde RTS pin niet geldig"
msgid "Serializer in use"
msgstr "Serializer in gebruik"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Slice en waarde hebben verschillende lengtes."
@ -1630,6 +1639,10 @@ msgstr ""
"Timer is gereserveerd voor intern gebruik - wijs PWM pins eerder in het "
"programma toe"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Teveel kanalen in sample."
@ -1725,6 +1738,10 @@ msgstr "Niet in staat om naar nvm te schrijven."
msgid "Unexpected nrfx uuid type"
msgstr "Onverwacht mrfx uuid type"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1839,6 +1856,10 @@ msgstr ""
"\n"
"Voor een lijst van ingebouwde modules, gebruik `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "Schrijven niet ondersteund op Characteristic"
@ -1953,7 +1974,7 @@ msgstr "slechte conversie specificatie"
msgid "bad format string"
msgstr "string met verkeerde indeling"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "verkeerde typecode"
@ -2006,6 +2027,10 @@ msgstr "byteorder is geen string"
msgid "bytes > 8 bits not supported"
msgstr "butes > 8 niet ondersteund"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "bytes waarde buiten bereik"
@ -2731,7 +2756,7 @@ msgstr "max_length moet 0-%d zijn als fixed_length %s is"
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
msgid "max_length must be > 0"
msgstr ""
msgstr "max_length moet >0 zijn"
#: py/runtime.c
msgid "maximum recursion depth exceeded"
@ -2979,6 +3004,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "overloop bij converteren van long int naar machine word"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "palette moet 32 bytes lang zijn"
@ -3455,6 +3485,13 @@ msgstr "zi moet van type float zijn"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi moet vorm (n_section, 2) hebben"
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Om te verlaten, herstart de module zonder "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "PulseOut niet ondersteund door deze chip"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@ -30,12 +30,6 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr " Plik \"%q\""
@ -273,7 +267,7 @@ msgstr "3-argumentowy pow() jest niewspierany"
msgid "A hardware interrupt channel is already in use"
msgstr "Kanał przerwań sprzętowych w użyciu"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "Adres musi mieć %d bajtów"
@ -371,6 +365,10 @@ msgstr ""
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Samo-przeładowywanie wyłączone.\n"
@ -580,6 +578,10 @@ msgid ""
"boot. Press again to exit safe mode.\n"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Nie powiodło się ustawienie nóżki zegara"
@ -1225,6 +1227,10 @@ msgstr ""
msgid "No more timers available on this pin."
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
@ -1245,6 +1251,10 @@ msgstr ""
msgid "Nordic Soft Device failure assertion."
msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1289,6 +1299,10 @@ msgid ""
"%d bpp given"
msgstr ""
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Nadpróbkowanie musi być wielokrotnością 8."
@ -1485,6 +1499,10 @@ msgstr ""
msgid "Serializer in use"
msgstr "Serializator w użyciu"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Fragment i wartość są różnych długości."
@ -1585,6 +1603,10 @@ msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "By wyjść, proszę zresetować płytkę bez "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Zbyt wiele kanałów."
@ -1680,6 +1702,10 @@ msgstr "Błąd zapisu do NVM."
msgid "Unexpected nrfx uuid type"
msgstr "Nieoczekiwany typ nrfx uuid."
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1786,6 +1812,10 @@ msgstr ""
"Podręczniki dostępne na learn.adafruit.com/category/circuitpyhon.\n"
"Aby zobaczyć wbudowane moduły, wpisz `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
@ -1900,7 +1930,7 @@ msgstr "zły specyfikator konwersji"
msgid "bad format string"
msgstr "zła specyfikacja formatu"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "zły typecode"
@ -1953,6 +1983,10 @@ msgstr ""
msgid "bytes > 8 bits not supported"
msgstr "bajty większe od 8 bitów są niewspierane"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "wartość bytes poza zakresem"
@ -1971,7 +2005,7 @@ msgstr "wartość kalibracji poza zakresem +/-127"
#: py/emitinlinethumb.c
msgid "can only have up to 4 parameters to Thumb assembly"
msgstr "asembler Thumb może przyjąć do 4 parameterów"
msgstr "asembler Thumb może przyjąć do 4 parameterów"
#: py/emitinlinextensa.c
msgid "can only have up to 4 parameters to Xtensa assembly"
@ -2919,6 +2953,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "przepełnienie przy konwersji long in to słowa maszynowego"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "paleta musi mieć 32 bajty długości"
@ -3562,7 +3601,7 @@ msgstr ""
#~ msgstr "Nie udało się odkryć serwisów"
#~ msgid "Failed to get local address"
#~ msgstr "Nie udało się uzyskać lokalnego adresu"
#~ msgstr "Nie udało się uzyskać lokalnego adresu"
#~ msgid "Failed to get softdevice state"
#~ msgstr "Nie udało się odczytać stanu softdevice"
@ -3610,7 +3649,7 @@ msgstr ""
#~ msgstr "Nie udało się zapisać gatts, błąd 0x%04x"
#~ msgid "Flash erase failed"
#~ msgstr "Nie udało się skasować flash"
#~ msgstr "Nie udało się skasować flash"
#~ msgid "Flash erase failed to start, err 0x%04x"
#~ msgstr "Nie udało się rozpocząć kasowania flash, błąd 0x%04x"
@ -3703,9 +3742,6 @@ msgstr ""
#~ msgid "Tile indices must be 0 - 255"
#~ msgstr "Indeks kafelka musi być pomiędzy 0 a 255 włącznie"
#~ msgid "To exit, please reset the board without "
#~ msgstr "By wyjść, proszę zresetować płytkę bez "
#~ msgid "UUID integer value not in range 0 to 0xffff"
#~ msgstr "Wartość UUID poza zakresem 0 do 0xffff"

View File

@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"PO-Revision-Date: 2020-09-02 22:32+0000\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-09-12 17:32+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -34,14 +34,6 @@ msgstr ""
"Registre um problema com o conteúdo do seu controlador no CIRCUITPY\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Para encerrar, redefina a placa sem "
#: py/obj.c
msgid " File \"%q\""
msgstr " Arquivo \"%q\""
@ -283,7 +275,7 @@ msgstr "3-arg pow() não compatível"
msgid "A hardware interrupt channel is already in use"
msgstr "Um canal de interrupção de hardware já está em uso"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "O endereço deve ter %d bytes de comprimento"
@ -383,6 +375,10 @@ msgstr ""
"A tentativa da área de alocação dinâmica de variáveis (heap) quando o "
"MicroPython VM não está em execução."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr "Houve um falha na autenticação"
#: main.c
msgid "Auto-reload is off.\n"
msgstr "A atualização automática está desligada.\n"
@ -600,6 +596,10 @@ msgstr ""
"redefinição durante a inicialização. Pressione novamente para sair do modo "
"de segurança.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr "O CircuitPython não conseguiu alocar o heap.\n"
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Inicialização do pino de Clock falhou."
@ -1248,6 +1248,10 @@ msgstr "Não há compatibilidade com inteiro longo"
msgid "No more timers available on this pin."
msgstr "Não há mais temporizadores disponíveis neste pino."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr "Não há rede com este ssid"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Não há pulldown no pino; É recomendável utilizar um resistor de 1M ohm"
@ -1268,6 +1272,10 @@ msgstr "Não há um temporizador disponível"
msgid "Nordic Soft Device failure assertion."
msgstr "Declaração de falha do dispositivo Nordic Soft."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr "Não é uma sequência válida de IP"
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1317,6 +1325,10 @@ msgstr ""
"São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e "
"16bpp ou superior: determinado %d bpp"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr "Apenas o int bruto é compatível para o ip"
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "A superamostragem deve ser um múltiplo de 8."
@ -1525,6 +1537,10 @@ msgstr "O pino RTS selecionado é inválido"
msgid "Serializer in use"
msgstr "Serializer em uso"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr "O contexto do lado do servidor não pode ter nome de host"
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Fatie e avalie os diferentes comprimentos."
@ -1638,6 +1654,10 @@ msgstr ""
"O temporizador foi reservado para uso interno - declare os pinos PWM no "
"início do programa"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Para sair, por favor, reinicie a placa sem "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Muitos canais na amostra."
@ -1734,6 +1754,10 @@ msgstr "Não é possível gravar no nvm."
msgid "Unexpected nrfx uuid type"
msgstr "Tipo uuid nrfx inesperado"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr "Falha desconhecida"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1849,6 +1873,10 @@ msgstr ""
"\n"
"Para listar os módulos internos, faça `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "A escrita não é compatível na Característica"
@ -1963,7 +1991,7 @@ msgstr "especificador de conversão incorreto"
msgid "bad format string"
msgstr "formato da string incorreta"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "typecode incorreto"
@ -2016,6 +2044,10 @@ msgstr "a ordem dos bytes não é uma cadeia de caracteres"
msgid "bytes > 8 bits not supported"
msgstr "bytes > 8 bits não suportado"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "o valor dos bytes estão fora do alcance"
@ -3001,6 +3033,11 @@ msgstr ""
"houve um transbordamento durante a conversão int longo para a palavra de "
"máquina"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "a paleta deve ter 32 bytes de comprimento"
@ -3476,6 +3513,13 @@ msgstr "zi deve ser de um tipo float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Para encerrar, redefina a placa sem "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "O PulseOut não é compatível neste CI"
@ -3799,9 +3843,6 @@ msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "STA required"
#~ msgstr "STA requerido"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Para sair, por favor, reinicie a placa sem "
#~ msgid "UART(%d) does not exist"
#~ msgstr "UART(%d) não existe"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2020-09-07 19:36+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -34,14 +34,6 @@ msgstr ""
"Vänligen skapa ett ärende med innehållet i din CIRCUITPY-enhet på\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"För att avsluta, gör reset på kortet utan "
#: py/obj.c
msgid " File \"%q\""
msgstr " Filen \"%q\""
@ -279,7 +271,7 @@ msgstr "3-arguments pow() stöds inte"
msgid "A hardware interrupt channel is already in use"
msgstr "En kanal för hårdvaruavbrott används redan"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "Adressen måste vara %d byte lång"
@ -377,6 +369,10 @@ msgstr "Försök att tilldela %d block"
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "Försökte tilldela heap när MicroPython VM inte körs."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Autoladdning är avstängd.\n"
@ -590,6 +586,10 @@ msgstr ""
"CircuitPython är i säkert läge eftersom du tryckte på återställningsknappen "
"under start. Tryck igen för att lämna säkert läge.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Initiering av klockpinne misslyckades."
@ -1238,6 +1238,10 @@ msgstr "Inget stöd för långt heltal"
msgid "No more timers available on this pin."
msgstr "Inga fler timers tillgängliga på denna pinne."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Ingen pulldown på pinnen; 1Mohm rekommenderas"
@ -1258,6 +1262,10 @@ msgstr "Ingen timer tillgänglig"
msgid "Nordic Soft Device failure assertion."
msgstr "Påståendet om Nordic Soft Device-fel."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1307,6 +1315,10 @@ msgstr ""
"Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er "
"stöds: %d bpp angiven"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Översampling måste vara multipel av 8."
@ -1511,6 +1523,10 @@ msgstr "Vald CTS-pinne är inte giltig"
msgid "Serializer in use"
msgstr "Serializern används redan"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Slice och värde har olika längd."
@ -1621,6 +1637,10 @@ msgstr ""
"Timern är reserverad för internt bruk - deklarera PWM-pinne tidigare i "
"programmet"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "För många kanaler i sampling."
@ -1716,6 +1736,10 @@ msgstr "Det gick inte att skriva till nvm."
msgid "Unexpected nrfx uuid type"
msgstr "Oväntad nrfx uuid-typ"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1827,6 +1851,10 @@ msgstr ""
"\n"
"För att lista inbyggda moduler, ange `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "Skrivning stöds inte på karaktäristik"
@ -1941,7 +1969,7 @@ msgstr "Ogiltig konverteringsspecifikation"
msgid "bad format string"
msgstr "Ogiltig formatsträng"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "Ogiltig typkod"
@ -1994,6 +2022,10 @@ msgstr "byteorder är inte en sträng"
msgid "bytes > 8 bits not supported"
msgstr "bytes> 8 bitar stöds inte"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "bytevärde utanför intervallet"
@ -2967,6 +2999,11 @@ msgstr "utanför räckvidd för target"
msgid "overflow converting long int to machine word"
msgstr "Konvertering av long int till machine word överskred maxvärde"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "palette måste vara 32 bytes lång"
@ -3443,6 +3480,13 @@ msgstr "zi måste vara av typ float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "För att avsluta, gör reset på kortet utan "
#~ msgid "PulseOut not supported on this chip"
#~ msgstr "PulseIn stöds inte av detta chip"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-30 14:38-0400\n"
"POT-Creation-Date: 2020-09-13 14:21-0500\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -34,14 +34,6 @@ msgstr ""
"Qǐng tōngguò https://github.com/adafruit/circuitpython/issues\n"
"tíjiāo yǒuguān nín de CIRCUITPY qūdòngqì nèiróng de wèntí \n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
"\n"
"Qǐng zài méiyǒu _ de qíngkuàng xià chóng zhì bǎn zǐ yǐ tuìchū "
#: py/obj.c
msgid " File \"%q\""
msgstr " Wénjiàn \"%q\""
@ -280,7 +272,7 @@ msgstr "bù zhīchí 3-arg pow ()"
msgid "A hardware interrupt channel is already in use"
msgstr "Yìngjiàn zhōngduàn tōngdào yǐ zài shǐyòng zhōng"
#: shared-bindings/_bleio/Address.c
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, c-format
msgid "Address must be %d bytes long"
msgstr "Dìzhǐ bìxū shì %d zì jié zhǎng"
@ -378,6 +370,10 @@ msgstr "cháng shì fēn pèi %d kuài"
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "MicroPython VM zài wèi yùnxíng shí chángshì fēnpèi duī."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
#: main.c
msgid "Auto-reload is off.\n"
msgstr "Zìdòng chóngxīn jiāzài yǐ guānbì.\n"
@ -589,6 +585,10 @@ msgstr ""
"CircuitPython chǔyú ānquán móshì, yīnwèi zài yǐndǎo guòchéng zhōng àn xiàle "
"chóng zhì ànniǔ. Zài àn yīcì tuìchū ānquán móshì.\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Shízhōng de yǐn jiǎo chūshǐhuà shībài."
@ -1234,6 +1234,10 @@ msgstr "Méiyǒu zhǎng zhěngshù zhīchí"
msgid "No more timers available on this pin."
msgstr "Gāi yǐn jiǎo shàng méiyǒu kěyòng de dìngshí qì."
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr "Yǐn jiǎo shàng méiyǒu xiàlā; 1Mohm tuījiàn"
@ -1254,6 +1258,10 @@ msgstr "Méiyǒu jìshí qì"
msgid "Nordic Soft Device failure assertion."
msgstr "Nordic ruǎn shèbèi gùzhàng shēngmíng."
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1303,6 +1311,10 @@ msgstr ""
"Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: "
"Gěi chū %d bpp"
#: shared-bindings/ipaddress/__init__.c
msgid "Only raw int supported for ip"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Guò cǎiyàng bìxū shì 8 de bèishù."
@ -1503,6 +1515,10 @@ msgstr "Suǒ xuǎn de RTS yǐn jiǎo wúxiào"
msgid "Serializer in use"
msgstr "Xùliè huà yǐjīng shǐyòngguò"
#: shared-bindings/ssl/SSLContext.c
msgid "Server side context cannot have hostname"
msgstr ""
#: shared-bindings/nvm/ByteArray.c
msgid "Slice and value different lengths."
msgstr "Qiēpiàn hé zhí bùtóng chángdù."
@ -1612,6 +1628,10 @@ msgstr ""
"Dìngshí qì bǎoliú gōng nèibù shǐyòng-zài chéngxù de qiánmiàn shēngmíng PWM "
"yǐn jiǎo"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Yào tuìchū, qǐng chóng zhì bǎnkuài ér bùyòng "
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr "Chōuyàng zhōng de píndào tài duō."
@ -1707,6 +1727,10 @@ msgstr "Wúfǎ xiě rù nvm."
msgid "Unexpected nrfx uuid type"
msgstr "Yìwài de nrfx uuid lèixíng"
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
@ -1818,6 +1842,10 @@ msgstr ""
"\n"
"Ruò yào liè chū nèizài de mókuài, qǐng qǐng zuò yǐxià `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr "Tèzhēng bù zhīchí xiě rù"
@ -1932,7 +1960,7 @@ msgstr "cuòwù zhuǎnhuàn biāozhù"
msgid "bad format string"
msgstr "géshì cuòwù zìfú chuàn"
#: py/binary.c
#: py/binary.c py/objarray.c
msgid "bad typecode"
msgstr "cuòwù de dàimǎ lèixíng"
@ -1985,6 +2013,10 @@ msgstr "byteorder bùshì zìfú chuàn"
msgid "bytes > 8 bits not supported"
msgstr "zì jié > 8 wèi"
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
#: py/objstr.c
msgid "bytes value out of range"
msgstr "zì jié zhí chāochū fànwéi"
@ -2956,6 +2988,11 @@ msgstr ""
msgid "overflow converting long int to machine word"
msgstr "chāo gāo zhuǎnhuàn zhǎng zhěng shùzì shí"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr ""
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr "yánsè bìxū shì 32 gè zì jié"
@ -3431,6 +3468,13 @@ msgstr "zi bìxū wèi fú diǎn xíng"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
#~ msgid ""
#~ "\n"
#~ "To exit, please reset the board without "
#~ msgstr ""
#~ "\n"
#~ "Qǐng zài méiyǒu _ de qíngkuàng xià chóng zhì bǎn zǐ yǐ tuìchū "
#~ msgid "tuple/list required on RHS"
#~ msgstr "RHS yāoqiú de yuán zǔ/lièbiǎo"
@ -3806,9 +3850,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
#~ msgid "Tile indices must be 0 - 255"
#~ msgstr "Píng pū zhǐshù bìxū wèi 0 - 255"
#~ msgid "To exit, please reset the board without "
#~ msgstr "Yào tuìchū, qǐng chóng zhì bǎnkuài ér bùyòng "
#~ msgid "UUID integer value not in range 0 to 0xffff"
#~ msgstr "UUID zhěngshù zhí bùzài fànwéi 0 zhì 0xffff"

View File

@ -255,7 +255,7 @@ SRC_ASF += \
hal/src/hal_mci_sync.c \
hpl/sdhc/hpl_sdhc.c \
$(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align
$(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align -Wno-implicit-fallthrough
endif
$(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sercom/hpl_sercom.o: CFLAGS += -Wno-maybe-uninitialized

View File

@ -25,7 +25,7 @@
#define CALIBRATE_CRYSTALLESS 1
// Explanation of how a user got into safe mode.
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up.\n"
// Increase stack size slightly due to CPX library import nesting
#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) //divisible by 8

View File

@ -27,7 +27,7 @@
#define USER_NEOPIXELS_PIN (&pin_PB23)
// Explanation of how a user got into safe mode.
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up.\n"
// Increase stack size slightly due to CPX library import nesting
#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8

View File

@ -25,7 +25,7 @@
#define CALIBRATE_CRYSTALLESS 1
// Explanation of how a user got into safe mode.
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up.\n"
// Increase stack size slightly due to CPX library import nesting.
#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8

View File

@ -11,7 +11,7 @@
#define CALIBRATE_CRYSTALLESS 1
// Explanation of how a user got into safe mode.
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up.\n"
#define DEFAULT_I2C_BUS_SCL (&pin_PA08)
#define DEFAULT_I2C_BUS_SDA (&pin_PA09)

View File

@ -10,4 +10,21 @@ INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
# A number of modules are removed for RFM69 to make room for frozen libraries.
# Many I/O functions are not available.
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_NEOPIXEL_WRITE = 1
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_USB_HID = 0
CIRCUITPY_TOUCHIO = 0
CFLAGS_INLINE_LIMIT = 35
# Make more room.
SUPEROPT_GC = 0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM69

View File

@ -16,8 +16,6 @@
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define EXTERNAL_FLASH_QSPI_DUAL
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)

View File

@ -11,7 +11,7 @@
#define CALIBRATE_CRYSTALLESS 1
// Explanation of how a user got into safe mode.
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up.\n"
#define DEFAULT_I2C_BUS_SCL (&pin_PA01)
#define DEFAULT_I2C_BUS_SDA (&pin_PA00)

View File

@ -0,0 +1,43 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "common-hal/microcontroller/Pin.h"
#include "supervisor/shared/board.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
gpio_set_pin_function(PIN_PA18, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(PIN_PA18, GPIO_DIRECTION_OUT);
gpio_set_pin_level(PIN_PA18, true); // Turn on neopixel by default
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,55 @@
#define MICROPY_HW_BOARD_NAME "Adafruit QT Py M0"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_NEOPIXEL (&pin_PA19)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define IGNORE_PIN_PA00 1
#define IGNORE_PIN_PA01 1
#define IGNORE_PIN_PA09 1
#define IGNORE_PIN_PA12 1
#define IGNORE_PIN_PA13 1
#define IGNORE_PIN_PA20 1
#define IGNORE_PIN_PA21 1
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define IGNORE_PIN_PA27 1
#define IGNORE_PIN_PA28 1
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1
#define IGNORE_PIN_PB01 1
#define IGNORE_PIN_PB02 1
#define IGNORE_PIN_PB03 1
#define IGNORE_PIN_PB04 1
#define IGNORE_PIN_PB05 1
#define IGNORE_PIN_PB06 1
#define IGNORE_PIN_PB07 1
#define IGNORE_PIN_PB08 1
#define IGNORE_PIN_PB09 1
#define IGNORE_PIN_PB10 1
#define IGNORE_PIN_PB11 1
#define IGNORE_PIN_PB12 1
#define IGNORE_PIN_PB13 1
#define IGNORE_PIN_PB14 1
#define IGNORE_PIN_PB15 1
#define IGNORE_PIN_PB16 1
#define IGNORE_PIN_PB17 1
#define IGNORE_PIN_PB22 1
#define IGNORE_PIN_PB23 1
#define IGNORE_PIN_PB30 1
#define IGNORE_PIN_PB31 1
#define IGNORE_PIN_PB00 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
#define DEFAULT_I2C_BUS_SDA (&pin_PA16)
#define DEFAULT_SPI_BUS_SCK (&pin_PA11)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA08)
#define DEFAULT_SPI_BUS_MISO (&pin_PA10)
#define DEFAULT_UART_BUS_RX (&pin_PA07)
#define DEFAULT_UART_BUS_TX (&pin_PA06)

View File

@ -0,0 +1,24 @@
USB_VID = 0x239A
USB_PID = 0x80CC
USB_PRODUCT = "QT Py M0"
USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), de_DE)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
SUPEROPT_VM = 0
endif

View File

@ -0,0 +1,49 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -106,6 +106,10 @@ void reset_all_pins(void) {
}
void never_reset_pin_number(uint8_t pin_number) {
if (pin_number >= PORT_BITS) {
return;
}
never_reset_pins[GPIO_PORT(pin_number)] |= 1 << GPIO_PIN(pin_number);
}

View File

@ -3,7 +3,10 @@
cmake_minimum_required(VERSION 3.13)
set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)
set(COMPONENTS esptool_py soc driver log main)
# 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_netif esp_wifi lwip wpa_supplicant freertos)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(circuitpython)

View File

@ -78,10 +78,19 @@ INC += -Iesp-idf/components/freertos/xtensa/include
INC += -Iesp-idf/components/esp32s2/include
INC += -Iesp-idf/components/xtensa/esp32s2/include
INC += -Iesp-idf/components/esp_common/include
INC += -Iesp-idf/components/esp_event/include
INC += -Iesp-idf/components/esp_netif/include
INC += -Iesp-idf/components/esp_ringbuf/include
INC += -Iesp-idf/components/esp_rom/include
INC += -Iesp-idf/components/esp_wifi/include
INC += -Iesp-idf/components/xtensa/include
INC += -Iesp-idf/components/esp_timer/include
INC += -Iesp-idf/components/mbedtls/mbedtls/include
INC += -Iesp-idf/components/mbedtls/port/include/
INC += -Iesp-idf/components/newlib/platform_include
INC += -Iesp-idf/components/lwip/lwip/src/include
INC += -Iesp-idf/components/lwip/port/esp32/include
INC += -Iesp-idf/components/lwip/include/apps/sntp
INC += -Iesp-idf/components/soc/include
INC += -Iesp-idf/components/soc/src/esp32s2/include
INC += -Iesp-idf/components/soc/soc/include
@ -125,11 +134,12 @@ LDFLAGS += -L$(BUILD)/esp-idf/esp-idf/esp32s2 \
-Tesp32s2.peripherals.ld \
-Lesp-idf/components/esp_rom/esp32s2/ld \
-Tesp32s2.rom.ld \
-Tesp32s2.rom.api.ld \
-Tesp32s2.rom.libgcc.ld \
-Tesp32s2.rom.newlib-data.ld \
-Tesp32s2.rom.newlib-funcs.ld \
-Tesp32s2.rom.spiflash.ld
LIBS := -lgcc -lc
LIBS := -lgcc -lc -lstdc++
#
@ -156,6 +166,7 @@ SRC_C += \
background.c \
fatfs_port.c \
mphalport.c \
bindings/espidf/__init__.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
modules/$(CIRCUITPY_MODULE).c \
@ -238,20 +249,25 @@ $(BUILD)/esp-idf/partition_table/partition-table.bin: $(BUILD)/esp-idf/config/sd
# run menuconfig
menuconfig: $(BUILD)/esp-idf/config
ninja -C $(BUILD)/esp-idf menuconfig
diff --old-line-format= --unchanged-line-format= sdkconfig.defaults $(BUILD)/esp-idf/sdkconfig > boards/$(BOARD)/sdkconfig || true
$(Q)ninja -C $(BUILD)/esp-idf menuconfig
$(Q)diff --old-line-format= --unchanged-line-format= sdkconfig.defaults $(BUILD)/esp-idf/sdkconfig > boards/$(BOARD)/sdkconfig || true
# qstr builds include headers so we need to make sure they are up to date
$(HEADER_BUILD)/qstr.i.last: | $(BUILD)/esp-idf/config/sdkconfig.h
# Order here matters
ESP_IDF_COMPONENTS_LINK = freertos log esp_system esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf #
ESP_IDF_COMPONENTS_LINK = freertos log esp_system esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp_rom esp-tls
ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc
INC += $(foreach component, $(ESP_IDF_COMPONENTS_INCLUDE), -Iesp-idf/components/$(component)/include)
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
MBEDTLS_COMPONENTS_LINK = crypto tls x509
MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a)
BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libhal.a
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a
BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS))
@ -265,18 +281,27 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
.PHONY: esp-idf-stamp
esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
ninja -C $(BUILD)/esp-idf \
$(Q)ninja -C $(BUILD)/esp-idf \
bootloader/bootloader.bin \
esp-idf/bootloader_support/libbootloader_support.a \
esp-idf/esp-tls/libesp-tls.a \
esp-idf/esp32s2/ld/esp32s2.project.ld \
esp-idf/esp_event/libesp_event.a \
esp-idf/esp_netif/libesp_netif.a \
esp-idf/esp_rom/libesp_rom.a \
esp-idf/esp_system/libesp_system.a \
esp-idf/esp_wifi/libesp_wifi.a \
esp-idf/lwip/liblwip.a \
esp-idf/nvs_flash/libnvs_flash.a \
esp-idf/wpa_supplicant/libwpa_supplicant.a \
esp-idf/mbedtls/libmbedtls.a \
esp-idf/freertos/libfreertos.a \
esp-idf/log/liblog.a \
esp-idf/xtensa/libxtensa.a
$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp
$(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $^ $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group build-$(BOARD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception
# $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld
$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf

View File

@ -0,0 +1,110 @@
/*
* 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 "py/obj.h"
#include "py/runtime.h"
#include "bindings/espidf/__init__.h"
#include "esp-idf/components/heap/include/esp_heap_caps.h"
//| """Direct access to a few ESP-IDF details. This module *should not* include any functionality
//| that could be implemented by other frameworks. It should only include ESP-IDF specific
//| things."""
//| def heap_caps_get_total_size() -> int:
//| """Return the total size of the ESP-IDF, which includes the CircuitPython heap."""
//| ...
//|
STATIC mp_obj_t espidf_heap_caps_get_total_size(void) {
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_total_size(MALLOC_CAP_8BIT));
}
MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_total_size_obj, espidf_heap_caps_get_total_size);
//| def heap_caps_get_free_size() -> int:
//| """Return total free memory in the ESP-IDF heap."""
//| ...
//|
STATIC mp_obj_t espidf_heap_caps_get_free_size(void) {
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_free_size_obj, espidf_heap_caps_get_free_size);
//| def heap_caps_get_largest_free_block() -> int:
//| """Return the size of largest free memory block in the ESP-IDF heap."""
//| ...
//|
STATIC mp_obj_t espidf_heap_caps_get_largest_free_block(void) {
return MP_OBJ_NEW_SMALL_INT(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT));
}
MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_heap_caps_get_largest_free_block);
//| class MemoryError(MemoryError):
//| """Raised when an ESP IDF memory allocation fails."""
//| ...
//|
NORETURN void mp_raise_espidf_MemoryError(void) {
nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError));
}
void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS;
bool is_subclass = kind & PRINT_EXC_SUBCLASS;
if (!is_subclass && (k == PRINT_EXC)) {
mp_print_str(print, qstr_str(MP_OBJ_QSTR_VALUE(MP_ROM_QSTR(MP_QSTR_espidf))));
mp_print_str(print, ".");
}
mp_obj_exception_print(print, o_in, kind);
}
const mp_obj_type_t mp_type_espidf_MemoryError = {
{ &mp_type_type },
.name = MP_QSTR_MemoryError,
.print = espidf_exception_print,
.make_new = mp_obj_exception_make_new,
.attr = mp_obj_exception_attr,
.parent = &mp_type_MemoryError,
};
STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espidf) },
{ MP_ROM_QSTR(MP_QSTR_heap_caps_get_total_size), MP_ROM_PTR(&espidf_heap_caps_get_total_size_obj)},
{ MP_ROM_QSTR(MP_QSTR_heap_caps_get_free_size), MP_ROM_PTR(&espidf_heap_caps_get_free_size_obj)},
{ MP_ROM_QSTR(MP_QSTR_heap_caps_get_largest_free_block), MP_ROM_PTR(&espidf_heap_caps_get_largest_free_block_obj)},
{ MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_espidf_MemoryError) },
};
STATIC MP_DEFINE_CONST_DICT(espidf_module_globals, espidf_module_globals_table);
const mp_obj_module_t espidf_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&espidf_module_globals,
};

View File

@ -0,0 +1,34 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H
#define MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H
extern const mp_obj_type_t mp_type_espidf_MemoryError;
NORETURN void mp_raise_espidf_MemoryError(void);
#endif // MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H

View File

@ -29,4 +29,8 @@
#define MICROPY_HW_BOARD_NAME "BastWiFi"
#define MICROPY_HW_MCU_NAME "ESP32S2"
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n"
#define AUTORESET_DELAY_MS 500

View File

@ -31,4 +31,8 @@
#define MICROPY_HW_NEOPIXEL (&pin_GPIO45)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n"
#define AUTORESET_DELAY_MS 500

View File

@ -31,4 +31,8 @@
#define MICROPY_HW_NEOPIXEL (&pin_GPIO18)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n"
#define AUTORESET_DELAY_MS 500

View File

@ -31,4 +31,8 @@
#define MICROPY_HW_NEOPIXEL (&pin_GPIO18)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n"
#define AUTORESET_DELAY_MS 500

View File

@ -32,4 +32,8 @@
#define MICROPY_HW_LED (&pin_GPIO21)
#define MICROPY_HW_NEOPIXEL (&pin_GPIO33)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n"
#define AUTORESET_DELAY_MS 500

View File

@ -29,6 +29,10 @@
#define MICROPY_HW_BOARD_NAME "FeatherS2"
#define MICROPY_HW_MCU_NAME "ESP32S2"
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n"
#define AUTORESET_DELAY_MS 500
// Doesn't work with this on.

View File

@ -45,6 +45,9 @@ bool apa102_mosi_in_use;
bool apa102_sck_in_use;
void never_reset_pin_number(gpio_num_t pin_number) {
if (pin_number == -1 ) {
return;
}
never_reset_pins[pin_number / 32] |= 1 << pin_number % 32;
}
@ -54,6 +57,9 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) {
// Mark pin as free and return it to a quiescent state.
void reset_pin_number(gpio_num_t pin_number) {
if (pin_number == -1 ) {
return;
}
never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32);
in_use[pin_number / 32] &= ~(1 << pin_number % 32);

View File

@ -0,0 +1,139 @@
/*
* 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 "shared-bindings/socketpool/Socket.h"
#include "bindings/espidf/__init__.h"
#include "lib/utils/interrupt_char.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include "supervisor/shared/tick.h"
void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms) {
self->timeout_ms = timeout_ms;
}
bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, mp_uint_t hostlen, mp_int_t port) {
// For simplicity we use esp_tls for all TCP connections. If it's not SSL, ssl_context will be
// NULL and should still work. This makes regular TCP connections more memory expensive but TLS
// should become more and more common. Therefore, we optimize for the TLS case.
esp_tls_cfg_t* tls_config = NULL;
if (self->ssl_context != NULL) {
tls_config = &self->ssl_context->ssl_config;
}
int result = esp_tls_conn_new_sync(host, hostlen, port, tls_config, self->tcp);
self->connected = result >= 0;
if (result < 0) {
int esp_tls_code;
int flags;
esp_err_t err = esp_tls_get_and_clear_last_error(self->tcp->error_handle, &esp_tls_code, &flags);
if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) {
mp_raise_espidf_MemoryError();
} else if (ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED) {
mp_raise_OSError_msg_varg(translate("Failed SSL handshake"));
} else {
mp_raise_OSError_msg_varg(translate("Unhandled ESP TLS error %d %d %x %d"), esp_tls_code, flags, err, result);
}
}
return self->connected;
}
bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self) {
return self->connected;
}
mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) {
size_t sent = esp_tls_conn_write(self->tcp, buf, len);
if (sent < 0) {
mp_raise_OSError(MP_ENOTCONN);
}
return sent;
}
mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len) {
size_t received = 0;
ssize_t last_read = 1;
uint64_t start_ticks = supervisor_ticks_ms64();
int sockfd;
esp_err_t err = esp_tls_get_conn_sockfd(self->tcp, &sockfd);
if (err != ESP_OK) {
mp_raise_OSError(MP_EBADF);
}
while (received < len &&
last_read > 0 &&
(self->timeout_ms == 0 || supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) &&
!mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
size_t available = esp_tls_get_bytes_avail(self->tcp);
if (available == 0) {
// This reads the raw socket buffer and is used for non-TLS connections
// and between encrypted TLS blocks.
int status = lwip_ioctl(sockfd, FIONREAD, &available);
if (status < 0) {
last_read = status;
break;
}
}
size_t remaining = len - received;
if (available > remaining) {
available = remaining;
}
if (available > 0) {
last_read = esp_tls_conn_read(self->tcp, (void*) buf + received, available);
received += last_read;
}
}
if (last_read == 0) {
// socket closed
common_hal_socketpool_socket_close(self);
}
if (last_read < 0) {
mp_raise_BrokenPipeError();
}
return received;
}
void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) {
self->connected = false;
if (self->tcp != NULL) {
esp_tls_conn_destroy(self->tcp);
self->tcp = NULL;
}
}
bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self) {
return self->tcp == NULL;
}
mp_uint_t common_hal_socketpool_socket_get_hash(socketpool_socket_obj_t* self) {
return self->num;
}

View File

@ -0,0 +1,47 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKET_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKET_H
#include "py/obj.h"
#include "common-hal/socketpool/SocketPool.h"
#include "common-hal/ssl/SSLContext.h"
#include "esp-idf/components/esp-tls/esp_tls.h"
typedef struct {
mp_obj_base_t base;
int num;
bool connected;
esp_tls_t* tcp;
ssl_sslcontext_obj_t* ssl_context;
socketpool_socketpool_obj_t* pool;
mp_uint_t timeout_ms;
} socketpool_socket_obj_t;
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKET_H

View File

@ -0,0 +1,117 @@
/*
* 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 "shared-bindings/socketpool/SocketPool.h"
#include "py/runtime.h"
#include "shared-bindings/wifi/__init__.h"
#include "esp-idf/components/lwip/lwip/src/include/lwip/netdb.h"
#include "bindings/espidf/__init__.h"
void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t* self, mp_obj_t radio) {
if (radio != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) {
mp_raise_ValueError(translate("SocketPool can only be used with wifi.radio"));
}
}
socketpool_socket_obj_t* common_hal_socketpool_socket(socketpool_socketpool_obj_t* self,
socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type) {
int addr_family;
int ipproto;
if (family == SOCKETPOOL_AF_INET) {
addr_family = AF_INET;
ipproto = IPPROTO_IP;
} else { // INET6
addr_family = AF_INET6;
ipproto = IPPROTO_IPV6;
}
int socket_type;
if (type == SOCKETPOOL_SOCK_STREAM) {
socket_type = SOCK_STREAM;
} else if (type == SOCKETPOOL_SOCK_DGRAM) {
socket_type = SOCK_DGRAM;
} else { // SOCKETPOOL_SOCK_RAW
socket_type = SOCK_RAW;
}
if (socket_type == SOCK_DGRAM || socket_type == SOCK_RAW ||
addr_family == AF_INET6 || ipproto == IPPROTO_IPV6) {
mp_raise_NotImplementedError(translate("Only IPv4 SOCK_STREAM sockets supported"));
}
int socknum = -1;
esp_tls_t* tcp_handle = NULL;
if (socket_type == SOCK_DGRAM || socket_type == SOCK_RAW) {
// socknum = lwip_socket(addr_family, socket_type, ipproto);
} else {
tcp_handle = esp_tls_init();
if (tcp_handle == NULL) {
mp_raise_espidf_MemoryError();
}
}
if (socknum < 0 && tcp_handle == NULL) {
mp_raise_RuntimeError(translate("Out of sockets"));
}
socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t);
sock->base.type = &socketpool_socket_type;
sock->num = socknum;
sock->tcp = tcp_handle;
sock->ssl_context = NULL;
sock->pool = self;
return sock;
}
mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t* self,
const char* host) {
const struct addrinfo hints = {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo *res;
int err = getaddrinfo(host, NULL, &hints, &res);
if (err != 0 || res == NULL) {
return mp_const_none;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
struct in_addr *addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr;
#pragma GCC diagnostic pop
char ip_str[IP4ADDR_STRLEN_MAX];
inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX);
mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str));
freeaddrinfo(res);
return ip_obj;
}

View File

@ -0,0 +1,36 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKETPOOL_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKETPOOL_H
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
} socketpool_socketpool_obj_t;
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL_SOCKETPOOL_H

View File

@ -0,0 +1,25 @@
/*
* 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.
*/

View File

@ -0,0 +1,31 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL___INIT___H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL___INIT___H
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SOCKETPOOL___INIT___H

View File

@ -0,0 +1,41 @@
/*
* 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 "shared-bindings/ssl/SSLContext.h"
#include "py/runtime.h"
void common_hal_ssl_sslcontext_construct(ssl_sslcontext_obj_t* self) {
}
socketpool_socket_obj_t* common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t* self,
socketpool_socket_obj_t* socket, bool server_side, const char* server_hostname) {
socket->ssl_context = self;
// Should we store server hostname on the socket in case connect is called with an ip?
return socket;
}

View File

@ -0,0 +1,39 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL_SSLCONTEXT_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL_SSLCONTEXT_H
#include "py/obj.h"
#include "esp-idf/components/esp-tls/esp_tls.h"
typedef struct {
mp_obj_base_t base;
esp_tls_cfg_t ssl_config;
} ssl_sslcontext_obj_t;
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL_SSL_CONTEXT_H

View File

@ -0,0 +1,34 @@
/*
* 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 "shared-bindings/ssl/SSLContext.h"
#include "esp-idf/components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h"
void common_hal_ssl_create_default_context(ssl_sslcontext_obj_t* self) {
memset(&self->ssl_config, 0, sizeof(esp_tls_cfg_t));
self->ssl_config.crt_bundle_attach = esp_crt_bundle_attach;
}

View File

@ -0,0 +1,31 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL___INIT___H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL___INIT___H
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_SSL___INIT___H

View File

@ -0,0 +1,44 @@
/*
* 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 "shared-bindings/wifi/Network.h"
#include <string.h>
#include "py/obj.h"
mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self) {
const char* cstr = (const char*) self->record.ssid;
return mp_obj_new_str(cstr, strlen(cstr));
}
mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self) {
return mp_obj_new_int(self->record.rssi);
}
mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) {
return mp_obj_new_int(self->record.primary);
}

View File

@ -0,0 +1,39 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_NETWORK_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_NETWORK_H
#include "py/obj.h"
#include "esp-idf/components/esp_wifi/include/esp_wifi_types.h"
typedef struct {
mp_obj_base_t base;
wifi_ap_record_t record;
} wifi_network_obj_t;
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_NETWORK_H

View File

@ -0,0 +1,174 @@
/*
* 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 "shared-bindings/wifi/Radio.h"
#include <string.h>
#include "common-hal/wifi/__init__.h"
#include "lib/utils/interrupt_char.h"
#include "py/runtime.h"
#include "shared-bindings/ipaddress/IPv4Address.h"
#include "shared-bindings/wifi/ScannedNetworks.h"
#include "shared-module/ipaddress/__init__.h"
#include "esp-idf/components/esp_wifi/include/esp_wifi.h"
#include "esp-idf/components/lwip/include/apps/ping/ping_sock.h"
static void start_station(wifi_radio_obj_t *self) {
if (self->sta_mode) {
return;
}
wifi_mode_t next_mode;
if (self->ap_mode) {
next_mode = WIFI_MODE_APSTA;
} else {
next_mode = WIFI_MODE_STA;
}
esp_wifi_set_mode(next_mode);
esp_wifi_set_config(WIFI_MODE_STA, &self->sta_config);
}
bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) {
return self->started;
}
void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) {
if (self->started && !enabled) {
if (self->current_scan != NULL) {
common_hal_wifi_radio_stop_scanning_networks(self);
}
ESP_ERROR_CHECK(esp_wifi_stop());
self->started = false;
return;
}
if (!self->started && enabled) {
ESP_ERROR_CHECK(esp_wifi_start());
self->started = true;
return;
}
}
#define MAC_ADDRESS_LENGTH 6
mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) {
uint8_t mac[MAC_ADDRESS_LENGTH];
esp_wifi_get_mac(ESP_IF_WIFI_STA, mac);
return mp_obj_new_bytes(mac, MAC_ADDRESS_LENGTH);
}
mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) {
if (self->current_scan != NULL) {
mp_raise_RuntimeError(translate("Already scanning for wifi networks"));
}
// check enabled
start_station(self);
wifi_scannednetworks_obj_t *scan = m_new_obj(wifi_scannednetworks_obj_t);
scan->base.type = &wifi_scannednetworks_type;
self->current_scan = scan;
scan->start_channel = 1;
scan->end_channel = 11;
scan->radio_event_group = self->event_group_handle;
wifi_scannednetworks_scan_next_channel(scan);
return scan;
}
void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) {
// Free the memory used to store the found aps.
wifi_scannednetworks_deinit(self->current_scan);
self->current_scan = NULL;
}
wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t* ssid, size_t ssid_len, uint8_t* password, size_t password_len, uint8_t channel, mp_float_t timeout) {
// check enabled
wifi_config_t* config = &self->sta_config;
memcpy(&config->sta.ssid, ssid, ssid_len);
config->sta.ssid[ssid_len] = 0;
memcpy(&config->sta.password, password, password_len);
config->sta.password[password_len] = 0;
config->sta.channel = channel;
esp_wifi_set_config(ESP_IF_WIFI_STA, config);
self->starting_retries = 5;
self->retries_left = 5;
esp_wifi_connect();
EventBits_t bits;
do {
RUN_BACKGROUND_TASKS;
bits = xEventGroupWaitBits(self->event_group_handle,
WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT,
pdTRUE,
pdTRUE,
0);
} while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted());
if ((bits & WIFI_DISCONNECTED_BIT) != 0) {
if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) {
return WIFI_RADIO_ERROR_AUTH;
} else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) {
return WIFI_RADIO_ERROR_NO_AP_FOUND;
}
return WIFI_RADIO_ERROR_UNKNOWN;
}
return WIFI_RADIO_ERROR_NONE;
}
mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) {
if (!esp_netif_is_netif_up(self->netif)) {
return mp_const_none;
}
esp_netif_ip_info_t ip_info;
esp_netif_get_ip_info(self->netif, &ip_info);
return common_hal_ipaddress_new_ipv4address(ip_info.ip.addr);
}
mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) {
esp_ping_config_t ping_config = ESP_PING_DEFAULT_CONFIG();
ipaddress_ipaddress_to_esp_idf(ip_address, &ping_config.target_addr);
ping_config.count = 1;
size_t timeout_ms = timeout * 1000;
esp_ping_handle_t ping;
esp_ping_new_session(&ping_config, NULL, &ping);
esp_ping_start(ping);
uint32_t received = 0;
uint32_t total_time_ms = 0;
while (received == 0 && total_time_ms < timeout_ms && !mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
esp_ping_get_profile(ping, ESP_PING_PROF_DURATION, &total_time_ms, sizeof(total_time_ms));
esp_ping_get_profile(ping, ESP_PING_PROF_REPLY, &received, sizeof(received));
}
uint32_t elapsed_time = 0xffffffff;
if (received > 0) {
esp_ping_get_profile(ping, ESP_PING_PROF_TIMEGAP, &elapsed_time, sizeof(elapsed_time));
}
esp_ping_delete_session(ping);
return elapsed_time;
}

View File

@ -0,0 +1,58 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H
#include "py/obj.h"
#include "esp-idf/components/esp_event/include/esp_event.h"
#include "shared-bindings/wifi/ScannedNetworks.h"
// Event bits for the Radio event group.
#define WIFI_SCAN_DONE_BIT BIT0
#define WIFI_CONNECTED_BIT BIT1
#define WIFI_DISCONNECTED_BIT BIT2
typedef struct {
mp_obj_base_t base;
esp_event_handler_instance_t handler_instance_all_wifi;
esp_event_handler_instance_t handler_instance_got_ip;
wifi_scannednetworks_obj_t *current_scan;
StaticEventGroup_t event_group;
EventGroupHandle_t event_group_handle;
wifi_config_t sta_config;
esp_netif_t *netif;
bool started;
bool ap_mode;
bool sta_mode;
uint8_t retries_left;
uint8_t starting_retries;
uint8_t last_disconnect_reason;
} wifi_radio_obj_t;
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_RADIO_H

View File

@ -0,0 +1,172 @@
/*
* 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 <string.h>
#include "lib/utils/interrupt_char.h"
#include "py/gc.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/wifi/__init__.h"
#include "shared-bindings/wifi/Network.h"
#include "shared-bindings/wifi/Radio.h"
#include "shared-bindings/wifi/ScannedNetworks.h"
#include "esp-idf/components/esp_wifi/include/esp_wifi.h"
static void wifi_scannednetworks_done(wifi_scannednetworks_obj_t *self) {
self->done = true;
if (self->results != NULL) {
// Check to see if the heap is still active. If not, it'll be freed automatically.
if (gc_alloc_possible()) {
m_free(self->results);
}
self->results = NULL;
}
}
static bool wifi_scannednetworks_wait_for_scan(wifi_scannednetworks_obj_t *self) {
EventBits_t bits = xEventGroupWaitBits(self->radio_event_group,
WIFI_SCAN_DONE_BIT,
pdTRUE,
pdTRUE,
0);
while ((bits & WIFI_SCAN_DONE_BIT) == 0 && !mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
bits = xEventGroupWaitBits(self->radio_event_group,
WIFI_SCAN_DONE_BIT,
pdTRUE,
pdTRUE,
0);
}
return !mp_hal_is_interrupted();
}
mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) {
if (self->done) {
return mp_const_none;
}
// If we are scanning, wait and then load them.
if (self->scanning) {
// We may have to scan more than one channel to get a result.
while (!self->done) {
if (!wifi_scannednetworks_wait_for_scan(self)) {
wifi_scannednetworks_done(self);
return mp_const_none;
}
esp_wifi_scan_get_ap_num(&self->total_results);
self->scanning = false;
if (self->total_results > 0) {
break;
}
// If total_results is zero then we need to start a scan and wait again.
wifi_scannednetworks_scan_next_channel(self);
}
// We not have found any more results so we're done.
if (self->done) {
return mp_const_none;
}
// If we need more space than we have, realloc.
if (self->total_results > self->max_results) {
wifi_ap_record_t* results = m_renew_maybe(wifi_ap_record_t,
self->results,
self->max_results,
self->total_results,
true /* allow move */);
if (results != NULL) {
self->results = results;
self->max_results = self->total_results;
} else {
if (self->max_results == 0) {
// No room for any results should error.
mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate wifi scan memory"));
}
// Unable to allocate more results, so load what we can.
self->total_results = self->max_results;
}
}
esp_wifi_scan_get_ap_records(&self->total_results, self->results);
self->scanning = false;
}
wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t);
entry->base.type = &wifi_network_type;
memcpy(&entry->record, &self->results[self->current_result], sizeof(wifi_ap_record_t));
self->current_result++;
// If we're returning our last network then start the next channel scan or
// be done.
if (self->current_result >= self->total_results) {
wifi_scannednetworks_scan_next_channel(self);
self->total_results = 0;
self->current_result = 0;
}
return MP_OBJ_FROM_PTR(entry);
}
// We don't do a linear scan so that we look at a variety of spectrum up front.
static uint8_t scan_pattern[] = {6, 1, 11, 3, 9, 13, 2, 4, 8, 12, 5, 7, 10, 14};
void wifi_scannednetworks_scan_next_channel(wifi_scannednetworks_obj_t *self) {
uint8_t next_channel = sizeof(scan_pattern);
while (self->current_channel_index < sizeof(scan_pattern)) {
next_channel = scan_pattern[self->current_channel_index];
self->current_channel_index++;
if (self->start_channel <= next_channel && next_channel <= self->end_channel) {
break;
}
}
wifi_scan_config_t config = { 0 };
config.channel = next_channel;
if (next_channel == sizeof(scan_pattern)) {
wifi_scannednetworks_done(self);
} else {
esp_err_t result = esp_wifi_scan_start(&config, false);
if (result != ESP_OK) {
wifi_scannednetworks_done(self);
} else {
self->scanning = true;
}
}
}
void wifi_scannednetworks_deinit(wifi_scannednetworks_obj_t* self) {
// if a scan is active, make sure and clean up the idf's buffer of results.
if (self->scanning) {
esp_wifi_scan_stop();
if (wifi_scannednetworks_wait_for_scan(self)) {
// Ignore the number of records since we're throwing them away.
uint16_t number = 0;
esp_wifi_scan_get_ap_records(&number, NULL);
self->scanning = false;
}
}
wifi_scannednetworks_done(self);
}

View File

@ -0,0 +1,62 @@
/*
* 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
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_SCANNEDNETWORKS_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_SCANNEDNETWORKS_H
#include <stdint.h>
#include "py/obj.h"
#include "FreeRTOS.h"
#include "freertos/event_groups.h"
#include "esp-idf/components/esp_wifi/include/esp_wifi_types.h"
typedef struct {
mp_obj_base_t base;
uint8_t current_channel_index;
EventGroupHandle_t radio_event_group;
// Results from the last channel scan
wifi_ap_record_t* results;
uint16_t current_result;
uint16_t total_results;
uint16_t max_results;
// Limits on what channels to scan.
uint8_t start_channel;
uint8_t end_channel; // Inclusive
bool done;
bool scanning;
} wifi_scannednetworks_obj_t;
void wifi_scannednetworks_scan_next_channel(wifi_scannednetworks_obj_t *self);
void wifi_scannednetworks_deinit(wifi_scannednetworks_obj_t *self);
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI_SCANNEDNETWORKS_H

View File

@ -0,0 +1,151 @@
/*
* 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 "common-hal/wifi/__init__.h"
#include "shared-bindings/ipaddress/IPv4Address.h"
#include "shared-bindings/wifi/Radio.h"
#include "py/runtime.h"
#include "esp-idf/components/esp_wifi/include/esp_wifi.h"
#include "esp-idf/components/heap/include/esp_heap_caps.h"
wifi_radio_obj_t common_hal_wifi_radio_obj;
#include "esp_log.h"
static const char* TAG = "wifi";
static void event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data) {
wifi_radio_obj_t* radio = arg;
if (event_base == WIFI_EVENT) {
switch (event_id) {
case WIFI_EVENT_SCAN_DONE:
xEventGroupSetBits(radio->event_group_handle, WIFI_SCAN_DONE_BIT);
break;
case WIFI_EVENT_STA_CONNECTED:
ESP_EARLY_LOGW(TAG, "connected");
break;
case WIFI_EVENT_STA_DISCONNECTED: {
ESP_EARLY_LOGW(TAG, "disconnected");
wifi_event_sta_disconnected_t* d = (wifi_event_sta_disconnected_t*) event_data;
uint8_t reason = d->reason;
ESP_EARLY_LOGW(TAG, "reason %d 0x%02x", reason, reason);
if (radio->retries_left > 0 &&
(reason == WIFI_REASON_AUTH_EXPIRE ||
reason == WIFI_REASON_ASSOC_EXPIRE ||
reason == WIFI_REASON_CONNECTION_FAIL ||
reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) {
radio->retries_left--;
ESP_EARLY_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left);
esp_wifi_connect();
return;
}
radio->last_disconnect_reason = reason;
xEventGroupSetBits(radio->event_group_handle, WIFI_DISCONNECTED_BIT);
}
// Cases to handle later.
// case WIFI_EVENT_STA_START:
// case WIFI_EVENT_STA_STOP:
// case WIFI_EVENT_STA_AUTHMODE_CHANGE:
default:
break;
}
}
if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
ESP_EARLY_LOGW(TAG, "got ip");
radio->retries_left = radio->starting_retries;
xEventGroupSetBits(radio->event_group_handle, WIFI_CONNECTED_BIT);
}
}
static bool wifi_inited;
void common_hal_wifi_init(void) {
wifi_inited = true;
common_hal_wifi_radio_obj.base.type = &wifi_radio_type;
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
wifi_radio_obj_t* self = &common_hal_wifi_radio_obj;
self->netif = esp_netif_create_default_wifi_sta();
self->event_group_handle = xEventGroupCreateStatic(&self->event_group);
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
ESP_EVENT_ANY_ID,
&event_handler,
self,
&self->handler_instance_all_wifi));
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
IP_EVENT_STA_GOT_IP,
&event_handler,
self,
&self->handler_instance_got_ip));
wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
esp_err_t result = esp_wifi_init(&config);
if (result == ESP_ERR_NO_MEM) {
mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate Wifi memory"));
} else if (result != ESP_OK) {
mp_raise_RuntimeError(translate("Failed to init wifi"));
}
common_hal_wifi_radio_set_enabled(self, true);
}
void wifi_reset(void) {
if (!wifi_inited) {
return;
}
wifi_radio_obj_t* radio = &common_hal_wifi_radio_obj;
common_hal_wifi_radio_set_enabled(radio, false);
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT,
ESP_EVENT_ANY_ID,
radio->handler_instance_all_wifi));
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT,
IP_EVENT_STA_GOT_IP,
radio->handler_instance_got_ip));
ESP_ERROR_CHECK(esp_wifi_deinit());
esp_netif_destroy(radio->netif);
radio->netif = NULL;
ESP_ERROR_CHECK(esp_netif_deinit());
}
void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_address) {
if (!MP_OBJ_IS_TYPE(ip_address, &ipaddress_ipv4address_type)) {
mp_raise_ValueError(translate("Only IPv4 addresses supported"));
}
mp_obj_t packed = common_hal_ipaddress_ipv4address_get_packed(ip_address);
size_t len;
const char* bytes = mp_obj_str_get_data(packed, &len);
IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]);
}

View File

@ -0,0 +1,38 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI___INIT___H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI___INIT___H
#include "py/obj.h"
#include "lwip/api.h"
void wifi_reset(void);
void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t* esp_ip_address);
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WIFI___INIT___H

@ -1 +1 @@
Subproject commit 160ba4924d8b588e718f76e3a0d0e92c11052fa3
Subproject commit de733cdab556c5713c94ba95078f4024dd56fd87

View File

@ -28,18 +28,19 @@
#ifndef ESP32S2_MPCONFIGPORT_H__
#define ESP32S2_MPCONFIGPORT_H__
#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
#define MICROPY_NLR_THUMB (0)
#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
#define MICROPY_NLR_THUMB (0)
#define MICROPY_PY_UJSON (0)
#define MICROPY_USE_INTERNAL_PRINTF (0)
#define MICROPY_PY_UJSON (1)
#define MICROPY_USE_INTERNAL_PRINTF (0)
#include "py/circuitpy_mpconfig.h"
#define MICROPY_PORT_ROOT_POINTERS \
CIRCUITPY_COMMON_ROOT_POINTERS
#define MICROPY_NLR_SETJMP (1)
#define CIRCUITPY_DEFAULT_STACK_SIZE (0x6000)
#define MICROPY_NLR_SETJMP (1)
#define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
#endif // __INCLUDED_ESP32S2_MPCONFIGPORT_H

View File

@ -13,21 +13,19 @@ USB_SERIAL_NUMBER_LENGTH = 12
LONGINT_IMPL = MPZ
# These modules are implemented in ports/<port>/common-hal:
CIRCUITPY_FULL_BUILD = 1
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_NVM = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_COUNTIO = 0
# These modules are implemented in shared-module/ - they can be included in
# any port once their prerequisites in common-hal are complete.
# Requires USB
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_NVM = 0
# We don't have enough endpoints to include MIDI.
CIRCUITPY_USB_MIDI = 0
# Too large for the partition table!
CIRCUITPY_ULAB = 0
CIRCUITPY_WIFI = 1
CIRCUITPY_ESPIDF = 1
CIRCUITPY_MODULE ?= none

View File

@ -1,10 +1,10 @@
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
# bootloader.bin 0x1000
# partition table 0x8000, 0xC00
otadata, data, ota, 0xd000, 0x2000,
ota_0, 0, ota_0, 0x10000, 512K,
ota_1, 0, ota_1, 0x90000, 512K,
phy_init, data, phy, 0x110000, 0x1000,
nvs, data, nvs, 0x111000, 0x6000,
user_fs, data, fat, 0x200000, 2M,
# bootloader.bin,, 0x1000, 32K
# partition table,, 0x8000, 4K
nvs, data, nvs, 0x9000, 20K,
otadata, data, ota, 0xe000, 8K,
ota_0, 0, ota_0, 0x10000, 1408K,
ota_1, 0, ota_1, 0x170000, 1408K,
uf2, app, factory,0x2d0000, 256K,
user_fs, data, fat, 0x310000, 960K,

1 # ESP-IDF Partition Table
2 # Name, Type, SubType, Offset, Size, Flags
3 # bootloader.bin 0x1000 # bootloader.bin,, 0x1000, 32K
4 # partition table 0x8000, 0xC00 # partition table,, 0x8000, 4K
5 otadata, data, ota, 0xd000, 0x2000, nvs, data, nvs, 0x9000, 20K,
6 ota_0, 0, ota_0, 0x10000, 512K, otadata, data, ota, 0xe000, 8K,
7 ota_1, 0, ota_1, 0x90000, 512K, ota_0, 0, ota_0, 0x10000, 1408K,
8 phy_init, data, phy, 0x110000, 0x1000, ota_1, 0, ota_1, 0x170000, 1408K,
9 nvs, data, nvs, 0x111000, 0x6000, uf2, app, factory,0x2d0000, 256K,
10 user_fs, data, fat, 0x200000, 2M, user_fs, data, fat, 0x310000, 960K,

View File

@ -37,6 +37,7 @@ CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16
#
# Bootloader config
#
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set
@ -64,15 +65,19 @@ CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0
#
# Security features
#
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
# CONFIG_SECURE_DISABLE_ROM_DL_MODE is not set
# CONFIG_SECURE_ENABLE_SECURE_ROM_DL_MODE is not set
# end of Security features
#
# Serial flasher config
#
CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
CONFIG_ESPTOOLPY_WITH_STUB=y
# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
@ -96,6 +101,7 @@ CONFIG_ESPTOOLPY_BEFORE="default_reset"
CONFIG_ESPTOOLPY_AFTER_RESET=y
# CONFIG_ESPTOOLPY_AFTER_NORESET is not set
CONFIG_ESPTOOLPY_AFTER="hard_reset"
# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set
# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set
# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
@ -122,8 +128,8 @@ CONFIG_PARTITION_TABLE_MD5=y
#
# Compiler options
#
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set
# 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
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE is not set
@ -186,6 +192,14 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
CONFIG_EFUSE_MAX_BLK_LEN=256
# end of eFuse Bit Manager
#
# ESP-TLS
#
CONFIG_ESP_TLS_USING_MBEDTLS=y
CONFIG_ESP_TLS_SERVER=y
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
# end of ESP-TLS
#
# ESP32S2-specific
#
@ -245,6 +259,10 @@ CONFIG_ESP32S2_RTC_CLK_SRC_INT_RC=y
# CONFIG_ESP32S2_RTC_CLK_SRC_INT_8MD256 is not set
CONFIG_ESP32S2_RTC_CLK_CAL_CYCLES=576
# CONFIG_ESP32S2_NO_BLOBS is not set
# CONFIG_ESP32S2_KEEP_USB_ALIVE is not set
# CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM is not set
# CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE is not set
CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y
# end of ESP32S2-specific
#
@ -263,15 +281,16 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_ESP_IPC_TASK_STACK_SIZE=1024
CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
# CONFIG_ESP_CONSOLE_USB_CDC is not set
# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set
# CONFIG_ESP_CONSOLE_UART_NONE is not set
# CONFIG_ESP_CONSOLE_NONE is not set
CONFIG_ESP_CONSOLE_UART=y
CONFIG_ESP_CONSOLE_UART_NUM=0
CONFIG_ESP_CONSOLE_UART_TX_GPIO=1
CONFIG_ESP_CONSOLE_UART_RX_GPIO=3
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
CONFIG_ESP_INT_WDT=y
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
# CONFIG_ESP_TASK_WDT is not set
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y
CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y
# end of Common ESP-related
@ -279,9 +298,7 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y
#
# Ethernet
#
CONFIG_ETH_ENABLED=y
CONFIG_ETH_USE_SPI_ETHERNET=y
# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set
# CONFIG_ETH_USE_SPI_ETHERNET is not set
# CONFIG_ETH_USE_OPENETH is not set
# end of Ethernet
@ -299,7 +316,7 @@ CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
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=y
# CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER is not set
# end of ESP NETIF Adapter
#
@ -309,6 +326,7 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
# CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT is not set
# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set
# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set
CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y
# end of ESP System Settings
#
@ -333,7 +351,7 @@ CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
CONFIG_ESP32_WIFI_TX_BA_WIN=6
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
CONFIG_ESP32_WIFI_RX_BA_WIN=6
CONFIG_ESP32_WIFI_NVS_ENABLED=y
# CONFIG_ESP32_WIFI_NVS_ENABLED is not set
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
# CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE is not set
@ -389,7 +407,6 @@ CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
CONFIG_FREERTOS_DEBUG_OCDAWARE=y
@ -432,12 +449,15 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y
CONFIG_LWIP_TIMERS_ONDEMAND=y
CONFIG_LWIP_MAX_SOCKETS=10
# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set
# CONFIG_LWIP_SO_LINGER is not set
CONFIG_LWIP_SO_REUSE=y
CONFIG_LWIP_SO_REUSE_RXTOALL=y
# CONFIG_LWIP_SO_RCVBUF is not set
CONFIG_LWIP_SO_RCVBUF=y
# CONFIG_LWIP_NETBUF_RECVINFO is not set
CONFIG_LWIP_IP_FRAG=y
# CONFIG_LWIP_IP_REASSEMBLY is not set
CONFIG_LWIP_IP4_FRAG=y
CONFIG_LWIP_IP6_FRAG=y
# CONFIG_LWIP_IP4_REASSEMBLY is not set
# CONFIG_LWIP_IP6_REASSEMBLY is not set
# CONFIG_LWIP_IP_FORWARD is not set
# CONFIG_LWIP_STATS is not set
# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
@ -478,6 +498,7 @@ CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
CONFIG_LWIP_TCP_OVERSIZE_MSS=y
# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set
# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set
CONFIG_LWIP_TCP_RTO_TIME=3000
# end of TCP
#
@ -492,6 +513,7 @@ CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
# CONFIG_LWIP_PPP_SUPPORT is not set
# CONFIG_LWIP_SLIP_SUPPORT is not set
#
# ICMP
@ -514,6 +536,20 @@ CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
# end of SNTP
CONFIG_LWIP_ESP_LWIP_ASSERT=y
#
# Debug
#
# CONFIG_LWIP_NETIF_DEBUG is not set
# CONFIG_LWIP_PBUF_DEBUG is not set
# CONFIG_LWIP_ETHARP_DEBUG is not set
# CONFIG_LWIP_API_LIB_DEBUG is not set
# CONFIG_LWIP_SOCKETS_DEBUG is not set
# CONFIG_LWIP_IP_DEBUG is not set
# CONFIG_LWIP_ICMP_DEBUG is not set
# CONFIG_LWIP_IP6_DEBUG is not set
# CONFIG_LWIP_ICMP6_DEBUG is not set
# end of Debug
# end of LWIP
#
@ -578,8 +614,8 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y
CONFIG_MBEDTLS_SSL_RENEGOTIATION=y
# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set
CONFIG_MBEDTLS_SSL_PROTO_TLS1=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y
# CONFIG_MBEDTLS_SSL_PROTO_TLS1 is not set
# CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 is not set
CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
CONFIG_MBEDTLS_SSL_ALPN=y
@ -677,6 +713,7 @@ CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1
CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192
#
# Auto-detect flash chips
@ -710,7 +747,6 @@ CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128
CONFIG_WPA_MBEDTLS_CRYPTO=y
# CONFIG_WPA_DEBUG_PRINT is not set
# CONFIG_WPA_TESTING_OPTIONS is not set
# CONFIG_WPA_TLS_V12 is not set
# CONFIG_WPA_WPS_WARS is not set
# end of Supplicant
# end of Component config
@ -745,8 +781,8 @@ CONFIG_MONITOR_BAUD_115200B=y
# CONFIG_MONITOR_BAUD_OTHER is not set
CONFIG_MONITOR_BAUD_OTHER_VAL=115200
CONFIG_MONITOR_BAUD=115200
CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set
CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y
# CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED is not set
CONFIG_OPTIMIZATION_ASSERTIONS_SILENT=y
# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set
@ -767,10 +803,9 @@ CONFIG_MAIN_TASK_STACK_SIZE=8192
CONFIG_IPC_TASK_STACK_SIZE=1024
CONFIG_CONSOLE_UART_DEFAULT=y
# CONFIG_CONSOLE_UART_CUSTOM is not set
# CONFIG_CONSOLE_UART_NONE is not set
# CONFIG_ESP_CONSOLE_UART_NONE is not set
CONFIG_CONSOLE_UART=y
CONFIG_CONSOLE_UART_NUM=0
CONFIG_CONSOLE_UART_TX_GPIO=1
CONFIG_CONSOLE_UART_RX_GPIO=3
CONFIG_CONSOLE_UART_BAUDRATE=115200
CONFIG_INT_WDT=y
CONFIG_INT_WDT_TIMEOUT_MS=300

View File

@ -40,6 +40,7 @@
#include "common-hal/busio/UART.h"
#include "common-hal/pulseio/PulseIn.h"
#include "common-hal/pwmio/PWMOut.h"
#include "common-hal/wifi/__init__.h"
#include "supervisor/memory.h"
#include "supervisor/shared/tick.h"
@ -65,6 +66,8 @@ safe_mode_t port_init(void) {
args.dispatch_method = ESP_TIMER_TASK;
args.name = "CircuitPython Tick";
esp_timer_create(&args, &_tick_timer);
heap = NULL;
never_reset_module_internal_pins();
#ifdef CONFIG_SPIRAM
@ -76,6 +79,10 @@ safe_mode_t port_init(void) {
heap = malloc(HEAP_SIZE);
heap_size = HEAP_SIZE / sizeof(uint32_t);
}
if (heap == NULL) {
return NO_HEAP;
}
return NO_SAFE_MODE;
}
@ -99,6 +106,9 @@ void reset_port(void) {
spi_reset();
uart_reset();
#endif
#if CIRCUITPY_WIFI
wifi_reset();
#endif
}
void reset_to_bootloader(void) {

View File

@ -129,14 +129,12 @@ STATIC bool packet_buffer_on_ble_client_evt(ble_evt_t *ble_evt, void *param) {
}
break;
}
case BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE: {
case BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE:
queue_next_write(self);
break;
}
case BLE_GATTC_EVT_WRITE_RSP: {
case BLE_GATTC_EVT_WRITE_RSP:
queue_next_write(self);
break;
}
default:
return false;
break;
@ -171,14 +169,14 @@ STATIC bool packet_buffer_on_ble_server_evt(ble_evt_t *ble_evt, void *param) {
}
break;
}
case BLE_GAP_EVT_DISCONNECTED: {
case BLE_GAP_EVT_DISCONNECTED:
if (self->conn_handle == ble_evt->evt.gap_evt.conn_handle) {
self->conn_handle = BLE_CONN_HANDLE_INVALID;
}
}
case BLE_GATTS_EVT_HVN_TX_COMPLETE: {
break;
case BLE_GATTS_EVT_HVN_TX_COMPLETE:
queue_next_write(self);
}
break;
default:
return false;
break;

View File

@ -180,7 +180,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
if (miso != NULL) {
config.miso_pin = miso->number;
self->MISO_pin_number = mosi->number;
self->MISO_pin_number = miso->number;
claim_pin(miso);
} else {
self->MISO_pin_number = NO_PIN;

View File

@ -123,6 +123,9 @@ void reset_pin_number(uint8_t pin_number) {
void never_reset_pin_number(uint8_t pin_number) {
if (pin_number == NO_PIN) {
return;
}
never_reset_pins[nrf_pin_port(pin_number)] |= 1 << nrf_relative_pin_number(pin_number);
}

View File

@ -9,6 +9,8 @@ MCU_SERIES = F4
MCU_VARIANT = STM32F401xE
MCU_PACKAGE = UFQFPN48
OPTIMIZATION_FLAGS = -Os
LD_COMMON = boards/common_default.ld
# use for internal flash
LD_FILE = boards/STM32F401xd_fs.ld

View File

@ -70,6 +70,10 @@ void reset_all_pins(void) {
// Mark pin as free and return it to a quiescent state.
void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
if ( pin_number == NO_PIN ) {
return;
}
if (pin_port == 0x0F) {
return;
}
@ -88,6 +92,9 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
}
void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
if ( pin_number == NO_PIN ) {
return;
}
never_reset_pins[pin_port] |= 1<<pin_number;
// Make sure never reset pins are also always claimed
claimed_pins[pin_port] |= 1<<pin_number;

View File

@ -126,7 +126,6 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, mp_uint_t index) {
break;
case BYTEARRAY_TYPECODE:
case 'B':
case 'x': // value will be discarded
val = ((unsigned char*)p)[index];
break;
case 'h':
@ -330,7 +329,11 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
}
}
mp_binary_set_int(MIN((size_t)size, sizeof(val)), struct_type == '>', p, val);
if (val_type == 'x') {
memset(p, 0, 1);
} else {
mp_binary_set_int(MIN((size_t)size, sizeof(val)), struct_type == '>', p, val);
}
}
void mp_binary_set_val_array(char typecode, void *p, mp_uint_t index, mp_obj_t val_in) {
@ -379,8 +382,6 @@ void mp_binary_set_val_array_from_int(char typecode, void *p, mp_uint_t index, m
case 'B':
((unsigned char*)p)[index] = val;
break;
case 'x':
((unsigned char*)p)[index] = 0;
case 'h':
((short*)p)[index] = val;
break;

View File

@ -31,6 +31,7 @@ BASE_CFLAGS = \
-fsingle-precision-constant \
-fno-strict-aliasing \
-Wdouble-promotion \
-Wimplicit-fallthrough=2 \
-Wno-endif-labels \
-Wstrict-prototypes \
-Werror-implicit-function-declaration \
@ -168,6 +169,9 @@ endif
ifeq ($(CIRCUITPY_I2CPERIPHERAL),1)
SRC_PATTERNS += i2cperipheral/%
endif
ifeq ($(CIRCUITPY_IPADDRESS),1)
SRC_PATTERNS += ipaddress/%
endif
ifeq ($(CIRCUITPY_MATH),1)
SRC_PATTERNS += math/%
endif
@ -228,6 +232,12 @@ endif
ifeq ($(CIRCUITPY_SHARPDISPLAY),1)
SRC_PATTERNS += sharpdisplay/%
endif
ifeq ($(CIRCUITPY_SOCKETPOOL),1)
SRC_PATTERNS += socketpool/%
endif
ifeq ($(CIRCUITPY_SSL),1)
SRC_PATTERNS += ssl/%
endif
ifeq ($(CIRCUITPY_STAGE),1)
SRC_PATTERNS += _stage/%
endif
@ -264,6 +274,9 @@ endif
ifeq ($(CIRCUITPY_WATCHDOG),1)
SRC_PATTERNS += watchdog/%
endif
ifeq ($(CIRCUITPY_WIFI),1)
SRC_PATTERNS += wifi/%
endif
ifeq ($(CIRCUITPY_PEW),1)
SRC_PATTERNS += _pew/%
endif
@ -332,11 +345,20 @@ SRC_COMMON_HAL_ALL = \
rtc/__init__.c \
sdioio/SDCard.c \
sdioio/__init__.c \
socketpool/__init__.c \
socketpool/SocketPool.c \
socketpool/Socket.c \
ssl/__init__.c \
ssl/SSLContext.c \
supervisor/Runtime.c \
supervisor/__init__.c \
watchdog/WatchDogMode.c \
watchdog/WatchDogTimer.c \
watchdog/__init__.c \
wifi/Network.c \
wifi/Radio.c \
wifi/ScannedNetworks.c \
wifi/__init__.c \
ifeq ($(CIRCUITPY_BLEIO_HCI),1)
# Helper code for _bleio HCI.
@ -414,6 +436,8 @@ SRC_SHARED_MODULE_ALL = \
fontio/__init__.c \
framebufferio/FramebufferDisplay.c \
framebufferio/__init__.c \
ipaddress/IPv4Address.c \
ipaddress/__init__.c \
sdcardio/SDCard.c \
sdcardio/__init__.c \
gamepad/GamePad.c \

View File

@ -364,6 +364,13 @@ extern const struct _mp_obj_module_t terminalio_module;
#define TERMINALIO_MODULE
#endif
#if CIRCUITPY_ESPIDF
extern const struct _mp_obj_module_t espidf_module;
#define ESPIDF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_espidf),(mp_obj_t)&espidf_module },
#else
#define ESPIDF_MODULE
#endif
#if CIRCUITPY_FRAMEBUFFERIO
extern const struct _mp_obj_module_t framebufferio_module;
#define FRAMEBUFFERIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_framebufferio), (mp_obj_t)&framebufferio_module },
@ -421,6 +428,13 @@ extern const struct _mp_obj_module_t i2cperipheral_module;
#define I2CPERIPHERAL_MODULE
#endif
#if CIRCUITPY_IPADDRESS
extern const struct _mp_obj_module_t ipaddress_module;
#define IPADDRESS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ipaddress), (mp_obj_t)&ipaddress_module },
#else
#define IPADDRESS_MODULE
#endif
#if CIRCUITPY_MATH
extern const struct _mp_obj_module_t math_module;
#define MATH_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&math_module },
@ -574,6 +588,7 @@ extern const struct _mp_obj_module_t sdioio_module;
#define SDIOIO_MODULE
#endif
#if CIRCUITPY_SHARPDISPLAY
extern const struct _mp_obj_module_t sharpdisplay_module;
#define SHARPDISPLAY_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sharpdisplay),(mp_obj_t)&sharpdisplay_module },
@ -581,6 +596,20 @@ extern const struct _mp_obj_module_t sharpdisplay_module;
#define SHARPDISPLAY_MODULE
#endif
#if CIRCUITPY_SOCKETPOOL
extern const struct _mp_obj_module_t socketpool_module;
#define SOCKETPOOL_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_socketpool), (mp_obj_t)&socketpool_module },
#else
#define SOCKETPOOL_MODULE
#endif
#if CIRCUITPY_SSL
extern const struct _mp_obj_module_t ssl_module;
#define SSL_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ssl), (mp_obj_t)&ssl_module },
#else
#define SSL_MODULE
#endif
#if CIRCUITPY_STAGE
extern const struct _mp_obj_module_t stage_module;
#define STAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module },
@ -691,6 +720,13 @@ extern const struct _mp_obj_module_t watchdog_module;
#define WATCHDOG_MODULE
#endif
#if CIRCUITPY_WIFI
extern const struct _mp_obj_module_t wifi_module;
#define WIFI_MODULE { MP_ROM_QSTR(MP_QSTR_wifi), MP_ROM_PTR(&wifi_module) },
#else
#define WIFI_MODULE
#endif
// Define certain native modules with weak links so they can be replaced with Python
// implementations. This list may grow over time.
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
@ -729,12 +765,14 @@ extern const struct _mp_obj_module_t watchdog_module;
TERMINALIO_MODULE \
VECTORIO_MODULE \
ERRNO_MODULE \
ESPIDF_MODULE \
FRAMEBUFFERIO_MODULE \
FREQUENCYIO_MODULE \
GAMEPAD_MODULE \
GAMEPADSHIFT_MODULE \
GNSS_MODULE \
I2CPERIPHERAL_MODULE \
IPADDRESS_MODULE \
JSON_MODULE \
MATH_MODULE \
_EVE_MODULE \
@ -758,6 +796,8 @@ extern const struct _mp_obj_module_t watchdog_module;
SDCARDIO_MODULE \
SDIOIO_MODULE \
SHARPDISPLAY_MODULE \
SOCKETPOOL_MODULE \
SSL_MODULE \
STAGE_MODULE \
STORAGE_MODULE \
STRUCT_MODULE \
@ -768,6 +808,7 @@ extern const struct _mp_obj_module_t watchdog_module;
USB_MIDI_MODULE \
USTACK_MODULE \
WATCHDOG_MODULE \
WIFI_MODULE \
// If weak links are enabled, just include strong links in the main list of modules,
// and also include the underscore alternate names.

View File

@ -99,6 +99,12 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
# CIRCUITPY_ESPIDF is handled in the esp32s2 tree.
# Only for ESP32S chips.
# Assume not a ESP build.
CIRCUITPY_ESPIDF ?= 0
CFLAGS += -DCIRCUITPY_ESPIDF=$(CIRCUITPY_ESPIDF)
ifeq ($(CIRCUITPY_DISPLAYIO),1)
CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD)
else
@ -124,6 +130,9 @@ CFLAGS += -DCIRCUITPY_GNSS=$(CIRCUITPY_GNSS)
CIRCUITPY_I2CPERIPHERAL ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_I2CPERIPHERAL=$(CIRCUITPY_I2CPERIPHERAL)
CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI)
CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS)
CIRCUITPY_MATH ?= 1
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
@ -191,6 +200,12 @@ CFLAGS += -DCIRCUITPY_SDIOIO=$(CIRCUITPY_SDIOIO)
CIRCUITPY_SHARPDISPLAY ?= $(CIRCUITPY_FRAMEBUFFERIO)
CFLAGS += -DCIRCUITPY_SHARPDISPLAY=$(CIRCUITPY_SHARPDISPLAY)
CIRCUITPY_SOCKETPOOL ?= $(CIRCUITPY_WIFI)
CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL)
CIRCUITPY_SSL ?= $(CIRCUITPY_WIFI)
CFLAGS += -DCIRCUITPY_SSL=$(CIRCUITPY_SSL)
# Currently always off.
CIRCUITPY_STAGE ?= 0
CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE)
@ -263,6 +278,9 @@ CFLAGS += -DCIRCUITPY_ULAB=$(CIRCUITPY_ULAB)
CIRCUITPY_WATCHDOG ?= 0
CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG)
CIRCUITPY_WIFI ?= 0
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI)
# Enabled micropython.native decorator (experimental)
CIRCUITPY_ENABLE_MPY_NATIVE ?= 0
CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE)

View File

@ -100,9 +100,30 @@ def translate(translation_file, i18ns):
translations.append((original, translation))
return translations
def frequent_ngrams(corpus, sz, n):
return collections.Counter(corpus[i:i+sz] for i in range(len(corpus)-sz)).most_common(n)
def encode_ngrams(translation, ngrams):
if len(ngrams) > 32:
start = 0xe000
else:
start = 0x80
for i, g in enumerate(ngrams):
translation = translation.replace(g, chr(start + i))
return translation
def decode_ngrams(compressed, ngrams):
if len(ngrams) > 32:
start, end = 0xe000, 0xf8ff
else:
start, end = 0x80, 0x9f
return "".join(ngrams[ord(c) - start] if (start <= ord(c) <= end) else c for c in compressed)
def compute_huffman_coding(translations, qstrs, compression_filename):
all_strings = [x[1] for x in translations]
all_strings_concat = "".join(all_strings)
ngrams = [i[0] for i in frequent_ngrams(all_strings_concat, 2, 32)]
all_strings_concat = encode_ngrams(all_strings_concat, ngrams)
counts = collections.Counter(all_strings_concat)
cb = huffman.codebook(counts.items())
values = []
@ -125,10 +146,12 @@ def compute_huffman_coding(translations, qstrs, compression_filename):
last_l = l
lengths = bytearray()
print("// length count", length_count)
print("// bigrams", ngrams)
for i in range(1, max(length_count) + 2):
lengths.append(length_count.get(i, 0))
print("// values", values, "lengths", len(lengths), lengths)
print("// estimated total memory size", len(lengths) + 2*len(values) + sum(len(cb[u]) for u in all_strings_concat))
ngramdata = [ord(ni) for i in ngrams for ni in i]
print("// estimated total memory size", len(lengths) + 2*len(values) + 2 * len(ngramdata) + sum((len(cb[u]) + 7)//8 for u in all_strings_concat))
print("//", values, lengths)
values_type = "uint16_t" if max(ord(u) for u in values) > 255 else "uint8_t"
max_translation_encoded_length = max(len(translation.encode("utf-8")) for original,translation in translations)
@ -136,10 +159,18 @@ def compute_huffman_coding(translations, qstrs, compression_filename):
f.write("const uint8_t lengths[] = {{ {} }};\n".format(", ".join(map(str, lengths))))
f.write("const {} values[] = {{ {} }};\n".format(values_type, ", ".join(str(ord(u)) for u in values)))
f.write("#define compress_max_length_bits ({})\n".format(max_translation_encoded_length.bit_length()))
return values, lengths
f.write("const {} bigrams[] = {{ {} }};\n".format(values_type, ", ".join(str(u) for u in ngramdata)))
if len(ngrams) > 32:
bigram_start = 0xe000
else:
bigram_start = 0x80
bigram_end = bigram_start + len(ngrams) - 1 # End is inclusive
f.write("#define bigram_start {}\n".format(bigram_start))
f.write("#define bigram_end {}\n".format(bigram_end))
return values, lengths, ngrams
def decompress(encoding_table, encoded, encoded_length_bits):
values, lengths = encoding_table
values, lengths, ngrams = encoding_table
dec = []
this_byte = 0
this_bit = 7
@ -187,6 +218,7 @@ def decompress(encoding_table, encoded, encoded_length_bits):
searched_length += lengths[bit_length]
v = values[searched_length + bits - max_code]
v = decode_ngrams(v, ngrams)
i += len(v.encode('utf-8'))
dec.append(v)
return ''.join(dec)
@ -194,7 +226,8 @@ def decompress(encoding_table, encoded, encoded_length_bits):
def compress(encoding_table, decompressed, encoded_length_bits, len_translation_encoded):
if not isinstance(decompressed, str):
raise TypeError()
values, lengths = encoding_table
values, lengths, ngrams = encoding_table
decompressed = encode_ngrams(decompressed, ngrams)
enc = bytearray(len(decompressed) * 3)
#print(decompressed)
#print(lengths)

View File

@ -726,6 +726,9 @@ STATIC const mp_rom_map_elem_t mp_module_builtins_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_NameError), MP_ROM_PTR(&mp_type_NameError) },
{ MP_ROM_QSTR(MP_QSTR_NotImplementedError), MP_ROM_PTR(&mp_type_NotImplementedError) },
{ MP_ROM_QSTR(MP_QSTR_OSError), MP_ROM_PTR(&mp_type_OSError) },
{ MP_ROM_QSTR(MP_QSTR_TimeoutError), MP_ROM_PTR(&mp_type_TimeoutError) },
{ MP_ROM_QSTR(MP_QSTR_ConnectionError), MP_ROM_PTR(&mp_type_ConnectionError) },
{ MP_ROM_QSTR(MP_QSTR_BrokenPipeError), MP_ROM_PTR(&mp_type_BrokenPipeError) },
{ MP_ROM_QSTR(MP_QSTR_OverflowError), MP_ROM_PTR(&mp_type_OverflowError) },
{ MP_ROM_QSTR(MP_QSTR_RuntimeError), MP_ROM_PTR(&mp_type_RuntimeError) },
#if MICROPY_PY_ASYNC_AWAIT

View File

@ -183,16 +183,21 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_from_obj, 2, 3, struct_unpack_
// This function assumes there is enough room in p to store all the values
STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, const mp_obj_t *args) {
size_t size;
size_t count = calc_size_items(mp_obj_str_get_str(fmt_in), &size);
if (count != n_args) {
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
mp_raise_ValueError(NULL);
#else
mp_raise_ValueError_varg(translate("pack expected %d items for packing (got %d)"), count, n_args);
#endif
}
const char *fmt = mp_obj_str_get_str(fmt_in);
char fmt_type = get_fmt_type(&fmt);
size_t i;
for (i = 0; i < n_args;) {
mp_uint_t cnt = 1;
if (*fmt == '\0') {
// more arguments given than used by format string; CPython raises struct.error here
break;
}
if (unichar_isdigit(*fmt)) {
cnt = get_fmt_num(&fmt);
}
@ -208,8 +213,7 @@ STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, c
memset(p + to_copy, 0, cnt - to_copy);
p += cnt;
} else {
// If we run out of args then we just finish; CPython would raise struct.error
while (cnt-- && i < n_args) {
while (cnt--) {
mp_binary_set_val(fmt_type, *fmt, args[i], &p);
// Pad bytes don't have a corresponding argument.
if (*fmt != 'x') {
@ -222,7 +226,6 @@ STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, c
}
STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
// TODO: "The arguments must match the values required by the format exactly."
mp_int_t size = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0]));
vstr_t vstr;
vstr_init_len(&vstr, size);

View File

@ -627,6 +627,8 @@ extern const mp_obj_type_t mp_type_NameError;
extern const mp_obj_type_t mp_type_NotImplementedError;
extern const mp_obj_type_t mp_type_OSError;
extern const mp_obj_type_t mp_type_TimeoutError;
extern const mp_obj_type_t mp_type_ConnectionError;
extern const mp_obj_type_t mp_type_BrokenPipeError;
extern const mp_obj_type_t mp_type_OverflowError;
extern const mp_obj_type_t mp_type_RuntimeError;
extern const mp_obj_type_t mp_type_StopAsyncIteration;

View File

@ -97,6 +97,9 @@ STATIC void array_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
STATIC mp_obj_array_t *array_new(char typecode, size_t n) {
if (typecode == 'x') {
mp_raise_ValueError(translate("bad typecode"));
}
int typecode_size = mp_binary_get_size('@', typecode, NULL);
mp_obj_array_t *o = m_new_obj(mp_obj_array_t);
#if MICROPY_PY_BUILTINS_BYTEARRAY && MICROPY_PY_ARRAY
@ -126,8 +129,10 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
|| (MICROPY_PY_BUILTINS_BYTEARRAY && MP_OBJ_IS_TYPE(initializer, &mp_type_bytearray)))))
&& mp_get_buffer(initializer, &bufinfo, MP_BUFFER_READ)) {
// construct array from raw bytes
// we round-down the len to make it a multiple of sz (CPython raises error)
size_t sz = mp_binary_get_size('@', typecode, NULL);
if (bufinfo.len % sz) {
mp_raise_ValueError(translate("bytes length not a multiple of item size"));
}
size_t len = bufinfo.len / sz;
mp_obj_array_t *o = array_new(typecode, len);
memcpy(o->items, bufinfo.buf, len * sz);

View File

@ -282,15 +282,17 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
MP_DEFINE_EXCEPTION(UnboundLocalError, NameError)
*/
MP_DEFINE_EXCEPTION(OSError, Exception)
MP_DEFINE_EXCEPTION(TimeoutError, OSError)
/*
MP_DEFINE_EXCEPTION(BlockingIOError, OSError)
MP_DEFINE_EXCEPTION(ChildProcessError, OSError)
MP_DEFINE_EXCEPTION(TimeoutError, OSError)
MP_DEFINE_EXCEPTION(ConnectionError, OSError)
MP_DEFINE_EXCEPTION(BrokenPipeError, ConnectionError)
/*
MP_DEFINE_EXCEPTION(ConnectionAbortedError, ConnectionError)
MP_DEFINE_EXCEPTION(ConnectionRefusedError, ConnectionError)
MP_DEFINE_EXCEPTION(ConnectionResetError, ConnectionError)
*/
/*
MP_DEFINE_EXCEPTION(BlockingIOError, OSError)
MP_DEFINE_EXCEPTION(ChildProcessError, OSError)
MP_DEFINE_EXCEPTION(InterruptedError, OSError)
MP_DEFINE_EXCEPTION(IsADirectoryError, OSError)
MP_DEFINE_EXCEPTION(NotADirectoryError, OSError)

View File

@ -450,6 +450,7 @@ STATIC mp_obj_t set_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
return MP_OBJ_NEW_SMALL_INT(hash);
}
#endif
/* FALLTHROUGH */
default: return MP_OBJ_NULL; // op not supported
}
}

View File

@ -1602,6 +1602,14 @@ NORETURN void mp_raise_OSError_msg_varg(const compressed_string_t *fmt, ...) {
va_end(argptr);
}
NORETURN void mp_raise_ConnectionError(const compressed_string_t *msg) {
mp_raise_msg(&mp_type_ConnectionError, msg);
}
NORETURN void mp_raise_BrokenPipeError(void) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_BrokenPipeError, MP_OBJ_NEW_SMALL_INT(MP_EPIPE)));
}
NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg) {
mp_raise_msg(&mp_type_NotImplementedError, msg);
}

View File

@ -166,6 +166,8 @@ NORETURN void mp_raise_OSError(int errno_);
NORETURN void mp_raise_OSError_errno_str(int errno_, mp_obj_t str);
NORETURN void mp_raise_OSError_msg(const compressed_string_t *msg);
NORETURN void mp_raise_OSError_msg_varg(const compressed_string_t *fmt, ...);
NORETURN void mp_raise_ConnectionError(const compressed_string_t *msg);
NORETURN void mp_raise_BrokenPipeError(void);
NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg);
NORETURN void mp_raise_NotImplementedError_varg(const compressed_string_t *fmt, ...);
NORETURN void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...);

View File

@ -86,7 +86,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
//| or use `str()` on the :py:class:`~_bleio.Attribute` object itself, the address will be printed
//| in the expected order. For example:
//|
//| .. code-block:: pycon
//| .. code-block:: python
//|
//| >>> import _bleio
//| >>> _bleio.adapter.address

View File

@ -0,0 +1,198 @@
/*
* 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
*
* 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/ipaddress/IPv4Address.h"
#include <string.h>
#include <stdio.h>
#include "py/objproperty.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/ipaddress/__init__.h"
//| class IPv4Address:
//| """Encapsulates an IPv4 address."""
//|
//| def __init__(self, address: Union[int, str, bytes]) -> None:
//| """Create a new IPv4Address object encapsulating the address value.
//|
//| The value itself can either be bytes or a string formatted address."""
//| ...
//|
STATIC mp_obj_t ipaddress_ipv4address_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_address };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_address, MP_ARG_OBJ | MP_ARG_REQUIRED },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mp_obj_t address = args[ARG_address].u_obj;
uint32_t value;
uint8_t* buf = NULL;
if (mp_obj_get_int_maybe(address, (mp_int_t*) &value)) {
// We're done.
buf = (uint8_t*) value;
} else if (MP_OBJ_IS_STR(address)) {
GET_STR_DATA_LEN(address, str_data, str_len);
if (!ipaddress_parse_ipv4address((const char*) str_data, str_len, &value)) {
mp_raise_ValueError(translate("Not a valid IP string"));
}
} else {
mp_buffer_info_t buf_info;
if (mp_get_buffer(address, &buf_info, MP_BUFFER_READ)) {
if (buf_info.len != 4) {
mp_raise_ValueError_varg(translate("Address must be %d bytes long"), 4);
}
buf = buf_info.buf;
}
}
ipaddress_ipv4address_obj_t *self = m_new_obj(ipaddress_ipv4address_obj_t);
self->base.type = &ipaddress_ipv4address_type;
common_hal_ipaddress_ipv4address_construct(self, buf, 4);
return MP_OBJ_FROM_PTR(self);
}
//| packed: bytes
//| """The bytes that make up the address (read-only)."""
//|
STATIC mp_obj_t ipaddress_ipv4address_get_packed(mp_obj_t self_in) {
ipaddress_ipv4address_obj_t *self = MP_OBJ_TO_PTR(self_in);
return common_hal_ipaddress_ipv4address_get_packed(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(ipaddress_ipv4address_get_packed_obj, ipaddress_ipv4address_get_packed);
const mp_obj_property_t ipaddress_ipv4address_packed_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&ipaddress_ipv4address_get_packed_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| version: int
//| """4 for IPv4, 6 for IPv6"""
//|
STATIC mp_obj_t ipaddress_ipv4address_get_version(mp_obj_t self_in) {
ipaddress_ipv4address_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf_info;
mp_obj_t address_bytes = common_hal_ipaddress_ipv4address_get_packed(self);
mp_get_buffer_raise(address_bytes, &buf_info, MP_BUFFER_READ);
mp_int_t version = 6;
if (buf_info.len == 4) {
version = 4;
}
return MP_OBJ_NEW_SMALL_INT(version);
}
MP_DEFINE_CONST_FUN_OBJ_1(ipaddress_ipv4address_get_version_obj, ipaddress_ipv4address_get_version);
const mp_obj_property_t ipaddress_ipv4address_version_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&ipaddress_ipv4address_get_version_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| def __eq__(self, other: IPv4Address) -> bool:
//| """Two Address objects are equal if their addresses and address types are equal."""
//| ...
//|
STATIC mp_obj_t ipaddress_ipv4address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
switch (op) {
// Two Addresses are equal if their address bytes and address_type are equal
case MP_BINARY_OP_EQUAL:
if (MP_OBJ_IS_TYPE(rhs_in, &ipaddress_ipv4address_type)) {
ipaddress_ipv4address_obj_t *lhs = MP_OBJ_TO_PTR(lhs_in);
ipaddress_ipv4address_obj_t *rhs = MP_OBJ_TO_PTR(rhs_in);
return mp_obj_new_bool(
mp_obj_equal(common_hal_ipaddress_ipv4address_get_packed(lhs),
common_hal_ipaddress_ipv4address_get_packed(rhs)));
} else {
return mp_const_false;
}
default:
return MP_OBJ_NULL; // op not supported
}
}
//| def __hash__(self) -> int:
//| """Returns a hash for the IPv4Address data."""
//| ...
//|
STATIC mp_obj_t ipaddress_ipv4address_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
switch (op) {
// Two Addresses are equal if their address bytes and address_type are equal
case MP_UNARY_OP_HASH: {
mp_obj_t bytes = common_hal_ipaddress_ipv4address_get_packed(MP_OBJ_TO_PTR(self_in));
GET_STR_HASH(bytes, h);
if (h == 0) {
GET_STR_DATA_LEN(bytes, data, len);
h = qstr_compute_hash(data, len);
}
return MP_OBJ_NEW_SMALL_INT(h);
}
default:
return MP_OBJ_NULL; // op not supported
}
}
STATIC void ipaddress_ipv4address_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
ipaddress_ipv4address_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf_info;
mp_obj_t address_bytes = common_hal_ipaddress_ipv4address_get_packed(self);
mp_get_buffer_raise(address_bytes, &buf_info, MP_BUFFER_READ);
const uint8_t *buf = (uint8_t *) buf_info.buf;
mp_printf(print, "%d.%d.%d.%d", buf[0], buf[1], buf[2], buf[3]);
}
STATIC const mp_rom_map_elem_t ipaddress_ipv4address_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_packed), MP_ROM_PTR(&ipaddress_ipv4address_packed_obj) },
};
STATIC MP_DEFINE_CONST_DICT(ipaddress_ipv4address_locals_dict, ipaddress_ipv4address_locals_dict_table);
const mp_obj_type_t ipaddress_ipv4address_type = {
{ &mp_type_type },
.name = MP_QSTR_Address,
.make_new = ipaddress_ipv4address_make_new,
.print = ipaddress_ipv4address_print,
.unary_op = ipaddress_ipv4address_unary_op,
.binary_op = ipaddress_ipv4address_binary_op,
.locals_dict = (mp_obj_dict_t*)&ipaddress_ipv4address_locals_dict
};

View File

@ -0,0 +1,38 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_IPADDRESS_IPV4ADDRESS_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_IPADDRESS_IPV4ADDRESS_H
#include "shared-module/ipaddress/IPv4Address.h"
extern const mp_obj_type_t ipaddress_ipv4address_type;
mp_obj_t common_hal_ipaddress_new_ipv4address(uint32_t value);
void common_hal_ipaddress_ipv4address_construct(ipaddress_ipv4address_obj_t* self, uint8_t* buf, size_t len);
mp_obj_t common_hal_ipaddress_ipv4address_get_packed(ipaddress_ipv4address_obj_t* self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_IPADDRESS_IPV4ADDRESS_H

View File

@ -0,0 +1,113 @@
/*
* 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 "py/objexcept.h"
#include "py/objstr.h"
#include "py/parsenum.h"
#include "py/runtime.h"
#include "shared-bindings/ipaddress/__init__.h"
#include "shared-bindings/ipaddress/IPv4Address.h"
//| """
//| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress
//| module.
//| """
//|
bool ipaddress_parse_ipv4address(const char* str_data, size_t str_len, uint32_t* ip_out) {
size_t period_count = 0;
size_t period_index[4] = {0, 0, 0, str_len};
for (size_t i = 0; i < str_len; i++) {
if (str_data[i] == '.') {
if (period_count < 3) {
period_index[period_count] = i;
}
period_count++;
}
}
if (period_count > 3) {
return false;
}
size_t last_period = 0;
if (ip_out != NULL) {
*ip_out = 0;
}
for (size_t i = 0; i < 4; i++) {
// Catch exceptions thrown by mp_parse_num_integer
nlr_buf_t nlr;
mp_obj_t octet;
if (nlr_push(&nlr) == 0) {
octet = mp_parse_num_integer((const char*) str_data + last_period, period_index[i] - last_period, 10, NULL);
nlr_pop();
} else {
return false;
}
last_period = period_index[i] + 1;
if (ip_out != NULL) {
mp_int_t int_octet = MP_OBJ_SMALL_INT_VALUE(octet);
*ip_out |= int_octet << (i * 8);
}
}
return true;
}
//| def ip_address(obj: Union[int]) -> IPv4Address:
//| """Return a corresponding IP address object or raise ValueError if not possible."""
//| ...
//|
STATIC mp_obj_t ipaddress_ip_address(mp_obj_t ip_in) {
uint32_t value;
if (mp_obj_get_int_maybe(ip_in, (mp_int_t*) &value)) {
// We're done.
} else if (MP_OBJ_IS_STR(ip_in)) {
GET_STR_DATA_LEN(ip_in, str_data, str_len);
if (!ipaddress_parse_ipv4address((const char*) str_data, str_len, &value)) {
mp_raise_ValueError(translate("Not a valid IP string"));
}
} else {
mp_raise_ValueError(translate("Only raw int supported for ip"));
}
return common_hal_ipaddress_new_ipv4address(value);
}
MP_DEFINE_CONST_FUN_OBJ_1(ipaddress_ip_address_obj, ipaddress_ip_address);
STATIC const mp_rom_map_elem_t ipaddress_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ipaddress) },
{ MP_ROM_QSTR(MP_QSTR_ip_address), MP_ROM_PTR(&ipaddress_ip_address_obj) },
{ MP_ROM_QSTR(MP_QSTR_IPv4Address), MP_ROM_PTR(&ipaddress_ipv4address_type) },
};
STATIC MP_DEFINE_CONST_DICT(ipaddress_module_globals, ipaddress_module_globals_table);
const mp_obj_module_t ipaddress_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&ipaddress_module_globals,
};

View File

@ -0,0 +1,36 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_IPADDRESS___INIT___H
#define MICROPY_INCLUDED_SHARED_BINDINGS_IPADDRESS___INIT___H
#include "shared-module/ipaddress/__init__.h"
bool ipaddress_parse_ipv4address(const char* ip_str, size_t len, uint32_t* ip_out);
mp_obj_t common_hal_ipaddress_new_ipv4address(uint32_t value);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_IPADDRESS___INIT___H

View File

@ -0,0 +1,468 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
* 2018 Nick Moore 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/socketpool/Socket.h"
#include <stdio.h>
#include <string.h>
#include "lib/utils/context_manager_helpers.h"
#include "py/objtuple.h"
#include "py/objlist.h"
#include "py/runtime.h"
#include "py/mperrno.h"
#include "esp_log.h"
static const char* TAG = "socket binding";
//| class Socket:
//| """TCP, UDP and RAW socket. Cannot be created directly. Instead, call
//| `SocketPool.socket()`.
//|
//| Provides a subset of CPython's `socket.socket` API. It only implements the versions of
//| recv that do not allocate bytes objects."""
//|
//| def __enter__(self) -> Socket:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self) -> None:
//| """Automatically closes the Socket when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
STATIC mp_obj_t socketpool_socket___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_socketpool_socket_close(args[0]);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket___exit___obj, 4, 4, socketpool_socket___exit__);
// //| def bind(self, address: tuple) -> None:
// //| """Bind a socket to an address
// //|
// //| :param ~tuple address: tuple of (remote_address, remote_port)"""
// //| ...
// //|
// STATIC mp_obj_t socketpool_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// // // get address
// // uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE];
// // mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_BIG);
// // // check if we need to select a NIC
// // socket_select_nic(self, ip);
// // // call the NIC to bind the socket
// // int _errno;
// // if (self->nic_type->bind(self, ip, port, &_errno) != 0) {
// // mp_raise_OSError(_errno);
// // }
// return mp_const_none;
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_bind_obj, socketpool_socket_bind);
// //| def listen(self, backlog: int) -> None:
// //| """Set socket to listen for incoming connections
// //|
// //| :param ~int backlog: length of backlog queue for waiting connetions"""
// //| ...
// //|
// STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// // if (self->nic == MP_OBJ_NULL) {
// // // not connected
// // // TODO I think we can listen even if not bound...
// // mp_raise_OSError(MP_ENOTCONN);
// // }
// // int _errno;
// // if (self->nic_type->listen(self, mp_obj_get_int(backlog), &_errno) != 0) {
// // mp_raise_OSError(_errno);
// // }
// return mp_const_none;
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket_listen);
// //| def accept(self) -> tuple:
// //| """Accept a connection on a listening socket of type SOCK_STREAM,
// //| creating a new socket of type SOCK_STREAM.
// //| Returns a tuple of (new_socket, remote_address)"""
// //|
// STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// // // create new socket object
// // // starts with empty NIC so that finaliser doesn't run close() method if accept() fails
// // mod_network_socket_obj_t *socket2 = m_new_obj_with_finaliser(mod_network_socket_obj_t);
// // socket2->base.type = &socket_type;
// // socket2->nic = MP_OBJ_NULL;
// // socket2->nic_type = NULL;
// // // accept incoming connection
// // uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE];
// // mp_uint_t port;
// // int _errno;
// // if (self->nic_type->accept(self, socket2, ip, &port, &_errno) != 0) {
// // mp_raise_OSError(_errno);
// // }
// // // new socket has valid state, so set the NIC to the same as parent
// // socket2->nic = self->nic;
// // socket2->nic_type = self->nic_type;
// // // make the return value
// // mp_obj_tuple_t *client = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL));
// // client->items[0] = MP_OBJ_FROM_PTR(socket2);
// // client->items[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
// return mp_const_none;
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, socketpool_socket_accept);
//| def close(self) -> None:
//| """Closes this Socket and makes its resources available to its SocketPool."""
//|
STATIC mp_obj_t socketpool_socket_close(mp_obj_t self_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_socketpool_socket_close(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_close);
//| def connect(self, address: tuple) -> None:
//| """Connect a socket to a remote address
//|
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
//| ...
//|
STATIC mp_obj_t socketpool_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t *addr_items;
mp_obj_get_array_fixed_n(addr_in, 2, &addr_items);
size_t hostlen;
const char* host = mp_obj_str_get_data(addr_items[0], &hostlen);
mp_int_t port = mp_obj_get_int(addr_items[1]);
bool ok = common_hal_socketpool_socket_connect(self, host, hostlen, port);
if (!ok) {
ESP_EARLY_LOGW(TAG, "socket connect failed");
mp_raise_OSError(0);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_connect_obj, socketpool_socket_connect);
//| def send(self, bytes: ReadableBuffer) -> int:
//| """Send some bytes to the connected remote address.
//| Suits sockets of type SOCK_STREAM
//|
//| :param ~bytes bytes: some bytes to send"""
//| ...
//|
STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (common_hal_socketpool_socket_get_closed(self)) {
// Bad file number.
mp_raise_OSError(MP_EBADF);
}
if (!common_hal_socketpool_socket_get_connected(self)) {
mp_raise_BrokenPipeError();
}
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
mp_int_t ret = common_hal_socketpool_socket_send(self, bufinfo.buf, bufinfo.len);
if (ret == -1) {
mp_raise_BrokenPipeError();
}
return mp_obj_new_int_from_uint(ret);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_send);
// helper function for socket_recv and socket_recv_into to handle common operations of both
// STATIC mp_int_t _socket_recv_into(mod_network_socket_obj_t *sock, byte *buf, mp_int_t len) {
// mp_int_t ret = 0;
// // int _errno;
// // mp_int_t ret = sock->nic_type->recv(sock, buf, len, &_errno);
// // if (ret == -1) {
// // mp_raise_OSError(_errno);
// // }
// return ret;
// }
//| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int:
//| """Reads some bytes from the connected remote address, writing
//| into the provided buffer. If bufsize <= len(buffer) is given,
//| a maximum of bufsize bytes will be read into the buffer. If no
//| valid value is given for bufsize, the default is the length of
//| the given buffer.
//|
//| Suits sockets of type SOCK_STREAM
//| Returns an int of number of bytes read.
//|
//| :param bytearray buffer: buffer to receive into
//| :param int bufsize: optionally, a maximum number of bytes to read."""
//| ...
//|
STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (common_hal_socketpool_socket_get_closed(self)) {
// Bad file number.
mp_raise_OSError(MP_EBADF);
}
if (!common_hal_socketpool_socket_get_connected(self)) {
// not connected
mp_raise_OSError(MP_ENOTCONN);
}
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE);
mp_int_t len = bufinfo.len;
if (n_args == 3) {
mp_int_t given_len = mp_obj_get_int(args[2]);
if (given_len < len) {
len = given_len;
}
}
if (len == 0) {
return MP_OBJ_NEW_SMALL_INT(0);
}
mp_int_t ret = common_hal_socketpool_socket_recv_into(self, (byte*)bufinfo.buf, len);
return mp_obj_new_int_from_uint(ret);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3, socketpool_socket_recv_into);
// //| def sendto(self, bytes: ReadableBuffer, address: tuple) -> int:
// //| """Send some bytes to a specific address.
// //| Suits sockets of type SOCK_DGRAM
// //|
// //| :param ~bytes bytes: some bytes to send
// //| :param ~tuple address: tuple of (remote_address, remote_port)"""
// //| ...
// //|
// STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// // // get the data
// // mp_buffer_info_t bufinfo;
// // mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_READ);
// // // get address
// // uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE];
// // mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_BIG);
// // // check if we need to select a NIC
// // socket_select_nic(self, ip);
// // // call the NIC to sendto
// // int _errno;
// // mp_int_t ret = self->nic_type->sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
// // if (ret == -1) {
// // mp_raise_OSError(_errno);
// // }
// mp_int_t ret = 0;
// return mp_obj_new_int(ret);
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_3(socketpool_socket_sendto_obj, socketpool_socket_sendto);
// //| def recvfrom(self, bufsize: int) -> Tuple[bytes, tuple]:
// //| """Reads some bytes from the connected remote address.
// //| Suits sockets of type SOCK_STREAM
// //|
// //| Returns a tuple containing
// //| * a bytes() of length <= bufsize
// //| * a remote_address, which is a tuple of ip address and port number
// //|
// //| :param ~int bufsize: maximum number of bytes to receive"""
// //| ...
// //|
// STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t len_in) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// // if (self->nic == MP_OBJ_NULL) {
// // // not connected
// // mp_raise_OSError(MP_ENOTCONN);
// // }
// // vstr_t vstr;
// // vstr_init_len(&vstr, mp_obj_get_int(len_in));
// // byte ip[4];
// // mp_uint_t port;
// // int _errno;
// // mp_int_t ret = self->nic_type->recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
// // if (ret == -1) {
// // mp_raise_OSError(_errno);
// // }
// mp_obj_t tuple[2];
// // if (ret == 0) {
// // tuple[0] = mp_const_empty_bytes;
// // } else {
// // vstr.len = ret;
// // tuple[0] = mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
// // }
// // tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
// return mp_obj_new_tuple(2, tuple);
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool_socket_recvfrom_into);
// //| def setsockopt(self, level: int, optname: int, value: int) -> None:
// //| """Sets socket options"""
// //| ...
// //|
// STATIC mp_obj_t socketpool_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
// // mp_int_t level = mp_obj_get_int(args[1]);
// // mp_int_t opt = mp_obj_get_int(args[2]);
// // const void *optval;
// // mp_uint_t optlen;
// // mp_int_t val;
// // if (mp_obj_is_integer(args[3])) {
// // val = mp_obj_get_int_truncated(args[3]);
// // optval = &val;
// // optlen = sizeof(val);
// // } else {
// // mp_buffer_info_t bufinfo;
// // mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
// // optval = bufinfo.buf;
// // optlen = bufinfo.len;
// // }
// // int _errno;
// // if (self->nic_type->setsockopt(self, level, opt, optval, optlen, &_errno) != 0) {
// // mp_raise_OSError(_errno);
// // }
// return mp_const_none;
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, 4, socketpool_socket_setsockopt);
//| def settimeout(self, value: int) -> None:
//| """Set the timeout value for this socket.
//|
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
//| ...
//|
STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t timeout_ms;
if (timeout_in == mp_const_none) {
timeout_ms = -1;
} else {
#if MICROPY_PY_BUILTINS_FLOAT
timeout_ms = 1000 * mp_obj_get_float(timeout_in);
#else
timeout_ms = 1000 * mp_obj_get_int(timeout_in);
#endif
}
common_hal_socketpool_socket_settimeout(self, timeout_ms);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_settimeout_obj, socketpool_socket_settimeout);
// //| def setblocking(self, flag: bool) -> Optional[int]:
// //| """Set the blocking behaviour of this socket.
// //|
// //| :param ~bool flag: False means non-blocking, True means block indefinitely."""
// //| ...
// //|
// // method socket.setblocking(flag)
// STATIC mp_obj_t socketpool_socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
// // if (mp_obj_is_true(blocking)) {
// // return socket_settimeout(self_in, mp_const_none);
// // } else {
// // return socket_settimeout(self_in, MP_OBJ_NEW_SMALL_INT(0));
// // }
// return mp_const_none;
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_setblocking_obj, socketpool_socket_setblocking);
//| def __hash__(self) -> int:
//| """Returns a hash for the Socket."""
//| ...
//|
STATIC mp_obj_t socketpool_socket_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
switch (op) {
case MP_UNARY_OP_HASH: {
return MP_OBJ_NEW_SMALL_INT(common_hal_socketpool_socket_get_hash(MP_OBJ_TO_PTR(self_in)));
}
default:
return MP_OBJ_NULL; // op not supported
}
}
STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&socketpool_socket___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&socketpool_socket_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&socketpool_socket_close_obj) },
// { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socketpool_socket_bind_obj) },
// { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socketpool_socket_listen_obj) },
// { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socketpool_socket_accept_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&socketpool_socket_connect_obj) },
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socketpool_socket_send_obj) },
// { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) },
// { MP_ROM_QSTR(MP_QSTR_recvfrom_into), MP_ROM_PTR(&socketpool_socket_recvfrom_into_obj) },
{ MP_ROM_QSTR(MP_QSTR_recv_into), MP_ROM_PTR(&socketpool_socket_recv_into_obj) },
// { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) },
{ MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socketpool_socket_settimeout_obj) },
// { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socketpool_socket_setblocking_obj) },
};
STATIC MP_DEFINE_CONST_DICT(socketpool_socket_locals_dict, socketpool_socket_locals_dict_table);
const mp_obj_type_t socketpool_socket_type = {
{ &mp_type_type },
.name = MP_QSTR_Socket,
.locals_dict = (mp_obj_dict_t*)&socketpool_socket_locals_dict,
.unary_op = socketpool_socket_unary_op,
};

View File

@ -0,0 +1,43 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H
#include "common-hal/socketpool/Socket.h"
extern const mp_obj_type_t socketpool_socket_type;
void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_uint_t timeout_ms);
bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port);
mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self);
bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t* self);
bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t* self);
mp_uint_t common_hal_socketpool_socket_get_hash(socketpool_socket_obj_t* self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H

View File

@ -0,0 +1,162 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
* 2018 Nick Moore 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 <stdio.h>
#include <string.h>
#include "py/objtuple.h"
#include "py/objlist.h"
#include "py/runtime.h"
#include "py/mperrno.h"
#include "shared-bindings/ipaddress/__init__.h"
#include "shared-bindings/socketpool/Socket.h"
#include "shared-bindings/socketpool/SocketPool.h"
#include "esp_log.h"
static const char* TAG = "socketpool binding";
//| class SocketPool:
//| """A pool of socket resources available for the given radio. Only one
//| SocketPool can be created for each radio.
//|
//| SocketPool should be used in place of CPython's socket which provides
//| a pool of sockets provided by the underlying OS."""
//|
STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 1, 1, false);
socketpool_socketpool_obj_t *s = m_new_obj_with_finaliser(socketpool_socketpool_obj_t);
s->base.type = &socketpool_socketpool_type;
mp_obj_t radio = args[0];
common_hal_socketpool_socketpool_construct(s, radio);
return MP_OBJ_FROM_PTR(s);
}
//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_TCP) -> None:
//| """Create a new socket
//|
//| :param ~int family: AF_INET or AF_INET6
//| :param ~int type: SOCK_STREAM, SOCK_DGRAM or SOCK_RAW
//| :param ~int proto: IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW (ignored)"""
//| ...
//|
STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 0, 5, false);
socketpool_socketpool_obj_t *self = pos_args[0];
socketpool_socketpool_addressfamily_t family = SOCKETPOOL_AF_INET;
socketpool_socketpool_sock_t type = SOCKETPOOL_SOCK_STREAM;
if (n_args >= 2) {
family = mp_obj_get_int(pos_args[1]);
if (n_args >= 3) {
type = mp_obj_get_int(pos_args[2]);
}
}
return common_hal_socketpool_socket(self, family, type);
}
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:
//| """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."""
//| ...
//|
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 };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_host, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_port, MP_ARG_INT | MP_ARG_REQUIRED },
{ MP_QSTR_family, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_type, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_port, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_flags, MP_ARG_INT, {.u_int = 0} },
};
socketpool_socketpool_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const char *host = mp_obj_str_get_str(args[ARG_host].u_obj);
mp_int_t port = args[ARG_port].u_int;
mp_obj_t ip_str = mp_const_none;
if (strlen(host) > 0 && ipaddress_parse_ipv4address(host, strlen(host), NULL)) {
ip_str = args[ARG_host].u_obj;
}
if (ip_str == mp_const_none) {
ip_str = common_hal_socketpool_socketpool_gethostbyname(self, host);
}
if (ip_str == mp_const_none) {
ESP_EARLY_LOGW(TAG, "no ip str");
mp_raise_OSError(0);
}
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(5, NULL));
tuple->items[0] = MP_OBJ_NEW_SMALL_INT(SOCKETPOOL_AF_INET);
tuple->items[1] = MP_OBJ_NEW_SMALL_INT(SOCKETPOOL_SOCK_STREAM);
tuple->items[2] = MP_OBJ_NEW_SMALL_INT(0);
tuple->items[3] = MP_OBJ_NEW_QSTR(MP_QSTR_);
mp_obj_tuple_t *sockaddr = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL));
sockaddr->items[0] = ip_str;
sockaddr->items[1] = MP_OBJ_NEW_SMALL_INT(port);
tuple->items[4] = MP_OBJ_FROM_PTR(sockaddr);
return mp_obj_new_list(1, (mp_obj_t*)&tuple);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_getaddrinfo_obj, 3, socketpool_socketpool_getaddrinfo);
STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socketpool_socketpool_socket_obj) },
{ MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&socketpool_socketpool_getaddrinfo_obj) },
// class constants
{ MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(SOCKETPOOL_AF_INET) },
{ MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_ROM_INT(SOCKETPOOL_AF_INET6) },
{ MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(SOCKETPOOL_SOCK_STREAM) },
{ MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(SOCKETPOOL_SOCK_DGRAM) },
{ MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(SOCKETPOOL_SOCK_RAW) },
};
STATIC MP_DEFINE_CONST_DICT(socketpool_socketpool_locals_dict, socketpool_socketpool_locals_dict_table);
const mp_obj_type_t socketpool_socketpool_type = {
{ &mp_type_type },
.name = MP_QSTR_SocketPool,
.make_new = socketpool_socketpool_make_new,
.locals_dict = (mp_obj_dict_t*)&socketpool_socketpool_locals_dict,
};

View File

@ -0,0 +1,55 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKETPOOL_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKETPOOL_H
#include "common-hal/socketpool/SocketPool.h"
#include "shared-bindings/socketpool/Socket.h"
extern const mp_obj_type_t socketpool_socketpool_type;
typedef enum {
SOCKETPOOL_SOCK_STREAM,
SOCKETPOOL_SOCK_DGRAM,
SOCKETPOOL_SOCK_RAW
} socketpool_socketpool_sock_t;
typedef enum {
SOCKETPOOL_AF_INET,
SOCKETPOOL_AF_INET6
} socketpool_socketpool_addressfamily_t;
void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t* self, mp_obj_t radio);
socketpool_socket_obj_t* common_hal_socketpool_socket(socketpool_socketpool_obj_t* self,
socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type);
mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t* self,
const char* host);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKETPOOL_H

View File

@ -0,0 +1,53 @@
/*
* 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 "py/objexcept.h"
#include "py/objstr.h"
#include "py/parsenum.h"
#include "py/runtime.h"
#include "shared-bindings/socketpool/__init__.h"
#include "shared-bindings/socketpool/Socket.h"
#include "shared-bindings/socketpool/SocketPool.h"
//| """
//| The `socketpool` module provides sockets through a pool. The pools themselves
//| act like CPython's `socket` module.
//| """
//|
STATIC const mp_rom_map_elem_t socketpool_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socketpool) },
{ MP_ROM_QSTR(MP_QSTR_SocketPool), MP_ROM_PTR(&socketpool_socketpool_type) },
{ MP_ROM_QSTR(MP_QSTR_Socket), MP_ROM_PTR(&socketpool_socket_type) },
};
STATIC MP_DEFINE_CONST_DICT(socketpool_globals, socketpool_globals_table);
const mp_obj_module_t socketpool_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&socketpool_globals,
};

View File

@ -0,0 +1,30 @@
/*
* 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL___INIT___H
#define MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL___INIT___H
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL___INIT___H

Some files were not shown because too many files have changed in this diff Show More