Merge remote-tracking branch 'origin/main' into gifio

This commit is contained in:
Jeff Epler 2021-11-04 20:22:00 -05:00
commit 334a9c85ce
37 changed files with 655 additions and 228 deletions

View File

@ -99,7 +99,7 @@ For example, a user can then use ``deinit()```::
import board
import time
led = digitalio.DigitalInOut(board.D13)
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
for i in range(10):
@ -119,7 +119,7 @@ Alternatively, using a ``with`` statement ensures that the hardware is deinitial
import board
import time
with digitalio.DigitalInOut(board.D13) as led:
with digitalio.DigitalInOut(board.LED) as led:
led.direction = digitalio.Direction.OUTPUT
for i in range(10):

View File

@ -11,32 +11,35 @@ If your host computer starts complaining that your ``CIRCUITPY`` drive is corrup
or files cannot be overwritten or deleted, then you will have to erase it completely.
When CircuitPython restarts it will create a fresh empty ``CIRCUITPY`` filesystem.
This often happens on Windows when the ``CIRCUITPY`` disk is not safely ejected
Corruption often happens on Windows when the ``CIRCUITPY`` disk is not safely ejected
before being reset by the button or being disconnected from USB. This can also
happen on Linux and Mac OSX but it's less likely.
.. caution:: To erase and re-create ``CIRCUITPY`` (for example, to correct a corrupted filesystem),
follow one of the procedures below. It's important to note that **any files stored on the**
``CIRCUITPY`` **drive will be erased**.
``CIRCUITPY`` **drive will be erased. Back up your code if possible before continuing!**
**For boards with** ``CIRCUITPY`` **stored on a separate SPI flash chip,
such as Feather M0 Express, Metro M0 Express and Circuit Playground Express:**
REPL Erase Method
^^^^^^^^^^^^^^^^^
This is the recommended method of erasing your board. If you are having trouble accessing the
``CIRCUITPY`` drive or the REPL, consider first putting your board into
`safe mode <https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#safe-mode-3105351-22>`_.
**To erase any board if you have access to the REPL:**
#. Download the appropriate flash .erase uf2 from `the Adafruit_SPIFlash repo <https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_erase_express>`_.
#. Double-click the reset button.
#. Copy the appropriate .uf2 to the xxxBOOT drive.
#. The on-board NeoPixel will turn blue, indicating the erase has started.
#. After about 15 seconds, the NexoPixel will start flashing green. If it flashes red, the erase failed.
#. Double-click again and load the appropriate `CircuitPython .uf2 <https://github.com/adafruit/circuitpython/releases/latest>`_.
#. Connect to the CircuitPython REPL using a terminal program.
#. Type ``import storage`` into the REPL.
#. Then, type ``storage.erase_filesystem()`` into the REPL.
#. The ``CIRCUITPY`` drive will be erased and the board will restart with an empty ``CIRCUITPY`` drive.
**For boards without SPI flash, such as Feather M0 Proto, Gemma M0 and, Trinket M0:**
Erase File Method
^^^^^^^^^^^^^^^^^
**If you do not have access to the REPL, you may still have options to erase your board.**
#. Download the appropriate erase .uf2 from `the Learn repo <https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/uf2_flash_erasers>`_.
#. Double-click the reset button.
#. Copy the appropriate .uf2 to the xxxBOOT drive.
#. The boot LED will start pulsing again, and the xxxBOOT drive will appear again.
#. Load the appropriate `CircuitPython .uf2 <https://github.com/adafruit/circuitpython/releases/latest>`_.
The `Erase CIRCUITPY Without Access to the REPL <https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#erase-circuitpy-without-access-to-the-repl-3105309-32>`_
section of the Troubleshooting page in the Welcome to CircuitPython guide covers the non-REPL
erase process for various boards. Visit the guide, find the process that applies to your board,
and follow the instructions to erase your board.
ValueError: Incompatible ``.mpy`` file.
---------------------------------------

View File

@ -347,6 +347,7 @@ msgstr ""
msgid "64 bit types"
msgstr ""
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
@ -625,6 +626,10 @@ msgstr ""
msgid "Buffer too short by %d bytes"
msgstr ""
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
msgid "Buffers must be same size"
msgstr ""
#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c
#: ports/espressif/common-hal/paralleldisplay/ParallelBus.c
#: ports/nrf/common-hal/paralleldisplay/ParallelBus.c
@ -1587,6 +1592,10 @@ msgstr ""
msgid "No available clocks"
msgstr ""
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
msgid "No capture in progress"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
msgid "No connection: length cannot be determined"
msgstr ""
@ -1607,6 +1616,7 @@ msgstr ""
msgid "No hardware support on clk pin"
msgstr ""
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "No hardware support on pin"
@ -1727,7 +1737,6 @@ msgstr ""
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1822,6 +1831,7 @@ msgstr ""
msgid "Permission denied"
msgstr ""
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Pin cannot wake from Deep Sleep"
msgstr ""
@ -2175,6 +2185,10 @@ msgstr ""
msgid "The sample's signedness does not match the mixer's"
msgstr ""
#: shared-module/imagecapture/ParallelImageCapture.c
msgid "This microcontroller does not support continuous capture."
msgstr ""
#: shared-module/paralleldisplay/ParallelBus.c
msgid ""
"This microcontroller only supports data0=, not data_pins=, because it "
@ -3881,6 +3895,7 @@ msgstr ""
msgid "pow() with 3 arguments requires integers"
msgstr ""
#: ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h
#: ports/espressif/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h
#: ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h
#: ports/espressif/boards/adafruit_funhouse/mpconfigboard.h

View File

