Merge branch 'opt-test' of https://github.com/DavePutz/circuitpython into opt-test

This commit is contained in:
root 2020-07-24 23:28:41 -05:00
commit c4817968ee
199 changed files with 3556 additions and 1689 deletions

@ -1 +1 @@
Subproject commit 9f71088d2c32206c6f0495704ae0c040426d5764
Subproject commit 761d6437e8cd6a131d51de96974337121a9c7164

View File

@ -84,10 +84,15 @@ msgstr "indeks %q harus bilangan bulat, bukan %s"
msgid "%q list must be a list"
msgstr "daftar %q harus berupa daftar"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q harus >= 1"
@ -325,6 +330,11 @@ msgstr "Semua timer sedang digunakan"
msgid "Already advertising."
msgstr "Sudah disebarkan."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "AnalogIn tidak didukung pada pin yang diberikan"
@ -360,6 +370,11 @@ msgstr "Nilai array harus berupa byte tunggal."
msgid "At most %d %q may be specified (not %d)"
msgstr "Paling banyak %d %q dapat ditentukan (bukan %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "Mencoba alokasi heap ketika MicroPython VM tidak berjalan."
@ -481,7 +496,9 @@ msgstr "Panggil super().__init__() sebelum mengakses objek asli."
msgid "Can't set CCCD on local Characteristic"
msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Tidak dapat menghapus nilai"
@ -1379,6 +1396,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1465,7 +1483,9 @@ msgid "Slice and value different lengths."
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"POT-Creation-Date: 2020-07-21 18:43-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"
@ -78,10 +78,15 @@ msgstr ""
msgid "%q list must be a list"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr ""
@ -229,6 +234,10 @@ msgstr ""
msgid "'continue' outside loop"
msgstr ""
#: py/objgenerator.c
msgid "'coroutine' object is not an iterator"
msgstr ""
#: py/compile.c
msgid "'data' requires at least 2 arguments"
msgstr ""
@ -311,7 +320,7 @@ msgstr ""
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c
#: shared-bindings/pulseio/PWMOut.c
#: ports/stm/peripherals/timers.c shared-bindings/pulseio/PWMOut.c
msgid "All timers in use"
msgstr ""
@ -319,6 +328,11 @@ msgstr ""
msgid "Already advertising."
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr ""
@ -354,6 +368,11 @@ msgstr ""
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -473,7 +492,9 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr ""
@ -1315,11 +1336,7 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "PulseIn not supported on this chip"
msgstr ""
#: ports/stm/common-hal/pulseio/PulseOut.c
#: ports/stm/ref/pulseout-pre-timeralloc.c
msgid "PulseOut not supported on this chip"
msgstr ""
@ -1353,6 +1370,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1437,7 +1455,9 @@ msgid "Slice and value different lengths."
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr ""
@ -1525,6 +1545,11 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/stm/common-hal/pulseio/PWMOut.c
msgid ""
"Timer was reserved for internal use - declare PWM pins earlier in the program"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample."
msgstr ""

View File

@ -84,10 +84,15 @@ msgstr "Indexy% q musí být celá čísla, nikoli% s"
msgid "%q list must be a list"
msgstr "Seznam% q musí být seznam"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "% q musí být > = 1"
@ -325,6 +330,11 @@ msgstr ""
msgid "Already advertising."
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr ""
@ -360,6 +370,11 @@ msgstr ""
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -479,7 +494,9 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr ""
@ -1359,6 +1376,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1443,7 +1461,9 @@ msgid "Slice and value different lengths."
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr ""

View File

@ -83,10 +83,15 @@ msgstr "%q Indizes müssen Integer sein, nicht %s"
msgid "%q list must be a list"
msgstr "%q Liste muss eine Liste sein"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q muss >= 1 sein"
@ -324,6 +329,11 @@ msgstr "Alle timer werden benutzt"
msgid "Already advertising."
msgstr "Bereits am anbieten (advertising)."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "AnalogIn ist an diesem Pin nicht unterstützt"
@ -359,6 +369,11 @@ msgstr "Array-Werte sollten aus Einzelbytes bestehen."
msgid "At most %d %q may be specified (not %d)"
msgstr "Es darf höchstens %d %q spezifiziert werden (nicht %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -482,7 +497,9 @@ msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf."
msgid "Can't set CCCD on local Characteristic"
msgstr "CCCD kann nicht auf lokales Merkmal eingestellt werden"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Kann Werte nicht löschen"
@ -1389,6 +1406,7 @@ msgstr "RTS / CTS / RS485 Wird von diesem Gerät noch nicht unterstützt"
msgid "Random number generation error"
msgstr "Fehler bei der Erzeugung von Zufallszahlen"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Nur lesen möglich, da Schreibgeschützt"
@ -1473,7 +1491,9 @@ msgid "Slice and value different lengths."
msgstr "Slice und Wert (value) haben unterschiedliche Längen."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Slices werden nicht unterstützt"

View File

@ -3,13 +3,12 @@
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
# SPDX-License-Identifier: MIT
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-13 19:24+0000\n"
"PO-Revision-Date: 2020-07-22 20:48+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
"Language: es\n"
@ -88,10 +87,15 @@ msgstr "%q indices deben ser enteros, no %s"
msgid "%q list must be a list"
msgstr "%q lista debe ser una lista"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q debe ser >= 1"
@ -117,7 +121,7 @@ msgstr "argumento '%q' requerido"
#: py/objarray.c
msgid "'%q' object is not bytes-like"
msgstr ""
msgstr "el objeto '%q' no es similar a bytes"
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
@ -331,6 +335,11 @@ msgstr "Todos los timers en uso"
msgid "Already advertising."
msgstr "Ya se encuentra publicando."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "El pin proporcionado no soporta AnalogIn"
@ -366,6 +375,11 @@ msgstr "Valores del array deben ser bytes individuales."
msgid "At most %d %q may be specified (not %d)"
msgstr "Como máximo %d %q se puede especificar (no %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -489,7 +503,9 @@ msgstr "Llame a super().__ init __() antes de acceder al objeto nativo."
msgid "Can't set CCCD on local Characteristic"
msgstr "No se puede configurar CCCD en la característica local"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "No se puede eliminar valores"
@ -1389,6 +1405,7 @@ msgstr "Sin capacidad de RTS/CTS/RS485 para este dispositivo"
msgid "Random number generation error"
msgstr "Error de generación de números aleatorios"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Solo-lectura"
@ -1473,7 +1490,9 @@ msgid "Slice and value different lengths."
msgstr "Slice y value tienen tamaños diferentes."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Rebanadas no soportadas"

View File

@ -76,10 +76,15 @@ msgstr "%q indeks ay dapat integers, hindi %s"
msgid "%q list must be a list"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
#, fuzzy
msgid "%q must be >= 1"
msgstr "aarehas na haba dapat ang buffer slices"
@ -321,6 +326,11 @@ msgstr "Lahat ng timer ginagamit"
msgid "Already advertising."
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr ""
@ -356,6 +366,11 @@ msgstr "Array values ay dapat single bytes."
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -478,7 +493,9 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Hindi mabura ang values"
@ -1373,6 +1390,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Basahin-lamang"
@ -1458,7 +1476,9 @@ msgid "Slice and value different lengths."
msgstr "Slice at value iba't ibang haba."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Hindi suportado ang Slices"

View File

@ -88,10 +88,15 @@ msgstr "les indices %q doivent être des entiers, pas %s"
msgid "%q list must be a list"
msgstr "La liste %q doit être une liste"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q doit être >=1"
@ -329,6 +334,11 @@ msgstr "Tous les timers sont utilisés"
msgid "Already advertising."
msgstr "S'annonce déjà."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée"
@ -365,6 +375,11 @@ msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'."
msgid "At most %d %q may be specified (not %d)"
msgstr "Au plus %d %q peut être spécifié (pas %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -488,7 +503,9 @@ msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif."
msgid "Can't set CCCD on local Characteristic"
msgstr "Impossible de définir CCCD sur une caractéristique locale"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Impossible de supprimer les valeurs"
@ -1394,6 +1411,7 @@ msgstr "RTS / CTS / RS485 Pas encore pris en charge sur cet appareil"
msgid "Random number generation error"
msgstr "Erreur de génération de nombres aléatoires"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Lecture seule"
@ -1478,7 +1496,9 @@ msgid "Slice and value different lengths."
msgstr "Tranche et valeur de tailles différentes."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Tranches non supportées"

View File

@ -76,10 +76,15 @@ msgstr "gli indici %q devono essere interi, non %s"
msgid "%q list must be a list"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
#, fuzzy
msgid "%q must be >= 1"
msgstr "slice del buffer devono essere della stessa lunghezza"
@ -320,6 +325,11 @@ msgstr "Tutti i timer utilizzati"
msgid "Already advertising."
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr ""
@ -355,6 +365,11 @@ msgstr "Valori di Array dovrebbero essere bytes singulari"
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -478,7 +493,9 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Impossibile cancellare valori"
@ -1382,6 +1399,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Sola lettura"
@ -1469,7 +1487,9 @@ msgid "Slice and value different lengths."
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Slice non supportate"

View File

@ -78,10 +78,15 @@ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다"
msgid "%q list must be a list"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q 는 >=1이어야합니다"
@ -319,6 +324,11 @@ msgstr "모든 타이머가 사용 중입니다"
msgid "Already advertising."
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr ""
@ -354,6 +364,11 @@ msgstr ""
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -475,7 +490,9 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "값을 삭제할 수 없습니다"
@ -1355,6 +1372,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1439,7 +1457,9 @@ msgid "Slice and value different lengths."
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr ""

View File

@ -84,10 +84,15 @@ msgstr "%q indexen moeten integers zijn, niet %s"
msgid "%q list must be a list"
msgstr "%q lijst moet een lijst zijn"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q moet >= 1 zijn"
@ -325,6 +330,11 @@ msgstr "Alle timers zijn in gebruik"
msgid "Already advertising."
msgstr "Advertising is al bezig."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "AnalogIn niet ondersteund door gegeven pin"
@ -360,6 +370,11 @@ msgstr "Array waardes moet enkele bytes zijn."
msgid "At most %d %q may be specified (not %d)"
msgstr "Op zijn meest %d %q mogen worden gespecificeerd (niet %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "heap allocatie geprobeerd terwijl MicroPython VM niet draait."
@ -481,7 +496,9 @@ msgstr "Roep super().__init__() aan voor toegang native object."
msgid "Can't set CCCD on local Characteristic"
msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Kan waardes niet verwijderen"
@ -1385,6 +1402,7 @@ msgstr "RTS/CTS/RS485 Nog niet ondersteund door dit apparaat"
msgid "Random number generation error"
msgstr "Random number generatie fout"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Alleen-lezen"
@ -1469,7 +1487,9 @@ msgid "Slice and value different lengths."
msgstr "Slice en waarde hebben verschillende lengtes."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Slices niet ondersteund"

View File

@ -78,10 +78,15 @@ msgstr "%q indeks musi być liczbą całkowitą, a nie %s"
msgid "%q list must be a list"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q musi być >= 1"
@ -319,6 +324,11 @@ msgstr "Wszystkie timery w użyciu"
msgid "Already advertising."
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr ""
@ -354,6 +364,11 @@ msgstr "Wartości powinny być bajtami."
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -475,7 +490,9 @@ msgstr ""
msgid "Can't set CCCD on local Characteristic"
msgstr ""
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Nie można usunąć"
@ -1357,6 +1374,7 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Tylko do odczytu"
@ -1441,7 +1459,9 @@ msgid "Slice and value different lengths."
msgstr "Fragment i wartość są różnych długości."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Fragmenty nieobsługiwane"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-09 17:23+0000\n"
"PO-Revision-Date: 2020-07-23 02:57+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -84,10 +84,15 @@ msgstr "Os índices %q devem ser inteiros, e não %s"
msgid "%q list must be a list"
msgstr "A lista %q deve ser uma lista"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q deve ser >= 0"
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q deve ser >= 1"
@ -113,7 +118,7 @@ msgstr "'%q' argumento(s) requerido(s)"
#: py/objarray.c
msgid "'%q' object is not bytes-like"
msgstr ""
msgstr "objetos '%q' não são bytes-like"
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
@ -327,6 +332,11 @@ msgstr "Todos os temporizadores em uso"
msgid "Already advertising."
msgstr "Já está anunciando."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr "Já está em execução"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "O AnalogIn não é compatível no pino informado"
@ -362,6 +372,11 @@ msgstr "Os valores das matrizes devem ser bytes simples."
msgid "At most %d %q may be specified (not %d)"
msgstr "Pelo menos %d %q pode ser definido (não %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr "Tentativa de alocar %d blocos"
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@ -487,7 +502,9 @@ msgstr "Chame super().__init__() antes de acessar o objeto nativo."
msgid "Can't set CCCD on local Characteristic"
msgstr "Não é possível definir o CCCD com a característica local"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Não é possível excluir valores"
@ -1393,6 +1410,7 @@ msgstr "RTS/CTS/RS485 Ainda não é compatível neste dispositivo"
msgid "Random number generation error"
msgstr "Houve um erro na geração do número aleatório"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Somente leitura"
@ -1477,7 +1495,9 @@ msgid "Slice and value different lengths."
msgstr "Fatie e avalie os diferentes comprimentos."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Fatiamento não compatível"

View File

@ -84,10 +84,15 @@ msgstr "Indexet %q måste vara ett heltal, inte %s"
msgid "%q list must be a list"
msgstr "%q-listan måste vara en lista"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q måste vara >= 1"
@ -325,6 +330,11 @@ msgstr "Alla timers används"
msgid "Already advertising."
msgstr "Annonserar redan."
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "AnalogIn stöds inte på angiven pinne"
@ -360,6 +370,11 @@ msgstr "Matrisvärden ska bestå av enstaka bytes."
msgid "At most %d %q may be specified (not %d)"
msgstr "Högst %d %q kan anges (inte %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr "Försökte tilldela heap när MicroPython VM inte körs."
@ -481,7 +496,9 @@ msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet."
msgid "Can't set CCCD on local Characteristic"
msgstr "Kan inte ställa in CCCD på lokal karaktäristik"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Kan inte radera värden"
@ -1381,6 +1398,7 @@ msgstr "RTS/CTS/RS485 Stöds ännu inte på den här enheten"
msgid "Random number generation error"
msgstr "Fel vid generering av slumptal"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Skrivskyddad"
@ -1465,7 +1483,9 @@ msgid "Slice and value different lengths."
msgstr "Slice och värde har olika längd."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Slice stöds inte"

View File

@ -84,10 +84,15 @@ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s"
msgid "%q list must be a list"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
#: shared-bindings/vectorio/Rectangle.c
#: shared-bindings/displayio/Shape.c
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c
msgid "%q must be >= 1"
msgstr "%q bìxū dàyú huò děngyú 1"
@ -325,6 +330,11 @@ msgstr "Suǒyǒu jìshí qì shǐyòng"
msgid "Already advertising."
msgstr "Mùqián zhèngzài guǎngbò"
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
msgstr "Gěi dìng de yǐn jiǎo bù zhīchí AnalogIn"
@ -360,6 +370,11 @@ msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié."
msgid "At most %d %q may be specified (not %d)"
msgstr ""
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
#: supervisor/shared/safe_mode.c
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ī."
@ -481,7 +496,9 @@ msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()
msgid "Can't set CCCD on local Characteristic"
msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
msgstr "Wúfǎ shānchú zhí"
@ -1371,6 +1388,7 @@ msgstr ""
msgid "Random number generation error"
msgstr "Suíjī shù shēngchéng cuòwù"
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Zhǐ dú"
@ -1455,7 +1473,9 @@ msgid "Slice and value different lengths."
msgstr "Qiēpiàn hé zhí bùtóng chángdù."
#: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c
#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c
#: shared-bindings/displayio/TileGrid.c
#: shared-bindings/memorymonitor/AllocationSize.c
#: shared-bindings/pulseio/PulseIn.c
msgid "Slices not supported"
msgstr "Qiēpiàn bù shòu zhīchí"

9
main.c
View File

@ -64,6 +64,10 @@
#include "shared-module/displayio/__init__.h"
#endif
#if CIRCUITPY_MEMORYMONITOR
#include "shared-module/memorymonitor/__init__.h"
#endif
#if CIRCUITPY_NETWORK
#include "shared-module/network/__init__.h"
#endif
@ -206,6 +210,9 @@ void cleanup_after_vm(supervisor_allocation* heap) {
#if CIRCUITPY_DISPLAYIO
reset_displays();
#endif
#if CIRCUITPY_MEMORYMONITOR
memorymonitor_reset();
#endif
filesystem_flush();
stop_mp();
free_memory(heap);
@ -324,6 +331,8 @@ bool run_code_py(safe_mode_t safe_mode) {
}
}
FIL* boot_output_file;
void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
// If not in safe mode, run boot before initing USB and capture output in a
// file.

View File

@ -40,6 +40,7 @@
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_CPYTHON_COMPAT (1)
#define MICROPY_PY_ASYNC_AWAIT (1)
#define MICROPY_USE_INTERNAL_PRINTF (0)
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)

View File

@ -37,8 +37,8 @@
#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32())
// Number of bytes in receive buffer
volatile uint8_t usb_rx_count;
volatile bool mp_cdc_enabled;
extern volatile uint8_t usb_rx_count;
extern volatile bool mp_cdc_enabled;
int receive_usb(void);

View File

@ -275,7 +275,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
$(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
$(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)$(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,198 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
* Uses code from Micropython, Copyright (c) 2013-2016 Damien P. George
*
* 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 <math.h>
#include "common-hal/pulseio/PWMOut.h"
#include "shared-bindings/pulseio/PWMOut.h"
#include "py/runtime.h"
#include "driver/ledc.h"
#define INDEX_EMPTY 0xFF
STATIC uint32_t reserved_timer_freq[LEDC_TIMER_MAX];
STATIC uint8_t reserved_channels[LEDC_CHANNEL_MAX];
STATIC bool never_reset_tim[LEDC_TIMER_MAX];
STATIC bool never_reset_chan[LEDC_CHANNEL_MAX];
void pwmout_reset(void) {
for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++ ) {
ledc_stop(LEDC_LOW_SPEED_MODE, i, 0);
if (!never_reset_chan[i]) {
reserved_channels[i] = INDEX_EMPTY;
}
}
for (size_t i = 0; i < LEDC_TIMER_MAX; i++ ) {
ledc_timer_rst(LEDC_LOW_SPEED_MODE, i);
if (!never_reset_tim[i]) {
reserved_timer_freq[i] = 0;
}
}
}
pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
const mcu_pin_obj_t* pin,
uint16_t duty,
uint32_t frequency,
bool variable_frequency) {
// Calculate duty cycle
uint32_t duty_bits = 0;
uint32_t interval = LEDC_APB_CLK_HZ/frequency;
for (size_t i = 0; i < 32; i++) {
if(!(interval >> i)) {
duty_bits = i - 1;
break;
}
}
if (duty_bits < 1) {
mp_raise_ValueError(translate("Invalid frequency"));
} else if (duty_bits >= LEDC_TIMER_14_BIT) {
duty_bits = LEDC_TIMER_13_BIT;
}
// Find a viable timer
size_t timer_index = INDEX_EMPTY;
size_t channel_index = INDEX_EMPTY;
for (size_t i = 0; i < LEDC_TIMER_MAX; i++) {
if ((reserved_timer_freq[i] == frequency) && !variable_frequency) {
//prioritize matched frequencies so we don't needlessly take slots
timer_index = i;
break;
} else if (reserved_timer_freq[i] == 0) {
timer_index = i;
break;
}
}
if (timer_index == INDEX_EMPTY) {
// Running out of timers isn't pin related on ESP32S2 so we can't re-use error messages
mp_raise_ValueError(translate("No more timers available"));
}
// Find a viable channel
for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) {
if (reserved_channels[i] == INDEX_EMPTY) {
channel_index = i;
break;
}
}
if (channel_index == INDEX_EMPTY) {
mp_raise_ValueError(translate("No more channels available"));
}
// Run configuration
self->tim_handle.timer_num = timer_index;
self->tim_handle.duty_resolution = duty_bits;
self->tim_handle.freq_hz = frequency;
self->tim_handle.speed_mode = LEDC_LOW_SPEED_MODE;
self->tim_handle.clk_cfg = LEDC_AUTO_CLK;
if (ledc_timer_config(&(self->tim_handle)) != ESP_OK) {
mp_raise_ValueError(translate("Could not initialize timer"));
}
self->chan_handle.channel = channel_index;
self->chan_handle.duty = duty >> (16 - duty_bits);
self->chan_handle.gpio_num = pin->number;
self->chan_handle.speed_mode = LEDC_LOW_SPEED_MODE; // Only LS is allowed on ESP32-S2
self->chan_handle.hpoint = 0;
self->chan_handle.timer_sel = timer_index;
if (ledc_channel_config(&(self->chan_handle))) {
mp_raise_ValueError(translate("Could not initialize channel"));
}
// Make reservations
reserved_timer_freq[timer_index] = frequency;
reserved_channels[channel_index] = timer_index;
self->variable_frequency = variable_frequency;
self->pin_number = pin->number;
self->deinited = false;
self->duty_resolution = duty_bits;
claim_pin(pin);
// Set initial duty
common_hal_pulseio_pwmout_set_duty_cycle(self, duty);
return PWMOUT_OK;
}
void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) {
never_reset_tim[self->tim_handle.timer_num] = true;
never_reset_chan[self->chan_handle.channel] = true;
}
void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) {
never_reset_tim[self->tim_handle.timer_num] = false;
never_reset_chan[self->chan_handle.channel] = false;
}
bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) {
return self->deinited == true;
}
void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
if (common_hal_pulseio_pwmout_deinited(self)) {
return;
}
ledc_stop(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, 0);
// Search if any other channel is using the timer
bool taken = false;
for (size_t i =0; i < LEDC_CHANNEL_MAX; i++) {
if (reserved_channels[i] == self->tim_handle.timer_num) {
taken = true;
}
}
// Variable frequency means there's only one channel on the timer
if (!taken || self->variable_frequency) {
ledc_timer_rst(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num);
reserved_timer_freq[self->tim_handle.timer_num] = 0;
}
reset_pin_number(self->pin_number);
reserved_channels[self->chan_handle.channel] = INDEX_EMPTY;
self->deinited = true;
}
void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) {
ledc_set_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, duty >> (16 - self->duty_resolution));
ledc_update_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel);
}
uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) {
return ledc_get_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel) << (16 - self->duty_resolution);
}
void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_t frequency) {
ledc_set_freq(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num, frequency);
}
uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) {
return ledc_get_freq(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num);
}
bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self) {
return self->variable_frequency;
}

View File

@ -0,0 +1,45 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H
#include "common-hal/microcontroller/Pin.h"
#include "driver/ledc.h"
typedef struct {
mp_obj_base_t base;
ledc_timer_config_t tim_handle;
ledc_channel_config_t chan_handle;
uint16_t pin_number;
uint8_t duty_resolution;
bool variable_frequency: 1;
bool deinited: 1;
} pulseio_pwmout_obj_t;
void pwmout_reset(void);
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H

View File

@ -0,0 +1,75 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "common-hal/pulseio/PulseIn.h"
#include "py/runtime.h"
// STATIC void pulsein_handler(uint8_t num) {
// }
void pulsein_reset(void) {
}
void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin,
uint16_t maxlen, bool idle_state) {
mp_raise_NotImplementedError(translate("PulseIn not supported on this chip"));
}
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
return false;
}
void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
}
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) {
}
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) {
}
void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
}
uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) {
return false;
}
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
return false;
}
uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) {
return false;
}
bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) {
return false;
}
uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) {
return false;
}

View File

@ -0,0 +1,53 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H
#include "common-hal/microcontroller/Pin.h"
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
const mcu_pin_obj_t* pin;
bool idle_state;
bool paused;
volatile bool first_edge;
uint16_t* buffer;
uint16_t maxlen;
volatile uint16_t start;
volatile uint16_t len;
volatile uint32_t last_overflow;
volatile uint16_t last_count;
} pulseio_pulsein_obj_t;
void pulsein_reset(void);
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H

View File

@ -0,0 +1,60 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "common-hal/pulseio/PulseOut.h"
#include "shared-bindings/pulseio/PWMOut.h"
#include "py/runtime.h"
// STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) {
// }
// STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) {
// }
// STATIC void start_timer(void) {
// }
// STATIC void pulseout_event_handler(void) {
// }
void pulseout_reset() {
}
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
const pulseio_pwmout_obj_t* carrier) {
mp_raise_NotImplementedError(translate("PulseOut not supported on this chip"));
}
bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) {
return false;
}
void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) {
}
void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pulses, uint16_t length) {
}

View File

@ -0,0 +1,42 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H
#include "common-hal/microcontroller/Pin.h"
#include "common-hal/pulseio/PWMOut.h"
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
pulseio_pwmout_obj_t *pwmout;
} pulseio_pulseout_obj_t;
void pulseout_reset(void);
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H

View File

@ -0,0 +1 @@
// No pulseio module functions.

View File

@ -25,7 +25,7 @@ CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MICROCONTROLLER = 1
CIRCUITPY_NVM = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_PULSEIO = 1
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_TOUCHIO = 0

View File

@ -38,6 +38,7 @@
#include "common-hal/busio/I2C.h"
#include "common-hal/busio/SPI.h"
#include "common-hal/busio/UART.h"
#include "common-hal/pulseio/PWMOut.h"
#include "supervisor/memory.h"
#include "supervisor/shared/tick.h"
@ -64,6 +65,9 @@ void reset_port(void) {
// A larger delay so the idle task can run and do any IDF cleanup needed.
vTaskDelay(4);
#if CIRCUITPY_PULSEIO
pwmout_reset();
#endif
#if CIRCUITPY_BUSIO
i2c_reset();
spi_reset();

View File

@ -41,12 +41,19 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
claimed_pins[pin_port] &= ~(1<<pin_number);
}
void common_hal_reset_pin(const mcu_pin_obj_t* pin) {
reset_pin_number(0, pin->number);
}
void claim_pin(const mcu_pin_obj_t* pin) {
// Set bit in claimed_pins bitmask.
claimed_pins[0] |= 1<<pin->number;
}
void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
claim_pin(pin);
}
bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) {
return !(claimed_pins[pin_port] & 1<<pin_number);
}

View File

@ -211,6 +211,7 @@ SRC_C += \
mphalport.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
peripherals/timers.c \
peripherals/stm32$(MCU_SERIES_LOWER)/clocks.c \
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/pins.c \
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/gpio.c \

View File

@ -29,7 +29,7 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "stm32f4xx_hal.h"
#include "stm32f4xx_ll_gpio.h"
@ -57,7 +57,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self,
} else {
mp_raise_ValueError(translate("Invalid ADC Unit value"));
}
claim_pin(pin);
common_hal_mcu_pin_claim(pin);
self->pin = pin;
}

View File

@ -86,7 +86,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self,
dac_on[self->dac_index] = true;
self->pin = pin;
claim_pin(pin);
common_hal_mcu_pin_claim(pin);
#endif
}

