Merge branch 'master' into nrf52_uart_io

This commit is contained in:
hathach 2018-09-24 12:50:48 +07:00
commit 7a1b4ccc9b
61 changed files with 1631 additions and 475 deletions

View File

@ -5,6 +5,9 @@ compiler:
- gcc
git:
depth: 1
# Put a representative board from each port or sub-port near the top
# to determine more quickly whether that port is going to build or not.
env:
- TRAVIS_TEST=unix
- TRAVIS_TEST=docs
@ -12,27 +15,30 @@ env:
- TRAVIS_BOARD=feather_huzzah
- TRAVIS_BOARD=circuitplayground_express
- TRAVIS_BOARD=pca10056
# The rest of the boards, in alphabetical order.
- TRAVIS_BOARD=trinket_m0
- TRAVIS_BOARD=feather_m4_express
- TRAVIS_BOARD=grandcentral_m4_express
- TRAVIS_BOARD=feather_radiofruit_zigbee
- TRAVIS_BOARD=arduino_zero
- TRAVIS_BOARD=circuitplayground_express_crickit
- TRAVIS_BOARD=feather_m0_basic
- TRAVIS_BOARD=feather_m0_adalogger
- TRAVIS_BOARD=feather_m0_rfm69
- TRAVIS_BOARD=feather_m0_rfm9x
- TRAVIS_BOARD=feather_m0_basic
- TRAVIS_BOARD=feather_m0_express
- TRAVIS_BOARD=feather_m0_express_crickit
- TRAVIS_BOARD=feather_m0_rfm69
- TRAVIS_BOARD=feather_m0_rfm9x
- TRAVIS_BOARD=feather_nrf52832
- TRAVIS_BOARD=feather_nrf52840_express
- TRAVIS_BOARD=feather_radiofruit_zigbee
- TRAVIS_BOARD=gemma_m0
- TRAVIS_BOARD=hallowing_m0_express
- TRAVIS_BOARD=itsybitsy_m0_express
- TRAVIS_BOARD=itsybitsy_m4_express
- TRAVIS_BOARD=metro_m0_express
- TRAVIS_BOARD=metro_m4_express
- TRAVIS_BOARD=pca10059
- TRAVIS_BOARD=pirkey_m0
- TRAVIS_BOARD=gemma_m0
- TRAVIS_BOARD=hallowing_m0_express
- TRAVIS_BOARD=feather_nrf52832
- TRAVIS_BOARD=feather_nrf52840_express
- TRAVIS_BOARD=trellis_m4_express
addons:
artifacts:
@ -56,13 +62,13 @@ before_script:
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
# For nrf builds
- ([[ $TRAVIS_BOARD != "feather_nrf52832" && $TRAVIS_BOARD != "feather_nrf52840_express" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
- ([[ $TRAVIS_BOARD != "feather_nrf52832" && $TRAVIS_BOARD != "feather_nrf52840_express" && $TRAVIS_BOARD != "pca10056" && $TRAVIS_BOARD != "pca10059" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
# For huzzah builds
- if [[ $TRAVIS_BOARD = "feather_huzzah" ]]; then wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar xavf xtensa-lx106-elf-standalone.tar.gz; PATH=$(readlink -f xtensa-lx106-elf/bin):$PATH; fi
# For coverage testing (upgrade is used to get latest urllib3 version)
- ([[ -z "$TRAVIS_TEST" ]] || sudo apt-get install -y python3-pip)
- ([[ -z "$TRAVIS_TEST" ]] || sudo pip install --upgrade cpp-coveralls)
- ([[ $TRAVIS_TEST != "docs" ]] || sudo pip install Sphinx sphinx-rtd-theme recommonmark)
- ([[ $TRAVIS_TEST != "docs" ]] || sudo pip install 'Sphinx<1.8.0' sphinx-rtd-theme recommonmark)
- ([[ $TRAVIS_TEST != "translations" ]] || sudo pip3 install polib)
- gcc --version
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || arm-none-eabi-gcc --version)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-06 14:55-0700\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -123,7 +123,7 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: extmod/moduzlib.c:97
#: extmod/moduzlib.c:98
msgid "compression header"
msgstr ""
@ -214,7 +214,7 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
#: main.c:415
#: main.c:416
msgid "soft reboot\n"
msgstr ""
@ -231,15 +231,15 @@ msgstr ""
msgid "calibration is out of range"
msgstr ""
#: ports/atmel-samd/board_busses.c:39 ports/nrf/board_busses.c:39
#: ports/atmel-samd/board_busses.c:59 ports/nrf/board_busses.c:39
msgid "No default I2C bus"
msgstr ""
#: ports/atmel-samd/board_busses.c:64 ports/nrf/board_busses.c:64
#: ports/atmel-samd/board_busses.c:85 ports/nrf/board_busses.c:64
msgid "No default SPI bus"
msgstr ""
#: ports/atmel-samd/board_busses.c:91 ports/nrf/board_busses.c:91
#: ports/atmel-samd/board_busses.c:112 ports/nrf/board_busses.c:91
msgid "No default UART bus"
msgstr ""
@ -291,12 +291,12 @@ msgid "Too many channels in sample."
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
@ -338,16 +338,21 @@ msgstr ""
msgid "Cannot output both channels on the same pin"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr ""
@ -356,7 +361,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:58
#: ports/nrf/common-hal/busio/I2C.c:77
msgid "Invalid pins"
msgstr ""
@ -376,24 +381,24 @@ msgstr ""
msgid "tx and rx cannot both be None"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:139
#: ports/atmel-samd/common-hal/busio/UART.c:145
msgid "Failed to allocate RX buffer"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:147
#: ports/atmel-samd/common-hal/busio/UART.c:153
msgid "Could not initialize UART"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:234
#: ports/atmel-samd/common-hal/busio/UART.c:240
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:288
#: ports/atmel-samd/common-hal/busio/UART.c:294
msgid "No TX pin"
msgstr ""
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:153
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
msgid "Cannot get pull while in output mode"
msgstr ""
@ -403,12 +408,12 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
msgid "Invalid PWM frequency"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187
msgid "All timers for this pin are in use"
msgstr ""
@ -685,11 +690,23 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
msgid "All I2C peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:109
msgid "All SPI peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
#: ports/nrf/common-hal/busio/UART.c:86
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
msgid "busio.UART not yet implemented"
msgstr ""
@ -1960,6 +1977,7 @@ msgid "buffer must be a bytes-like object"
msgstr ""
#: shared-bindings/audioio/WaveFile.c:78
#: shared-bindings/displayio/OnDiskBitmap.c:85
msgid "file must be a file opened in byte mode"
msgstr ""
@ -1992,11 +2010,11 @@ msgstr ""
msgid "Function requires lock."
msgstr ""
#: shared-bindings/busio/UART.c:98
#: shared-bindings/busio/UART.c:102
msgid "bits must be 7, 8 or 9"
msgstr ""
#: shared-bindings/busio/UART.c:110
#: shared-bindings/busio/UART.c:114
msgid "stop must be 1 or 2"
msgstr ""
@ -2034,6 +2052,10 @@ msgstr ""
msgid "row data must be a buffer"
msgstr ""
#: shared-bindings/displayio/ColorConverter.c:72
msgid "color should be an int"
msgstr ""
#: shared-bindings/displayio/FourWire.c:55
#: shared-bindings/displayio/FourWire.c:64
msgid "displayio is a work in progress"
@ -2064,16 +2086,16 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: shared-bindings/displayio/Sprite.c:45
#: shared-bindings/displayio/Sprite.c:48
msgid "position must be 2-tuple"
msgstr ""
#: shared-bindings/displayio/Sprite.c:87
#: shared-bindings/displayio/Sprite.c:97
msgid "unsupported bitmap type"
msgstr ""
#: shared-bindings/displayio/Sprite.c:152
msgid "palette must be displayio.Palette"
#: shared-bindings/displayio/Sprite.c:162
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""
#: shared-bindings/gamepad/GamePad.c:100
@ -2302,6 +2324,24 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:48
msgid "Group empty"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:49
msgid "Invalid BMP file"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:59
#, c-format
msgid "Only Windows format, uncompressed BMP supported %d"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:64
#, c-format
msgid "Only true color (24 bpp or higher) BMP supported %x"
msgstr ""
#: shared-module/struct/__init__.c:39
msgid "'S' and 'O' are not supported format types"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-06 14:55-0700\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Sebastian Plamauer\n"
"Language-Team: \n"
@ -123,7 +123,7 @@ msgstr "ungültiges cert"
msgid "queue overflow"
msgstr "Warteschlangenüberlauf"
#: extmod/moduzlib.c:97
#: extmod/moduzlib.c:98
msgid "compression header"
msgstr "kompression header"
@ -223,7 +223,7 @@ msgstr ""
"Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu "
"laden"
#: main.c:415
#: main.c:416
msgid "soft reboot\n"
msgstr "weicher reboot\n"
@ -240,15 +240,15 @@ msgstr "Kalibrierung ist Schreibgeschützt"
msgid "calibration is out of range"
msgstr "Kalibrierung ist außerhalb der Reichweite"
#: ports/atmel-samd/board_busses.c:39 ports/nrf/board_busses.c:39
#: ports/atmel-samd/board_busses.c:59 ports/nrf/board_busses.c:39
msgid "No default I2C bus"
msgstr "Kein Standard I2C Bus"
#: ports/atmel-samd/board_busses.c:64 ports/nrf/board_busses.c:64
#: ports/atmel-samd/board_busses.c:85 ports/nrf/board_busses.c:64
msgid "No default SPI bus"
msgstr "Kein Standard SPI Bus"
#: ports/atmel-samd/board_busses.c:91 ports/nrf/board_busses.c:91
#: ports/atmel-samd/board_busses.c:112 ports/nrf/board_busses.c:91
msgid "No default UART bus"
msgstr "Kein Standard UART Bus"
@ -300,12 +300,12 @@ msgid "Too many channels in sample."
msgstr "Zu viele Kanäle im sample"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr "Kein DMA Kanal gefunden"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "Konnte keine Buffer für Vorzeichenumwandlung allozieren"
@ -347,16 +347,21 @@ msgstr "Ungültiger Pin für rechten Kanal"
msgid "Cannot output both channels on the same pin"
msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Alle timer werden benutzt"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Alle event Kanälre werden benutzt"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "Nicht genug Pins vorhanden"
@ -365,7 +370,7 @@ msgstr "Nicht genug Pins vorhanden"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:58
#: ports/nrf/common-hal/busio/I2C.c:77
msgid "Invalid pins"
msgstr "Ungültige Pins"
@ -385,24 +390,24 @@ msgstr "bytes mit merh als 8 bits werden nicht unterstützt"
msgid "tx and rx cannot both be None"
msgstr "tx und rx können nicht beide None sein"
#: ports/atmel-samd/common-hal/busio/UART.c:139
#: ports/atmel-samd/common-hal/busio/UART.c:145
msgid "Failed to allocate RX buffer"
msgstr "Konnte keinen RX Buffer allozieren"
#: ports/atmel-samd/common-hal/busio/UART.c:147
#: ports/atmel-samd/common-hal/busio/UART.c:153
msgid "Could not initialize UART"
msgstr "Konnte UART nicht initialisieren"
#: ports/atmel-samd/common-hal/busio/UART.c:234
#: ports/atmel-samd/common-hal/busio/UART.c:240
msgid "No RX pin"
msgstr "Kein RX Pin"
#: ports/atmel-samd/common-hal/busio/UART.c:288
#: ports/atmel-samd/common-hal/busio/UART.c:294
msgid "No TX pin"
msgstr "Kein TX Pin"
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:153
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
msgid "Cannot get pull while in output mode"
msgstr "Pull up im Ausgabemodus nicht möglich"
@ -412,12 +417,12 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "Reset zum bootloader nicht möglich da bootloader nicht vorhanden"
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
msgid "Invalid PWM frequency"
msgstr "Ungültige PWM Frequenz"
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187
msgid "All timers for this pin are in use"
msgstr "Alle timer für diesen Pin werden benutzt"
@ -694,11 +699,25 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
#, fuzzy
msgid "All I2C peripherals are in use"
msgstr "Alle timer werden benutzt"
#: ports/nrf/common-hal/busio/SPI.c:109
#, fuzzy
msgid "All SPI peripherals are in use"
msgstr "Alle timer werden benutzt"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
#: ports/nrf/common-hal/busio/UART.c:86
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
msgid "busio.UART not yet implemented"
msgstr ""
@ -1969,6 +1988,7 @@ msgid "buffer must be a bytes-like object"
msgstr ""
#: shared-bindings/audioio/WaveFile.c:78
#: shared-bindings/displayio/OnDiskBitmap.c:85
msgid "file must be a file opened in byte mode"
msgstr ""
@ -2001,11 +2021,11 @@ msgstr ""
msgid "Function requires lock."
msgstr ""
#: shared-bindings/busio/UART.c:98
#: shared-bindings/busio/UART.c:102
msgid "bits must be 7, 8 or 9"
msgstr ""
#: shared-bindings/busio/UART.c:110
#: shared-bindings/busio/UART.c:114
msgid "stop must be 1 or 2"
msgstr ""
@ -2043,6 +2063,10 @@ msgstr ""
msgid "row data must be a buffer"
msgstr ""
#: shared-bindings/displayio/ColorConverter.c:72
msgid "color should be an int"
msgstr ""
#: shared-bindings/displayio/FourWire.c:55
#: shared-bindings/displayio/FourWire.c:64
msgid "displayio is a work in progress"
@ -2073,17 +2097,17 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: shared-bindings/displayio/Sprite.c:45
#: shared-bindings/displayio/Sprite.c:48
msgid "position must be 2-tuple"
msgstr ""
#: shared-bindings/displayio/Sprite.c:87
#: shared-bindings/displayio/Sprite.c:97
#, fuzzy
msgid "unsupported bitmap type"
msgstr "Baudrate wird nicht unterstütz"
#: shared-bindings/displayio/Sprite.c:152
msgid "palette must be displayio.Palette"
#: shared-bindings/displayio/Sprite.c:162
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""
#: shared-bindings/gamepad/GamePad.c:100
@ -2312,6 +2336,25 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:48
msgid "Group empty"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:49
#, fuzzy
msgid "Invalid BMP file"
msgstr "Ungültiger Pin"
#: shared-module/displayio/OnDiskBitmap.c:59
#, c-format
msgid "Only Windows format, uncompressed BMP supported %d"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:64
#, c-format
msgid "Only true color (24 bpp or higher) BMP supported %x"
msgstr ""
#: shared-module/struct/__init__.c:39
msgid "'S' and 'O' are not supported format types"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-06 14:55-0700\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -123,7 +123,7 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: extmod/moduzlib.c:97
#: extmod/moduzlib.c:98
msgid "compression header"
msgstr ""
@ -214,7 +214,7 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
#: main.c:415
#: main.c:416
msgid "soft reboot\n"
msgstr ""
@ -231,15 +231,15 @@ msgstr ""
msgid "calibration is out of range"
msgstr ""
#: ports/atmel-samd/board_busses.c:39 ports/nrf/board_busses.c:39
#: ports/atmel-samd/board_busses.c:59 ports/nrf/board_busses.c:39
msgid "No default I2C bus"
msgstr ""
#: ports/atmel-samd/board_busses.c:64 ports/nrf/board_busses.c:64
#: ports/atmel-samd/board_busses.c:85 ports/nrf/board_busses.c:64
msgid "No default SPI bus"
msgstr ""
#: ports/atmel-samd/board_busses.c:91 ports/nrf/board_busses.c:91
#: ports/atmel-samd/board_busses.c:112 ports/nrf/board_busses.c:91
msgid "No default UART bus"
msgstr ""
@ -291,12 +291,12 @@ msgid "Too many channels in sample."
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
@ -338,16 +338,21 @@ msgstr ""
msgid "Cannot output both channels on the same pin"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr ""
@ -356,7 +361,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:58
#: ports/nrf/common-hal/busio/I2C.c:77
msgid "Invalid pins"
msgstr ""
@ -376,24 +381,24 @@ msgstr ""
msgid "tx and rx cannot both be None"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:139
#: ports/atmel-samd/common-hal/busio/UART.c:145
msgid "Failed to allocate RX buffer"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:147
#: ports/atmel-samd/common-hal/busio/UART.c:153
msgid "Could not initialize UART"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:234
#: ports/atmel-samd/common-hal/busio/UART.c:240
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:288
#: ports/atmel-samd/common-hal/busio/UART.c:294
msgid "No TX pin"
msgstr ""
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:153
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
msgid "Cannot get pull while in output mode"
msgstr ""
@ -403,12 +408,12 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
msgid "Invalid PWM frequency"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187
msgid "All timers for this pin are in use"
msgstr ""
@ -685,11 +690,23 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
msgid "All I2C peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:109
msgid "All SPI peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
#: ports/nrf/common-hal/busio/UART.c:86
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
msgid "busio.UART not yet implemented"
msgstr ""
@ -1960,6 +1977,7 @@ msgid "buffer must be a bytes-like object"
msgstr ""
#: shared-bindings/audioio/WaveFile.c:78
#: shared-bindings/displayio/OnDiskBitmap.c:85
msgid "file must be a file opened in byte mode"
msgstr ""
@ -1992,11 +2010,11 @@ msgstr ""
msgid "Function requires lock."
msgstr ""
#: shared-bindings/busio/UART.c:98
#: shared-bindings/busio/UART.c:102
msgid "bits must be 7, 8 or 9"
msgstr ""
#: shared-bindings/busio/UART.c:110
#: shared-bindings/busio/UART.c:114
msgid "stop must be 1 or 2"
msgstr ""
@ -2034,6 +2052,10 @@ msgstr ""
msgid "row data must be a buffer"
msgstr ""
#: shared-bindings/displayio/ColorConverter.c:72
msgid "color should be an int"
msgstr ""
#: shared-bindings/displayio/FourWire.c:55
#: shared-bindings/displayio/FourWire.c:64
msgid "displayio is a work in progress"
@ -2064,16 +2086,16 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: shared-bindings/displayio/Sprite.c:45
#: shared-bindings/displayio/Sprite.c:48
msgid "position must be 2-tuple"
msgstr ""
#: shared-bindings/displayio/Sprite.c:87
#: shared-bindings/displayio/Sprite.c:97
msgid "unsupported bitmap type"
msgstr ""
#: shared-bindings/displayio/Sprite.c:152
msgid "palette must be displayio.Palette"
#: shared-bindings/displayio/Sprite.c:162
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""
#: shared-bindings/gamepad/GamePad.c:100
@ -2302,6 +2324,24 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:48
msgid "Group empty"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:49
msgid "Invalid BMP file"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:59
#, c-format
msgid "Only Windows format, uncompressed BMP supported %d"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:64
#, c-format
msgid "Only true color (24 bpp or higher) BMP supported %x"
msgstr ""
#: shared-module/struct/__init__.c:39
msgid "'S' and 'O' are not supported format types"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-06 14:55-0700\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -123,7 +123,7 @@ msgstr "certificado inválido"
msgid "queue overflow"
msgstr "desborde de queue"
#: extmod/moduzlib.c:97
#: extmod/moduzlib.c:98
msgid "compression header"
msgstr "encabezado de compresión"
@ -229,47 +229,47 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
"Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar."
#: main.c:415
#: main.c:416
msgid "soft reboot\n"
msgstr "reinicio suave\n"
#: ports/atmel-samd/audio_dma.c:285
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:361
msgid "All sync event channels in use"
msgstr ""
msgstr "Todos los sync event channels están siendo utilizados"
#: ports/atmel-samd/bindings/samd/Clock.c:135
msgid "calibration is read only"
msgstr ""
msgstr "calibration es de solo lectura"
#: ports/atmel-samd/bindings/samd/Clock.c:137
msgid "calibration is out of range"
msgstr ""
msgstr "calibration esta fuera de rango"
#: ports/atmel-samd/board_busses.c:39 ports/nrf/board_busses.c:39
#: ports/atmel-samd/board_busses.c:59 ports/nrf/board_busses.c:39
msgid "No default I2C bus"
msgstr ""
msgstr "Sin bus I2C por default"
#: ports/atmel-samd/board_busses.c:64 ports/nrf/board_busses.c:64
#: ports/atmel-samd/board_busses.c:85 ports/nrf/board_busses.c:64
msgid "No default SPI bus"
msgstr ""
msgstr "Sin bus SPI por default"
#: ports/atmel-samd/board_busses.c:91 ports/nrf/board_busses.c:91
#: ports/atmel-samd/board_busses.c:112 ports/nrf/board_busses.c:91
msgid "No default UART bus"
msgstr ""
msgstr "Sin bus UART por default"
#: ports/atmel-samd/common-hal/analogio/AnalogIn.c:63
#: ports/nrf/common-hal/analogio/AnalogIn.c:39
msgid "Pin does not have ADC capabilities"
msgstr ""
msgstr "pin no tiene capacidades ADC"
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c:49
msgid "No DAC on chip"
msgstr ""
msgstr "El chip no tiene DAC"
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c:56
msgid "AnalogOut not supported on given pin"
msgstr "AnalogOut no es soportado por el pin dado"
msgstr "El pin proporcionado no soporta AnalogOut"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:147
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:150
@ -277,25 +277,24 @@ msgid "Invalid bit clock pin"
msgstr "Pin bit clock inválido"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:153
#, fuzzy
msgid "Bit clock and word select must share a clock unit"
msgstr "Bit clock y Word select deben compartir la unidad de reloj"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:156
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:130
msgid "Invalid data pin"
msgstr ""
msgstr "Pin de datos inválido"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:169
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:174
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:145
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:150
msgid "Serializer in use"
msgstr ""
msgstr "Serializer está siendo utilizado"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:230
msgid "Clock unit in use"
msgstr ""
msgstr "Clock unit está siendo utilizado"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:240
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:172
@ -304,21 +303,21 @@ msgstr "No se pudo encontrar un GCLK disponible"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:254
msgid "Too many channels in sample."
msgstr ""
msgstr "Demasiados canales en sample"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr ""
msgstr "No se encontró el canal DMA"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "No se pudieron asignar buffers para la conversión con signo"
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:109
msgid "Invalid clock pin"
msgstr "pin clock inválido"
msgstr "Pin clock inválido"
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:134
msgid "Only 8 or 16 bit mono with "
@ -330,7 +329,7 @@ msgstr "velocidad de muestreo fuera de rango"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:69
msgid "DAC already in use"
msgstr ""
msgstr "DAC ya está siendo utilizado"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:73
msgid "Right channel unsupported"
@ -354,15 +353,20 @@ msgstr ""
msgid "Cannot output both channels on the same pin"
msgstr "No es posible utilizar el mismo pin para ambos canales"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Todos los timers estan siendo utilizados"
msgstr "Todos los timers están siendo utilizados"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Todos los canales de eventos estan siendo utilizados"
msgstr "Todos los canales de eventos están siendo utilizados"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
@ -372,7 +376,7 @@ msgstr "No hay suficientes pines disponibles"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:58
#: ports/nrf/common-hal/busio/I2C.c:77
msgid "Invalid pins"
msgstr "pines inválidos"
@ -392,24 +396,24 @@ msgstr "bytes > 8 bits no son soportados"
msgid "tx and rx cannot both be None"
msgstr "tx y rx no pueden ser ambos None"
#: ports/atmel-samd/common-hal/busio/UART.c:139
#: ports/atmel-samd/common-hal/busio/UART.c:145
msgid "Failed to allocate RX buffer"
msgstr "Fallo la asignación del buffer RX"
#: ports/atmel-samd/common-hal/busio/UART.c:147
#: ports/atmel-samd/common-hal/busio/UART.c:153
msgid "Could not initialize UART"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:234
#: ports/atmel-samd/common-hal/busio/UART.c:240
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:288
#: ports/atmel-samd/common-hal/busio/UART.c:294
msgid "No TX pin"
msgstr ""
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:153
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
msgid "Cannot get pull while in output mode"
msgstr ""
@ -419,14 +423,14 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
msgid "Invalid PWM frequency"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187
msgid "All timers for this pin are in use"
msgstr "Todos los timers para este pin están siendo utilizado"
msgstr "Todos los timers para este pin están siendo utilizados"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110
msgid "No hardware support on pin"
@ -434,7 +438,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:113
msgid "EXTINT channel already in use"
msgstr "El canal EXTINT ya esta siendo usado"
msgstr "El canal EXTINT ya está siendo utilizado"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:118
#: ports/esp8266/common-hal/pulseio/PulseIn.c:86
@ -461,9 +465,8 @@ msgid "Both pins must support hardware interrupts"
msgstr "Ambos pines deben soportar interrupciones por hardware"
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c:46
#, fuzzy
msgid "A hardware interrupt channel is already in use"
msgstr "El canal EXTINT ya esta siendo usado"
msgstr "El canal EXTINT ya está siendo utilizado"
#: ports/atmel-samd/common-hal/rtc/RTC.c:101
msgid "calibration value out of range +/-127"
@ -703,11 +706,23 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
msgid "All I2C peripherals are in use"
msgstr "Todos los timers están siendo utilizados"
#: ports/nrf/common-hal/busio/SPI.c:109
msgid "All SPI peripherals are in use"
msgstr "Todos los timers están siendo utilizados"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
#: ports/nrf/common-hal/busio/UART.c:86
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
msgid "busio.UART not yet implemented"
msgstr ""
@ -2005,6 +2020,7 @@ msgid "buffer must be a bytes-like object"
msgstr ""
#: shared-bindings/audioio/WaveFile.c:78
#: shared-bindings/displayio/OnDiskBitmap.c:85
msgid "file must be a file opened in byte mode"
msgstr ""
@ -2037,11 +2053,11 @@ msgstr ""
msgid "Function requires lock."
msgstr ""
#: shared-bindings/busio/UART.c:98
#: shared-bindings/busio/UART.c:102
msgid "bits must be 7, 8 or 9"
msgstr ""
#: shared-bindings/busio/UART.c:110
#: shared-bindings/busio/UART.c:114
msgid "stop must be 1 or 2"
msgstr ""
@ -2080,6 +2096,10 @@ msgstr ""
msgid "row data must be a buffer"
msgstr ""
#: shared-bindings/displayio/ColorConverter.c:72
msgid "color should be an int"
msgstr ""
#: shared-bindings/displayio/FourWire.c:55
#: shared-bindings/displayio/FourWire.c:64
msgid "displayio is a work in progress"
@ -2110,16 +2130,16 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: shared-bindings/displayio/Sprite.c:45
#: shared-bindings/displayio/Sprite.c:48
msgid "position must be 2-tuple"
msgstr ""
#: shared-bindings/displayio/Sprite.c:87
#: shared-bindings/displayio/Sprite.c:97
msgid "unsupported bitmap type"
msgstr ""
#: shared-bindings/displayio/Sprite.c:152
msgid "palette must be displayio.Palette"
#: shared-bindings/displayio/Sprite.c:162
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""
#: shared-bindings/gamepad/GamePad.c:100
@ -2150,7 +2170,7 @@ msgstr ""
#: shared-bindings/microcontroller/Pin.c:100
msgid "%q in use"
msgstr ""
msgstr "%q está siendo utilizado"
#: shared-bindings/microcontroller/__init__.c:126
msgid "Invalid run mode."
@ -2349,6 +2369,26 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:48
#, fuzzy
msgid "Group empty"
msgstr "heap vacío"
#: shared-module/displayio/OnDiskBitmap.c:49
#, fuzzy
msgid "Invalid BMP file"
msgstr "pin inválido"
#: shared-module/displayio/OnDiskBitmap.c:59
#, c-format
msgid "Only Windows format, uncompressed BMP supported %d"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:64
#, c-format
msgid "Only true color (24 bpp or higher) BMP supported %x"
msgstr ""
#: shared-module/struct/__init__.c:39
msgid "'S' and 'O' are not supported format types"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-06 14:55-0700\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-08-30 23:04-0700\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -123,7 +123,7 @@ msgstr "mali ang cert"
msgid "queue overflow"
msgstr "puno na ang pila (overflow)"
#: extmod/moduzlib.c:97
#: extmod/moduzlib.c:98
msgid "compression header"
msgstr "compression header"
@ -226,7 +226,7 @@ msgstr ""
"Pindutin ang anumang key upang ipasok ang REPL. Gamitin ang CTRL-D upang i-"
"reload."
#: main.c:415
#: main.c:416
msgid "soft reboot\n"
msgstr "malambot na reboot\n"
@ -243,15 +243,15 @@ msgstr "pagkakalibrate ay basahin lamang"
msgid "calibration is out of range"
msgstr "kalibrasion ay wala sa sakop"
#: ports/atmel-samd/board_busses.c:39 ports/nrf/board_busses.c:39
#: ports/atmel-samd/board_busses.c:59 ports/nrf/board_busses.c:39
msgid "No default I2C bus"
msgstr "Walang default na I2C bus"
#: ports/atmel-samd/board_busses.c:64 ports/nrf/board_busses.c:64
#: ports/atmel-samd/board_busses.c:85 ports/nrf/board_busses.c:64
msgid "No default SPI bus"
msgstr "Walang default SPI bus"
#: ports/atmel-samd/board_busses.c:91 ports/nrf/board_busses.c:91
#: ports/atmel-samd/board_busses.c:112 ports/nrf/board_busses.c:91
msgid "No default UART bus"
msgstr "Walang default UART bus"
@ -303,12 +303,12 @@ msgid "Too many channels in sample."
msgstr "Sobra ang channels sa sample."
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr "Walang DMA channel na mahanap"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "Hindi ma-allocate ang buffers para sa naka-sign na conversion"
@ -350,16 +350,21 @@ msgstr "Mali ang pin para sa kanang channel"
msgid "Cannot output both channels on the same pin"
msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Lahat ng timer ginagamit"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Lahat ng event channels ginagamit"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "Hindi sapat ang magagamit na pins"
@ -368,7 +373,7 @@ msgstr "Hindi sapat ang magagamit na pins"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:58
#: ports/nrf/common-hal/busio/I2C.c:77
msgid "Invalid pins"
msgstr "Mali ang pins"
@ -388,24 +393,24 @@ msgstr "hindi sinusuportahan ang bytes > 8 bits"
msgid "tx and rx cannot both be None"
msgstr "tx at rx hindi pwedeng parehas na None"
#: ports/atmel-samd/common-hal/busio/UART.c:139
#: ports/atmel-samd/common-hal/busio/UART.c:145
msgid "Failed to allocate RX buffer"
msgstr "Nabigong ilaan ang RX buffer"
#: ports/atmel-samd/common-hal/busio/UART.c:147
#: ports/atmel-samd/common-hal/busio/UART.c:153
msgid "Could not initialize UART"
msgstr "Hindi ma-initialize ang UART"
#: ports/atmel-samd/common-hal/busio/UART.c:234
#: ports/atmel-samd/common-hal/busio/UART.c:240
msgid "No RX pin"
msgstr "Walang RX pin"
#: ports/atmel-samd/common-hal/busio/UART.c:288
#: ports/atmel-samd/common-hal/busio/UART.c:294
msgid "No TX pin"
msgstr "Walang TX pin"
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:153
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
msgid "Cannot get pull while in output mode"
msgstr "Hindi makakakuha ng pull habang nasa output mode"
@ -415,12 +420,12 @@ msgid "Cannot reset into bootloader because no bootloader is present."
msgstr "Hindi ma-reset sa bootloader dahil walang bootloader."
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
msgid "Invalid PWM frequency"
msgstr "Mali ang PWM frequency"
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187
msgid "All timers for this pin are in use"
msgstr "Lahat ng timers para sa pin na ito ay ginagamit"
@ -700,11 +705,25 @@ msgstr "hindi alam na config param"
msgid "AnalogOut functionality not supported"
msgstr "Hindi supportado ang AnalogOut"
#: ports/nrf/common-hal/busio/I2C.c:91
#, fuzzy
msgid "All I2C peripherals are in use"
msgstr "Lahat ng timer ginagamit"
#: ports/nrf/common-hal/busio/SPI.c:109
#, fuzzy
msgid "All SPI peripherals are in use"
msgstr "Lahat ng timer ginagamit"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
#: ports/nrf/common-hal/busio/UART.c:86
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
msgid "busio.UART not yet implemented"
msgstr "hindi pa implemented ang busio.UART"
@ -1998,6 +2017,7 @@ msgid "buffer must be a bytes-like object"
msgstr "buffer ay dapat bytes-like object"
#: shared-bindings/audioio/WaveFile.c:78
#: shared-bindings/displayio/OnDiskBitmap.c:85
msgid "file must be a file opened in byte mode"
msgstr "file ay dapat buksan sa byte mode"
@ -2030,11 +2050,11 @@ msgstr "aarehas na haba dapat ang buffer slices"
msgid "Function requires lock."
msgstr "Kailangan ng lock ang function."
#: shared-bindings/busio/UART.c:98
#: shared-bindings/busio/UART.c:102
msgid "bits must be 7, 8 or 9"
msgstr "bits ay dapat 7, 8 o 9"
#: shared-bindings/busio/UART.c:110
#: shared-bindings/busio/UART.c:114
msgid "stop must be 1 or 2"
msgstr "stop dapat 1 o 2"
@ -2077,6 +2097,11 @@ msgstr ""
msgid "row data must be a buffer"
msgstr "constant ay dapat na integer"
#: shared-bindings/displayio/ColorConverter.c:72
#, fuzzy
msgid "color should be an int"
msgstr "Haba ay dapat int"
#: shared-bindings/displayio/FourWire.c:55
#: shared-bindings/displayio/FourWire.c:64
msgid "displayio is a work in progress"
@ -2113,20 +2138,19 @@ msgstr "buffer ay dapat bytes-like object"
msgid "palette_index should be an int"
msgstr ""
#: shared-bindings/displayio/Sprite.c:45
#: shared-bindings/displayio/Sprite.c:48
#, fuzzy
msgid "position must be 2-tuple"
msgstr "stop dapat 1 o 2"
#: shared-bindings/displayio/Sprite.c:87
#: shared-bindings/displayio/Sprite.c:97
#, fuzzy
msgid "unsupported bitmap type"
msgstr "Hindi supportadong baudrate"
#: shared-bindings/displayio/Sprite.c:152
#, fuzzy
msgid "palette must be displayio.Palette"
msgstr "ang palette ay dapat 32 bytes ang haba"
#: shared-bindings/displayio/Sprite.c:162
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""
#: shared-bindings/gamepad/GamePad.c:100
msgid "too many arguments"
@ -2357,6 +2381,26 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:48
#, fuzzy
msgid "Group empty"
msgstr "walang laman"
#: shared-module/displayio/OnDiskBitmap.c:49
#, fuzzy
msgid "Invalid BMP file"
msgstr "Mali ang file"
#: shared-module/displayio/OnDiskBitmap.c:59
#, c-format
msgid "Only Windows format, uncompressed BMP supported %d"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:64
#, c-format
msgid "Only true color (24 bpp or higher) BMP supported %x"
msgstr ""
#: shared-module/struct/__init__.c:39
msgid "'S' and 'O' are not supported format types"
msgstr "Ang 'S' at 'O' ay hindi suportadong uri ng format"
@ -2364,3 +2408,7 @@ msgstr "Ang 'S' at 'O' ay hindi suportadong uri ng format"
#: shared-module/struct/__init__.c:83
msgid "too many arguments provided with the given format"
msgstr "masyadong maraming mga argumento na ibinigay sa ibinigay na format"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "ang palette ay dapat 32 bytes ang haba"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-06 14:55-0700\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-08-14 11:01+0200\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -122,7 +122,7 @@ msgstr "certificat invalide"
msgid "queue overflow"
msgstr "dépassement de file"
#: extmod/moduzlib.c:97
#: extmod/moduzlib.c:98
msgid "compression header"
msgstr "entête de compression"
@ -221,7 +221,7 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger."
#: main.c:415
#: main.c:416
msgid "soft reboot\n"
msgstr "redémarrage logiciel\n"
@ -238,15 +238,15 @@ msgstr "la calibration est en lecture seule"
msgid "calibration is out of range"
msgstr "la calibration est hors gamme"
#: ports/atmel-samd/board_busses.c:39 ports/nrf/board_busses.c:39
#: ports/atmel-samd/board_busses.c:59 ports/nrf/board_busses.c:39
msgid "No default I2C bus"
msgstr "Pas de bus I2C par défaut"
#: ports/atmel-samd/board_busses.c:64 ports/nrf/board_busses.c:64
#: ports/atmel-samd/board_busses.c:85 ports/nrf/board_busses.c:64
msgid "No default SPI bus"
msgstr "Pas de bus SPI par défaut"
#: ports/atmel-samd/board_busses.c:91 ports/nrf/board_busses.c:91
#: ports/atmel-samd/board_busses.c:112 ports/nrf/board_busses.c:91
msgid "No default UART bus"
msgstr "Pas de bus UART par défaut"
@ -298,12 +298,12 @@ msgid "Too many channels in sample."
msgstr "Trop de canaux dans l'échantillon."
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr "Aucun canal DMA trouvé"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "Impossible d'allouer des tampons pour une conversion signée"
@ -345,16 +345,21 @@ msgstr "Broche invalide pour le canal droit"
msgid "Cannot output both channels on the same pin"
msgstr "On ne peut mettre les deux canaux sur la même broche"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Tous les timers sont utilisés"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Tous les canaux d'événements sont utilisés"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "Pas assez de broches disponibles"
@ -363,7 +368,7 @@ msgstr "Pas assez de broches disponibles"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:58
#: ports/nrf/common-hal/busio/I2C.c:77
msgid "Invalid pins"
msgstr "Broche invalide"
@ -383,24 +388,24 @@ msgstr "octets > 8 bits non supporté"
msgid "tx and rx cannot both be None"
msgstr "TX et RX ne peuvent être None tous les deux"
#: ports/atmel-samd/common-hal/busio/UART.c:139
#: ports/atmel-samd/common-hal/busio/UART.c:145
msgid "Failed to allocate RX buffer"
msgstr "Echec de l'allocation du tampon RX"
#: ports/atmel-samd/common-hal/busio/UART.c:147
#: ports/atmel-samd/common-hal/busio/UART.c:153
msgid "Could not initialize UART"
msgstr "L'UART n'a pu être initialisé"
#: ports/atmel-samd/common-hal/busio/UART.c:234
#: ports/atmel-samd/common-hal/busio/UART.c:240
msgid "No RX pin"
msgstr "Pas de broche RX"
#: ports/atmel-samd/common-hal/busio/UART.c:288
#: ports/atmel-samd/common-hal/busio/UART.c:294
msgid "No TX pin"
msgstr "Pas de broche TX"
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:153
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
msgid "Cannot get pull while in output mode"
msgstr "Ne peux être tirer ('pull') en mode 'output'"
@ -411,12 +416,12 @@ msgstr ""
"Ne peut être redémarré vers le bootloader car il n'y a pas de bootloader."
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
msgid "Invalid PWM frequency"
msgstr "Fréquence de PWM invalide"
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:187
msgid "All timers for this pin are in use"
msgstr "Tous les timers pour cette broche sont utilisés"
@ -696,11 +701,25 @@ msgstr "paramètre de config. inconnu"
msgid "AnalogOut functionality not supported"
msgstr "AnalogOut non supporté"
#: ports/nrf/common-hal/busio/I2C.c:91
#, fuzzy
msgid "All I2C peripherals are in use"
msgstr "Tous les timers sont utilisés"
#: ports/nrf/common-hal/busio/SPI.c:109
#, fuzzy
msgid "All SPI peripherals are in use"
msgstr "Tous les timers sont utilisés"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
#: ports/nrf/common-hal/busio/UART.c:86
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
msgid "busio.UART not yet implemented"
msgstr "busio.UART pas encore implémenté"
@ -1989,6 +2008,7 @@ msgid "buffer must be a bytes-like object"
msgstr "le tampon doit être un objet bytes-like"
#: shared-bindings/audioio/WaveFile.c:78
#: shared-bindings/displayio/OnDiskBitmap.c:85
msgid "file must be a file opened in byte mode"
msgstr "le fichier doit être un fichier ouvert en mode byte"
@ -2021,11 +2041,11 @@ msgstr "les slices de tampon doivent être de longueurs égales"
msgid "Function requires lock."
msgstr "La fonction nécessite un verrou."
#: shared-bindings/busio/UART.c:98
#: shared-bindings/busio/UART.c:102
msgid "bits must be 7, 8 or 9"
msgstr "bits doivent être 7, 8 ou 9"
#: shared-bindings/busio/UART.c:110
#: shared-bindings/busio/UART.c:114
msgid "stop must be 1 or 2"
msgstr "stop doit être 1 ou 2"
@ -2068,6 +2088,11 @@ msgstr ""
msgid "row data must be a buffer"
msgstr "les constantes doivent être des entiers"
#: shared-bindings/displayio/ColorConverter.c:72
#, fuzzy
msgid "color should be an int"
msgstr "La longueur doit être entière"
#: shared-bindings/displayio/FourWire.c:55
#: shared-bindings/displayio/FourWire.c:64
msgid "displayio is a work in progress"
@ -2105,20 +2130,19 @@ msgstr "le tampon doit être un objet bytes-like"
msgid "palette_index should be an int"
msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'"
#: shared-bindings/displayio/Sprite.c:45
#: shared-bindings/displayio/Sprite.c:48
#, fuzzy
msgid "position must be 2-tuple"
msgstr "stop doit être 1 ou 2"
#: shared-bindings/displayio/Sprite.c:87
#: shared-bindings/displayio/Sprite.c:97
#, fuzzy
msgid "unsupported bitmap type"
msgstr "Débit non supporté"
#: shared-bindings/displayio/Sprite.c:152
#, fuzzy
msgid "palette must be displayio.Palette"
msgstr "la palette doit être longue de 32 octets"
#: shared-bindings/displayio/Sprite.c:162
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
msgstr ""
#: shared-bindings/gamepad/GamePad.c:100
msgid "too many arguments"
@ -2353,6 +2377,26 @@ msgstr ""
msgid "Group full"
msgstr ""
#: shared-module/displayio/Group.c:48
#, fuzzy
msgid "Group empty"
msgstr "vide"
#: shared-module/displayio/OnDiskBitmap.c:49
#, fuzzy
msgid "Invalid BMP file"
msgstr "Fichier invalide"
#: shared-module/displayio/OnDiskBitmap.c:59
#, c-format
msgid "Only Windows format, uncompressed BMP supported %d"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c:64
#, c-format
msgid "Only true color (24 bpp or higher) BMP supported %x"
msgstr ""
#: shared-module/struct/__init__.c:39
msgid "'S' and 'O' are not supported format types"
msgstr "'S' et 'O' ne sont pas des types de format supportés"
@ -2364,3 +2408,7 @@ msgstr "trop d'arguments fournis avec ce format"
#, fuzzy
#~ msgid "value_size must be power of two"
#~ msgstr "'len' doit être un multiple de 4"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "la palette doit être longue de 32 octets"

View File

@ -113,7 +113,7 @@ else
# -finline-limit=80 or so is similar to not having it on.
# There is no simple default value, though.
ifdef INTERNAL_FLASH_FILESYSTEM
CFLAGS += -finline-limit=55
CFLAGS += -finline-limit=50
endif
ifdef CFLAGS_INLINE_LIMIT
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
@ -384,7 +384,9 @@ SRC_SHARED_MODULE = \
busio/OneWire.c \
displayio/__init__.c \
displayio/Bitmap.c \
displayio/ColorConverter.c \
displayio/Group.c \
displayio/OnDiskBitmap.c \
displayio/Palette.c \
displayio/Sprite.c \
gamepad/__init__.c \

View File

@ -385,7 +385,7 @@
// <i> Select the clock source for DAC.
#ifndef CONF_GCLK_DAC_SRC
#define CONF_GCLK_DAC_SRC GCLK_CLKCTRL_GEN_GCLK1_Val
#define CONF_GCLK_DAC_SRC GCLK_CLKCTRL_GEN_GCLK0_Val
#endif
/**
@ -393,7 +393,7 @@
* \brief DAC's Clock frequency
*/
#ifndef CONF_GCLK_DAC_FREQUENCY
#define CONF_GCLK_DAC_FREQUENCY 320000
#define CONF_GCLK_DAC_FREQUENCY 48000000
#endif
// <y> USB Clock Source

View File

@ -34,81 +34,96 @@
#include "samd/pins.h"
#include "py/runtime.h"
#if !defined(DEFAULT_I2C_BUS_SDA) || !defined(DEFAULT_I2C_BUS_SCL)
STATIC mp_obj_t board_i2c(void) {
mp_raise_NotImplementedError(translate("No default I2C bus"));
return NULL;
#define BOARD_I2C (defined(DEFAULT_I2C_BUS_SDA) && defined(DEFAULT_I2C_BUS_SCL))
#define BOARD_SPI (defined(DEFAULT_SPI_BUS_SCK) && defined(DEFAULT_SPI_BUS_MISO) && defined(DEFAULT_SPI_BUS_MOSI))
#define BOARD_UART (defined(DEFAULT_UART_BUS_RX) && defined(DEFAULT_UART_BUS_TX))
#if BOARD_I2C
STATIC mp_obj_t i2c_singleton = NULL;
STATIC mp_obj_t board_i2c(void) {
if (i2c_singleton == NULL) {
busio_i2c_obj_t *self = m_new_obj(busio_i2c_obj_t);
self->base.type = &busio_i2c_type;
assert_pin_free(DEFAULT_I2C_BUS_SDA);
assert_pin_free(DEFAULT_I2C_BUS_SCL);
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
i2c_singleton = (mp_obj_t)self;
}
return i2c_singleton;
}
#else
STATIC mp_obj_t i2c_singleton = NULL;
STATIC mp_obj_t board_i2c(void) {
if (i2c_singleton == NULL) {
busio_i2c_obj_t *self = m_new_obj(busio_i2c_obj_t);
self->base.type = &busio_i2c_type;
assert_pin_free(DEFAULT_I2C_BUS_SDA);
assert_pin_free(DEFAULT_I2C_BUS_SCL);
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
i2c_singleton = (mp_obj_t)self;
}
return i2c_singleton;
}
STATIC mp_obj_t board_i2c(void) {
mp_raise_NotImplementedError(translate("No default I2C bus"));
return NULL;
}
#endif
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
#if !defined(DEFAULT_SPI_BUS_SCK) || !defined(DEFAULT_SPI_BUS_MISO) || !defined(DEFAULT_SPI_BUS_MOSI)
STATIC mp_obj_t board_spi(void) {
mp_raise_NotImplementedError(translate("No default SPI bus"));
return NULL;
#if BOARD_SPI
STATIC mp_obj_t spi_singleton = NULL;
STATIC mp_obj_t board_spi(void) {
if (spi_singleton == NULL) {
busio_spi_obj_t *self = m_new_obj(busio_spi_obj_t);
self->base.type = &busio_spi_type;
assert_pin_free(DEFAULT_SPI_BUS_SCK);
assert_pin_free(DEFAULT_SPI_BUS_MOSI);
assert_pin_free(DEFAULT_SPI_BUS_MISO);
const mcu_pin_obj_t* clock = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_SCK);
const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MOSI);
const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MISO);
common_hal_busio_spi_construct(self, clock, mosi, miso);
spi_singleton = (mp_obj_t)self;
}
return spi_singleton;
}
#else
STATIC mp_obj_t spi_singleton = NULL;
STATIC mp_obj_t board_spi(void) {
if (spi_singleton == NULL) {
busio_spi_obj_t *self = m_new_obj(busio_spi_obj_t);
self->base.type = &busio_spi_type;
assert_pin_free(DEFAULT_SPI_BUS_SCK);
assert_pin_free(DEFAULT_SPI_BUS_MOSI);
assert_pin_free(DEFAULT_SPI_BUS_MISO);
const mcu_pin_obj_t* clock = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_SCK);
const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MOSI);
const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MISO);
common_hal_busio_spi_construct(self, clock, mosi, miso);
spi_singleton = (mp_obj_t)self;
}
return spi_singleton;
}
STATIC mp_obj_t board_spi(void) {
mp_raise_NotImplementedError(translate("No default SPI bus"));
return NULL;
}
#endif
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
#if !defined(DEFAULT_UART_BUS_RX) || !defined(DEFAULT_UART_BUS_TX)
STATIC mp_obj_t board_uart(void) {
mp_raise_NotImplementedError(translate("No default UART bus"));
return NULL;
#if BOARD_UART
STATIC mp_obj_t uart_singleton = NULL;
STATIC mp_obj_t board_uart(void) {
if (uart_singleton == NULL) {
busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
self->base.type = &busio_uart_type;
assert_pin_free(DEFAULT_UART_BUS_RX);
assert_pin_free(DEFAULT_UART_BUS_TX);
const mcu_pin_obj_t* rx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RX);
const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_TX);
common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1000, 64);
uart_singleton = (mp_obj_t)self;
}
return uart_singleton;
}
#else
STATIC mp_obj_t uart_singleton = NULL;
STATIC mp_obj_t board_uart(void) {
if (uart_singleton == NULL) {
busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
self->base.type = &busio_uart_type;
assert_pin_free(DEFAULT_UART_BUS_RX);
assert_pin_free(DEFAULT_UART_BUS_TX);
const mcu_pin_obj_t* rx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RX);
const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_TX);
common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1000, 64);
uart_singleton = (mp_obj_t)self;
}
return uart_singleton;
}
STATIC mp_obj_t board_uart(void) {
mp_raise_NotImplementedError(translate("No default UART bus"));
return NULL;
}
#endif
MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);
void reset_board_busses(void) {
#if BOARD_I2C
i2c_singleton = NULL;
#endif
#if BOARD_SPI
spi_singleton = NULL;
#endif
#if BOARD_UART
uart_singleton = NULL;
#endif
}

