Merge branch 'adafruit:main' into seeduino-xiao-rp2040

This commit is contained in:
Pierre Constantineau 2021-11-03 14:07:45 -06:00 committed by GitHub
commit f3eb9ea5e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 218 additions and 194 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

@ -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

@ -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

@ -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

@ -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

@ -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)