View File

@ -32,7 +32,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/shared/translate.h"
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Pin.h"
// I2C timing specs for the H7 and F7
// Configured for maximum possible clock settings for the family
@ -161,8 +161,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
if (HAL_I2C_Init(&(self->handle)) != HAL_OK) {
mp_raise_RuntimeError(translate("I2C Init Error"));
}
claim_pin(sda);
claim_pin(scl);
common_hal_mcu_pin_claim(sda);
common_hal_mcu_pin_claim(scl);
}
void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) {

View File

@ -33,7 +33,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "boards/board.h"
#include "supervisor/shared/translate.h"
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Pin.h"
// Note that any bugs introduced in this file can cause crashes at startup
// for chips using external SPI flash.
@ -233,12 +233,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
self->phase = 0;
self->bits = 8;
claim_pin(sck);
common_hal_mcu_pin_claim(sck);
if (self->mosi != NULL) {
claim_pin(mosi);
common_hal_mcu_pin_claim(mosi);
}
if (self->miso != NULL) {
claim_pin(miso);
common_hal_mcu_pin_claim(miso);
}
}

View File

@ -25,6 +25,7 @@
*/
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/busio/UART.h"
#include "mpconfigport.h"
@ -224,10 +225,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
mp_raise_ValueError(translate("UART Buffer allocation error"));
}
}
claim_pin(rx);
common_hal_mcu_pin_claim(rx);
}
if (self->tx != NULL) {
claim_pin(tx);
common_hal_mcu_pin_claim(tx);
}
self->baudrate = baudrate;
self->timeout_ms = timeout * 1000;

View File

@ -26,6 +26,7 @@
*/
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
@ -46,7 +47,7 @@ void common_hal_digitalio_digitalinout_never_reset(
digitalinout_result_t common_hal_digitalio_digitalinout_construct(
digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) {
claim_pin(pin);
common_hal_mcu_pin_claim(pin);
self->pin = pin;
GPIO_InitTypeDef GPIO_InitStruct = {0};

View File

@ -89,6 +89,8 @@ 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) {
never_reset_pins[pin_port] |= 1<<pin_number;
// Make sure never reset pins are also always claimed
claimed_pins[pin_port] |= 1<<pin_number;
}
void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) {
@ -99,15 +101,9 @@ void common_hal_reset_pin(const mcu_pin_obj_t* pin) {
reset_pin_number(pin->port, pin->number);
}
void claim_pin(const mcu_pin_obj_t* pin) {
void claim_pin(uint8_t pin_port, uint8_t pin_number) {
// Set bit in claimed_pins bitmask.
claimed_pins[pin->port] |= 1<<pin->number;
#ifdef MICROPY_HW_NEOPIXEL
if (pin == MICROPY_HW_NEOPIXEL) {
neopixel_in_use = true;
}
#endif
claimed_pins[pin_port] |= 1<<pin_number;
}
bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) {
@ -137,7 +133,12 @@ uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) {
}
void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
claim_pin(pin);
claim_pin(pin->port, pin->number);
#ifdef MICROPY_HW_NEOPIXEL
if (pin == MICROPY_HW_NEOPIXEL) {
neopixel_in_use = true;
}
#endif
}
void common_hal_mcu_pin_reset_number(uint8_t pin_no) {

View File

@ -43,7 +43,7 @@ void reset_all_pins(void);
// reset_pin_number takes the pin number instead of the pointer so that objects don't
// need to store a full pointer.
void reset_pin_number(uint8_t pin_port, uint8_t pin_number);
void claim_pin(const mcu_pin_obj_t* pin);
void claim_pin(uint8_t pin_port, uint8_t pin_number);
bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number);
void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number);
GPIO_TypeDef * pin_port(uint8_t pin_port);

View File

@ -33,7 +33,9 @@
#include "shared-bindings/microcontroller/__init__.h"
#include STM32_HAL_H
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "timers.h"
#define ALL_CLOCKS 0xFFFF
@ -41,32 +43,6 @@ STATIC uint8_t reserved_tim[TIM_BANK_ARRAY_LEN];
STATIC uint32_t tim_frequencies[TIM_BANK_ARRAY_LEN];
STATIC bool never_reset_tim[TIM_BANK_ARRAY_LEN];
STATIC void tim_clock_enable(uint16_t mask);
STATIC void tim_clock_disable(uint16_t mask);
// Get the frequency (in Hz) of the source clock for the given timer.
// On STM32F405/407/415/417 there are 2 cases for how the clock freq is set.
// If the APB prescaler is 1, then the timer clock is equal to its respective
// APB clock. Otherwise (APB prescaler > 1) the timer clock is twice its
// respective APB clock. See DM00031020 Rev 4, page 115.
STATIC uint32_t timer_get_source_freq(uint32_t tim_id) {
uint32_t source, clk_div;
if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) {
// TIM{1,8,9,10,11} are on APB2
source = HAL_RCC_GetPCLK2Freq();
clk_div = RCC->CFGR & RCC_CFGR_PPRE2;
} else {
// TIM{2,3,4,5,6,7,12,13,14} are on APB1
source = HAL_RCC_GetPCLK1Freq();
clk_div = RCC->CFGR & RCC_CFGR_PPRE1;
}
if (clk_div != 0) {
// APB prescaler for this timer is > 1
source *= 2;
}
return source;
}
STATIC uint32_t timer_get_internal_duty(uint16_t duty, uint32_t period) {
//duty cycle is duty/0xFFFF fraction x (number of pulses per period)
return (duty*period) / ((1 << 16) - 1);
@ -97,7 +73,6 @@ void pwmout_reset(void) {
never_reset_mask |= 1 << i;
}
}
tim_clock_disable(ALL_CLOCKS & ~(never_reset_mask));
}
pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
@ -107,6 +82,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
bool variable_frequency) {
TIM_TypeDef * TIMx;
uint8_t tim_num = MP_ARRAY_SIZE(mcu_tim_pin_list);
bool tim_taken_internal = false;
bool tim_chan_taken = false;
bool tim_taken_f_mismatch = false;
bool var_freq_mismatch = false;
@ -119,8 +95,13 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
//if pin is same
if (l_tim->pin == pin) {
//check if the timer has a channel active
//check if the timer has a channel active, or is reserved by main timer system
if (reserved_tim[l_tim_index] != 0) {
// Timer has already been reserved by an internal module
if (stm_peripherals_timer_is_reserved(mcu_tim_banks[l_tim_index])) {
tim_taken_internal = true;
continue; //keep looking
}
//is it the same channel? (or all channels reserved by a var-freq)
if (reserved_tim[l_tim_index] & 1 << (l_tim_channel)) {
tim_chan_taken = true;
@ -155,9 +136,12 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
reserved_tim[self->tim->tim_index - 1] |= 1 << (self->tim->channel_index - 1);
}
tim_frequencies[self->tim->tim_index - 1] = frequency;
stm_peripherals_timer_reserve(TIMx);
} else { //no match found
if (tim_chan_taken) {
mp_raise_ValueError(translate("No more timers available on this pin."));
} else if (tim_taken_internal) {
mp_raise_ValueError(translate("Timer was reserved for internal use - declare PWM pins earlier in the program"));
} else if (tim_taken_f_mismatch) {
mp_raise_ValueError(translate("Frequency must match existing PWMOut using this timer"));
} else if (var_freq_mismatch) {
@ -182,8 +166,8 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
uint32_t prescaler = 0; //prescaler is 15 bit
uint32_t period = 0; //period is 16 bit
timer_get_optimal_divisors(&period, &prescaler, frequency,
timer_get_source_freq(self->tim->tim_index));
uint32_t source_freq = stm_peripherals_timer_get_source_freq(TIMx);
timer_get_optimal_divisors(&period, &prescaler, frequency, source_freq);
//Timer init
self->handle.Instance = TIMx;
@ -260,7 +244,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
//if reserved timer has no active channels, we can disable it
if (!reserved_tim[self->tim->tim_index - 1]) {
tim_frequencies[self->tim->tim_index - 1] = 0x00;
tim_clock_disable(1 << (self->tim->tim_index - 1));
stm_peripherals_timer_free(self->handle.Instance);
}
}
@ -282,8 +266,8 @@ void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_
uint32_t prescaler = 0;
uint32_t period = 0;
timer_get_optimal_divisors(&period, &prescaler, frequency,
timer_get_source_freq(self->tim->tim_index));
uint32_t source_freq = stm_peripherals_timer_get_source_freq(self->handle.Instance);
timer_get_optimal_divisors(&period, &prescaler, frequency, source_freq);
//shut down
HAL_TIM_PWM_Stop(&self->handle, self->channel);
@ -318,131 +302,3 @@ uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) {
bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self) {
return self->variable_frequency;
}
STATIC void tim_clock_enable(uint16_t mask) {
#ifdef TIM1
if (mask & (1 << 0)) {
__HAL_RCC_TIM1_CLK_ENABLE();
}
#endif
#ifdef TIM2
if (mask & (1 << 1)) {
__HAL_RCC_TIM2_CLK_ENABLE();
}
#endif
#ifdef TIM3
if (mask & (1 << 2)) {
__HAL_RCC_TIM3_CLK_ENABLE();
}
#endif
#ifdef TIM4
if (mask & (1 << 3)) {
__HAL_RCC_TIM4_CLK_ENABLE();
}
#endif
#ifdef TIM5
if (mask & (1 << 4)) {
__HAL_RCC_TIM5_CLK_ENABLE();
}
#endif
//6 and 7 are reserved ADC timers
#ifdef TIM8
if (mask & (1 << 7)) {
__HAL_RCC_TIM8_CLK_ENABLE();
}
#endif
#ifdef TIM9
if (mask & (1 << 8)) {
__HAL_RCC_TIM9_CLK_ENABLE();
}
#endif
#ifdef TIM10
if (mask & (1 << 9)) {
__HAL_RCC_TIM10_CLK_ENABLE();
}
#endif
#ifdef TIM11
if (mask & (1 << 10)) {
__HAL_RCC_TIM11_CLK_ENABLE();
}
#endif
#ifdef TIM12
if (mask & (1 << 11)) {
__HAL_RCC_TIM12_CLK_ENABLE();
}
#endif
#ifdef TIM13
if (mask & (1 << 12)) {
__HAL_RCC_TIM13_CLK_ENABLE();
}
#endif
#ifdef TIM14
if (mask & (1 << 13)) {
__HAL_RCC_TIM14_CLK_ENABLE();
}
#endif
}
STATIC void tim_clock_disable(uint16_t mask) {
#ifdef TIM1
if (mask & (1 << 0)) {
__HAL_RCC_TIM1_CLK_DISABLE();
}
#endif
#ifdef TIM2
if (mask & (1 << 1)) {
__HAL_RCC_TIM2_CLK_DISABLE();
}
#endif
#ifdef TIM3
if (mask & (1 << 2)) {
__HAL_RCC_TIM3_CLK_DISABLE();
}
#endif
#ifdef TIM4
if (mask & (1 << 3)) {
__HAL_RCC_TIM4_CLK_DISABLE();
}
#endif
#ifdef TIM5
if (mask & (1 << 4)) {
__HAL_RCC_TIM5_CLK_DISABLE();
}
#endif
//6 and 7 are reserved ADC timers
#ifdef TIM8
if (mask & (1 << 7)) {
__HAL_RCC_TIM8_CLK_DISABLE();
}
#endif
#ifdef TIM9
if (mask & (1 << 8)) {
__HAL_RCC_TIM9_CLK_DISABLE();
}
#endif
#ifdef TIM10
if (mask & (1 << 9)) {
__HAL_RCC_TIM10_CLK_DISABLE();
}
#endif
#ifdef TIM11
if (mask & (1 << 10)) {
__HAL_RCC_TIM11_CLK_DISABLE();
}
#endif
#ifdef TIM12
if (mask & (1 << 11)) {
__HAL_RCC_TIM12_CLK_DISABLE();
}
#endif
#ifdef TIM13
if (mask & (1 << 12)) {
__HAL_RCC_TIM13_CLK_DISABLE();
}
#endif
#ifdef TIM14
if (mask & (1 << 13)) {
__HAL_RCC_TIM14_CLK_DISABLE();
}
#endif
}

View File

@ -31,40 +31,38 @@
#include "py/gc.h"
#include "py/runtime.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/pulseio/PulseIn.h"
#include "timers.h"
#include STM32_HAL_H
#define STM32_GPIO_PORT_SIZE 16
static pulseio_pulsein_obj_t* _objs[STM32_GPIO_PORT_SIZE];
STATIC TIM_HandleTypeDef t6_handle;
STATIC TIM_HandleTypeDef tim_handle;
static uint32_t overflow_count = 0;
STATIC uint8_t refcount = 0;
static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num);
void TIM6_IRQHandler(void)
void pulsein_timer_event_handler(void)
{
// Detect TIM Update event
if (__HAL_TIM_GET_FLAG(&t6_handle, TIM_FLAG_UPDATE) != RESET)
if (__HAL_TIM_GET_FLAG(&tim_handle, TIM_FLAG_UPDATE) != RESET)
{
if (__HAL_TIM_GET_IT_SOURCE(&t6_handle, TIM_IT_UPDATE) != RESET)
if (__HAL_TIM_GET_IT_SOURCE(&tim_handle, TIM_IT_UPDATE) != RESET)
{
__HAL_TIM_CLEAR_IT(&t6_handle, TIM_IT_UPDATE);
__HAL_TIM_CLEAR_IT(&tim_handle, TIM_IT_UPDATE);
overflow_count++;
}
}
}
static void pulsein_handler(uint8_t num) {
static void pulsein_exti_event_handler(uint8_t num) {
// Grab the current time first.
uint32_t current_overflow = overflow_count;
uint32_t current_count = 0;
#if HAS_BASIC_TIM
current_count = TIM6->CNT;
#endif
uint32_t current_count = tim_handle.Instance->CNT;
// Interrupt register must be cleared manually
EXTI->PR = 1 << num;
@ -105,17 +103,14 @@ void pulsein_reset(void) {
}
memset(_objs, 0, sizeof(_objs));
#if HAS_BASIC_TIM
__HAL_RCC_TIM6_CLK_DISABLE();
HAL_TIM_Base_DeInit(&tim_handle);
tim_clock_disable(stm_peripherals_timer_get_index(tim_handle.Instance));
memset(&tim_handle, 0, sizeof(tim_handle));
refcount = 0;
#endif
}
void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin,
uint16_t maxlen, bool idle_state) {
#if !(HAS_BASIC_TIM)
mp_raise_NotImplementedError(translate("PulseIn not supported on this chip"));
#else
// STM32 has one shared EXTI for each pin number, 0-15
uint8_t p_num = pin->number;
if(_objs[p_num]) {
@ -141,24 +136,34 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu
self->last_count = 0;
self->last_overflow = 0;
if (HAL_TIM_Base_GetState(&t6_handle) == HAL_TIM_STATE_RESET) {
// Set the new period
t6_handle.Instance = TIM6;
t6_handle.Init.Prescaler = 168; // HCLK is 168 mhz so divide down to 1mhz
t6_handle.Init.Period = 0xffff;
HAL_TIM_Base_Init(&t6_handle);
if (HAL_TIM_Base_GetState(&tim_handle) == HAL_TIM_STATE_RESET) {
// Find a suitable timer
TIM_TypeDef * tim_instance = stm_peripherals_find_timer();
stm_peripherals_timer_reserve(tim_instance);
// TIM6 has limited HAL support, set registers manually
t6_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt
t6_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer
t6_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts
__HAL_TIM_ENABLE_IT(&t6_handle, TIM_IT_UPDATE);
// Set ticks to 1us
uint32_t source = stm_peripherals_timer_get_source_freq(tim_instance);
uint32_t prescaler = source/1000000;
// Enable clocks and IRQ, set callback
stm_peripherals_timer_preinit(tim_instance, 4, pulsein_timer_event_handler);
// Set the new period
tim_handle.Instance = tim_instance;
tim_handle.Init.Prescaler = prescaler - 1;
tim_handle.Init.Period = 0x10000 - 1; //65 ms period (maximum)
HAL_TIM_Base_Init(&tim_handle);
// Set registers manually
tim_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt
tim_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer
tim_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts
__HAL_TIM_ENABLE_IT(&tim_handle, TIM_IT_UPDATE);
overflow_count = 0;
}
// Add to active PulseIns
refcount++;
#endif
// EXTI pins can also be read as an input
GPIO_InitTypeDef GPIO_InitStruct = {0};
@ -170,7 +175,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu
// Interrupt starts immediately
assign_EXTI_Interrupt(self, pin->number);
HAL_NVIC_EnableIRQ(self->irq);
claim_pin(pin);
common_hal_mcu_pin_claim(pin);
}
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
@ -182,16 +187,13 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
return;
}
//Remove pulsein slot from shared array
HAL_NVIC_DisableIRQ(self->irq);
_objs[self->pin->number] = NULL;
reset_pin_number(self->pin->port, self->pin->number);
self->pin = NULL;
refcount--;
if (refcount == 0) {
#if HAS_BASIC_TIM
__HAL_RCC_TIM6_CLK_DISABLE();
#endif
stm_peripherals_timer_free(tim_handle.Instance);
}
}
@ -299,23 +301,23 @@ static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num) {
void EXTI0_IRQHandler(void)
{
pulsein_handler(0);
pulsein_exti_event_handler(0);
}
void EXTI1_IRQHandler(void)
{
pulsein_handler(1);
pulsein_exti_event_handler(1);
}
void EXTI2_IRQHandler(void)
{
pulsein_handler(2);
pulsein_exti_event_handler(2);
}
void EXTI3_IRQHandler(void)
{
pulsein_handler(3);
pulsein_exti_event_handler(3);
}
void EXTI4_IRQHandler(void)
{
pulsein_handler(4);
pulsein_exti_event_handler(4);
}
void EXTI9_5_IRQHandler(void)
@ -323,7 +325,7 @@ void EXTI9_5_IRQHandler(void)
uint32_t pending = EXTI->PR;
for (uint i = 5; i <= 9; i++) {
if(pending & (1 << i)) {
pulsein_handler(i);
pulsein_exti_event_handler(i);
}
}
}
@ -333,7 +335,7 @@ void EXTI15_10_IRQHandler(void)
uint32_t pending = EXTI->PR;
for (uint i = 10; i <= 15; i++) {
if(pending & (1 << i)) {
pulsein_handler(i);
pulsein_exti_event_handler(i);
}
}
}

View File

@ -36,20 +36,20 @@
#include "supervisor/shared/translate.h"
#include STM32_HAL_H
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "timers.h"
// A single timer is shared amongst all PulseOut objects under the assumption that
// the code is single threaded.
STATIC uint8_t refcount = 0;
STATIC uint16_t *pulse_array = NULL;
STATIC volatile uint16_t pulse_array_index = 0;
STATIC uint16_t pulse_array_length;
//Timer is shared, must be accessible by interrupt
STATIC TIM_HandleTypeDef t7_handle;
STATIC TIM_HandleTypeDef tim_handle;
pulseio_pulseout_obj_t *curr_pulseout = NULL;
STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) {
// Turn on PWM
HAL_TIM_PWM_Start(&(pulseout->pwmout->handle), pulseout->pwmout->channel);
@ -65,91 +65,78 @@ STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) {
STATIC void start_timer(void) {
// Set the new period
t7_handle.Init.Period = pulse_array[pulse_array_index] - 1;
HAL_TIM_Base_Init(&t7_handle);
tim_handle.Init.Period = pulse_array[pulse_array_index] - 1;
HAL_TIM_Base_Init(&tim_handle);
// TIM7 has limited HAL support, set registers manually
t7_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt
t7_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer
t7_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts
__HAL_TIM_ENABLE_IT(&t7_handle, TIM_IT_UPDATE);
tim_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt
tim_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer
tim_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts
__HAL_TIM_ENABLE_IT(&tim_handle, TIM_IT_UPDATE);
}
STATIC void pulseout_event_handler(void) {
if (curr_pulseout->pwmout == NULL) {
return; //invalid interrupt
// Detect TIM Update event
if (__HAL_TIM_GET_FLAG(&tim_handle, TIM_FLAG_UPDATE) != RESET)
{
if (__HAL_TIM_GET_IT_SOURCE(&tim_handle, TIM_IT_UPDATE) != RESET)
{
__HAL_TIM_CLEAR_IT(&tim_handle, TIM_IT_UPDATE);
if (curr_pulseout->pwmout == NULL) {
return; //invalid interrupt
}
pulse_array_index++;
// No more pulses. Turn off output and don't restart.
if (pulse_array_index >= pulse_array_length) {
turn_off(curr_pulseout);
return;
}
// Alternate on and off, starting with on.
if (pulse_array_index % 2 == 0) {
turn_on(curr_pulseout);
} else {
turn_off(curr_pulseout);
}
// Count up to the next given value.
start_timer();
}
}
HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 1);
HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 0);
pulse_array_index++;
// No more pulses. Turn off output and don't restart.
if (pulse_array_index >= pulse_array_length) {
turn_off(curr_pulseout);
return;
}
// Alternate on and off, starting with on.
if (pulse_array_index % 2 == 0) {
turn_on(curr_pulseout);
} else {
turn_off(curr_pulseout);
}
// Count up to the next given value.
start_timer();
}
void pulseout_reset() {
#if HAS_BASIC_TIM
__HAL_RCC_TIM7_CLK_DISABLE();
stm_peripherals_timer_free(tim_handle.Instance);
refcount = 0;
#endif
}
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
const pulseio_pwmout_obj_t* carrier) {
#if !(HAS_BASIC_TIM)
mp_raise_NotImplementedError(translate("PulseOut not supported on this chip"));
#else
// Add to active PulseOuts
refcount++;
TIM_TypeDef * tim_instance = stm_peripherals_find_timer();
stm_peripherals_timer_reserve(tim_instance);
// Calculate a 1 ms period
uint32_t source, clk_div;
source = HAL_RCC_GetPCLK1Freq(); // TIM7 is on APB1
clk_div = RCC->CFGR & RCC_CFGR_PPRE1;
// APB quirk, see See DM00031020 Rev 4, page 115.
if (clk_div != 0) {
// APB prescaler for this timer is > 1
source *= 2;
}
//calculate a 1ms period
uint32_t source = stm_peripherals_timer_get_source_freq(tim_instance);
uint32_t prescaler = source/1000000; //1us intervals
__HAL_RCC_TIM7_CLK_ENABLE();
HAL_NVIC_SetPriority(TIM7_IRQn, 4, 0);
HAL_NVIC_EnableIRQ(TIM7_IRQn);
stm_peripherals_timer_preinit(tim_instance, 4, pulseout_event_handler);
tim_handle.Instance = tim_instance;
tim_handle.Init.Period = 100; //immediately replaced.
tim_handle.Init.Prescaler = prescaler - 1;
tim_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
tim_handle.Init.CounterMode = TIM_COUNTERMODE_UP;
tim_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
// Timers 6 and 7 have no pins, so using them doesn't affect PWM availability
t7_handle.Instance = TIM7;
t7_handle.Init.Period = 100; //immediately replaced.
t7_handle.Init.Prescaler = prescaler - 1;
t7_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
t7_handle.Init.CounterMode = TIM_COUNTERMODE_UP;
t7_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
HAL_TIM_Base_Init(&t7_handle);
t7_handle.Instance->SR = 0;
HAL_TIM_Base_Init(&tim_handle);
tim_handle.Instance->SR = 0;
// The HAL can't work with const, recast required.
self->pwmout = (pulseio_pwmout_obj_t*)carrier;
turn_off(self);
#endif
}
bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) {
@ -165,9 +152,7 @@ void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) {
refcount--;
if (refcount == 0) {
#if HAS_BASIC_TIM
__HAL_RCC_TIM7_CLK_DISABLE();
#endif
stm_peripherals_timer_free(tim_handle.Instance);
}
}
@ -190,24 +175,11 @@ void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pu
// signal.
RUN_BACKGROUND_TASKS;
// Use when debugging, or issues are irrecoverable
// // Use when debugging, or issues are irrecoverable
// if ((supervisor_ticks_ms64() - starttime ) > timeout ) {
// mp_raise_RuntimeError(translate("Error: Send Timeout"));
// }
}
//turn off timer counter.
t7_handle.Instance->CR1 &= ~TIM_CR1_CEN;
}
void TIM7_IRQHandler(void)
{
// Detect TIM Update event
if (__HAL_TIM_GET_FLAG(&t7_handle, TIM_FLAG_UPDATE) != RESET)
{
if (__HAL_TIM_GET_IT_SOURCE(&t7_handle, TIM_IT_UPDATE) != RESET)
{
__HAL_TIM_CLEAR_IT(&t7_handle, TIM_IT_UPDATE);
pulseout_event_handler();
}
}
tim_handle.Instance->CR1 &= ~TIM_CR1_CEN;
}

View File

@ -27,28 +27,30 @@
#include <stddef.h>
#include "common-hal/rgbmatrix/RGBMatrix.h"
#include "timers.h"
#include STM32_HAL_H
extern void _PM_IRQ_HANDLER(void);
void *common_hal_rgbmatrix_timer_allocate() {
// TODO(jepler) properly handle resource allocation including never-reset
return TIM6;
TIM_TypeDef * timer = stm_peripherals_find_timer();
stm_peripherals_timer_reserve(timer);
return timer;
}
void common_hal_rgbmatrix_timer_enable(void* ptr) {
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
TIM_TypeDef *tim = (TIM_TypeDef*)ptr;
HAL_NVIC_EnableIRQ(stm_peripherals_timer_get_irqnum(tim));
}
void common_hal_rgbmatrix_timer_disable(void* ptr) {
TIM_TypeDef *tim = (TIM_TypeDef*)ptr;
tim->DIER &= ~TIM_DIER_UIE;
HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn);
}
void common_hal_rgbmatrix_timer_free(void* ptr) {
TIM_TypeDef *tim = (TIM_TypeDef*)ptr;
stm_peripherals_timer_free(tim);
common_hal_rgbmatrix_timer_disable(ptr);
// TODO(jepler) properly handle resource allocation including never-reset
}

View File

