Merge remote-tracking branch 'adafruit/master' into esp32s2

This commit is contained in:
Scott Shawcroft 2020-05-18 16:46:41 -07:00
commit cf690bd390
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
47 changed files with 4559 additions and 1199 deletions

View File

@ -3,7 +3,7 @@ CircuitPython
.. image:: https://s3.amazonaws.com/adafruit-circuit-python/CircuitPython_Repo_header_logo.png
|Build Status| |Doc Status| |License| |Discord|
|Build Status| |Doc Status| |License| |Discord| |Weblate|
`circuitpython.org <https://circuitpython.org>`__ \| `Get CircuitPython <#get-circuitpython>`__ \|
`Documentation <#documentation>`__ \| `Contributing <#contributing>`__ \|
@ -219,3 +219,5 @@ The remaining port directories not listed above are in the repo to maintain comp
:target: https://adafru.it/discord
.. |License| image:: https://img.shields.io/badge/License-MIT-brightgreen.svg
:target: https://choosealicense.com/licenses/mit/
.. |Weblate| image:: https://hosted.weblate.org/widgets/circuitpython/-/svg-badge.svg
:target: https://hosted.weblate.org/engage/circuitpython/?utm_source=widget

@ -1 +1 @@
Subproject commit 96774b15da61da54662bcfbbf15b5bdc27315a9f
Subproject commit 5d584576ef79ca36506e6c7470e7ac5204cf0a8d

@ -1 +1 @@
Subproject commit 0b0d1e999a6c7944e55bed59a30ccc21b3c96666
Subproject commit e9411c4244984b69ec6928370ede40cec014c10b

@ -1 +1 @@
Subproject commit 2cf0f40ab818fddbc2cecf3ec495ed16067c5f7e
Subproject commit e9f15d61502f34173912ba271aaaf9446dae8da1

@ -1 +1 @@
Subproject commit 09bd10e94894a4eec7e3a02b51ffb5d8581b3024
Subproject commit 0e1230676a54da17a309d1dfffdd7fa90240191c

@ -1 +1 @@
Subproject commit 84eadeafa9144829b8c6faf903b4282d58a77353
Subproject commit f4f66fa03990428c239eac68d37f79a7245b4cd3

@ -1 +1 @@
Subproject commit f523b2316bc3e25220b88c5435868c6a5880dfab
Subproject commit 94b03517c1f4ff68cc2bb09b0963f7e7e3ce3d04

@ -1 +1 @@
Subproject commit f044548d6d3aa21650b50232bb16e0b29f540b8f
Subproject commit 65fb213b8c554181d54b77f75335e16e2f4c0987

@ -1 +1 @@
Subproject commit 9dac9628e48675308d447b70b2005f7d1f0ddf6b
Subproject commit d435fc9a9d90cb063608ae037bf5284b33bc5e84

@ -1 +1 @@
Subproject commit 42a55eafcb29f563b31e23af902c31dac8289900
Subproject commit 457aba6dd59ad00502b80c9031655d3d26ecc82b

@ -1 +1 @@
Subproject commit 24224cc905fad4646506caeb2451b4a495804ffc
Subproject commit ee8f2187d4795b08ae4aa60558f564d26c997be9

@ -1 +1 @@
Subproject commit ddcd1e7154f1b27f9a87daffb6e691e1e7051b64
Subproject commit 5fd72fb963c4a0318d29282ca2cc988f19787fda

@ -1 +1 @@
Subproject commit 10db851c81873fd8db207ff0c4d9342426ee25a4
Subproject commit 59add970cc66f9b0f2d45082e86b25650843a159

@ -1 +1 @@
Subproject commit c525eedeb0d20c9829febfbf621eab707da71f8a
Subproject commit 56358b4494da825cd99a56a854119f926abca670

@ -1 +1 @@
Subproject commit e8a759719e94c69a01f9e07d418ca6db39114db3
Subproject commit 41de8b3c05dd78d7be8893a0f6cb47a7e9b421a2

@ -1 +1 @@
Subproject commit efd548b1e36c534bbce494f4cb0d9a625dd170cd
Subproject commit 96ee9954a3099ee9c9d7d7b7747f30ab3c6a45bf

