Merge remote-tracking branch 'adafruit/master' into choose-usb-devices-xac
This commit is contained in:
commit
f3af2a6fb7
34
locale/ID.po
34
locale/ID.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -482,11 +482,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Tidak dapat menginisialisasi UART"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
|
@ -812,7 +812,7 @@ msgstr "Ukuran buffer tidak valid"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -874,7 +874,11 @@ msgstr ""
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1133,7 +1137,7 @@ msgstr ""
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA atau SCL membutuhkan pull up"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1206,19 +1210,19 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1355,10 +1359,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "PERINGATAN: Nama file kode anda mempunyai dua ekstensi\n"
|
||||
|
@ -1478,7 +1478,7 @@ msgstr ""
|
|||
msgid "bits must be 8"
|
||||
msgstr "bits harus memilki nilai 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2074,6 +2074,10 @@ msgstr "label didefinis ulang"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr ""
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -472,11 +472,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
|
@ -797,7 +797,7 @@ msgstr ""
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -859,7 +859,11 @@ msgstr ""
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1113,7 +1117,7 @@ msgstr ""
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1183,19 +1187,19 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1331,10 +1335,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
@ -1445,7 +1445,7 @@ msgstr ""
|
|||
msgid "bits must be 8"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2040,6 +2040,10 @@ msgstr ""
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr ""
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: Pascal Deneaux\n"
|
||||
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
|
||||
|
@ -476,11 +476,11 @@ msgstr "Konnte ble_uuid nicht decodieren. Status: 0x%04x"
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Konnte UART nicht initialisieren"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Konnte first buffer nicht zuteilen"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Konnte second buffer nicht zuteilen"
|
||||
|
||||
|
@ -803,7 +803,7 @@ msgstr "Ungültige Puffergröße"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Ungültige Anzahl von Kanälen"
|
||||
|
||||
|
@ -865,7 +865,11 @@ msgstr "Ungültiger Ausführungsmodus"
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Ungültige Anzahl von Stimmen"
|
||||
|
||||
|
@ -1130,7 +1134,7 @@ msgstr "Sicherheitsmodus aktiv! Gespeicherter Code wird nicht ausgeführt\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA oder SCL brauchen pull up"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Abtastrate muss positiv sein"
|
||||
|
||||
|
@ -1212,19 +1216,19 @@ msgstr ""
|
|||
"Die Reset-Taste wurde beim Booten von CircuitPython gedrückt. Drücke sie "
|
||||
"erneut um den abgesicherten Modus zu verlassen. \n"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1362,10 +1366,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr "Voice index zu hoch"
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
@ -1485,7 +1485,7 @@ msgstr "bits muss 7, 8 oder 9 sein"
|
|||
msgid "bits must be 8"
|
||||
msgstr "bits müssen 8 sein"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "Es müssen 8 oder 16 bits_per_sample sein"
|
||||
|
||||
|
@ -2085,6 +2085,10 @@ msgstr "Label neu definiert"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr "Für diesen Typ ist length nicht zulässig"
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "lhs und rhs sollten kompatibel sein"
|
||||
|
@ -2915,6 +2919,9 @@ msgstr ""
|
|||
#~ msgstr ""
|
||||
#~ "Benutze das esptool um den flash zu löschen und Python erneut hochzuladen"
|
||||
|
||||
#~ msgid "Voice index too high"
|
||||
#~ msgstr "Voice index zu hoch"
|
||||
|
||||
#~ msgid "buffer too long"
|
||||
#~ msgstr "Buffer zu lang"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
@ -472,11 +472,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
|
@ -797,7 +797,7 @@ msgstr ""
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -859,7 +859,11 @@ msgstr ""
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1113,7 +1117,7 @@ msgstr ""
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1183,19 +1187,19 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1331,10 +1335,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
@ -1445,7 +1445,7 @@ msgstr ""
|
|||
msgid "bits must be 8"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2040,6 +2040,10 @@ msgstr ""
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr ""
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: @sommersoft, @MrCertainly\n"
|
||||
|
@ -476,11 +476,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
|
@ -801,7 +801,7 @@ msgstr ""
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -863,7 +863,11 @@ msgstr ""
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1117,7 +1121,7 @@ msgstr "Runnin' in safe mode! Nay runnin' saved code.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1187,19 +1191,19 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1335,10 +1339,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "Blimey! Yer code filename has two extensions\n"
|
||||
|
@ -1449,7 +1449,7 @@ msgstr ""
|
|||
msgid "bits must be 8"
|
||||
msgstr "pieces must be of 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2044,6 +2044,10 @@ msgstr ""
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr ""
|
||||
|
|
37
locale/es.po
37
locale/es.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
@ -480,11 +480,11 @@ msgstr "No se puede descodificar ble_uuid, err 0x%04x"
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "No se puede inicializar la UART"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "No se pudo asignar el primer buffer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "No se pudo asignar el segundo buffer"
|
||||
|
||||
|
@ -808,7 +808,7 @@ msgstr "Tamaño de buffer inválido"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr "Inválido periodo de captura. Rango válido: 1 - 500"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Cuenta de canales inválida"
|
||||
|
||||
|
@ -870,7 +870,11 @@ msgstr "Modo de ejecución inválido."
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Cuenta de voces inválida"
|
||||
|
||||
|
@ -1139,7 +1143,7 @@ msgstr "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA o SCL necesitan una pull up"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Sample rate debe ser positivo"
|
||||
|
||||
|
@ -1221,19 +1225,19 @@ msgstr ""
|
|||
"El botón reset fue presionado mientras arrancaba CircuitPython. Presiona "
|
||||
"otra vez para salir del modo seguro.\n"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr "Los bits_per_sample del sample no igualan a los del mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr "La cuenta de canales del sample no iguala a las del mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr "El sample rate del sample no iguala al del mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr "El signo del sample no iguala al del mixer"
|
||||
|
||||
|
@ -1370,10 +1374,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr "funciones Viper actualmente no soportan más de 4 argumentos."
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr "Index de voz demasiado alto"
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n"
|
||||
|
@ -1492,7 +1492,7 @@ msgstr "bits deben ser 7, 8 ó 9"
|
|||
msgid "bits must be 8"
|
||||
msgstr "bits debe ser 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "bits_per_sample debe ser 8 ó 16"
|
||||
|
||||
|
@ -2097,6 +2097,10 @@ msgstr "etiqueta redefinida"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr "argumento length no permitido para este tipo"
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "lhs y rhs deben ser compatibles"
|
||||
|
@ -2946,6 +2950,9 @@ msgstr "paso cero"
|
|||
#~ msgstr ""
|
||||
#~ "Usa esptool para borrar la flash y vuelve a cargar Python en su lugar"
|
||||
|
||||
#~ msgid "Voice index too high"
|
||||
#~ msgstr "Index de voz demasiado alto"
|
||||
|
||||
#~ msgid "bad GATT role"
|
||||
#~ msgstr "mal GATT role"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
|
||||
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
|
||||
"Language-Team: fil\n"
|
||||
|
@ -481,11 +481,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Hindi ma-initialize ang UART"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Hindi ma-iallocate ang first buffer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Hindi ma-iallocate ang second buffer"
|
||||
|
||||
|
@ -817,7 +817,7 @@ msgstr "Mali ang buffer size"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Maling bilang ng channel"
|
||||
|
||||
|
@ -879,7 +879,11 @@ msgstr "Mali ang run mode."
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Maling bilang ng voice"
|
||||
|
||||
|
@ -1146,7 +1150,7 @@ msgstr "Tumatakbo sa safe mode! Hindi tumatakbo ang nai-save na code.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "Kailangan ng pull up resistors ang SDA o SCL"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Sample rate ay dapat positibo"
|
||||
|
||||
|
@ -1226,19 +1230,19 @@ msgstr ""
|
|||
"Ang reset button ay pinindot habang nag boot ang CircuitPython. Pindutin "
|
||||
"ulit para lumabas sa safe mode.\n"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr "Ang bits_per_sample ng sample ay hindi tugma sa mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr "Ang channel count ng sample ay hindi tugma sa mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr "Ang sample rate ng sample ay hindi tugma sa mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr "Ang signedness ng sample hindi tugma sa mixer"
|
||||
|
||||
|
@ -1378,10 +1382,6 @@ msgstr ""
|
|||
"Ang mga function ng Viper ay kasalukuyang hindi sumusuporta sa higit sa 4 na "
|
||||
"argumento"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr "Index ng Voice ay masyadong mataas"
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "BABALA: Ang pangalan ng file ay may dalawang extension\n"
|
||||
|
@ -1498,7 +1498,7 @@ msgstr "bits ay dapat 7, 8 o 9"
|
|||
msgid "bits must be 8"
|
||||
msgstr "bits ay dapat walo (8)"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "bits_per_sample ay dapat 8 o 16"
|
||||
|
||||
|
@ -2110,6 +2110,10 @@ msgstr "ang label ay na-define ulit"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr "length argument ay walang pahintulot sa ganitong type"
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "lhs at rhs ay dapat magkasundo"
|
||||
|
@ -2935,6 +2939,9 @@ msgstr "zero step"
|
|||
#~ msgstr ""
|
||||
#~ "Gamitin ang esptool upang burahin ang flash at muling i-upload ang Python"
|
||||
|
||||
#~ msgid "Voice index too high"
|
||||
#~ msgstr "Index ng Voice ay masyadong mataas"
|
||||
|
||||
#~ msgid "[addrinfo error %d]"
|
||||
#~ msgstr "[addrinfo error %d]"
|
||||
|
||||
|
|
37
locale/fr.po
37
locale/fr.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: 0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
|
||||
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
|
||||
"Language-Team: fr\n"
|
||||
|
@ -487,11 +487,11 @@ msgstr "Impossible de décoder le 'ble_uuid', err 0x%04x"
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "L'UART n'a pu être initialisé"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Impossible d'allouer le 1er tampon"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Impossible d'allouer le 2e tampon"
|
||||
|
||||
|
@ -824,7 +824,7 @@ msgstr "Longueur de tampon invalide"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr "Période de capture invalide. Gamme valide: 1 à 500"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Nombre de canaux invalide"
|
||||
|
@ -887,7 +887,11 @@ msgstr "Mode de lancement invalide."
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Nombre de voix invalide"
|
||||
|
@ -1161,7 +1165,7 @@ msgstr "Mode sans-échec! Le code sauvegardé n'est pas éxecuté.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA ou SCL a besoin d'une résistance de tirage ('pull up')"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Le taux d'échantillonage doit être positif"
|
||||
|
@ -1245,20 +1249,20 @@ msgstr ""
|
|||
"Le bouton 'reset' a été appuyé pendant le démarrage de CircuitPython. "
|
||||
"Appuyer de nouveau pour quitter de le mode sans-échec.\n"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
"Le 'bits_per_sample' de l'échantillon ne correspond pas à celui du mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr "Le canal de l'échantillon ne correspond pas à celui du mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr "L'échantillonage de l'échantillon ne correspond pas à celui du mixer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr "Le signe de l'échantillon ne correspond pas à celui du mixer"
|
||||
|
||||
|
@ -1401,10 +1405,6 @@ msgid "Viper functions don't currently support more than 4 arguments"
|
|||
msgstr ""
|
||||
"les fonctions de Viper ne supportent pas plus de 4 arguments actuellement"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr "Index de la voix trop grand"
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "ATTENTION: le nom de fichier de votre code a deux extensions\n"
|
||||
|
@ -1522,7 +1522,7 @@ msgstr "bits doivent être 7, 8 ou 9"
|
|||
msgid "bits must be 8"
|
||||
msgstr "les bits doivent être 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "'bits_per_sample' doivent être 8 ou 16"
|
||||
|
@ -2142,6 +2142,10 @@ msgstr "label redéfini"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr "argument 'length' non-permis pour ce type"
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "Les parties gauches et droites doivent être compatibles"
|
||||
|
@ -2998,6 +3002,9 @@ msgstr "'step' nul"
|
|||
#~ msgstr ""
|
||||
#~ "Utilisez 'esptool' pour effacer la flash et recharger Python à la place"
|
||||
|
||||
#~ msgid "Voice index too high"
|
||||
#~ msgstr "Index de la voix trop grand"
|
||||
|
||||
#~ msgid "bad GATT role"
|
||||
#~ msgstr "mauvais rôle GATT"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
|
||||
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -482,11 +482,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Impossibile inizializzare l'UART"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Impossibile allocare il primo buffer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Impossibile allocare il secondo buffer"
|
||||
|
||||
|
@ -817,7 +817,7 @@ msgstr "lunghezza del buffer non valida"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr "periodo di cattura invalido. Zona valida: 1 - 500"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Argomento non valido"
|
||||
|
@ -880,7 +880,11 @@ msgstr "Modalità di esecuzione non valida."
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Tipo di servizio non valido"
|
||||
|
@ -1150,7 +1154,7 @@ msgstr "Modalità sicura in esecuzione! Codice salvato non in esecuzione.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA o SCL necessitano un pull-up"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "STA deve essere attiva"
|
||||
|
@ -1225,19 +1229,19 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1375,10 +1379,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "ATTENZIONE: Il nome del sorgente ha due estensioni\n"
|
||||
|
@ -1492,7 +1492,7 @@ msgstr "i bit devono essere 7, 8 o 9"
|
|||
msgid "bits must be 8"
|
||||
msgstr "i bit devono essere 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "i bit devono essere 7, 8 o 9"
|
||||
|
@ -2103,6 +2103,10 @@ msgstr "etichetta ridefinita"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "lhs e rhs devono essere compatibili"
|
||||
|
|
37
locale/pl.po
37
locale/pl.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
|
||||
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
|
||||
"Language-Team: pl\n"
|
||||
|
@ -475,11 +475,11 @@ msgstr "Nie można zdekodować ble_uuid, błąd 0x%04x"
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Ustawienie UART nie powiodło się"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Nie udała się alokacja pierwszego bufora"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Nie udała się alokacja drugiego bufora"
|
||||
|
||||
|
@ -802,7 +802,7 @@ msgstr "Zła wielkość bufora"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr "Zły okres. Poprawny zakres to: 1 - 500"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Zła liczba kanałów"
|
||||
|
||||
|
@ -864,7 +864,11 @@ msgstr "Zły tryb uruchomienia"
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Zła liczba głosów"
|
||||
|
||||
|
@ -1123,7 +1127,7 @@ msgstr "Uruchomiony tryb bezpieczeństwa! Zapisany kod nie jest uruchamiany.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA lub SCL wymagają podciągnięcia"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Częstotliwość próbkowania musi być dodatnia"
|
||||
|
||||
|
@ -1203,19 +1207,19 @@ msgstr ""
|
|||
"Przycisk reset został wciśnięty podczas startu CircuitPythona. Wciśnij go "
|
||||
"ponownie aby wyjść z trybu bezpieczeństwa.\n"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr "Wartość bits_per_sample nie pasuje do miksera"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr "Liczba kanałów nie pasuje do miksera "
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr "Sample rate nie pasuje do miksera"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr "Znak nie pasuje do miksera"
|
||||
|
||||
|
@ -1351,10 +1355,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr "Zbyt wysoki indeks głosu"
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "UWAGA: Nazwa pliku ma dwa rozszerzenia\n"
|
||||
|
@ -1469,7 +1469,7 @@ msgstr "bits musi być 7, 8 lub 9"
|
|||
msgid "bits must be 8"
|
||||
msgstr "bits musi być 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "bits_per_sample musi być 8 lub 16"
|
||||
|
||||
|
@ -2065,6 +2065,10 @@ msgstr "etykieta przedefiniowana"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr "ten typ nie pozawala na podanie długości"
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "lewa i prawa strona powinny być kompatybilne"
|
||||
|
@ -2788,6 +2792,9 @@ msgstr "zerowy krok"
|
|||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "Wartość UUID poza zakresem 0 do 0xffff"
|
||||
|
||||
#~ msgid "Voice index too high"
|
||||
#~ msgstr "Zbyt wysoki indeks głosu"
|
||||
|
||||
#~ msgid "bad GATT role"
|
||||
#~ msgstr "zła rola GATT"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
@ -478,11 +478,11 @@ msgstr ""
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Não foi possível inicializar o UART"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Não pôde alocar primeiro buffer"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Não pôde alocar segundo buffer"
|
||||
|
||||
|
@ -810,7 +810,7 @@ msgstr "Arquivo inválido"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Invalid channel count"
|
||||
msgstr "certificado inválido"
|
||||
|
@ -873,7 +873,11 @@ msgstr ""
|
|||
msgid "Invalid security_mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "Invalid voice count"
|
||||
msgstr "certificado inválido"
|
||||
|
@ -1133,7 +1137,7 @@ msgstr "Rodando em modo seguro! Não está executando o código salvo.\n"
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA ou SCL precisa de um pull up"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1203,19 +1207,19 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1352,10 +1356,6 @@ msgstr ""
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "AVISO: Seu arquivo de código tem duas extensões\n"
|
||||
|
@ -1466,7 +1466,7 @@ msgstr ""
|
|||
msgid "bits must be 8"
|
||||
msgstr "bits devem ser 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
#, fuzzy
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "bits devem ser 8"
|
||||
|
@ -2065,6 +2065,10 @@ msgstr ""
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr ""
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: circuitpython-cn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-08-29 18:48-0400\n"
|
||||
"POT-Creation-Date: 2019-08-29 22:16-0500\n"
|
||||
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
|
||||
"Last-Translator: hexthat\n"
|
||||
"Language-Team: Chinese Hanyu Pinyin\n"
|
||||
|
@ -476,11 +476,11 @@ msgstr "Wúfǎ jiěmǎ kě dú_uuid, err 0x%04x"
|
|||
msgid "Could not initialize UART"
|
||||
msgstr "Wúfǎ chūshǐhuà UART"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Wúfǎ fēnpèi dì yī gè huǎnchōng qū"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c shared-module/audiocore/WaveFile.c
|
||||
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Wúfǎ fēnpèi dì èr gè huǎnchōng qū"
|
||||
|
||||
|
@ -803,7 +803,7 @@ msgstr "Wúxiào de huǎnchōng qū dàxiǎo"
|
|||
msgid "Invalid capture period. Valid range: 1 - 500"
|
||||
msgstr "Wúxiào de bǔhuò zhōuqí. Yǒuxiào fànwéi: 1-500"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Wúxiào de tōngdào jìshù"
|
||||
|
||||
|
@ -865,7 +865,11 @@ msgstr "Wúxiào de yùnxíng móshì."
|
|||
msgid "Invalid security_mode"
|
||||
msgstr "Ānquán móshì wúxiào"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Wúxiào de yǔyīn jìshù"
|
||||
|
||||
|
@ -1127,7 +1131,7 @@ msgstr "Zài ānquán móshì xià yùnxíng! Bù yùnxíng yǐ bǎocún de dài
|
|||
msgid "SDA or SCL needs a pull up"
|
||||
msgstr "SDA huò SCL xūyào lādòng"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù"
|
||||
|
||||
|
@ -1209,19 +1213,19 @@ msgstr ""
|
|||
"Qǐdòng CircuitPython shí, chóng zhì ànniǔ bèi àn xià. Zàicì àn xià yǐ tuìchū "
|
||||
"ānquán móshì\n"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr "Yàngběn de bits_per_sample yǔ hǔn yīn qì bù pǐpèi"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr "Yàngběn de píndào jìshù yǔ hǔn yīn qì bù xiāngfú"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr "Yàngběn de yàngběn sùdù yǔ hǔn yīn qì de xiāngchà bù pǐpèi"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
#: shared-module/audiomixer/MixerVoice.c
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr "Yàngběn de qiānmíng yǔ hǔn yīn qì de qiānmíng bù pǐpèi"
|
||||
|
||||
|
@ -1357,10 +1361,6 @@ msgstr "Zhí chángdù > zuìdà chángdù"
|
|||
msgid "Viper functions don't currently support more than 4 arguments"
|
||||
msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù"
|
||||
|
||||
#: shared-module/audiocore/Mixer.c
|
||||
msgid "Voice index too high"
|
||||
msgstr "Yǔyīn suǒyǐn tài gāo"
|
||||
|
||||
#: main.c
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "Jǐnggào: Nǐ de dàimǎ wénjiàn míng yǒu liǎng gè kuòzhǎn míng\n"
|
||||
|
@ -1478,7 +1478,7 @@ msgstr "bǐtè bìxū shì 7,8 huò 9"
|
|||
msgid "bits must be 8"
|
||||
msgstr "bǐtè bìxū shì 8"
|
||||
|
||||
#: shared-bindings/audiocore/Mixer.c
|
||||
#: shared-bindings/audiomixer/Mixer.c
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "měi jiàn yàngběn bìxū wèi 8 huò 16"
|
||||
|
||||
|
@ -2077,6 +2077,10 @@ msgstr "biāoqiān chóngxīn dìngyì"
|
|||
msgid "length argument not allowed for this type"
|
||||
msgstr "bù yǔnxǔ gāi lèixíng de chángdù cānshù"
|
||||
|
||||
#: shared-bindings/audiomixer/MixerVoice.c
|
||||
msgid "level must be between 0 and 1"
|
||||
msgstr ""
|
||||
|
||||
#: py/objarray.c
|
||||
msgid "lhs and rhs should be compatible"
|
||||
msgstr "lhs hé rhs yīnggāi jiānróng"
|
||||
|
@ -2817,6 +2821,9 @@ msgstr "líng bù"
|
|||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "UUID zhěngshù zhí bùzài fànwéi 0 zhì 0xffff"
|
||||
|
||||
#~ msgid "Voice index too high"
|
||||
#~ msgstr "Yǔyīn suǒyǐn tài gāo"
|
||||
|
||||
#~ msgid "bad GATT role"
|
||||
#~ msgstr "zǒng xiédìng de bùliáng juésè"
|
||||
|
||||
|
|
|
@ -19,15 +19,16 @@ CIRCUITPY_ANALOGIO = 1
|
|||
CIRCUITPY_GAMEPAD = 1
|
||||
CIRCUITPY_DISPLAYIO = 1
|
||||
|
||||
CIRCUITPY_TOUCHIO = 0
|
||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||
CIRCUITPY_RTC = 0
|
||||
CIRCUITPY_USB_MIDI = 0
|
||||
CIRCUITPY_USB_HID = 0
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
CIRCUITPY_BITBANGIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
CIRCUITPY_RTC = 0
|
||||
CIRCUITPY_TOUCHIO = 0
|
||||
CIRCUITPY_USB_HID = 0
|
||||
CIRCUITPY_USB_MIDI = 0
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame10
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ endif
|
|||
# Put samd21-only choices here.
|
||||
ifeq ($(CHIP_FAMILY),samd21)
|
||||
# frequencyio not yet verified as working on SAMD21.
|
||||
CIRCUITPY_AUDIOMIXER = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ LONGINT_IMPL = MPZ
|
|||
# Audio via PWM
|
||||
CIRCUITPY_AUDIOCORE = 1
|
||||
CIRCUITPY_AUDIOIO = 0
|
||||
CIRCUITPY_AUDIOMIXER = 1
|
||||
CIRCUITPY_AUDIOPWMIO = 1
|
||||
CIRCUITPY_AUDIOBUSIO = 1
|
||||
|
||||
|
|
|
@ -98,10 +98,13 @@ endif
|
|||
|
||||
ifeq ($(MCU_SUB_VARIANT), stm32f411xe)
|
||||
C_DEFS = \
|
||||
-DUSE_FULL_LL_DRIVER \
|
||||
-DUSE_HAL_DRIVER \
|
||||
-DSTM32F411xE
|
||||
endif
|
||||
|
||||
C_DEFS += -DMCU_PACKAGE=$(MCU_PACKAGE)
|
||||
|
||||
#TODO: Add ASM Flags? -Werror
|
||||
CFLAGS += $(INC) -Wall -std=gnu11 -nostdlib $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
|
||||
|
||||
|
@ -133,7 +136,7 @@ LIBS += -lm
|
|||
endif
|
||||
|
||||
# TinyUSB defines
|
||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
|
||||
CFLAGS += -DHSE_VALUE=8000000 -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
|
||||
|
||||
|
||||
######################################
|
||||
|
@ -148,6 +151,7 @@ SRC_STM32 = \
|
|||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \
|
||||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \
|
||||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c \
|
||||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
|
||||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \
|
||||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \
|
||||
stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c \
|
||||
|
@ -183,6 +187,8 @@ SRC_C += \
|
|||
mphalport.c \
|
||||
tick.c \
|
||||
boards/$(BOARD)/board.c \
|
||||
boards/$(BOARD)/pins.c \
|
||||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/pins.c \
|
||||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/clocks.c \
|
||||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/gpio.c \
|
||||
lib/libc/string0.c \
|
||||
|
@ -202,11 +208,6 @@ ifneq ($(USB),FALSE)
|
|||
SRC_C += lib/tinyusb/src/portable/st/stm32f4/dcd_stm32f4.c
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SUB_VARIANT), stm32f412zx)
|
||||
SRC_C += peripherals/stm32f4/stm32f412zx/pins.c
|
||||
SRC_C += boards/$(BOARD)/pins.c
|
||||
endif
|
||||
|
||||
SRC_S = \
|
||||
supervisor/cpu.s \
|
||||
boards/startup_$(MCU_SUB_VARIANT).s
|
||||
|
|
|
@ -46,7 +46,10 @@ void run_background_tasks(void) {
|
|||
}
|
||||
running_background_tasks = true;
|
||||
filesystem_background();
|
||||
//usb_background();
|
||||
|
||||
#if USB_AVAILABLE
|
||||
usb_background();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
displayio_background();
|
||||
|
|
|
@ -1,189 +1,109 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
**
|
||||
|
||||
** File : LinkerScript.ld
|
||||
**
|
||||
** Author : Auto-generated by Ac6 System Workbench
|
||||
**
|
||||
** Abstract : Linker script for STM32F411VETx series
|
||||
** 512Kbytes FLASH and 128Kbytes RAM
|
||||
**
|
||||
** Set heap size, stack size and stack location according
|
||||
** to application requirements.
|
||||
**
|
||||
** Set memory bank area and size if external memory is used.
|
||||
**
|
||||
** Target : STMicroelectronics STM32
|
||||
**
|
||||
** Distribution: The file is distributed “as is,” without any warranty
|
||||
** of any kind.
|
||||
**
|
||||
*****************************************************************************
|
||||
** @attention
|
||||
**
|
||||
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
** are permitted provided that the following conditions are met:
|
||||
** 1. Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** 3. Neither the name of Ac6 nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*****************************************************************************
|
||||
GNU linker script for STM32F411 via Micropython
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x20020000; /* end of RAM */
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
|
||||
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
|
||||
FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
|
||||
FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
/* Define output sections */
|
||||
/* produce a link error if there is not this amount of RAM for these sections */
|
||||
_minimum_stack_size = 2K;
|
||||
_minimum_heap_size = 16K;
|
||||
|
||||
/* Define tho top end of the stack. The stack is full descending so begins just
|
||||
above last byte of RAM. Note that EABI requires the stack to be 8-byte
|
||||
aligned for a call. */
|
||||
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
||||
|
||||
/* RAM extents for the garbage collector */
|
||||
_ram_start = ORIGIN(RAM);
|
||||
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||
_heap_start = _ebss; /* heap starts just after statically allocated memory */
|
||||
_heap_end = 0x2001c000; /* tunable */
|
||||
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* define output sections */
|
||||
SECTIONS
|
||||
{
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.glue_7) /* glue arm to thumb code */
|
||||
*(.glue_7t) /* glue thumb to arm code */
|
||||
*(.eh_frame)
|
||||
/* This first flash block is 16K annd the isr vectors only take up
|
||||
about 400 bytes. Micropython pads this with files, but this didn't
|
||||
work with the size of Circuitpython's ff object. */
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
. = ALIGN(4);
|
||||
} >FLASH_ISR
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >FLASH
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
/* *(.glue_7) */ /* glue arm to thumb code */
|
||||
/* *(.glue_7t) */ /* glue thumb to arm code */
|
||||
|
||||
/* Constant data goes into FLASH */
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbol at end of code */
|
||||
} >FLASH_TEXT
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >FLASH
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array*))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
/* This is the initialized data section
|
||||
The program executes knowing that the data is in the RAM
|
||||
but the loader puts the initial values in the FLASH (inidata).
|
||||
It is one task of the startup to copy the initial values from FLASH to RAM. */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
|
||||
*(.data*) /* .data* sections */
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
|
||||
} >RAM AT> FLASH_TEXT
|
||||
|
||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
/* Uninitialized data section */
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = .; /* define a global symbol at bss start; used by startup code */
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT> FLASH
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end; used by startup code and GC */
|
||||
} >RAM
|
||||
|
||||
|
||||
/* Uninitialized data section */
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
/* this is to define the start of the heap, and make sure we have a minimum size */
|
||||
.heap :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
. = . + _minimum_heap_size;
|
||||
. = ALIGN(4);
|
||||
} >RAM
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >RAM
|
||||
/* this just checks there is enough RAM for the stack */
|
||||
.stack :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
. = . + _minimum_stack_size;
|
||||
. = ALIGN(4);
|
||||
} >RAM
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
._user_heap_stack :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
. = . + _Min_Heap_Size;
|
||||
. = . + _Min_Stack_Size;
|
||||
. = ALIGN(8);
|
||||
} >RAM
|
||||
|
||||
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,189 +0,0 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
**
|
||||
|
||||
** File : LinkerScript.ld
|
||||
**
|
||||
** Author : Auto-generated by Ac6 System Workbench
|
||||
**
|
||||
** Abstract : Linker script for STM32F411RETx series
|
||||
** 512Kbytes FLASH and 128Kbytes RAM
|
||||
**
|
||||
** Set heap size, stack size and stack location according
|
||||
** to application requirements.
|
||||
**
|
||||
** Set memory bank area and size if external memory is used.
|
||||
**
|
||||
** Target : STMicroelectronics STM32
|
||||
**
|
||||
** Distribution: The file is distributed “as is,” without any warranty
|
||||
** of any kind.
|
||||
**
|
||||
*****************************************************************************
|
||||
** @attention
|
||||
**
|
||||
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
** are permitted provided that the following conditions are met:
|
||||
** 1. Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** 3. Neither the name of Ac6 nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x20020000; /* end of RAM */
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
|
||||
}
|
||||
|
||||
/* Define output sections */
|
||||
SECTIONS
|
||||
{
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.glue_7) /* glue arm to thumb code */
|
||||
*(.glue_7t) /* glue thumb to arm code */
|
||||
*(.eh_frame)
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >FLASH
|
||||
|
||||
/* Constant data goes into FLASH */
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >FLASH
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array*))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT> FLASH
|
||||
|
||||
|
||||
/* Uninitialized data section */
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >RAM
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
._user_heap_stack :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
. = . + _Min_Heap_Size;
|
||||
. = . + _Min_Stack_Size;
|
||||
. = ALIGN(8);
|
||||
} >RAM
|
||||
|
||||
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
USB_VID = 0x239A
|
||||
USB_PID = 0x802A
|
||||
USB_PRODUCT = "STM32F411RE Discovery Board - CPy"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
MCU_SERIES = m4
|
||||
MCU_VARIANT = stm32f4
|
||||
MCU_SUB_VARIANT = stm32f411xe
|
||||
CMSIS_MCU = STM32F411xE
|
||||
LD_FILE = boards/STM32F411VETx_FLASH.ld
|
||||
TEXT0_ADDR = 0x08000000
|
||||
TEXT1_ADDR = 0x08020000
|
||||
|
|
@ -30,9 +30,11 @@
|
|||
#define MICROPY_HW_BOARD_NAME "STM32F411E_DISCO"
|
||||
#define MICROPY_HW_MCU_NAME "STM32F411xE"
|
||||
|
||||
#define FLASH_SIZE (0x7D000)
|
||||
#define FLASH_PAGE_SIZE (0x4000)
|
||||
#define FLASH_SIZE (0x80000) //512K
|
||||
#define FLASH_PAGE_SIZE (0x4000) //16K
|
||||
|
||||
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE (4096)
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
|
@ -0,0 +1,17 @@
|
|||
USB_VID = 0x239A
|
||||
USB_PID = 0x802A
|
||||
USB_PRODUCT = "STM32F411VE Discovery Board - CPy"
|
||||
USB_MANUFACTURER = "STMicroelectronics"
|
||||
USB_CDC_AND_MSC_ONLY = 1
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
|
||||
MCU_SERIES = m4
|
||||
MCU_VARIANT = stm32f4
|
||||
MCU_SUB_VARIANT = stm32f411xe
|
||||
MCU_PACKAGE = 100
|
||||
CMSIS_MCU = STM32F411xE
|
||||
LD_FILE = boards/STM32F411VETx_FLASH.ld
|
||||
TEXT0_ADDR = 0x08000000
|
||||
TEXT1_ADDR = 0x08020000
|
|
@ -1,19 +1,12 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE04), MP_ROM_PTR(&pin_PE04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF02), MP_ROM_PTR(&pin_PF02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF03), MP_ROM_PTR(&pin_PF03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF10), MP_ROM_PTR(&pin_PF10) },
|
||||
//P1
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
|
||||
|
@ -25,66 +18,76 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF11), MP_ROM_PTR(&pin_PF11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF13), MP_ROM_PTR(&pin_PF13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE07), MP_ROM_PTR(&pin_PE07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE08), MP_ROM_PTR(&pin_PE08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE09), MP_ROM_PTR(&pin_PE09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE10), MP_ROM_PTR(&pin_PE10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE11), MP_ROM_PTR(&pin_PE11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE12), MP_ROM_PTR(&pin_PE12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE13), MP_ROM_PTR(&pin_PE13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD12), MP_ROM_PTR(&pin_PD12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG02), MP_ROM_PTR(&pin_PG02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC09), MP_ROM_PTR(&pin_PC09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG09), MP_ROM_PTR(&pin_PG09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG10), MP_ROM_PTR(&pin_PG10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG11), MP_ROM_PTR(&pin_PG11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG12), MP_ROM_PTR(&pin_PG12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG13), MP_ROM_PTR(&pin_PG13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG14), MP_ROM_PTR(&pin_PG14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE00), MP_ROM_PTR(&pin_PE00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
|
||||
//P2
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC14), MP_ROM_PTR(&pin_PC14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC15), MP_ROM_PTR(&pin_PC15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE04), MP_ROM_PTR(&pin_PE04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE01), MP_ROM_PTR(&pin_PE01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PG10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PG11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PF03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PF10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PG12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PF04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PG13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PG14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PG09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PC01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PC03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PC04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC05) }, //alt PB09, see F401ZG-DISCO manual
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB00) }, //alt PB10, see F401ZG-DISCO manual
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PE00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PE01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PE02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_PE03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE00), MP_ROM_PTR(&pin_PE00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD07), MP_ROM_PTR(&pin_PD07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD05), MP_ROM_PTR(&pin_PD05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD04), MP_ROM_PTR(&pin_PD04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD03), MP_ROM_PTR(&pin_PD03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD02), MP_ROM_PTR(&pin_PD02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD01), MP_ROM_PTR(&pin_PD01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD00), MP_ROM_PTR(&pin_PD00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC09), MP_ROM_PTR(&pin_PC09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
|
||||
//Names
|
||||
{ MP_ROM_QSTR(MP_QSTR_LD3), MP_ROM_PTR(&pin_PD13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LD4), MP_ROM_PTR(&pin_PD12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LD5), MP_ROM_PTR(&pin_PD14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LD6), MP_ROM_PTR(&pin_PD15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_ORANGE), MP_ROM_PTR(&pin_PD13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PD12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PD14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_PD15) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -166,7 +166,7 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
|
|||
PB6 ------> I2C1_SCL
|
||||
PB9 ------> I2C1_SDA
|
||||
*/
|
||||
GPIO_InitStruct.Pin = Audio_SCL_Pin|Audio_SDA_Pin;
|
||||
GPIO_InitStruct.Pin = Audio_SCL_Pin|GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
@ -33,6 +33,5 @@
|
|||
#define FLASH_SIZE (0x100000)
|
||||
#define FLASH_PAGE_SIZE (0x4000)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE (4096)
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
|
|
@ -3,9 +3,12 @@ USB_PID = 0x572B
|
|||
USB_PRODUCT = "STM32F412ZG Discovery Board - CPy"
|
||||
USB_MANUFACTURER = "STMicroelectronics"
|
||||
|
||||
DISABLE_FILESYSTEM = 1
|
||||
|
||||
MCU_SERIES = m4
|
||||
MCU_VARIANT = stm32f4
|
||||
MCU_SUB_VARIANT = stm32f412zx
|
||||
MCU_PACKAGE = 144
|
||||
CMSIS_MCU = STM32F412xG
|
||||
LD_FILE = boards/STM32F412ZGTx_FLASH.ld
|
||||
TEXT0_ADDR = 0x08000000
|
||||
|
|
|
@ -273,14 +273,14 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
|
|||
*/
|
||||
GPIO_InitStruct.Pin = I2C2_SCL_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_I2C2;
|
||||
HAL_GPIO_Init(I2C2_SCL_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = I2C2_SDA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_I2C2;
|
||||
HAL_GPIO_Init(I2C2_SDA_GPIO_Port, &GPIO_InitStruct);
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft
|
||||
* 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 "shared-bindings/busio/I2C.h"
|
||||
#include "py/mperrno.h"
|
||||
#include "py/runtime.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
I2C_HandleTypeDef hi2c2;
|
||||
|
||||
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
||||
const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) {
|
||||
//TODO: Rework this entire section to use LL so we can properly assign pins
|
||||
// This will also be bundled with MSP removal
|
||||
hi2c2.Instance = I2C1;
|
||||
hi2c2.Init.ClockSpeed = 100000;
|
||||
hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
||||
hi2c2.Init.OwnAddress1 = 0;
|
||||
hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
hi2c2.Init.OwnAddress2 = 0;
|
||||
hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
if(HAL_I2C_Init(&hi2c2) != HAL_OK) {
|
||||
mp_raise_RuntimeError(translate("I2C Init Error"));
|
||||
} else {
|
||||
mp_printf(&mp_plat_print, "I2C INIT OK");
|
||||
}
|
||||
|
||||
self->sda_pin = sda->number;
|
||||
self->scl_pin = scl->number;
|
||||
|
||||
claim_pin(sda);
|
||||
claim_pin(scl);
|
||||
}
|
||||
|
||||
bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) {
|
||||
return self->sda_pin == NO_PIN;
|
||||
}
|
||||
|
||||
void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
HAL_I2C_MspDeInit(&hi2c2);
|
||||
|
||||
self->sda_pin = NO_PIN;
|
||||
self->scl_pin = NO_PIN;
|
||||
}
|
||||
|
||||
bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
||||
return HAL_I2C_IsDeviceReady(&hi2c2, (uint16_t)(addr<<1),2,2) == HAL_OK;
|
||||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
bool grabbed_lock = false;
|
||||
|
||||
//Critical section code that may be required at some point.
|
||||
// uint32_t store_primask = __get_PRIMASK();
|
||||
// __disable_irq();
|
||||
// __DMB();
|
||||
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
self->has_lock = true;
|
||||
}
|
||||
|
||||
// __DMB();
|
||||
// __set_PRIMASK(store_primask);
|
||||
|
||||
return grabbed_lock;
|
||||
}
|
||||
|
||||
bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) {
|
||||
return self->has_lock;
|
||||
}
|
||||
|
||||
void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) {
|
||||
self->has_lock = false;
|
||||
}
|
||||
|
||||
uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr,
|
||||
const uint8_t *data, size_t len, bool transmit_stop_bit) {
|
||||
return HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)(addr<<1), (uint8_t *)data, (uint16_t)len, 2) == HAL_OK ? 0 : MP_EIO;
|
||||
}
|
||||
|
||||
uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr,
|
||||
uint8_t *data, size_t len) {
|
||||
return HAL_I2C_Master_Receive(&hi2c2, (uint16_t)(addr<<1), data, (uint16_t)len, 2) == HAL_OK ? 0 : MP_EIO;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft
|
||||
* 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_STM32F4_COMMON_HAL_BUSIO_I2C_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_I2C_H
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
I2C_HandleTypeDef i2c_handle;
|
||||
bool has_lock;
|
||||
uint8_t scl_pin;
|
||||
uint8_t sda_pin;
|
||||
} busio_i2c_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_I2C_H
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Nick Moore for Adafruit Industries
|
||||
* Copyright (c) 2016 Scott Shawcroft
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,13 +24,10 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_NVM_BYTEARRAY_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_NVM_BYTEARRAY_H
|
||||
#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_ONEWIRE_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_ONEWIRE_H
|
||||
|
||||
#include "py/obj.h"
|
||||
// Use bitbangio.
|
||||
#include "shared-module/busio/OneWire.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
} nvm_bytearray_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_NVM_BYTEARRAY_H
|
||||
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_ONEWIRE_H
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "py/mperrno.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
||||
const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi,
|
||||
const mcu_pin_obj_t * miso) {
|
||||
mp_raise_NotImplementedError(translate("SPI not yet supported"));
|
||||
}
|
||||
|
||||
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
||||
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
bool grabbed_lock = false;
|
||||
return grabbed_lock;
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) {
|
||||
return self->has_lock;
|
||||
}
|
||||
|
||||
void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
|
||||
self->has_lock = false;
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_write(busio_spi_obj_t *self,
|
||||
const uint8_t *data, size_t len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_read(busio_spi_obj_t *self,
|
||||
uint8_t *data, size_t len, uint8_t write_value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) {
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft
|
||||
*
|
||||
* 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_STM32F4_COMMON_HAL_BUSIO_SPI_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_SPI_H
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
bool has_lock;
|
||||
uint8_t clock_pin;
|
||||
uint8_t MOSI_pin;
|
||||
uint8_t MISO_pin;
|
||||
} busio_spi_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_SPI_H
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 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 "shared-bindings/microcontroller/__init__.h"
|
||||
#include "shared-bindings/busio/UART.h"
|
||||
|
||||
#include "mpconfigport.h"
|
||||
#include "lib/utils/interrupt_char.h"
|
||||
#include "py/gc.h"
|
||||
#include "py/mperrno.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/stream.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
#include "tick.h"
|
||||
|
||||
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
|
||||
uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
|
||||
uint16_t receiver_buffer_size) {
|
||||
mp_raise_NotImplementedError(translate("UART not yet supported"));
|
||||
}
|
||||
|
||||
bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
||||
}
|
||||
|
||||
// Read characters.
|
||||
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Write characters.
|
||||
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate) {
|
||||
}
|
||||
|
||||
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
|
||||
}
|
||||
|
||||
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft
|
||||
*
|
||||
* 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_STM32F4_COMMON_HAL_BUSIO_UART_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_UART_H
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
uint8_t rx_pin;
|
||||
uint8_t tx_pin;
|
||||
uint8_t character_bits;
|
||||
bool rx_error;
|
||||
uint32_t baudrate;
|
||||
uint32_t timeout_ms;
|
||||
uint32_t buffer_length;
|
||||
uint8_t* buffer;
|
||||
} busio_uart_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_UART_H
|
|
@ -0,0 +1 @@
|
|||
// No busio module functions.
|
|
@ -31,11 +31,16 @@
|
|||
#include "stm32f4/pins.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
#define GPIO_PORT_COUNT 5
|
||||
#if MCU_PACKAGE == 144
|
||||
#define GPIO_PORT_COUNT 7
|
||||
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG};
|
||||
#elif MCU_PACKAGE == 100
|
||||
#define GPIO_PORT_COUNT 5
|
||||
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE};
|
||||
#endif
|
||||
|
||||
STATIC uint16_t claimed_pins[GPIO_PORT_COUNT];
|
||||
STATIC uint16_t never_reset_pins[GPIO_PORT_COUNT];
|
||||
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE};
|
||||
|
||||
void reset_all_pins(void) {
|
||||
// Reset claimed pins
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Dan Halbert for Adafruit Industries
|
||||
* 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
|
||||
|
@ -28,17 +29,20 @@
|
|||
#include "py/runtime.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
#define STM32_UUID ((uint32_t *)0x1FFF7A10)
|
||||
|
||||
float common_hal_mcu_processor_get_temperature(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t common_hal_mcu_processor_get_frequency(void) {
|
||||
return 64000000ul;
|
||||
return SystemCoreClock;
|
||||
}
|
||||
|
||||
void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
|
||||
for (int i=0; i<2; i++) {
|
||||
((uint32_t*) raw_id)[i] = 0;
|
||||
for (int i=0; i<3; i++) {
|
||||
((uint32_t*) raw_id)[i] = STM32_UUID[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
|
||||
|
||||
#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 8
|
||||
#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 12
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
|
||||
* 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
|
||||
|
@ -31,17 +32,18 @@
|
|||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "common-hal/microcontroller/Processor.h"
|
||||
|
||||
#include "shared-bindings/nvm/ByteArray.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/microcontroller/Processor.h"
|
||||
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/safe_mode.h"
|
||||
|
||||
// This routine should work even when interrupts are disabled. Used by OneWire
|
||||
// for precise timing.
|
||||
void common_hal_mcu_delay_us(uint32_t delay) {
|
||||
//NRFX_DELAY_US(delay);
|
||||
//TODO: implement equivalent of mp_hal_delay_us(delay);
|
||||
//this is fairly annoying in the STM32 HAL
|
||||
}
|
||||
|
||||
void common_hal_mcu_disable_interrupts() {
|
||||
|
@ -51,12 +53,13 @@ void common_hal_mcu_enable_interrupts() {
|
|||
}
|
||||
|
||||
void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
|
||||
// TODO: see atmel-samd for functionality
|
||||
if(runmode == RUNMODE_SAFE_MODE)
|
||||
safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);
|
||||
}
|
||||
|
||||
void common_hal_mcu_reset(void) {
|
||||
// filesystem_flush();
|
||||
// NVIC_SystemReset();
|
||||
filesystem_flush();
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
// The singleton microcontroller.Processor object, bound to microcontroller.cpu
|
||||
|
@ -67,15 +70,6 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = {
|
|||
},
|
||||
};
|
||||
|
||||
#if CIRCUITPY_INTERNAL_NVM_SIZE > 0
|
||||
// The singleton nvm.ByteArray object.
|
||||
const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = {
|
||||
.base = {
|
||||
.type = &nvm_bytearray_type,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
|
||||
|
@ -83,6 +77,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
|
||||
#if MCU_PACKAGE == LQFP144
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF00), MP_ROM_PTR(&pin_PF00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF01), MP_ROM_PTR(&pin_PF01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF02), MP_ROM_PTR(&pin_PF02) },
|
||||
|
@ -94,6 +89,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PF08), MP_ROM_PTR(&pin_PF08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF09), MP_ROM_PTR(&pin_PF09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF10), MP_ROM_PTR(&pin_PF10) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
|
||||
|
@ -111,6 +107,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
|
||||
#if MCU_PACKAGE == LQFP144
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF11), MP_ROM_PTR(&pin_PF11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF12), MP_ROM_PTR(&pin_PF12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PF13), MP_ROM_PTR(&pin_PF13) },
|
||||
|
@ -118,6 +115,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PF15), MP_ROM_PTR(&pin_PF15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG00), MP_ROM_PTR(&pin_PG00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG01), MP_ROM_PTR(&pin_PG01) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE07), MP_ROM_PTR(&pin_PE07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE08), MP_ROM_PTR(&pin_PE08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE09), MP_ROM_PTR(&pin_PE09) },
|
||||
|
@ -128,7 +126,9 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
|
||||
#if MCU_PACKAGE == LQFP144
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
|
||||
|
@ -141,6 +141,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
|
||||
#if MCU_PACKAGE == LQFP144
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG02), MP_ROM_PTR(&pin_PG02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG03), MP_ROM_PTR(&pin_PG03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG04), MP_ROM_PTR(&pin_PG04) },
|
||||
|
@ -148,6 +149,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PG06), MP_ROM_PTR(&pin_PG06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG07), MP_ROM_PTR(&pin_PG07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG08), MP_ROM_PTR(&pin_PG08) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
|
||||
|
@ -171,6 +173,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PD05), MP_ROM_PTR(&pin_PD05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PD07), MP_ROM_PTR(&pin_PD07) },
|
||||
#if MCU_PACKAGE == LQFP144
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG09), MP_ROM_PTR(&pin_PG09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG10), MP_ROM_PTR(&pin_PG10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG11), MP_ROM_PTR(&pin_PG11) },
|
||||
|
@ -178,6 +181,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_PG13), MP_ROM_PTR(&pin_PG13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG14), MP_ROM_PTR(&pin_PG14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PG15), MP_ROM_PTR(&pin_PG15) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Nick Moore for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
//TODO: Implement for STM32. File required by Microcontroller Init
|
||||
|
||||
#include "common-hal/nvm/ByteArray.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// defined in linker
|
||||
extern uint32_t __fatfs_flash_start_addr[];
|
||||
extern uint32_t __fatfs_flash_length[];
|
||||
|
||||
#define NVM_START_ADDR ((uint32_t)__fatfs_flash_start_addr + \
|
||||
(uint32_t)__fatfs_flash_length - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) {
|
||||
return CIRCUITPY_INTERNAL_NVM_SIZE;
|
||||
}
|
||||
|
||||
static void write_page(uint32_t page_addr, uint32_t offset, uint32_t len, uint8_t *bytes) {
|
||||
//
|
||||
// Write a whole page to flash, buffering it first and then erasing and rewriting
|
||||
// it since we can only clear a whole page at a time.
|
||||
|
||||
// if (offset == 0 && len == FLASH_PAGE_SIZE) {
|
||||
// nrf_nvm_safe_flash_page_write(page_addr, bytes);
|
||||
// } else {
|
||||
// uint8_t buffer[FLASH_PAGE_SIZE];
|
||||
// memcpy(buffer, (uint8_t *)page_addr, FLASH_PAGE_SIZE);
|
||||
// memcpy(buffer + offset, bytes, len);
|
||||
// nrf_nvm_safe_flash_page_write(page_addr, buffer);
|
||||
// }
|
||||
}
|
||||
|
||||
bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
|
||||
// uint32_t start_index, uint8_t* values, uint32_t len) {
|
||||
|
||||
// uint32_t address = NVM_START_ADDR + start_index;
|
||||
// uint32_t offset = address % FLASH_PAGE_SIZE;
|
||||
// uint32_t page_addr = address - offset;
|
||||
|
||||
// while (len) {
|
||||
// uint32_t write_len = MIN(len, FLASH_PAGE_SIZE - offset);
|
||||
// write_page(page_addr, offset, write_len, values);
|
||||
// len -= write_len;
|
||||
// values += write_len;
|
||||
// page_addr += FLASH_PAGE_SIZE;
|
||||
// offset = 0;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self,
|
||||
uint32_t start_index, uint32_t len, uint8_t* values) {
|
||||
memcpy(values, (uint8_t *)(NVM_START_ADDR + start_index), len);
|
||||
}
|
|
@ -7,7 +7,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
|
|||
INTERNAL_LIBM = 1
|
||||
|
||||
# Chip supplied serial number, in bytes
|
||||
USB_SERIAL_NUMBER_LENGTH = 16
|
||||
USB_SERIAL_NUMBER_LENGTH = 24
|
||||
|
||||
# Longints can be implemented as mpz, as longlong, or not
|
||||
LONGINT_IMPL = MPZ
|
||||
|
@ -15,8 +15,11 @@ LONGINT_IMPL = MPZ
|
|||
#Reduced feature set for early port
|
||||
CIRCUITPY_MINIMAL_BUILD = 1
|
||||
|
||||
ifeq ($(MCU_SUB_VARIANT), stm32f412zx)
|
||||
CIRCUITPY_BOARD = 1
|
||||
CIRCUITPY_DIGITALIO = 1
|
||||
CIRCUITPY_MICROCONTROLLER = 1
|
||||
endif
|
||||
CIRCUITPY_BOARD = 1
|
||||
CIRCUITPY_DIGITALIO = 1
|
||||
CIRCUITPY_MICROCONTROLLER = 1
|
||||
CIRCUITPY_BUSIO = 1
|
||||
CIRCUITPY_TIME = 1
|
||||
|
||||
#ifeq ($(MCU_SUB_VARIANT), stm32f412zx)
|
||||
#endif
|
||||
|
|
|
@ -25,3 +25,4 @@
|
|||
*/
|
||||
|
||||
void stm32f4_peripherals_gpio_init(void);
|
||||
void stm32f4_peripherals_status_led(uint8_t led, uint8_t state);
|
||||
|
|
|
@ -69,5 +69,7 @@ extern const mp_obj_type_t mcu_pin_type;
|
|||
#ifdef STM32F412Zx
|
||||
#include "stm32f412zx/pins.h"
|
||||
#endif
|
||||
|
||||
#ifdef STM32F411xE
|
||||
#include "stm32f411xe/pins.h"
|
||||
#endif
|
||||
#endif // __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PINS_H__
|
||||
|
|
|
@ -28,36 +28,34 @@
|
|||
|
||||
void stm32f4_peripherals_clocks_init(void) {
|
||||
//System clock init
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 4;
|
||||
RCC_OscInitStruct.PLL.PLLN = 192;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 8;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
|
||||
PeriphClkInitStruct.PLLI2S.PLLI2SN = 200;
|
||||
PeriphClkInitStruct.PLLI2S.PLLI2SM = 5;
|
||||
PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
|
||||
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
|
||||
/* Enable Power Control clock */
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
/* The voltage scaling allows optimizing the power consumption when the device is
|
||||
clocked below the maximum system frequency, to update the voltage scaling value
|
||||
regarding system frequency refer to product datasheet. */
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
|
||||
|
||||
/* Enable HSE Oscillator and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 8;
|
||||
RCC_OscInitStruct.PLL.PLLN = 336;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 7;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
|
||||
clocks dividers */
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
|
||||
}
|
||||
|
|
|
@ -105,33 +105,50 @@
|
|||
#define LD6_GPIO_Port GPIOD
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stm32f4/gpio.h"
|
||||
|
||||
void stm32f4_peripherals_gpio_init(void) {
|
||||
//Enable all GPIO for now
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
//Enable all GPIO for now
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin, GPIO_PIN_RESET);
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : LD4_Pin LD3_Pin LD5_Pin LD6_Pin */
|
||||
GPIO_InitStruct.Pin = LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
/*Configure GPIO pins : LD4_Pin LD3_Pin LD5_Pin LD6_Pin */
|
||||
GPIO_InitStruct.Pin = LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
//Status LED chain
|
||||
HAL_GPIO_WritePin(GPIOD, LD4_Pin, GPIO_PIN_RESET); //LED 1
|
||||
HAL_GPIO_WritePin(GPIOD, LD3_Pin, GPIO_PIN_SET); //LED 2
|
||||
HAL_GPIO_WritePin(GPIOD, LD5_Pin, GPIO_PIN_SET); //LED 3
|
||||
HAL_GPIO_WritePin(GPIOD, LD6_Pin, GPIO_PIN_SET); //LED 4
|
||||
//Status LED chain
|
||||
stm32f4_peripherals_status_led(0,1);
|
||||
stm32f4_peripherals_status_led(1,0);
|
||||
stm32f4_peripherals_status_led(2,0);
|
||||
stm32f4_peripherals_status_led(3,0);
|
||||
}
|
||||
|
||||
//LEDs are inverted on F411 DISCO
|
||||
void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
|
||||
switch(led)
|
||||
{
|
||||
case 0: HAL_GPIO_WritePin(GPIOD, LD4_Pin, (state ^ 1));
|
||||
break;
|
||||
case 1: HAL_GPIO_WritePin(GPIOD, LD3_Pin, (state ^ 1));
|
||||
break;
|
||||
case 2: HAL_GPIO_WritePin(GPIOD, LD5_Pin, (state ^ 1));
|
||||
break;
|
||||
case 3: HAL_GPIO_WritePin(GPIOD, LD6_Pin, (state ^ 1));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,96 @@
|
|||
#include "py/mphal.h"
|
||||
#include "stm32f4/pins.h"
|
||||
|
||||
const mcu_pin_obj_t pin_PE02 = PIN(4, GPIOE, 2);
|
||||
const mcu_pin_obj_t pin_PE03 = PIN(4, GPIOE, 3);
|
||||
const mcu_pin_obj_t pin_PE04 = PIN(4, GPIOE, 4);
|
||||
const mcu_pin_obj_t pin_PE05 = PIN(4, GPIOE, 5);
|
||||
const mcu_pin_obj_t pin_PE06 = PIN(4, GPIOE, 6);
|
||||
|
||||
//TODO
|
||||
//const mcu_pin_obj_t pin_PE02 = PIN(4, GPIOE, 2);
|
||||
const mcu_pin_obj_t pin_PC13 = PIN(2, GPIOC, 13); //anti-tamp
|
||||
const mcu_pin_obj_t pin_PC14 = PIN(2, GPIOC, 14); //OSC32_IN
|
||||
const mcu_pin_obj_t pin_PC15 = PIN(2, GPIOC, 15); //OSC32_OUT
|
||||
|
||||
const mcu_pin_obj_t pin_PC00 = PIN(2, GPIOC, 0);
|
||||
const mcu_pin_obj_t pin_PC01 = PIN(2, GPIOC, 1);
|
||||
const mcu_pin_obj_t pin_PC02 = PIN(2, GPIOC, 2);
|
||||
const mcu_pin_obj_t pin_PC03 = PIN(2, GPIOC, 3);
|
||||
|
||||
const mcu_pin_obj_t pin_PA00 = PIN(0, GPIOA, 0);
|
||||
const mcu_pin_obj_t pin_PA01 = PIN(0, GPIOA, 1);
|
||||
const mcu_pin_obj_t pin_PA02 = PIN(0, GPIOA, 2);
|
||||
const mcu_pin_obj_t pin_PA03 = PIN(0, GPIOA, 3);
|
||||
const mcu_pin_obj_t pin_PA04 = PIN(0, GPIOA, 4);
|
||||
const mcu_pin_obj_t pin_PA05 = PIN(0, GPIOA, 5);
|
||||
const mcu_pin_obj_t pin_PA06 = PIN(0, GPIOA, 6);
|
||||
const mcu_pin_obj_t pin_PA07 = PIN(0, GPIOA, 7);
|
||||
|
||||
const mcu_pin_obj_t pin_PC04 = PIN(2, GPIOC, 4);
|
||||
const mcu_pin_obj_t pin_PC05 = PIN(2, GPIOC, 5);
|
||||
|
||||
const mcu_pin_obj_t pin_PB00 = PIN(1, GPIOB, 0);
|
||||
const mcu_pin_obj_t pin_PB01 = PIN(1, GPIOB, 1);
|
||||
const mcu_pin_obj_t pin_PB02 = PIN(1, GPIOB, 2);
|
||||
|
||||
const mcu_pin_obj_t pin_PE07 = PIN(4, GPIOE, 7);
|
||||
const mcu_pin_obj_t pin_PE08 = PIN(4, GPIOE, 8);
|
||||
const mcu_pin_obj_t pin_PE09 = PIN(4, GPIOE, 9);
|
||||
const mcu_pin_obj_t pin_PE10 = PIN(4, GPIOE, 10);
|
||||
const mcu_pin_obj_t pin_PE11 = PIN(4, GPIOE, 11);
|
||||
const mcu_pin_obj_t pin_PE12 = PIN(4, GPIOE, 12);
|
||||
const mcu_pin_obj_t pin_PE13 = PIN(4, GPIOE, 13);
|
||||
const mcu_pin_obj_t pin_PE14 = PIN(4, GPIOE, 14);
|
||||
const mcu_pin_obj_t pin_PE15 = PIN(4, GPIOE, 15);
|
||||
|
||||
const mcu_pin_obj_t pin_PB10 = PIN(1, GPIOB, 10);
|
||||
const mcu_pin_obj_t pin_PB12 = PIN(1, GPIOB, 12);
|
||||
const mcu_pin_obj_t pin_PB13 = PIN(1, GPIOB, 13);
|
||||
const mcu_pin_obj_t pin_PB14 = PIN(1, GPIOB, 14);
|
||||
const mcu_pin_obj_t pin_PB15 = PIN(1, GPIOB, 15);
|
||||
|
||||
const mcu_pin_obj_t pin_PD08 = PIN(3, GPIOD, 8);
|
||||
const mcu_pin_obj_t pin_PD09 = PIN(3, GPIOD, 9);
|
||||
const mcu_pin_obj_t pin_PD10 = PIN(3, GPIOD, 10);
|
||||
const mcu_pin_obj_t pin_PD11 = PIN(3, GPIOD, 11);
|
||||
const mcu_pin_obj_t pin_PD12 = PIN(3, GPIOD, 12);
|
||||
const mcu_pin_obj_t pin_PD13 = PIN(3, GPIOD, 13);
|
||||
const mcu_pin_obj_t pin_PD14 = PIN(3, GPIOD, 14);
|
||||
const mcu_pin_obj_t pin_PD15 = PIN(3, GPIOD, 15);
|
||||
|
||||
const mcu_pin_obj_t pin_PC06 = PIN(2, GPIOC, 6);
|
||||
const mcu_pin_obj_t pin_PC07 = PIN(2, GPIOC, 7);
|
||||
const mcu_pin_obj_t pin_PC08 = PIN(2, GPIOC, 8);
|
||||
const mcu_pin_obj_t pin_PC09 = PIN(2, GPIOC, 9);
|
||||
|
||||
const mcu_pin_obj_t pin_PA08 = PIN(0, GPIOA, 8);
|
||||
const mcu_pin_obj_t pin_PA09 = PIN(0, GPIOA, 9);
|
||||
const mcu_pin_obj_t pin_PA10 = PIN(0, GPIOA, 10);
|
||||
const mcu_pin_obj_t pin_PA11 = PIN(0, GPIOA, 11);
|
||||
const mcu_pin_obj_t pin_PA12 = PIN(0, GPIOA, 12);
|
||||
const mcu_pin_obj_t pin_PA13 = PIN(0, GPIOA, 13);
|
||||
const mcu_pin_obj_t pin_PA14 = PIN(0, GPIOA, 14);
|
||||
const mcu_pin_obj_t pin_PA15 = PIN(0, GPIOA, 15);
|
||||
|
||||
const mcu_pin_obj_t pin_PC10 = PIN(2, GPIOC, 10);
|
||||
const mcu_pin_obj_t pin_PC11 = PIN(2, GPIOC, 11);
|
||||
const mcu_pin_obj_t pin_PC12 = PIN(2, GPIOC, 12);
|
||||
|
||||
const mcu_pin_obj_t pin_PD00 = PIN(3, GPIOD, 0);
|
||||
const mcu_pin_obj_t pin_PD01 = PIN(3, GPIOD, 1);
|
||||
const mcu_pin_obj_t pin_PD02 = PIN(3, GPIOD, 2);
|
||||
const mcu_pin_obj_t pin_PD03 = PIN(3, GPIOD, 3);
|
||||
const mcu_pin_obj_t pin_PD04 = PIN(3, GPIOD, 4);
|
||||
const mcu_pin_obj_t pin_PD05 = PIN(3, GPIOD, 5);
|
||||
const mcu_pin_obj_t pin_PD06 = PIN(3, GPIOD, 6);
|
||||
const mcu_pin_obj_t pin_PD07 = PIN(3, GPIOD, 7);
|
||||
|
||||
const mcu_pin_obj_t pin_PB03 = PIN(1, GPIOB, 3);
|
||||
const mcu_pin_obj_t pin_PB04 = PIN(1, GPIOB, 4);
|
||||
const mcu_pin_obj_t pin_PB05 = PIN(1, GPIOB, 5);
|
||||
const mcu_pin_obj_t pin_PB06 = PIN(1, GPIOB, 6);
|
||||
const mcu_pin_obj_t pin_PB07 = PIN(1, GPIOB, 7);
|
||||
const mcu_pin_obj_t pin_PB08 = PIN(1, GPIOB, 8);
|
||||
const mcu_pin_obj_t pin_PB09 = PIN(1, GPIOB, 9);
|
||||
|
||||
const mcu_pin_obj_t pin_PE00 = PIN(4, GPIOE, 0);
|
||||
const mcu_pin_obj_t pin_PE01 = PIN(4, GPIOE, 1);
|
|
@ -24,13 +24,98 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411RE_PINS_H
|
||||
#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411RE_PINS_H
|
||||
#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
|
||||
#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
|
||||
|
||||
//TODO
|
||||
//Pins in datasheet order: DocID028087 Rev 7 page 50. LQFP100 only
|
||||
//pg 50
|
||||
//extern const mcu_pin_obj_t pin_PE02;
|
||||
//Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
|
||||
//pg 38
|
||||
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;
|
||||
//pg 39
|
||||
extern const mcu_pin_obj_t pin_PE06;
|
||||
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_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;
|
||||
//pg 40
|
||||
extern const mcu_pin_obj_t pin_PA00;
|
||||
extern const mcu_pin_obj_t pin_PA01;
|
||||
extern const mcu_pin_obj_t pin_PA02;
|
||||
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;
|
||||
//pg 41
|
||||
extern const mcu_pin_obj_t pin_PC04;
|
||||
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_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;
|
||||
//pg 42
|
||||
extern const mcu_pin_obj_t pin_PB10;
|
||||
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_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 43
|
||||
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_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;
|
||||
//pg 44
|
||||
extern const mcu_pin_obj_t pin_PA10;
|
||||
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_PC10;
|
||||
extern const mcu_pin_obj_t pin_PC11;
|
||||
extern const mcu_pin_obj_t pin_PC12;
|
||||
//pg 45
|
||||
extern const mcu_pin_obj_t pin_PD00;
|
||||
extern const mcu_pin_obj_t pin_PD01;
|
||||
extern const mcu_pin_obj_t pin_PD02;
|
||||
extern const mcu_pin_obj_t pin_PD03;
|
||||
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;
|
||||
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;
|
||||
//pg 46
|
||||
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_PE00;
|
||||
extern const mcu_pin_obj_t pin_PE01;
|
||||
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411RE_PINS_H
|
||||
#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
*/
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stm32f4/gpio.h"
|
||||
|
||||
void stm32f4_peripherals_gpio_init(void) {
|
||||
//Enable all GPIO for now
|
||||
|
@ -202,17 +203,26 @@ void stm32f4_peripherals_gpio_init(void) {
|
|||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
||||
//Status LED chain
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_0, GPIO_PIN_RESET); //LED 1
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_SET); //LED 2
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_SET); //LED 3
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_SET); //LED 4
|
||||
stm32f4_peripherals_status_led(0,1);
|
||||
stm32f4_peripherals_status_led(1,0);
|
||||
stm32f4_peripherals_status_led(2,0);
|
||||
stm32f4_peripherals_status_led(3,0);
|
||||
}
|
||||
|
||||
//TBD, USB power
|
||||
// GPIO_InitStruct.Pin = USB_OTGFS_PPWR_EN_Pin;
|
||||
// GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
||||
// GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
// GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
// HAL_GPIO_Init(USB_OTGFS_PPWR_EN_GPIO_Port, &GPIO_InitStruct);
|
||||
//LEDs are inverted on F411 DISCO
|
||||
void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
|
||||
switch(led)
|
||||
{
|
||||
case 0: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_0, (state ^ 1));
|
||||
break;
|
||||
case 1: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, (state ^ 1));
|
||||
break;
|
||||
case 2: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, (state ^ 1));
|
||||
break;
|
||||
case 3: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, (state ^ 1));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ const mcu_pin_obj_t pin_PE05 = PIN(4, GPIOE, 5);
|
|||
const mcu_pin_obj_t pin_PE06 = PIN(4, GPIOE, 6);
|
||||
|
||||
const mcu_pin_obj_t pin_PC13 = PIN(2, GPIOC, 13);
|
||||
const mcu_pin_obj_t pin_PC14 = PIN(2, GPIOC, 14); //OSC32_IN
|
||||
const mcu_pin_obj_t pin_PC15 = PIN(2, GPIOC, 15); //OSC32_OUT
|
||||
|
||||
const mcu_pin_obj_t pin_PF00 = PIN(5, GPIOF, 0); // 144 only
|
||||
const mcu_pin_obj_t pin_PF01 = PIN(5, GPIOF, 1); // 144 only
|
||||
|
|
|
@ -35,7 +35,9 @@ 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
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 12411ade32aeec4e49c969d8d095463b0c2fb1f0
|
||||
Subproject commit 89a356f0b44883d55c45a5d22940777a44a2b881
|
|
@ -4,6 +4,7 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* 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
|
||||
|
@ -23,7 +24,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "supervisor/flash.h"
|
||||
#include "supervisor/internal_flash.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
@ -35,11 +36,57 @@
|
|||
#include "py/runtime.h"
|
||||
#include "lib/oofatfs/ff.h"
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t base_address;
|
||||
uint32_t sector_size;
|
||||
uint32_t sector_count;
|
||||
} flash_layout_t;
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Internal Flash API
|
||||
*------------------------------------------------------------------*/
|
||||
static inline uint32_t lba2addr(uint32_t block) {
|
||||
|
||||
static const flash_layout_t flash_layout[] = {
|
||||
{ 0x08000000, 0x04000, 4 },
|
||||
{ 0x08010000, 0x10000, 1 },
|
||||
{ 0x08020000, 0x20000, 3 },
|
||||
#if defined(FLASH_SECTOR_8)
|
||||
{ 0x08080000, 0x20000, 4 },
|
||||
#endif
|
||||
#if defined(FLASH_SECTOR_12)
|
||||
{ 0x08100000, 0x04000, 4 },
|
||||
{ 0x08110000, 0x10000, 1 },
|
||||
{ 0x08120000, 0x20000, 7 },
|
||||
#endif
|
||||
};
|
||||
|
||||
static uint8_t sector_copy[0x4000] __attribute__((aligned(4)));
|
||||
|
||||
//Return the sector of a given flash address.
|
||||
uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size) {
|
||||
if (addr >= flash_layout[0].base_address) {
|
||||
uint32_t sector_index = 0;
|
||||
for (uint8_t i = 0; i < MP_ARRAY_SIZE(flash_layout); ++i) {
|
||||
for (uint8_t j = 0; j < flash_layout[i].sector_count; ++j) {
|
||||
uint32_t sector_start_next = flash_layout[i].base_address
|
||||
+ (j + 1) * flash_layout[i].sector_size;
|
||||
if (addr < sector_start_next) {
|
||||
if (start_addr != NULL) {
|
||||
*start_addr = flash_layout[i].base_address
|
||||
+ j * flash_layout[i].sector_size;
|
||||
}
|
||||
if (size != NULL) {
|
||||
*size = flash_layout[i].sector_size;
|
||||
}
|
||||
return sector_index;
|
||||
}
|
||||
++sector_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void supervisor_flash_init(void) {
|
||||
|
@ -50,21 +97,105 @@ uint32_t supervisor_flash_get_block_size(void) {
|
|||
}
|
||||
|
||||
uint32_t supervisor_flash_get_block_count(void) {
|
||||
return false;
|
||||
return INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS;
|
||||
}
|
||||
|
||||
void supervisor_flash_flush(void) {
|
||||
}
|
||||
|
||||
static int32_t convert_block_to_flash_addr(uint32_t block) {
|
||||
if (0 <= block && block < INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS) {
|
||||
// a block in partition 1
|
||||
return INTERNAL_FLASH_FILESYSTEM_START_ADDR + block * FILESYSTEM_BLOCK_SIZE;
|
||||
}
|
||||
// bad block
|
||||
return -1;
|
||||
}
|
||||
|
||||
mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
|
||||
|
||||
int32_t src = convert_block_to_flash_addr(block);
|
||||
if (src == -1) {
|
||||
// bad block number
|
||||
return false;
|
||||
}
|
||||
memcpy(dest, (uint8_t*) src, FILESYSTEM_BLOCK_SIZE*num_blocks);
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32_t num_blocks) {
|
||||
bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
|
||||
int32_t dest = convert_block_to_flash_addr(block);
|
||||
if (dest == -1) {
|
||||
// bad block number
|
||||
mp_printf(&mp_plat_print, "BAD FLASH BLOCK ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
// unlock flash
|
||||
HAL_FLASH_Unlock();
|
||||
|
||||
// set up for erase
|
||||
FLASH_EraseInitTypeDef EraseInitStruct;
|
||||
EraseInitStruct.TypeErase = TYPEERASE_SECTORS;
|
||||
EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3; // voltage range needs to be 2.7V to 3.6V
|
||||
// get the sector information
|
||||
uint32_t sector_size;
|
||||
uint32_t sector_start_addr;
|
||||
EraseInitStruct.Sector = flash_get_sector_info(dest, §or_start_addr, §or_size);
|
||||
EraseInitStruct.NbSectors = 1;
|
||||
if (sector_size>0x4000) return false;
|
||||
|
||||
// copy the sector
|
||||
memcpy(sector_copy,(void *)sector_start_addr,sector_size);
|
||||
|
||||
// // overwrite sector data
|
||||
memcpy(sector_copy+(dest-sector_start_addr),src,FILESYSTEM_BLOCK_SIZE);
|
||||
|
||||
// find end address, subtract for number of sectors
|
||||
// Shouldn't be required since blocks will always fit in a single sector, they should never overlap
|
||||
//EraseInitStruct.NbSectors = flash_get_sector_info(dest + FILESYSTEM_BLOCK_SIZE - 1, NULL, NULL) - EraseInitStruct.Sector + 1;
|
||||
|
||||
// erase the sector
|
||||
uint32_t SectorError = 0;
|
||||
if (HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError) != HAL_OK) {
|
||||
// error occurred during sector erase
|
||||
HAL_FLASH_Lock(); // lock the flash
|
||||
mp_printf(&mp_plat_print, "FLASH SECTOR ERASE ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
__HAL_FLASH_DATA_CACHE_DISABLE();
|
||||
__HAL_FLASH_INSTRUCTION_CACHE_DISABLE();
|
||||
|
||||
__HAL_FLASH_DATA_CACHE_RESET();
|
||||
__HAL_FLASH_INSTRUCTION_CACHE_RESET();
|
||||
|
||||
__HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
|
||||
__HAL_FLASH_DATA_CACHE_ENABLE();
|
||||
|
||||
// reprogram the sector
|
||||
for (uint32_t i = 0; i < sector_size; i++) {
|
||||
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, sector_start_addr, (uint64_t)sector_copy[i]) != HAL_OK) {
|
||||
// error occurred during flash write
|
||||
HAL_FLASH_Lock(); // lock the flash
|
||||
mp_printf(&mp_plat_print, "FLASH WRITE ERROR");
|
||||
return false;
|
||||
}
|
||||
sector_start_addr += 1;
|
||||
}
|
||||
|
||||
// lock the flash
|
||||
HAL_FLASH_Lock();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) {
|
||||
|
||||
for (size_t i = 0; i < num_blocks; i++) {
|
||||
if (!supervisor_flash_write_block(src + i * FILESYSTEM_BLOCK_SIZE, block_num + i)) {
|
||||
return 1; // error
|
||||
}
|
||||
}
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* 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
|
||||
|
@ -31,6 +32,21 @@
|
|||
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
#ifdef STM32F411xE
|
||||
#define STM32_FLASH_SIZE 0x80000 //512KiB
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //112KiB
|
||||
#endif
|
||||
|
||||
#ifdef STM32F412Zx
|
||||
#define STM32_FLASH_SIZE 0x100000 //1MB
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //112KiB
|
||||
#endif
|
||||
|
||||
#define STM32_FLASH_OFFSET 0x8000000 //All STM32 chips map to this flash location
|
||||
|
||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
|
||||
#define INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS (INTERNAL_FLASH_FILESYSTEM_SIZE / FILESYSTEM_BLOCK_SIZE)
|
||||
|
||||
#define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms
|
||||
#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2)
|
||||
|
||||
|
|
|
@ -35,12 +35,6 @@
|
|||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
//#include "shared-bindings/rtc/__init__.h"
|
||||
|
||||
static void power_warning_handler(void) {
|
||||
reset_into_safe_mode(BROWNOUT);
|
||||
}
|
||||
|
||||
safe_mode_t port_init(void) {
|
||||
HAL_Init();
|
||||
|
||||
|
@ -75,6 +69,6 @@ uint32_t port_get_saved_word(void) {
|
|||
return _ebss;
|
||||
}
|
||||
|
||||
// void HardFault_Handler(void) {
|
||||
|
||||
// }
|
||||
void HardFault_Handler(void) {
|
||||
while(1) {}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017, 2018 Scott Shawcroft for Adafruit Industries
|
||||
* 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
|
||||
|
@ -28,12 +29,13 @@
|
|||
#include <string.h>
|
||||
#include "supervisor/serial.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stm32f4/gpio.h"
|
||||
|
||||
UART_HandleTypeDef huart2;
|
||||
|
||||
void serial_init(void) {
|
||||
huart2.Instance = USART2;
|
||||
huart2.Init.BaudRate = 9600;
|
||||
huart2.Init.BaudRate = 115200;
|
||||
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
huart2.Init.Parity = UART_PARITY_NONE;
|
||||
|
@ -42,10 +44,8 @@ void serial_init(void) {
|
|||
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
if (HAL_UART_Init(&huart2) == HAL_OK)
|
||||
{
|
||||
//HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_RESET);
|
||||
stm32f4_peripherals_status_led(1,1);
|
||||
}
|
||||
//HAL_UART_Transmit(&huart2, (uint8_t*)"Serial On", 9, 5000);
|
||||
//HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
bool serial_connected(void) {
|
||||
|
@ -54,7 +54,7 @@ bool serial_connected(void) {
|
|||
|
||||
char serial_read(void) {
|
||||
uint8_t data;
|
||||
HAL_UART_Receive(&huart2, &data, 1,5000);
|
||||
HAL_UART_Receive(&huart2, &data, 1,500);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 hathach for Adafruit Industries
|
||||
* 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
|
||||
|
@ -31,16 +32,6 @@
|
|||
#include "lib/mp-readline/readline.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
#define USB_OTGFS_VBUS_Pin GPIO_PIN_9
|
||||
#define USB_OTGFS_VBUS_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_ID_Pin GPIO_PIN_10
|
||||
#define USB_OTGFS_ID_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_DM_Pin GPIO_PIN_11
|
||||
#define USB_OTGFS_DM_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_DP_Pin GPIO_PIN_12
|
||||
#define USB_OTGFS_DP_GPIO_Port GPIOA
|
||||
|
||||
|
||||
void init_usb_hardware(void) {
|
||||
// HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_RESET); //LED 2
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
@ -49,32 +40,36 @@ void init_usb_hardware(void) {
|
|||
PA11 ------> USB_OTG_FS_DM
|
||||
PA12 ------> USB_OTG_FS_DP
|
||||
*/
|
||||
GPIO_InitStruct.Pin = USB_OTGFS_VBUS_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(USB_OTGFS_VBUS_GPIO_Port, &GPIO_InitStruct);
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
|
||||
GPIO_InitStruct.Pin = USB_OTGFS_DM_Pin|USB_OTGFS_DP_Pin;
|
||||
/* Configure DM DP Pins */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
//TinyUSB suggestion
|
||||
GPIO_InitStruct.Pin = USB_OTGFS_ID_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
/* Configure VBUS Pin */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* This for ID line debug */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
||||
|
||||
/* Peripheral interrupt init */
|
||||
HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
|
||||
// /* Peripheral interrupt init */
|
||||
// HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0);
|
||||
// HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
|
||||
|
||||
//HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET); //LED 3
|
||||
}
|
||||
|
|
|
@ -114,6 +114,9 @@ endif
|
|||
ifeq ($(CIRCUITPY_AUDIOCORE),1)
|
||||
SRC_PATTERNS += audiocore/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_AUDIOMIXER),1)
|
||||
SRC_PATTERNS += audiomixer/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_BITBANGIO),1)
|
||||
SRC_PATTERNS += bitbangio/%
|
||||
endif
|
||||
|
@ -312,9 +315,11 @@ SRC_SHARED_MODULE_ALL = \
|
|||
audiopwmio/__init__.c \
|
||||
audioio/__init__.c \
|
||||
audiocore/__init__.c \
|
||||
audiocore/Mixer.c \
|
||||
audiocore/RawSample.c \
|
||||
audiocore/WaveFile.c \
|
||||
audiomixer/__init__.c \
|
||||
audiomixer/Mixer.c \
|
||||
audiomixer/MixerVoice.c \
|
||||
bitbangio/I2C.c \
|
||||
bitbangio/OneWire.c \
|
||||
bitbangio/SPI.c \
|
||||
|
|
|
@ -244,6 +244,13 @@ extern const struct _mp_obj_module_t audioio_module;
|
|||
#define AUDIOIO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
#define AUDIOMIXER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiomixer), (mp_obj_t)&audiomixer_module },
|
||||
extern const struct _mp_obj_module_t audiomixer_module;
|
||||
#else
|
||||
#define AUDIOMIXER_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_AUDIOPWMIO
|
||||
#define AUDIOPWMIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiopwmio), (mp_obj_t)&audiopwmio_module },
|
||||
extern const struct _mp_obj_module_t audiopwmio_module;
|
||||
|
@ -573,6 +580,7 @@ extern const struct _mp_obj_module_t ustack_module;
|
|||
AUDIOBUSIO_MODULE \
|
||||
AUDIOCORE_MODULE \
|
||||
AUDIOIO_MODULE \
|
||||
AUDIOMIXER_MODULE \
|
||||
AUDIOPWMIO_MODULE \
|
||||
BITBANGIO_MODULE \
|
||||
BLEIO_MODULE \
|
||||
|
|
|
@ -94,6 +94,11 @@ endif
|
|||
endif
|
||||
CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE)
|
||||
|
||||
ifndef CIRCUITPY_AUDIOMIXER
|
||||
CIRCUITPY_AUDIOMIXER = $(CIRCUITPY_AUDIOIO)
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_AUDIOMIXER=$(CIRCUITPY_AUDIOMIXER)
|
||||
|
||||
ifndef CIRCUITPY_BITBANGIO
|
||||
CIRCUITPY_BITBANGIO = $(CIRCUITPY_FULL_BUILD)
|
||||
endif
|
||||
|
|
|
@ -96,21 +96,8 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
|
|||
scale = mp_obj_get_int(args[7]);
|
||||
}
|
||||
|
||||
// TODO: Everything below should be in shared-module because it's not argument parsing.
|
||||
while (!displayio_display_core_begin_transaction(&display->core)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
displayio_area_t area;
|
||||
area.x1 = x0;
|
||||
area.y1 = y0;
|
||||
area.x2 = x1;
|
||||
area.y2 = y1;
|
||||
displayio_display_core_set_region_to_update(&display->core, display->set_column_command, display->set_row_command, NO_COMMAND, NO_COMMAND, display->data_as_commands, false, &area);
|
||||
|
||||
display->core.send(display->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &display->write_ram_command, 1);
|
||||
render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size,
|
||||
display, scale);
|
||||
displayio_display_core_end_transaction(&display->core);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4,
|
|||
//| Plays the sample once when loop=False and continuously when loop=True.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiocore.Mixer`.
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiomixer.Mixer`.
|
||||
//|
|
||||
//| The sample itself should consist of 8 bit or 16 bit samples.
|
||||
//|
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/audiocore/__init__.h"
|
||||
#include "shared-bindings/audiocore/Mixer.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
#include "shared-bindings/audiocore/WaveFile.h"
|
||||
//#include "shared-bindings/audiomixer/Mixer.h"
|
||||
|
||||
//| :mod:`audiocore` --- Support for audio samples and mixer
|
||||
//| ========================================================
|
||||
|
@ -49,14 +49,12 @@
|
|||
//| .. toctree::
|
||||
//| :maxdepth: 3
|
||||
//|
|
||||
//| Mixer
|
||||
//| RawSample
|
||||
//| WaveFile
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Mixer), MP_ROM_PTR(&audioio_mixer_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_WaveFile), MP_ROM_PTR(&audioio_wavefile_type) },
|
||||
};
|
||||
|
|
|
@ -163,7 +163,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4,
|
|||
//| Plays the sample once when loop=False and continuously when loop=True.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiocore.Mixer`.
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiomixer.Mixer`.
|
||||
//|
|
||||
//| The sample itself should consist of 16 bit samples. Microcontrollers with a lower output
|
||||
//| resolution will use the highest order bits to output. For example, the SAMD21 has a 10 bit
|
||||
|
|
|
@ -33,11 +33,14 @@
|
|||
#include "shared-bindings/audioio/__init__.h"
|
||||
#include "shared-bindings/audioio/AudioOut.h"
|
||||
|
||||
#ifdef CIRCUITPY_AUDIOIO_COMPAT
|
||||
#include "shared-bindings/audiocore/Mixer.h"
|
||||
#if CIRCUITPY_AUDIOIO_COMPAT
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
#include "shared-bindings/audiocore/WaveFile.h"
|
||||
#endif
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#endif
|
||||
|
||||
//| :mod:`audioio` --- Support for audio input and output
|
||||
//| ======================================================
|
||||
|
@ -60,8 +63,8 @@
|
|||
//| call :py:meth:`!deinit` or use a context manager. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info.
|
||||
//|
|
||||
//| Since CircuitPython 5, `Mixer`, `RawSample` and `WaveFile` are moved
|
||||
//| to :mod:`audiocore`.
|
||||
//| Since CircuitPython 5, `RawSample` and `WaveFile` are moved
|
||||
//| to :mod:`audiocore`, and `Mixer` is moved to :mod:`audiomixer`.
|
||||
//|
|
||||
//| For compatibility with CircuitPython 4.x, some builds allow the items in
|
||||
//| `audiocore` to be imported from `audioio`. This will be removed for all
|
||||
|
@ -71,8 +74,10 @@
|
|||
STATIC const mp_rom_map_elem_t audioio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audioio) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AudioOut), MP_ROM_PTR(&audioio_audioout_type) },
|
||||
#ifdef CIRCUITPY_AUDIOIO_COMPAT
|
||||
{ MP_ROM_QSTR(MP_QSTR_Mixer), MP_ROM_PTR(&audioio_mixer_type) },
|
||||
#if CIRCUITPY_AUDIOIO_COMPAT
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
{ MP_ROM_QSTR(MP_QSTR_Mixer), MP_ROM_PTR(&audiomixer_mixer_type) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_WaveFile), MP_ROM_PTR(&audioio_wavefile_type) },
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "shared-bindings/audiocore/Mixer.h"
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#include "shared-bindings/audiomixer/MixerVoice.h"
|
||||
#include "shared-module/audiomixer/MixerVoice.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -36,45 +38,51 @@
|
|||
#include "shared-bindings/util.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
//| .. currentmodule:: audiocore
|
||||
//| .. currentmodule:: audiomixer
|
||||
//|
|
||||
//| :class:`Mixer` -- Mixes one or more audio samples together
|
||||
//| ===========================================================
|
||||
//|
|
||||
//| Mixer mixes multiple samples into one sample.
|
||||
//|
|
||||
//| .. class:: Mixer(channel_count=2, buffer_size=1024)
|
||||
//| .. class:: Mixer(voice_count=2, buffer_size=1024, channel_count=2, bits_per_sample=16, samples_signed=True, sample_rate=8000)
|
||||
//|
|
||||
//| 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.
|
||||
//|
|
||||
//| :param int channel_count: The maximum number of samples to mix at once
|
||||
//| :param int voice_count: The maximum number of voices to mix
|
||||
//| :param int buffer_size: The total size in bytes of the buffers to mix into
|
||||
//| :param int channel_count: The number of channels the source samples contain. 1 = mono; 2 = stereo.
|
||||
//| :param int bits_per_sample: The bits per sample of the samples being played
|
||||
//| :param bool samples_signed: Samples are signed (True) or unsigned (False)
|
||||
//| :param int sample_rate: The sample rate to be used for all samples
|
||||
//|
|
||||
//| Playing a wave file from flash::
|
||||
//|
|
||||
//| import board
|
||||
//| import audioio
|
||||
//| import audiocore
|
||||
//| import audiomixer
|
||||
//| import digitalio
|
||||
//|
|
||||
//| # Required for CircuitPlayground Express
|
||||
//| speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
|
||||
//| speaker_enable.switch_to_output(value=True)
|
||||
//|
|
||||
//| a = audioio.AudioOut(board.A0)
|
||||
//| music = audiocore.WaveFile(open("cplay-5.1-16bit-16khz.wav", "rb"))
|
||||
//| drum = audiocore.WaveFile(open("drum.wav", "rb"))
|
||||
//| mixer = audiocore.Mixer(voice_count=2, sample_rate=16000, channel_count=1, bits_per_sample=16, samples_signed=True)
|
||||
//| a = audioio.AudioOut(board.A0)
|
||||
//| mixer = audiomixer.Mixer(voice_count=2, sample_rate=16000, channel_count=1,
|
||||
//| bits_per_sample=16, samples_signed=True)
|
||||
//|
|
||||
//| print("playing")
|
||||
//| # Have AudioOut play our Mixer source
|
||||
//| a.play(mixer)
|
||||
//| mixer.play(music, voice=0)
|
||||
//| # Play the first sample voice
|
||||
//| mixer.voice[0].play(music)
|
||||
//| while mixer.playing:
|
||||
//| mixer.play(drum, voice=1)
|
||||
//| # Play the second sample voice
|
||||
//| mixer.voice[1].play(drum)
|
||||
//| time.sleep(1)
|
||||
//| print("stopped")
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_voice_count, ARG_buffer_size, ARG_channel_count, ARG_bits_per_sample, ARG_samples_signed, ARG_sample_rate };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_voice_count, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 2} },
|
||||
|
@ -104,9 +112,15 @@ STATIC mp_obj_t audioio_mixer_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||
if (bits_per_sample != 8 && bits_per_sample != 16) {
|
||||
mp_raise_ValueError(translate("bits_per_sample must be 8 or 16"));
|
||||
}
|
||||
audioio_mixer_obj_t *self = m_new_obj_var(audioio_mixer_obj_t, audioio_mixer_voice_t, voice_count);
|
||||
self->base.type = &audioio_mixer_type;
|
||||
common_hal_audioio_mixer_construct(self, voice_count, args[ARG_buffer_size].u_int, bits_per_sample, args[ARG_samples_signed].u_bool, channel_count, sample_rate);
|
||||
audiomixer_mixer_obj_t *self = m_new_obj_var(audiomixer_mixer_obj_t, mp_obj_t, voice_count);
|
||||
self->base.type = &audiomixer_mixer_type;
|
||||
common_hal_audiomixer_mixer_construct(self, voice_count, args[ARG_buffer_size].u_int, bits_per_sample, args[ARG_samples_signed].u_bool, channel_count, sample_rate);
|
||||
|
||||
for(int v=0; v<voice_count; v++){
|
||||
self->voice[v] = audiomixer_mixervoice_type.make_new(&audiomixer_mixervoice_type, 0, 0, NULL);
|
||||
common_hal_audiomixer_mixervoice_set_parent(self->voice[v], self);
|
||||
}
|
||||
self->voice_tuple = mp_obj_new_tuple(self->voice_count, self->voice);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
@ -115,15 +129,15 @@ STATIC mp_obj_t audioio_mixer_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||
//|
|
||||
//| Deinitialises the Mixer and releases any hardware resources for reuse.
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_deinit(mp_obj_t self_in) {
|
||||
audioio_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_audioio_mixer_deinit(self);
|
||||
STATIC mp_obj_t audiomixer_mixer_deinit(mp_obj_t self_in) {
|
||||
audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_audiomixer_mixer_deinit(self);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audioio_mixer_deinit_obj, audioio_mixer_deinit);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixer_deinit_obj, audiomixer_mixer_deinit);
|
||||
|
||||
STATIC void check_for_deinit(audioio_mixer_obj_t *self) {
|
||||
if (common_hal_audioio_mixer_deinited(self)) {
|
||||
STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) {
|
||||
if (common_hal_audiomixer_mixer_deinited(self)) {
|
||||
raise_deinited_error();
|
||||
}
|
||||
}
|
||||
|
@ -139,75 +153,27 @@ STATIC void check_for_deinit(audioio_mixer_obj_t *self) {
|
|||
//| Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info.
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_audioio_mixer_deinit(args[0]);
|
||||
common_hal_audiomixer_mixer_deinit(args[0]);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_mixer___exit___obj, 4, 4, audioio_mixer_obj___exit__);
|
||||
|
||||
|
||||
//| .. method:: play(sample, *, voice=0, loop=False)
|
||||
//|
|
||||
//| Plays the sample once when loop=False and continuously when loop=True.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiocore.Mixer`.
|
||||
//|
|
||||
//| The sample must match the Mixer's encoding settings given in the constructor.
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_sample, ARG_voice, ARG_loop };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_sample, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_voice, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
|
||||
{ MP_QSTR_loop, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
||||
};
|
||||
audioio_mixer_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
check_for_deinit(self);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_obj_t sample = args[ARG_sample].u_obj;
|
||||
common_hal_audioio_mixer_play(self, sample, args[ARG_voice].u_int, args[ARG_loop].u_bool);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_mixer_play_obj, 1, audioio_mixer_obj_play);
|
||||
|
||||
//| .. method:: stop_voice(voice=0)
|
||||
//|
|
||||
//| Stops playback of the sample on the given voice.
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj_stop_voice(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_voice };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_voice, MP_ARG_INT, {.u_int = 0} },
|
||||
};
|
||||
audioio_mixer_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
check_for_deinit(self);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
common_hal_audioio_mixer_stop_voice(self, args[ARG_voice].u_int);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_mixer_stop_voice_obj, 1, audioio_mixer_obj_stop_voice);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__);
|
||||
|
||||
//| .. attribute:: playing
|
||||
//|
|
||||
//| True when any voice is being output. (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj_get_playing(mp_obj_t self_in) {
|
||||
audioio_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) {
|
||||
audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_audioio_mixer_get_playing(self));
|
||||
return mp_obj_new_bool(common_hal_audiomixer_mixer_get_playing(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audioio_mixer_get_playing_obj, audioio_mixer_obj_get_playing);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixer_get_playing_obj, audiomixer_mixer_obj_get_playing);
|
||||
|
||||
const mp_obj_property_t audioio_mixer_playing_obj = {
|
||||
const mp_obj_property_t audiomixer_mixer_playing_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&audioio_mixer_get_playing_obj,
|
||||
.proxy = {(mp_obj_t)&audiomixer_mixer_get_playing_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
@ -216,38 +182,118 @@ const mp_obj_property_t audioio_mixer_playing_obj = {
|
|||
//|
|
||||
//| 32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj_get_sample_rate(mp_obj_t self_in) {
|
||||
audioio_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) {
|
||||
audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_audioio_mixer_get_sample_rate(self));
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_audiomixer_mixer_get_sample_rate(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audioio_mixer_get_sample_rate_obj, audioio_mixer_obj_get_sample_rate);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixer_get_sample_rate_obj, audiomixer_mixer_obj_get_sample_rate);
|
||||
|
||||
|
||||
const mp_obj_property_t audioio_mixer_sample_rate_obj = {
|
||||
const mp_obj_property_t audiomixer_mixer_sample_rate_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&audioio_mixer_get_sample_rate_obj,
|
||||
.proxy = {(mp_obj_t)&audiomixer_mixer_get_sample_rate_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t audioio_mixer_locals_dict_table[] = {
|
||||
//| .. attribute:: voice
|
||||
//|
|
||||
//| A tuple of the mixer's `audiomixer.MixerVoice` object(s).
|
||||
//|
|
||||
//| .. code-block:: python
|
||||
//|
|
||||
//| >>> mixer.voice
|
||||
//| (<MixerVoice>,)
|
||||
STATIC mp_obj_t audiomixer_mixer_obj_get_voice(mp_obj_t self_in) {
|
||||
audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return self->voice_tuple;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixer_get_voice_obj, audiomixer_mixer_obj_get_voice);
|
||||
|
||||
const mp_obj_property_t audiomixer_mixer_voice_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&audiomixer_mixer_get_voice_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. method:: play(sample, *, voice=0, loop=False)
|
||||
//|
|
||||
//| Plays the sample once when loop=False and continuously when loop=True.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiomixer.Mixer`.
|
||||
//|
|
||||
//| The sample must match the Mixer's encoding settings given in the constructor.
|
||||
//|
|
||||
STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_sample, ARG_voice, ARG_loop };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_sample, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_voice, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
|
||||
{ MP_QSTR_loop, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
||||
};
|
||||
audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
check_for_deinit(self);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
uint8_t v = args[ARG_voice].u_int;
|
||||
if (v > (self->voice_count - 1)) {
|
||||
mp_raise_ValueError(translate("Invalid voice"));
|
||||
}
|
||||
audiomixer_mixervoice_obj_t *voice = MP_OBJ_TO_PTR(self->voice[v]);
|
||||
mp_obj_t sample = args[ARG_sample].u_obj;
|
||||
common_hal_audiomixer_mixervoice_play(voice, sample, args[ARG_loop].u_bool);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_play);
|
||||
|
||||
//| .. method:: stop_voice(voice=0)
|
||||
//|
|
||||
//| Stops playback of the sample on the given voice.
|
||||
//|
|
||||
STATIC mp_obj_t audiomixer_mixer_obj_stop_voice(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_voice };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_voice, MP_ARG_INT, {.u_int = 0} },
|
||||
};
|
||||
audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
check_for_deinit(self);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
uint8_t v = args[ARG_voice].u_int;
|
||||
if (v > (self->voice_count - 1)) {
|
||||
mp_raise_ValueError(translate("Invalid voice"));
|
||||
}
|
||||
audiomixer_mixervoice_obj_t *voice = MP_OBJ_TO_PTR(self->voice[v]);
|
||||
common_hal_audiomixer_mixervoice_stop(voice);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_stop_voice_obj, 1, audiomixer_mixer_obj_stop_voice);
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t audiomixer_mixer_locals_dict_table[] = {
|
||||
// Methods
|
||||
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audioio_mixer_deinit_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiomixer_mixer_deinit_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audioio_mixer___exit___obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audioio_mixer_play_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop_voice), MP_ROM_PTR(&audioio_mixer_stop_voice_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiomixer_mixer___exit___obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiomixer_mixer_play_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop_voice), MP_ROM_PTR(&audiomixer_mixer_stop_voice_obj) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audioio_mixer_playing_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&audioio_mixer_sample_rate_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audiomixer_mixer_playing_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&audiomixer_mixer_sample_rate_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_voice), MP_ROM_PTR(&audiomixer_mixer_voice_obj) }
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(audioio_mixer_locals_dict, audioio_mixer_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(audiomixer_mixer_locals_dict, audiomixer_mixer_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t audioio_mixer_type = {
|
||||
const mp_obj_type_t audiomixer_mixer_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Mixer,
|
||||
.make_new = audioio_mixer_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&audioio_mixer_locals_dict,
|
||||
.make_new = audiomixer_mixer_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&audiomixer_mixer_locals_dict,
|
||||
};
|
|
@ -24,29 +24,28 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOIO_MIXER_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOIO_MIXER_H
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER_MIXER_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER_MIXER_H
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "shared-module/audiocore/Mixer.h"
|
||||
#include "shared-module/audiomixer/Mixer.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
|
||||
extern const mp_obj_type_t audioio_mixer_type;
|
||||
extern const mp_obj_type_t audiomixer_mixer_type;
|
||||
extern const mp_obj_type_t audiomixer_mixervoice_type;
|
||||
|
||||
void common_hal_audioio_mixer_construct(audioio_mixer_obj_t* self,
|
||||
uint8_t voice_count,
|
||||
uint32_t buffer_size,
|
||||
uint8_t bits_per_sample,
|
||||
bool samples_signed,
|
||||
uint8_t channel_count,
|
||||
uint32_t sample_rate);
|
||||
void common_hal_audiomixer_mixer_construct(audiomixer_mixer_obj_t* self,
|
||||
uint8_t voice_count,
|
||||
uint32_t buffer_size,
|
||||
uint8_t bits_per_sample,
|
||||
bool samples_signed,
|
||||
uint8_t channel_count,
|
||||
uint32_t sample_rate);
|
||||
|
||||
void common_hal_audioio_mixer_deinit(audioio_mixer_obj_t* self);
|
||||
bool common_hal_audioio_mixer_deinited(audioio_mixer_obj_t* self);
|
||||
void common_hal_audioio_mixer_play(audioio_mixer_obj_t* self, mp_obj_t sample, uint8_t voice, bool loop);
|
||||
void common_hal_audioio_mixer_stop_voice(audioio_mixer_obj_t* self, uint8_t voice);
|
||||
void common_hal_audiomixer_mixer_deinit(audiomixer_mixer_obj_t* self);
|
||||
bool common_hal_audiomixer_mixer_deinited(audiomixer_mixer_obj_t* self);
|
||||
|
||||
bool common_hal_audioio_mixer_get_playing(audioio_mixer_obj_t* self);
|
||||
uint32_t common_hal_audioio_mixer_get_sample_rate(audioio_mixer_obj_t* self);
|
||||
bool common_hal_audiomixer_mixer_get_playing(audiomixer_mixer_obj_t* self);
|
||||
uint32_t common_hal_audiomixer_mixer_get_sample_rate(audiomixer_mixer_obj_t* self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOIO_MIXER_H
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER_MIXER_H
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 DeanM for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#include "shared-bindings/audiomixer/MixerVoice.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "lib/utils/context_manager_helpers.h"
|
||||
#include "py/binary.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
#include "shared-bindings/util.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
//| .. currentmodule:: audiomixer
|
||||
//|
|
||||
//| :class:`MixerVoice` -- Voice objects used with Mixer
|
||||
//| =====================================================
|
||||
//|
|
||||
//| Used to access and control samples with `audiomixer.Mixer`.
|
||||
//|
|
||||
//| .. class:: MixerVoice()
|
||||
//|
|
||||
//| MixerVoice instance object(s) created by `audiomixer.Mixer`.
|
||||
//|
|
||||
// TODO: support mono or stereo voices
|
||||
STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
audiomixer_mixervoice_obj_t *self = m_new_obj(audiomixer_mixervoice_obj_t);
|
||||
self->base.type = &audiomixer_mixervoice_type;
|
||||
|
||||
common_hal_audiomixer_mixervoice_construct(self);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
//| .. method:: play(sample, *, loop=False)
|
||||
//|
|
||||
//| Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiomixer.Mixer` or `audiocore.RawSample`.
|
||||
//|
|
||||
//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.
|
||||
//|
|
||||
STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_sample, ARG_loop };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_sample, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_loop, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
||||
};
|
||||
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_obj_t sample = args[ARG_sample].u_obj;
|
||||
common_hal_audiomixer_mixervoice_play(self, sample, args[ARG_loop].u_bool);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play);
|
||||
|
||||
//| .. method:: stop()
|
||||
//|
|
||||
//| Stops playback of the sample on this voice.
|
||||
//|
|
||||
STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_voice };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_voice, MP_ARG_INT, {.u_int = 0} },
|
||||
};
|
||||
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
common_hal_audiomixer_mixervoice_stop(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
|
||||
|
||||
//| .. attribute:: level()
|
||||
//|
|
||||
//| 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) {
|
||||
return mp_obj_new_float(common_hal_audiomixer_mixervoice_get_level(self_in));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixervoice_get_level_obj, audiomixer_mixervoice_obj_get_level);
|
||||
|
||||
STATIC mp_obj_t audiomixer_mixervoice_obj_set_level(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_level };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_level, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||
};
|
||||
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
float level = mp_obj_get_float(args[ARG_level].u_obj);
|
||||
|
||||
if (level > 1 || level < 0) {
|
||||
mp_raise_ValueError(translate("level must be between 0 and 1"));
|
||||
}
|
||||
|
||||
common_hal_audiomixer_mixervoice_set_level(self, level);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_set_level_obj, 1, audiomixer_mixervoice_obj_set_level);
|
||||
|
||||
const mp_obj_property_t audiomixer_mixervoice_level_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&audiomixer_mixervoice_get_level_obj,
|
||||
(mp_obj_t)&audiomixer_mixervoice_set_level_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: playing
|
||||
//|
|
||||
//| True when this voice is being output. (read-only)
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t audiomixer_mixervoice_obj_get_playing(mp_obj_t self_in) {
|
||||
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(common_hal_audiomixer_mixervoice_get_playing(self));
|
||||
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixervoice_get_playing_obj, audiomixer_mixervoice_obj_get_playing);
|
||||
|
||||
const mp_obj_property_t audiomixer_mixervoice_playing_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&audiomixer_mixervoice_get_playing_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t audiomixer_mixervoice_locals_dict_table[] = {
|
||||
// Methods
|
||||
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiomixer_mixervoice_play_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audiomixer_mixervoice_stop_obj) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audiomixer_mixervoice_playing_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_level), MP_ROM_PTR(&audiomixer_mixervoice_level_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(audiomixer_mixervoice_locals_dict, audiomixer_mixervoice_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t audiomixer_mixervoice_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_MixerVoice,
|
||||
.make_new = audiomixer_mixervoice_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&audiomixer_mixervoice_locals_dict,
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 DeanM 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 SHARED_BINDINGS_AUDIOMIXER_MIXERVOICE_H_
|
||||
#define SHARED_BINDINGS_AUDIOMIXER_MIXERVOICE_H_
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
|
||||
#include "shared-module/audiomixer/MixerVoice.h"
|
||||
#include "shared-module/audiomixer/Mixer.h"
|
||||
|
||||
extern const mp_obj_type_t audiomixer_mixer_type;
|
||||
extern const mp_obj_type_t audiomixer_mixervoice_type;
|
||||
|
||||
void common_hal_audiomixer_mixervoice_construct(audiomixer_mixervoice_obj_t *self);
|
||||
void common_hal_audiomixer_mixervoice_set_parent(audiomixer_mixervoice_obj_t* self, audiomixer_mixer_obj_t *parent);
|
||||
void common_hal_audiomixer_mixervoice_play(audiomixer_mixervoice_obj_t* self, mp_obj_t sample, bool loop);
|
||||
void common_hal_audiomixer_mixervoice_stop(audiomixer_mixervoice_obj_t* self);
|
||||
float common_hal_audiomixer_mixervoice_get_level(audiomixer_mixervoice_obj_t* self);
|
||||
void common_hal_audiomixer_mixervoice_set_level(audiomixer_mixervoice_obj_t* self, float gain);
|
||||
|
||||
bool common_hal_audiomixer_mixervoice_get_playing(audiomixer_mixervoice_obj_t* self);
|
||||
|
||||
#endif /* SHARED_BINDINGS_AUDIOMIXER_MIXERVOICE_H_ */
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Michael Schroeder
|
||||
*
|
||||
* 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/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
|
||||
//| :mod:`audiomixer` --- Support for audio mixer
|
||||
//| ========================================================
|
||||
//|
|
||||
//| .. module:: audiomixer
|
||||
//| :synopsis: Support for audio mixer
|
||||
//|
|
||||
//| The `audiomixer` module contains core classes for mixing audio sources
|
||||
//|
|
||||
//| Libraries
|
||||
//|
|
||||
//| .. toctree::
|
||||
//| :maxdepth: 3
|
||||
//|
|
||||
//| Mixer
|
||||
//| MixerVoice
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t audiomixer_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiomixer) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Mixer), MP_ROM_PTR(&audiomixer_mixer_type) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(audiomixer_module_globals, audiomixer_module_globals_table);
|
||||
|
||||
const mp_obj_module_t audiomixer_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t*)&audiomixer_module_globals,
|
||||
};
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Nick Moore for Adafruit Industries
|
||||
* Copyright (c) 2019 Michael Schroeder
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,4 +24,11 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// No nvm module functions.
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER___INIT___H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER___INIT___H
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
// Nothing now.
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER___INIT___H
|
|
@ -166,7 +166,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj,
|
|||
//| Plays the sample once when loop=False and continuously when loop=True.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiocore.Mixer`.
|
||||
//| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, or `audiomixer.Mixer`.
|
||||
//|
|
||||
//| The sample itself should consist of 16 bit samples. Microcontrollers with a lower output
|
||||
//| resolution will use the highest order bits to output. For example, the SAMD21 has a 10 bit
|
||||
|
|
|
@ -90,6 +90,32 @@ displayio_group_t* native_group(mp_obj_t group_obj) {
|
|||
return MP_OBJ_TO_PTR(native_group);
|
||||
}
|
||||
|
||||
//| .. attribute:: hidden
|
||||
//|
|
||||
//| True when the Group and all of it's layers are not visible. When False, the Group's layers
|
||||
//| are visible if they haven't been hidden.
|
||||
//|
|
||||
STATIC mp_obj_t displayio_group_obj_get_hidden(mp_obj_t self_in) {
|
||||
displayio_group_t *self = native_group(self_in);
|
||||
return mp_obj_new_bool(common_hal_displayio_group_get_hidden(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_group_get_hidden_obj, displayio_group_obj_get_hidden);
|
||||
|
||||
STATIC mp_obj_t displayio_group_obj_set_hidden(mp_obj_t self_in, mp_obj_t hidden_obj) {
|
||||
displayio_group_t *self = native_group(self_in);
|
||||
|
||||
common_hal_displayio_group_set_hidden(self, mp_obj_is_true(hidden_obj));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_set_hidden_obj, displayio_group_obj_set_hidden);
|
||||
|
||||
const mp_obj_property_t displayio_group_hidden_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&displayio_group_get_hidden_obj,
|
||||
(mp_obj_t)&displayio_group_set_hidden_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: scale
|
||||
//|
|
||||
//| Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
|
||||
|
@ -305,6 +331,7 @@ STATIC mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t valu
|
|||
}
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_group_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_hidden), MP_ROM_PTR(&displayio_group_hidden_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_scale), MP_ROM_PTR(&displayio_group_scale_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&displayio_group_x_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&displayio_group_y_obj) },
|
||||
|
|
|
@ -36,6 +36,8 @@ displayio_group_t* native_group(mp_obj_t group_obj);
|
|||
void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size, uint32_t scale, mp_int_t x, mp_int_t y);
|
||||
uint32_t common_hal_displayio_group_get_scale(displayio_group_t* self);
|
||||
void common_hal_displayio_group_set_scale(displayio_group_t* self, uint32_t scale);
|
||||
bool common_hal_displayio_group_get_hidden(displayio_group_t* self);
|
||||
void common_hal_displayio_group_set_hidden(displayio_group_t* self, bool hidden);
|
||||
mp_int_t common_hal_displayio_group_get_x(displayio_group_t* self);
|
||||
void common_hal_displayio_group_set_x(displayio_group_t* self, mp_int_t x);
|
||||
mp_int_t common_hal_displayio_group_get_y(displayio_group_t* self);
|
||||
|
|
|
@ -144,6 +144,30 @@ static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) {
|
|||
mp_obj_assert_native_inited(native_tilegrid);
|
||||
return MP_OBJ_TO_PTR(native_tilegrid);
|
||||
}
|
||||
//| .. attribute:: hidden
|
||||
//|
|
||||
//| True when the TileGrid is hidden. This may be False even when a part of a hidden Group.
|
||||
//|
|
||||
STATIC mp_obj_t displayio_tilegrid_obj_get_hidden(mp_obj_t self_in) {
|
||||
displayio_tilegrid_t *self = native_tilegrid(self_in);
|
||||
return mp_obj_new_bool(common_hal_displayio_tilegrid_get_hidden(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_hidden_obj, displayio_tilegrid_obj_get_hidden);
|
||||
|
||||
STATIC mp_obj_t displayio_tilegrid_obj_set_hidden(mp_obj_t self_in, mp_obj_t hidden_obj) {
|
||||
displayio_tilegrid_t *self = native_tilegrid(self_in);
|
||||
|
||||
common_hal_displayio_tilegrid_set_hidden(self, mp_obj_is_true(hidden_obj));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_set_hidden_obj, displayio_tilegrid_obj_set_hidden);
|
||||
|
||||
const mp_obj_property_t displayio_tilegrid_hidden_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&displayio_tilegrid_get_hidden_obj,
|
||||
(mp_obj_t)&displayio_tilegrid_set_hidden_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: x
|
||||
//|
|
||||
|
@ -368,6 +392,7 @@ STATIC mp_obj_t tilegrid_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t v
|
|||
|
||||
STATIC const mp_rom_map_elem_t displayio_tilegrid_locals_dict_table[] = {
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_hidden), MP_ROM_PTR(&displayio_tilegrid_hidden_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&displayio_tilegrid_x_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&displayio_tilegrid_y_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_flip_x), MP_ROM_PTR(&displayio_tilegrid_flip_x_obj) },
|
||||
|
|
|
@ -36,6 +36,8 @@ void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_
|
|||
mp_obj_t pixel_shader, uint16_t width, uint16_t height,
|
||||
uint16_t tile_width, uint16_t tile_height, uint16_t x, uint16_t y, uint8_t default_tile);
|
||||
|
||||
bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t* self);
|
||||
void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t* self, bool hidden);
|
||||
mp_int_t common_hal_displayio_tilegrid_get_x(displayio_tilegrid_t *self);
|
||||
void common_hal_displayio_tilegrid_set_x(displayio_tilegrid_t *self, mp_int_t x);
|
||||
mp_int_t common_hal_displayio_tilegrid_get_y(displayio_tilegrid_t *self);
|
||||
|
|
|
@ -34,7 +34,6 @@ typedef enum {
|
|||
DISPLAY_DATA
|
||||
} display_byte_type_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
CHIP_SELECT_UNTOUCHED,
|
||||
CHIP_SELECT_TOGGLE_EVERY_BYTE
|
||||
|
|
|
@ -36,6 +36,22 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
|||
uint16_t *buffer, size_t buffer_size,
|
||||
displayio_display_obj_t *display, uint8_t scale) {
|
||||
|
||||
|
||||
displayio_area_t area;
|
||||
area.x1 = x0;
|
||||
area.y1 = y0;
|
||||
area.x2 = x1;
|
||||
area.y2 = y1;
|
||||
displayio_display_core_set_region_to_update(
|
||||
&display->core, display->set_column_command, display->set_row_command,
|
||||
NO_COMMAND, NO_COMMAND, display->data_as_commands, false, &area);
|
||||
|
||||
while (!displayio_display_core_begin_transaction(&display->core)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
display->core.send(display->core.bus, DISPLAY_COMMAND,
|
||||
CHIP_SELECT_TOGGLE_EVERY_BYTE,
|
||||
&display->write_ram_command, 1);
|
||||
size_t index = 0;
|
||||
for (uint16_t y = y0; y < y1; ++y) {
|
||||
for (uint8_t yscale = 0; yscale < scale; ++yscale) {
|
||||
|
@ -57,8 +73,9 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
|||
index += 1;
|
||||
// The buffer is full, send it.
|
||||
if (index >= buffer_size) {
|
||||
display->core.send(display->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*)buffer),
|
||||
buffer_size * 2);
|
||||
display->core.send(display->core.bus, DISPLAY_DATA,
|
||||
CHIP_SELECT_UNTOUCHED,
|
||||
((uint8_t*)buffer), buffer_size * 2);
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +84,10 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
|||
}
|
||||
// Send the remaining data.
|
||||
if (index) {
|
||||
display->core.send(display->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*)buffer), index * 2);
|
||||
display->core.send(display->core.bus, DISPLAY_DATA,
|
||||
CHIP_SELECT_UNTOUCHED,
|
||||
((uint8_t*)buffer), index * 2);
|
||||
}
|
||||
|
||||
displayio_display_core_end_transaction(&display->core);
|
||||
}
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
#include "shared-module/audioio/__init__.h"
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "shared-bindings/audiocore/Mixer.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
#include "shared-bindings/audiocore/WaveFile.h"
|
||||
#include "shared-module/audiocore/Mixer.h"
|
||||
#include "shared-module/audiocore/RawSample.h"
|
||||
#include "shared-module/audiocore/WaveFile.h"
|
||||
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#include "shared-module/audiomixer/Mixer.h"
|
||||
|
||||
uint32_t audiosample_sample_rate(mp_obj_t sample_obj) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
|
@ -41,9 +42,11 @@ uint32_t audiosample_sample_rate(mp_obj_t sample_obj) {
|
|||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return file->sample_rate;
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_mixer_type)) {
|
||||
audioio_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
|
||||
audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
|
||||
return mixer->sample_rate;
|
||||
#endif
|
||||
}
|
||||
return 16000;
|
||||
}
|
||||
|
@ -55,9 +58,11 @@ uint8_t audiosample_bits_per_sample(mp_obj_t sample_obj) {
|
|||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return file->bits_per_sample;
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_mixer_type)) {
|
||||
audioio_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
|
||||
audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
|
||||
return mixer->bits_per_sample;
|
||||
#endif
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
@ -69,9 +74,11 @@ uint8_t audiosample_channel_count(mp_obj_t sample_obj) {
|
|||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return file->channel_count;
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_mixer_type)) {
|
||||
audioio_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
|
||||
audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
|
||||
return mixer->channel_count;
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -83,9 +90,11 @@ void audiosample_reset_buffer(mp_obj_t sample_obj, bool single_channel, uint8_t
|
|||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_wavefile_reset_buffer(file, single_channel, audio_channel);
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_mixer_type)) {
|
||||
audioio_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_mixer_reset_buffer(file, single_channel, audio_channel);
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
|
||||
audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audiomixer_mixer_reset_buffer(file, single_channel, audio_channel);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,9 +108,11 @@ audioio_get_buffer_result_t audiosample_get_buffer(mp_obj_t sample_obj,
|
|||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return audioio_wavefile_get_buffer(file, single_channel, channel, buffer, buffer_length);
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_mixer_type)) {
|
||||
audioio_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return audioio_mixer_get_buffer(file, single_channel, channel, buffer, buffer_length);
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
|
||||
audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return audiomixer_mixer_get_buffer(file, single_channel, channel, buffer, buffer_length);
|
||||
#endif
|
||||
}
|
||||
return GET_BUFFER_DONE;
|
||||
}
|
||||
|
@ -117,9 +128,11 @@ void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel,
|
|||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_wavefile_get_buffer_structure(file, single_channel, single_buffer, samples_signed,
|
||||
max_buffer_length, spacing);
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_mixer_type)) {
|
||||
audioio_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_mixer_get_buffer_structure(file, single_channel, single_buffer, samples_signed,
|
||||
#if CIRCUITPY_AUDIOMIXER
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
|
||||
audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audiomixer_mixer_get_buffer_structure(file, single_channel, single_buffer, samples_signed,
|
||||
max_buffer_length, spacing);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
* 2018 DeanM for Adafruit Industries
|
||||
* 2019 Michael Schroeder
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,7 +26,8 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/audiocore/Mixer.h"
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#include "shared-bindings/audiomixer/MixerVoice.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -32,24 +35,24 @@
|
|||
#include "shared-module/audiocore/__init__.h"
|
||||
#include "shared-module/audiocore/RawSample.h"
|
||||
|
||||
void common_hal_audioio_mixer_construct(audioio_mixer_obj_t* self,
|
||||
uint8_t voice_count,
|
||||
uint32_t buffer_size,
|
||||
uint8_t bits_per_sample,
|
||||
bool samples_signed,
|
||||
uint8_t channel_count,
|
||||
uint32_t sample_rate) {
|
||||
void common_hal_audiomixer_mixer_construct(audiomixer_mixer_obj_t* self,
|
||||
uint8_t voice_count,
|
||||
uint32_t buffer_size,
|
||||
uint8_t bits_per_sample,
|
||||
bool samples_signed,
|
||||
uint8_t channel_count,
|
||||
uint32_t sample_rate) {
|
||||
self->len = buffer_size / 2 / sizeof(uint32_t) * sizeof(uint32_t);
|
||||
|
||||
self->first_buffer = m_malloc(self->len, false);
|
||||
if (self->first_buffer == NULL) {
|
||||
common_hal_audioio_mixer_deinit(self);
|
||||
common_hal_audiomixer_mixer_deinit(self);
|
||||
mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate first buffer"));
|
||||
}
|
||||
|
||||
self->second_buffer = m_malloc(self->len, false);
|
||||
if (self->second_buffer == NULL) {
|
||||
common_hal_audioio_mixer_deinit(self);
|
||||
common_hal_audiomixer_mixer_deinit(self);
|
||||
mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate second buffer"));
|
||||
}
|
||||
|
||||
|
@ -58,130 +61,85 @@ void common_hal_audioio_mixer_construct(audioio_mixer_obj_t* self,
|
|||
self->channel_count = channel_count;
|
||||
self->sample_rate = sample_rate;
|
||||
self->voice_count = voice_count;
|
||||
|
||||
for (uint8_t i = 0; i < self->voice_count; i++) {
|
||||
self->voice[i].sample = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_audioio_mixer_deinit(audioio_mixer_obj_t* self) {
|
||||
void common_hal_audiomixer_mixer_deinit(audiomixer_mixer_obj_t* self) {
|
||||
self->first_buffer = NULL;
|
||||
self->second_buffer = NULL;
|
||||
}
|
||||
|
||||
bool common_hal_audioio_mixer_deinited(audioio_mixer_obj_t* self) {
|
||||
bool common_hal_audiomixer_mixer_deinited(audiomixer_mixer_obj_t* self) {
|
||||
return self->first_buffer == NULL;
|
||||
}
|
||||
|
||||
uint32_t common_hal_audioio_mixer_get_sample_rate(audioio_mixer_obj_t* self) {
|
||||
uint32_t common_hal_audiomixer_mixer_get_sample_rate(audiomixer_mixer_obj_t* self) {
|
||||
return self->sample_rate;
|
||||
}
|
||||
|
||||
void common_hal_audioio_mixer_play(audioio_mixer_obj_t* self, mp_obj_t sample, uint8_t v, bool loop) {
|
||||
if (v >= self->voice_count) {
|
||||
mp_raise_ValueError(translate("Voice index too high"));
|
||||
}
|
||||
if (audiosample_sample_rate(sample) != self->sample_rate) {
|
||||
mp_raise_ValueError(translate("The sample's sample rate does not match the mixer's"));
|
||||
}
|
||||
if (audiosample_channel_count(sample) != self->channel_count) {
|
||||
mp_raise_ValueError(translate("The sample's channel count does not match the mixer's"));
|
||||
}
|
||||
if (audiosample_bits_per_sample(sample) != self->bits_per_sample) {
|
||||
mp_raise_ValueError(translate("The sample's bits_per_sample does not match the mixer's"));
|
||||
}
|
||||
bool single_buffer;
|
||||
bool samples_signed;
|
||||
uint32_t max_buffer_length;
|
||||
uint8_t spacing;
|
||||
audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed,
|
||||
&max_buffer_length, &spacing);
|
||||
if (samples_signed != self->samples_signed) {
|
||||
mp_raise_ValueError(translate("The sample's signedness does not match the mixer's"));
|
||||
}
|
||||
audioio_mixer_voice_t* voice = &self->voice[v];
|
||||
voice->sample = sample;
|
||||
voice->loop = loop;
|
||||
|
||||
audiosample_reset_buffer(sample, false, 0);
|
||||
audioio_get_buffer_result_t result = audiosample_get_buffer(sample, false, 0, (uint8_t**) &voice->remaining_buffer, &voice->buffer_length);
|
||||
// Track length in terms of words.
|
||||
voice->buffer_length /= sizeof(uint32_t);
|
||||
voice->more_data = result == GET_BUFFER_MORE_DATA;
|
||||
}
|
||||
|
||||
void common_hal_audioio_mixer_stop_voice(audioio_mixer_obj_t* self, uint8_t voice) {
|
||||
self->voice[voice].sample = NULL;
|
||||
}
|
||||
|
||||
bool common_hal_audioio_mixer_get_playing(audioio_mixer_obj_t* self) {
|
||||
for (int32_t v = 0; v < self->voice_count; v++) {
|
||||
if (self->voice[v].sample != NULL) {
|
||||
bool common_hal_audiomixer_mixer_get_playing(audiomixer_mixer_obj_t* self) {
|
||||
for (uint8_t v = 0; v < self->voice_count; v++) {
|
||||
if (common_hal_audiomixer_mixervoice_get_playing(MP_OBJ_TO_PTR(self->voice[v]))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void audioio_mixer_reset_buffer(audioio_mixer_obj_t* self,
|
||||
bool single_channel,
|
||||
uint8_t channel) {
|
||||
for (int32_t i = 0; i < self->voice_count; i++) {
|
||||
self->voice[i].sample = NULL;
|
||||
void audiomixer_mixer_reset_buffer(audiomixer_mixer_obj_t* self,
|
||||
bool single_channel,
|
||||
uint8_t channel) {
|
||||
for (uint8_t i = 0; i < self->voice_count; i++) {
|
||||
common_hal_audiomixer_mixervoice_stop(self->voice[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t add8signed(uint32_t a, uint32_t b) {
|
||||
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
|
||||
return __QADD8(a, b);
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
return __SHADD8(a, b);
|
||||
#else
|
||||
uint32_t result = 0;
|
||||
for (int8_t i = 0; i < 4; i++) {
|
||||
int8_t ai = a >> (sizeof(int8_t) * 8 * i);
|
||||
int8_t bi = b >> (sizeof(int8_t) * 8 * i);
|
||||
int32_t intermediate = (int32_t) ai + bi;
|
||||
int32_t intermediate = (int32_t) ai + bi / 2;
|
||||
if (intermediate > CHAR_MAX) {
|
||||
intermediate = CHAR_MAX;
|
||||
} else if (intermediate < CHAR_MIN) {
|
||||
//intermediate = CHAR_MIN;
|
||||
intermediate = CHAR_MIN;
|
||||
}
|
||||
result |= (((uint32_t) intermediate) & 0xff) << (sizeof(int8_t) * 8 * i);
|
||||
result |= ((uint32_t) intermediate & 0xff) << (sizeof(int8_t) * 8 * i);
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t add8unsigned(uint32_t a, uint32_t b) {
|
||||
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
|
||||
// Subtract out the DC offset, add and then shift back.
|
||||
a = __USUB8(a, 0x80808080);
|
||||
b = __USUB8(b, 0x80808080);
|
||||
uint32_t sum = __QADD8(a, b);
|
||||
return __UADD8(sum, 0x80808080);
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
return __UHADD8(a, b);
|
||||
#else
|
||||
uint32_t result = 0;
|
||||
for (int8_t i = 0; i < 4; i++) {
|
||||
int8_t ai = (a >> (sizeof(uint8_t) * 8 * i)) - 128;
|
||||
int8_t bi = (b >> (sizeof(uint8_t) * 8 * i)) - 128;
|
||||
int32_t intermediate = (int32_t) ai + bi;
|
||||
uint8_t ai = (a >> (sizeof(uint8_t) * 8 * i));
|
||||
uint8_t bi = (b >> (sizeof(uint8_t) * 8 * i));
|
||||
int32_t intermediate = (int32_t) (ai + bi) / 2;
|
||||
if (intermediate > UCHAR_MAX) {
|
||||
intermediate = UCHAR_MAX;
|
||||
}
|
||||
result |= ((uint8_t) intermediate + 128) << (sizeof(uint8_t) * 8 * i);
|
||||
result |= ((uint32_t) intermediate & 0xff) << (sizeof(uint8_t) * 8 * i);
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t add16signed(uint32_t a, uint32_t b) {
|
||||
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
|
||||
return __QADD16(a, b);
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
return __SHADD16(a, b);
|
||||
#else
|
||||
uint32_t result = 0;
|
||||
for (int8_t i = 0; i < 2; i++) {
|
||||
int16_t ai = a >> (sizeof(int16_t) * 8 * i);
|
||||
int16_t bi = b >> (sizeof(int16_t) * 8 * i);
|
||||
int32_t intermediate = (int32_t) ai + bi;
|
||||
int32_t intermediate = (int32_t) ai + bi / 2;
|
||||
if (intermediate > SHRT_MAX) {
|
||||
intermediate = SHRT_MAX;
|
||||
} else if (intermediate < SHRT_MIN) {
|
||||
|
@ -194,32 +152,146 @@ uint32_t add16signed(uint32_t a, uint32_t b) {
|
|||
}
|
||||
|
||||
uint32_t add16unsigned(uint32_t a, uint32_t b) {
|
||||
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
|
||||
// Subtract out the DC offset, add and then shift back.
|
||||
a = __USUB16(a, 0x80008000);
|
||||
b = __USUB16(b, 0x80008000);
|
||||
uint32_t sum = __QADD16(a, b);
|
||||
return __UADD16(sum, 0x80008000);
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
return __UHADD16(a, b);
|
||||
#else
|
||||
uint32_t result = 0;
|
||||
for (int8_t i = 0; i < 2; i++) {
|
||||
int16_t ai = (a >> (sizeof(uint16_t) * 8 * i)) - 0x8000;
|
||||
int16_t bi = (b >> (sizeof(uint16_t) * 8 * i)) - 0x8000;
|
||||
int32_t intermediate = (int32_t) ai + bi;
|
||||
int32_t intermediate = (int32_t) ai + bi / 2;
|
||||
if (intermediate > USHRT_MAX) {
|
||||
intermediate = USHRT_MAX;
|
||||
}
|
||||
result |= ((uint16_t) intermediate + 0x8000) << (sizeof(int16_t) * 8 * i);
|
||||
result |= ((uint32_t) intermediate & 0xffff) << (sizeof(int16_t) * 8 * i);
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
audioio_get_buffer_result_t audioio_mixer_get_buffer(audioio_mixer_obj_t* self,
|
||||
bool single_channel,
|
||||
uint8_t channel,
|
||||
uint8_t** buffer,
|
||||
uint32_t* buffer_length) {
|
||||
static inline uint32_t mult8unsigned(uint32_t val, int32_t mul) {
|
||||
// if mul == 0, no need in wasting cycles
|
||||
if (mul == 0) {
|
||||
return 0;
|
||||
}
|
||||
/* TODO: workout ARMv7 instructions
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
return val;
|
||||
#else*/
|
||||
uint32_t result = 0;
|
||||
float mod_mul = (float) mul / (float) ((1<<15)-1);
|
||||
for (int8_t i = 0; i < 4; i++) {
|
||||
uint8_t ai = val >> (sizeof(uint8_t) * 8 * i);
|
||||
int32_t intermediate = ai * mod_mul;
|
||||
if (intermediate > SHRT_MAX) {
|
||||
intermediate = SHRT_MAX;
|
||||
}
|
||||
result |= ((uint32_t) intermediate & 0xff) << (sizeof(uint8_t) * 8 * i);
|
||||
}
|
||||
|
||||
return result;
|
||||
//#endif
|
||||
}
|
||||
|
||||
static inline uint32_t mult8signed(uint32_t val, int32_t mul) {
|
||||
// if mul == 0, no need in wasting cycles
|
||||
if (mul == 0) {
|
||||
return 0;
|
||||
}
|
||||
/* TODO: workout ARMv7 instructions
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
return val;
|
||||
#else
|
||||
*/
|
||||
uint32_t result = 0;
|
||||
float mod_mul = (float)mul / (float)((1<<15)-1);
|
||||
for (int8_t i = 0; i < 4; i++) {
|
||||
int16_t ai = val >> (sizeof(int8_t) * 8 * i);
|
||||
int32_t intermediate = ai * mod_mul;
|
||||
if (intermediate > CHAR_MAX) {
|
||||
intermediate = CHAR_MAX;
|
||||
} else if (intermediate < CHAR_MIN) {
|
||||
intermediate = CHAR_MIN;
|
||||
}
|
||||
result |= (((uint32_t) intermediate) & 0xff) << (sizeof(int16_t) * 8 * i);
|
||||
}
|
||||
return result;
|
||||
//#endif
|
||||
}
|
||||
|
||||
//TODO:
|
||||
static inline uint32_t mult16unsigned(uint32_t val, int32_t mul) {
|
||||
// if mul == 0, no need in wasting cycles
|
||||
if (mul == 0) {
|
||||
return 0;
|
||||
}
|
||||
/* TODO: the below ARMv7m instructions "work", but the amplitude is much higher/louder
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
// there is no unsigned equivalent to the 'SMULWx' ARMv7 Thumb function,
|
||||
// so we have to do it by hand.
|
||||
uint32_t lo = val & 0xffff;
|
||||
uint32_t hi = val >> 16;
|
||||
//mp_printf(&mp_plat_print, "pre-asm: (mul: %d)\n\tval: %x\tlo: %x\thi: %x\n", mul, val, lo, hi);
|
||||
uint32_t val_lo;
|
||||
asm volatile("mul %0, %1, %2" : "=r" (val_lo) : "r" (mul), "r" (lo));
|
||||
asm volatile("mla %0, %1, %2, %3" : "=r" (val) : "r" (mul), "r" (hi), "r" (val_lo));
|
||||
//mp_printf(&mp_plat_print, "post-asm:\n\tval: %x\tlo: %x\n\n", val, val_lo);
|
||||
return val;
|
||||
#else
|
||||
*/
|
||||
uint32_t result = 0;
|
||||
float mod_mul = (float)mul / (float)((1<<15)-1);
|
||||
for (int8_t i = 0; i < 2; i++) {
|
||||
int16_t ai = (val >> (sizeof(uint16_t) * 8 * i)) - 0x8000;
|
||||
int32_t intermediate = ai * mod_mul;
|
||||
if (intermediate > SHRT_MAX) {
|
||||
intermediate = SHRT_MAX;
|
||||
} else if (intermediate < SHRT_MIN) {
|
||||
intermediate = SHRT_MIN;
|
||||
}
|
||||
result |= (((uint32_t) intermediate) + 0x8000) << (sizeof(int16_t) * 8 * i);
|
||||
}
|
||||
return result;
|
||||
//#endif
|
||||
}
|
||||
|
||||
static inline uint32_t mult16signed(uint32_t val, int32_t mul) {
|
||||
// if mul == 0, no need in wasting cycles
|
||||
if (mul == 0) {
|
||||
return 0;
|
||||
}
|
||||
#if (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) //Cortex-M4 w/FPU
|
||||
int32_t hi, lo;
|
||||
int32_t bits = 16; // saturate to 16 bits
|
||||
int32_t shift = 0; // shift is done automatically
|
||||
asm volatile("smulwb %0, %1, %2" : "=r" (lo) : "r" (mul), "r" (val));
|
||||
asm volatile("smulwt %0, %1, %2" : "=r" (hi) : "r" (mul), "r" (val));
|
||||
asm volatile("ssat %0, %1, %2, asr %3" : "=r" (lo) : "I" (bits), "r" (lo), "I" (shift));
|
||||
asm volatile("ssat %0, %1, %2, asr %3" : "=r" (hi) : "I" (bits), "r" (hi), "I" (shift));
|
||||
asm volatile("pkhbt %0, %1, %2, lsl #16" : "=r" (val) : "r" (lo), "r" (hi)); // pack
|
||||
return val;
|
||||
#else
|
||||
uint32_t result = 0;
|
||||
float mod_mul = (float)mul / (float)((1<<15)-1);
|
||||
for (int8_t i = 0; i < 2; i++) {
|
||||
int16_t ai = val >> (sizeof(int16_t) * 8 * i);
|
||||
int32_t intermediate = ai * mod_mul;
|
||||
if (intermediate > SHRT_MAX) {
|
||||
intermediate = SHRT_MAX;
|
||||
} else if (intermediate < SHRT_MIN) {
|
||||
intermediate = SHRT_MIN;
|
||||
}
|
||||
result |= (((uint32_t) intermediate) & 0xffff) << (sizeof(int16_t) * 8 * i);
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
audioio_get_buffer_result_t audiomixer_mixer_get_buffer(audiomixer_mixer_obj_t* self,
|
||||
bool single_channel,
|
||||
uint8_t channel,
|
||||
uint8_t** buffer,
|
||||
uint32_t* buffer_length) {
|
||||
if (!single_channel) {
|
||||
channel = 0;
|
||||
}
|
||||
|
@ -243,7 +315,7 @@ audioio_get_buffer_result_t audioio_mixer_get_buffer(audioio_mixer_obj_t* self,
|
|||
self->use_first_buffer = !self->use_first_buffer;
|
||||
bool voices_active = false;
|
||||
for (int32_t v = 0; v < self->voice_count; v++) {
|
||||
audioio_mixer_voice_t* voice = &self->voice[v];
|
||||
audiomixer_mixervoice_obj_t* voice = MP_OBJ_TO_PTR(self->voice[v]);
|
||||
|
||||
uint32_t j = 0;
|
||||
bool voice_done = voice->sample == NULL;
|
||||
|
@ -285,6 +357,21 @@ audioio_get_buffer_result_t audioio_mixer_get_buffer(audioio_mixer_obj_t* self,
|
|||
sample_value = voice->remaining_buffer[j];
|
||||
}
|
||||
|
||||
// apply the mixer level
|
||||
if (!self->samples_signed) {
|
||||
if (self->bits_per_sample == 8) {
|
||||
sample_value = mult8unsigned(sample_value, voice->level);
|
||||
} else {
|
||||
sample_value = mult16unsigned(sample_value, voice->level);
|
||||
}
|
||||
} else {
|
||||
if (self->bits_per_sample == 8) {
|
||||
sample_value = mult8signed(sample_value, voice->level);
|
||||
} else {
|
||||
sample_value = mult16signed(sample_value, voice->level);
|
||||
}
|
||||
}
|
||||
|
||||
if (!voices_active) {
|
||||
word_buffer[i] = sample_value;
|
||||
} else {
|
||||
|
@ -327,7 +414,7 @@ audioio_get_buffer_result_t audioio_mixer_get_buffer(audioio_mixer_obj_t* self,
|
|||
return GET_BUFFER_MORE_DATA;
|
||||
}
|
||||
|
||||
void audioio_mixer_get_buffer_structure(audioio_mixer_obj_t* self, bool single_channel,
|
||||
void audiomixer_mixer_get_buffer_structure(audiomixer_mixer_obj_t* self, bool single_channel,
|
||||
bool* single_buffer, bool* samples_signed,
|
||||
uint32_t* max_buffer_length, uint8_t* spacing) {
|
||||
*single_buffer = false;
|
|
@ -24,21 +24,14 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_AUDIOIO_MIXER_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_AUDIOIO_MIXER_H
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_AUDIOMIXER_MIXER_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_AUDIOMIXER_MIXER_H
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "py/objtuple.h"
|
||||
|
||||
#include "shared-module/audiocore/__init__.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_t sample;
|
||||
bool loop;
|
||||
bool more_data;
|
||||
uint32_t* remaining_buffer;
|
||||
uint32_t buffer_length;
|
||||
} audioio_mixer_voice_t;
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
uint32_t* first_buffer;
|
||||
|
@ -55,21 +48,22 @@ typedef struct {
|
|||
uint32_t right_read_count;
|
||||
|
||||
uint8_t voice_count;
|
||||
audioio_mixer_voice_t voice[];
|
||||
} audioio_mixer_obj_t;
|
||||
mp_obj_tuple_t *voice_tuple;
|
||||
mp_obj_t voice[];
|
||||
} audiomixer_mixer_obj_t;
|
||||
|
||||
|
||||
// These are not available from Python because it may be called in an interrupt.
|
||||
void audioio_mixer_reset_buffer(audioio_mixer_obj_t* self,
|
||||
void audiomixer_mixer_reset_buffer(audiomixer_mixer_obj_t* self,
|
||||
bool single_channel,
|
||||
uint8_t channel);
|
||||
audioio_get_buffer_result_t audioio_mixer_get_buffer(audioio_mixer_obj_t* self,
|
||||
audioio_get_buffer_result_t audiomixer_mixer_get_buffer(audiomixer_mixer_obj_t* self,
|
||||
bool single_channel,
|
||||
uint8_t channel,
|
||||
uint8_t** buffer,
|
||||
uint32_t* buffer_length); // length in bytes
|
||||
void audioio_mixer_get_buffer_structure(audioio_mixer_obj_t* self, bool single_channel,
|
||||
void audiomixer_mixer_get_buffer_structure(audiomixer_mixer_obj_t* self, bool single_channel,
|
||||
bool* single_buffer, bool* samples_signed,
|
||||
uint32_t* max_buffer_length, uint8_t* spacing);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_AUDIOIO_MIXER_H
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_AUDIOMIXER_MIXER_H
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 DeanM for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "shared-bindings/audiomixer/Mixer.h"
|
||||
#include "shared-module/audiomixer/MixerVoice.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "shared-module/audiomixer/__init__.h"
|
||||
#include "shared-module/audiocore/RawSample.h"
|
||||
|
||||
void common_hal_audiomixer_mixervoice_construct(audiomixer_mixervoice_obj_t *self) {
|
||||
self->sample = NULL;
|
||||
self->level = ((1 << 15) - 1);
|
||||
}
|
||||
|
||||
void common_hal_audiomixer_mixervoice_set_parent(audiomixer_mixervoice_obj_t* self, audiomixer_mixer_obj_t *parent) {
|
||||
self->parent = parent;
|
||||
}
|
||||
|
||||
float common_hal_audiomixer_mixervoice_get_level(audiomixer_mixervoice_obj_t* self) {
|
||||
return ((float) self->level / ((1 << 15) - 1));
|
||||
}
|
||||
|
||||
void common_hal_audiomixer_mixervoice_set_level(audiomixer_mixervoice_obj_t* self, float level) {
|
||||
self->level = level * ((1 << 15)-1);
|
||||
}
|
||||
|
||||
void common_hal_audiomixer_mixervoice_play(audiomixer_mixervoice_obj_t* self, mp_obj_t sample, bool loop) {
|
||||
if (audiosample_sample_rate(sample) != self->parent->sample_rate) {
|
||||
mp_raise_ValueError(translate("The sample's sample rate does not match the mixer's"));
|
||||
}
|
||||
if (audiosample_channel_count(sample) != self->parent->channel_count) {
|
||||
mp_raise_ValueError(translate("The sample's channel count does not match the mixer's"));
|
||||
}
|
||||
if (audiosample_bits_per_sample(sample) != self->parent->bits_per_sample) {
|
||||
mp_raise_ValueError(translate("The sample's bits_per_sample does not match the mixer's"));
|
||||
}
|
||||
bool single_buffer;
|
||||
bool samples_signed;
|
||||
uint32_t max_buffer_length;
|
||||
uint8_t spacing;
|
||||
audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed,
|
||||
&max_buffer_length, &spacing);
|
||||
if (samples_signed != self->parent->samples_signed) {
|
||||
mp_raise_ValueError(translate("The sample's signedness does not match the mixer's"));
|
||||
}
|
||||
self->sample = sample;
|
||||
self->loop = loop;
|
||||
|
||||
audiosample_reset_buffer(sample, false, 0);
|
||||
audioio_get_buffer_result_t result = audiosample_get_buffer(sample, false, 0, (uint8_t**) &self->remaining_buffer, &self->buffer_length);
|
||||
// Track length in terms of words.
|
||||
self->buffer_length /= sizeof(uint32_t);
|
||||
self->more_data = result == GET_BUFFER_MORE_DATA;
|
||||
}
|
||||
|
||||
bool common_hal_audiomixer_mixervoice_get_playing(audiomixer_mixervoice_obj_t* self) {
|
||||
return self->sample != NULL;
|
||||
}
|
||||
|
||||
void common_hal_audiomixer_mixervoice_stop(audiomixer_mixervoice_obj_t* self) {
|
||||
self->sample = NULL;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 DeanM 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 SHARED_MODULE_AUDIOMIXER_MIXERVOICE_H_
|
||||
#define SHARED_MODULE_AUDIOMIXER_MIXERVOICE_H_
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
#include "shared-module/audiomixer/__init__.h"
|
||||
#include "shared-module/audiomixer/Mixer.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
audiomixer_mixer_obj_t *parent;
|
||||
mp_obj_t sample;
|
||||
bool loop;
|
||||
bool more_data;
|
||||
uint32_t* remaining_buffer;
|
||||
uint32_t buffer_length;
|
||||
int16_t level;
|
||||
} audiomixer_mixervoice_obj_t;
|
||||
|
||||
|
||||
#endif /* SHARED_MODULE_AUDIOMIXER_MIXERVOICE_H_ */
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_AUDIOMIXER__INIT__H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_AUDIOMIXER__INIT__H
|
||||
|
||||
#include "shared-module/audiocore/__init__.h"
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_AUDIOMIXER__INIT__H
|
|
@ -50,6 +50,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
|
|||
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin,
|
||||
uint16_t brightness_command, mp_float_t brightness, bool auto_brightness,
|
||||
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second) {
|
||||
// Turn off auto-refresh as we init.
|
||||
self->auto_refresh = false;
|
||||
uint16_t ram_width = 0x100;
|
||||
uint16_t ram_height = 0x100;
|
||||
if (single_byte_bounds) {
|
||||
|
@ -64,7 +66,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
|
|||
self->write_ram_command = write_ram_command;
|
||||
self->brightness_command = brightness_command;
|
||||
self->auto_brightness = auto_brightness;
|
||||
self->auto_refresh = auto_refresh;
|
||||
self->first_manual_refresh = !auto_refresh;
|
||||
self->data_as_commands = data_as_commands;
|
||||
|
||||
|
@ -128,6 +129,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
|
|||
// Set the group after initialization otherwise we may send pixels while we delay in
|
||||
// initialization.
|
||||
common_hal_displayio_display_show(self, &circuitpython_splash);
|
||||
self->auto_refresh = auto_refresh;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group) {
|
||||
|
|
|
@ -34,6 +34,47 @@ void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_
|
|||
displayio_group_construct(self, children, max_size, scale, x, y);
|
||||
}
|
||||
|
||||
bool common_hal_displayio_group_get_hidden(displayio_group_t* self) {
|
||||
return self->hidden;
|
||||
}
|
||||
|
||||
void common_hal_displayio_group_set_hidden(displayio_group_t* self, bool hidden) {
|
||||
if (self->hidden == hidden) {
|
||||
return;
|
||||
}
|
||||
self->hidden = hidden;
|
||||
if (self->hidden_by_parent) {
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < self->size; i++) {
|
||||
mp_obj_t layer = self->children[i].native;
|
||||
if (MP_OBJ_IS_TYPE(layer, &displayio_tilegrid_type)) {
|
||||
displayio_tilegrid_set_hidden_by_parent(layer, hidden);
|
||||
} else if (MP_OBJ_IS_TYPE(layer, &displayio_group_type)) {
|
||||
displayio_group_set_hidden_by_parent(layer, hidden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void displayio_group_set_hidden_by_parent(displayio_group_t *self, bool hidden) {
|
||||
if (self->hidden_by_parent == hidden) {
|
||||
return;
|
||||
}
|
||||
self->hidden_by_parent = hidden;
|
||||
// If we're already hidden, then we're done.
|
||||
if (self->hidden) {
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < self->size; i++) {
|
||||
mp_obj_t layer = self->children[i].native;
|
||||
if (MP_OBJ_IS_TYPE(layer, &displayio_tilegrid_type)) {
|
||||
displayio_tilegrid_set_hidden_by_parent(layer, hidden);
|
||||
} else if (MP_OBJ_IS_TYPE(layer, &displayio_group_type)) {
|
||||
displayio_group_set_hidden_by_parent(layer, hidden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t common_hal_displayio_group_get_scale(displayio_group_t* self) {
|
||||
return self->scale;
|
||||
}
|
||||
|
|
|
@ -42,18 +42,22 @@ typedef struct {
|
|||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
displayio_group_child_t* children;
|
||||
displayio_buffer_transform_t absolute_transform;
|
||||
displayio_area_t dirty_area; // Catch all for changed area
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
uint16_t scale;
|
||||
uint16_t size;
|
||||
uint16_t max_size;
|
||||
bool item_removed;
|
||||
bool in_group;
|
||||
displayio_buffer_transform_t absolute_transform;
|
||||
displayio_area_t dirty_area; // Catch all for changed area
|
||||
bool item_removed :1;
|
||||
bool in_group :1;
|
||||
bool hidden :1;
|
||||
bool hidden_by_parent :1;
|
||||
uint8_t padding :4;
|
||||
} displayio_group_t;
|
||||
|
||||
void displayio_group_construct(displayio_group_t* self, displayio_group_child_t* child_array, uint32_t max_size, uint32_t scale, mp_int_t x, mp_int_t y);
|
||||
void displayio_group_set_hidden_by_parent(displayio_group_t *self, bool hidden);
|
||||
bool displayio_group_get_previous_area(displayio_group_t *group, displayio_area_t* area);
|
||||
bool displayio_group_fill_area(displayio_group_t *group, const _displayio_colorspace_t* colorspace, const displayio_area_t* area, uint32_t* mask, uint32_t *buffer);
|
||||
void displayio_group_update_transform(displayio_group_t *group, const displayio_buffer_transform_t* parent_transform);
|
||||
|
|
|
@ -97,7 +97,7 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t obj) {
|
|||
|
||||
bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) {
|
||||
displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj);
|
||||
return !common_hal_busio_i2c_try_lock(self->bus);
|
||||
return common_hal_busio_i2c_try_lock(self->bus);
|
||||
}
|
||||
|
||||
void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) {
|
||||
|
|
|
@ -67,14 +67,30 @@ void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_
|
|||
self->bitmap = bitmap;
|
||||
self->pixel_shader = pixel_shader;
|
||||
self->in_group = false;
|
||||
self->first_draw = true;
|
||||
self->hidden = false;
|
||||
self->hidden_by_parent = false;
|
||||
self->previous_area.x1 = 0xffff;
|
||||
self->previous_area.x2 = self->previous_area.x1;
|
||||
self->flip_x = false;
|
||||
self->flip_y = false;
|
||||
self->transpose_xy = false;
|
||||
}
|
||||
|
||||
|
||||
bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t* self) {
|
||||
return self->hidden;
|
||||
}
|
||||
|
||||
void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t* self, bool hidden) {
|
||||
self->hidden = hidden;
|
||||
}
|
||||
|
||||
void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) {
|
||||
self->hidden_by_parent = hidden;
|
||||
}
|
||||
|
||||
bool displayio_tilegrid_get_previous_area(displayio_tilegrid_t *self, displayio_area_t* area) {
|
||||
if (self->first_draw) {
|
||||
if (self->previous_area.x1 == self->previous_area.x2) {
|
||||
return false;
|
||||
}
|
||||
displayio_area_copy(&self->previous_area, area);
|
||||
|
@ -138,12 +154,10 @@ void displayio_tilegrid_update_transform(displayio_tilegrid_t *self,
|
|||
self->in_group = absolute_transform != NULL;
|
||||
self->absolute_transform = absolute_transform;
|
||||
if (absolute_transform != NULL) {
|
||||
self->moved = !self->first_draw;
|
||||
self->moved = true;
|
||||
|
||||
_update_current_x(self);
|
||||
_update_current_y(self);
|
||||
} else {
|
||||
self->first_draw = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +169,7 @@ void common_hal_displayio_tilegrid_set_x(displayio_tilegrid_t *self, mp_int_t x)
|
|||
return;
|
||||
}
|
||||
|
||||
self->moved = !self->first_draw;
|
||||
self->moved = true;
|
||||
|
||||
self->x = x;
|
||||
if (self->absolute_transform != NULL) {
|
||||
|
@ -170,7 +184,7 @@ void common_hal_displayio_tilegrid_set_y(displayio_tilegrid_t *self, mp_int_t y)
|
|||
if (self->y == y) {
|
||||
return;
|
||||
}
|
||||
self->moved = !self->first_draw;
|
||||
self->moved = true;
|
||||
self->y = y;
|
||||
if (self->absolute_transform != NULL) {
|
||||
_update_current_y(self);
|
||||
|
@ -306,6 +320,11 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, const _displayio_c
|
|||
return false;
|
||||
}
|
||||
|
||||
bool hidden = self->hidden || self->hidden_by_parent;
|
||||
if (hidden) {
|
||||
return false;
|
||||
}
|
||||
|
||||
displayio_area_t overlap;
|
||||
if (!displayio_area_compute_overlap(area, &self->current_area, &overlap)) {
|
||||
return false;
|
||||
|
@ -455,14 +474,17 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, const _displayio_c
|
|||
}
|
||||
|
||||
void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) {
|
||||
if (self->moved || self->first_draw) {
|
||||
bool first_draw = self->previous_area.x1 == self->previous_area.x2;
|
||||
bool hidden = self->hidden || self->hidden_by_parent;
|
||||
if (!first_draw && hidden) {
|
||||
self->previous_area.x2 = self->previous_area.x1;
|
||||
} else if (self->moved || first_draw) {
|
||||
displayio_area_copy(&self->current_area, &self->previous_area);
|
||||
}
|
||||
|
||||
self->moved = false;
|
||||
self->full_change = false;
|
||||
self->partial_change = false;
|
||||
self->first_draw = false;
|
||||
if (MP_OBJ_IS_TYPE(self->pixel_shader, &displayio_palette_type)) {
|
||||
displayio_palette_finish_refresh(self->pixel_shader);
|
||||
} else if (MP_OBJ_IS_TYPE(self->pixel_shader, &displayio_colorconverter_type)) {
|
||||
|
@ -481,7 +503,17 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) {
|
|||
}
|
||||
|
||||
displayio_area_t* displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t* tail) {
|
||||
if (self->moved && !self->first_draw) {
|
||||
bool first_draw = self->previous_area.x1 == self->previous_area.x2;
|
||||
bool hidden = self->hidden || self->hidden_by_parent;
|
||||
// Check hidden first because it trumps all other changes.
|
||||
if (hidden) {
|
||||
if (!first_draw) {
|
||||
self->previous_area.next = tail;
|
||||
return &self->previous_area;
|
||||
} else {
|
||||
return tail;
|
||||
}
|
||||
} else if (self->moved && !first_draw) {
|
||||
displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area);
|
||||
if (displayio_area_size(&self->dirty_area) <= 2U * self->pixel_width * self->pixel_height) {
|
||||
self->dirty_area.next = tail;
|
||||
|
@ -512,7 +544,7 @@ displayio_area_t* displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *sel
|
|||
displayio_palette_needs_refresh(self->pixel_shader)) ||
|
||||
(MP_OBJ_IS_TYPE(self->pixel_shader, &displayio_colorconverter_type) &&
|
||||
displayio_colorconverter_needs_refresh(self->pixel_shader));
|
||||
if (self->full_change || self->first_draw) {
|
||||
if (self->full_change || first_draw) {
|
||||
self->current_area.next = tail;
|
||||
return &self->current_area;
|
||||
}
|
||||
|
|
|
@ -55,17 +55,21 @@ typedef struct {
|
|||
displayio_area_t dirty_area; // Stored as a relative area until the refresh area is fetched.
|
||||
displayio_area_t previous_area; // Stored as an absolute area.
|
||||
displayio_area_t current_area; // Stored as an absolute area so it applies across frames.
|
||||
bool partial_change;
|
||||
bool full_change;
|
||||
bool first_draw;
|
||||
bool moved;
|
||||
bool inline_tiles;
|
||||
bool in_group;
|
||||
bool flip_x;
|
||||
bool flip_y;
|
||||
bool transpose_xy;
|
||||
bool partial_change :1;
|
||||
bool full_change :1;
|
||||
bool moved :1;
|
||||
bool inline_tiles :1;
|
||||
bool in_group :1;
|
||||
bool flip_x :1;
|
||||
bool flip_y :1;
|
||||
bool transpose_xy :1;
|
||||
bool hidden :1;
|
||||
bool hidden_by_parent :1;
|
||||
uint8_t padding :6;
|
||||
} displayio_tilegrid_t;
|
||||
|
||||
void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden);
|
||||
|
||||
// Updating the screen is a three stage process.
|
||||
|
||||
// The first stage is used to determine i
|
||||
|
|
|
@ -222,7 +222,8 @@ displayio_tilegrid_t blinka_sprite = {
|
|||
.tiles = 0,
|
||||
.partial_change = false,
|
||||
.full_change = false,
|
||||
.first_draw = true,
|
||||
.hidden = false,
|
||||
.hidden_by_parent = false,
|
||||
.moved = false,
|
||||
.inline_tiles = true,
|
||||
.in_group = true
|
||||
|
@ -242,5 +243,7 @@ displayio_group_t circuitpython_splash = {
|
|||
.max_size = 2,
|
||||
.children = splash_children,
|
||||
.item_removed = false,
|
||||
.in_group = false
|
||||
.in_group = false,
|
||||
.hidden = false,
|
||||
.hidden_by_parent = false
|
||||
};
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 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 "supervisor/internal_flash.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "extmod/vfs.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "py/mphal.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
#include "lib/oofatfs/ff.h"
|
||||
|
||||
void supervisor_flash_init(void) {
|
||||
}
|
||||
|
||||
uint32_t supervisor_flash_get_block_size(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t supervisor_flash_get_block_count(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void supervisor_flash_flush(void) {
|
||||
}
|
||||
|
||||
static int32_t convert_block_to_flash_addr(uint32_t block) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) {
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
void supervisor_flash_release_cache(void) {
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ SRC_SUPERVISOR = \
|
|||
supervisor/shared/translate.c
|
||||
|
||||
ifndef $(NO_USB)
|
||||
NO_USB = $(wildcard supervisor/usb.c)
|
||||
NO_USB = $(wildcard supervisor/usb.c)
|
||||
endif
|
||||
|
||||
ifneq ($(INTERNAL_FLASH_FILESYSTEM),)
|
||||
|
@ -44,7 +44,11 @@ ifdef EXTERNAL_FLASH_DEVICES
|
|||
SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c
|
||||
endif
|
||||
else
|
||||
SRC_SUPERVISOR += supervisor/internal_flash.c
|
||||
ifeq ($(DISABLE_FILESYSTEM),1)
|
||||
SRC_SUPERVISOR += supervisor/stub/internal_flash.c
|
||||
else
|
||||
SRC_SUPERVISOR += supervisor/internal_flash.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USB),FALSE)
|
||||
|
@ -78,6 +82,7 @@ else
|
|||
shared-module/usb_midi/PortIn.c \
|
||||
shared-module/usb_midi/PortOut.c \
|
||||
$(BUILD)/autogen_usb_descriptor.c
|
||||
|
||||
CFLAGS += -DUSB_AVAILABLE
|
||||
endif
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ def get_current_info():
|
|||
current_info[info["id"]] = info
|
||||
return git_info, current_info
|
||||
|
||||
def create_pr(changes, updated, git_info):
|
||||
def create_pr(changes, updated, git_info, user):
|
||||
commit_sha, original_blob_sha = git_info
|
||||
branch_name = "new_release_" + changes["new_release"]
|
||||
|
||||
|
@ -138,7 +138,7 @@ def create_pr(changes, updated, git_info):
|
|||
languages = ""
|
||||
if changes["new_languages"]:
|
||||
languages = "New languages:\n* " + "\n* ".join(changes["new_languages"])
|
||||
message = "Automated website update for release {} by AdaBot.\n\n{}\n\n{}\n".format(
|
||||
message = "Automated website update for release {} by Blinka.\n\n{}\n\n{}\n".format(
|
||||
changes["new_release"],
|
||||
boards,
|
||||
languages
|
||||
|
@ -148,7 +148,7 @@ def create_pr(changes, updated, git_info):
|
|||
"ref": "refs/heads/" + branch_name,
|
||||
"sha": commit_sha
|
||||
}
|
||||
response = github.post("/repos/adafruit-adabot/circuitpython-org/git/refs", json=create_branch)
|
||||
response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch)
|
||||
if not response.ok and response.json()["message"] != "Reference already exists":
|
||||
print("unable to create branch")
|
||||
print(response.text)
|
||||
|
@ -161,14 +161,14 @@ def create_pr(changes, updated, git_info):
|
|||
"branch": branch_name
|
||||
}
|
||||
|
||||
response = github.put("/repos/adafruit-adabot/circuitpython-org/contents/_data/files.json", json=update_file)
|
||||
response = github.put("/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file)
|
||||
if not response.ok:
|
||||
print("unable to post new file")
|
||||
print(response.text)
|
||||
return
|
||||
pr_info = {
|
||||
"title": pr_title,
|
||||
"head": "adafruit-adabot:" + branch_name,
|
||||
"head": user + ":" + branch_name,
|
||||
"base": "master",
|
||||
"body": message,
|
||||
"maintainer_can_modify": True
|
||||
|
@ -198,9 +198,12 @@ def update_downloads(boards, release):
|
|||
def print_active_user():
|
||||
response = github.get("/user")
|
||||
if response.ok:
|
||||
print("Logged in as {}".format(response.json()["login"]))
|
||||
user = response.json()["login"]
|
||||
print("Logged in as {}".format(user))
|
||||
return user
|
||||
else:
|
||||
print("Not logged in")
|
||||
return None
|
||||
|
||||
def generate_download_info():
|
||||
boards = {}
|
||||
|
@ -214,7 +217,7 @@ def generate_download_info():
|
|||
"new_languages": []
|
||||
}
|
||||
|
||||
print_active_user()
|
||||
user = print_active_user()
|
||||
|
||||
sha, this_version = get_version_info()
|
||||
|
||||
|
@ -271,8 +274,8 @@ def generate_download_info():
|
|||
|
||||
changes["new_languages"] = set(languages) - previous_languages
|
||||
|
||||
if changes["new_release"]:
|
||||
create_pr(changes, current_info, git_info)
|
||||
if changes["new_release"] and user:
|
||||
create_pr(changes, current_info, git_info, user)
|
||||
else:
|
||||
print("No new release to update")
|
||||
|
||||
|
|
|
@ -139,7 +139,8 @@ displayio_tilegrid_t supervisor_terminal_text_grid = {{
|
|||
.tiles = NULL,
|
||||
.partial_change = false,
|
||||
.full_change = false,
|
||||
.first_draw = true,
|
||||
.hidden = false,
|
||||
.hidden_by_parent = false,
|
||||
.moved = false,
|
||||
.inline_tiles = false,
|
||||
.in_group = true
|
||||
|
|
Loading…
Reference in New Issue