@ -29,55 +29,57 @@
#include "peripherals/pins.h"
#include "peripherals/periph.h"
// I2C
I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3};
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_periph_obj_t mcu_i2c_sda_list[4] = {
const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN] = {
PERIPH(1, 4, &pin_PB07),
PERIPH(1, 4, &pin_PB09),
PERIPH(2, 4, &pin_PB11),
PERIPH(3, 4, &pin_PC09),
PERIPH(2, 4, &pin_PF00),
PERIPH(2, 4, &pin_PH05),
PERIPH(3, 4, &pin_PH08),
};
const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN] = {
PERIPH(3, 4, &pin_PA08),
PERIPH(1, 4, &pin_PB06),
PERIPH(1, 4, &pin_PB08),
PERIPH(2, 4, &pin_PB10),
PERIPH(3, 4, &pin_PA08)
PERIPH(2, 4, &pin_PF01),
PERIPH(2, 4, &pin_PH04),
PERIPH(3, 4, &pin_PH07),
};
SPI_TypeDef * mcu_spi_banks[3] = {SPI1, SPI2, SPI3};
SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3};
const mcu_periph_obj_t mcu_spi_sck_list[7] = {
const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN] = {
PERIPH(1, 5, &pin_PA05),
PERIPH(1, 5, &pin_PB03),
PERIPH(3, 6, &pin_PB03),
PERIPH(2, 5, &pin_PB10),
PERIPH(2, 5, &pin_PB13),
PERIPH(2, 5, &pin_PC07),
PERIPH(3, 6, &pin_PB03),
PERIPH(3, 6, &pin_PC10),
PERIPH(2, 5, &pin_PI01),
};
const mcu_periph_obj_t mcu_spi_mosi_list[6] = {
const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN] = {
PERIPH(1, 5, &pin_PA07),
PERIPH(1, 5, &pin_PB05),
PERIPH(3, 6, &pin_PB05),
PERIPH(2, 5, &pin_PB15),
PERIPH(2, 5, &pin_PC03),
PERIPH(3, 6, &pin_PB05),
PERIPH(3, 6, &pin_PC12),
PERIPH(2, 5, &pin_PI03),
};
const mcu_periph_obj_t mcu_spi_miso_list[6] = {
const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN] = {
PERIPH(1, 5, &pin_PA06),
PERIPH(1, 5, &pin_PB04),
PERIPH(3, 6, &pin_PB04),
PERIPH(2, 5, &pin_PB14),
PERIPH(2, 5, &pin_PC02),
PERIPH(3, 6, &pin_PB04),
PERIPH(3, 6, &pin_PC11),
PERIPH(2, 5, &pin_PI02),
};
const mcu_periph_obj_t mcu_spi_nss_list[6] = {
const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN] = {
PERIPH(1, 5, &pin_PA04),
PERIPH(1, 5, &pin_PA15),
PERIPH(2, 5, &pin_PB09),
@ -89,7 +91,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[6] = {
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
const mcu_periph_obj_t mcu_uart_tx_list[12] = {
const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN] = {
PERIPH(4, 8, &pin_PA00),
PERIPH(2, 7, &pin_PA02),
PERIPH(1, 7, &pin_PA09),
@ -103,8 +105,7 @@ const mcu_periph_obj_t mcu_uart_tx_list[12] = {
PERIPH(3, 7, &pin_PD08),
PERIPH(6, 8, &pin_PG14),
};
const mcu_periph_obj_t mcu_uart_rx_list[12] = {
const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN] = {
PERIPH(4, 8, &pin_PA01),
PERIPH(2, 7, &pin_PA03),
PERIPH(1, 7, &pin_PA10),
@ -121,74 +122,75 @@ const mcu_periph_obj_t mcu_uart_rx_list[12] = {
//Timers
//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
TIM11, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[56] = {
TIM(2,1,1,&pin_PA00),
TIM(5,2,1,&pin_PA00),
TIM(2,1,2,&pin_PA01),
TIM(5,2,2,&pin_PA01),
TIM(2,1,3,&pin_PA02),
TIM(5,2,3,&pin_PA02),
TIM(2,1,4,&pin_PA03),
TIM(5,2,4,&pin_PA03),
TIM(9,3,1,&pin_PA02),
TIM(9,3,2,&pin_PA03),
TIM(3,2,1,&pin_PA06),
TIM(13,9,1,&pin_PA06),
TIM(3,2,2,&pin_PA07),
TIM(14,9,1,&pin_PA07),
TIM(1,1,1,&pin_PA08),
TIM(1,1,2,&pin_PA09),
TIM(1,1,3,&pin_PA10),
TIM(1,1,4,&pin_PA11),
TIM(2,1,1,&pin_PA15),
TIM(3,2,3,&pin_PB00),
TIM(3,2,4,&pin_PB01),
TIM(2,1,2,&pin_PB03),
TIM(3,2,1,&pin_PB04),
TIM(3,2,2,&pin_PB05),
TIM(4,2,1,&pin_PB06),
TIM(4,2,2,&pin_PB07),
TIM(4,2,3,&pin_PB08),
TIM(10,2,1,&pin_PB08),
TIM(4,2,4,&pin_PB09),
TIM(11,2,1,&pin_PB09),
TIM(2,1,3,&pin_PB10),
TIM(2,1,4,&pin_PB11),
TIM(12,9,1,&pin_PB14),
TIM(12,9,2,&pin_PB15),
TIM(3,2,1,&pin_PC06),
TIM(3,2,2,&pin_PC07),
TIM(3,2,3,&pin_PC08),
TIM(3,2,4,&pin_PC09),
TIM(8,3,1,&pin_PC06),
TIM(8,3,2,&pin_PC07),
TIM(8,3,3,&pin_PC08),
TIM(8,3,4,&pin_PC09),
TIM(4,2,1,&pin_PD12),
TIM(4,2,2,&pin_PD13),
TIM(4,2,3,&pin_PD14),
TIM(4,2,4,&pin_PD15),
TIM(9,3,1,&pin_PE05),
TIM(9,3,2,&pin_PE06),
TIM(1,1,1,&pin_PE09),
TIM(1,1,2,&pin_PE11),
TIM(1,1,3,&pin_PE13),
TIM(1,1,4,&pin_PE14),
TIM(10,3,1,&pin_PF06),
TIM(11,3,1,&pin_PF07),
TIM(13,9,1,&pin_PF08),
TIM(14,9,1,&pin_PF09),
// TIM(12,9,1,&pin_PH06), //TODO: include these when pin map is expanded
// TIM(12,9,2,&pin_PH09),
// TIM(5,2,1,&pin_PH10),
// TIM(5,2,2,&pin_PH11),
// TIM(5,2,3,&pin_PH12),
// TIM(5,2,4,&pin_PI00),
// TIM(8,3,4,&pin_PI02),
// TIM(8,3,1,&pin_PI05),
// TIM(8,3,2,&pin_PI06),
// TIM(8,3,3,&pin_PI07),
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = {
TIM(2, 1, 1, &pin_PA00),
TIM(5, 2, 1, &pin_PA00),
TIM(2, 1, 2, &pin_PA01),
TIM(5, 2, 2, &pin_PA01),
TIM(2, 1, 3, &pin_PA02),
TIM(5, 2, 3, &pin_PA02),
TIM(9, 3, 1, &pin_PA02),
TIM(2, 1, 4, &pin_PA03),
TIM(5, 2, 4, &pin_PA03),
TIM(9, 3, 2, &pin_PA03),
TIM(2, 1, 1, &pin_PA05),
TIM(3, 2, 1, &pin_PA06),
TIM(13, 9, 1, &pin_PA06),
TIM(3, 2, 2, &pin_PA07),
TIM(14, 9, 1, &pin_PA07),
TIM(1, 1, 1, &pin_PA08),
TIM(1, 1, 2, &pin_PA09),
TIM(1, 1, 3, &pin_PA10),
TIM(1, 1, 4, &pin_PA11),
TIM(2, 1, 1, &pin_PA15),
TIM(3, 2, 3, &pin_PB00),
TIM(3, 2, 4, &pin_PB01),
TIM(2, 1, 2, &pin_PB03),
TIM(3, 2, 1, &pin_PB04),
TIM(3, 2, 2, &pin_PB05),
TIM(4, 2, 1, &pin_PB06),
TIM(4, 2, 2, &pin_PB07),
TIM(4, 2, 3, &pin_PB08),
TIM(10, 3, 1, &pin_PB08),
TIM(4, 2, 4, &pin_PB09),
TIM(11, 3, 1, &pin_PB09),
TIM(2, 1, 3, &pin_PB10),
TIM(2, 1, 4, &pin_PB11),
TIM(12, 9, 1, &pin_PB14),
TIM(12, 9, 2, &pin_PB15),
TIM(3, 2, 1, &pin_PC06),
TIM(8, 3, 1, &pin_PC06),
TIM(3, 2, 2, &pin_PC07),
TIM(8, 3, 2, &pin_PC07),
TIM(3, 2, 3, &pin_PC08),
TIM(8, 3, 3, &pin_PC08),
TIM(3, 2, 4, &pin_PC09),
TIM(8, 3, 4, &pin_PC09),
TIM(4, 2, 1, &pin_PD12),
TIM(4, 2, 2, &pin_PD13),
TIM(4, 2, 3, &pin_PD14),
TIM(4, 2, 4, &pin_PD15),
TIM(9, 3, 1, &pin_PE05),
TIM(9, 3, 2, &pin_PE06),
TIM(1, 1, 1, &pin_PE09),
TIM(1, 1, 2, &pin_PE11),
TIM(1, 1, 3, &pin_PE13),
TIM(1, 1, 4, &pin_PE14),
TIM(10, 3, 1, &pin_PF06),
TIM(11, 3, 1, &pin_PF07),
TIM(13, 9, 1, &pin_PF08),
TIM(14, 9, 1, &pin_PF09),
TIM(12, 9, 1, &pin_PH06),
TIM(12, 9, 2, &pin_PH09),
TIM(5, 2, 1, &pin_PH10),
TIM(5, 2, 2, &pin_PH11),
TIM(5, 2, 3, &pin_PH12),
TIM(5, 2, 4, &pin_PI00),
TIM(8, 3, 4, &pin_PI02),
TIM(8, 3, 1, &pin_PI05),
TIM(8, 3, 2, &pin_PI06),
TIM(8, 3, 3, &pin_PI07),
};

View File

@ -28,29 +28,36 @@
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H
//I2C
extern I2C_TypeDef * mcu_i2c_banks[3];
extern const mcu_periph_obj_t mcu_i2c_sda_list[4];
extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
#define I2C_BANK_ARRAY_LEN 3
#define I2C_SDA_ARRAY_LEN 7
#define I2C_SCL_ARRAY_LEN 7
extern I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN];
//SPI
extern SPI_TypeDef * mcu_spi_banks[3];
extern const mcu_periph_obj_t mcu_spi_sck_list[7];
extern const mcu_periph_obj_t mcu_spi_mosi_list[6];
extern const mcu_periph_obj_t mcu_spi_miso_list[6];
extern const mcu_periph_obj_t mcu_spi_nss_list[6];
#define SPI_BANK_ARRAY_LEN 3
#define SPI_SCK_ARRAY_LEN 7
#define SPI_MOSI_ARRAY_LEN 7
#define SPI_MISO_ARRAY_LEN 7
#define SPI_NSS_ARRAY_LEN 6
extern SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN];
//UART
#define UART_TX_ARRAY_LEN 12
#define UART_RX_ARRAY_LEN 12
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[12];
extern const mcu_periph_obj_t mcu_uart_rx_list[12];
extern const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN];
//Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 56
#define TIM_PIN_ARRAY_LEN 67
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];

View File

@ -28,33 +28,6 @@
#include "py/mphal.h"
#include "peripherals/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9)); // 144 only
const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14)); // 144 only
const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15)); // 144 only
const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4)); // 144 only
const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5)); // 144 only
const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6)); // 144 only
const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7)); // 144 only
const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8)); // 144 only
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10));
const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11));
const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12));
const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13));
const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123,0));
const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123,1));
const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123,2));
@ -63,23 +36,69 @@ const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12,4));
const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12,5));
const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12,6));
const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12,7));
const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14));
const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15));
const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12,8));
const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12,9));
const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); //BOOT1
const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC);
const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10));
const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11));
const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12));
const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13));
const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14));
const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15));
const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC);
const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC);
const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC);
const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
@ -89,73 +108,63 @@ const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC);
const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);
const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC);
const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC);
const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC);
const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9));
const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14));
const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15));
const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4));
const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5));
const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6));
const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7));
const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8));
const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC);
const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC);
const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC);
const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC);
const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC);
const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC);
const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC);
const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC);
const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC);
const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC);
const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC);
const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC);
const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC);
const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC);
const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC);
const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC);
const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC);
const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC);
const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC);
const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC);
const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC);
const mcu_pin_obj_t pin_PH00 = PIN(7, 0, NO_ADC);
const mcu_pin_obj_t pin_PH01 = PIN(7, 1, NO_ADC);
const mcu_pin_obj_t pin_PH02 = PIN(7, 2, NO_ADC);
const mcu_pin_obj_t pin_PH03 = PIN(7, 3, NO_ADC);
const mcu_pin_obj_t pin_PH04 = PIN(7, 4, NO_ADC);
const mcu_pin_obj_t pin_PH05 = PIN(7, 5, NO_ADC);
const mcu_pin_obj_t pin_PH06 = PIN(7, 6, NO_ADC);
const mcu_pin_obj_t pin_PH07 = PIN(7, 7, NO_ADC);
const mcu_pin_obj_t pin_PH08 = PIN(7, 8, NO_ADC);
const mcu_pin_obj_t pin_PH09 = PIN(7, 9, NO_ADC);
const mcu_pin_obj_t pin_PH10 = PIN(7, 10, NO_ADC);
const mcu_pin_obj_t pin_PH11 = PIN(7, 11, NO_ADC);
const mcu_pin_obj_t pin_PH12 = PIN(7, 12, NO_ADC);
const mcu_pin_obj_t pin_PH13 = PIN(7, 13, NO_ADC);
const mcu_pin_obj_t pin_PH14 = PIN(7, 14, NO_ADC);
const mcu_pin_obj_t pin_PH15 = PIN(7, 15, NO_ADC);
const mcu_pin_obj_t pin_PI00 = PIN(8, 0, NO_ADC);
const mcu_pin_obj_t pin_PI01 = PIN(8, 1, NO_ADC);
const mcu_pin_obj_t pin_PI02 = PIN(8, 2, NO_ADC);
const mcu_pin_obj_t pin_PI03 = PIN(8, 3, NO_ADC);
const mcu_pin_obj_t pin_PI04 = PIN(8, 4, NO_ADC);
const mcu_pin_obj_t pin_PI05 = PIN(8, 5, NO_ADC);
const mcu_pin_obj_t pin_PI06 = PIN(8, 6, NO_ADC);
const mcu_pin_obj_t pin_PI07 = PIN(8, 7, NO_ADC);
const mcu_pin_obj_t pin_PI08 = PIN(8, 8, NO_ADC);
const mcu_pin_obj_t pin_PI09 = PIN(8, 9, NO_ADC);
const mcu_pin_obj_t pin_PI10 = PIN(8, 10, NO_ADC);
const mcu_pin_obj_t pin_PI11 = PIN(8, 11, NO_ADC);

View File

@ -27,107 +27,54 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H
//Pins in datasheet order: DocID028087 Rev 7 page 50. LQFP100 only
//pg 50
extern const mcu_pin_obj_t pin_PE02;
extern const mcu_pin_obj_t pin_PE03;
extern const mcu_pin_obj_t pin_PE04;
extern const mcu_pin_obj_t pin_PE05;
extern const mcu_pin_obj_t pin_PE06;
extern const mcu_pin_obj_t pin_PC13;
extern const mcu_pin_obj_t pin_PC14;
//pg 51
extern const mcu_pin_obj_t pin_PC15;
extern const mcu_pin_obj_t pin_PF00; // 144 only
extern const mcu_pin_obj_t pin_PF01; // 144 only
extern const mcu_pin_obj_t pin_PF02; // 144 only
extern const mcu_pin_obj_t pin_PF03; // 144 only
extern const mcu_pin_obj_t pin_PF04; // 144 only
extern const mcu_pin_obj_t pin_PF05; // 144 only
extern const mcu_pin_obj_t pin_PF06; // 144 only
extern const mcu_pin_obj_t pin_PF07; // 144 only
extern const mcu_pin_obj_t pin_PF08; // 144 only
extern const mcu_pin_obj_t pin_PF09; // 144 only
extern const mcu_pin_obj_t pin_PF10; // 144 only
//pg 52
extern const mcu_pin_obj_t pin_PC00;
extern const mcu_pin_obj_t pin_PC01;
extern const mcu_pin_obj_t pin_PC02;
extern const mcu_pin_obj_t pin_PC03;
extern const mcu_pin_obj_t pin_PA00;
extern const mcu_pin_obj_t pin_PA01;
extern const mcu_pin_obj_t pin_PA02;
//pg 53
extern const mcu_pin_obj_t pin_PA03;
extern const mcu_pin_obj_t pin_PA04;
extern const mcu_pin_obj_t pin_PA05;
extern const mcu_pin_obj_t pin_PA06;
extern const mcu_pin_obj_t pin_PA07;
extern const mcu_pin_obj_t pin_PC04;
//pg 54
extern const mcu_pin_obj_t pin_PC05;
extern const mcu_pin_obj_t pin_PB00;
extern const mcu_pin_obj_t pin_PB01;
extern const mcu_pin_obj_t pin_PB02;
extern const mcu_pin_obj_t pin_PF11; // 144 only
extern const mcu_pin_obj_t pin_PF12; // 144 only
extern const mcu_pin_obj_t pin_PF13; // 144 only
extern const mcu_pin_obj_t pin_PF14; // 144 only
extern const mcu_pin_obj_t pin_PF15; // 144 only
extern const mcu_pin_obj_t pin_PG00; // 144 only
extern const mcu_pin_obj_t pin_PG01; // 144 only
//pg 55
extern const mcu_pin_obj_t pin_PE07;
extern const mcu_pin_obj_t pin_PE08;
extern const mcu_pin_obj_t pin_PE09;
extern const mcu_pin_obj_t pin_PE10;
extern const mcu_pin_obj_t pin_PE11;
extern const mcu_pin_obj_t pin_PE12;
extern const mcu_pin_obj_t pin_PE13;
extern const mcu_pin_obj_t pin_PE14;
//pg 56
extern const mcu_pin_obj_t pin_PE15;
extern const mcu_pin_obj_t pin_PB10;
extern const mcu_pin_obj_t pin_PB11; // 144 only
extern const mcu_pin_obj_t pin_PB12;
extern const mcu_pin_obj_t pin_PB13;
//pg 57
extern const mcu_pin_obj_t pin_PB14;
extern const mcu_pin_obj_t pin_PB15;
extern const mcu_pin_obj_t pin_PD08;
extern const mcu_pin_obj_t pin_PD09;
extern const mcu_pin_obj_t pin_PD10;
extern const mcu_pin_obj_t pin_PD11;
extern const mcu_pin_obj_t pin_PD12;
//pg 58
extern const mcu_pin_obj_t pin_PD13;
extern const mcu_pin_obj_t pin_PD14;
extern const mcu_pin_obj_t pin_PD15;
extern const mcu_pin_obj_t pin_PG02; // 144 only
extern const mcu_pin_obj_t pin_PG03; // 144 only
extern const mcu_pin_obj_t pin_PG04; // 144 only
extern const mcu_pin_obj_t pin_PG05; // 144 only
extern const mcu_pin_obj_t pin_PG06; // 144 only
extern const mcu_pin_obj_t pin_PG07; // 144 only
extern const mcu_pin_obj_t pin_PG08; // 144 only
//pg 59
extern const mcu_pin_obj_t pin_PC06;
extern const mcu_pin_obj_t pin_PC07;
extern const mcu_pin_obj_t pin_PC08;
extern const mcu_pin_obj_t pin_PC09;
extern const mcu_pin_obj_t pin_PA08;
extern const mcu_pin_obj_t pin_PA09;
extern const mcu_pin_obj_t pin_PA10;
//pg 60
extern const mcu_pin_obj_t pin_PA11;
extern const mcu_pin_obj_t pin_PA12;
extern const mcu_pin_obj_t pin_PA13;
extern const mcu_pin_obj_t pin_PA14;
extern const mcu_pin_obj_t pin_PA15;
extern const mcu_pin_obj_t pin_PB00;
extern const mcu_pin_obj_t pin_PB01;
extern const mcu_pin_obj_t pin_PB02;
extern const mcu_pin_obj_t pin_PB03;
extern const mcu_pin_obj_t pin_PB04;
extern const mcu_pin_obj_t pin_PB05;
extern const mcu_pin_obj_t pin_PB06;
extern const mcu_pin_obj_t pin_PB07;
extern const mcu_pin_obj_t pin_PB08;
extern const mcu_pin_obj_t pin_PB09;
extern const mcu_pin_obj_t pin_PB10;
extern const mcu_pin_obj_t pin_PB11;
extern const mcu_pin_obj_t pin_PB12;
extern const mcu_pin_obj_t pin_PB13;
extern const mcu_pin_obj_t pin_PB14;
extern const mcu_pin_obj_t pin_PB15;
extern const mcu_pin_obj_t pin_PC00;
extern const mcu_pin_obj_t pin_PC01;
extern const mcu_pin_obj_t pin_PC02;
extern const mcu_pin_obj_t pin_PC03;
extern const mcu_pin_obj_t pin_PC04;
extern const mcu_pin_obj_t pin_PC05;
extern const mcu_pin_obj_t pin_PC06;
extern const mcu_pin_obj_t pin_PC07;
extern const mcu_pin_obj_t pin_PC08;
extern const mcu_pin_obj_t pin_PC09;
extern const mcu_pin_obj_t pin_PC10;
extern const mcu_pin_obj_t pin_PC11;
//pg 61
extern const mcu_pin_obj_t pin_PC12;
extern const mcu_pin_obj_t pin_PC13;
extern const mcu_pin_obj_t pin_PC14;
extern const mcu_pin_obj_t pin_PC15;
extern const mcu_pin_obj_t pin_PD00;
extern const mcu_pin_obj_t pin_PD01;
extern const mcu_pin_obj_t pin_PD02;
@ -136,23 +83,89 @@ extern const mcu_pin_obj_t pin_PD04;
extern const mcu_pin_obj_t pin_PD05;
extern const mcu_pin_obj_t pin_PD06;
extern const mcu_pin_obj_t pin_PD07;
//pg 62
extern const mcu_pin_obj_t pin_PG09; // 144 only
extern const mcu_pin_obj_t pin_PG10; // 144 only
extern const mcu_pin_obj_t pin_PG11; // 144 only
extern const mcu_pin_obj_t pin_PG12; // 144 only
extern const mcu_pin_obj_t pin_PG13; // 144 only
extern const mcu_pin_obj_t pin_PG14; // 144 only
extern const mcu_pin_obj_t pin_PG15; // 144 only
extern const mcu_pin_obj_t pin_PB03;
extern const mcu_pin_obj_t pin_PB04;
//pg 63
extern const mcu_pin_obj_t pin_PB05;
extern const mcu_pin_obj_t pin_PB06;
extern const mcu_pin_obj_t pin_PB07;
extern const mcu_pin_obj_t pin_PB08;
extern const mcu_pin_obj_t pin_PB09;
extern const mcu_pin_obj_t pin_PD08;
extern const mcu_pin_obj_t pin_PD09;
extern const mcu_pin_obj_t pin_PD10;
extern const mcu_pin_obj_t pin_PD11;
extern const mcu_pin_obj_t pin_PD12;
extern const mcu_pin_obj_t pin_PD13;
extern const mcu_pin_obj_t pin_PD14;
extern const mcu_pin_obj_t pin_PD15;
extern const mcu_pin_obj_t pin_PE00;
extern const mcu_pin_obj_t pin_PE01;
extern const mcu_pin_obj_t pin_PE02;
extern const mcu_pin_obj_t pin_PE03;
extern const mcu_pin_obj_t pin_PE04;
extern const mcu_pin_obj_t pin_PE05;
extern const mcu_pin_obj_t pin_PE06;
extern const mcu_pin_obj_t pin_PE07;
extern const mcu_pin_obj_t pin_PE08;
extern const mcu_pin_obj_t pin_PE09;
extern const mcu_pin_obj_t pin_PE10;
extern const mcu_pin_obj_t pin_PE11;
extern const mcu_pin_obj_t pin_PE12;
extern const mcu_pin_obj_t pin_PE13;
extern const mcu_pin_obj_t pin_PE14;
extern const mcu_pin_obj_t pin_PE15;
extern const mcu_pin_obj_t pin_PF00;
extern const mcu_pin_obj_t pin_PF01;
extern const mcu_pin_obj_t pin_PF02;
extern const mcu_pin_obj_t pin_PF03;
extern const mcu_pin_obj_t pin_PF04;
extern const mcu_pin_obj_t pin_PF05;
extern const mcu_pin_obj_t pin_PF06;
extern const mcu_pin_obj_t pin_PF07;
extern const mcu_pin_obj_t pin_PF08;
extern const mcu_pin_obj_t pin_PF09;
extern const mcu_pin_obj_t pin_PF10;
extern const mcu_pin_obj_t pin_PF11;
extern const mcu_pin_obj_t pin_PF12;
extern const mcu_pin_obj_t pin_PF13;
extern const mcu_pin_obj_t pin_PF14;
extern const mcu_pin_obj_t pin_PF15;
extern const mcu_pin_obj_t pin_PG00;
extern const mcu_pin_obj_t pin_PG01;
extern const mcu_pin_obj_t pin_PG02;
extern const mcu_pin_obj_t pin_PG03;
extern const mcu_pin_obj_t pin_PG04;
extern const mcu_pin_obj_t pin_PG05;
extern const mcu_pin_obj_t pin_PG06;
extern const mcu_pin_obj_t pin_PG07;
extern const mcu_pin_obj_t pin_PG08;
extern const mcu_pin_obj_t pin_PG09;
extern const mcu_pin_obj_t pin_PG10;
extern const mcu_pin_obj_t pin_PG11;
extern const mcu_pin_obj_t pin_PG12;
extern const mcu_pin_obj_t pin_PG13;
extern const mcu_pin_obj_t pin_PG14;
extern const mcu_pin_obj_t pin_PG15;
extern const mcu_pin_obj_t pin_PH00;
extern const mcu_pin_obj_t pin_PH01;
extern const mcu_pin_obj_t pin_PH02;
extern const mcu_pin_obj_t pin_PH03;
extern const mcu_pin_obj_t pin_PH04;
extern const mcu_pin_obj_t pin_PH05;
extern const mcu_pin_obj_t pin_PH06;
extern const mcu_pin_obj_t pin_PH07;
extern const mcu_pin_obj_t pin_PH08;
extern const mcu_pin_obj_t pin_PH09;
extern const mcu_pin_obj_t pin_PH10;
extern const mcu_pin_obj_t pin_PH11;
extern const mcu_pin_obj_t pin_PH12;
extern const mcu_pin_obj_t pin_PH13;
extern const mcu_pin_obj_t pin_PH14;
extern const mcu_pin_obj_t pin_PH15;
extern const mcu_pin_obj_t pin_PI00;
extern const mcu_pin_obj_t pin_PI01;
extern const mcu_pin_obj_t pin_PI02;
extern const mcu_pin_obj_t pin_PI03;
extern const mcu_pin_obj_t pin_PI04;
extern const mcu_pin_obj_t pin_PI05;
extern const mcu_pin_obj_t pin_PI06;
extern const mcu_pin_obj_t pin_PI07;
extern const mcu_pin_obj_t pin_PI08;
extern const mcu_pin_obj_t pin_PI09;
extern const mcu_pin_obj_t pin_PI10;
extern const mcu_pin_obj_t pin_PI11;
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H