@ -1 +1 @@
Subproject commit ac83a3dc703ec50b2236c773d22c47a0c0aaba43
Subproject commit b5bbdbd56ca205c581ba2c84d927ef99befce88e

@ -1 +1 @@
Subproject commit dc01285aa45dd8260bb3ae35a657e4cdcbf325b8
Subproject commit 76c0dd13294ce8ae0518cb9882dcad5d3668977e

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\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"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "buffers harus mempunyai panjang yang sama"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1269,6 +1269,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Tambahkan module apapun pada filesystem\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2137,10 +2141,6 @@ msgstr ""
msgid "empty"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "heap kosong"
@ -3158,8 +3158,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\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"
@ -81,7 +81,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1257,6 +1257,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2113,10 +2117,6 @@ msgstr ""
msgid "empty"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr ""
@ -3132,8 +3132,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr ""

3214
locale/cs.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2020-04-30 17:01+0000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-05-18 02:48+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: German <https://later.unpythonic.net/projects/circuitpython/"
"circuitpython-master/de/>\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.0.2\n"
"X-Generator: Weblate 4.1-dev\n"
#: main.c
msgid ""
@ -81,7 +81,7 @@ msgstr "%q Indizes müssen ganze Zahlen sein, nicht %s"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
msgstr "%q Liste muss eine Liste sein"
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
@ -90,9 +90,9 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "%q muss >= 1 sein"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
msgstr "%q muss ein Tupel der Länge 2 sein"
#: shared-bindings/fontio/BuiltinFont.c
msgid "%q should be an int"
@ -1279,6 +1279,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "und alle Module im Dateisystem \n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2149,10 +2153,6 @@ msgstr "Division durch Null"
msgid "empty"
msgstr "leer"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "leerer heap"
@ -3184,8 +3184,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr "nicht lesbares Attribut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr "Nicht unterstützter %q-Typ"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -81,7 +81,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1257,6 +1257,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2113,10 +2117,6 @@ msgstr ""
msgid "empty"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr ""
@ -3132,8 +3132,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-03-30 22:11+0000\n"
"Last-Translator: Tannewt <devnull@unpythonic.net>\n"
"Language-Team: English <https://later.unpythonic.net/projects/circuitpython/"
@ -88,7 +88,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1266,6 +1266,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2122,10 +2126,6 @@ msgstr ""
msgid "empty"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr ""
@ -3141,8 +3141,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr ""

View File

@ -7,15 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-05-17 20:56+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: \n"
"Language: en_US\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.1.1\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.1-dev\n"
#: main.c
msgid ""
@ -83,7 +84,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "%q debe ser >= 1"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1272,6 +1273,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Incapaz de montar de nuevo el sistema de archivos"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr "Pop de un buffer Ps2 vacio"
@ -1802,6 +1807,7 @@ msgid "bits_per_sample must be 8 or 16"
msgstr "bits_per_sample debe ser 8 ó 16"
#: py/emitinlinethumb.c
#, fuzzy
msgid "branch not in range"
msgstr "El argumento de chr() no esta en el rango(256)"
@ -2144,10 +2150,6 @@ msgstr "división por cero"
msgid "empty"
msgstr "vacío"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "heap vacío"
@ -3173,8 +3175,8 @@ msgstr "No coinciden '{' en format"
msgid "unreadable attribute"
msgstr "atributo no legible"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr "tipo de %q no soportado"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "aarehas na haba dapat ang buffer slices"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1277,6 +1277,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Kasama ang kung ano pang modules na sa filesystem\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2157,10 +2161,6 @@ msgstr "dibisyon ng zero"
msgid "empty"
msgstr "walang laman"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "walang laman ang heap"
@ -3188,8 +3188,8 @@ msgstr "hindi tugma ang '{' sa format"
msgid "unreadable attribute"
msgstr "hindi mabasa ang attribute"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr "Hindi supportadong tipo ng %q"

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "slice del buffer devono essere della stessa lunghezza"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1287,6 +1287,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Imposssibile rimontare il filesystem"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2158,10 +2162,6 @@ msgstr "divisione per zero"
msgid "empty"
msgstr "vuoto"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "heap vuoto"
@ -3195,8 +3195,8 @@ msgstr "'{' spaiato nella stringa di formattazione"
msgid "unreadable attribute"
msgstr "attributo non leggibile"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr "tipo di %q non supportato"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -83,7 +83,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "%q 는 >=1이어야합니다"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1261,6 +1261,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2118,10 +2122,6 @@ msgstr ""
msgid "empty"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr ""
@ -3137,8 +3137,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "%q musi być >= 1"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1262,6 +1262,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Oraz moduły w systemie plików\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr ""
@ -2122,10 +2126,6 @@ msgstr "dzielenie przez zero"
msgid "empty"
msgstr "puste"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "pusta sterta"
@ -3143,8 +3143,8 @@ msgstr "niepasujące '{' for formacie"
msgid "unreadable attribute"
msgstr "nieczytelny atrybut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr "zły typ %q"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "buffers devem ser o mesmo tamanho"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1273,6 +1273,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Não é possível remontar o sistema de arquivos"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr "Buffer Ps2 vazio"
@ -2134,10 +2138,6 @@ msgstr "divisão por zero"
msgid "empty"
msgstr "vazio"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "heap vazia"
@ -3156,8 +3156,8 @@ msgstr ""
msgid "unreadable attribute"
msgstr "atributo ilegível"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -88,7 +88,7 @@ msgstr ""
msgid "%q must be >= 1"
msgstr "%q bìxū dàyú huò děngyú 1"
#: shared-bindings/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -1276,6 +1276,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n"
msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer"
msgstr "Cóng kōng de Ps2 huǎnchōng qū dànchū"
@ -2150,10 +2154,6 @@ msgstr "bèi líng chú"
msgid "empty"
msgstr "kòngxián"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap"
msgstr "kōng yīn yīnxiào"
@ -3173,8 +3173,8 @@ msgstr "géshì wèi pǐpèi '{'"
msgid "unreadable attribute"
msgstr "bùkě dú shǔxìng"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
#: shared-bindings/vectorio/VectorShape.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
msgid "unsupported %q type"
msgstr "bù zhīchí %q lèixíng"