@ -2233,7 +2233,7 @@ msgstr "Die Kachelbreite muss die Bitmap-Breite genau teilen"
#: shared-bindings/alarm/time/TimeAlarm.c
msgid "Time is in the past."
msgstr ""
msgstr "Zeit liegt in der Vergangenheit"
#: ports/nrf/common-hal/_bleio/Adapter.c
#, c-format
@ -2260,7 +2260,7 @@ msgstr "Zu viele displays"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Total data to write is larger than %q"
msgstr ""
msgstr "Gesamte zu schreibende Datenmenge ist größer als %q"
#: ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
@ -2298,19 +2298,19 @@ msgstr "UART-Schreibfehler"
#: shared-module/usb_hid/Device.c
msgid "USB busy"
msgstr ""
msgstr "USB beschäftigt"
#: supervisor/shared/safe_mode.c
msgid "USB devices need more endpoints than are available."
msgstr ""
msgstr "USB Geräte brauchen mehr Endpunkte als verfügbar sind"
#: supervisor/shared/safe_mode.c
msgid "USB devices specify too many interface names."
msgstr ""
msgstr "USB Geräte haben zu viele Schnittstellennamen festgelegt"
#: shared-module/usb_hid/Device.c
msgid "USB error"
msgstr ""
msgstr "USB Fehler"
#: shared-bindings/_bleio/UUID.c
msgid "UUID integer value must be 0-0xffff"
@ -2359,7 +2359,7 @@ msgstr "Schreiben in nvm nicht möglich."
#: shared-bindings/alarm/SleepMemory.c
msgid "Unable to write to sleep_memory."
msgstr ""
msgstr "Schreiben in sleep_memory nicht möglich."
#: ports/nrf/common-hal/_bleio/UUID.c
msgid "Unexpected nrfx uuid type"
@ -2373,7 +2373,7 @@ msgstr ""
#: shared-bindings/wifi/Radio.c
#, c-format
msgid "Unknown failure %d"
msgstr ""
msgstr "Unbekannter Fehler %d"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
@ -2392,7 +2392,7 @@ msgstr "Unbekannter Sicherheitsfehler: 0x%04x"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown system firmware error: %04x"
msgstr ""
msgstr "Unbekannter Systemfirmware Fehler: %04x"
#: shared-bindings/adafruit_pixelbuf/PixelBuf.c
#, c-format
@ -2433,7 +2433,7 @@ msgstr "Nicht unterstützter Pull-Wert."
#: ports/espressif/common-hal/dualbank/__init__.c
msgid "Update Failed"
msgstr ""
msgstr "Update fehlgeschlagen"
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
@ -2447,7 +2447,7 @@ msgstr "Länge des Wertes > max_length"
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "Version was invalid"
msgstr ""
msgstr "Version ist ungültig"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
@ -2498,7 +2498,7 @@ msgstr "WiFi Passwort muss zwischen 8 und 63 Zeichen lang sein"
#: main.c
msgid "Woken up by alarm.\n"
msgstr ""
msgstr "Aufgeweckt durch Alarm.\n"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
@ -2506,7 +2506,7 @@ msgstr "Schreiben nicht unterstüzt für diese Charakteristik"
#: supervisor/shared/safe_mode.c
msgid "You are in safe mode because:\n"
msgstr ""
msgstr "Du bist im abgesicherten Modus weil:\n"
#: supervisor/shared/safe_mode.c
msgid ""
@ -2515,7 +2515,7 @@ msgstr ""
#: supervisor/shared/safe_mode.c
msgid "You requested starting safe mode by "
msgstr "Du hast das Starten im Sicherheitsmodus ausgelöst durch "
msgstr "Du hast das Starten im abgesicherten Modus ausgelöst durch "
#: py/objtype.c
msgid "__init__() should return None"
@ -2539,11 +2539,11 @@ msgstr "Adresse außerhalb der Grenzen"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "addresses is empty"
msgstr "adresses ist leer"
msgstr "addresses ist leer"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
msgstr "Die Annotation muss ein Bezeichner sein"
#: py/modbuiltins.c
msgid "arg is an empty sequence"
@ -2551,7 +2551,7 @@ msgstr "arg ist eine leere Sequenz"
#: py/objobject.c
msgid "arg must be user-type"
msgstr ""
msgstr "arg muss ein Nutzer-Typ sein"
#: extmod/ulab/code/numpy/numerical.c
msgid "argsort argument must be an ndarray"
@ -2567,7 +2567,7 @@ msgstr "Argument hat falschen Typ"
#: py/compile.c
msgid "argument name reused"
msgstr ""
msgstr "Name des Arguments wiederverwendet"
#: py/argcheck.c shared-bindings/_stage/__init__.c
#: shared-bindings/digitalio/DigitalInOut.c
@ -2584,7 +2584,7 @@ msgstr "Argumente müssen ndarrays sein"
#: extmod/ulab/code/ndarray.c
msgid "array and index length must be equal"
msgstr ""
msgstr "Array- und Indexlänge müssen gleich sein"
#: py/objarray.c shared-bindings/alarm/SleepMemory.c
#: shared-bindings/nvm/ByteArray.c
@ -2593,11 +2593,11 @@ msgstr "Array/Bytes auf der rechten Seite erforderlich"
#: extmod/ulab/code/numpy/numerical.c
msgid "attempt to get (arg)min/(arg)max of empty sequence"
msgstr ""
msgstr "Versuch (arg)min/(arg)max einer leeren Sequenz zu holen"
#: extmod/ulab/code/numpy/numerical.c
msgid "attempt to get argmin/argmax of an empty sequence"
msgstr "Sie haben versucht argmin/argmax von einer leeren Sequenz zu bekommen"
msgstr "Sie haben versucht argmin/argmax einer leeren Sequenz zu erhalten"
#: py/objstr.c
msgid "attributes not supported yet"
@ -2605,19 +2605,19 @@ msgstr "Attribute werden noch nicht unterstützt"
#: extmod/ulab/code/numpy/numerical.c
msgid "axis is out of bounds"
msgstr ""
msgstr "Achse außerhalb des Wertebereichs"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
msgid "axis must be None, or an integer"
msgstr ""
msgstr "Achse muss Nichts, oder ein Integer sein"
#: extmod/ulab/code/numpy/numerical.c
msgid "axis too long"
msgstr ""
msgstr "Achse zu lang"
#: shared-bindings/bitmaptools/__init__.c
msgid "background value out of range of target"
msgstr ""
msgstr "Hintergrundwert außerhalb des Zielbereichs"
#: py/builtinevex.c
msgid "bad compile mode"
@ -2641,11 +2641,11 @@ msgstr "Der binäre Operator %q ist nicht implementiert"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
msgstr "bits müssen 32 oder kleiner sein"
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
msgstr "bits müssen zwischen 5 und 9 liegen"
#: shared-bindings/audiomixer/Mixer.c
msgid "bits_per_sample must be 8 or 16"
@ -2657,11 +2657,11 @@ msgstr "Zweig ist außerhalb der Reichweite"
#: extmod/ulab/code/ulab_create.c extmod/ulab/code/utils/utils.c
msgid "buffer is smaller than requested size"
msgstr ""
msgstr "Der Puffer ist kleiner als die angefragte Größe"
#: extmod/ulab/code/ulab_create.c extmod/ulab/code/utils/utils.c
msgid "buffer size must be a multiple of element size"
msgstr ""
msgstr "Die Puffergröße muss ein vielfaches der Elementgröße sein"
#: shared-module/struct/__init__.c
msgid "buffer size must match format"
@ -2678,7 +2678,7 @@ msgstr "Der Puffer ist zu klein"
#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "buffer too small for requested bytes"
msgstr ""
msgstr "Der Puffer ist zu klein für die angefragten Bytes"
#: shared-bindings/adafruit_pixelbuf/PixelBuf.c
msgid "byteorder is not a string"
@ -2729,7 +2729,7 @@ msgstr "kann keinem Ausdruck zuweisen"
#: extmod/moduasyncio.c
msgid "can't cancel self"
msgstr ""
msgstr "kann self nicht abbrechen"
#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c
#: shared-module/adafruit_pixelbuf/PixelBuf.c
@ -2738,7 +2738,7 @@ msgstr "kann %q nicht zu %q konvertieren"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
msgstr "kann %q nicht nach int konvertieren"
#: py/obj.c
#, c-format
@ -2843,7 +2843,7 @@ msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "cannot assign new shape"
msgstr ""
msgstr "Kann neue shape nicht zuweisen"
#: extmod/ulab/code/ndarray_operators.c
msgid "cannot cast output with casting rule"
@ -2867,7 +2867,7 @@ msgstr "kann keinen relativen Import durchführen"
#: extmod/moductypes.c
msgid "cannot unambiguously get sizeof scalar"
msgstr ""
msgstr "Kann nicht eindeutig die Größe (sizeof) des Skalars ermitteln"
#: py/emitnative.c
msgid "casting"
@ -2891,11 +2891,11 @@ msgstr "Kreis kann nur in einem Elternteil registriert werden"
#: shared-bindings/bitmaptools/__init__.c
msgid "clip point must be (x,y) tuple"
msgstr ""
msgstr "clip Punkt muss ein (x,y) Tupel sein"
#: shared-bindings/msgpack/ExtType.c
msgid "code outside range 0~127"
msgstr ""
msgstr "code außerhalb des Wertebereichs 0~127"
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
@ -2921,7 +2921,7 @@ msgstr "Farbe sollte ein int sein"
#: py/emitnative.c
msgid "comparison of int and uint"
msgstr ""
msgstr "Vergleich von int und uint"
#: py/objcomplex.c
msgid "complex division by zero"
@ -2961,28 +2961,28 @@ msgstr "Vandermonde-Matrix konnte nicht invertiert werden"
#: shared-module/sdcardio/SDCard.c
msgid "couldn't determine SD card version"
msgstr ""
msgstr "Konnte SD-Karten Version nicht ermitteln"
#: extmod/ulab/code/numpy/numerical.c
msgid "cross is defined for 1D arrays of length 3"
msgstr ""
msgstr "cross ist definiert für 1-Dimensionale Arrays der Länge 3"
#: extmod/ulab/code/scipy/optimize/optimize.c
msgid "data must be iterable"
msgstr ""
msgstr "data muss iterierbar sein"
#: extmod/ulab/code/scipy/optimize/optimize.c
msgid "data must be of equal length"
msgstr ""
msgstr "data muss von gleicher Länge sein"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
msgstr "Datenpin #%d ist in Benutzung"
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
msgstr "Datentyp nicht verstanden"
#: py/parsenum.c
msgid "decimal numbers not supported"
@ -3176,7 +3176,7 @@ msgstr "float zu groß"
#: py/nativeglue.c
msgid "float unsupported"
msgstr ""
msgstr "float (Gleitkommazahlen) nicht unterstützt"
#: shared-bindings/_stage/Text.c
msgid "font must be 2048 bytes long"
@ -3328,7 +3328,7 @@ msgstr ""
#: extmod/ulab/code/ulab_create.c
msgid "input argument must be an integer, a tuple, or a list"
msgstr ""
msgstr "das Eingabeargument muss ein Integer, Tupel oder eine Liste sein"
#: extmod/ulab/code/numpy/fft/fft_tools.c
msgid "input array length must be power of 2"
@ -3336,7 +3336,7 @@ msgstr "Die Länge des Eingabearrays muss eine Potenz von 2 sein"
#: extmod/ulab/code/ulab_create.c
msgid "input arrays are not compatible"
msgstr ""
msgstr "Eingabe-Arrays sind nicht kompatibel"
#: extmod/ulab/code/numpy/poly.c
msgid "input data must be an iterable"
@ -3365,7 +3365,7 @@ msgstr ""
#: extmod/ulab/code/scipy/signal/signal.c
msgid "input must be one-dimensional"
msgstr ""
msgstr "die Eingabe muss ein-Dimensional sein"
#: extmod/ulab/code/ulab_tools.c
msgid "input must be square matrix"
@ -3398,7 +3398,7 @@ msgstr "Das Intervall muss im Bereich %s-%s sein"
#: py/compile.c
msgid "invalid architecture"
msgstr ""
msgstr "ungültige Architektur"
#: shared-bindings/bitmaptools/__init__.c
#, c-format
@ -4240,7 +4240,7 @@ msgstr "Das Zeitlimit muss 0,0-100,0 Sekunden betragen"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "timeout must be < 655.35 secs"
msgstr ""
msgstr "timeout muss kleiner als 655.35 Sekunden sein"
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "timeout must be >= 0.0"
@ -4268,7 +4268,7 @@ msgstr "zu viele Argumente mit dem angegebenen Format"
#: extmod/ulab/code/ndarray.c extmod/ulab/code/ulab_create.c
msgid "too many dimensions"
msgstr ""
msgstr "zu viele Dimensionen"
#: extmod/ulab/code/ndarray.c
msgid "too many indices"
@ -4425,7 +4425,7 @@ msgstr "Wert muss in %d Byte(s) passen"
#: shared-bindings/bitmaptools/__init__.c
msgid "value out of range of target"
msgstr ""
msgstr "Wert außerhalb des Zielbereiches"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
@ -4433,24 +4433,24 @@ msgstr "value_count muss größer als 0 sein"
#: ports/espressif/common-hal/watchdog/WatchDogTimer.c
msgid "watchdog not initialized"
msgstr ""
msgstr "watchdog nicht initialisiert"
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "watchdog timeout must be greater than 0"
msgstr ""
msgstr "watchdog Zeitlimit muss größer als 0 sein"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
msgstr "breite muss zwischen (inklusive) 2 und 8 liegen, nicht %d"
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""
msgstr "breite muss größer als 0 sein"
#: ports/espressif/common-hal/wifi/Radio.c
msgid "wifi is not enabled"
msgstr ""
msgstr "wifi ist nicht aktiviert"
#: shared-bindings/_bleio/Adapter.c
msgid "window must be <= interval"
@ -4458,11 +4458,11 @@ msgstr "Fenster muss <= Intervall sein"
#: extmod/ulab/code/numpy/numerical.c
msgid "wrong axis index"
msgstr ""
msgstr "falscher Achsenindex"
#: extmod/ulab/code/ulab_create.c
msgid "wrong axis specified"
msgstr ""
msgstr "falsche Achse gewählt"
#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c
msgid "wrong input type"
@ -4486,7 +4486,7 @@ msgstr "x Wert außerhalb der Grenzen"
#: ports/espressif/common-hal/audiobusio/__init__.c
msgid "xTaskCreate failed"
msgstr ""
msgstr "xTaskCreate fehlgeschlagen"
#: shared-bindings/displayio/Shape.c
msgid "y should be an int"
@ -4502,11 +4502,11 @@ msgstr "Nullschritt"
#: extmod/ulab/code/scipy/signal/signal.c
msgid "zi must be an ndarray"
msgstr ""
msgstr "zi muss ein ndarray sein"
#: extmod/ulab/code/scipy/signal/signal.c
msgid "zi must be of float type"
msgstr ""
msgstr "zi muss eine Gleitkommazahl sein"
#: extmod/ulab/code/scipy/signal/signal.c
msgid "zi must be of shape (n_section, 2)"