View File

@ -36,4 +36,6 @@ extern mp_obj_fun_builtin_fixed_t board_spi_obj;
void board_uart(void);
extern mp_obj_fun_builtin_fixed_t board_uart_obj;
void reset_board_busses(void);
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_BUSSES_H

View File

@ -27,6 +27,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },

View File

@ -42,5 +42,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_CLKM), MP_ROM_PTR(&pin_PC16) },
{ MP_ROM_QSTR(MP_QSTR_RF_SCK), MP_ROM_PTR(&pin_PC18) },
{ MP_ROM_QSTR(MP_QSTR_RF_MISO), MP_ROM_PTR(&pin_PC19) },
{ MP_ROM_QSTR(MP_QSTR_RESETN), MP_ROM_PTR(&pin_PB15) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -62,4 +62,4 @@
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_DISPLAYIO
#define CIRCUITPY_DISPLAYIO (1)

View File

@ -42,8 +42,12 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXEL), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_SENSE), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_PA00) },

View File

@ -0,0 +1,39 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 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 "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,40 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Trellis M4 Express"
#define MICROPY_HW_MCU_NAME "samd51g19"
#define CIRCUITPY_MCU_FAMILY samd51
// This is for Rev A
#define MICROPY_HW_APA102_MOSI (&pin_PA01)
#define MICROPY_HW_APA102_SCK (&pin_PA00)
#define CIRCUITPY_BITBANG_APA102
// These are pins not to reset.
// QSPI Data pins & DotStar pins
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
// QSPI CS, and QSPI SCK
#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define AUTORESET_DELAY_MS 500
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code
#define CIRCUITPY_INTERNAL_NVM_SIZE 8192
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#include "external_flash/devices.h"
#define EXTERNAL_FLASH_DEVICE_COUNT 1
#define EXTERNAL_FLASH_DEVICES GD25Q64C
#include "external_flash/external_flash.h"
#define DEFAULT_I2C_BUS_SCL (&pin_PB08)
#define DEFAULT_I2C_BUS_SDA (&pin_PB09)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,11 @@
LD_FILE = boards/samd51x19-bootloader-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8030
USB_PRODUCT = "Trellis M4 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
QSPI_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