View File

@ -0,0 +1,460 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "timers.h"
#include "py/mpconfig.h"
#include "py/gc.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#if !(CPY_STM32H7)
#define ALL_CLOCKS 0xFFFF
#define NULL_IRQ 0xFF
static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)];
static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)];
static void (*stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)])(void);
static size_t irq_map[] = {
#ifdef TIM1
TIM1_CC_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM2
TIM2_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM3
TIM3_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM4
TIM4_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM5
TIM5_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM6
#if !defined(DAC_BASE) && !defined(DAC1_BASE)
TIM6_IRQn,
#else
TIM6_DAC_IRQn,
#endif
#else
NULL_IRQ,
#endif
#ifdef TIM7
TIM7_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM8
TIM8_CC_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM9
TIM1_BRK_TIM9_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM10
TIM1_UP_TIM10_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM11
TIM1_TRG_COM_TIM11_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM12
TIM8_BRK_TIM12_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM13
TIM8_UP_TIM13_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM14
TIM8_TRG_COM_TIM14_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM15
TIM15_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM16
TIM16_IRQn,
#else
NULL_IRQ,
#endif
#ifdef TIM17
TIM17_IRQn,
#else
NULL_IRQ,
#endif
};
// Get the frequency (in Hz) of the source clock for the given timer.
// On STM32F405/407/415/417 there are 2 cases for how the clock freq is set.
// If the APB prescaler is 1, then the timer clock is equal to its respective
// APB clock. Otherwise (APB prescaler > 1) the timer clock is twice its
// respective APB clock. See DM00031020 Rev 4, page 115.
uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer) {
size_t tim_id = stm_peripherals_timer_get_index(timer);
uint32_t source, clk_div;
if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) {
// TIM{1,8,9,10,11} are on APB2
source = HAL_RCC_GetPCLK2Freq();
clk_div = RCC->CFGR & RCC_CFGR_PPRE2;
} else {
// TIM{2,3,4,5,6,7,12,13,14} are on APB1
source = HAL_RCC_GetPCLK1Freq();
clk_div = RCC->CFGR & RCC_CFGR_PPRE1;
}
if (clk_div != 0) {
// APB prescaler for this timer is > 1
source *= 2;
}
return source;
}
size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef * instance) {
size_t tim_id = stm_peripherals_timer_get_index(instance);
return irq_map[tim_id];
}
void timers_reset(void) {
uint16_t never_reset_mask = 0x00;
for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) {
if (!stm_timer_never_reset[i]) {
stm_timer_reserved[i] = false;
} else {
never_reset_mask |= 1 << i;
}
}
tim_clock_disable(ALL_CLOCKS & ~(never_reset_mask));
}
TIM_TypeDef * stm_peripherals_find_timer(void) {
// Check for timers on pins outside the package size
for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) {
bool timer_in_package = false;
// Find each timer instance on the given bank
for (size_t j = 0; j < MP_ARRAY_SIZE(mcu_tim_pin_list); j++) {
// If a pin is claimed, we skip it
if ( (mcu_tim_pin_list[j].tim_index == i + 1)
&& (common_hal_mcu_pin_is_free(mcu_tim_pin_list[j].pin) == true) ) {
// Search whether any pins in the package array match it
for (size_t k = 0; k < mcu_pin_globals.map.alloc; k++) {
if ( (mcu_tim_pin_list[j].pin == (mcu_pin_obj_t*)(mcu_pin_globals.map.table[k].value)) ) {
timer_in_package = true;
}
}
}
}
// If no results are found, no unclaimed pins with this timer are in this package,
// and it is safe to pick
if (timer_in_package == false && mcu_tim_banks[i] != NULL) {
// DEBUG: print the timer
return mcu_tim_banks[i];
mp_printf(&mp_plat_print, "Timer: %d\n",i);
}
}
//TODO: secondary search for timers outside the pins in the board profile
// Work backwards - higher index timers have fewer pin allocations
for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) {
if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) {
// DEBUG: print the timer
mp_printf(&mp_plat_print, "Timer: %d\n",i);
return mcu_tim_banks[i];
}
}
mp_raise_RuntimeError(translate("All timers in use"));
return NULL;
}
void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void)) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_callback[tim_idx] = callback;
tim_clock_enable(1 << tim_idx);
HAL_NVIC_SetPriority(irq_map[tim_idx], prio, 0);
HAL_NVIC_EnableIRQ(irq_map[tim_idx]);
}
void stm_peripherals_timer_reserve(TIM_TypeDef * instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_reserved[tim_idx] = true;
}
void stm_peripherals_timer_set_callback(void(*callback)(void), TIM_TypeDef * timer) {
stm_timer_callback[stm_peripherals_timer_get_index(timer)] = callback;
}
void stm_peripherals_timer_free(TIM_TypeDef * instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
HAL_NVIC_DisableIRQ(irq_map[tim_idx]);
stm_timer_callback[tim_idx] = NULL;
tim_clock_disable(1 << tim_idx);
stm_timer_reserved[tim_idx] = false;
stm_timer_never_reset[tim_idx] = false;
}
void stm_peripherals_timer_never_reset(TIM_TypeDef * instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_never_reset[tim_idx] = true;
}
void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_never_reset[tim_idx] = false;
}
bool stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance){
size_t tim_idx = stm_peripherals_timer_get_index(instance);
return stm_timer_never_reset[tim_idx];
}
bool stm_peripherals_timer_is_reserved(TIM_TypeDef * instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
return stm_timer_reserved[tim_idx];
}
size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance) {
for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) {
if (instance == mcu_tim_banks[i]) {
return i;
}
}
return ~(size_t)0;
}
void tim_clock_enable(uint16_t mask) {
#ifdef TIM1
if (mask & (1 << 0)) {
__HAL_RCC_TIM1_CLK_ENABLE();
}
#endif
#ifdef TIM2
if (mask & (1 << 1)) {
__HAL_RCC_TIM2_CLK_ENABLE();
}
#endif
#ifdef TIM3
if (mask & (1 << 2)) {
__HAL_RCC_TIM3_CLK_ENABLE();
}
#endif
#ifdef TIM4
if (mask & (1 << 3)) {
__HAL_RCC_TIM4_CLK_ENABLE();
}
#endif
#ifdef TIM5
if (mask & (1 << 4)) {
__HAL_RCC_TIM5_CLK_ENABLE();
}
#endif
//6 and 7 are reserved ADC timers
#ifdef TIM8
if (mask & (1 << 7)) {
__HAL_RCC_TIM8_CLK_ENABLE();
}
#endif
#ifdef TIM9
if (mask & (1 << 8)) {
__HAL_RCC_TIM9_CLK_ENABLE();
}
#endif
#ifdef TIM10
if (mask & (1 << 9)) {
__HAL_RCC_TIM10_CLK_ENABLE();
}
#endif
#ifdef TIM11
if (mask & (1 << 10)) {
__HAL_RCC_TIM11_CLK_ENABLE();
}
#endif
#ifdef TIM12
if (mask & (1 << 11)) {
__HAL_RCC_TIM12_CLK_ENABLE();
}
#endif
#ifdef TIM13
if (mask & (1 << 12)) {
__HAL_RCC_TIM13_CLK_ENABLE();
}
#endif
#ifdef TIM14
if (mask & (1 << 13)) {
__HAL_RCC_TIM14_CLK_ENABLE();
}
#endif
}
void tim_clock_disable(uint16_t mask) {
#ifdef TIM1
if (mask & (1 << 0)) {
__HAL_RCC_TIM1_CLK_DISABLE();
}
#endif
#ifdef TIM2
if (mask & (1 << 1)) {
__HAL_RCC_TIM2_CLK_DISABLE();
}
#endif
#ifdef TIM3
if (mask & (1 << 2)) {
__HAL_RCC_TIM3_CLK_DISABLE();
}
#endif
#ifdef TIM4
if (mask & (1 << 3)) {
__HAL_RCC_TIM4_CLK_DISABLE();
}
#endif
#ifdef TIM5
if (mask & (1 << 4)) {
__HAL_RCC_TIM5_CLK_DISABLE();
}
#endif
//6 and 7 are reserved ADC timers
#ifdef TIM8
if (mask & (1 << 7)) {
__HAL_RCC_TIM8_CLK_DISABLE();
}
#endif
#ifdef TIM9
if (mask & (1 << 8)) {
__HAL_RCC_TIM9_CLK_DISABLE();
}
#endif
#ifdef TIM10
if (mask & (1 << 9)) {
__HAL_RCC_TIM10_CLK_DISABLE();
}
#endif
#ifdef TIM11
if (mask & (1 << 10)) {
__HAL_RCC_TIM11_CLK_DISABLE();
}
#endif
#ifdef TIM12
if (mask & (1 << 11)) {
__HAL_RCC_TIM12_CLK_DISABLE();
}
#endif
#ifdef TIM13
if (mask & (1 << 12)) {
__HAL_RCC_TIM13_CLK_DISABLE();
}
#endif
#ifdef TIM14
if (mask & (1 << 13)) {
__HAL_RCC_TIM14_CLK_DISABLE();
}
#endif
}
STATIC void callback_router(size_t index) {
if (stm_timer_callback[index - 1]) {
(*stm_timer_callback[index - 1])();
}
}
void TIM1_CC_IRQHandler(void) { // Advanced timer
callback_router(1);
}
void TIM2_IRQHandler(void) {
callback_router(2);
}
void TIM3_IRQHandler(void) {
callback_router(3);
}
void TIM4_IRQHandler(void) {
callback_router(4);
}
void TIM5_IRQHandler(void) {
callback_router(5);
}
void TIM6_DAC_IRQHandler(void) { // Basic timer (DAC)
callback_router(6);
}
void TIM7_IRQHandler(void) { // Basic timer
callback_router(7);
}
void TIM8_CC_IRQHandler(void) { // Advanced timer
callback_router(8);
}
// Advanced timer interrupts are currently unused.
void TIM1_BRK_TIM9_IRQHandler(void) {
callback_router(9);
}
void TIM1_UP_TIM10_IRQHandler(void) {
callback_router(10);
}
void TIM1_TRG_COM_TIM11_IRQHandler(void) {
callback_router(11);
}
void TIM8_BRK_TIM12_IRQHandler(void) {
callback_router(12);
}
void TIM8_UP_TIM13_IRQHandler(void) {
callback_router(13);
}
void TIM8_TRG_COM_TIM14_IRQHandler(void) {
callback_router(14);
}
#if (CPY_STM32H7)
void TIM15_IRQHandler(void) {
callback_router(15);
}
void TIM16_IRQHandler(void) {
callback_router(16);
}
void TIM17_IRQHandler(void) {
callback_router(17);
}
#endif
#endif

View File

@ -0,0 +1,46 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdint.h>
#include "py/mphal.h"
#include "peripherals/periph.h"
#include STM32_HAL_H
void tim_clock_enable(uint16_t mask);
void tim_clock_disable(uint16_t mask);
uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer);
size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef * instance);
void timers_reset(void);
TIM_TypeDef * stm_peripherals_find_timer(void);
void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void));
void stm_peripherals_timer_reserve(TIM_TypeDef * instance);
void stm_peripherals_timer_free(TIM_TypeDef * instance);
void stm_peripherals_timer_never_reset(TIM_TypeDef * instance);
void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance);
bool stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance);
bool stm_peripherals_timer_is_reserved(TIM_TypeDef * instance);
size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance);

View File