View File

@ -17,10 +17,11 @@ CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_PIXELBUF = 1
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
SUPEROPT_GC = 0
CFLAGS_INLINE_LIMIT = 55
CFLAGS_INLINE_LIMIT = 50
# Include these Python libraries in firmware.

View File

@ -58,7 +58,7 @@ STATIC void config_periph_pin(const mcu_periph_obj_t *periph) {
| IOMUXC_SW_PAD_CTL_PAD_SRE(0));
}
#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv)))
#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv) + 1))
void spi_reset(void) {
for (int i = 0; i < MAX_SPI; i++) {

View File

@ -37,11 +37,13 @@ float common_hal_mcu_processor_get_temperature(void) {
tempmon_config_t config;
TEMPMON_GetDefaultConfig(&config);
OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_IpgClk));
TEMPMON_Init(TEMPMON, &config);
TEMPMON_StartMeasure(TEMPMON);
const float temp = TEMPMON_GetCurrentTemperature(TEMPMON);
TEMPMON_Deinit(TEMPMON);
OCOTP_Deinit(OCOTP);
return temp;
}

View File

@ -55,7 +55,7 @@
#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 62500000UL
#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 125000000UL
#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL
#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL
#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 130900000UL
#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL
#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 62500000UL
#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL
@ -137,7 +137,7 @@ void clocks_init(void) {
CLOCK_DisableClock(kCLOCK_Lpspi1);
CLOCK_DisableClock(kCLOCK_Lpspi2);
/* Set LPSPI_PODF. */
CLOCK_SetDiv(kCLOCK_LpspiDiv, 7);
CLOCK_SetDiv(kCLOCK_LpspiDiv, 2);
/* Set Lpspi clock source. */
CLOCK_SetMux(kCLOCK_LpspiMux, 1);
/* Disable TRACE clock gate. */

View File

@ -103,7 +103,7 @@ SECTIONS
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM
/* Uninitialized data section */
/* Zero-initialized data section */
.bss :
{
. = ALIGN(4);
@ -116,6 +116,19 @@ SECTIONS
_ebss = .; /* define a global symbol at bss end; used by startup code and GC */
} >RAM
/* Uninitialized data section
Data placed into this section will remain unchanged across reboots. */
.uninitialized (NOLOAD) :
{
. = ALIGN(4);
_suninitialized = .; /* define a global symbol at uninitialized start; currently unused */
*(.uninitialized)
*(.uninitialized*)
. = ALIGN(4);
_euninitialized = .; /* define a global symbol at uninitialized end; currently unused */
} >RAM
/* this is to define the start of the heap, and make sure we have a minimum size */
.heap :
{

View File

@ -34,11 +34,28 @@
#include "supervisor/shared/translate.h"
// This is the time in seconds since 2000 that the RTC was started.
static uint32_t rtc_offset = 0;
__attribute__((section(".uninitialized"))) static uint32_t rtc_offset[3];
// These values are placed before and after the current RTC count. They are
// used to determine if the RTC count is valid. These randomly-generated values
// will be set when the RTC value is set in order to mark the RTC as valid. If
// the system crashes or reboots, these values will remain undisturbed and the
// RTC offset will remain valid.
//
// If Circuit Python is updated or these symbols shift around, the prefix and
// suffix will no longer match, and the time will no longer be valid.
#define RTC_OFFSET_CHECK_PREFIX 0x25ea7e2a
#define RTC_OFFSET_CHECK_SUFFIX 0x2b80b69e
void common_hal_rtc_init(void) {
// If the prefix and suffix are not valid, zero-initialize the RTC offset.
if ((rtc_offset[0] != RTC_OFFSET_CHECK_PREFIX) || (rtc_offset[2] != RTC_OFFSET_CHECK_SUFFIX))
rtc_offset[1] = 0;
}
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
uint64_t ticks_s = port_get_raw_ticks(NULL) / 1024;
timeutils_seconds_since_2000_to_struct_time(rtc_offset + ticks_s, tm);
timeutils_seconds_since_2000_to_struct_time(rtc_offset[1] + ticks_s, tm);
}
void common_hal_rtc_set_time(timeutils_struct_time_t *tm) {
@ -46,7 +63,13 @@ void common_hal_rtc_set_time(timeutils_struct_time_t *tm) {
uint32_t epoch_s = timeutils_seconds_since_2000(
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec
);
rtc_offset = epoch_s - ticks_s;
rtc_offset[1] = epoch_s - ticks_s;
// Set the prefix and suffix in order to indicate the time is valid. This
// must be done after the offset is updated, in case there is a crash or
// power failure.
rtc_offset[0] = RTC_OFFSET_CHECK_PREFIX;
rtc_offset[2] = RTC_OFFSET_CHECK_SUFFIX;
}
int common_hal_rtc_get_calibration(void) {

View File

@ -29,5 +29,6 @@
extern void rtc_init(void);
extern void rtc_reset(void);
extern void common_hal_rtc_init(void);
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_RTC_RTC_H

View File

@ -120,6 +120,10 @@ safe_mode_t port_init(void) {
// Configure millisecond timer initialization.
tick_init();
#if CIRCUITPY_RTC
common_hal_rtc_init();
#endif
#if CIRCUITPY_ANALOGIO
analogin_init();
#endif
@ -177,8 +181,13 @@ void reset_cpu(void) {
NVIC_SystemReset();
}
// The uninitialized data section is placed directly after BSS, under the theory
// that Circuit Python has a lot more .data and .bss than the bootloader. As a
// result, this section is less likely to be tampered with by the bootloader.
extern uint32_t _euninitialized;
uint32_t *port_heap_get_bottom(void) {
return port_stack_get_limit();
return &_euninitialized;
}
uint32_t *port_heap_get_top(void) {
@ -190,21 +199,21 @@ supervisor_allocation* port_fixed_stack(void) {
}
uint32_t *port_stack_get_limit(void) {
return &_ebss;
return &_euninitialized;
}
uint32_t *port_stack_get_top(void) {
return &_estack;
}
extern uint32_t _ebss;
// Place the word to save just after our BSS section that gets blanked.
// Place the word in the uninitialized section so it won't get overwritten.
__attribute__((section(".uninitialized"))) uint32_t _saved_word;
void port_set_saved_word(uint32_t value) {
_ebss = value;
_saved_word = value;
}
uint32_t port_get_saved_word(void) {
return _ebss;
return _saved_word;
}
uint64_t port_get_raw_ticks(uint8_t* subticks) {

View File

@ -63,6 +63,10 @@ STATIC mp_obj_t array_iterator_new(mp_obj_t array_in, mp_obj_iter_buf_t *iter_bu
STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg);
STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in);
STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags);
#if MICROPY_CPYTHON_COMPAT
STATIC mp_obj_t array_decode(size_t n_args, const mp_obj_t *args);
#endif
/******************************************************************************/
// array
@ -546,7 +550,24 @@ STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_ui
return 0;
}
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
#if MICROPY_CPYTHON_COMPAT && MICROPY_PY_BUILTINS_BYTEARRAY
// Directly lifted from objstr.c
STATIC mp_obj_t array_decode(size_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2];
if (n_args == 1) {
new_args[0] = args[0];
new_args[1] = MP_OBJ_NEW_QSTR(MP_QSTR_utf_hyphen_8);
args = new_args;
n_args++;
}
return mp_obj_str_make_new(&mp_type_str, n_args, args, NULL);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(array_decode_obj, 1, 3, array_decode);
#endif
#if MICROPY_PY_ARRAY
STATIC const mp_rom_map_elem_t array_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&array_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&array_extend_obj) },
@ -555,6 +576,19 @@ STATIC const mp_rom_map_elem_t array_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(array_locals_dict, array_locals_dict_table);
#endif
#if MICROPY_PY_BUILTINS_BYTEARRAY
STATIC const mp_rom_map_elem_t bytearray_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&array_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&array_extend_obj) },
#if MICROPY_CPYTHON_COMPAT
{ MP_ROM_QSTR(MP_QSTR_decode), MP_ROM_PTR(&array_decode_obj) },
#endif
};
STATIC MP_DEFINE_CONST_DICT(bytearray_locals_dict, bytearray_locals_dict_table);
#endif
#if MICROPY_PY_ARRAY
const mp_obj_type_t mp_type_array = {
{ &mp_type_type },
@ -581,7 +615,7 @@ const mp_obj_type_t mp_type_bytearray = {
.binary_op = array_binary_op,
.subscr = array_subscr,
.buffer_p = { .get_buffer = array_get_buffer },
.locals_dict = (mp_obj_dict_t*)&array_locals_dict,
.locals_dict = (mp_obj_dict_t*)&bytearray_locals_dict,
};
#endif

View File

@ -71,7 +71,7 @@ STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type,
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Turn off the DigitalInOut and release the pin for other use."""
//| ...
//|
@ -82,13 +82,13 @@ STATIC mp_obj_t digitalio_digitalinout_obj_deinit(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(digitalio_digitalinout_deinit_obj, digitalio_digitalinout_obj_deinit);
//| def __enter__(self, ) -> Any:
//| def __enter__(self, ) -> DigitalInOut:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self, ) -> Any:
//| def __exit__(self, ) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -106,12 +106,13 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) {
}
}
//| def switch_to_output(self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL) -> Any:
//| def switch_to_output(self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL) -> None:
//| """Set the drive mode and value and then switch to writing out digital
//| values.
//|
//| :param bool value: default value to set upon switching
//| :param ~digitalio.DriveMode drive_mode: drive mode for the output"""
//| :param ~digitalio.DriveMode drive_mode: drive mode for the output
//| """
//| ...
//|
STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -135,7 +136,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_
}
MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_output_obj, 1, digitalio_digitalinout_switch_to_output);
//| def switch_to_input(self, pull: Pull = None) -> Any:
//| def switch_to_input(self, pull: Pull = None) -> None:
//| """Set the pull and then switch to read in digital values.
//|
//| :param Pull pull: pull configuration for the input
@ -162,6 +163,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_o
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);
digitalio_pull_t pull = PULL_NONE;
if (args[ARG_pull].u_rom_obj == &digitalio_pull_up_obj) {
pull = PULL_UP;
@ -174,7 +176,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_o
}
MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_input_obj, 1, digitalio_digitalinout_switch_to_input);
//| direction: Any = ...
//| direction: Direction = ...
//| """The direction of the pin.
//|
//| Setting this will use the defaults from the corresponding
@ -220,7 +222,7 @@ const mp_obj_property_t digitalio_digitalio_direction_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| value: Any = ...
//| value: Bool = ...
//| """The digital logic level of the pin."""
//|
STATIC mp_obj_t digitalio_digitalinout_obj_get_value(mp_obj_t self_in) {
@ -250,7 +252,7 @@ const mp_obj_property_t digitalio_digitalinout_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| drive_mode: Any = ...
//| drive_mode: DriveMode = ...
//| """The pin drive mode. One of:
//|
//| - `digitalio.DriveMode.PUSH_PULL`
@ -294,7 +296,7 @@ const mp_obj_property_t digitalio_digitalio_drive_mode_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| pull: Any = ...
//| pull: Optional[Pull] = ...
//| """The pin pull direction. One of:
//|
//| - `digitalio.Pull.UP`

View File

@ -34,7 +34,11 @@
//| """Non-volatile memory
//|
//| The `nvm` module allows you to store whatever raw bytes you wish in a
//| reserved section non-volatile memory."""
//| reserved section non-volatile memory.
//|
//| Note that this module can't be imported and used directly. The sole
//| instance of :class:`ByteArray` is available at
//| :attr:`microcontroller.nvm`."""
//|
STATIC const mp_rom_map_elem_t nvm_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_nvm) },