View File

@ -0,0 +1,44 @@
#include "shared-bindings/board/__init__.h"
#include "board_busses.h"
// This mapping only includes functional names because pins broken
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) }, // INT pin
{ MP_OBJ_NEW_QSTR(MP_QSTR_MICOUT), MP_ROM_PTR(&pin_PA06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MICIN), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB09) },
// Key Grid columns
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL0), MP_ROM_PTR(&pin_PA14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL1), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL2), MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL3), MP_ROM_PTR(&pin_PA17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL4), MP_ROM_PTR(&pin_PA20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL5), MP_ROM_PTR(&pin_PA21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL6), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_COL7), MP_ROM_PTR(&pin_PA23) },
// Key Grid rows
{ MP_OBJ_NEW_QSTR(MP_QSTR_ROW0), MP_ROM_PTR(&pin_PA18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ROW1), MP_ROM_PTR(&pin_PA19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ROW2), MP_ROM_PTR(&pin_PB22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ROW3), MP_ROM_PTR(&pin_PB23) },
// IRQ/GPIO pin
{ MP_OBJ_NEW_QSTR(MP_QSTR_INT), MP_ROM_PTR(&pin_PA04) },
// NeoPixels
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -110,13 +110,14 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
_pm_enable_bus_clock(PM_BUS_APBC, DAC);
#endif
// SAMD21: This clock should be <= 12 MHz, per datasheet section 47.6.3.
// SAMD51: This clock should be <= 350kHz, per datasheet table 37-6.
// SAMD51: This clock should be <= 12 MHz, per datasheet section 47.6.3.
// SAMD21: This clock is 48mhz despite the datasheet saying it must only be <= 350kHz, per
// datasheet table 37-6. It's incorrect because the max output rate is 350ksps and is only
// achieved when the GCLK is more than 8mhz.
_gclk_enable_channel(DAC_GCLK_ID, CONF_GCLK_DAC_SRC);
DAC->CTRLA.bit.SWRST = 1;
while (DAC->CTRLA.bit.SWRST == 1) {}
DAC->CTRLA.bit.SWRST = 1;
while (DAC->CTRLA.bit.SWRST == 1) {}
bool channel0_enabled = true;
#ifdef SAMD51
@ -127,9 +128,11 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
if (channel0_enabled) {
#ifdef SAMD21
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI;
// We disable the voltage pump because we always run at 3.3v.
DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC |
DAC_CTRLB_LEFTADJ |
DAC_CTRLB_EOEN;
DAC_CTRLB_EOEN |
DAC_CTRLB_VPD;
#endif
#ifdef SAMD51
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI0;
@ -283,6 +286,16 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t* self,
common_hal_audioio_audioout_stop(self);
}
audio_dma_result result = AUDIO_DMA_OK;
uint32_t sample_rate = audiosample_sample_rate(sample);
#ifdef SAMD21
uint32_t max_sample_rate = 350000;
#endif
#ifdef SAMD51
uint32_t max_sample_rate = 1000000;
#endif
if (sample_rate > max_sample_rate) {
mp_raise_ValueError_varg(translate("Sample rate too high. It must be less than %d"), max_sample_rate);
}
#ifdef SAMD21
result = audio_dma_setup_playback(&self->left_dma, sample, loop, true, 0,
false /* output unsigned */,

View File

@ -133,7 +133,13 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
if (rx && receiver_buffer_size > 0) {
self->buffer_length = receiver_buffer_size;
self->buffer = (uint8_t *) gc_alloc(self->buffer_length * sizeof(uint8_t), false, false);
// Initially allocate the UART's buffer in the long-lived part of the
// heap. UARTs are generally long-lived objects, but the "make long-
// lived" machinery is incapable of moving internal pointers like
// self->buffer, so do it manually. (However, as long as internal
// pointers like this are NOT moved, allocating the buffer
// in the long-lived pool is not strictly necessary)
self->buffer = (uint8_t *) gc_alloc(self->buffer_length * sizeof(uint8_t), false, true);
if (self->buffer == NULL) {
common_hal_busio_uart_deinit(self);
mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer"));
@ -268,7 +274,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
// If we are zero timeout, make sure we don't loop again (in the event
// If we are zero timeout, make sure we don't loop again (in the event
// we read in under 1ms)
if (self->timeout_ms == 0)
break;
@ -344,7 +350,18 @@ void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrat
}
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
return self->buffer_size;
// This assignment is only here because the usart_async routines take a *const argument.
struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc;
struct usart_async_status async_status;
usart_async_get_status(usart_desc_p, &async_status);
return async_status.rxcnt;
}
void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
// This assignment is only here because the usart_async routines take a *const argument.
struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc;
usart_async_flush_rx_buffer(usart_desc_p);
}
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {

View File

@ -42,10 +42,6 @@ typedef struct {
bool rx_error;
uint32_t baudrate;
uint32_t timeout_ms;
// Index of the oldest received character.
uint32_t buffer_start;
// Index of the next available spot to store a character.
uint32_t buffer_size;
uint32_t buffer_length;
uint8_t* buffer;
} busio_uart_obj_t;

View File

@ -109,16 +109,16 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
asm("nop; nop;");
#endif
#ifdef SAMD51
delay_cycles(3);
delay_cycles(2);
#endif
if(p & bitMask) {
if((p & bitMask) != 0) {
// This is the high delay unique to a one bit.
// For the SK6812 its 0.3us
#ifdef SAMD21
asm("nop; nop; nop; nop; nop; nop; nop;");
#endif
#ifdef SAMD51
delay_cycles(11);
delay_cycles(3);
#endif
*clr = pinMask;
} else {
@ -129,7 +129,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
asm("nop; nop;");
#endif
#ifdef SAMD51
delay_cycles(3);
delay_cycles(2);
#endif
}
if((bitMask >>= 1) != 0) {
@ -140,7 +140,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
asm("nop; nop; nop; nop; nop;");
#endif
#ifdef SAMD51
delay_cycles(20);
delay_cycles(4);
#endif
} else {
if(ptr >= end) break;
@ -151,7 +151,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
// above operations take.
// For the SK6812 its 0.6us +- 0.15us
#ifdef SAMD51
delay_cycles(15);
delay_cycles(3);
#endif
}
}

View File

@ -52,10 +52,10 @@ uint8_t tcc_refcount[TCC_INST_NUM];
// This bitmask keeps track of which channels of a TCC are currently claimed.
#ifdef SAMD21
uint8_t tcc_channels[3] = {0xf0, 0xfc, 0xfc};
uint8_t tcc_channels[3]; // Set by pwmout_reset() to {0xf0, 0xfc, 0xfc} initially.
#endif
#ifdef SAMD51
uint8_t tcc_channels[5] = {0xc0, 0xf0, 0xf8, 0xfc, 0xfc};
uint8_t tcc_channels[5]; // Set by pwmout_reset() to {0xc0, 0xf0, 0xf8, 0xfc, 0xfc} initially.
#endif
void pwmout_reset(void) {
@ -76,7 +76,7 @@ void pwmout_reset(void) {
for (uint8_t j = 0; j < tcc_cc_num[i]; j++) {
mask <<= 1;
}
tcc_channels[i] = 0xf0;
tcc_channels[i] = mask;
tccs[i]->CTRLA.bit.SWRST = 1;
}
Tc *tcs[TC_INST_NUM] = TC_INSTS;
@ -123,7 +123,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
// Figure out which timer we are using.
// First see if a tcc is already going with the frequency we want and our
// channel is unused. tc's don't have neough channels to share.
// channel is unused. tc's don't have enough channels to share.
const pin_timer_t* timer = NULL;
uint8_t mux_position = 0;
if (!variable_frequency) {
@ -140,6 +140,9 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
if (tcc->CTRLA.bit.ENABLE == 1 && channel_ok(t)) {
timer = t;
mux_position = j;
// Claim channel.
tcc_channels[timer->index] |= (1 << tcc_channel(timer));
}
}
}

View File

@ -61,6 +61,7 @@
#include "samd/external_interrupts.h"
#include "samd/dma.h"
#include "shared-bindings/rtc/__init__.h"
#include "board_busses.h"
#include "tick.h"
#include "usb.h"
@ -278,6 +279,8 @@ void reset_port(void) {
reset_all_pins();
reset_board_busses();
// Output clocks for debugging.
// not supported by SAMD51G; uncomment for SAMD51J or update for 51G
// #ifdef SAMD51

View File

@ -288,7 +288,7 @@ void usb_write(const char* buffer, uint32_t len) {
return;
}
uint8_t * output_buffer;
uint8_t output_len;
uint32_t output_len;
while (len > 0) {
while (usb_transmitting) {}
output_buffer = (uint8_t *) buffer;

View File

@ -138,6 +138,9 @@ uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
return 0;
}
void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
}
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {
return true;
}

View File

@ -29,6 +29,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_11) },