@ -41,6 +41,7 @@
#include "common-hal/pulseio/PWMOut.h"
#include "common-hal/pulseio/PulseOut.h"
#include "common-hal/pulseio/PulseIn.h"
#include "timers.h"
#endif
#include "clocks.h"
@ -224,6 +225,7 @@ void reset_port(void) {
uart_reset();
#endif
#if CIRCUITPY_PULSEIO
timers_reset();
pwmout_reset();
pulseout_reset();
pulsein_reset();

View File

@ -86,6 +86,8 @@ void init_usb_hardware(void) {
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 11);
never_reset_pin_number(0, 12);
claim_pin(0, 11);
claim_pin(0, 12);
/* Configure VBUS Pin */
#if !(BOARD_NO_VBUS_SENSE)
@ -94,6 +96,7 @@ void init_usb_hardware(void) {
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 9);
claim_pin(0, 9);
#endif
/* This for ID line debug */
@ -108,6 +111,7 @@ void init_usb_hardware(void) {
#endif
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 10);
claim_pin(0, 10);
#ifdef STM32F412Zx
/* Configure POWER_SWITCH IO pin (F412 ONLY)*/
@ -116,6 +120,7 @@ void init_usb_hardware(void) {
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
never_reset_pin_number(0, 8);
claim_pin(0, 8);
#endif
#if CPY_STM32H7

View File

@ -52,6 +52,8 @@ def evaluate_tim(inper, inlist, altfn, pin):
if inper[:3] == "TIM" and inper[5:7] == "CH" and inper[-1:] != 'N':
inlist.append([inper[3:4],altfn,inper[-1:],pin])
elif inper[:3] == "TIM" and inper[6:8] == "CH" and inper[-1:] != 'N':
inlist.append([inper[3:5],altfn,inper[-1:],pin])
# Open target file
with open(sys.argv[1]) as csv_file:

View File

@ -1,93 +0,0 @@
A0,PA3
A1,PC0
A2,PC3
A3,PB1
A4,PC2
A5,PF10
A6,PF4
A7,PF5
A8,PF6
D0,PB7
D1,PB6
D2,PG14
D3,PE13
D4,PE14
D5,PE11
D6,PE9
D7,PG12
D8,PF3
D9,PD15
D10,PD14
D11,PB5
D12,PA6
D13,PA5
D14,PB9
D15,PB8
D16,PC6
D17,PB15
D18,PB13
D19,PB12
D20,PA15
D21,PC7
D22,PB5
D23,PB3
D24,PA4
D25,PB4
D26,PG6
D27,PB2
D28,PD13
D29,PD12
D30,PD11
D31,PE2
D32,PA0
D33,PB0
D34,PE0
D35,PB11
D36,PB10
D37,PE15
D38,PE6
D39,PE12
D40,PE10
D41,PE7
D42,PE8
D43,PC8
D44,PC9
D45,PC10
D46,PC11
D47,PC12
D48,PD2
D49,PG2
D50,PG3
D51,PD7
D52,PD6
D53,PD5
D54,PD4
D55,PD3
D56,PE2
D57,PE4
D58,PE5
D59,PE6
D60,PE3
D61,PF8
D62,PF7
D63,PF9
D64,PG1
D65,PG0
D66,PD1
D67,PD0
D68,PF0
D69,PF1
D70,PF2
D71,PE0
D72,PB2
SDA,PB9
SCL,PB8
MOSI,PB5
MISO,PA6
SCK,PA5
RX,PB7
TX,PB6
LED1,PB00
LED2,PE01
LED3,PB14
SW,PC13
1 A0 PA3
2 A1 PC0
3 A2 PC3
4 A3 PB1
5 A4 PC2
6 A5 PF10
7 A6 PF4
8 A7 PF5
9 A8 PF6
10 D0 PB7
11 D1 PB6
12 D2 PG14
13 D3 PE13
14 D4 PE14
15 D5 PE11
16 D6 PE9
17 D7 PG12
18 D8 PF3
19 D9 PD15
20 D10 PD14
21 D11 PB5
22 D12 PA6
23 D13 PA5
24 D14 PB9
25 D15 PB8
26 D16 PC6
27 D17 PB15
28 D18 PB13
29 D19 PB12
30 D20 PA15
31 D21 PC7
32 D22 PB5
33 D23 PB3
34 D24 PA4
35 D25 PB4
36 D26 PG6
37 D27 PB2
38 D28 PD13
39 D29 PD12
40 D30 PD11
41 D31 PE2
42 D32 PA0
43 D33 PB0
44 D34 PE0
45 D35 PB11
46 D36 PB10
47 D37 PE15
48 D38 PE6
49 D39 PE12
50 D40 PE10
51 D41 PE7
52 D42 PE8
53 D43 PC8
54 D44 PC9
55 D45 PC10
56 D46 PC11
57 D47 PC12
58 D48 PD2
59 D49 PG2
60 D50 PG3
61 D51 PD7
62 D52 PD6
63 D53 PD5
64 D54 PD4
65 D55 PD3
66 D56 PE2
67 D57 PE4
68 D58 PE5
69 D59 PE6
70 D60 PE3
71 D61 PF8
72 D62 PF7
73 D63 PF9
74 D64 PG1
75 D65 PG0
76 D66 PD1
77 D67 PD0
78 D68 PF0
79 D69 PF1
80 D70 PF2
81 D71 PE0
82 D72 PB2
83 SDA PB9
84 SCL PB8
85 MOSI PB5
86 MISO PA6
87 SCK PA5
88 RX PB7
89 TX PB6
90 LED1 PB00
91 LED2 PE01
92 LED3 PB14
93 SW PC13

View File

@ -1,168 +0,0 @@
PortA,PA0,,TIM2_CH1/TIM2_ETR,TIM5_CH1,TIM8_ETR,,,,USART2_CTS,UART4_TX,,SAI2_SD_B,ETH_MII_CRS,,,,EVENTOUT,ADC123_IN0
PortA,PA1,,TIM2_CH2,TIM5_CH2,,,,,USART2_RTS,UART4_RX,QUADSPI_BK1_IO3,SAI2_MCK_B,ETH_MII_RX_CLK/ETH_RMII_REF_CLK,,,LCD_R2,EVENTOUT,ADC123_IN1
PortA,PA2,,TIM2_CH3,TIM5_CH3,TIM9_CH1,,,,USART2_TX,SAI2_SCK_B,,,ETH_MDIO,MDIOS_MDIO,,LCD_R1,EVENTOUT,ADC123_IN2
PortA,PA3,,TIM2_CH4,TIM5_CH4,TIM9_CH2,,,,USART2_RX,,LCD_B2,OTG_HS_ULPI_D0,ETH_MII_COL,,,LCD_B5,EVENTOUT,ADC123_IN3
PortA,PA4,,,,,,SPI1_NSS/I2S1_WS,SPI3_NSS/I2S3_WS,USART2_CK,SPI6_NSS,,,,OTG_HS_SOF,DCMI_HSYNC,LCD_VSYNC,EVENTOUT,ADC12_IN4
PortA,PA5,,TIM2_CH1/TIM2_ETR,,TIM8_CH1N,,SPI1_SCK/I2S1_CK,,,SPI6_SCK,,OTG_HS_ULPI_CK,,,,LCD_R4,EVENTOUT,ADC12_IN5
PortA,PA6,,TIM1_BKIN,TIM3_CH1,TIM8_BKIN,,SPI1_MISO,,,SPI6_MISO,TIM13_CH1,,,MDIOS_MDC,DCMI_PIXCLK,LCD_G2,EVENTOUT,ADC12_IN6
PortA,PA7,,TIM1_CH1N,TIM3_CH2,TIM8_CH1N,,SPI1_MOSI/I2S1_SD,,,SPI6_MOSI,TIM14_CH1,,ETH_MII_RX_DV/ETH_RMII_CRS_DV,FMC_SDNWE,,,EVENTOUT,ADC12_IN7
PortA,PA8,MCO1,TIM1_CH1,,TIM8_BKIN2,I2C3_SCL,,,USART1_CK,,,OTG_FS_SOF,CAN3_RX,UART7_RX,LCD_B3,LCD_R6,EVENTOUT,
PortA,PA9,,TIM1_CH2,,,I2C3_SMBA,SPI2_SCK/I2S2_CK,,USART1_TX,,,,,,DCMI_D0,LCD_R5,EVENTOUT,
PortA,PA10,,TIM1_CH3,,,,,,USART1_RX,,LCD_B4,OTG_FS_ID,,MDIOS_MDIO,DCMI_D1,LCD_B1,EVENTOUT,
PortA,PA11,,TIM1_CH4,,,,SPI2_NSS/I2S2_WS,UART4_RX,USART1_CTS,,CAN1_RX,OTG_FS_DM,,,,LCD_R4,EVENTOUT,
PortA,PA12,,TIM1_ETR,,,,SPI2_SCK/I2S2_CK,UART4_TX,USART1_RTS,SAI2_FS_B,CAN1_TX,OTG_FS_DP,,,,LCD_R5,EVENTOUT,
PortA,PA13,JTMS/SWDIO,,,,,,,,,,,,,,,EVENTOUT,
PortA,PA14,JTCK/SWCLK,,,,,,,,,,,,,,,EVENTOUT,
PortA,PA15,JTDI,TIM2_CH1/TIM2_ETR,,,HDMI_CEC,SPI1_NSS/I2S1_WS,SPI3_NSS/I2S3_WS,SPI6_NSS,UART4_RTS,,,CAN3_TX,UART7_TX,,,EVENTOUT,
PortB,PB0,,TIM1_CH2N,TIM3_CH3,TIM8_CH2N,,,DFSDM1_CKOUT,,UART4_CTS,LCD_R3,OTG_HS_ULPI_D1,ETH_MII_RXD2,,,LCD_G1,EVENTOUT,ADC12_IN8
PortB,PB1,,TIM1_CH3N,TIM3_CH4,TIM8_CH3N,,,DFSDM1_DATAIN1,,,LCD_R6,OTG_HS_ULPI_D2,ETH_MII_RXD3,,,LCD_G0,EVENTOUT,ADC12_IN9
PortB,PB2,,,,,,,SAI1_SD_A,SPI3_MOSI/I2S3_SD,,QUADSPI_CLK,DFSDM1_CKIN1,,,,,EVENTOUT,
PortB,PB3,JTDO/TRACESWO,TIM2_CH2,,,,SPI1_SCK/I2S1_CK,SPI3_SCK/I2S3_CK,,SPI6_SCK,,SDMMC2_D2,CAN3_RX,UART7_RX,,,EVENTOUT,
PortB,PB4,NJTRST,,TIM3_CH1,,,SPI1_MISO,SPI3_MISO,SPI2_NSS/I2S2_WS,SPI6_MISO,,SDMMC2_D3,CAN3_TX,UART7_TX,,,EVENTOUT,
PortB,PB5,,UART5_RX,TIM3_CH2,,I2C1_SMBA,SPI1_MOSI/I2S1_SD,SPI3_MOSI/I2S3_SD,,SPI6_MOSI,CAN2_RX,OTG_HS_ULPI_D7,ETH_PPS_OUT,FMC_SDCKE1,DCMI_D10,LCD_G7,EVENTOUT,
PortB,PB6,,UART5_TX,TIM4_CH1,HDMI_CEC,I2C1_SCL,,DFSDM1_DATAIN5,USART1_TX,,CAN2_TX,QUADSPI_BK1_NCS,I2C4_SCL,FMC_SDNE1,DCMI_D5,,EVENTOUT,
PortB,PB7,,,TIM4_CH2,,I2C1_SDA,,DFSDM1_CKIN5,USART1_RX,,,,I2C4_SDA,FMC_NL,DCMI_VSYNC,,EVENTOUT,
PortB,PB8,,I2C4_SCL,TIM4_CH3,TIM10_CH1,I2C1_SCL,,DFSDM1_CKIN7,UART5_RX,,CAN1_RX,SDMMC2_D4,ETH_MII_TXD3,SDMMC1_D4,DCMI_D6,LCD_B6,EVENTOUT,
PortB,PB9,,I2C4_SDA,TIM4_CH4,TIM11_CH1,I2C1_SDA,SPI2_NSS/I2S2_WS,DFSDM1_DATAIN7,UART5_TX,,CAN1_TX,SDMMC2_D5,I2C4_SMBA,SDMMC1_D5,DCMI_D7,LCD_B7,EVENTOUT,
PortB,PB10,,TIM2_CH3,,,I2C2_SCL,SPI2_SCK/I2S2_CK,DFSDM1_DATAIN7,USART3_TX,,QUADSPI_BK1_NCS,OTG_HS_ULPI_D3,ETH_MII_RX_ER,,,LCD_G4,EVENTOUT,
PortB,PB11,,TIM2_CH4,,,I2C2_SDA,,DFSDM1_CKIN7,USART3_RX,,,OTG_HS_ULPI_D4,ETH_MII_TX_EN/ETH_RMII_TX_EN,,DSI_TE,LCD_G5,EVENTOUT,
PortB,PB12,,TIM1_BKIN,,,I2C2_SMBA,SPI2_NSS/I2S2_WS,DFSDM1_DATAIN1,USART3_CK,UART5_RX,CAN2_RX,OTG_HS_ULPI_D5,ETH_MII_TXD0/ETH_RMII_TXD0,OTG_HS_ID,,,EVENTOUT,
PortB,PB13,,TIM1_CH1N,,,,SPI2_SCK/I2S2_CK,DFSDM1_CKIN1,USART3_CTS,UART5_TX,CAN2_TX,OTG_HS_ULPI_D6,ETH_MII_TXD1/ETH_RMII_TXD1,,,,EVENTOUT,
PortB,PB14,,TIM1_CH2N,,TIM8_CH2N,USART1_TX,SPI2_MISO,DFSDM1_DATAIN2,USART3_RTS,UART4_RTS,TIM12_CH1,SDMMC2_D0,,OTG_HS_DM,,,EVENTOUT,
PortB,PB15,RTC_REFIN,TIM1_CH3N,,TIM8_CH3N,USART1_RX,SPI2_MOSI/I2S2_SD,DFSDM1_CKIN2,,UART4_CTS,TIM12_CH2,SDMMC2_D1,,OTG_HS_DP,,,EVENTOUT,
PortC,PC0,,,,DFSDM1_CKIN0,,,DFSDM1_DATAIN4,,SAI2_FS_B,,OTG_HS_ULPI_STP,,FMC_SDNWE,,LCD_R5,EVENTOUT,ADC123_IN10
PortC,PC1,TRACED0,,,DFSDM1_DATAIN0,,SPI2_MOSI/I2S2_SD,SAI1_SD_A,,,,DFSDM1_CKIN4,ETH_MDC,MDIOS_MDC,,,EVENTOUT,ADC123_IN11
PortC,PC2,,,,DFSDM1_CKIN1,,SPI2_MISO,DFSDM1_CKOUT,,,,OTG_HS_ULPI_DIR,ETH_MII_TXD2,FMC_SDNE0,,,EVENTOUT,ADC123_IN12
PortC,PC3,,,,DFSDM1_DATAIN1,,SPI2_MOSI/I2S2_SD,,,,,OTG_HS_ULPI_NXT,ETH_MII_TX_CLK,FMC_SDCKE0,,,EVENTOUT,ADC123_IN13
PortC,PC4,,,,DFSDM1_CKIN2,,I2S1_MCK,,,SPDIFRX_IN2,,,ETH_MII_RXD0/ETH_RMII_RXD0,FMC_SDNE0,,,EVENTOUT,ADC12_IN14
PortC,PC5,,,,DFSDM1_DATAIN2,,,,,SPDIFRX_IN3,,,ETH_MII_RXD1/ETH_RMII_RXD1,FMC_SDCKE0,,,EVENTOUT,ADC12_IN15
PortC,PC6,,,TIM3_CH1,TIM8_CH1,,I2S2_MCK,,DFSDM1_CKIN3,USART6_TX,FMC_NWAIT,SDMMC2_D6,,SDMMC1_D6,DCMI_D0,LCD_HSYNC,EVENTOUT,
PortC,PC7,,,TIM3_CH2,TIM8_CH2,,,I2S3_MCK,DFSDM1_DATAIN3,USART6_RX,FMC_NE1,SDMMC2_D7,,SDMMC1_D7,DCMI_D1,LCD_G6,EVENTOUT,
PortC,PC8,TRACED1,,TIM3_CH3,TIM8_CH3,,,,UART5_RTS,USART6_CK,FMC_NE2/FMC_NCE,,,SDMMC1_D0,DCMI_D2,,EVENTOUT,
PortC,PC9,MCO2,,TIM3_CH4,TIM8_CH4,I2C3_SDA,I2S_CKIN,,UART5_CTS,,QUADSPI_BK1_IO0,LCD_G3,,SDMMC1_D1,DCMI_D3,LCD_B2,EVENTOUT,
PortC,PC10,,,,DFSDM1_CKIN5,,,SPI3_SCK/I2S3_CK,USART3_TX,UART4_TX,QUADSPI_BK1_IO1,,,SDMMC1_D2,DCMI_D8,LCD_R2,EVENTOUT,
PortC,PC11,,,,DFSDM1_DATAIN5,,,SPI3_MISO,USART3_RX,UART4_RX,QUADSPI_BK2_NCS,,,SDMMC1_D3,DCMI_D4,,EVENTOUT,
PortC,PC12,TRACED3,,,,,,SPI3_MOSI/I2S3_SD,USART3_CK,UART5_TX,,,,SDMMC1_CK,DCMI_D9,,EVENTOUT,
PortC,PC13,,,,,,,,,,,,,,,,EVENTOUT,
PortC,PC14,,,,,,,,,,,,,,,,EVENTOUT,
PortC,PC15,,,,,,,,,,,,,,,,EVENTOUT,
PortD,PD0,,,,DFSDM1_CKIN6,,,DFSDM1_DATAIN7,,UART4_RX,CAN1_RX,,,FMC_D2,,,EVENTOUT,
PortD,PD1,,,,DFSDM1_DATAIN6,,,DFSDM1_CKIN7,,UART4_TX,CAN1_TX,,,FMC_D3,,,EVENTOUT,
PortD,PD2,TRACED2,,TIM3_ETR,,,,,,UART5_RX,,,,SDMMC1_CMD,DCMI_D11,,EVENTOUT,
PortD,PD3,,,,DFSDM1_CKOUT,,SPI2_SCK/I2S2_CK,DFSDM1_DATAIN0,USART2_CTS,,,,,FMC_CLK,DCMI_D5,LCD_G7,EVENTOUT,
PortD,PD4,,,,,,,DFSDM1_CKIN0,USART2_RTS,,,,,FMC_NOE,,,EVENTOUT,
PortD,PD5,,,,,,,,USART2_TX,,,,,FMC_NWE,,,EVENTOUT,
PortD,PD6,,,,DFSDM1_CKIN4,,SPI3_MOSI/I2S3_SD,SAI1_SD_A,USART2_RX,,,DFSDM1_DATAIN1,SDMMC2_CK,FMC_NWAIT,DCMI_D10,LCD_B2,EVENTOUT,
PortD,PD7,,,,DFSDM1_DATAIN4,,SPI1_MOSI/I2S1_SD,DFSDM1_CKIN1,USART2_CK,SPDIFRX_IN0,,,SDMMC2_CMD,FMC_NE1,,,EVENTOUT,
PortD,PD8,,,,DFSDM1_CKIN3,,,,USART3_TX,SPDIFRX_IN1,,,,FMC_D13,,,EVENTOUT,
PortD,PD9,,,,DFSDM1_DATAIN3,,,,USART3_RX,,,,,FMC_D14,,,EVENTOUT,
PortD,PD10,,,,DFSDM1_CKOUT,,,,USART3_CK,,,,,FMC_D15,,LCD_B3,EVENTOUT,
PortD,PD11,,,,,I2C4_SMBA,,,USART3_CTS,,QUADSPI_BK1_IO0,SAI2_SD_A,,FMC_A16/FMC_CLE,,,EVENTOUT,
PortD,PD12,,,TIM4_CH1,LPTIM1_IN1,I2C4_SCL,,,USART3_RTS,,QUADSPI_BK1_IO1,SAI2_FS_A,,FMC_A17/FMC_ALE,,,EVENTOUT,
PortD,PD13,,,TIM4_CH2,LPTIM1_OUT,I2C4_SDA,,,,,QUADSPI_BK1_IO3,SAI2_SCK_A,,FMC_A18,,,EVENTOUT,
PortD,PD14,,,TIM4_CH3,,,,,,UART8_CTS,,,,FMC_D0,,,EVENTOUT,
PortD,PD15,,,TIM4_CH4,,,,,,UART8_RTS,,,,FMC_D1,,,EVENTOUT,
PortE,PE0,,,TIM4_ETR,LPTIM1_ETR,,,,,UART8_RX,,SAI2_MCK_A,,FMC_NBL0,DCMI_D2,,EVENTOUT,
PortE,PE1,,,,LPTIM1_IN2,,,,,UART8_TX,,,,FMC_NBL1,DCMI_D3,,EVENTOUT,
PortE,PE2,TRACECLK,,,,,SPI4_SCK,SAI1_MCLK_A,,,QUADSPI_BK1_IO2,,ETH_MII_TXD3,FMC_A23,,,EVENTOUT,
PortE,PE3,TRACED0,,,,,,SAI1_SD_B,,,,,,FMC_A19,,,EVENTOUT,
PortE,PE4,TRACED1,,,,,SPI4_NSS,SAI1_FS_A,,,,DFSDM1_DATAIN3,,FMC_A20,DCMI_D4,LCD_B0,EVENTOUT,
PortE,PE5,TRACED2,,,TIM9_CH1,,SPI4_MISO,SAI1_SCK_A,,,,DFSDM1_CKIN3,,FMC_A21,DCMI_D6,LCD_G0,EVENTOUT,
PortE,PE6,TRACED3,TIM1_BKIN2,,TIM9_CH2,,SPI4_MOSI,SAI1_SD_A,,,,SAI2_MCK_B,,FMC_A22,DCMI_D7,LCD_G1,EVENTOUT,
PortE,PE7,,TIM1_ETR,,,,,DFSDM1_DATAIN2,,UART7_RX,,QUADSPI_BK2_IO0,,FMC_D4,,,EVENTOUT,
PortE,PE8,,TIM1_CH1N,,,,,DFSDM1_CKIN2,,UART7_TX,,QUADSPI_BK2_IO1,,FMC_D5,,,EVENTOUT,
PortE,PE9,,TIM1_CH1,,,,,DFSDM1_CKOUT,,UART7_RTS,,QUADSPI_BK2_IO2,,FMC_D6,,,EVENTOUT,
PortE,PE10,,TIM1_CH2N,,,,,DFSDM1_DATAIN4,,UART7_CTS,,QUADSPI_BK2_IO3,,FMC_D7,,,EVENTOUT,
PortE,PE11,,TIM1_CH2,,,,SPI4_NSS,DFSDM1_CKIN4,,,,SAI2_SD_B,,FMC_D8,,LCD_G3,EVENTOUT,
PortE,PE12,,TIM1_CH3N,,,,SPI4_SCK,DFSDM1_DATAIN5,,,,SAI2_SCK_B,,FMC_D9,,LCD_B4,EVENTOUT,
PortE,PE13,,TIM1_CH3,,,,SPI4_MISO,DFSDM1_CKIN5,,,,SAI2_FS_B,,FMC_D10,,LCD_DE,EVENTOUT,
PortE,PE14,,TIM1_CH4,,,,SPI4_MOSI,,,,,SAI2_MCK_B,,FMC_D11,,LCD_CLK,EVENTOUT,
PortE,PE15,,TIM1_BKIN,,,,,,,,,,,FMC_D12,,LCD_R7,EVENTOUT,
PortF,PF0,,,,,I2C2_SDA,,,,,,,,FMC_A0,,,EVENTOUT,
PortF,PF1,,,,,I2C2_SCL,,,,,,,,FMC_A1,,,EVENTOUT,
PortF,PF2,,,,,I2C2_SMBA,,,,,,,,FMC_A2,,,EVENTOUT,
PortF,PF3,,,,,,,,,,,,,FMC_A3,,,EVENTOUT,ADC3_IN9
PortF,PF4,,,,,,,,,,,,,FMC_A4,,,EVENTOUT,ADC3_IN14
PortF,PF5,,,,,,,,,,,,,FMC_A5,,,EVENTOUT,ADC3_IN15
PortF,PF6,,,,TIM10_CH1,,SPI5_NSS,SAI1_SD_B,,UART7_RX,QUADSPI_BK1_IO3,,,,,,EVENTOUT,ADC3_IN4
PortF,PF7,,,,TIM11_CH1,,SPI5_SCK,SAI1_MCLK_B,,UART7_TX,QUADSPI_BK1_IO2,,,,,,EVENTOUT,ADC3_IN5
PortF,PF8,,,,,,SPI5_MISO,SAI1_SCK_B,,UART7_RTS,TIM13_CH1,QUADSPI_BK1_IO0,,,,,EVENTOUT,ADC3_IN6
PortF,PF9,,,,,,SPI5_MOSI,SAI1_FS_B,,UART7_CTS,TIM14_CH1,QUADSPI_BK1_IO1,,,,,EVENTOUT,ADC3_IN7
PortF,PF10,,,,,,,,,,QUADSPI_CLK,,,,DCMI_D11,LCD_DE,EVENTOUT,ADC3_IN8
PortF,PF11,,,,,,SPI5_MOSI,,,,,SAI2_SD_B,,FMC_SDNRAS,DCMI_D12,,EVENTOUT,
PortF,PF12,,,,,,,,,,,,,FMC_A6,,,EVENTOUT,
PortF,PF13,,,,,I2C4_SMBA,,DFSDM1_DATAIN6,,,,,,FMC_A7,,,EVENTOUT,
PortF,PF14,,,,,I2C4_SCL,,DFSDM1_CKIN6,,,,,,FMC_A8,,,EVENTOUT,
PortF,PF15,,,,,I2C4_SDA,,,,,,,,FMC_A9,,,EVENTOUT,
PortG,PG0,,,,,,,,,,,,,FMC_A10,,,EVENTOUT,
PortG,PG1,,,,,,,,,,,,,FMC_A11,,,EVENTOUT,
PortG,PG2,,,,,,,,,,,,,FMC_A12,,,EVENTOUT,
PortG,PG3,,,,,,,,,,,,,FMC_A13,,,EVENTOUT,
PortG,PG4,,,,,,,,,,,,,FMC_A14/FMC_BA0,,,EVENTOUT,
PortG,PG5,,,,,,,,,,,,,FMC_A15/FMC_BA1,,,EVENTOUT,
PortG,PG6,,,,,,,,,,,,,FMC_NE3,DCMI_D12,LCD_R7,EVENTOUT,
PortG,PG7,,,,,,,SAI1_MCLK_A,,USART6_CK,,,,FMC_INT,DCMI_D13,LCD_CLK,EVENTOUT,
PortG,PG8,,,,,,SPI6_NSS,,SPDIFRX_IN2,USART6_RTS,,,ETH_PPS_OUT,FMC_SDCLK,,LCD_G7,EVENTOUT,
PortG,PG9,,,,,,SPI1_MISO,,SPDIFRX_IN3,USART6_RX,QUADSPI_BK2_IO2,SAI2_FS_B,SDMMC2_D0,FMC_NE2/FMC_NCE,DCMI_VSYNC,,EVENTOUT,
PortG,PG10,,,,,,SPI1_NSS/I2S1_WS,,,,LCD_G3,SAI2_SD_B,SDMMC2_D1,FMC_NE3,DCMI_D2,LCD_B2,EVENTOUT,
PortG,PG11,,,,,,SPI1_SCK/I2S1_CK,,SPDIFRX_IN0,,,SDMMC2_D2,ETH_MII_TX_EN/ETH_RMII_TX_EN,,DCMI_D3,LCD_B3,EVENTOUT,
PortG,PG12,,,,LPTIM1_IN1,,SPI6_MISO,,SPDIFRX_IN1,USART6_RTS,LCD_B4,,SDMMC2_D3,FMC_NE4,,LCD_B1,EVENTOUT,
PortG,PG13,TRACED0,,,LPTIM1_OUT,,SPI6_SCK,,,USART6_CTS,,,ETH_MII_TXD0/ETH_RMII_TXD0,FMC_A24,,LCD_R0,EVENTOUT,
PortG,PG14,TRACED1,,,LPTIM1_ETR,,SPI6_MOSI,,,USART6_TX,QUADSPI_BK2_IO3,,ETH_MII_TXD1/ETH_RMII_TXD1,FMC_A25,,LCD_B0,EVENTOUT,
PortG,PG15,,,,,,,,,USART6_CTS,,,,FMC_SDNCAS,DCMI_D13,,EVENTOUT,
PortH,PH0,,,,,,,,,,,,,,,,EVENTOUT,
PortH,PH1,,,,,,,,,,,,,,,,EVENTOUT,
PortH,PH2,,,,LPTIM1_IN2,,,,,,QUADSPI_BK2_IO0,SAI2_SCK_B,ETH_MII_CRS,FMC_SDCKE0,,LCD_R0,EVENTOUT,
PortH,PH3,,,,,,,,,,QUADSPI_BK2_IO1,SAI2_MCK_B,ETH_MII_COL,FMC_SDNE0,,LCD_R1,EVENTOUT,
PortH,PH4,,,,,I2C2_SCL,,,,,LCD_G5,OTG_HS_ULPI_NXT,,,,LCD_G4,EVENTOUT,
PortH,PH5,,,,,I2C2_SDA,SPI5_NSS,,,,,,,FMC_SDNWE,,,EVENTOUT,
PortH,PH6,,,,,I2C2_SMBA,SPI5_SCK,,,,TIM12_CH1,,ETH_MII_RXD2,FMC_SDNE1,DCMI_D8,,EVENTOUT,
PortH,PH7,,,,,I2C3_SCL,SPI5_MISO,,,,,,ETH_MII_RXD3,FMC_SDCKE1,DCMI_D9,,EVENTOUT,
PortH,PH8,,,,,I2C3_SDA,,,,,,,,FMC_D16,DCMI_HSYNC,LCD_R2,EVENTOUT,
PortH,PH9,,,,,I2C3_SMBA,,,,,TIM12_CH2,,,FMC_D17,DCMI_D0,LCD_R3,EVENTOUT,
PortH,PH10,,,TIM5_CH1,,I2C4_SMBA,,,,,,,,FMC_D18,DCMI_D1,LCD_R4,EVENTOUT,
PortH,PH11,,,TIM5_CH2,,I2C4_SCL,,,,,,,,FMC_D19,DCMI_D2,LCD_R5,EVENTOUT,
PortH,PH12,,,TIM5_CH3,,I2C4_SDA,,,,,,,,FMC_D20,DCMI_D3,LCD_R6,EVENTOUT,
PortH,PH13,,,,TIM8_CH1N,,,,,UART4_TX,CAN1_TX,,,FMC_D21,,LCD_G2,EVENTOUT,
PortH,PH14,,,,TIM8_CH2N,,,,,UART4_RX,CAN1_RX,,,FMC_D22,DCMI_D4,LCD_G3,EVENTOUT,
PortH,PH15,,,,TIM8_CH3N,,,,,,,,,FMC_D23,DCMI_D11,LCD_G4,EVENTOUT,
PortI,PI0,,,TIM5_CH4,,,SPI2_NSS/I2S2_WS,,,,,,,FMC_D24,DCMI_D13,LCD_G5,EVENTOUT,
PortI,PI1,,,,TIM8_BKIN2,,SPI2_SCK/I2S2_CK,,,,,,,FMC_D25,DCMI_D8,LCD_G6,EVENTOUT,
PortI,PI2,,,,TIM8_CH4,,SPI2_MISO,,,,,,,FMC_D26,DCMI_D9,LCD_G7,EVENTOUT,
PortI,PI3,,,,TIM8_ETR,,SPI2_MOSI/I2S2_SD,,,,,,,FMC_D27,DCMI_D10,,EVENTOUT,
PortI,PI4,,,,TIM8_BKIN,,,,,,,SAI2_MCK_A,,FMC_NBL2,DCMI_D5,LCD_B4,EVENTOUT,
PortI,PI5,,,,TIM8_CH1,,,,,,,SAI2_SCK_A,,FMC_NBL3,DCMI_VSYNC,LCD_B5,EVENTOUT,
PortI,PI6,,,,TIM8_CH2,,,,,,,SAI2_SD_A,,FMC_D28,DCMI_D6,LCD_B6,EVENTOUT,
PortI,PI7,,,,TIM8_CH3,,,,,,,SAI2_FS_A,,FMC_D29,DCMI_D7,LCD_B7,EVENTOUT,
PortI,PI8,,,,,,,,,,,,,,,,EVENTOUT,
PortI,PI9,,,,,,,,,UART4_RX,CAN1_RX,,,FMC_D30,,LCD_VSYNC,EVENTOUT,
PortI,PI10,,,,,,,,,,,,ETH_MII_RX_ER,FMC_D31,,LCD_HSYNC,EVENTOUT,
PortI,PI11,,,,,,,,,,LCD_G6,OTG_HS_ULPI_DIR,,,,,EVENTOUT,
PortI,PI12,,,,,,,,,,,,,,,LCD_HSYNC,EVENTOUT,
PortI,PI13,,,,,,,,,,,,,,,LCD_VSYNC,EVENTOUT,
PortI,PI14,,,,,,,,,,,,,,,LCD_CLK,EVENTOUT,
PortI,PI15,,,,,,,,,,LCD_G2,,,,,LCD_R0,EVENTOUT,
PortJ,PJ0,,,,,,,,,,LCD_R7,,,,,LCD_R1,EVENTOUT,
PortJ,PJ1,,,,,,,,,,,,,,,LCD_R2,EVENTOUT,
PortJ,PJ2,,,,,,,,,,,,,,DSI_TE,LCD_R3,EVENTOUT,
PortJ,PJ3,,,,,,,,,,,,,,,LCD_R4,EVENTOUT,
PortJ,PJ4,,,,,,,,,,,,,,,LCD_R5,EVENTOUT,
PortJ,PJ5,,,,,,,,,,,,,,,LCD_R6,EVENTOUT,
PortJ,PJ6,,,,,,,,,,,,,,,LCD_R7,EVENTOUT,
PortJ,PJ7,,,,,,,,,,,,,,,LCD_G0,EVENTOUT,
PortJ,PJ8,,,,,,,,,,,,,,,LCD_G1,EVENTOUT,
PortJ,PJ9,,,,,,,,,,,,,,,LCD_G2,EVENTOUT,
PortJ,PJ10,,,,,,,,,,,,,,,LCD_G3,EVENTOUT,
PortJ,PJ11,,,,,,,,,,,,,,,LCD_G4,EVENTOUT,
PortJ,PJ12,,,,,,,,,,LCD_G3,,,,,LCD_B0,EVENTOUT,
PortJ,PJ13,,,,,,,,,,LCD_G4,,,,,LCD_B1,EVENTOUT,
PortJ,PJ14,,,,,,,,,,,,,,,LCD_B2,EVENTOUT,
PortJ,PJ15,,,,,,,,,,,,,,,LCD_B3,EVENTOUT,
PortK,PK0,,,,,,,,,,,,,,,LCD_G5,EVENTOUT,
PortK,PK1,,,,,,,,,,,,,,,LCD_G6,EVENTOUT,
PortK,PK2,,,,,,,,,,,,,,,LCD_G7,EVENTOUT,
PortK,PK3,,,,,,,,,,,,,,,LCD_B4,EVENTOUT,
PortK,PK4,,,,,,,,,,,,,,,LCD_B5,EVENTOUT,
PortK,PK5,,,,,,,,,,,,,,,LCD_B6,EVENTOUT,
PortK,PK6,,,,,,,,,,,,,,,LCD_B7,EVENTOUT,
PortK,PK7,,,,,,,,,,,,,,,LCD_DE,EVENTOUT,
1 PortA PA0 TIM2_CH1/TIM2_ETR TIM5_CH1 TIM8_ETR USART2_CTS UART4_TX SAI2_SD_B ETH_MII_CRS EVENTOUT ADC123_IN0
2 PortA PA1 TIM2_CH2 TIM5_CH2 USART2_RTS UART4_RX QUADSPI_BK1_IO3 SAI2_MCK_B ETH_MII_RX_CLK/ETH_RMII_REF_CLK LCD_R2 EVENTOUT ADC123_IN1
3 PortA PA2 TIM2_CH3 TIM5_CH3 TIM9_CH1 USART2_TX SAI2_SCK_B ETH_MDIO MDIOS_MDIO LCD_R1 EVENTOUT ADC123_IN2
4 PortA PA3 TIM2_CH4 TIM5_CH4 TIM9_CH2 USART2_RX LCD_B2 OTG_HS_ULPI_D0 ETH_MII_COL LCD_B5 EVENTOUT ADC123_IN3
5 PortA PA4 SPI1_NSS/I2S1_WS SPI3_NSS/I2S3_WS USART2_CK SPI6_NSS OTG_HS_SOF DCMI_HSYNC LCD_VSYNC EVENTOUT ADC12_IN4
6 PortA PA5 TIM2_CH1/TIM2_ETR TIM8_CH1N SPI1_SCK/I2S1_CK SPI6_SCK OTG_HS_ULPI_CK LCD_R4 EVENTOUT ADC12_IN5
7 PortA PA6 TIM1_BKIN TIM3_CH1 TIM8_BKIN SPI1_MISO SPI6_MISO TIM13_CH1 MDIOS_MDC DCMI_PIXCLK LCD_G2 EVENTOUT ADC12_IN6
8 PortA PA7 TIM1_CH1N TIM3_CH2 TIM8_CH1N SPI1_MOSI/I2S1_SD SPI6_MOSI TIM14_CH1 ETH_MII_RX_DV/ETH_RMII_CRS_DV FMC_SDNWE EVENTOUT ADC12_IN7
9 PortA PA8 MCO1 TIM1_CH1 TIM8_BKIN2 I2C3_SCL USART1_CK OTG_FS_SOF CAN3_RX UART7_RX LCD_B3 LCD_R6 EVENTOUT
10 PortA PA9 TIM1_CH2 I2C3_SMBA SPI2_SCK/I2S2_CK USART1_TX DCMI_D0 LCD_R5 EVENTOUT
11 PortA PA10 TIM1_CH3 USART1_RX LCD_B4 OTG_FS_ID MDIOS_MDIO DCMI_D1 LCD_B1 EVENTOUT
12 PortA PA11 TIM1_CH4 SPI2_NSS/I2S2_WS UART4_RX USART1_CTS CAN1_RX OTG_FS_DM LCD_R4 EVENTOUT
13 PortA PA12 TIM1_ETR SPI2_SCK/I2S2_CK UART4_TX USART1_RTS SAI2_FS_B CAN1_TX OTG_FS_DP LCD_R5 EVENTOUT
14 PortA PA13 JTMS/SWDIO EVENTOUT
15 PortA PA14 JTCK/SWCLK EVENTOUT
16 PortA PA15 JTDI TIM2_CH1/TIM2_ETR HDMI_CEC SPI1_NSS/I2S1_WS SPI3_NSS/I2S3_WS SPI6_NSS UART4_RTS CAN3_TX UART7_TX EVENTOUT
17 PortB PB0 TIM1_CH2N TIM3_CH3 TIM8_CH2N DFSDM1_CKOUT UART4_CTS LCD_R3 OTG_HS_ULPI_D1 ETH_MII_RXD2 LCD_G1 EVENTOUT ADC12_IN8
18 PortB PB1 TIM1_CH3N TIM3_CH4 TIM8_CH3N DFSDM1_DATAIN1 LCD_R6 OTG_HS_ULPI_D2 ETH_MII_RXD3 LCD_G0 EVENTOUT ADC12_IN9
19 PortB PB2 SAI1_SD_A SPI3_MOSI/I2S3_SD QUADSPI_CLK DFSDM1_CKIN1 EVENTOUT
20 PortB PB3 JTDO/TRACESWO TIM2_CH2 SPI1_SCK/I2S1_CK SPI3_SCK/I2S3_CK SPI6_SCK SDMMC2_D2 CAN3_RX UART7_RX EVENTOUT
21 PortB PB4 NJTRST TIM3_CH1 SPI1_MISO SPI3_MISO SPI2_NSS/I2S2_WS SPI6_MISO SDMMC2_D3 CAN3_TX UART7_TX EVENTOUT
22 PortB PB5 UART5_RX TIM3_CH2 I2C1_SMBA SPI1_MOSI/I2S1_SD SPI3_MOSI/I2S3_SD SPI6_MOSI CAN2_RX OTG_HS_ULPI_D7 ETH_PPS_OUT FMC_SDCKE1 DCMI_D10 LCD_G7 EVENTOUT
23 PortB PB6 UART5_TX TIM4_CH1 HDMI_CEC I2C1_SCL DFSDM1_DATAIN5 USART1_TX CAN2_TX QUADSPI_BK1_NCS I2C4_SCL FMC_SDNE1 DCMI_D5 EVENTOUT
24 PortB PB7 TIM4_CH2 I2C1_SDA DFSDM1_CKIN5 USART1_RX I2C4_SDA FMC_NL DCMI_VSYNC EVENTOUT
25 PortB PB8 I2C4_SCL TIM4_CH3 TIM10_CH1 I2C1_SCL DFSDM1_CKIN7 UART5_RX CAN1_RX SDMMC2_D4 ETH_MII_TXD3 SDMMC1_D4 DCMI_D6 LCD_B6 EVENTOUT
26 PortB PB9 I2C4_SDA TIM4_CH4 TIM11_CH1 I2C1_SDA SPI2_NSS/I2S2_WS DFSDM1_DATAIN7 UART5_TX CAN1_TX SDMMC2_D5 I2C4_SMBA SDMMC1_D5 DCMI_D7 LCD_B7 EVENTOUT
27 PortB PB10 TIM2_CH3 I2C2_SCL SPI2_SCK/I2S2_CK DFSDM1_DATAIN7 USART3_TX QUADSPI_BK1_NCS OTG_HS_ULPI_D3 ETH_MII_RX_ER LCD_G4 EVENTOUT
28 PortB PB11 TIM2_CH4 I2C2_SDA DFSDM1_CKIN7 USART3_RX OTG_HS_ULPI_D4 ETH_MII_TX_EN/ETH_RMII_TX_EN DSI_TE LCD_G5 EVENTOUT
29 PortB PB12 TIM1_BKIN I2C2_SMBA SPI2_NSS/I2S2_WS DFSDM1_DATAIN1 USART3_CK UART5_RX CAN2_RX OTG_HS_ULPI_D5 ETH_MII_TXD0/ETH_RMII_TXD0 OTG_HS_ID EVENTOUT
30 PortB PB13 TIM1_CH1N SPI2_SCK/I2S2_CK DFSDM1_CKIN1 USART3_CTS UART5_TX CAN2_TX OTG_HS_ULPI_D6 ETH_MII_TXD1/ETH_RMII_TXD1 EVENTOUT
31 PortB PB14 TIM1_CH2N TIM8_CH2N USART1_TX SPI2_MISO DFSDM1_DATAIN2 USART3_RTS UART4_RTS TIM12_CH1 SDMMC2_D0 OTG_HS_DM EVENTOUT
32 PortB PB15 RTC_REFIN TIM1_CH3N TIM8_CH3N USART1_RX SPI2_MOSI/I2S2_SD DFSDM1_CKIN2 UART4_CTS TIM12_CH2 SDMMC2_D1 OTG_HS_DP EVENTOUT
33 PortC PC0 DFSDM1_CKIN0 DFSDM1_DATAIN4 SAI2_FS_B OTG_HS_ULPI_STP FMC_SDNWE LCD_R5 EVENTOUT ADC123_IN10
34 PortC PC1 TRACED0 DFSDM1_DATAIN0 SPI2_MOSI/I2S2_SD SAI1_SD_A DFSDM1_CKIN4 ETH_MDC MDIOS_MDC EVENTOUT ADC123_IN11
35 PortC PC2 DFSDM1_CKIN1 SPI2_MISO DFSDM1_CKOUT OTG_HS_ULPI_DIR ETH_MII_TXD2 FMC_SDNE0 EVENTOUT ADC123_IN12
36 PortC PC3 DFSDM1_DATAIN1 SPI2_MOSI/I2S2_SD OTG_HS_ULPI_NXT ETH_MII_TX_CLK FMC_SDCKE0 EVENTOUT ADC123_IN13
37 PortC PC4 DFSDM1_CKIN2 I2S1_MCK SPDIFRX_IN2 ETH_MII_RXD0/ETH_RMII_RXD0 FMC_SDNE0 EVENTOUT ADC12_IN14
38 PortC PC5 DFSDM1_DATAIN2 SPDIFRX_IN3 ETH_MII_RXD1/ETH_RMII_RXD1 FMC_SDCKE0 EVENTOUT ADC12_IN15
39 PortC PC6 TIM3_CH1 TIM8_CH1 I2S2_MCK DFSDM1_CKIN3 USART6_TX FMC_NWAIT SDMMC2_D6 SDMMC1_D6 DCMI_D0 LCD_HSYNC EVENTOUT
40 PortC PC7 TIM3_CH2 TIM8_CH2 I2S3_MCK DFSDM1_DATAIN3 USART6_RX FMC_NE1 SDMMC2_D7 SDMMC1_D7 DCMI_D1 LCD_G6 EVENTOUT
41 PortC PC8 TRACED1 TIM3_CH3 TIM8_CH3 UART5_RTS USART6_CK FMC_NE2/FMC_NCE SDMMC1_D0 DCMI_D2 EVENTOUT
42 PortC PC9 MCO2 TIM3_CH4 TIM8_CH4 I2C3_SDA I2S_CKIN UART5_CTS QUADSPI_BK1_IO0 LCD_G3 SDMMC1_D1 DCMI_D3 LCD_B2 EVENTOUT
43 PortC PC10 DFSDM1_CKIN5 SPI3_SCK/I2S3_CK USART3_TX UART4_TX QUADSPI_BK1_IO1 SDMMC1_D2 DCMI_D8 LCD_R2 EVENTOUT
44 PortC PC11 DFSDM1_DATAIN5 SPI3_MISO USART3_RX UART4_RX QUADSPI_BK2_NCS SDMMC1_D3 DCMI_D4 EVENTOUT
45 PortC PC12 TRACED3 SPI3_MOSI/I2S3_SD USART3_CK UART5_TX SDMMC1_CK DCMI_D9 EVENTOUT
46 PortC PC13 EVENTOUT
47 PortC PC14 EVENTOUT
48 PortC PC15 EVENTOUT
49 PortD PD0 DFSDM1_CKIN6 DFSDM1_DATAIN7 UART4_RX CAN1_RX FMC_D2 EVENTOUT
50 PortD PD1 DFSDM1_DATAIN6 DFSDM1_CKIN7 UART4_TX CAN1_TX FMC_D3 EVENTOUT
51 PortD PD2 TRACED2 TIM3_ETR UART5_RX SDMMC1_CMD DCMI_D11 EVENTOUT
52 PortD PD3 DFSDM1_CKOUT SPI2_SCK/I2S2_CK DFSDM1_DATAIN0 USART2_CTS FMC_CLK DCMI_D5 LCD_G7 EVENTOUT
53 PortD PD4 DFSDM1_CKIN0 USART2_RTS FMC_NOE EVENTOUT
54 PortD PD5 USART2_TX FMC_NWE EVENTOUT
55 PortD PD6 DFSDM1_CKIN4 SPI3_MOSI/I2S3_SD SAI1_SD_A USART2_RX DFSDM1_DATAIN1 SDMMC2_CK FMC_NWAIT DCMI_D10 LCD_B2 EVENTOUT
56 PortD PD7 DFSDM1_DATAIN4 SPI1_MOSI/I2S1_SD DFSDM1_CKIN1 USART2_CK SPDIFRX_IN0 SDMMC2_CMD FMC_NE1 EVENTOUT
57 PortD PD8 DFSDM1_CKIN3 USART3_TX SPDIFRX_IN1 FMC_D13 EVENTOUT
58 PortD PD9 DFSDM1_DATAIN3 USART3_RX FMC_D14 EVENTOUT
59 PortD PD10 DFSDM1_CKOUT USART3_CK FMC_D15 LCD_B3 EVENTOUT
60 PortD PD11 I2C4_SMBA USART3_CTS QUADSPI_BK1_IO0 SAI2_SD_A FMC_A16/FMC_CLE EVENTOUT
61 PortD PD12 TIM4_CH1 LPTIM1_IN1 I2C4_SCL USART3_RTS QUADSPI_BK1_IO1 SAI2_FS_A FMC_A17/FMC_ALE EVENTOUT
62 PortD PD13 TIM4_CH2 LPTIM1_OUT I2C4_SDA QUADSPI_BK1_IO3 SAI2_SCK_A FMC_A18 EVENTOUT
63 PortD PD14 TIM4_CH3 UART8_CTS FMC_D0 EVENTOUT
64 PortD PD15 TIM4_CH4 UART8_RTS FMC_D1 EVENTOUT
65 PortE PE0 TIM4_ETR LPTIM1_ETR UART8_RX SAI2_MCK_A FMC_NBL0 DCMI_D2 EVENTOUT
66 PortE PE1 LPTIM1_IN2 UART8_TX FMC_NBL1 DCMI_D3 EVENTOUT
67 PortE PE2 TRACECLK SPI4_SCK SAI1_MCLK_A QUADSPI_BK1_IO2 ETH_MII_TXD3 FMC_A23 EVENTOUT
68 PortE PE3 TRACED0 SAI1_SD_B FMC_A19 EVENTOUT
69 PortE PE4 TRACED1 SPI4_NSS SAI1_FS_A DFSDM1_DATAIN3 FMC_A20 DCMI_D4 LCD_B0 EVENTOUT
70 PortE PE5 TRACED2 TIM9_CH1 SPI4_MISO SAI1_SCK_A DFSDM1_CKIN3 FMC_A21 DCMI_D6 LCD_G0 EVENTOUT
71 PortE PE6 TRACED3 TIM1_BKIN2 TIM9_CH2 SPI4_MOSI SAI1_SD_A SAI2_MCK_B FMC_A22 DCMI_D7 LCD_G1 EVENTOUT
72 PortE PE7 TIM1_ETR DFSDM1_DATAIN2 UART7_RX QUADSPI_BK2_IO0 FMC_D4 EVENTOUT
73 PortE PE8 TIM1_CH1N DFSDM1_CKIN2 UART7_TX QUADSPI_BK2_IO1 FMC_D5 EVENTOUT
74 PortE PE9 TIM1_CH1 DFSDM1_CKOUT UART7_RTS QUADSPI_BK2_IO2 FMC_D6 EVENTOUT
75 PortE PE10 TIM1_CH2N DFSDM1_DATAIN4 UART7_CTS QUADSPI_BK2_IO3 FMC_D7 EVENTOUT
76 PortE PE11 TIM1_CH2 SPI4_NSS DFSDM1_CKIN4 SAI2_SD_B FMC_D8 LCD_G3 EVENTOUT
77 PortE PE12 TIM1_CH3N SPI4_SCK DFSDM1_DATAIN5 SAI2_SCK_B FMC_D9 LCD_B4 EVENTOUT
78 PortE PE13 TIM1_CH3 SPI4_MISO DFSDM1_CKIN5 SAI2_FS_B FMC_D10 LCD_DE EVENTOUT
79 PortE PE14 TIM1_CH4 SPI4_MOSI SAI2_MCK_B FMC_D11 LCD_CLK EVENTOUT
80 PortE PE15 TIM1_BKIN FMC_D12 LCD_R7 EVENTOUT
81 PortF PF0 I2C2_SDA FMC_A0 EVENTOUT
82 PortF PF1 I2C2_SCL FMC_A1 EVENTOUT
83 PortF PF2 I2C2_SMBA FMC_A2 EVENTOUT
84 PortF PF3 FMC_A3 EVENTOUT ADC3_IN9
85 PortF PF4 FMC_A4 EVENTOUT ADC3_IN14
86 PortF PF5 FMC_A5 EVENTOUT ADC3_IN15
87 PortF PF6 TIM10_CH1 SPI5_NSS SAI1_SD_B UART7_RX QUADSPI_BK1_IO3 EVENTOUT ADC3_IN4
88 PortF PF7 TIM11_CH1 SPI5_SCK SAI1_MCLK_B UART7_TX QUADSPI_BK1_IO2 EVENTOUT ADC3_IN5
89 PortF PF8 SPI5_MISO SAI1_SCK_B UART7_RTS TIM13_CH1 QUADSPI_BK1_IO0 EVENTOUT ADC3_IN6
90 PortF PF9 SPI5_MOSI SAI1_FS_B UART7_CTS TIM14_CH1 QUADSPI_BK1_IO1 EVENTOUT ADC3_IN7
91 PortF PF10 QUADSPI_CLK DCMI_D11 LCD_DE EVENTOUT ADC3_IN8
92 PortF PF11 SPI5_MOSI SAI2_SD_B FMC_SDNRAS DCMI_D12 EVENTOUT
93 PortF PF12 FMC_A6 EVENTOUT
94 PortF PF13 I2C4_SMBA DFSDM1_DATAIN6 FMC_A7 EVENTOUT
95 PortF PF14 I2C4_SCL DFSDM1_CKIN6 FMC_A8 EVENTOUT
96 PortF PF15 I2C4_SDA FMC_A9 EVENTOUT
97 PortG PG0 FMC_A10 EVENTOUT
98 PortG PG1 FMC_A11 EVENTOUT
99 PortG PG2 FMC_A12 EVENTOUT
100 PortG PG3 FMC_A13 EVENTOUT
101 PortG PG4 FMC_A14/FMC_BA0 EVENTOUT
102 PortG PG5 FMC_A15/FMC_BA1 EVENTOUT
103 PortG PG6 FMC_NE3 DCMI_D12 LCD_R7 EVENTOUT
104 PortG PG7 SAI1_MCLK_A USART6_CK FMC_INT DCMI_D13 LCD_CLK EVENTOUT
105 PortG PG8 SPI6_NSS SPDIFRX_IN2 USART6_RTS ETH_PPS_OUT FMC_SDCLK LCD_G7 EVENTOUT
106 PortG PG9 SPI1_MISO SPDIFRX_IN3 USART6_RX QUADSPI_BK2_IO2 SAI2_FS_B SDMMC2_D0 FMC_NE2/FMC_NCE DCMI_VSYNC EVENTOUT
107 PortG PG10 SPI1_NSS/I2S1_WS LCD_G3 SAI2_SD_B SDMMC2_D1 FMC_NE3 DCMI_D2 LCD_B2 EVENTOUT
108 PortG PG11 SPI1_SCK/I2S1_CK SPDIFRX_IN0 SDMMC2_D2 ETH_MII_TX_EN/ETH_RMII_TX_EN DCMI_D3 LCD_B3 EVENTOUT
109 PortG PG12 LPTIM1_IN1 SPI6_MISO SPDIFRX_IN1 USART6_RTS LCD_B4 SDMMC2_D3 FMC_NE4 LCD_B1 EVENTOUT
110 PortG PG13 TRACED0 LPTIM1_OUT SPI6_SCK USART6_CTS ETH_MII_TXD0/ETH_RMII_TXD0 FMC_A24 LCD_R0 EVENTOUT
111 PortG PG14 TRACED1 LPTIM1_ETR SPI6_MOSI USART6_TX QUADSPI_BK2_IO3 ETH_MII_TXD1/ETH_RMII_TXD1 FMC_A25 LCD_B0 EVENTOUT
112 PortG PG15 USART6_CTS FMC_SDNCAS DCMI_D13 EVENTOUT
113 PortH PH0 EVENTOUT
114 PortH PH1 EVENTOUT
115 PortH PH2 LPTIM1_IN2 QUADSPI_BK2_IO0 SAI2_SCK_B ETH_MII_CRS FMC_SDCKE0 LCD_R0 EVENTOUT
116 PortH PH3 QUADSPI_BK2_IO1 SAI2_MCK_B ETH_MII_COL FMC_SDNE0 LCD_R1 EVENTOUT
117 PortH PH4 I2C2_SCL LCD_G5 OTG_HS_ULPI_NXT LCD_G4 EVENTOUT
118 PortH PH5 I2C2_SDA SPI5_NSS FMC_SDNWE EVENTOUT
119 PortH PH6 I2C2_SMBA SPI5_SCK TIM12_CH1 ETH_MII_RXD2 FMC_SDNE1 DCMI_D8 EVENTOUT
120 PortH PH7 I2C3_SCL SPI5_MISO ETH_MII_RXD3 FMC_SDCKE1 DCMI_D9 EVENTOUT
121 PortH PH8 I2C3_SDA FMC_D16 DCMI_HSYNC LCD_R2 EVENTOUT
122 PortH PH9 I2C3_SMBA TIM12_CH2 FMC_D17 DCMI_D0 LCD_R3 EVENTOUT
123 PortH PH10 TIM5_CH1 I2C4_SMBA FMC_D18 DCMI_D1 LCD_R4 EVENTOUT
124 PortH PH11 TIM5_CH2 I2C4_SCL FMC_D19 DCMI_D2 LCD_R5 EVENTOUT
125 PortH PH12 TIM5_CH3 I2C4_SDA FMC_D20 DCMI_D3 LCD_R6 EVENTOUT
126 PortH PH13 TIM8_CH1N UART4_TX CAN1_TX FMC_D21 LCD_G2 EVENTOUT
127 PortH PH14 TIM8_CH2N UART4_RX CAN1_RX FMC_D22 DCMI_D4 LCD_G3 EVENTOUT
128 PortH PH15 TIM8_CH3N FMC_D23 DCMI_D11 LCD_G4 EVENTOUT
129 PortI PI0 TIM5_CH4 SPI2_NSS/I2S2_WS FMC_D24 DCMI_D13 LCD_G5 EVENTOUT
130 PortI PI1 TIM8_BKIN2 SPI2_SCK/I2S2_CK FMC_D25 DCMI_D8 LCD_G6 EVENTOUT
131 PortI PI2 TIM8_CH4 SPI2_MISO FMC_D26 DCMI_D9 LCD_G7 EVENTOUT
132 PortI PI3 TIM8_ETR SPI2_MOSI/I2S2_SD FMC_D27 DCMI_D10 EVENTOUT
133 PortI PI4 TIM8_BKIN SAI2_MCK_A FMC_NBL2 DCMI_D5 LCD_B4 EVENTOUT
134 PortI PI5 TIM8_CH1 SAI2_SCK_A FMC_NBL3 DCMI_VSYNC LCD_B5 EVENTOUT
135 PortI PI6 TIM8_CH2 SAI2_SD_A FMC_D28 DCMI_D6 LCD_B6 EVENTOUT
136 PortI PI7 TIM8_CH3 SAI2_FS_A FMC_D29 DCMI_D7 LCD_B7 EVENTOUT
137 PortI PI8 EVENTOUT
138 PortI PI9 UART4_RX CAN1_RX FMC_D30 LCD_VSYNC EVENTOUT
139 PortI PI10 ETH_MII_RX_ER FMC_D31 LCD_HSYNC EVENTOUT
140 PortI PI11 LCD_G6 OTG_HS_ULPI_DIR EVENTOUT
141 PortI PI12 LCD_HSYNC EVENTOUT
142 PortI PI13 LCD_VSYNC EVENTOUT
143 PortI PI14 LCD_CLK EVENTOUT
144 PortI PI15 LCD_G2 LCD_R0 EVENTOUT
145 PortJ PJ0 LCD_R7 LCD_R1 EVENTOUT
146 PortJ PJ1 LCD_R2 EVENTOUT
147 PortJ PJ2 DSI_TE LCD_R3 EVENTOUT
148 PortJ PJ3 LCD_R4 EVENTOUT
149 PortJ PJ4 LCD_R5 EVENTOUT
150 PortJ PJ5 LCD_R6 EVENTOUT
151 PortJ PJ6 LCD_R7 EVENTOUT
152 PortJ PJ7 LCD_G0 EVENTOUT
153 PortJ PJ8 LCD_G1 EVENTOUT
154 PortJ PJ9 LCD_G2 EVENTOUT
155 PortJ PJ10 LCD_G3 EVENTOUT
156 PortJ PJ11 LCD_G4 EVENTOUT
157 PortJ PJ12 LCD_G3 LCD_B0 EVENTOUT
158 PortJ PJ13 LCD_G4 LCD_B1 EVENTOUT
159 PortJ PJ14 LCD_B2 EVENTOUT
160 PortJ PJ15 LCD_B3 EVENTOUT
161 PortK PK0 LCD_G5 EVENTOUT
162 PortK PK1 LCD_G6 EVENTOUT
163 PortK PK2 LCD_G7 EVENTOUT
164 PortK PK3 LCD_B4 EVENTOUT
165 PortK PK4 LCD_B5 EVENTOUT
166 PortK PK5 LCD_B6 EVENTOUT
167 PortK PK6 LCD_B7 EVENTOUT
168 PortK PK7 LCD_DE EVENTOUT

View File

@ -174,6 +174,9 @@ endif
ifeq ($(CIRCUITPY__EVE),1)
SRC_PATTERNS += _eve/%
endif
ifeq ($(CIRCUITPY_MEMORYMONITOR),1)
SRC_PATTERNS += memorymonitor/%
endif
ifeq ($(CIRCUITPY_MICROCONTROLLER),1)
SRC_PATTERNS += microcontroller/%
endif
@ -398,6 +401,9 @@ SRC_SHARED_MODULE_ALL = \
gamepad/__init__.c \
gamepadshift/GamePadShift.c \
gamepadshift/__init__.c \
memorymonitor/__init__.c \
memorymonitor/AllocationAlarm.c \
memorymonitor/AllocationSize.c \
network/__init__.c \
os/__init__.c \
random/__init__.c \

View File

@ -430,6 +430,16 @@ extern const struct _mp_obj_module_t _eve_module;
#define _EVE_MODULE
#endif
#if CIRCUITPY_MEMORYMONITOR
extern const struct _mp_obj_module_t memorymonitor_module;
#define MEMORYMONITOR_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_memorymonitor), (mp_obj_t)&memorymonitor_module },
#define MEMORYMONITOR_ROOT_POINTERS mp_obj_t active_allocationsizes; \
mp_obj_t active_allocationalarms;
#else
#define MEMORYMONITOR_MODULE
#define MEMORYMONITOR_ROOT_POINTERS
#endif
#if CIRCUITPY_MICROCONTROLLER
extern const struct _mp_obj_module_t microcontroller_module;
#define MICROCONTROLLER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module },
@ -709,6 +719,7 @@ extern const struct _mp_obj_module_t watchdog_module;
JSON_MODULE \
MATH_MODULE \
_EVE_MODULE \
MEMORYMONITOR_MODULE \
MICROCONTROLLER_MODULE \
NEOPIXEL_WRITE_MODULE \
NETWORK_MODULE \
@ -766,6 +777,7 @@ extern const struct _mp_obj_module_t watchdog_module;
mp_obj_t terminal_tilegrid_tiles; \
BOARD_UART_ROOT_POINTER \
FLASH_ROOT_POINTERS \
MEMORYMONITOR_ROOT_POINTERS \
NETWORK_ROOT_POINTERS \
void supervisor_run_background_tasks_if_tick(void);

View File

@ -118,6 +118,9 @@ CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
CIRCUITPY__EVE ?= 0
CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE)
CIRCUITPY_MEMORYMONITOR ?= 0
CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR)
CIRCUITPY_MICROCONTROLLER ?= 1
CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER)