View File

@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-10-01 02:38+0000\n"
"PO-Revision-Date: 2021-10-31 11:37+0000\n"
"Last-Translator: hexthat <hexthat@gmail.com>\n"
"Language-Team: Chinese Hanyu Pinyin\n"
"Language: zh_Latn_pinyin\n"
@ -152,7 +152,7 @@ msgstr "%q bì xū zài %d hé %d zhī jiān"
#: py/argcheck.c
msgid "%q must be of type %q"
msgstr ""
msgstr "%q bì xū shì lèi xíng %q"
#: ports/atmel-samd/common-hal/busio/UART.c
msgid "%q must be power of 2"
@ -173,7 +173,7 @@ msgstr "%q yīnggāi shì yīgè int"
#: shared-bindings/usb_hid/Device.c
msgid "%q with a report ID of 0 must be of length 1"
msgstr ""
msgstr "%q yǔ bào gào ID 0 bì xū shì cháng dù 1"
#: py/bc.c py/objnamedtuple.c
msgid "%q() takes %d positional arguments but %d were given"
@ -565,7 +565,7 @@ msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng."
#: supervisor/shared/safe_mode.c
msgid "Boot device must be first device (interface #0)."
msgstr ""
msgstr "yǐn dǎo shè bèi bì xū shì dì yī tái shè bèi (jiē kǒu #0)."
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Both RX and TX required for flow control"
@ -1777,7 +1777,7 @@ msgstr "zhǐ yǒu yí gè chù mō bì kě yǐ shè zhì zài shēn dù shuì mi
#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c
msgid "Only one address is allowed"
msgstr ""
msgstr "zhǐ yǔn xǔ yí gè dì zhǐ"
#: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c
#: ports/espressif/common-hal/alarm/time/TimeAlarm.c
@ -1908,7 +1908,7 @@ msgstr "yǐn jiǎo bì xū shì lián xù de"
#: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c
msgid "Pins must be sequential GPIO pins"
msgstr ""
msgstr "yǐn jiǎo bì xū shì lián xù de GPIO yǐn jiǎo"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Pins must share PWM slice"
@ -2495,6 +2495,11 @@ msgid ""
"\n"
"To list built-in modules type `help(\"modules\")`.\n"
msgstr ""
"huān yíng lái dào ā dá shuǐ guǒ diàn lù Python %s!\n"
"\n"
"fǎng wèn circuitpython.org le jiě gèng duō xìn xī.\n"
"\n"
"liè chū nèi zhì mó kuài jiàn rù `help(\"modules\")`.\n"
#: shared-bindings/wifi/Radio.c
msgid "WiFi password must be between 8 and 63 characters"
@ -3042,7 +3047,7 @@ msgstr "bèi líng chú"
#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c
msgid "divisor must be 4"
msgstr ""
msgstr "èr chóng zòu bì xū shì 4"
#: py/objdeque.c
msgid "empty"
@ -4005,7 +4010,7 @@ msgstr "duìliè yìchū"
#: py/parse.c
msgid "raw f-strings are not supported"
msgstr ""
msgstr "bù zhī chí yuán shǐ f-strings"
#: extmod/ulab/code/numpy/fft/fft_tools.c
msgid "real and imaginary parts must be of equal length"
@ -4345,7 +4350,7 @@ msgstr "unicode míngchēng táoyì"
#: py/parse.c
msgid "unindent doesn't match any outer indent level"
msgstr ""
msgstr "dān dù bù pǐ pèi rèn hé wài bù āo hén shuǐ píng"
#: py/objstr.c
#, c-format