View File

@ -34,8 +34,27 @@
#include "nrfx_twim.h"
#include "nrf_gpio.h"
#include "nrfx_spim.h"
#include "nrf_gpio.h"
STATIC twim_peripheral_t twim_peripherals[] = {
#if NRFX_CHECK(NRFX_TWIM0_ENABLED)
// SPIM0 and TWIM0 share an address.
{ .twim = NRFX_TWIM_INSTANCE(0),
.in_use = false,
.max_xfer_size = TWIM0_EASYDMA_MAXCNT_SIZE,
},
#endif
#if NRFX_CHECK(NRFX_TWIM1_ENABLED)
// SPIM1 and TWIM1 share an address.
{ .twim = NRFX_TWIM_INSTANCE(1),
.in_use = false,
.max_xfer_size = TWIM1_EASYDMA_MAXCNT_SIZE,
},
#endif
};
#define INST_NO 0
#define MAX_XFER_SIZE ((1U << NRFX_CONCAT_3(TWIM, INST_NO, _EASYDMA_MAXCNT_SIZE)) - 1)
static uint8_t twi_error_to_mp(const nrfx_err_t err) {
switch (err) {
@ -54,11 +73,23 @@ static uint8_t twi_error_to_mp(const nrfx_err_t err) {
}
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) {
if (scl->number == sda->number)
if (scl->number == sda->number) {
mp_raise_ValueError(translate("Invalid pins"));
}
const nrfx_twim_t instance = NRFX_TWIM_INSTANCE(INST_NO);
self->twim = instance;
// Find a free instance.
self->twim_peripheral = NULL;
for (size_t i = 0 ; i < MP_ARRAY_SIZE(twim_peripherals); i++) {
if (!twim_peripherals[i].in_use) {
self->twim_peripheral = &twim_peripherals[i];
self->twim_peripheral->in_use = true;
break;
}
}
if (self->twim_peripheral == NULL) {
mp_raise_ValueError(translate("All I2C peripherals are in use"));
}
nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG;
config.scl = scl->number;
@ -76,12 +107,12 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
claim_pin(sda);
claim_pin(scl);
nrfx_err_t err = nrfx_twim_init(&self->twim, &config, NULL, NULL);
nrfx_err_t err = nrfx_twim_init(&self->twim_peripheral->twim, &config, NULL, NULL);
// A soft reset doesn't uninit the driver so we might end up with a invalid state
if (err == NRFX_ERROR_INVALID_STATE) {
nrfx_twim_uninit(&self->twim);
err = nrfx_twim_init(&self->twim, &config, NULL, NULL);
nrfx_twim_uninit(&self->twim_peripheral->twim);
err = nrfx_twim_init(&self->twim_peripheral->twim, &config, NULL, NULL);
}
if (err != NRFX_SUCCESS) {
@ -99,20 +130,22 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
if (common_hal_busio_i2c_deinited(self))
return;
nrfx_twim_uninit(&self->twim);
nrfx_twim_uninit(&self->twim_peripheral->twim);
reset_pin_number(self->sda_pin_number);
reset_pin_number(self->scl_pin_number);
self->sda_pin_number = NO_PIN;
self->scl_pin_number = NO_PIN;
self->twim_peripheral->in_use = false;
}
// nrfx_twim_tx doesn't support 0-length data so we fall back to the hal API
bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
NRF_TWIM_Type *reg = self->twim.p_twim;
NRF_TWIM_Type *reg = self->twim_peripheral->twim.p_twim;
bool found = true;
nrfx_twim_enable(&self->twim);
nrfx_twim_enable(&self->twim_peripheral->twim);
nrf_twim_address_set(reg, addr);
nrf_twim_tx_buffer_set(reg, NULL, 0);
@ -135,19 +168,19 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
found = false;
}
nrfx_twim_disable(&self->twim);
nrfx_twim_disable(&self->twim_peripheral->twim);
return found;
}
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
bool grabbed_lock = false;
// CRITICAL_SECTION_ENTER()
if (!self->has_lock) {
grabbed_lock = true;
self->has_lock = true;
}
// CRITICAL_SECTION_LEAVE();
// NRFX_CRITICAL_SECTION_ENTER();
if (!self->has_lock) {
grabbed_lock = true;
self->has_lock = true;
}
// NRFX_CRITICAL_SECTION_EXIT();
return grabbed_lock;
}
@ -163,22 +196,23 @@ uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, const u
if(len == 0)
return common_hal_busio_i2c_probe(self, addr) ? 0 : MP_ENODEV;
const uint32_t parts = len / MAX_XFER_SIZE;
const uint32_t remainder = len % MAX_XFER_SIZE;
const uint32_t max_xfer_size = self->twim_peripheral->max_xfer_size;
const uint32_t parts = len / max_xfer_size;
const uint32_t remainder = len % max_xfer_size;
nrfx_err_t err = NRFX_SUCCESS;
nrfx_twim_enable(&self->twim);
nrfx_twim_enable(&self->twim_peripheral->twim);
for (uint32_t i = 0; i < parts; ++i) {
err = nrfx_twim_tx(&self->twim, addr, data + i * MAX_XFER_SIZE, MAX_XFER_SIZE, !stopBit);
err = nrfx_twim_tx(&self->twim_peripheral->twim, addr, data + i * max_xfer_size, max_xfer_size, !stopBit);
if (err != NRFX_SUCCESS)
break;
}
if ((remainder > 0) && (err == NRFX_SUCCESS))
err = nrfx_twim_tx(&self->twim, addr, data + parts * MAX_XFER_SIZE, remainder, !stopBit);
err = nrfx_twim_tx(&self->twim_peripheral->twim, addr, data + parts * max_xfer_size, remainder, !stopBit);
nrfx_twim_disable(&self->twim);
nrfx_twim_disable(&self->twim_peripheral->twim);
return twi_error_to_mp(err);
}
@ -187,22 +221,23 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, uint8_t
if(len == 0)
return 0;
const uint32_t parts = len / MAX_XFER_SIZE;
const uint32_t remainder = len % MAX_XFER_SIZE;
const uint32_t max_xfer_size = self->twim_peripheral->max_xfer_size;
const uint32_t parts = len / max_xfer_size;
const uint32_t remainder = len % max_xfer_size;
nrfx_err_t err = NRFX_SUCCESS;
nrfx_twim_enable(&self->twim);
nrfx_twim_enable(&self->twim_peripheral->twim);
for (uint32_t i = 0; i < parts; ++i) {
err = nrfx_twim_rx(&self->twim, addr, data + i * MAX_XFER_SIZE, MAX_XFER_SIZE);
err = nrfx_twim_rx(&self->twim_peripheral->twim, addr, data + i * max_xfer_size, max_xfer_size);
if (err != NRFX_SUCCESS)
break;
}
if ((remainder > 0) && (err == NRFX_SUCCESS))
err = nrfx_twim_rx(&self->twim, addr, data + parts * MAX_XFER_SIZE, remainder);
err = nrfx_twim_rx(&self->twim_peripheral->twim, addr, data + parts * max_xfer_size, remainder);
nrfx_twim_disable(&self->twim);
nrfx_twim_disable(&self->twim_peripheral->twim);
return twi_error_to_mp(err);
}