View File

@ -1890,7 +1890,7 @@ STATIC void compile_async_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// async def
compile_funcdef(comp, pns0);
scope_t *fscope = (scope_t*)pns0->nodes[4];
fscope->scope_flags |= MP_SCOPE_FLAG_GENERATOR;
fscope->scope_flags |= MP_SCOPE_FLAG_GENERATOR | MP_SCOPE_FLAG_ASYNC;
} else if (MP_PARSE_NODE_STRUCT_KIND(pns0) == PN_for_stmt) {
// async for
compile_async_for_stmt(comp, pns0);

View File

@ -152,7 +152,7 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar
// check for generator functions and if so wrap in generator object
if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) {
fun = mp_obj_new_gen_wrap(fun);
fun = mp_obj_new_gen_wrap(fun, (rc->scope_flags & MP_SCOPE_FLAG_ASYNC) != 0);
}
return fun;

16
py/gc.c
View File

@ -33,6 +33,10 @@
#include "supervisor/shared/safe_mode.h"
#if CIRCUITPY_MEMORYMONITOR
#include "shared-module/memorymonitor/__init__.h"
#endif
#if MICROPY_ENABLE_GC
#if MICROPY_DEBUG_VERBOSE // print debugging info
@ -653,6 +657,10 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) {
gc_dump_alloc_table();
#endif
#if CIRCUITPY_MEMORYMONITOR
memorymonitor_track_allocation(end_block - start_block + 1);
#endif
return ret_ptr;
}
@ -906,6 +914,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
gc_log_change(block, new_blocks);
#endif
#if CIRCUITPY_MEMORYMONITOR
memorymonitor_track_allocation(new_blocks);
#endif
return ptr_in;
}
@ -935,6 +947,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
gc_log_change(block, new_blocks);
#endif
#if CIRCUITPY_MEMORYMONITOR
memorymonitor_track_allocation(new_blocks);
#endif
return ptr_in;
}

View File

@ -665,7 +665,7 @@ mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte *
mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table);
mp_obj_t mp_obj_new_fun_viper(size_t n_args, void *fun_data, mp_uint_t type_sig);
mp_obj_t mp_obj_new_fun_asm(size_t n_args, void *fun_data, mp_uint_t type_sig);
mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun);
mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine);
mp_obj_t mp_obj_new_closure(mp_obj_t fun, size_t n_closed, const mp_obj_t *closed);
mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items);
mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items);

View File

@ -42,11 +42,13 @@
typedef struct _mp_obj_gen_wrap_t {
mp_obj_base_t base;
mp_obj_t *fun;
bool coroutine_generator;
} mp_obj_gen_wrap_t;
typedef struct _mp_obj_gen_instance_t {
mp_obj_base_t base;
mp_obj_dict_t *globals;
bool coroutine_generator;
mp_code_state_t code_state;
} mp_obj_gen_instance_t;
@ -64,6 +66,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons
n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t));
o->base.type = &mp_type_gen_instance;
o->coroutine_generator = self->coroutine_generator;
o->globals = self_fun->globals;
o->code_state.fun_bc = self_fun;
o->code_state.ip = 0;
@ -78,10 +81,11 @@ const mp_obj_type_t mp_type_gen_wrap = {
.unary_op = mp_generic_unary_op,
};
mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) {
mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine) {
mp_obj_gen_wrap_t *o = m_new_obj(mp_obj_gen_wrap_t);
o->base.type = &mp_type_gen_wrap;
o->fun = MP_OBJ_TO_PTR(fun);
o->coroutine_generator = is_coroutine;
return MP_OBJ_FROM_PTR(o);
}
@ -91,6 +95,12 @@ mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) {
STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
#if MICROPY_PY_ASYNC_AWAIT
if (self->coroutine_generator) {
mp_printf(print, "<coroutine object '%q' at %p>", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self);
return;
}
#endif
mp_printf(print, "<generator object '%q' at %p>", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self);
}
@ -194,6 +204,13 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o
}
STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) {
#if MICROPY_PY_ASYNC_AWAIT
// This translate is literally too much for m0 boards
mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
if (self->coroutine_generator) {
mp_raise_TypeError(translate("'coroutine' object is not an iterator"));
}
#endif
return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL);
}

View File

@ -77,8 +77,8 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
mp_obj_t index, bool is_slice);
const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction);
const char nibble_to_hex_upper[16];
const char nibble_to_hex_lower[16];
extern const char nibble_to_hex_upper[16];
extern const char nibble_to_hex_lower[16];
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj);

View File

@ -346,6 +346,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/
$(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h
# Standard C functions like memset need to be compiled with special flags so
# the compiler does not optimise these functions in terms of themselves.
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN)
# Force nlr code to always be compiled with space-saving optimisation so
# that the function preludes are of a minimal and predictable form.
$(PY_BUILD)/nlr%.o: CFLAGS += -Os

View File

@ -33,6 +33,7 @@
#define MP_SCOPE_FLAG_VARKEYWORDS (0x02)
#define MP_SCOPE_FLAG_GENERATOR (0x04)
#define MP_SCOPE_FLAG_DEFKWARGS (0x08)
#define MP_SCOPE_FLAG_ASYNC (0x10)
// types for native (viper) function signature
#define MP_NATIVE_TYPE_OBJ (0x00)

View File