120
main.c
View File

@ -635,7 +635,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
return skip_repl;
}
FIL* boot_output_file;
vstr_t *boot_output;
STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
// If not in safe mode, run boot before initing USB and capture output in a file.
@ -645,67 +645,12 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
&& safe_mode == NO_SAFE_MODE
&& MP_STATE_VM(vfs_mount_table) != NULL;
static const char * const boot_py_filenames[] = STRING_LIST("boot.py", "boot.txt");
bool skip_boot_output = false;
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
FIL file_pointer;
#endif
if (ok_to_run) {
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
boot_output_file = &file_pointer;
// Get the base filesystem.
FATFS *fs = &((fs_user_mount_t *) MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
bool have_boot_py = first_existing_file_in_list(boot_py_filenames) != NULL;
// If there's no boot.py file that might write some changing output,
// read the existing copy of CIRCUITPY_BOOT_OUTPUT_FILE and see if its contents
// match the version info we would print anyway. If so, skip writing CIRCUITPY_BOOT_OUTPUT_FILE.
// This saves wear and tear on the flash and also prevents filesystem damage if power is lost
// during the write, which may happen due to bobbling the power connector or weak power.
static const size_t NUM_CHARS_TO_COMPARE = 160;
if (!have_boot_py && f_open(fs, boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_READ) == FR_OK) {
char file_contents[NUM_CHARS_TO_COMPARE];
UINT chars_read = 0;
f_read(boot_output_file, file_contents, NUM_CHARS_TO_COMPARE, &chars_read);
f_close(boot_output_file);
skip_boot_output =
// + 2 accounts for \r\n.
chars_read == strlen(MICROPY_FULL_VERSION_INFO) + 2 &&
strncmp(file_contents, MICROPY_FULL_VERSION_INFO, strlen(MICROPY_FULL_VERSION_INFO)) == 0;
}
if (!skip_boot_output) {
// Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write,
// in case power is momentary or will fail shortly due to, say a low, battery.
if (common_hal_mcu_processor_get_reset_reason() == RESET_REASON_POWER_ON) {
mp_hal_delay_ms(1500);
}
// USB isn't up, so we can write the file.
filesystem_set_internal_writable_by_usb(false);
f_open(fs, boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_WRITE | FA_CREATE_ALWAYS);
// Switch the filesystem back to non-writable by Python now instead of later,
// since boot.py might change it back to writable.
filesystem_set_internal_writable_by_usb(true);
// Write version info to boot_out.txt.
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
// Write the board ID (board directory and ID on circuitpython.org)
mp_hal_stdout_tx_str("\r\n" "Board ID:");
mp_hal_stdout_tx_str(CIRCUITPY_BOARD_ID);
mp_hal_stdout_tx_str("\r\n");
}
#endif
filesystem_flush();
if (!ok_to_run) {
return;
}
static const char * const boot_py_filenames[] = STRING_LIST("boot.py", "boot.txt");
// Do USB setup even if boot.py is not run.
supervisor_allocation* heap = allocate_remaining_memory();
@ -716,20 +661,55 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
usb_set_defaults();
#endif
pyexec_result_t result = {0, MP_OBJ_NULL, 0};
if (ok_to_run) {
bool found_boot = maybe_run_list(boot_py_filenames, &result);
(void) found_boot;
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
vstr_t boot_text;
vstr_init(&boot_text, 512);
boot_output = &boot_text;
#endif
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
if (!skip_boot_output) {
f_close(boot_output_file);
filesystem_flush();
// Write version info
mp_printf(&mp_plat_print, "%s\nBoard ID:%s\n", MICROPY_FULL_VERSION_INFO, CIRCUITPY_BOARD_ID);
pyexec_result_t result = {0, MP_OBJ_NULL, 0};
bool found_boot = maybe_run_list(boot_py_filenames, &result);
(void) found_boot;
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
// Get the base filesystem.
fs_user_mount_t *vfs = (fs_user_mount_t *) MP_STATE_VM(vfs_mount_table)->obj;
FATFS *fs = &vfs->fatfs;
boot_output = NULL;
bool write_boot_output = (common_hal_mcu_processor_get_reset_reason() == RESET_REASON_POWER_ON);
FIL boot_output_file;
if (f_open(fs, &boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_READ) == FR_OK) {
char *file_contents = m_new(char, boot_text.alloc);
UINT chars_read;
if (f_read(&boot_output_file, file_contents, 1+boot_text.len, &chars_read) == FR_OK) {
write_boot_output =
(chars_read != boot_text.len) || (memcmp(boot_text.buf, file_contents, chars_read) != 0);
}
boot_output_file = NULL;
#endif
// no need to f_close the file
}
if (write_boot_output) {
// Wait 1 second before opening CIRCUITPY_BOOT_OUTPUT_FILE for write,
// in case power is momentary or will fail shortly due to, say a low, battery.
mp_hal_delay_ms(1000);
// USB isn't up, so we can write the file.
// operating at the oofatfs (f_open) layer means the usb concurrent write permission
// is not even checked!
f_open(fs, &boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_WRITE | FA_CREATE_ALWAYS);
UINT chars_written;
f_write(&boot_output_file, boot_text.buf, boot_text.len, &chars_written);
f_close(&boot_output_file);
filesystem_flush();
}
#endif
#if CIRCUITPY_USB
// Some data needs to be carried over from the USB settings in boot.py
// to the next VM, while the heap is still available.

View File

@ -13,4 +13,3 @@ CIRCUITPY_FULL_BUILD = 0
# There are many pin definitions on this board; it doesn't quite fit on very large translations.
# Remove a couple of modules.
CIRCUITPY_ONEWIREIO = 0
CIRCUITPY_RAINBOWIO = 0

View File

@ -151,14 +151,14 @@ static void setup_dma(DmacDescriptor *descriptor, size_t count, uint32_t *buffer
descriptor->DESCADDR.reg = 0;
}
#include <string.h>
void common_hal_imagecapture_parallelimagecapture_capture(imagecapture_parallelimagecapture_obj_t *self, void *buffer, size_t bufsize) {
void common_hal_imagecapture_parallelimagecapture_singleshot_capture(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_RW);
uint8_t dma_channel = dma_allocate_channel();
uint32_t *dest = buffer;
size_t count = bufsize / 4; // PCC receives 4 bytes (2 pixels) at a time
uint32_t *dest = bufinfo.buf;
size_t count = bufinfo.len / 4; // PCC receives 4 bytes (2 pixels) at a time
turn_on_event_system();

View File

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

View File

@ -0,0 +1,49 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Micropython setup
#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32S2"
#define MICROPY_HW_MCU_NAME "ESP32S2"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO33)
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
#define AUTORESET_DELAY_MS 500
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37)
#define DEFAULT_UART_BUS_RX (&pin_GPIO38)
#define DEFAULT_UART_BUS_TX (&pin_GPIO39)

View File

@ -0,0 +1,19 @@
USB_VID = 0x239A
USB_PID = 0x80EC
USB_PRODUCT = "Adafruit Feather ESP32S2"
USB_MANUFACTURER = "Adafruit"
IDF_TARGET = esp32s2
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# The default queue depth of 16 overflows on release builds,
# so increase it to 32.
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE=dio
CIRCUITPY_ESP_FLASH_FREQ=40m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_MODULE=wroom

View File

@ -0,0 +1,70 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -0,0 +1,33 @@
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
#
# SPI RAM config
#
# CONFIG_SPIRAM_TYPE_AUTO is not set
CONFIG_SPIRAM_TYPE_ESPPSRAM16=y
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
CONFIG_SPIRAM_SIZE=2097152
#
# PSRAM clock and cs IO for ESP32S2
#
CONFIG_DEFAULT_PSRAM_CLK_IO=30
CONFIG_DEFAULT_PSRAM_CS_IO=26
# end of PSRAM clock and cs IO for ESP32S2
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
# CONFIG_SPIRAM_RODATA is not set
# CONFIG_SPIRAM_SPEED_80M is not set
CONFIG_SPIRAM_SPEED_40M=y
# CONFIG_SPIRAM_SPEED_26M is not set
# CONFIG_SPIRAM_SPEED_20M is not set
CONFIG_SPIRAM=y
CONFIG_SPIRAM_BOOT_INIT=y
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
CONFIG_SPIRAM_USE_MEMMAP=y
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
# CONFIG_SPIRAM_USE_MALLOC is not set
CONFIG_SPIRAM_MEMTEST=y
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
# end of SPI RAM config

View File

@ -1,5 +1,5 @@
USB_VID = 0x239A
USB_PID = 0x80EC
USB_PID = 0x8FFF
USB_PRODUCT = "Feather ESP32S2 no PSRAM"
USB_MANUFACTURER = "Adafruit"

View File

@ -79,6 +79,11 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle
}
void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self) {
cam_deinit();
self->buffer1 = NULL;
self->buffer2 = NULL;
reset_pin_number(self->data_clock);
self->data_clock = NO_PIN;
@ -102,28 +107,73 @@ bool common_hal_imagecapture_parallelimagecapture_deinited(imagecapture_parallel
return self->data_clock == NO_PIN;
}
void common_hal_imagecapture_parallelimagecapture_capture(imagecapture_parallelimagecapture_obj_t *self, void *buffer, size_t bufsize) {
size_t size = bufsize / 2; // count is in pixels
if (size != self->config.size || buffer != self->config.frame1_buffer) {
cam_deinit();
self->config.size = bufsize / 2; // count is in pixels(?)
self->config.frame1_buffer = buffer;
cam_init(&self->config);
cam_start();
} else {
cam_give(buffer);
void common_hal_imagecapture_parallelimagecapture_continuous_capture_start(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer1, mp_obj_t buffer2) {
if (buffer1 == self->buffer1 && buffer2 == self->buffer2) {
return;
}
mp_buffer_info_t bufinfo1, bufinfo2 = {};
mp_get_buffer_raise(buffer1, &bufinfo1, MP_BUFFER_RW);
if (buffer2 != mp_const_none) {
mp_get_buffer_raise(buffer2, &bufinfo2, MP_BUFFER_RW);
if (bufinfo1.len != bufinfo2.len) {
mp_raise_ValueError(translate("Buffers must be same size"));
}
}
self->buffer1 = buffer1;
self->buffer2 = buffer2;
cam_deinit();
self->config.size = bufinfo1.len / 2; // count is in pixels
self->config.frame1_buffer = bufinfo1.buf;
self->config.frame2_buffer = bufinfo2.buf;
self->buffer_to_give = NULL;
cam_init(&self->config);
cam_start();
}
void common_hal_imagecapture_parallelimagecapture_continuous_capture_stop(imagecapture_parallelimagecapture_obj_t *self) {
cam_deinit();
self->buffer1 = self->buffer2 = NULL;
self->buffer_to_give = NULL;
}
STATIC void common_hal_imagecapture_parallelimagecapture_continuous_capture_give_frame(imagecapture_parallelimagecapture_obj_t *self) {
if (self->buffer_to_give) {
cam_give(self->buffer_to_give);
self->buffer_to_give = NULL;
}
}
mp_obj_t common_hal_imagecapture_parallelimagecapture_continuous_capture_get_frame(imagecapture_parallelimagecapture_obj_t *self) {
if (self->buffer1 == NULL) {
mp_raise_RuntimeError(translate("No capture in progress"));
}
common_hal_imagecapture_parallelimagecapture_continuous_capture_give_frame(self);
while (!cam_ready()) {
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
self->config.size = 0; // force re-init next time
cam_stop();
return;
return mp_const_none;
}
}
uint8_t *unused;
cam_take(&unused); // this just "returns" buffer
cam_take(&self->buffer_to_give);
if (self->buffer_to_give == self->config.frame1_buffer) {
return self->buffer1;
}
if (self->buffer_to_give == self->config.frame2_buffer) {
return self->buffer2;
}
return mp_const_none; // should be unreachable
}
void common_hal_imagecapture_parallelimagecapture_singleshot_capture(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer) {
common_hal_imagecapture_parallelimagecapture_continuous_capture_start(self, buffer, mp_const_none);
common_hal_imagecapture_parallelimagecapture_continuous_capture_get_frame(self);
}

View File

@ -26,6 +26,7 @@
#pragma once
#include "py/obj.h"
#include "shared-bindings/imagecapture/ParallelImageCapture.h"
#include "cam.h"
@ -36,4 +37,6 @@ struct imagecapture_parallelimagecapture_obj {
gpio_num_t vertical_sync;
gpio_num_t horizontal_reference;
uint8_t data_count;
mp_obj_t buffer1, buffer2;
uint8_t *buffer_to_give;
};

View File

@ -345,7 +345,10 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
// if we timed out, stop the transfer
if (self->rx_ongoing) {
uint32_t recvd = 0;
LPUART_TransferGetReceiveCount(self->uart, &self->handle, &recvd);
LPUART_TransferAbortReceive(self->uart, &self->handle);
return recvd;
}
// No data left, we got it all
@ -355,7 +358,11 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
// The only place we can reliably tell how many bytes have been received is from the current
// wp in the handle (because the abort nukes rxDataSize, and reading it before abort is a race.)
return self->handle.rxData - data;
if (self->handle.rxData > data) {
return self->handle.rxData - data;
} else {
return len;
}
}
// Write characters.

View File

@ -28,6 +28,7 @@ CIRCUITPY_NVM = 0
CIRCUITPY_PIXELBUF = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_PWMIO = 1
# Deliberately excluded for other reasons than code space, see #5534
CIRCUITPY_RAINBOWIO = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_ROTARYIO = 0

View File

@ -356,9 +356,12 @@ mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self, c
if (self->conn_handle == BLE_CONN_HANDLE_INVALID) {
return -1;
}
uint16_t outgoing_packet_length = common_hal_bleio_packet_buffer_get_outgoing_packet_length(self);
mp_int_t outgoing_packet_length = common_hal_bleio_packet_buffer_get_outgoing_packet_length(self);
if (outgoing_packet_length < 0) {
return -1;
}
uint16_t total_len = len + header_len;
mp_int_t total_len = len + header_len;
if (total_len > outgoing_packet_length) {
// Supplied data will not fit in a single BLE packet.
mp_raise_ValueError_varg(translate("Total data to write is larger than %q"), MP_QSTR_outgoing_packet_length);
@ -369,7 +372,7 @@ mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self, c
}
outgoing_packet_length = MIN(outgoing_packet_length, self->max_packet_size);
if (len + self->pending_size > outgoing_packet_length) {
if (len + self->pending_size > (size_t)outgoing_packet_length) {
// No room to append len bytes to packet. Wait until we get a free buffer,
// and keep checking that we haven't been disconnected.
while (self->pending_size != 0 &&

View File

@ -3,7 +3,9 @@
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) },
@ -42,9 +44,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },

View File

@ -137,7 +137,10 @@ bool common_hal_imagecapture_parallelimagecapture_deinited(imagecapture_parallel
return common_hal_rp2pio_statemachine_deinited(&self->state_machine);
}
void common_hal_imagecapture_parallelimagecapture_capture(imagecapture_parallelimagecapture_obj_t *self, void *buffer, size_t bufsize) {
void common_hal_imagecapture_parallelimagecapture_singleshot_capture(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_RW);
PIO pio = self->state_machine.pio;
uint sm = self->state_machine.state_machine;
uint8_t offset = rp2pio_statemachine_program_offset(&self->state_machine);
@ -149,7 +152,7 @@ void common_hal_imagecapture_parallelimagecapture_capture(imagecapture_paralleli
pio_sm_exec(pio, sm, pio_encode_jmp(offset));
pio_sm_set_enabled(pio, sm, true);
common_hal_rp2pio_statemachine_readinto(&self->state_machine, buffer, bufsize, 4);
common_hal_rp2pio_statemachine_readinto(&self->state_machine, bufinfo.buf, bufinfo.len, 4);
pio_sm_set_enabled(pio, sm, false);
}

View File

@ -470,6 +470,7 @@ $(filter $(SRC_PATTERNS), \
digitalio/Pull.c \
displayio/Colorspace.c \
fontio/Glyph.c \
imagecapture/ParallelImageCapture.c \
math/__init__.c \
microcontroller/ResetReason.c \
microcontroller/RunMode.c \
@ -541,6 +542,7 @@ SRC_SHARED_MODULE_ALL = \
getpass/__init__.c \
gifio/__init__.c \
gifio/GifWriter.c \
imagecapture/ParallelImageCapture.c \
ipaddress/IPv4Address.c \
ipaddress/__init__.c \
keypad/__init__.c \

View File

@ -107,7 +107,7 @@ def make_version_header(filename):
#define MICROPY_VERSION_MINOR (%s)
#define MICROPY_VERSION_MICRO (%s)
#define MICROPY_VERSION_STRING "%s"
#define MICROPY_FULL_VERSION_INFO ("Adafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME)
#define MICROPY_FULL_VERSION_INFO "Adafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME
""" % (
git_tag,
git_hash,

View File

@ -50,9 +50,9 @@
//| For example::
//|
//| import digitalio
//| from board import *
//| import board
//|
//| pin = digitalio.DigitalInOut(D13)
//| pin = digitalio.DigitalInOut(board.LED)
//| print(pin.value)
//|
//| This example will initialize the the device, read
@ -61,11 +61,11 @@
//|
//| Here is blinky::
//|
//| import digitalio
//| from board import *
//| import time
//| import digitalio
//| import board
//|
//| led = digitalio.DigitalInOut(D13)
//| led = digitalio.DigitalInOut(board.LED)
//| led.direction = digitalio.Direction.OUTPUT
//| while True:
//| led.value = True

View File

@ -46,11 +46,11 @@
//|
//| For example::
//|
//| import frequencyio
//| import time
//| from board import *
//| import frequencyio
//| import board
//|
//| frequency = frequencyio.FrequencyIn(D13)
//| frequency = frequencyio.FrequencyIn(board.D11)
//| frequency.capture_period = 15
//| time.sleep(0.1)
//|

View File

@ -25,6 +25,7 @@
*/
#include "py/obj.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared/runtime/context_manager_helpers.h"
@ -82,19 +83,69 @@ STATIC mp_obj_t imagecapture_parallelimagecapture_make_new(const mp_obj_type_t *
return self;
}
//| def capture(self, buffer: WriteableBuffer, width: int, height: int, bpp: int=16) -> None:
//| """Capture a single frame into the given buffer"""
//| def capture(self, buffer: WriteableBuffer) -> WriteableBuffer:
//| """Capture a single frame into the given buffer.
//|
//| This will stop a continuous-mode capture, if one is in progress."""
//| ...
//|
STATIC mp_obj_t imagecapture_parallelimagecapture_capture(mp_obj_t self_in, mp_obj_t buffer) {
imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in;
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_RW);
common_hal_imagecapture_parallelimagecapture_capture(self, bufinfo.buf, bufinfo.len);
common_hal_imagecapture_parallelimagecapture_singleshot_capture(self, buffer);
return buffer;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(imagecapture_parallelimagecapture_capture_obj, imagecapture_parallelimagecapture_capture);
//| def continuous_capture_start(self, buffer1: WriteableBuffer, buffer2: WriteableBuffer, /) -> None:
//| """Begin capturing into the given buffers in the background.
//|
//| Call `continuous_capture_get_frame` to get the next available
//| frame, and `continuous_capture_stop` to stop capturing.
//|
//| Until `continuous_capture_stop` (or `deinit`) is called, the
//| `ParallelImageCapture` object keeps references to ``buffer1`` and
//| ``buffer2``, so the objects will not be garbage collected."""
//| ...
//|
STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_start(mp_obj_t self_in, mp_obj_t buffer1, mp_obj_t buffer2) {
imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in;
common_hal_imagecapture_parallelimagecapture_continuous_capture_start(self, buffer1, buffer2);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(imagecapture_parallelimagecapture_capture_obj, imagecapture_parallelimagecapture_capture);
STATIC MP_DEFINE_CONST_FUN_OBJ_3(imagecapture_parallelimagecapture_continuous_capture_start_obj, imagecapture_parallelimagecapture_continuous_capture_start);
//| def continuous_capture_get_frame(self) -> WriteableBuffer:
//| """Return the next available frame, one of the two buffers passed to `continuous_capture_start`"""
//| ...
//|
STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_get_frame(mp_obj_t self_in) {
imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in;
return common_hal_imagecapture_parallelimagecapture_continuous_capture_get_frame(self);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_continuous_capture_get_frame_obj, imagecapture_parallelimagecapture_continuous_capture_get_frame);
//| def continuous_capture_stop(self) -> None:
//| """Stop continuous capture.
//|
//| Calling this method also causes the object to release its
//| references to the buffers passed to `continuous_capture_start`,
//| potentially allowing the objects to be garbage collected."""
//| ...
//|
STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_stop(mp_obj_t self_in) {
imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in;
common_hal_imagecapture_parallelimagecapture_continuous_capture_stop(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_continuous_capture_stop_obj, imagecapture_parallelimagecapture_continuous_capture_stop);
//| def deinit(self) -> None:
//| """Deinitialize this instance"""
@ -134,6 +185,9 @@ STATIC const mp_rom_map_elem_t imagecapture_parallelimagecapture_locals_dict_tab
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&imagecapture_parallelimagecapture___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_capture), MP_ROM_PTR(&imagecapture_parallelimagecapture_capture_obj) },
{ MP_ROM_QSTR(MP_QSTR_continuous_capture_start), MP_ROM_PTR(&imagecapture_parallelimagecapture_continuous_capture_start_obj) },
{ MP_ROM_QSTR(MP_QSTR_continuous_capture_stop), MP_ROM_PTR(&imagecapture_parallelimagecapture_continuous_capture_stop_obj) },
{ MP_ROM_QSTR(MP_QSTR_continuous_capture_get_frame), MP_ROM_PTR(&imagecapture_parallelimagecapture_continuous_capture_get_frame_obj) },
};
STATIC MP_DEFINE_CONST_DICT(imagecapture_parallelimagecapture_locals_dict, imagecapture_parallelimagecapture_locals_dict_table);

View File

@ -40,4 +40,7 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle
const mcu_pin_obj_t *horizontal_sync);
void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self);
bool common_hal_imagecapture_parallelimagecapture_deinited(imagecapture_parallelimagecapture_obj_t *self);
void common_hal_imagecapture_parallelimagecapture_capture(imagecapture_parallelimagecapture_obj_t *self, void *buffer, size_t bufsize);
void common_hal_imagecapture_parallelimagecapture_singleshot_capture(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer);
void common_hal_imagecapture_parallelimagecapture_continuous_capture_start(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer1, mp_obj_t buffer2);
void common_hal_imagecapture_parallelimagecapture_continuous_capture_stop(imagecapture_parallelimagecapture_obj_t *self);
mp_obj_t common_hal_imagecapture_parallelimagecapture_continuous_capture_get_frame(imagecapture_parallelimagecapture_obj_t *self);

View File

@ -59,7 +59,7 @@
//| import board
//|
//| # 50% duty cycle at 38kHz.
//| pwm = pulseio.PulseOut(board.D13, frequency=38000, duty_cycle=32768)
//| pwm = pulseio.PulseOut(board.LED, frequency=38000, duty_cycle=32768)
//| # on off on off on
//| pulses = array.array('H', [65000, 1000, 65000, 65000, 1000])
//| pulse.send(pulses)

View File

@ -86,13 +86,29 @@ void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) {
//| :param int frequency: The target frequency in Hertz (32-bit)
//| :param bool variable_frequency: True if the frequency will change over time
//|
//| Simple LED fade::
//|
//| Simple LED on::
//|
//| import pwmio
//| import board
//|
//| pwm = pwmio.PWMOut(board.D13) # output on D13
//| pwm.duty_cycle = 2 ** 15 # Cycles the pin with 50% duty cycle (half of 2 ** 16) at the default 500hz
//| pwm = pwmio.PWMOut(board.LED)
//|
//| while True:
//| pwm.duty_cycle = 2 ** 15 # Cycles the pin with 50% duty cycle (half of 2 ** 16) at the default 500hz
//|
//| PWM LED fade::
//|
//| import pwmio
//| import board
//|
//| pwm = pwmio.PWMOut(board.LED) # output on LED pin with default of 500Hz
//|
//| while True:
//| for cycle in range(0, 65535): # Cycles through the full PWM range from 0 to 65535
//| pwm.duty_cycle = cycle # Cycles the LED pin duty cycle through the range of values
//| for cycle in range(65534, 0, -1): # Cycles through the PWM range backwards from 65534 to 0
//| pwm.duty_cycle = cycle # Cycles the LED pin duty cycle through the range of values
//|
//| PWM at specific frequency (servos and motors)::
//|
@ -100,7 +116,7 @@ void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) {
//| import board
//|
//| pwm = pwmio.PWMOut(board.D13, frequency=50)
//| pwm.duty_cycle = 2 ** 15 # Cycles the pin with 50% duty cycle (half of 2 ** 16) at 50hz
//| pwm.duty_cycle = 2 ** 15 # Cycles the pin with 50% duty cycle (half of 2 ** 16) at 50hz
//|
//| Variable frequency (usually tones)::
//|

View File

@ -45,11 +45,11 @@
//|
//| For example::
//|
//| import pwmio
//| import time
//| from board import *
//| import pwmio
//| import board
//|
//| pwm = pwmio.PWMOut(D13)
//| pwm = pwmio.PWMOut(board.LED)
//| pwm.duty_cycle = 2 ** 15
//| time.sleep(0.1)
//|

View File

@ -0,0 +1,44 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/imagecapture/ParallelImageCapture.h"
#include "py/runtime.h"
// If the continuous-capture mode isn't supported, then this default (weak) implementation will raise exceptions for you
__attribute__((weak))
void common_hal_imagecapture_parallelimagecapture_continuous_capture_start(imagecapture_parallelimagecapture_obj_t *self, mp_obj_t buffer1, mp_obj_t buffer2) {
mp_raise_NotImplementedError(translate("This microcontroller does not support continuous capture."));
}
__attribute__((weak))
void common_hal_imagecapture_parallelimagecapture_continuous_capture_stop(imagecapture_parallelimagecapture_obj_t *self) {
mp_raise_NotImplementedError(translate("This microcontroller does not support continuous capture."));
}
__attribute__((weak))
mp_obj_t common_hal_imagecapture_parallelimagecapture_continuous_capture_get_frame(imagecapture_parallelimagecapture_obj_t *self) {
mp_raise_NotImplementedError(translate("This microcontroller does not support continuous capture."));
}

View File

@ -34,9 +34,9 @@
#include "py/mpconfig.h"
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
#include "lib/oofatfs/ff.h"
#include "py/misc.h"
extern FIL *boot_output_file;
extern vstr_t *boot_output;
#endif
void serial_early_init(void);

View File

@ -525,18 +525,33 @@ STATIC uint8_t _process_mkdir(const uint8_t *raw_buf, size_t command_len) {
return ANY_COMMAND;
}
STATIC void send_listdir_entry_header(const struct listdir_entry *entry, mp_int_t max_packet_size) {
mp_int_t response_size = sizeof(struct listdir_entry);
if (max_packet_size >= response_size) {
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, (const uint8_t *)entry, response_size, NULL, 0);
return;
}
// Split into 16 + 12 size packets to fit into 20 byte minimum packet size.
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, (const uint8_t *)entry, 16, NULL, 0);
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, ((const uint8_t *)entry) + 16, response_size - 16, NULL, 0);
}
STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
const struct listdir_command *command = (struct listdir_command *)raw_buf;
struct listdir_entry *entry = (struct listdir_entry *)raw_buf;
size_t header_size = sizeof(struct listdir_command);
size_t response_size = sizeof(struct listdir_entry);
mp_int_t max_packet_size = common_hal_bleio_packet_buffer_get_outgoing_packet_length(&_transfer_packet_buffer);
if (max_packet_size < 0) {
// -1 means we're disconnected
return ANY_COMMAND;
}
// We reuse the command buffer so that we can produce long packets without
// making the stack large.
if (command->path_length > (COMMAND_SIZE - header_size - 1)) { // -1 for the null we'll write
// TODO: throw away any more packets of path.
entry->command = LISTDIR_ENTRY;
entry->status = STATUS_ERROR;
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, (const uint8_t *)entry, response_size, NULL, 0);
send_listdir_entry_header(entry, max_packet_size);
return ANY_COMMAND;
}
// We need to receive another packet to have the full path.
@ -560,7 +575,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
if (res != FR_OK) {
entry->status = STATUS_ERROR_NO_FILE;
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, (const uint8_t *)entry, response_size, NULL, 0);
send_listdir_entry_header(entry, max_packet_size);
return ANY_COMMAND;
}
FILINFO file_info;
@ -594,7 +609,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
size_t name_length = strlen(file_info.fname);
entry->path_length = name_length;
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, (const uint8_t *)entry, response_size, NULL, 0);
send_listdir_entry_header(entry, max_packet_size);
size_t fn_offset = 0;
while (fn_offset < name_length) {
size_t fn_size = MIN(name_length - fn_offset, 4);
@ -607,7 +622,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
entry->entry_number = entry->entry_count;
entry->flags = 0;
entry->file_size = 0;
common_hal_bleio_packet_buffer_write(&_transfer_packet_buffer, (const uint8_t *)entry, response_size, NULL, 0);
send_listdir_entry_header(entry, max_packet_size);
return ANY_COMMAND;
}