View File

@ -32,8 +32,14 @@
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
nrfx_twim_t twim;
bool in_use;
uint8_t max_xfer_size;
} twim_peripheral_t;
typedef struct {
mp_obj_base_t base;
twim_peripheral_t* twim_peripheral;
bool has_lock;
uint8_t scl_pin_number;
uint8_t sda_pin_number;

View File

@ -27,40 +27,65 @@
#include "nrfx_spim.h"
#include "nrf_gpio.h"
#if NRFX_SPIM3_ENABLED
#define INST_NO 3
#else
#define INST_NO 2
STATIC spim_peripheral_t spim_peripherals[] = {
#if NRFX_CHECK(NRFX_SPIM3_ENABLED)
// SPIM3 exists only on nRF52840 and supports 32MHz max. All other SPIM's are only 8MHz max.
// Allocate SPIM3 first.
{ .spim = NRFX_SPIM_INSTANCE(3),
.max_frequency_MHz = 32,
.max_xfer_size = SPIM3_EASYDMA_MAXCNT_SIZE,
},
#endif
#define MAX_XFER_SIZE ((1U << NRFX_CONCAT_3(SPIM, INST_NO, _EASYDMA_MAXCNT_SIZE)) - 1)
#if NRFX_CHECK(NRFX_SPIM2_ENABLED)
// SPIM2 is not shared with a TWIM, so allocate before the shared ones.
{ .spim = NRFX_SPIM_INSTANCE(2),
.max_frequency_MHz = 8,
.max_xfer_size = SPIM2_EASYDMA_MAXCNT_SIZE,
},
#endif
#if NRFX_CHECK(NRFX_SPIM1_ENABLED)
// SPIM1 and TWIM1 share an address.
{ .spim = NRFX_SPIM_INSTANCE(1),
.max_frequency_MHz = 8,
.max_xfer_size = SPIM1_EASYDMA_MAXCNT_SIZE,
},
#endif
#if NRFX_CHECK(NRFX_SPIM0_ENABLED)
// SPIM0 and TWIM0 share an address.
{ .spim = NRFX_SPIM_INSTANCE(0),
.max_frequency_MHz = 8,
.max_xfer_size = SPIM0_EASYDMA_MAXCNT_SIZE,
},
#endif
};
// Convert frequency to clock-speed-dependent value
static nrf_spim_frequency_t baudrate_to_spim_frequency(const uint32_t baudrate) {
if (baudrate <= 125000)
if (baudrate <= 125000) {
return NRF_SPIM_FREQ_125K;
if (baudrate <= 250000)
}
if (baudrate <= 250000) {
return NRF_SPIM_FREQ_250K;
if (baudrate <= 500000)
}
if (baudrate <= 500000) {
return NRF_SPIM_FREQ_500K;
if (baudrate <= 1000000)
}
if (baudrate <= 1000000) {
return NRF_SPIM_FREQ_1M;
if (baudrate <= 2000000)
}
if (baudrate <= 2000000) {
return NRF_SPIM_FREQ_2M;
if (baudrate <= 4000000)
}
if (baudrate <= 4000000) {
return NRF_SPIM_FREQ_4M;
if (baudrate <= 8000000)
}
if (baudrate <= 8000000) {
return NRF_SPIM_FREQ_8M;
}
#ifdef SPIM_FREQUENCY_FREQUENCY_M16
if (baudrate <= 16000000)
if (baudrate <= 16000000) {
return NRF_SPIM_FREQ_16M;
}
#endif
#ifdef SPIM_FREQUENCY_FREQUENCY_M32
@ -71,8 +96,18 @@ static nrf_spim_frequency_t baudrate_to_spim_frequency(const uint32_t baudrate)
}
void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, const mcu_pin_obj_t * miso) {
const nrfx_spim_t instance = NRFX_SPIM_INSTANCE(INST_NO);
self->spim = instance;
// Find a free instance.
self->spim_peripheral = NULL;
for (size_t i = 0 ; i < MP_ARRAY_SIZE(spim_peripherals); i++) {
if ((spim_peripherals[i].spim.p_reg->ENABLE & SPIM_ENABLE_ENABLE_Msk) == 0) {
self->spim_peripheral = &spim_peripherals[i];
break;
}
}
if (self->spim_peripheral == NULL) {
mp_raise_ValueError(translate("All SPI peripherals are in use"));
}
nrfx_spim_config_t config = NRFX_SPIM_DEFAULT_CONFIG;
config.frequency = NRF_SPIM_FREQ_8M;
@ -97,12 +132,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
self->MISO_pin_number = NO_PIN;
}
nrfx_err_t err = nrfx_spim_init(&self->spim, &config, NULL, NULL);
nrfx_err_t err = nrfx_spim_init(&self->spim_peripheral->spim, &config, NULL, NULL);
// A soft reset doesn't uninit the driver so we might end up with a invalid state
if (err == NRFX_ERROR_INVALID_STATE) {
nrfx_spim_uninit(&self->spim);
err = nrfx_spim_init(&self->spim, &config, NULL, NULL);
nrfx_spim_uninit(&self->spim_peripheral->spim);
err = nrfx_spim_init(&self->spim_peripheral->spim, &config, NULL, NULL);
}
if (err != NRFX_SUCCESS) {
@ -119,7 +154,7 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
if (common_hal_busio_spi_deinited(self))
return;
nrfx_spim_uninit(&self->spim);
nrfx_spim_uninit(&self->spim_peripheral->spim);
reset_pin_number(self->clock_pin_number);
reset_pin_number(self->MOSI_pin_number);
@ -131,7 +166,11 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, ui
if (bits != 8)
return false;
nrf_spim_frequency_set(self->spim.p_reg, baudrate_to_spim_frequency(baudrate));
if (baudrate > self->spim_peripheral->max_frequency_MHz * 1000000) {
mp_raise_ValueError(translate("Baud rate too high for this SPI peripheral"));
return false;
}
nrf_spim_frequency_set(self->spim_peripheral->spim.p_reg, baudrate_to_spim_frequency(baudrate));
nrf_spim_mode_t mode = NRF_SPIM_MODE_0;
if (polarity) {
@ -140,19 +179,19 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, ui
mode = (phase) ? NRF_SPIM_MODE_1 : NRF_SPIM_MODE_0;
}
nrf_spim_configure(self->spim.p_reg, mode, NRF_SPIM_BIT_ORDER_MSB_FIRST);
nrf_spim_configure(self->spim_peripheral->spim.p_reg, mode, NRF_SPIM_BIT_ORDER_MSB_FIRST);
return true;
}
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
bool grabbed_lock = false;
// CRITICAL_SECTION_ENTER()
// if (!self->has_lock) {
grabbed_lock = true;
self->has_lock = true;
// }
// CRITICAL_SECTION_LEAVE();
// NRFX_CRITICAL_SECTION_ENTER();
if (!self->has_lock) {
grabbed_lock = true;
self->has_lock = true;
}
// NRFX_CRITICAL_SECTION_EXIT();
return grabbed_lock;
}
@ -168,18 +207,19 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *data, size
if (len == 0)
return true;
const uint32_t parts = len / MAX_XFER_SIZE;
const uint32_t remainder = len % MAX_XFER_SIZE;
const uint32_t max_xfer_size = self->spim_peripheral->max_xfer_size;
const uint32_t parts = len / max_xfer_size;
const uint32_t remainder = len % max_xfer_size;
for (uint32_t i = 0; i < parts; ++i) {
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(data + i * MAX_XFER_SIZE, MAX_XFER_SIZE);
if (nrfx_spim_xfer(&self->spim, &xfer, 0) != NRFX_SUCCESS)
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(data + i * max_xfer_size, max_xfer_size);
if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
return false;
}
if (remainder > 0) {
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(data + parts * MAX_XFER_SIZE, remainder);
if (nrfx_spim_xfer(&self->spim, &xfer, 0) != NRFX_SUCCESS)
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(data + parts * max_xfer_size, remainder);
if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
return false;
}
@ -190,18 +230,19 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len,
if (len == 0)
return true;
const uint32_t parts = len / MAX_XFER_SIZE;
const uint32_t remainder = len % MAX_XFER_SIZE;
const uint32_t max_xfer_size = self->spim_peripheral->max_xfer_size;
const uint32_t parts = len / max_xfer_size;
const uint32_t remainder = len % max_xfer_size;
for (uint32_t i = 0; i < parts; ++i) {
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(data + i * MAX_XFER_SIZE, MAX_XFER_SIZE);
if (nrfx_spim_xfer(&self->spim, &xfer, 0) != NRFX_SUCCESS)
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(data + i * max_xfer_size, max_xfer_size);
if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
return false;
}
if (remainder > 0) {
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(data + parts * MAX_XFER_SIZE, remainder);
if (nrfx_spim_xfer(&self->spim, &xfer, 0) != NRFX_SUCCESS)
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(data + parts * max_xfer_size, remainder);
if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
return false;
}
@ -212,20 +253,22 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin
if (len == 0)
return true;
const uint32_t parts = len / MAX_XFER_SIZE;
const uint32_t remainder = len % MAX_XFER_SIZE;
const uint32_t max_xfer_size = self->spim_peripheral->max_xfer_size;
const uint32_t parts = len / max_xfer_size;
const uint32_t remainder = len % max_xfer_size;
for (uint32_t i = 0; i < parts; ++i) {
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_SINGLE_XFER(data_out + i * MAX_XFER_SIZE, MAX_XFER_SIZE,
data_in + i * MAX_XFER_SIZE, MAX_XFER_SIZE);
if (nrfx_spim_xfer(&self->spim, &xfer, 0) != NRFX_SUCCESS)
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_SINGLE_XFER(data_out + i * max_xfer_size, max_xfer_size,
data_in + i * max_xfer_size, max_xfer_size);
if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
return false;
}
if (remainder > 0) {
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_SINGLE_XFER(data_out + parts * MAX_XFER_SIZE, remainder,
data_in + parts * MAX_XFER_SIZE, remainder);
if (nrfx_spim_xfer(&self->spim, &xfer, 0) != NRFX_SUCCESS)
const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_SINGLE_XFER(data_out + parts * max_xfer_size, remainder,
data_in + parts * max_xfer_size, remainder);
if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
return false;
}
@ -233,7 +276,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin
}
uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) {
switch (self->spim.p_reg->FREQUENCY) {
switch (self->spim_peripheral->spim.p_reg->FREQUENCY) {
case NRF_SPIM_FREQ_125K:
return 125000;
case NRF_SPIM_FREQ_250K:

View File

@ -31,8 +31,14 @@
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
nrfx_spim_t spim;
uint8_t max_frequency_MHz;
uint8_t max_xfer_size;
} spim_peripheral_t;
typedef struct {
mp_obj_base_t base;
spim_peripheral_t* spim_peripheral;
bool has_lock;
uint8_t clock_pin_number;
uint8_t MOSI_pin_number;

View File

@ -271,6 +271,10 @@ return self->rx_count + (nrfx_uart_rx_ready(&_uart) ? 1 : 0);
#endif
}
void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
mp_raise_NotImplementedError(translate("busio.UART not yet implemented"));
}
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {
#ifndef NRF52840_XXAA
mp_raise_NotImplementedError(translate("busio.UART not yet implemented"));

View File

@ -5,21 +5,40 @@
#define NRFX_POWER_ENABLED 1
#define NRFX_POWER_CONFIG_IRQ_PRIORITY 7
// Turn on nrfx supported workarounds for errata in Rev1/Rev2 of nRF52832
#ifdef NRF52832_XXAA
#define NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1
#endif
// Turn on nrfx supported workarounds for errata in Rev1 of nRF52840
#ifdef NRF52840_XXAA
#define NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED 1
#endif
// SPI
#define NRFX_SPIM_ENABLED 1
// TWIM0 and TWIM1 are the same peripherals as SPIM0 and SPIM1.
// The IRQ handlers for these peripherals are set up at compile time,
// so out of the box TWIM0/SPIM0 and TWIM1/SPIM1 cannot be shared
// between common-hal/busio/I2C.c and SPI.c.
// We could write an interrupt handler that checks whether it's
// being used for SPI or I2C, but perhaps two I2C's and 1-2 SPI's are good enough for now.
// Enable SPIM2 and SPIM3 (if available)
#define NRFX_SPIM2_ENABLED 1
#ifdef NRF52840_XXAA
#define NRFX_SPIM3_ENABLED 1
#else
#define NRFX_SPIM2_ENABLED 1
#endif
#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY 7
#define NRFX_SPIM_MISO_PULL_CFG 1
// TWI aka. I2C
// TWI aka. I2C; enable TWIM0 and TWIM1 (no conflict with SPIM choices)
#define NRFX_TWIM_ENABLED 1
#define NRFX_TWIM0_ENABLED 1
#define NRFX_TWIM1_ENABLED 1
#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 7
#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY NRF_TWIM_FREQ_400K
@ -45,4 +64,4 @@
#define NRFX_PWM3_ENABLED 0
#endif
#endif
#endif // NRFX_CONFIG_H__

View File

@ -1,38 +1,28 @@
/**************************************************************************/
/*!
@file usb_msc_flash.c
@author hathach (tinyusb.org)
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2018, Adafruit Industries (adafruit.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 hathach 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 "tusb.h"
#include "internal_flash.h"
@ -43,6 +33,8 @@
#include "lib/oofatfs/ff.h"
#include "py/mpstate.h"
#include "supervisor/shared/autoreload.h"
/*------------------------------------------------------------------*/
/* MACRO TYPEDEF CONSTANT ENUM
*------------------------------------------------------------------*/
@ -56,8 +48,8 @@
// Callback invoked when received an SCSI command not in built-in list below
// - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE
// - READ10 and WRITE10 has their own callbacks
int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) {
void const* response = NULL;
int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer, uint16_t bufsize) {
const void* response = NULL;
uint16_t resplen = 0;
switch ( scsi_cmd[0] ) {
@ -110,7 +102,7 @@ int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buf
(void) lun;
(void) offset;
uint32_t const block_count = bufsize / MSC_FLASH_BLOCK_SIZE;
const uint32_t block_count = bufsize / MSC_FLASH_BLOCK_SIZE;
internal_flash_read_blocks(buffer, lba, block_count);
@ -123,7 +115,7 @@ int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* bu
(void) lun;
(void) offset;
uint32_t const block_count = bufsize / MSC_FLASH_BLOCK_SIZE;
const uint32_t block_count = bufsize / MSC_FLASH_BLOCK_SIZE;
// bufsize <= CFG_TUD_MSC_BUFSIZE (4096)
internal_flash_write_blocks(buffer, lba, block_count);
@ -145,4 +137,7 @@ void tud_msc_write10_complete_cb (uint8_t lun) {
// flush pending cache when write10 is complete
internal_flash_flush();
// This write is complete, start the autoreload clock.
autoreload_start();
}

View File

@ -67,7 +67,11 @@ extern const busio_uart_parity_obj_t busio_uart_parity_odd_obj;
STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, true);
busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
// Always initially allocate the UART object within the long-lived heap.
// This is needed to avoid crashes with certain UART implementations which
// cannot accomodate being moved after creation. (See
// https://github.com/adafruit/circuitpython/issues/1056)
busio_uart_obj_t *self = m_new_ll_obj(busio_uart_obj_t);
self->base.type = &busio_uart_type;
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, pos_args + n_args);
@ -249,6 +253,36 @@ const mp_obj_property_t busio_uart_baudrate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: in_waiting
//|
//| The number of bytes in the input buffer, available to be read
//|
STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) {
busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
raise_error_if_deinited(common_hal_busio_uart_deinited(self));
return MP_OBJ_NEW_SMALL_INT(common_hal_busio_uart_rx_characters_available(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_get_in_waiting_obj, busio_uart_obj_get_in_waiting);
const mp_obj_property_t busio_uart_in_waiting_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&busio_uart_get_in_waiting_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| .. method:: reset_input_buffer()
//|
//| Discard any unread characters in the input buffer.
//|
STATIC mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) {
busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
raise_error_if_deinited(common_hal_busio_uart_deinited(self));
common_hal_busio_uart_clear_rx_buffer(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_obj_reset_input_buffer);
//| .. class:: busio.UART.Parity
//|
//| Enum-like class to define the parity used to verify correct data transfer.
@ -303,8 +337,11 @@ STATIC const mp_rom_map_elem_t busio_uart_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset_input_buffer), MP_ROM_PTR(&busio_uart_reset_input_buffer_obj) },
// Properties
{ MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&busio_uart_baudrate_obj) },
{ MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&busio_uart_in_waiting_obj) },
// Nested Enum-like Classes.
{ MP_ROM_QSTR(MP_QSTR_Parity), MP_ROM_PTR(&busio_uart_parity_type) },