View File

@ -15,40 +15,6 @@
// #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
// Converts a list of points tuples to a flat list of ints for speedier internal use.
// Also validates the points.
static mp_obj_t _to_points_list(mp_obj_t points_tuple_list) {
size_t len = 0;
mp_obj_t *items;
mp_obj_list_get(points_tuple_list, &len, &items);
VECTORIO_POLYGON_DEBUG("polygon_points_list len: %d\n", len);
if ( len == 0 ) {
mp_raise_TypeError_varg(translate("empty %q list"), MP_QSTR_point);
}
mp_obj_t points_list = mp_obj_new_list(0, NULL);
for ( size_t i = 0; i < len; ++i) {
size_t tuple_len = 0;
mp_obj_t *tuple_items;
mp_obj_tuple_get(items[i], &tuple_len, &tuple_items);
if (tuple_len != 2) {
mp_raise_ValueError_varg(translate("%q must be a tuple of length 2"), MP_QSTR_point);
}
int value;
if (!mp_obj_get_int_maybe(tuple_items[0], &value)) {
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
}
mp_obj_list_append(points_list, MP_OBJ_NEW_SMALL_INT(value));
if (!mp_obj_get_int_maybe(tuple_items[1], &value)) {
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
}
mp_obj_list_append(points_list, MP_OBJ_NEW_SMALL_INT(value));
}
return points_list;
}
//| from typing import List, Tuple
//|
//| class Polygon:
@ -68,12 +34,11 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar
if (!MP_OBJ_IS_TYPE(args[ARG_points_list].u_obj, &mp_type_list)) {
mp_raise_TypeError_varg(translate("%q list must be a list"), MP_QSTR_point);
}
mp_obj_t points_list = _to_points_list(args[ARG_points_list].u_obj);
vectorio_polygon_t *self = m_new_obj(vectorio_polygon_t);
self->base.type = &vectorio_polygon_type;
common_hal_vectorio_polygon_construct(self, points_list);
common_hal_vectorio_polygon_construct(self, args[ARG_points_list].u_obj);
return MP_OBJ_FROM_PTR(self);
}
@ -104,9 +69,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorio_polygon_get_points_obj, vectorio_polygon_obj_
STATIC mp_obj_t vectorio_polygon_obj_set_points(mp_obj_t self_in, mp_obj_t points) {
vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t points_list = _to_points_list(points);
common_hal_vectorio_polygon_set_points(self, points_list);
common_hal_vectorio_polygon_set_points(self, points);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_polygon_set_points_obj, vectorio_polygon_obj_set_points);