@ -65,13 +65,13 @@
//| connections and also initiate connections."""
//|
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """You cannot create an instance of `_bleio.Adapter`.
//| Use `_bleio.adapter` to access the sole instance available."""
//| ...
//|
//| enabled: Any = ...
//| enabled: bool = ...
//| """State of the BLE adapter."""
//|
STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) {
@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| address: Any = ...
//| address: Address = ...
//| """MAC address of the BLE adapter. (read-only)"""
//|
STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) {
@ -111,7 +111,7 @@ const mp_obj_property_t bleio_adapter_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| name: Any = ...
//| name: str = ...
//| """name of the BLE adapter used once connected.
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
//| to make it easy to distinguish multiple CircuitPython boards."""
@ -135,7 +135,7 @@ const mp_obj_property_t bleio_adapter_name_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> Any:
//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None:
//| """Starts advertising until `stop_advertising` is called or if connectable, another device
//| connects to us.
//|
@ -202,7 +202,7 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_advertising_obj, 2, bleio_adapter_start_advertising);
//| def stop_advertising(self, ) -> Any:
//| def stop_advertising(self) -> None:
//| """Stop sending advertising packets."""
//| ...
//|
@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising);
//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Any:
//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> iterable:
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
//| filtered and returned separately.
//|
@ -288,7 +288,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_scan_obj, 1, bleio_adapter_start_scan);
//| def stop_scan(self, ) -> Any:
//| def stop_scan(self) -> None:
//| """Stop the current scan."""
//| ...
//|
@ -301,7 +301,7 @@ STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan);
//| advertising: Any = ...
//| advertising: bool = ...
//| """True when the adapter is currently advertising. (read-only)"""
//|
STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) {
@ -317,7 +317,7 @@ const mp_obj_property_t bleio_adapter_advertising_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connected: Any = ...
//| connected: bool = ...
//| """True when the adapter is connected to another device regardless of who initiated the
//| connection. (read-only)"""
//|
@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connections: Any = ...
//| connections: tuple = ...
//| """Tuple of active connections including those initiated through
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
//|
@ -350,7 +350,7 @@ const mp_obj_property_t bleio_adapter_connections_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def connect(self, address: Address, *, timeout: float/int) -> Any:
//| def connect(self, address: Address, *, timeout: float/int) -> Connection:
//| """Attempts a connection to the device with the given address.
//|
//| :param Address address: The address of the peripheral to connect to
@ -380,7 +380,7 @@ STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_connect_obj, 2, bleio_adapter_connect);
//| def erase_bonding(self, ) -> Any:
//| def erase_bonding(self) -> None:
//| """Erase all bonding information stored in flash memory."""
//| ...
//|

View File

@ -38,7 +38,7 @@
//| """Encapsulates the address of a BLE device."""
//|
//| def __init__(self, address: buf, address_type: Any):
//| def __init__(self, address: ReadableBuffer, address_type: int) -> None:
//| """Create a new Address object encapsulating the address value.
//| The value itself can be one of:
//|
@ -77,8 +77,8 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
//| address_bytes: Any = ...
//| r"""The bytes that make up the device address (read-only).
//| address_bytes: bytes = ...
//| """The bytes that make up the device address (read-only).
//|
//| Note that the ``bytes`` object returned is in little-endian order:
//| The least significant byte is ``address_bytes[0]``. So the address will
@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| type: Any = ...
//| type: int = ...
//| """The address type (read-only).
//|
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`,
@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def __eq__(self, other: Any) -> Any:
//| def __eq__(self, other: Any) -> bool:
//| """Two Address objects are equal if their addresses and address types are equal."""
//| ...
//|
@ -154,7 +154,7 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o
}
}
//| def __hash__(self, ) -> Any:
//| def __hash__(self) -> int:
//| """Returns a hash for the Address data."""
//| ...
//|
@ -187,17 +187,17 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
}
//| PUBLIC: Any = ...
//| PUBLIC: int = ...
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
//|
//| RANDOM_STATIC: Any = ...
//| RANDOM_STATIC: int = ...
//| """A randomly generated address that does not change often. It may never change or may change after
//| a power cycle."""
//|
//| RANDOM_PRIVATE_RESOLVABLE: Any = ...
//| RANDOM_PRIVATE_RESOLVABLE: int = ...
//| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK)."""
//|
//| RANDOM_PRIVATE_NON_RESOLVABLE: Any = ...
//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ...
//| """A randomly generated address that changes on every connection."""
//|
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {

View File

@ -36,32 +36,32 @@
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
//| but is not defined as a Python superclass of those classes."""
//|
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """You cannot create an instance of :py:class:`~_bleio.Attribute`."""
//| ...
//|
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
//| NO_ACCESS: Any = ...
//| NO_ACCESS: int = ...
//| """security mode: access not allowed"""
//|
//| OPEN: Any = ...
//| OPEN: int = ...
//| """security_mode: no security (link is not encrypted)"""
//|
//| ENCRYPT_NO_MITM: Any = ...
//| ENCRYPT_NO_MITM: int = ...
//| """security_mode: unauthenticated encryption, without man-in-the-middle protection"""
//|
//| ENCRYPT_WITH_MITM: Any = ...
//| ENCRYPT_WITH_MITM: int = ...
//| """security_mode: authenticated encryption, with man-in-the-middle protection"""
//|
//| LESC_ENCRYPT_WITH_MITM: Any = ...
//| LESC_ENCRYPT_WITH_MITM: int = ...
//| """security_mode: LESC encryption, with man-in-the-middle protection"""
//|
//| SIGNED_NO_MITM: Any = ...
//| SIGNED_NO_MITM: int = ...
//| """security_mode: unauthenticated data signing, without man-in-the-middle protection"""
//|
//| SIGNED_WITH_MITM: Any = ...
//| SIGNED_WITH_MITM: int = ...
//| """security_mode: authenticated data signing, without man-in-the-middle protection"""
//|
{ MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) },

View File

@ -37,7 +37,7 @@
//| """Stores information about a BLE service characteristic and allows reading
//| and writing of the characteristic's value."""
//|
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """There is no regular constructor for a Characteristic. A new local Characteristic can be created
//| and attached to a Service by calling `add_to_service()`.
//| Remote Characteristic objects are created by `Connection.discover_remote_services()`
@ -45,7 +45,7 @@
//| ...
//|
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Any:
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Characteristic:
//| """Create a new Characteristic object, and add it to this Service.
//|
//| :param Service service: The service that will provide this characteristic
@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj,
//| properties: Any = ...
//| properties: int = ...
//| """An int bitmask representing which properties are set, specified as bitwise or'ing of
//| of these possible values.
//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`."""
@ -160,7 +160,7 @@ const mp_obj_property_t bleio_characteristic_properties_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| uuid: Any = ...
//| uuid: Optional[UUID] = ...
//| """The UUID of this characteristic. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this characteristic is not known."""
@ -180,7 +180,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| value: Any = ...
//| value: bytearray = ...
//| """The value of this characteristic."""
//|
STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) {
@ -211,7 +211,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| descriptors: Any = ...
//| descriptors: Descriptor = ...
//| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)"""
//|
STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) {
@ -241,7 +241,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| service: Any = ...
//| service: Service = ...
//| """The Service this Characteristic is a part of."""
//|
STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) {
@ -258,7 +258,7 @@ const mp_obj_property_t bleio_characteristic_service_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> Any:
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None:
//| """Set the remote characteristic's CCCD to enable or disable notification and indication.
//|
//| :param bool notify: True if Characteristic should receive notifications of remote writes
@ -291,22 +291,22 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) },
// Bitmask constants to represent properties
//| BROADCAST: Any = ...
//| BROADCAST: int = ...
//| """property: allowed in advertising packets"""
//|
//| INDICATE: Any = ...
//| INDICATE: int = ...
//| """property: server will indicate to the client when the value is set and wait for a response"""
//|
//| NOTIFY: Any = ...
//| NOTIFY: int = ...
//| """property: server will notify the client when the value is set"""
//|
//| READ: Any = ...
//| READ: int = ...
//| """property: clients may read this characteristic"""
//|
//| WRITE: Any = ...
//| WRITE: int = ...
//| """property: clients may write this characteristic; a response will be sent back"""
//|
//| WRITE_NO_RESPONSE: Any = ...
//| WRITE_NO_RESPONSE: int = ...
//| """property: clients may write this characteristic; no response will be sent back"""
//|
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },

View File

@ -44,7 +44,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
//| class CharacteristicBuffer:
//| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
//|
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64):
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64) -> None:
//|
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
//| add the newly-written bytes to a FIFO buffer.
@ -100,7 +100,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
// These are standard stream methods. Code is in py/stream.c.
//
//| def read(self, nbytes: Any = None) -> Any:
//| def read(self, nbytes: int = None) -> Optional[bytes]:
//| """Read characters. If ``nbytes`` is specified then read at most that many
//| bytes. Otherwise, read everything that arrives until the connection
//| times out. Providing the number of bytes expected is highly recommended
@ -110,14 +110,14 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
//| :rtype: bytes or None"""
//| ...
//|
//| def readinto(self, buf: Any) -> Any:
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
//|
//| :return: number of bytes read and stored into ``buf``
//| :rtype: int or None (on a non-blocking error)"""
//| ...
//|
//| def readline(self, ) -> Any:
//| def readline(self) -> bytes:
//| """Read a line, ending in a newline character.
//|
//| :return: the line read
@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r
return ret;
}
//| in_waiting: Any = ...
//| in_waiting: int = ...
//| """The number of bytes in the input buffer, available to be read"""
//|
STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) {
@ -184,7 +184,7 @@ const mp_obj_property_t bleio_characteristic_buffer_in_waiting_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def reset_input_buffer(self, ) -> Any:
//| def reset_input_buffer(self) -> None:
//| """Discard any unread characters in the input buffer."""
//| ...
//|
@ -196,7 +196,7 @@ STATIC mp_obj_t bleio_characteristic_buffer_obj_reset_input_buffer(mp_obj_t self
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_buffer_reset_input_buffer_obj, bleio_characteristic_buffer_obj_reset_input_buffer);
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Disable permanently."""
//| ...
//|

View File

@ -68,13 +68,13 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
}
}
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`.
//| Connections may also be made when another device initiates a connection. To use a Connection
//| created by a peer, read the `Adapter.connections` property.
//| ...
//|
//| def disconnect(self, ) -> Any:
//| def disconnect(self) -> Any:
//| ""Disconnects from the remote peripheral. Does nothing if already disconnected."""
//| ...
//|
@ -87,7 +87,7 @@ STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_disconnect_obj, bleio_connection_disconnect);
//| def pair(self, *, bond: Any = True) -> Any:
//| def pair(self, *, bond: bool = True) -> None:
//| """Pair to the peer to improve security."""
//| ...
//|
@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair);
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Any:
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service:
//| """Do BLE discovery for all services or for the given service UUIDS,
//| to find their handles and characteristics, and return the discovered services.
//| `Connection.connected` must be True.
@ -152,7 +152,7 @@ STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, cons
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services);
//| connected: Any = ...
//| connected: bool = ...
//| """True if connected to the remote peer."""
//|
STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) {
@ -170,7 +170,7 @@ const mp_obj_property_t bleio_connection_connected_obj = {
};
//| paired: Any = ...
//| paired: bool = ...
//| """True if paired to the remote peer."""
//|
STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) {
@ -188,7 +188,7 @@ const mp_obj_property_t bleio_connection_paired_obj = {
};
//| connection_interval: Any = ...
//| connection_interval: float = ...
//| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
//| increase speed and decrease latency but increase power consumption.
//|
@ -206,7 +206,7 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval);
//| attribute: Any = ...
//| attribute: int = ...
//| """The maximum number of data bytes that can be sent in a single transmission,
//| not including overhead bytes.
//|

View File

@ -39,7 +39,7 @@
//| Descriptors are attached to BLE characteristics and provide contextual
//| information about the characteristic."""
//|
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
//| and attached to a Characteristic by calling `add_to_characteristic()`.
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic);
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj));
//| uuid: Any = ...
//| uuid: UUID = ...
//| """The descriptor uuid. (read-only)"""
//|
STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) {
@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| characteristic: Any = ...
//| characteristic: Characteristic = ...
//| """The Characteristic this Descriptor is a part of."""
//|
STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) {
@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| value: Any = ...
//| value: WriteableBuffer = ...
//| """The value of this descriptor."""
//|
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {

View File

@ -44,7 +44,7 @@
//| When we're the server, we ignore all connections besides the first to subscribe to
//| notifications."""
//|
//| def __init__(self, characteristic: Characteristic, *, buffer_size: int):
//| def __init__(self, characteristic: Characteristic, *, buffer_size: int) -> None:
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
//| add the newly-written bytes to a FIFO buffer.
//|
@ -93,7 +93,7 @@ STATIC void check_for_deinit(bleio_packet_buffer_obj_t *self) {
}
}
//| def readinto(self, buf: Any) -> Any:
//| def readinto(self, buf: WriteableBuffer) -> int:
//| """Reads a single BLE packet into the ``buf``. Raises an exception if the next packet is longer
//| than the given buffer. Use `packet_size` to read the maximum length of a single packet.
//|
@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto);
//| def write(self, data: Any, *, header: Any = None) -> Any:
//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int:
//| """Writes all bytes from data into the same outgoing packet. The bytes from header are included
//| before data when the pending packet is currently empty.
//|
@ -169,7 +169,7 @@ STATIC mp_obj_t bleio_packet_buffer_write(mp_uint_t n_args, const mp_obj_t *pos_
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_packet_buffer_write_obj, 1, bleio_packet_buffer_write);
//| def deinit(self) -> Any:
//| def deinit(self) -> None:
//| """Disable permanently."""
//| ...
STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) {
@ -184,7 +184,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_bu
//| The name `packet_size` is deprecated and
//| will be removed in CircuitPython 6.0.0."""
//|
//| incoming_packet_length: Any = ...
//| incoming_packet_length: int = ...
//| """Maximum length in bytes of a packet we are reading."""
//|
STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) {

View File

@ -41,11 +41,11 @@
//| it has no user-visible constructor."""
//|
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
//| ...
//|
//| def matches(self, prefixes: Any, *, all: Any = True) -> Any:
//| def matches(self, prefixes: ScanEntry, *, all: bool = True) -> bool:
//| """Returns True if the ScanEntry matches all prefixes when ``all`` is True. This is stricter
//| than the scan filtering which accepts any advertisements that match any of the prefixes
//| where all is False."""
@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches);
//| address: Any = ...
//| address: Address = ...
//| """The address of the device (read-only), of type `_bleio.Address`."""
//|
STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {
@ -86,7 +86,7 @@ const mp_obj_property_t bleio_scanentry_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| advertisement_bytes: Any = ...
//| advertisement_bytes: bytes = ...
//| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) {
@ -102,7 +102,7 @@ const mp_obj_property_t bleio_scanentry_advertisement_bytes_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| rssi: Any = ...
//| rssi: int = ...
//| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) {
@ -118,7 +118,7 @@ const mp_obj_property_t bleio_scanentry_rssi_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connectable: Any = ...
//| connectable: bool = ...
//| """True if the device can be connected to. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) {
@ -134,7 +134,7 @@ const mp_obj_property_t bleio_scanentry_connectable_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| scan_response: Any = ...
//| scan_response: bool = ...
//| """True if the entry was a scan response. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) {

View File

@ -46,15 +46,15 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
return MP_OBJ_STOP_ITERATION;
}
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
//| ...
//|
//| def __iter__(self, ) -> Any:
//| def __iter__(self) -> Iterator[ScanEntry]:
//| """Returns itself since it is the iterator."""
//| ...
//|
//| def __next__(self, ) -> Any:
//| def __next__(self) -> ScanEntry:
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
//| active. Raises `StopIteration` if scanning is finished and no other results are available."""
//| ...

View File

@ -35,7 +35,7 @@
//| class Service:
//| """Stores information about a BLE service and its characteristics."""
//|
//| def __init__(self, uuid: UUID, *, secondary: bool = False):
//| def __init__(self, uuid: UUID, *, secondary: bool = False) -> None:
//| """Create a new Service identified by the specified UUID. It can be accessed by all
//| connections. This is known as a Service server. Client Service objects are created via
//| `Connection.discover_remote_services`.
@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(service);
}
//| characteristics: Any = ...
//| characteristics: Tuple[Characteristic, ...] = ...
//| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by
//| this service. (read-only)"""
//|
@ -92,7 +92,7 @@ const mp_obj_property_t bleio_service_characteristics_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| remote: Any = ...
//| remote: bool = ...
//| """True if this is a service provided by a remote device. (read-only)"""
//|
STATIC mp_obj_t bleio_service_get_remote(mp_obj_t self_in) {
@ -109,7 +109,7 @@ const mp_obj_property_t bleio_service_remote_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| secondary: Any = ...
//| secondary: bool = ...
//| """True if this is a secondary service. (read-only)"""
//|
STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) {
@ -126,7 +126,7 @@ const mp_obj_property_t bleio_service_secondary_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| uuid: Any = ...
//| uuid: Optional[UUID] = ...
//| """The UUID of this service. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this service is not known."""

View File

@ -36,7 +36,7 @@
//| class UUID:
//| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
//|
//| def __init__(self, value: Any):
//| def __init__(self, value: Union[int, ReadableBuffer, str]) -> None:
//| """Create a new UUID or UUID object encapsulating the uuid value.
//| The value can be one of:
//|
@ -120,7 +120,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, co
return MP_OBJ_FROM_PTR(self);
}
//| uuid16: Any = ...
//| uuid16: int = ...
//| """The 16-bit part of the UUID. (read-only)
//|
//| :type: int"""
@ -139,7 +139,7 @@ const mp_obj_property_t bleio_uuid_uuid16_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| uuid128: Any = ...
//| uuid128: bytes = ...
//| """The 128-bit value of the UUID
//| Raises AttributeError if this is a 16-bit UUID. (read-only)
//|
@ -165,7 +165,7 @@ const mp_obj_property_t bleio_uuid_uuid128_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| size: Any = ...
//| size: int = ...
//| """128 if this UUID represents a 128-bit vendor-specific UUID. 16 if this UUID represents a
//| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported.
//|
@ -186,7 +186,7 @@ const mp_obj_property_t bleio_uuid_size_obj = {
};
//| def pack_into(self, buffer: Any, offset: Any = 0) -> Any:
//| def pack_into(self, buffer: WriteableBuffer, offset: int = 0) -> None:
//| """Packs the UUID into the given buffer at the given offset."""
//| ...
//|
@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def __eq__(self, other: Any) -> Any:
//| def __eq__(self, other: Any) -> bool:
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
//| ...
//|

View File