View File

@ -60,6 +60,7 @@ extern void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t
extern uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self);
extern void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self);
extern bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_UART_H

View File

@ -0,0 +1,90 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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/displayio/ColorConverter.h"
#include <stdint.h>
#include "lib/utils/context_manager_helpers.h"
#include "py/binary.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| .. currentmodule:: displayio
//|
//| :class:`ColorConverter` -- Converts one color format to another
//| =========================================================================================
//|
//| Converts one color format to another.
//|
//| .. warning:: This will be changed before 4.0.0. Consider it very experimental.
//|
//| .. class:: ColorConverter()
//|
//| Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565
//| currently.
//|
// TODO(tannewt): Add support for other color formats.
//|
STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
mp_arg_check_num(n_args, n_kw, 0, 0, true);
displayio_colorconverter_t *self = m_new_obj(displayio_colorconverter_t);
self->base.type = &displayio_colorconverter_type;
common_hal_displayio_colorconverter_construct(self);
return MP_OBJ_FROM_PTR(self);
}
//| .. method:: convert(color)
//|
STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t color_obj) {
displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t color;
if (!mp_obj_get_int_maybe(color_obj, &color)) {
mp_raise_ValueError(translate("color should be an int"));
}
uint16_t output_color;
common_hal_displayio_colorconverter_convert(self, color, &output_color);
return MP_OBJ_NEW_SMALL_INT(output_color);
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert);
STATIC const mp_rom_map_elem_t displayio_colorconverter_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_convert), MP_ROM_PTR(&displayio_colorconverter_convert_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_colorconverter_locals_dict, displayio_colorconverter_locals_dict_table);
const mp_obj_type_t displayio_colorconverter_type = {
{ &mp_type_type },
.name = MP_QSTR_ColorConverter,
.make_new = displayio_colorconverter_make_new,
.locals_dict = (mp_obj_dict_t*)&displayio_colorconverter_locals_dict,
};