View File

@ -4,6 +4,8 @@
#include "shared-module/displayio/area.h"
#include "py/runtime.h"
#include "py/gc.h"
#include "stdlib.h"
#include <stdio.h>
@ -12,10 +14,53 @@
// #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
// Converts a list of points tuples to a flat list of ints for speedier internal use.
// Also validates the points.
static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple_list) {
size_t len = 0;
mp_obj_t *items;
mp_obj_list_get(points_tuple_list, &len, &items);
VECTORIO_POLYGON_DEBUG("polygon_points_list len: %d\n", len);
if ( len < 3 ) {
mp_raise_TypeError_varg(translate("Polygon needs at least 3 points"));
}
if ( self->len < 2*len ) {
if ( self->points_list != NULL ) {
gc_free( self->points_list );
}
self->points_list = gc_alloc( 2 * len * sizeof(int), false, false );
}
self->len = 2*len;
for ( size_t i = 0; i < len; ++i) {
size_t tuple_len = 0;
mp_obj_t *tuple_items;
mp_obj_tuple_get(items[i], &tuple_len, &tuple_items);
if (tuple_len != 2) {
mp_raise_ValueError_varg(translate("%q must be a tuple of length 2"), MP_QSTR_point);
}
if ( !mp_obj_get_int_maybe(tuple_items[ 0 ], &self->points_list[2*i ])
|| !mp_obj_get_int_maybe(tuple_items[ 1 ], &self->points_list[2*i + 1])
) {
self->len = 0;
gc_free( self->points_list );
self->points_list = NULL;
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
}
}
}
void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list) {
VECTORIO_POLYGON_DEBUG("%p polygon_construct\n", self);
self->points_list = points_list;
self->points_list = NULL;
self->len = 0;
self->on_dirty.obj = NULL;
_clobber_points_list( self, points_list );
}
@ -23,7 +68,7 @@ mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self) {
return self->points_list;
}
void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t points_list) {
self->points_list = points_list;
_clobber_points_list( self, points_list );
if (self->on_dirty.obj != NULL) {
self->on_dirty.event(self->on_dirty.obj);
}
@ -38,21 +83,16 @@ void common_hal_vectorio_polygon_set_on_dirty(vectorio_polygon_t *self, vectorio
void common_hal_vectorio_polygon_get_area(void *polygon, displayio_area_t *area) {
VECTORIO_POLYGON_DEBUG("%p polygon get_area", polygon);
vectorio_polygon_t *self = polygon;
size_t len;
mp_obj_t *points;
mp_obj_list_get(self->points_list, &len, &points);
VECTORIO_POLYGON_DEBUG(" len: %2d, points: %d\n", len, len/2);
area->x1 = SHRT_MAX;
area->y1 = SHRT_MAX;
area->x2 = SHRT_MIN;
area->y2 = SHRT_MIN;
for (size_t i=0; i < len; ++i) {
mp_int_t x = mp_obj_get_int(points[i]);
for (size_t i=0; i < self->len; ++i) {
int x = self->points_list[i];
++i;
mp_int_t y = mp_obj_get_int(points[i]);
int y = self->points_list[i];
if (x <= area->x1) area->x1 = x-1;
if (y <= area->y1) area->y1 = y-1;
if (x >= area->x2) area->x2 = x+1;
@ -73,22 +113,19 @@ __attribute__((always_inline)) static inline int line_side( mp_int_t x1, mp_int_
uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y) {
VECTORIO_POLYGON_DEBUG("%p polygon get_pixel %d, %d\n", obj, x, y);
vectorio_polygon_t *self = obj;
size_t len;
mp_obj_t *points;
mp_obj_list_get(self->points_list, &len, &points);
if (len == 0) {
if (self->len == 0) {
return 0;
}
int winding_number = 0;
mp_int_t x1 = mp_obj_get_int(points[0]);
mp_int_t y1 = mp_obj_get_int(points[1]);
for (size_t i=2; i <= len + 1; ++i) {
int x1 = self->points_list[0];
int y1 = self->points_list[1];
for (size_t i=2; i <= self->len + 1; ++i) {
VECTORIO_POLYGON_DEBUG(" {(%3d, %3d),", x1, y1);
mp_int_t x2 = mp_obj_get_int(points[i % len]);
int x2 = self->points_list[i % self->len];
++i;
mp_int_t y2 = mp_obj_get_int(points[i % len]);
int y2 = self->points_list[i % self->len];
VECTORIO_POLYGON_DEBUG(" (%3d, %3d)}\n", x2, y2);
if ( y1 <= y ) {
if ( y2 > y && line_side(x1, y1, x2, y2, x, y) > 0 ) {

View File

@ -8,8 +8,9 @@
typedef struct {
mp_obj_base_t base;
// A micropython List[ x, y, ... ]
mp_obj_t points_list;
// An int array[ x, y, ... ]
int *points_list;
size_t len;
vectorio_event_t on_dirty;
} vectorio_polygon_t;