View File

@ -59,9 +59,14 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
toggle_tx_led();
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
if (boot_output_file != NULL) {
UINT bytes_written = 0;
f_write(boot_output_file, str, len, &bytes_written);
if (boot_output != NULL) {
// Ensure boot_out.txt is capped at 1 filesystem block and ends with a newline
if (len + boot_output->len > 508) {
vstr_add_str(boot_output, "...\n");
boot_output = NULL;
} else {
vstr_add_strn(boot_output, str, len);
}
}
#endif

View File

@ -3,7 +3,6 @@ import audiopwmio
import board
import digitalio
import time
import math
import os
trigger = digitalio.DigitalInOut(board.D4)

View File

@ -3,7 +3,6 @@ import audiopwmio
import board
import digitalio
import time
import math
import os
trigger = digitalio.DigitalInOut(board.D4)

View File

@ -88,7 +88,12 @@ def set_boards_to_build(build_all):
arch_to_boards = {"arm": [], "riscv": [], "espressif": []}
for board in boards_to_build:
print(" ", board)
arch = PORT_TO_ARCH[board_to_port[board]]
port = board_to_port.get(board)
# A board can appear due to its _deletion_ (rare)
# if this happens it's not in `board_to_port`.
if not port:
continue
arch = PORT_TO_ARCH[port]
arch_to_boards[arch].append(board)
# Set the step outputs for each architecture