View File

@ -0,0 +1,37 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H
#include "shared-module/displayio/ColorConverter.h"
extern const mp_obj_type_t displayio_colorconverter_type;
void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self);
bool common_hal_displayio_colorconverter_convert(displayio_colorconverter_t *colorconverter, uint32_t input_color, uint16_t* output_color);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H

View File

@ -83,8 +83,19 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append);
//| .. method:: pop()
//|
//| Remove the last item and return it.
//|
STATIC mp_obj_t displayio_group_obj_pop(mp_obj_t self_in) {
displayio_group_t *self = MP_OBJ_TO_PTR(self_in);
return common_hal_displayio_group_pop(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_group_pop_obj, displayio_group_obj_pop);
STATIC const mp_rom_map_elem_t displayio_group_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&displayio_group_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&displayio_group_pop_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_group_locals_dict, displayio_group_locals_dict_table);

View File

@ -34,5 +34,6 @@ extern const mp_obj_type_t displayio_group_type;
void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size);
void common_hal_displayio_group_append(displayio_group_t* self, mp_obj_t layer);
mp_obj_t common_hal_displayio_group_pop(displayio_group_t* self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_GROUP_H

View File

@ -0,0 +1,104 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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/displayio/OnDiskBitmap.h"
#include <stdint.h>
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
//| .. currentmodule:: displayio
//|
//| :class:`OnDiskBitmap` -- Loads pixels straight from disk
//| ==========================================================================
//|
//| Loads values straight from disk. This minimizes memory use but can lead to
//| much slower pixel load times. These load times may result in frame tearing where only part of
//| the image is visible.
//|
//| .. warning:: This will likely be changed before 4.0.0. Consider it very experimental.
//|
//| It's easiest to use on a board with a built in display such as the `Hallowing M0 Express
//| <https://www.adafruit.com/product/3900>`_.
//|
//| .. code-block:: Python
//|
//| import board
//| import displayio
//| import time
//| import pulseio
//|
//| backlight = pulseio.PWMOut(board.TFT_BACKLIGHT)
//| splash = displayio.Group()
//| board.DISPLAY.show(splash)
//|
//| with open("/sample.bmp", "rb") as f:
//| odb = displayio.OnDiskBitmap(f)
//| face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0,0))
//| splash.append(face)
//| # Wait for the image to load.
//| board.DISPLAY.wait_for_frame()
//|
//| # Fade up the backlight
//| for i in range(100):
//| backlight.duty_cycle = i * (2 ** 15) // 100
//| time.sleep(0.01)
//|
//| # Wait forever
//| while True:
//| pass
//|
//| .. class:: OnDiskBitmap(file)
//|
//| Create an OnDiskBitmap object with the given file.
//|
//| :param file file: The open bitmap file
//|
STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
if (!MP_OBJ_IS_TYPE(pos_args[0], &mp_type_fileio)) {
mp_raise_TypeError(translate("file must be a file opened in byte mode"));
}
displayio_ondiskbitmap_t *self = m_new_obj(displayio_ondiskbitmap_t);
self->base.type = &displayio_ondiskbitmap_type;
common_hal_displayio_ondiskbitmap_construct(self, MP_OBJ_TO_PTR(pos_args[0]));
return MP_OBJ_FROM_PTR(self);
}
STATIC const mp_rom_map_elem_t displayio_ondiskbitmap_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(displayio_ondiskbitmap_locals_dict, displayio_ondiskbitmap_locals_dict_table);
const mp_obj_type_t displayio_ondiskbitmap_type = {
{ &mp_type_type },
.name = MP_QSTR_OnDiskBitmap,
.make_new = displayio_ondiskbitmap_make_new,
.locals_dict = (mp_obj_dict_t*)&displayio_ondiskbitmap_locals_dict,
};

View File

@ -0,0 +1,40 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H
#include "shared-module/displayio/OnDiskBitmap.h"
#include "extmod/vfs_fat.h"
extern const mp_obj_type_t displayio_ondiskbitmap_type;
void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, pyb_file_obj_t* file);
uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *bitmap,
int16_t x, int16_t y);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H

View File

@ -33,6 +33,9 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/OnDiskBitmap.h"
#include "shared-bindings/displayio/Palette.h"
#include "supervisor/shared/translate.h"
void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) {
@ -51,23 +54,26 @@ void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) {
//| :class:`Sprite` -- A particular copy of an image to display
//| ==========================================================================
//|
//| Position a particular image and palette combination.
//| Position a particular image and pixel_shader combination. Multiple sprites can share bitmaps
//| pixel shaders.
//|
//| .. warning:: This will be changed before 4.0.0. Consider it very experimental.
//|
//| .. class:: Sprite(bitmap, *, palette, position, width, height)
//| .. class:: Sprite(bitmap, *, pixel_shader, position, width, height)
//|
//| Create a Sprite object
//| Create a Sprite object. The bitmap is source for 2d pixels. The pixel_shader is used to
//| convert the value and its location to a display native pixel color. This may be a simple color
//| palette lookup, a gradient, a pattern or a color transformer.
//|
//|
STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
mp_arg_check_num(n_args, n_kw, 1, 4, true);
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, pos_args + n_args);
enum { ARG_bitmap, ARG_palette, ARG_position, ARG_width, ARG_height };
enum { ARG_bitmap, ARG_pixel_shader, ARG_position, ARG_width, ARG_height };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bitmap, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_palette, MP_ARG_OBJ | MP_ARG_KW_ONLY },
{ MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY },
{ MP_QSTR_position, MP_ARG_OBJ | MP_ARG_KW_ONLY },
{ MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} },
{ MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} },
@ -83,6 +89,10 @@ STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_ar
displayio_bitmap_t* bmp = MP_OBJ_TO_PTR(bitmap);
width = bmp->width;
height = bmp->height;
} else if (MP_OBJ_IS_TYPE(bitmap, &displayio_ondiskbitmap_type)) {
displayio_ondiskbitmap_t* bmp = MP_OBJ_TO_PTR(bitmap);
width = bmp->width;
height = bmp->height;
} else {
mp_raise_TypeError(translate("unsupported bitmap type"));
}
@ -93,7 +103,7 @@ STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_ar
displayio_sprite_t *self = m_new_obj(displayio_sprite_t);
self->base.type = &displayio_sprite_type;
common_hal_displayio_sprite_construct(self, bitmap, args[ARG_palette].u_obj,
common_hal_displayio_sprite_construct(self, bitmap, args[ARG_pixel_shader].u_obj,
width, height, x, y);
return MP_OBJ_FROM_PTR(self);
}
@ -136,40 +146,39 @@ const mp_obj_property_t displayio_sprite_position_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: palette
//| .. attribute:: pixel_shader
//|
//| The color palette of the sprite.
//| The pixel shader of the sprite.
//|
STATIC mp_obj_t displayio_sprite_obj_get_palette(mp_obj_t self_in) {
STATIC mp_obj_t displayio_sprite_obj_get_pixel_shader(mp_obj_t self_in) {
displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in);
return common_hal_displayio_sprite_get_palette(self);
return common_hal_displayio_sprite_get_pixel_shader(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_sprite_get_palette_obj, displayio_sprite_obj_get_palette);
MP_DEFINE_CONST_FUN_OBJ_1(displayio_sprite_get_pixel_shader_obj, displayio_sprite_obj_get_pixel_shader);
STATIC mp_obj_t displayio_sprite_obj_set_palette(mp_obj_t self_in, mp_obj_t palette_in) {
STATIC mp_obj_t displayio_sprite_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) {
displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in);
if (!MP_OBJ_IS_TYPE(palette_in, &displayio_palette_type)) {
mp_raise_TypeError(translate("palette must be displayio.Palette"));
if (!MP_OBJ_IS_TYPE(pixel_shader, &displayio_palette_type) && !MP_OBJ_IS_TYPE(pixel_shader, &displayio_colorconverter_type)) {
mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter"));
}
displayio_palette_t *palette = MP_OBJ_TO_PTR(palette_in);
common_hal_displayio_sprite_set_palette(self, palette);
common_hal_displayio_sprite_set_pixel_shader(self, pixel_shader);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_sprite_set_palette_obj, displayio_sprite_obj_set_palette);
MP_DEFINE_CONST_FUN_OBJ_2(displayio_sprite_set_pixel_shader_obj, displayio_sprite_obj_set_pixel_shader);
const mp_obj_property_t displayio_sprite_palette_obj = {
const mp_obj_property_t displayio_sprite_pixel_shader_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&displayio_sprite_get_palette_obj,
(mp_obj_t)&displayio_sprite_set_palette_obj,
.proxy = {(mp_obj_t)&displayio_sprite_get_pixel_shader_obj,
(mp_obj_t)&displayio_sprite_set_pixel_shader_obj,
(mp_obj_t)&mp_const_none_obj},
};
STATIC const mp_rom_map_elem_t displayio_sprite_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_position), MP_ROM_PTR(&displayio_sprite_position_obj) },
{ MP_ROM_QSTR(MP_QSTR_palette), MP_ROM_PTR(&displayio_sprite_palette_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_sprite_pixel_shader_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_sprite_locals_dict, displayio_sprite_locals_dict_table);

View File

@ -32,12 +32,12 @@
extern const mp_obj_type_t displayio_sprite_type;
void common_hal_displayio_sprite_construct(displayio_sprite_t *self, mp_obj_t bitmap,
mp_obj_t palette, uint16_t width, uint16_t height, uint16_t x, uint16_t y);
mp_obj_t pixel_shader, uint16_t width, uint16_t height, uint16_t x, uint16_t y);
void common_hal_displayio_sprite_get_position(displayio_sprite_t *self, int16_t* x, int16_t* y);
void common_hal_displayio_sprite_set_position(displayio_sprite_t *self, int16_t x, int16_t y);
displayio_palette_t* common_hal_displayio_sprite_get_palette(displayio_sprite_t *self);
void common_hal_displayio_sprite_set_palette(displayio_sprite_t *self, displayio_palette_t* palette);
mp_obj_t common_hal_displayio_sprite_get_pixel_shader(displayio_sprite_t *self);
void common_hal_displayio_sprite_set_pixel_shader(displayio_sprite_t *self, mp_obj_t pixel_shader);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SPRITE_H

View File