@ -58,11 +58,9 @@
//| This object is the sole instance of `_bleio.Adapter`."""
//|
//| class BluetoothError:
//| def __init__(self, Exception: Any):
//| """Catch all exception for Bluetooth related errors."""
//| ...
//| class BluetoothError(Exception):
//| """Catchall exception for Bluetooth related errors."""
//| ...
MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception)
NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) {
@ -72,10 +70,9 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...)
va_end(argptr);
nlr_raise(exception);
}
//| class ConnectionError:
//| def __init__(self, BluetoothError: Any):
//| """Raised when a connection is unavailable."""
//| ...
//| class ConnectionError(BluetoothError):
//| """Raised when a connection is unavailable."""
//| ...
//|
MP_DEFINE_BLEIO_EXCEPTION(ConnectionError, bleio_BluetoothError)
NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...) {
@ -86,20 +83,18 @@ NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...
nlr_raise(exception);
}
//| class RoleError:
//| def __init__(self, BluetoothError: Any):
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
//| attempted to be set but they can only be set when remote."""
//| ...
//| class RoleError(BluetoothError):
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
//| attempted to be set but they can only be set when remote."""
//| ...
//|
MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError)
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) {
mp_raise_msg(&mp_type_bleio_RoleError, msg);
}
//| class SecurityError:
//| def __init__(self, BluetoothError: Any):
//| """Raised when a security related error occurs."""
//| ...
//| class SecurityError(BluetoothError):
//| """Raised when a security related error occurs."""
//| ...
//|
MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError)
NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t* fmt, ...) {

View File

@ -58,7 +58,7 @@ STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
//| def flush(self, ) -> Any:
//| def flush(self) -> None:
//| """Send any queued drawing commands directly to the hardware.
//|
//| :param int width: The width of the grid in tiles, or 1 for sprites."""
@ -70,7 +70,7 @@ STATIC mp_obj_t _flush(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
//| def cc(self, b: bytes) -> Any:
//| def cc(self, b: bytes) -> None:
//| """Append bytes to the command FIFO.
//|
//| :param bytes b: The bytes to add"""
@ -86,7 +86,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc);
//{
//| def AlphaFunc(self, func: int, ref: int) -> Any:
//| def AlphaFunc(self, func: int, ref: int) -> None:
//| """Set the alpha test function
//|
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
@ -104,7 +104,7 @@ STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc);
//| def Begin(self, prim: int) -> Any:
//| def Begin(self, prim: int) -> None:
//| """Begin drawing a graphics primitive
//|
//| :param int prim: graphics primitive.
@ -120,7 +120,7 @@ STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin);
//| def BitmapExtFormat(self, format: int) -> Any:
//| def BitmapExtFormat(self, format: int) -> None:
//| """Set the bitmap format
//|
//| :param int format: bitmap pixel format."""
@ -134,7 +134,7 @@ STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat);
//| def BitmapHandle(self, handle: int) -> Any:
//| def BitmapHandle(self, handle: int) -> None:
//| """Set the bitmap handle
//|
//| :param int handle: bitmap handle. Range 0-31. The initial value is 0
@ -150,7 +150,7 @@ STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle);
//| def BitmapLayoutH(self, linestride: int, height: int) -> Any:
//| def BitmapLayoutH(self, linestride: int, height: int) -> None:
//| """Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps
//|
//| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7
@ -166,7 +166,7 @@ STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth);
//| def BitmapLayout(self, format: int, linestride: int, height: int) -> Any:
//| def BitmapLayout(self, format: int, linestride: int, height: int) -> None:
//| """Set the source bitmap memory format and layout for the current handle
//|
//| :param int format: bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31
@ -184,7 +184,7 @@ STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout);
//| def BitmapSizeH(self, width: int, height: int) -> Any:
//| def BitmapSizeH(self, width: int, height: int) -> None:
//| """Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps
//|
//| :param int width: high part of drawn bitmap width, in pixels. Range 0-3
@ -200,7 +200,7 @@ STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh);
//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> Any:
//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> None:
//| """Set the screen drawing of bitmaps for the current handle
//|
//| :param int filter: bitmap filtering mode, one of ``NEAREST`` or ``BILINEAR``. Range 0-1
@ -222,7 +222,7 @@ STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize);
//| def BitmapSource(self, addr: int) -> Any:
//| def BitmapSource(self, addr: int) -> None:
//| """Set the source address for bitmap graphics
//|
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215"""
@ -236,7 +236,7 @@ STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource);
//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> Any:
//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> None:
//| """Set the source for the r,g,b and a channels of a bitmap
//|
//| :param int r: red component source channel. Range 0-7
@ -256,7 +256,7 @@ STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizzle);
//| def BitmapTransformA(self, p: Any, v: int) -> Any:
//| def BitmapTransformA(self, p: int, v: int) -> None:
//| """Set the :math:`a` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
@ -276,7 +276,7 @@ STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
//| def BitmapTransformB(self, p: Any, v: int) -> Any:
//| def BitmapTransformB(self, p: int, v: int) -> None:
//| """Set the :math:`b` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
@ -296,7 +296,7 @@ STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
//| def BitmapTransformC(self, v: int) -> Any:
//| def BitmapTransformC(self, v: int) -> None:
//| """Set the :math:`c` component of the bitmap transform matrix
//|
//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
@ -312,7 +312,7 @@ STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
//| def BitmapTransformD(self, p: Any, v: int) -> Any:
//| def BitmapTransformD(self, p: int, v: int) -> None:
//| """Set the :math:`d` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
@ -332,7 +332,7 @@ STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
//| def BitmapTransformE(self, p: Any, v: int) -> Any:
//| def BitmapTransformE(self, p: int, v: int) -> None:
//| """Set the :math:`e` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
@ -352,7 +352,7 @@ STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
//| def BitmapTransformF(self, v: int) -> Any:
//| def BitmapTransformF(self, v: int) -> None:
//| """Set the :math:`f` component of the bitmap transform matrix
//|
//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
@ -368,7 +368,7 @@ STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
//| def BlendFunc(self, src: int, dst: int) -> Any:
//| def BlendFunc(self, src: int, dst: int) -> None:
//| """Set pixel arithmetic
//|
//| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2)
@ -386,7 +386,7 @@ STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc);
//| def Call(self, dest: int) -> Any:
//| def Call(self, dest: int) -> None:
//| """Execute a sequence of commands at another location in the display list
//|
//| :param int dest: display list address. Range 0-65535"""
@ -400,7 +400,7 @@ STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call);
//| def Cell(self, cell: int) -> Any:
//| def Cell(self, cell: int) -> None:
//| """Set the bitmap cell number for the vertex2f command
//|
//| :param int cell: bitmap cell number. Range 0-127. The initial value is 0
@ -416,7 +416,7 @@ STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell);
//| def ClearColorA(self, alpha: int) -> Any:
//| def ClearColorA(self, alpha: int) -> None:
//| """Set clear value for the alpha channel
//|
//| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0
@ -432,7 +432,7 @@ STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora);
//| def ClearColorRGB(self, red: int, green: int, blue: int) -> Any:
//| def ClearColorRGB(self, red: int, green: int, blue: int) -> None:
//| """Set clear values for red, green and blue channels
//|
//| :param int red: red value used when the color buffer is cleared. Range 0-255. The initial value is 0
@ -452,7 +452,7 @@ STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorrgb);
//| def Clear(self, c: int, s: int, t: int) -> Any:
//| def Clear(self, c: int, s: int, t: int) -> None:
//| """Clear buffers to preset values
//|
//| :param int c: clear color buffer. Range 0-1
@ -470,7 +470,7 @@ STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear);
//| def ClearStencil(self, s: int) -> Any:
//| def ClearStencil(self, s: int) -> None:
//| """Set clear value for the stencil buffer
//|
//| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0
@ -486,7 +486,7 @@ STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil);
//| def ClearTag(self, s: int) -> Any:
//| def ClearTag(self, s: int) -> None:
//| """Set clear value for the tag buffer
//|
//| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0
@ -501,7 +501,7 @@ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag);
//| def ColorA(self, alpha: int) -> Any:
//| def ColorA(self, alpha: int) -> None:
//| """Set the current color alpha
//|
//| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255
@ -517,7 +517,7 @@ STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora);
//| def ColorMask(self, r: int, g: int, b: int, a: int) -> Any:
//| def ColorMask(self, r: int, g: int, b: int, a: int) -> None:
//| """Enable and disable writing of frame buffer color components
//|
//| :param int r: allow updates to the frame buffer red component. Range 0-1. The initial value is 1
@ -539,7 +539,7 @@ STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask);
//| def ColorRGB(self, red: int, green: int, blue: int) -> Any:
//| def ColorRGB(self, red: int, green: int, blue: int) -> None:
//| """Set the drawing color
//|
//| :param int red: red value for the current color. Range 0-255. The initial value is 255
@ -559,9 +559,9 @@ STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb);
//| def Display(self, ) -> Any: ...
//| """End the display list"""
//|
//| def Display(self) -> None:
//| """End the display list"""
//| ...
STATIC mp_obj_t _display(mp_obj_t self) {
@ -570,7 +570,7 @@ STATIC mp_obj_t _display(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
//| def End(self, ) -> Any:
//| def End(self) -> None:
//| """End drawing a graphics primitive
//|
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`."""
@ -584,7 +584,7 @@ STATIC mp_obj_t _end(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end);
//| def Jump(self, dest: int) -> Any:
//| def Jump(self, dest: int) -> None:
//| """Execute commands at another location in the display list
//|
//| :param int dest: display list address. Range 0-65535"""
@ -598,7 +598,7 @@ STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump);
//| def LineWidth(self, width: int) -> Any:
//| def LineWidth(self, width: int) -> None:
//| """Set the width of rasterized lines
//|
//| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16
@ -614,7 +614,7 @@ STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth);
//| def Macro(self, m: int) -> Any:
//| def Macro(self, m: int) -> None:
//| """Execute a single command from a macro register
//|
//| :param int m: macro register to read. Range 0-1"""
@ -628,7 +628,7 @@ STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro);
//| def Nop(self, ) -> Any:
//| def Nop(self) -> None:
//| """No operation"""
//| ...
//|
@ -640,7 +640,7 @@ STATIC mp_obj_t _nop(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop);
//| def PaletteSource(self, addr: int) -> Any:
//| def PaletteSource(self, addr: int) -> None:
//| """Set the base address of the palette
//|
//| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0
@ -656,7 +656,7 @@ STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource);
//| def PointSize(self, size: int) -> Any:
//| def PointSize(self, size: int) -> None:
//| """Set the radius of rasterized points
//|
//| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16
@ -672,7 +672,7 @@ STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
//| def RestoreContext(self, ) -> Any:
//| def RestoreContext(self) -> None:
//| """Restore the current graphics context from the context stack"""
//| ...
//|
@ -684,7 +684,7 @@ STATIC mp_obj_t _restorecontext(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext);
//| def Return(self, ) -> Any:
//| def Return(self) -> None:
//| """Return from a previous call command"""
//| ...
//|
@ -696,7 +696,7 @@ STATIC mp_obj_t _return(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return);
//| def SaveContext(self, ) -> Any:
//| def SaveContext(self) -> None:
//| """Push the current graphics context on the context stack"""
//| ...
//|
@ -708,7 +708,7 @@ STATIC mp_obj_t _savecontext(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext);
//| def ScissorSize(self, width: int, height: int) -> Any:
//| def ScissorSize(self, width: int, height: int) -> None:
//| """Set the size of the scissor clip rectangle
//|
//| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
@ -726,7 +726,7 @@ STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize);
//| def ScissorXY(self, x: int, y: int) -> Any:
//| def ScissorXY(self, x: int, y: int) -> None:
//| """Set the top left corner of the scissor clip rectangle
//|
//| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
@ -744,7 +744,7 @@ STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy);
//| def StencilFunc(self, func: int, ref: int, mask: int) -> Any:
//| def StencilFunc(self, func: int, ref: int, mask: int) -> None:
//| """Set function and reference value for stencil testing
//|
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
@ -764,7 +764,7 @@ STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc);
//| def StencilMask(self, mask: int) -> Any:
//| def StencilMask(self, mask: int) -> None:
//| """Control the writing of individual bits in the stencil planes
//|
//| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255
@ -780,7 +780,7 @@ STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask);
//| def StencilOp(self, sfail: int, spass: int) -> Any:
//| def StencilOp(self, sfail: int, spass: int) -> None:
//| """Set stencil test actions
//|
//| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1)
@ -798,7 +798,7 @@ STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop);
//| def TagMask(self, mask: int) -> Any:
//| def TagMask(self, mask: int) -> None:
//| """Control the writing of the tag buffer
//|
//| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1
@ -814,7 +814,7 @@ STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask);
//| def Tag(self, s: int) -> Any:
//| def Tag(self, s: int) -> None:
//| """Set the current tag value
//|
//| :param int s: tag value. Range 0-255. The initial value is 255
@ -830,7 +830,7 @@ STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag);
//| def VertexTranslateX(self, x: int) -> Any:
//| def VertexTranslateX(self, x: int) -> None:
//| """Set the vertex transformation's x translation component
//|
//| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
@ -846,7 +846,7 @@ STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex);
//| def VertexTranslateY(self, y: int) -> Any:
//| def VertexTranslateY(self, y: int) -> None:
//| """Set the vertex transformation's y translation component
//|
//| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
@ -863,7 +863,7 @@ STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey);
//| def VertexFormat(self, frac: int) -> Any:
//| def VertexFormat(self, frac: int) -> None:
//| """Set the precision of vertex2f coordinates
//|
//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4
@ -879,7 +879,7 @@ STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat);
//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> Any:
//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> None:
//| """:param int x: x-coordinate in pixels. Range 0-511
//| :param int y: y-coordinate in pixels. Range 0-511
//| :param int handle: bitmap handle. Range 0-31
@ -954,7 +954,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
// Hand-written functions {
//| def Vertex2f(self, b: Any) -> Any:
//| def Vertex2f(self, b: float) -> None:
//| """Draw a point.
//|
//| :param float x: pixel x-coordinate
@ -973,7 +973,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f);
#define ADD_X(self, x) \
common_hal__eve_add(EVEHAL(self), sizeof(x), &(x));
//| def cmd0(self, n: int) -> Any:
//| def cmd0(self, n: int) -> None:
//| """Append the command word n to the FIFO
//|
//| :param int n: The command code
@ -990,7 +990,7 @@ STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
//| def cmd(self, n: int, fmt: str, args: tuple) -> Any:
//| def cmd(self, n: int, fmt: str, args: tuple) -> None:
//| """Append a command packet to the FIFO.
//|
//| :param int n: The command code

View File

@ -46,7 +46,7 @@
//| that library."""
//|
//| def __init__(self, buffer: Any, rows: Any, cols: Any, buttons: Any):
//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None:
//| """Initializes matrix scanning routines.
//|
//| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should

View File

@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
//| class PixelBuf:
//| """A fast RGB[W] pixel buffer for LED and similar devices."""
//|
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b""):
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b"") -> None:
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
}
}
//| bpp: Any = ...
//| bpp: int = ...
//| """The number of bytes per pixel in the buffer (read-only)"""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
};
//| brightness: Any = ...
//| brightness: float = ...
//| """Float value between 0 and 1. Output brightness.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| auto_write: Any = ...
//| auto_write: bool = ...
//| """Whether to automatically write the pixels after each update."""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| byteorder: Any = ...
//| byteorder: string = ...
//| """byteorder string for the buffer (read-only)"""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
@ -245,7 +245,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def show(self, ) -> Any:
//| def show(self) -> None:
//| """Transmits the color data to the pixels so that they are shown. This is done automatically
//| when `auto_write` is True."""
//| ...
@ -257,9 +257,9 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
//| def fill(color: Any) -> Any:
//| """Fills the given pixelbuf with the given color."""
//| ...
//| def fill(color: Union[int, Tuple[int, int, int]]) -> None:
//| """Fills the given pixelbuf with the given color."""
//| ...
//|
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
@ -269,13 +269,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
//| def __getitem__(self, index: Any) -> Any:
//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]:
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
//| intensity from 0-1.0."""
//| ...
//|
//| def __setitem__(self, index: Any, value: Any) -> Any:
//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf:
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).

View File

@ -29,7 +29,7 @@
#include "shared-module/_pixelbuf/PixelBuf.h"
const mp_obj_type_t pixelbuf_pixelbuf_type;
extern const mp_obj_type_t pixelbuf_pixelbuf_type;
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write, uint8_t* header,

View File

@ -41,7 +41,7 @@
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
// TODO: Pull in docs from pypixelbuf.
//| def colorwheel(n: int) -> Any:
//| def colorwheel(n: int) -> int:
//| """C implementation of the common wheel() function found in many examples.
//| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar)."""
//| ...

View File

@ -33,7 +33,7 @@
//| class Layer:
//| """Keep information about a single layer of graphics"""
//|
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray):
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None:
//| """Keep internal information about a layer of graphics (either a
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
//| with the ``render()`` function.
@ -88,7 +88,7 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
//| def move(self, x: Any, y: Any) -> Any:
//| def move(self, x: int, y: int) -> None:
//| """Set the offset of the layer to the specified values."""
//| ...
//|
@ -100,7 +100,7 @@ STATIC mp_obj_t layer_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_move_obj, layer_move);
//| def frame(self, frame: Any, rotation: Any) -> Any:
//| def frame(self, frame: int, rotation: int) -> None:
//| """Set the animation frame of the sprite, and optionally rotation its
//| graphic."""
//| ...

View File

@ -33,7 +33,7 @@
//| class Text:
//| """Keep information about a single grid of text"""
//|
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray):
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None:
//| """Keep internal information about a grid of text
//| in a format suitable for fast rendering
//| with the ``render()`` function.
@ -82,7 +82,7 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
//| def move(self, x: Any, y: Any) -> Any:
//| def move(self, x: int, y: int) -> None:
//| """Set the offset of the text to the specified values."""
//| ...
//|

View File

@ -12,7 +12,7 @@
//| class AES:
//| """Encrypt and decrypt AES streams"""
//|
//| def __init__(self, key, mode=0, iv=None, segment_size=8) -> Any:
//| def __init__(self, key: Optional[ReadableBuffer], mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> None:
//| """Create a new AES state with the given key.
//|
//| :param bytearray key: A 16-, 24-, or 32-byte key
@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
}
}
//| def encrypt_into(src, dest) -> None:
//| def encrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
//| """Encrypt the buffer from ``src`` into ``dest``.
//|
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
aesio_aes_encrypt_into);
//| def decrypt_into(src, dest) -> None:
//| def decrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
//|
//| """Decrypt the buffer from ``src`` into ``dest``.
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the

View File

@ -48,7 +48,7 @@
//| val = adc.value"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Use the AnalogIn on the given pin. The reference voltage varies by
//| platform so use ``reference_voltage`` to read the configured setting.
//|
@ -70,7 +70,7 @@ STATIC mp_obj_t analogio_analogin_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 AnalogIn and release the pin for other use."""
//| ...
//|
@ -86,13 +86,13 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) {
raise_deinited_error();
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> AnalogIn:
//| """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."""
//| ...
@ -104,7 +104,7 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
//| value: Any = ...
//| value: int = ...
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
//|
//| Even if the underlying analog to digital converter (ADC) is lower
@ -124,7 +124,7 @@ const mp_obj_property_t analogio_analogin_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| reference_voltage: Any = ...
//| reference_voltage: Optional[float] = ...
//| """The maximum voltage measurable (also known as the reference voltage) as a
//| `float` in Volts."""
//|

View File

@ -47,7 +47,7 @@
//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
//| dac.value = 32768 # makes PA02 1.65V"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Use the AnalogOut on the given pin.
//|
//| :param ~microcontroller.Pin pin: the pin to output to"""
@ -66,7 +66,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Turn off the AnalogOut and release the pin for other use."""
//| ...
//|
@ -79,13 +79,13 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit);
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> AnalogOut:
//| """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."""
//| ...
@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
//| value: Any = ...
//| value: int = ...
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
//|
//| Even if the underlying digital to analog converter (DAC) is lower

View File

@ -38,7 +38,7 @@
//| class I2SOut:
//| """Output an I2S audio signal"""
//|
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool):
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool) -> None:
//| """Create a I2SOut object associated with the given pins.
//|
//| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin
@ -112,7 +112,7 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the I2SOut and releases any hardware resources for reuse."""
//| ...
//|
@ -128,13 +128,13 @@ STATIC void check_for_deinit(audiobusio_i2sout_obj_t *self) {
raise_deinited_error();
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> I2SOut:
//| """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."""
//| ...
@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -174,7 +174,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_play(size_t n_args, const mp_obj_t *pos_ar
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_play);
//| def stop(self, ) -> Any:
//| def stop(self) -> None:
//| """Stops playback."""
//| ...
//|
@ -186,7 +186,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop);
//| playing: Any = ...
//| playing: bool = ...
//| """True when the audio sample is being output. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) {
@ -203,7 +203,7 @@ const mp_obj_property_t audiobusio_i2sout_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def pause(self, ) -> Any:
//| def pause(self) -> None:
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
//| ...
//|
@ -219,7 +219,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_pause(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pause);
//| def resume(self, ) -> Any:
//| def resume(self) -> None:
//| """Resumes sample playback after :py:func:`pause`."""
//| ...
//|
@ -235,7 +235,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume);
//| paused: Any = ...
//| paused: bool = ...
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {

View File

@ -39,7 +39,7 @@
//| class PDMIn:
//| """Record an input PDM audio stream"""
//|
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11):
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11) -> None:
//| """Create a PDMIn object associated with the given pins. This allows you to
//| record audio signals from the given pins. Individual ports may put further
//| restrictions on the recording parameters. The overall sample rate is
@ -134,7 +134,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the PDMIn and releases any hardware resources for reuse."""
//| ...
//|
@ -150,13 +150,13 @@ STATIC void check_for_deinit(audiobusio_pdmin_obj_t *self) {
raise_deinited_error();
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> PDMIn:
//| """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."""
//| ...
//|
@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__);
//| def record(self, destination: Any, destination_length: Any) -> Any:
//| def record(self, destination: WriteableBuffer, destination_length: int) -> None:
//| """Records destination_length bytes of samples to destination. This is
//| blocking.
//|
@ -210,7 +210,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat
}
MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record);
//| sample_rate: Any = ...
//| sample_rate: int = ...
//| """The actual sample_rate of the recording. This may not match the constructed
//| sample rate due to internal clock limitations."""
//|

View File

@ -38,7 +38,7 @@
//| class RawSample:
//| """A raw audio sample buffer in memory"""
//|
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000):
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
//| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the
//| first sample will be for channel 1, the second sample will be for channel two, the third for
@ -101,7 +101,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
//| ...
//|
@ -118,13 +118,13 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> RawSample:
//| """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."""
//| ...
@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
//| sample_rate: Any = ...
//| sample_rate: Optional(int) = ...
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
//| When the sample is looped, this can change the pitch output without changing the underlying
//| sample. This will not change the sample rate of any active playback. Call ``play`` again to

View File

@ -40,7 +40,7 @@
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating
//| an internal buffer."""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer) -> None:
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
//| :param typing.BinaryIO file: Already opened wave file
@ -91,7 +91,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the WaveFile and releases all memory resources for reuse."""
//| ...
STATIC mp_obj_t audioio_wavefile_deinit(mp_obj_t self_in) {
@ -107,13 +107,13 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> WaveFile:
//| """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."""
//| ...
@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
//| sample_rate: Any = ...
//| sample_rate: int = ...
//| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample."""
@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bits_per_sample: Any = ...
//| bits_per_sample: int = ...
//| """Bits per sample. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| channel_count: Any = ...
//| channel_count: int = ...
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {

View File

@ -39,7 +39,7 @@
//| class AudioOut:
//| """Output an analog audio signal"""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| """Create a AudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s).
//|
@ -111,7 +111,7 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
//| ...
//|
@ -127,13 +127,13 @@ STATIC void check_for_deinit(audioio_audioout_obj_t *self) {
raise_deinited_error();
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> AudioOut:
//| """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."""
//| ...
@ -146,7 +146,7 @@ STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *arg
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__);
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -175,7 +175,7 @@ STATIC mp_obj_t audioio_audioout_obj_play(size_t n_args, const mp_obj_t *pos_arg
}
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_play);
//| def stop(self, ) -> Any:
//| def stop(self) -> None:
//| """Stops playback and resets to the start of the sample."""
//| ...
//|
@ -187,7 +187,7 @@ STATIC mp_obj_t audioio_audioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop);
//| playing: Any = ...
//| playing: bool = ...
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) {
@ -204,7 +204,7 @@ const mp_obj_property_t audioio_audioout_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def pause(self, ) -> Any:
//| def pause(self) -> None:
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
//| ...
//|
@ -220,7 +220,7 @@ STATIC mp_obj_t audioio_audioout_obj_pause(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause);
//| def resume(self, ) -> Any:
//| def resume(self) -> None:
//| """Resumes sample playback after :py:func:`pause`."""
//| ...
//|
@ -236,7 +236,7 @@ STATIC mp_obj_t audioio_audioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resume);
//| paused: Any = ...
//| paused: bool = ...
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) {

View File

@ -41,7 +41,7 @@
//| class Mixer:
//| """Mixes one or more audio samples together into one sample."""
//|
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000):
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000) -> None:
//| """Create a Mixer object that can mix multiple channels with the same sample rate.
//| Samples are accessed and controlled with the mixer's `audiomixer.MixerVoice` objects.
//|
@ -121,7 +121,7 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the Mixer and releases any hardware resources for reuse."""
//| ...
//|
@ -138,13 +138,13 @@ STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> Mixer:
//| """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."""
//| ...
@ -156,7 +156,7 @@ STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__);
//| playing: Any = ...
//| playing: bool = ...
//| """True when any voice is being output. (read-only)"""
//|
STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) {
@ -173,7 +173,7 @@ const mp_obj_property_t audiomixer_mixer_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| sample_rate: Any = ...
//| sample_rate: int = ...
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second)."""
//|
STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) {
@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| voice: Any = ...
//| voice: Tuple[MixerVoice, ...] = ...
//| """A tuple of the mixer's `audiomixer.MixerVoice` object(s).
//|
//| .. code-block:: python
@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def play(self, sample: Any, *, voice: Any = 0, loop: Any = False) -> Any:
//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -244,7 +244,7 @@ STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_arg
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_play);
//| def stop_voice(self, voice: Any = 0) -> Any:
//| def stop_voice(self, voice: int = 0) -> None:
//| """Stops playback of the sample on the given voice."""
//| ...
//|

View File

@ -42,7 +42,7 @@
//|
//| Used to access and control samples with `audiomixer.Mixer`."""
//|
//| def __init__(self, ):
//| def __init__(self) -> None:
//| """MixerVoice instance object(s) created by `audiomixer.Mixer`."""
//| ...
//|
@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(self);
}
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
//| def play(self, sample: Union[audiocore.WaveFile, Mixer, audiocore.RawSample], *, loop: bool = False) -> None:
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
//| Does not block. Use `playing` to block.
//|
@ -81,7 +81,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *po
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play);
//| def stop(self, ) -> Any:
//| def stop(self) -> None:
//| """Stops playback of the sample on this voice."""
//| ...
//|
@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
//| level: Any = ...
//| level: float = ...
//| """The volume level of a voice, as a floating point number between 0 and 1."""
//|
STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
@ -136,7 +136,7 @@ const mp_obj_property_t audiomixer_mixervoice_level_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| playing: Any = ...
//| playing: bool = ...
//| """True when this voice is being output. (read-only)"""
//|

View File

@ -37,7 +37,7 @@
//| class MP3:
//| """Load a mp3 file for audio playback"""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
//|
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
@ -89,7 +89,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the MP3 and releases all memory resources for reuse."""
//| ...
//|
@ -106,13 +106,13 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> MP3:
//| """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."""
//| ...
@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__);
//| file: Any = ...
//| file: file = ...
//| """File to play back."""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = {
//| sample_rate: Any = ...
//| sample_rate: int = ...
//| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample."""
@ -181,7 +181,7 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bits_per_sample: Any = ...
//| bits_per_sample: int = ...
//| """Bits per sample. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -198,7 +198,7 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| channel_count: Any = ...
//| channel_count: int = ...
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) {
@ -215,7 +215,7 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| rms_level: Any = ...
//| rms_level: float = ...
//| """The RMS audio level of a recently played moment of audio. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) {

View File

@ -39,7 +39,7 @@
//| class PWMAudioOut:
//| """Output an analog audio signal by varying the PWM duty cycle."""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s). In contrast to mod:`audioio`,
//| the pin(s) specified are digital pins, and are driven with a device-dependent PWM
@ -114,7 +114,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse."""
//| ...
//|
@ -130,13 +130,13 @@ STATIC void check_for_deinit(audiopwmio_pwmaudioout_obj_t *self) {
raise_deinited_error();
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> PWMAudioOut:
//| """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."""
//| ...
@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__);
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -177,7 +177,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_play(size_t n_args, const mp_obj_t *p
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaudioout_obj_play);
//| def stop(self, ) -> Any:
//| def stop(self) -> None:
//| """Stops playback and resets to the start of the sample."""
//| ...
//|
@ -189,7 +189,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop);
//| playing: Any = ...
//| playing: bool = ...
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) {
@ -206,7 +206,7 @@ const mp_obj_property_t audiopwmio_pwmaudioout_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def pause(self, ) -> Any:
//| def pause(self) -> None:
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
//| ...
//|
@ -222,7 +222,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_pause(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioout_obj_pause);
//| def resume(self, ) -> Any:
//| def resume(self) -> None:
//| """Resumes sample playback after :py:func:`pause`."""
//| ...
//|
@ -238,7 +238,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume);
//| paused: Any = ...
//| paused: bool = ...
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {

View File

@ -40,7 +40,7 @@
//| class I2C:
//| """Two wire serial protocol"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int):
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None:
//| """I2C is a two-wire protocol for communicating between devices. At the
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
//| lines respectively.
@ -79,7 +79,7 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args,
return (mp_obj_t)self;
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Releases control of the underlying hardware so other classes can use it."""
//| ...
//|
@ -96,13 +96,13 @@ STATIC void check_for_deinit(bitbangio_i2c_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> I2C:
//| """No-op used in Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self, ) -> Any:
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware on context exit. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -120,7 +120,7 @@ static void check_lock(bitbangio_i2c_obj_t *self) {
}
}
//| def scan(self, ) -> Any:
//| def scan(self) -> list:
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of
//| those that respond. A device responds if it pulls the SDA line low after
//| its address (including a read bit) is sent on the bus."""
@ -142,7 +142,7 @@ STATIC mp_obj_t bitbangio_i2c_scan(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_scan_obj, bitbangio_i2c_scan);
//| def try_lock(self, ) -> Any:
//| def try_lock(self) -> bool:
//| """Attempts to grab the I2C lock. Returns True on success."""
//| ...
//|
@ -153,7 +153,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_try_lock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_try_lock_obj, bitbangio_i2c_obj_try_lock);
//| def unlock(self, ) -> Any:
//| def unlock(self) -> None:
//| """Releases the I2C lock."""
//| ...
//|
@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock);
//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> Any:
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a
}
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into);
//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> Any:
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a
//| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start
//| before a read.
@ -232,9 +232,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_rea
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include
//| :param bool stop: If true, output an I2C stop condition after the buffer is written.
//| Deprecated. Will be removed in 6.x and act as stop=True."""
//| :param int end: Index to read up to but not include"""
//| ...
//|
// Shared arg parsing for writeto and writeto_then_readfrom.
@ -256,13 +254,12 @@ STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer
}
STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop };
enum { ARG_address, ARG_buffer, ARG_start, ARG_end };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
{ MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
};
bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
check_for_deinit(self);
@ -271,13 +268,13 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int,
args[ARG_end].u_int, args[ARG_stop].u_bool);
args[ARG_end].u_int, true);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto);
//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> Any:
//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.

View File

@ -42,7 +42,7 @@
//|
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//|
//| """Create a OneWire object associated with the given pin. The object
//| implements the lowest level timing-sensitive bits of the protocol.
@ -78,7 +78,7 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Deinitialize the OneWire bus and release any hardware resources for reuse."""
//| ...
//|
@ -95,13 +95,13 @@ STATIC void check_for_deinit(bitbangio_onewire_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> OneWire:
//| """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."""
//| ...
@ -113,7 +113,7 @@ STATIC mp_obj_t bitbangio_onewire_obj___exit__(size_t n_args, const mp_obj_t *ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_onewire___exit___obj, 4, 4, bitbangio_onewire_obj___exit__);
//| def reset(self, ) -> Any:
//| def reset(self) -> bool:
//| """Reset the OneWire bus"""
//| ...
//|
@ -125,7 +125,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_reset(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_reset_obj, bitbangio_onewire_obj_reset);
//| def read_bit(self, ) -> Any:
//| def read_bit(self) -> bool:
//| """Read in a bit
//|
//| :returns: bit state read
@ -140,7 +140,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_read_bit(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_read_bit_obj, bitbangio_onewire_obj_read_bit);
//| def write_bit(self, value: Any) -> Any:
//| def write_bit(self, value: bool) -> None:
//| """Write out a bit based on value."""
//| ...
//|

View File

@ -51,7 +51,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//| """Construct an SPI object on the given pins.
//|
//| .. seealso:: Using this class directly requires careful lock management.
@ -90,7 +90,7 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args,
return (mp_obj_t)self;
}
//| def deinit(self, ) -> Any:
//| def deinit(self) -> None:
//| """Turn off the SPI bus."""
//| ...
//|
@ -107,13 +107,13 @@ STATIC void check_for_deinit(bitbangio_spi_obj_t *self) {
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self) -> SPI:
//| """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."""
//| ...
@ -132,7 +132,7 @@ static void check_lock(bitbangio_spi_obj_t *self) {
}
}
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any:
//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None:
//| """Configures the SPI bus. Only valid when locked.
//|
//| :param int baudrate: the clock rate in Hertz
@ -174,7 +174,7 @@ STATIC mp_obj_t bitbangio_spi_configure(size_t n_args, const mp_obj_t *pos_args,
}
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configure);
//| def try_lock(self, ) -> Any:
//| def try_lock(self) -> bool:
//| """Attempts to grab the SPI lock. Returns True on success.
//|
//| :return: True when lock has been grabbed
@ -188,7 +188,7 @@ STATIC mp_obj_t bitbangio_spi_obj_try_lock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_try_lock_obj, bitbangio_spi_obj_try_lock);
//| def unlock(self, ) -> Any:
//| def unlock(self) -> None:
//| """Releases the SPI lock."""
//| ...
//|
@ -200,7 +200,7 @@ STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock);
//| def write(self, buf: Any) -> Any:
//| def write(self, buf: ReadableBuffer) -> None:
//| """Write the data contained in ``buf``. Requires the SPI being locked.
//| If the buffer is empty, nothing happens."""
//| ...
@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) {
MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write);
//| def readinto(self, buf: Any) -> Any:
//| def readinto(self, buf: WriteableBuffer) -> None:
//| """Read into the buffer specified by ``buf`` while writing zeroes.
//| Requires the SPI being locked.
//| If the number of bytes to read is 0, nothing happens."""
@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto);
//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any:
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
//| must be equal.

View File

@ -37,7 +37,7 @@
//| .. warning:: The board module varies by board. The APIs documented here may or may not be
//| available on a specific board."""
//| def I2C() -> Any:
//| def I2C() -> busio.I2C:
//| """Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton."""
//| ...
//|
@ -61,7 +61,7 @@ mp_obj_t board_i2c(void) {
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
//| def SPI() -> Any:
//| def SPI() -> busio.SPI:
//| """Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a
//| singleton."""
//| ...
@ -85,7 +85,7 @@ mp_obj_t board_spi(void) {
#endif
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
//| def UART() -> Any:
//| def UART() -> busio.UART:
//| """Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
//|
//| The object created uses the default parameter values for `busio.UART`. If you need to set

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