@ -31,8 +31,10 @@
#include "shared-bindings/displayio/__init__.h"
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/displayio/OnDiskBitmap.h"
#include "shared-bindings/displayio/Palette.h"
#include "shared-bindings/displayio/Sprite.h"
@ -57,8 +59,10 @@
//| :maxdepth: 3
//|
//| Bitmap
//| ColorConverter
//| FourWire
//| Group
//| OnDiskBitmap
//| Palette
//| Sprite
//|
@ -68,7 +72,9 @@
STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) },
{ MP_ROM_QSTR(MP_QSTR_Bitmap), MP_ROM_PTR(&displayio_bitmap_type) },
{ MP_ROM_QSTR(MP_QSTR_ColorConverter), MP_ROM_PTR(&displayio_colorconverter_type) },
{ MP_ROM_QSTR(MP_QSTR_Group), MP_ROM_PTR(&displayio_group_type) },
{ MP_ROM_QSTR(MP_QSTR_OnDiskBitmap), MP_ROM_PTR(&displayio_ondiskbitmap_type) },
{ MP_ROM_QSTR(MP_QSTR_Palette), MP_ROM_PTR(&displayio_palette_type) },
{ MP_ROM_QSTR(MP_QSTR_Sprite), MP_ROM_PTR(&displayio_sprite_type) },

View File

@ -0,0 +1,41 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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/displayio/ColorConverter.h"
void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self) {
}
bool common_hal_displayio_colorconverter_convert(displayio_colorconverter_t *self, uint32_t input_color, uint16_t* output_color) {
// TODO(tannewt): Validate the color input against the input format.
uint32_t r5 = (input_color >> 19);
uint32_t g6 = (input_color >> 10) & 0x3f;
uint32_t b5 = (input_color >> 3) & 0x1f;
uint32_t packed = r5 << 11 | g6 << 5 | b5;
// swap bytes
*output_color = __builtin_bswap16(packed);
return true;
}

View File

@ -0,0 +1,39 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_COLORCONVERTER_H
#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_COLORCONVERTER_H
#include <stdbool.h>
#include <stdint.h>
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
} displayio_colorconverter_t;
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_COLORCONVERTER_H

View File

@ -40,13 +40,26 @@ void common_hal_displayio_group_append(displayio_group_t* self, mp_obj_t layer)
}
self->children[self->size] = layer;
self->size++;
self->needs_refresh = true;
}
mp_obj_t common_hal_displayio_group_pop(displayio_group_t* self) {
if (self->size == 0) {
mp_raise_IndexError(translate("Group empty"));
}
self->size--;
mp_obj_t item = self->children[self->size];
self->children[self->size] = NULL;
self->needs_refresh = true;
return item;
}
void displayio_group_construct(displayio_group_t* self, mp_obj_t* child_array, uint32_t max_size) {
self->x = 0;
self->y = 1;
self->y = 0;
self->children = child_array;
self->max_size = max_size;
self->needs_refresh = false;
}
bool displayio_group_get_pixel(displayio_group_t *self, int16_t x, int16_t y, uint16_t* pixel) {
@ -65,6 +78,9 @@ bool displayio_group_get_pixel(displayio_group_t *self, int16_t x, int16_t y, ui
}
bool displayio_group_needs_refresh(displayio_group_t *self) {
if (self->needs_refresh) {
return true;
}
for (int32_t i = self->size - 1; i >= 0 ; i--) {
mp_obj_t layer = self->children[i];
if (MP_OBJ_IS_TYPE(layer, &displayio_sprite_type)) {
@ -78,6 +94,7 @@ bool displayio_group_needs_refresh(displayio_group_t *self) {
}
void displayio_group_finish_refresh(displayio_group_t *self) {
self->needs_refresh = false;
for (int32_t i = self->size - 1; i >= 0 ; i--) {
mp_obj_t layer = self->children[i];
if (MP_OBJ_IS_TYPE(layer, &displayio_sprite_type)) {

View File

@ -39,6 +39,7 @@ typedef struct {
uint16_t size;
uint16_t max_size;
mp_obj_t* children;
bool needs_refresh;
} displayio_group_t;

View File

@ -0,0 +1,93 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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/displayio/OnDiskBitmap.h"
#include <string.h>
#include "py/mperrno.h"
#include "py/runtime.h"
static uint32_t read_word(uint16_t* bmp_header, uint16_t index) {
return bmp_header[index] | bmp_header[index + 1] << 16;
}
void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, pyb_file_obj_t* file) {
// Load the wave
self->file = file;
uint16_t bmp_header[24];
f_rewind(&self->file->fp);
UINT bytes_read;
if (f_read(&self->file->fp, bmp_header, 48, &bytes_read) != FR_OK) {
mp_raise_OSError(MP_EIO);
}
if (bytes_read != 48 ||
memcmp(bmp_header, "BM", 2) != 0) {
mp_raise_ValueError(translate("Invalid BMP file"));
}
// We can't cast because we're not aligned.
self->data_offset = read_word(bmp_header, 5);
uint32_t header_size = read_word(bmp_header, 7);
uint32_t compression = read_word(bmp_header, 15);
if (!(header_size == 12 || header_size == 40 || header_size == 108 || header_size == 124) ||
!(compression == 0)) {
mp_raise_ValueError_varg(translate("Only Windows format, uncompressed BMP supported %d"), header_size);
}
// TODO(tannewt): Support bitfield compressed colors since RGB565 can be produced by the GIMP.
uint16_t bits_per_pixel = bmp_header[14];
if (bits_per_pixel < 24) {
mp_raise_ValueError_varg(translate("Only true color (24 bpp or higher) BMP supported %x"), bits_per_pixel);
}
self->bytes_per_pixel = bits_per_pixel / 8;
self->width = read_word(bmp_header, 9);
self->height = read_word(bmp_header, 11);
uint32_t byte_width = self->width * self->bytes_per_pixel;
self->stride = byte_width;
// Rows are word aligned.
if (self->stride % 4 != 0) {
self->stride += 4 - self->stride % 4;
}
}
uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *self,
int16_t x, int16_t y) {
if (x < 0 || x >= self->width || y < 0 || y >= self->height) {
return 0;
}
uint32_t location = self->data_offset + (self->height - y) * self->stride + x * self->bytes_per_pixel;
// We don't cache here because the underlying FS caches sectors.
f_lseek(&self->file->fp, location);
UINT bytes_read;
uint32_t pixel = 0;
uint32_t result = f_read(&self->file->fp, &pixel, self->bytes_per_pixel, &bytes_read);
if (result == FR_OK) {
return pixel;
}
return 0;
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 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.
*/
#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_ONDISKBITMAP_H
#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_ONDISKBITMAP_H
#include <stdbool.h>
#include <stdint.h>
#include "py/obj.h"
#include "extmod/vfs_fat.h"
typedef struct {
mp_obj_base_t base;
uint16_t width;
uint16_t height;
uint16_t data_offset;
uint16_t stride;
pyb_file_obj_t* file;
uint8_t bytes_per_pixel;
} displayio_ondiskbitmap_t;
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_ONDISKBITMAP_H

View File

@ -26,15 +26,17 @@
#include "shared-bindings/displayio/Sprite.h"
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/OnDiskBitmap.h"
#include "shared-bindings/displayio/Palette.h"
void common_hal_displayio_sprite_construct(displayio_sprite_t *self, mp_obj_t bitmap,
mp_obj_t palette, uint16_t width, uint16_t height, uint16_t x, uint16_t y) {
mp_obj_t pixel_shader, uint16_t width, uint16_t height, uint16_t x, uint16_t y) {
self->width = width;
self->height = height;
self->bitmap = bitmap;
self->palette = palette;
self->pixel_shader = pixel_shader;
self->x = x;
self->y = y;
}
@ -51,12 +53,12 @@ void common_hal_displayio_sprite_set_position(displayio_sprite_t *self, int16_t
}
displayio_palette_t* common_hal_displayio_sprite_get_palette(displayio_sprite_t *self) {
return self->palette;
mp_obj_t common_hal_displayio_sprite_get_pixel_shader(displayio_sprite_t *self) {
return self->pixel_shader;
}
void common_hal_displayio_sprite_set_palette(displayio_sprite_t *self, displayio_palette_t* palette) {
self->palette = palette;
void common_hal_displayio_sprite_set_pixel_shader(displayio_sprite_t *self, mp_obj_t pixel_shader) {
self->pixel_shader = pixel_shader;
self->needs_refresh = true;
}
@ -66,12 +68,19 @@ bool displayio_sprite_get_pixel(displayio_sprite_t *self, int16_t x, int16_t y,
if (y < 0 || y >= self->height || x >= self->width || x < 0) {
return false;
}
uint32_t value;
if (MP_OBJ_IS_TYPE(self->bitmap, &displayio_bitmap_type)) {
value = common_hal_displayio_bitmap_get_pixel(self->bitmap, x, y);
} else if (MP_OBJ_IS_TYPE(self->bitmap, &displayio_ondiskbitmap_type)) {
value = common_hal_displayio_ondiskbitmap_get_pixel(self->bitmap, x, y);
}
uint32_t value = common_hal_displayio_bitmap_get_pixel(self->bitmap, x, y);
if (self->palette == mp_const_none) {
if (self->pixel_shader == mp_const_none) {
*pixel = value;
return true;
} else if (MP_OBJ_IS_TYPE(self->palette, &displayio_palette_type) && displayio_palette_get_color(self->palette, value, pixel)) {
} else if (MP_OBJ_IS_TYPE(self->pixel_shader, &displayio_palette_type) && displayio_palette_get_color(self->pixel_shader, value, pixel)) {
return true;
} else if (MP_OBJ_IS_TYPE(self->pixel_shader, &displayio_colorconverter_type) && common_hal_displayio_colorconverter_convert(self->pixel_shader, value, pixel)) {
return true;
}
@ -79,12 +88,12 @@ bool displayio_sprite_get_pixel(displayio_sprite_t *self, int16_t x, int16_t y,
}
bool displayio_sprite_needs_refresh(displayio_sprite_t *self) {
return self->needs_refresh || displayio_palette_needs_refresh(self->palette);
return self->needs_refresh || displayio_palette_needs_refresh(self->pixel_shader);
}
void displayio_sprite_finish_refresh(displayio_sprite_t *self) {
self->needs_refresh = false;
displayio_palette_finish_refresh(self->palette);
displayio_palette_finish_refresh(self->pixel_shader);
// TODO(tannewt): We could double buffer changes to position and move them over here.
// That way they won't change during a refresh and tear.
}

View File

@ -31,12 +31,11 @@
#include <stdint.h>
#include "py/obj.h"
#include "shared-bindings/displayio/Palette.h"
typedef struct {
mp_obj_base_t base;
mp_obj_t bitmap;
displayio_palette_t* palette;
mp_obj_t pixel_shader;
uint16_t x;
uint16_t y;
uint16_t width;

View File

@ -1,7 +1,10 @@
#!/usr/bin/env bash
rm -rf ports/atmel-samd/build*
rm -rf ports/esp8266/build*
rm -rf ports/nrf/build*
# Alphabetical.
HW_BOARDS="\
arduino_zero \
circuitplayground_express \
@ -16,40 +19,42 @@ feather_m0_rfm9x \
feather_m4_express \
feather_nrf52832 \
feather_nrf52840_express \
grandcentral_m4_express \
pca10056 \
feather_radiofruit_zigbee \
gemma_m0 \
grandcentral_m4_express \
hallowing_m0_express \
itsybitsy_m0_express \
itsybitsy_m4_express \
metro_m0_express \
metro_m4_express \
pca10056 \
pca10059 \
pirkey_m0 \
trellis_m4_express \
trinket_m0 \
"
ROSIE_SETUPS="rosie-ci"
PARALLEL="-j 5"
if [ "$TRAVIS" == "true" ]; then
if [[ "$TRAVIS" == "true" ]]; then
PARALLEL="-j 2"
fi
if [ -z "$TRAVIS_BOARD" ]; then
if [[ -z "$TRAVIS_BOARD" ]]; then
boards=$HW_BOARDS
else
boards=$TRAVIS_BOARD
fi
version=`git describe --tags --exact-match`
if [ $? -ne 0 ]; then
if [[ $? -ne 0 ]]; then
version=`date +%Y%m%d`-`git rev-parse --short HEAD`
fi
if [ "$TRAVIS" == "true" ]; then
if [[ "$TRAVIS" == "true" ]]; then
sha=$TRAVIS_COMMIT
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
version=`date +%Y%m%d`-`echo $TRAVIS_PULL_REQUEST_SHA | cut -c1-7`
sha=$TRAVIS_PULL_REQUEST_SHA
fi
@ -61,23 +66,18 @@ for board in $boards; do
for language_file in $(ls locale/*.po); do
language=$(basename -s .po $language_file)
echo "Building $board for $language"
if [ $board == "feather_huzzah" ]; then
make $PARALLEL -C ports/esp8266 TRANSLATION=$language BOARD=feather_huzzah
if [[ $board == "feather_huzzah" ]]; then
make $PARALLEL -C ports/esp8266 TRANSLATION=$language BOARD=$board
(( exit_status = exit_status || $? ))
temp_filename=ports/esp8266/build/firmware-combined.bin
extension=bin
elif [ $board == "feather_nrf52832" ]; then
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather_nrf52832
elif [[ $board == "feather_nrf52832" ]]; then
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=$board
(( exit_status = exit_status || $? ))
temp_filename=ports/nrf/build-$board-s132/firmware.bin
extension=bin
elif [ $board == "feather_nrf52840_express" ]; then
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather_nrf52840_express SD=s140
(( exit_status = exit_status || $? ))
temp_filename=ports/nrf/build-$board-s140/firmware.uf2
extension=uf2
elif [ $board == "pca10056" ]; then
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=pca10056 SD=s140
elif [[ $board == "feather_nrf52840_express" || $board == "pca10056" || $board == "pca10059" ]]; then
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=$board SD=s140
(( exit_status = exit_status || $? ))
temp_filename=ports/nrf/build-$board-s140/firmware.uf2
extension=uf2
@ -93,7 +93,7 @@ for board in $boards; do
cp $temp_filename $final_filename
(( exit_status = exit_status || $? ))
# Only upload to Rosie if its a pull request.
if [ "$TRAVIS" == "true" ]; then
if [[ "$TRAVIS" == "true" ]]; then
for rosie in $ROSIE_SETUPS; do
echo "Uploading to https://$rosie.ngrok.io/upload/$sha"
curl -F "file=@$final_filename" https://$rosie.ngrok.io/upload/$sha