Merge branch 'main' into nrf52-sleep

This commit is contained in:
jun2sak 2021-02-21 13:35:06 +09:00
commit 1da8b9900a
116 changed files with 2987 additions and 873 deletions

View File

@ -178,6 +178,7 @@ exclude_patterns = ["**/build*",
"ports/cxd56/spresense-exported-sdk",
"ports/esp32s2/certificates",
"ports/esp32s2/esp-idf",
"ports/esp32s2/.idf_tools",
"ports/esp32s2/peripherals",
"ports/litex/hw",
"ports/minimal",

View File

@ -14,6 +14,7 @@
/*************************** HEADER FILES ***************************/
#include <stdlib.h>
#include <string.h>
#include "sha256.h"
/****************************** MACROS ******************************/

@ -1 +1 @@
Subproject commit 743d86487c83e42024ed508ed50499ad0a527d5d
Subproject commit 2ecad9586d088ee66f1b208ff2204906eba9e987

@ -1 +1 @@
Subproject commit 1e3312ab1cba0b1d3bb1f559c52acfdc1a6d57b8
Subproject commit 0cfa671b0c38386ba4da59119d61d399faa9b358

@ -1 +1 @@
Subproject commit dd7cc167c528a94a9feed81f9c52b5d372f68258
Subproject commit 5fee6e0c3878110844bc51e16063eeae7d94c457

View File

@ -1113,6 +1113,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1686,6 +1691,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Sampel berlebihan harus kelipatan 8."
@ -4154,6 +4164,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1092,6 +1092,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1659,6 +1664,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -4101,6 +4111,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1095,6 +1095,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1662,6 +1667,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -4104,6 +4114,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1113,6 +1113,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr "Initialisierung aufgrund von Speichermangel fehlgeschlagen"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1688,6 +1693,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Oversample muss ein Vielfaches von 8 sein."
@ -4193,6 +4203,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1092,6 +1092,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1659,6 +1664,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -4101,6 +4111,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -8,15 +8,15 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-02-08 21:21+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"PO-Revision-Date: 2021-02-20 01:10+0000\n"
"Last-Translator: Jose David M <jquintana202020@gmail.com>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.5-dev\n"
"X-Generator: Weblate 4.5\n"
#: main.c
msgid ""
@ -70,6 +70,8 @@ msgstr "%%c requiere int o char"
msgid ""
"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"
msgstr ""
"%d pines de dirección, %d pines rgb y %d tiles indican una altura de %d, y "
"no de %d"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
msgid "%q failure: %d"
@ -580,15 +582,17 @@ msgstr "Llame a super().__ init __() antes de acceder al objeto nativo."
#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c
msgid "Can only alarm on RTC IO from deep sleep."
msgstr ""
msgstr "Solo puede alertar en RTC IO de deep sleep"
#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c
msgid "Can only alarm on one low pin while others alarm high from deep sleep."
msgstr ""
"Solo puede alertar en un pin low mientras los otros alertan en high viniendo "
"de deep sleep."
#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c
msgid "Can only alarm on two low pins from deep sleep."
msgstr ""
msgstr "Solo puede alerta en dos low pines viniendo de deep sleep."
#: ports/nrf/common-hal/_bleio/Characteristic.c
msgid "Can't set CCCD on local Characteristic"
@ -627,7 +631,7 @@ msgstr "No se puede tener ambos canales en el mismo pin"
#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c
msgid "Cannot pull on input-only pin."
msgstr ""
msgstr "No puede hacer pull en un pin de entrada sola."
#: shared-module/bitbangio/SPI.c
msgid "Cannot read without MISO pin."
@ -678,7 +682,7 @@ msgstr "No puede variar la frecuencia en un temporizador que ya está en uso"
#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c
msgid "Cannot wake on pin edge. Only level."
msgstr ""
msgstr "No puede despertar en pin edge, solo en nivel."
#: shared-module/bitbangio/SPI.c
msgid "Cannot write without MOSI pin."
@ -835,7 +839,7 @@ msgstr "El pin Data 0 debe estar alineado a bytes"
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
msgid "Data 0 pin must be byte aligned."
msgstr ""
msgstr "El pin de datos 0 debe ser alineado a byte."
#: shared-module/audiocore/WaveFile.c
msgid "Data chunk must follow fmt chunk"
@ -893,7 +897,7 @@ msgstr "Error en regex"
#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "Error: Failure to bind"
msgstr ""
msgstr "Error: fallo al vincular"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c
#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c
@ -931,7 +935,7 @@ msgstr "Se esperaba una dirección"
#: shared-bindings/alarm/__init__.c
msgid "Expected an alarm"
msgstr ""
msgstr "Un objecto alarm era esperado"
#: shared-module/_pixelbuf/PixelBuf.c
#, c-format
@ -1089,7 +1093,7 @@ msgstr "I2SOut no disponible"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "IOs 0, 2 & 4 do not support internal pullup in sleep"
msgstr ""
msgstr "IOs 0, 2 y 4 no soportan pullup interno durante sleep"
#: shared-bindings/aesio/aes.c
#, c-format
@ -1110,12 +1114,19 @@ msgstr "Tamaño incorrecto del buffer"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Init program size invalid"
msgstr ""
msgstr "Tamaño del programa Init invalido"
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
msgid "Initialization failed due to lack of memory"
msgstr "Inicializacion fallida por falta de memoria"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
"La longitud del buffer de entrada(%d) debe ser un múltiplo del conteo de la "
"tira (%d)"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr "La entrada está durando mucho tiempo"
@ -1127,27 +1138,27 @@ msgstr "error Input/output"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d jumps on pin"
msgstr ""
msgstr "La instruction %d jumps en pin"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d shifts in more bits than pin count"
msgstr ""
msgstr "La instruccion %d mueve mas bits que la cuenta del pin"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d shifts out more bits than pin count"
msgstr ""
msgstr "La instruccion %d mueve mas bits que la cuenta del pin"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d uses extra pin"
msgstr ""
msgstr "La instrucción %d usa un pin extra"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Instruction %d waits on input outside of count"
msgstr ""
msgstr "La instrucción %d espera una entrada fuera del conteo"
#: ports/nrf/common-hal/_bleio/__init__.c
msgid "Insufficient authentication"
@ -1206,7 +1217,7 @@ msgstr "Frecuencia PWM inválida"
#: ports/esp32s2/common-hal/analogio/AnalogIn.c
msgid "Invalid Pin"
msgstr ""
msgstr "Pin inválido"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
#: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c
@ -1322,15 +1333,15 @@ msgstr "'security_mode' no válido"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Invalid size"
msgstr ""
msgstr "Tamaño incorrecto"
#: ports/esp32s2/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
msgstr "socket invalido para TLS"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Invalid state"
msgstr ""
msgstr "Estado invalido"
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
@ -1374,7 +1385,7 @@ msgstr "Length no deberia ser negativa"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "MAC address was invalid"
msgstr ""
msgstr "La dirección MAC es incorrecta"
#: shared-module/bitbangio/SPI.c
msgid "MISO pin init failed."
@ -1412,32 +1423,34 @@ msgstr "Falta el pin MISO o MOSI"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d reads pin(s)"
msgstr ""
msgstr "first-in-pin no encontrado. La instrucción %d lee el/los pin(es)"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)"
msgstr ""
msgstr "first_in_pin no encontrado. La instrucción %d desplaza de los pin(es)"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_in_pin. Instruction %d waits based on pin"
msgstr ""
msgstr "first_in_pin no encontrado. La instrucción %d espera basada en este pin"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)"
msgstr ""
"first_in_pin no encontrado. La instrucción %d mueve hacia afuera hacia el/"
"los pin(es)"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_out_pin. Instruction %d writes pin(s)"
msgstr ""
msgstr "first_in_pin no encontrado. La instrucción %d escribe pin(es)"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
msgid "Missing first_set_pin. Instruction %d sets pin(s)"
msgstr ""
msgstr "first_set_pin no encontrado. La instrucción %d configura el/los pin(es)"
#: shared-bindings/displayio/Group.c
msgid "Must be a %q subclass."
@ -1477,12 +1490,12 @@ msgstr "No se encontró el canal DMA"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "No DMA pacing timer found"
msgstr ""
msgstr "timer por establecedor de paso DMA no encontrado"
#: shared-module/adafruit_bus_device/I2CDevice.c
#, c-format
msgid "No I2C device at address: %x"
msgstr ""
msgstr "No hay dispositivo I2C en la dirección: %x"
#: ports/esp32s2/common-hal/busio/SPI.c ports/mimxrt10xx/common-hal/busio/SPI.c
#: ports/stm/common-hal/busio/SPI.c
@ -1563,13 +1576,13 @@ msgstr "No hay una red con ese ssid"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "No out in program"
msgstr ""
msgstr "No hay out en el programa"
#: ports/atmel-samd/common-hal/busio/I2C.c ports/esp32s2/common-hal/busio/I2C.c
#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
#: ports/raspberrypi/common-hal/busio/I2C.c
msgid "No pull up found on SDA or SCL; check your wiring"
msgstr ""
msgstr "No se encontró pull up en SDA or SCL; verifique su cableado"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
@ -1630,7 +1643,7 @@ msgstr "Solo mono de 8 ó 16 bit con "
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Only IN/OUT of up to 8 supported"
msgstr ""
msgstr "Solamente IN/OUT hasta 8 esta soportado"
#: ports/esp32s2/common-hal/wifi/__init__.c
msgid "Only IPv4 addresses supported"
@ -1659,11 +1672,11 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c
msgid "Only one TouchAlarm can be set in deep sleep."
msgstr ""
msgstr "Solamente una TouchAlarm puede ser configurada durante deep sleep."
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
msgstr "Solamente una alarm.time puede ser configurada."
#: shared-module/displayio/ColorConverter.c
msgid "Only one color can be transparent at a time"
@ -1675,27 +1688,32 @@ msgstr "Solo se aceptan enteros crudos para ip"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Operation or feature not supported"
msgstr ""
msgstr "Operación no característica no soportada"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Operation timed out"
msgstr ""
msgstr "Tiempo de espera agotado"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Out of memory"
msgstr ""
msgstr "Memoria agotada"
#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr "Se acabaron los enchufes"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr "buffer de salida debe ser de por lo menos %d bytes"
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "El sobremuestreo debe ser un múltiplo de 8."
#: shared-bindings/audiobusio/PDMIn.c
msgid "PDMIn not available"
msgstr ""
msgstr "PDMIn no esta disponible"
#: shared-bindings/pwmio/PWMOut.c
msgid ""
@ -1717,7 +1735,7 @@ msgstr "ParallelBus todavía no soportado"
#: ports/esp32s2/common-hal/audiobusio/__init__.c
msgid "Peripheral in use"
msgstr ""
msgstr "Periférico en uso"
#: py/moduerrno.c
msgid "Permission denied"
@ -1725,11 +1743,11 @@ msgstr "Permiso denegado"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Pin count must be at least 1"
msgstr ""
msgstr "El total de pines debe ser por lo menos 1"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Pin count too large"
msgstr ""
msgstr "Total de pines demasiado grande"
#: ports/atmel-samd/common-hal/analogio/AnalogIn.c
#: ports/cxd56/common-hal/analogio/AnalogIn.c
@ -1767,7 +1785,7 @@ msgstr ""
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Pins must share PWM slice"
msgstr ""
msgstr "Los pines deben compartir la división PWM"
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
@ -1803,30 +1821,33 @@ msgstr "El prefijo del buffer debe estar en el heap"
#: main.c
msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n"
msgstr ""
"Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar.\n"
#: main.c
msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n"
msgstr ""
"Pretendiendo ir a deep sleep hasta la alarma, CTRL-C or una escritura de "
"archivo\n"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Program does IN without loading ISR"
msgstr ""
msgstr "El programa hace un IN sin cargar ISR"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Program does OUT without loading OSR"
msgstr ""
msgstr "El programa hace OUT sin cargar OSR"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program must contain at least one 16-bit instruction."
msgstr ""
msgstr "El programa debe contener por lo menos una instrucción de 16 bits."
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program size invalid"
msgstr ""
msgstr "El tamaño del programa no es correcto"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Program too large"
msgstr ""
msgstr "Programa demasiado grande"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
@ -1834,7 +1855,7 @@ msgstr "Pull no se usa cuando la dirección es output."
#: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c
msgid "RAISE mode is not implemented"
msgstr ""
msgstr "El modo RAISE no esta implementado"
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
@ -1846,7 +1867,7 @@ msgstr "Error de inicialización de RNG"
#: ports/nrf/common-hal/busio/UART.c
msgid "RS485 Not yet supported on this device"
msgstr ""
msgstr "RS485 no esta soportado todavía en este dispositivo"
#: ports/esp32s2/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
@ -1887,7 +1908,7 @@ msgstr "Objeto de solo-lectura"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Received response was invalid"
msgstr ""
msgstr "La respuesta recibida es invalida"
#: shared-bindings/displayio/EPaperDisplay.c
msgid "Refresh too soon"
@ -1903,7 +1924,7 @@ msgstr "El modo AES solicitado no es compatible"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Requested resource not found"
msgstr ""
msgstr "Recurso solicitado no encontrado"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "Right channel unsupported"
@ -1941,7 +1962,7 @@ msgstr "Error de reinicialización de SPI"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
msgstr "Periférico SPI en uso"
#: shared-bindings/audiomixer/Mixer.c
msgid "Sample rate must be positive"
@ -1975,11 +1996,11 @@ msgstr "El contexto del lado del servidor no puede tener un hostname"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Set pin count must be between 1 and 5"
msgstr ""
msgstr "La suma de pines configurados debe estar entre 1 y 5"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Side set pin count must be between 1 and 5"
msgstr ""
msgstr "El conteo de pines de Side set debe estar entre 1 y 5"
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Size not supported"
@ -2014,11 +2035,11 @@ msgstr "El tamaño de la pila debe ser de al menos 256"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Stereo left must be on PWM channel A"
msgstr ""
msgstr "Estéreo izquierdo debe estar en el canal PWM A"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Stereo right must be on PWM channel B"
msgstr ""
msgstr "Estéreo derecho debe estar en el canal PWM B"
#: shared-bindings/multiterminal/__init__.c
msgid "Stream missing readinto() or write() method."
@ -2030,7 +2051,7 @@ msgstr "Suministre al menos un pin UART"
#: shared-bindings/alarm/time/TimeAlarm.c
msgid "Supply one of monotonic_time or epoch_time"
msgstr ""
msgstr "Suministre monotonic_time o epoch_time"
#: shared-bindings/gnss/GNSS.c
msgid "System entry must be gnss.SatelliteSystem"
@ -2106,7 +2127,7 @@ msgstr "Ancho del Tile debe dividir exactamente el ancho de mapa de bits"
#: shared-bindings/alarm/time/TimeAlarm.c
msgid "Time is in the past."
msgstr ""
msgstr "Tiempo suministrado esta en el pasado."
#: ports/nrf/common-hal/_bleio/Adapter.c
#, c-format
@ -2169,7 +2190,7 @@ msgstr "Error de reinicialización de UART"
#: ports/raspberrypi/common-hal/busio/UART.c
msgid "UART not yet supported"
msgstr ""
msgstr "UART no esta soportado todavia"
#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
@ -2229,7 +2250,7 @@ msgstr "Imposible escribir en nvm."
#: shared-bindings/alarm/SleepMemory.c
msgid "Unable to write to sleep_memory."
msgstr ""
msgstr "Imposible de escribir en sleep_memory."
#: ports/nrf/common-hal/_bleio/UUID.c
msgid "Unexpected nrfx uuid type"
@ -2243,7 +2264,7 @@ msgstr "Error no manejado de ESP TLS %d %d %x %d"
#: shared-bindings/wifi/Radio.c
#, c-format
msgid "Unknown failure %d"
msgstr ""
msgstr "Fallo desconocido %d"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
@ -2301,7 +2322,7 @@ msgstr "valor pull no soportado."
#: ports/esp32s2/common-hal/dualbank/__init__.c
msgid "Update Failed"
msgstr ""
msgstr "La actualización fallo"
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
@ -2315,7 +2336,7 @@ msgstr "Tamaño de valor > max_length"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "Version was invalid"
msgstr ""
msgstr "La versión era invalida"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
@ -2375,7 +2396,7 @@ msgstr "La clave de WiFi debe ser entre 8 y 63 caracteres"
#: main.c
msgid "Woken up by alarm.\n"
msgstr ""
msgstr "Despertado por la alarma.\n"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
@ -2522,7 +2543,7 @@ msgstr "la rama no está dentro del rango"
#: extmod/ulab/code/ulab_create.c
msgid "buffer is smaller than requested size"
msgstr ""
msgstr "El buffer es mas pequeño que el requerido"
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
@ -2530,7 +2551,7 @@ msgstr "buffer debe de ser un objeto bytes-like"
#: extmod/ulab/code/ulab_create.c
msgid "buffer size must be a multiple of element size"
msgstr ""
msgstr "El tamaño del buffer debe ser un múltiplo del tamaño del elemento"
#: shared-module/struct/__init__.c
msgid "buffer size must match format"
@ -2744,7 +2765,7 @@ msgstr "circulo solo puede ser registrado con un pariente"
#: shared-bindings/msgpack/ExtType.c
msgid "code outside range 0~127"
msgstr ""
msgstr "código fuera del rango 0~127"
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
@ -2820,7 +2841,7 @@ msgstr "los datos deben ser de igual tamaño"
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
msgstr "tipo de dato no comprendido"
#: py/parsenum.c
msgid "decimal numbers not supported"
@ -2832,7 +2853,7 @@ msgstr "'except' por defecto deberia estar de último"
#: shared-bindings/msgpack/__init__.c
msgid "default is not a function"
msgstr ""
msgstr "default no es una función"
#: shared-bindings/audiobusio/PDMIn.c
msgid ""
@ -2892,7 +2913,7 @@ msgstr "end_x debe ser un int"
#: shared-bindings/alarm/time/TimeAlarm.c
msgid "epoch_time not supported on this board"
msgstr ""
msgstr "epoch_time no esta soportado en esta tarjeta"
#: ports/nrf/common-hal/busio/UART.c
#, c-format
@ -2937,7 +2958,7 @@ msgstr "esperando la clave:valor para dict"
#: shared-bindings/msgpack/__init__.c
msgid "ext_hook is not a function"
msgstr ""
msgstr "ext_hook no es una función"
#: py/argcheck.c
msgid "extra keyword arguments given"
@ -3143,7 +3164,7 @@ msgstr "Formas de entrada y salida no son compactibles"
#: extmod/ulab/code/ulab_create.c
msgid "input argument must be an integer, a tuple, or a list"
msgstr ""
msgstr "argumento de entrada debe ser un entero, una tupla o una lista"
#: extmod/ulab/code/fft/fft.c
msgid "input array length must be power of 2"
@ -3269,7 +3290,7 @@ msgstr "sintaxis inválida para número"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "io must be rtc io"
msgstr ""
msgstr "io debe ser rtc io"
#: py/objtype.c
msgid "issubclass() arg 1 must be a class"
@ -3370,7 +3391,7 @@ msgstr "max_length debe ser 0-%d cuando fixed_length es %s"
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
msgid "max_length must be >= 0"
msgstr ""
msgstr "max_length debe ser >= 0"
#: extmod/ulab/code/ndarray.c
msgid "maximum number of dimensions is 4"
@ -3390,7 +3411,7 @@ msgstr "maxiter debe ser > 0"
#: extmod/ulab/code/numerical/numerical.c
msgid "median argument must be an ndarray"
msgstr ""
msgstr "argumento median debe ser una matriz ndarray"
#: py/runtime.c
#, c-format
@ -3476,7 +3497,7 @@ msgstr "no se ha encontrado ningún enlace para nonlocal"
#: shared-module/msgpack/__init__.c
msgid "no default packer"
msgstr ""
msgstr "no hay empaquetador por defecto"
#: py/builtinimport.c
msgid "no module named '%q'"
@ -3519,11 +3540,11 @@ msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "non-zero timeout must be > 0.01"
msgstr ""
msgstr "el tiempo de espera non-zero deber ser > 0.01"
#: shared-bindings/_bleio/Adapter.c
msgid "non-zero timeout must be >= interval"
msgstr ""
msgstr "el tiempo de espera non-zero debe ser >= intervalo"
#: extmod/ulab/code/linalg/linalg.c
msgid "norm is defined for 1D and 2D arrays"
@ -3548,7 +3569,7 @@ msgstr "el número de puntos debe ser al menos 2"
#: py/builtinhelp.c
msgid "object "
msgstr ""
msgstr "objecto "
#: py/obj.c
msgid "object '%q' is not a tuple or list"
@ -3604,11 +3625,11 @@ msgstr "offset es demasiado grande"
#: shared-bindings/dualbank/__init__.c
msgid "offset must be >= 0"
msgstr ""
msgstr "offset debe ser >= 0"
#: extmod/ulab/code/ulab_create.c
msgid "offset must be non-negative and no greater than buffer length"
msgstr ""
msgstr "offset debe ser non-negative y no mayo que la longitud del buffer"
#: py/objstr.c py/objstrunicode.c
msgid "offset out of bounds"
@ -3720,7 +3741,7 @@ msgstr "pop desde %q vacía"
#: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c
msgid "port must be >= 0"
msgstr ""
msgstr "port debe ser be >= 0"
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
@ -3758,11 +3779,11 @@ msgstr "presionando ambos botones al inicio.\n"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "pull_threshold must be between 1 and 32"
msgstr ""
msgstr "pull_threshold debe esta entre 1 y 32"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "push_threshold must be between 1 and 32"
msgstr ""
msgstr "push_threshold debe esta entre 1 y 32"
#: extmod/modutimeq.c
msgid "queue overflow"
@ -3841,7 +3862,7 @@ msgstr "forma tiene que ser una tupla"
#: shared-module/msgpack/__init__.c
msgid "short read"
msgstr ""
msgstr "lectura corta"
#: py/objstr.c
msgid "sign not allowed in string format specifier"
@ -3961,7 +3982,7 @@ msgstr "limite debe ser en el rango 0-65536"
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "tile must be greater than zero"
msgstr ""
msgstr "tile debe sera mas grande que cero"
#: shared-bindings/time/__init__.c
msgid "time.struct_time() takes a 9-sequence"
@ -3980,7 +4001,7 @@ msgstr "el tiempo de espera debe ser 0.0-100.0 segundos"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "timeout must be < 655.35 secs"
msgstr ""
msgstr "timeout debe ser < 655.35 segundos"
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "timeout must be >= 0.0"
@ -4008,7 +4029,7 @@ msgstr "demasiados argumentos provistos con el formato dado"
#: extmod/ulab/code/ulab_create.c
msgid "too many dimensions"
msgstr ""
msgstr "demasiadas dimensiones"
#: extmod/ulab/code/ndarray.c
msgid "too many indices"
@ -4021,7 +4042,7 @@ msgstr "demasiados valores para descomprimir (%d esperado)"
#: extmod/ulab/code/approx/approx.c
msgid "trapz is defined for 1D arrays"
msgstr ""
msgstr "trapz esta definido para matrices 1D"
#: extmod/ulab/code/approx/approx.c
msgid "trapz is defined for 1D arrays of equal length"
@ -4029,7 +4050,7 @@ msgstr "trapz está definido para arreglos 1D de igual tamaño"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "trigger level must be 0 or 1"
msgstr ""
msgstr "nivel de accionamiento debe ser 0 o 1"
#: py/obj.c
msgid "tuple/list has wrong length"
@ -4171,7 +4192,7 @@ msgstr "los vectores deben tener el mismo tamaño"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""
msgstr "conflicto de wakeup"
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
msgid "watchdog not initialized"
@ -4181,13 +4202,18 @@ msgstr "watchdog no inicializado"
msgid "watchdog timeout must be greater than 0"
msgstr "el tiempo de espera del perro guardián debe ser mayor a 0"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr "ancho debe estar entre 2 y 8 (inclusivamente), no %d"
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "el ancho debe ser mayor que cero"
#: ports/esp32s2/common-hal/wifi/Radio.c
msgid "wifi is not enabled"
msgstr ""
msgstr "wifi no esta habilitado"
#: shared-bindings/_bleio/Adapter.c
msgid "window must be <= interval"
@ -4227,7 +4253,7 @@ msgstr "valor x fuera de límites"
#: ports/esp32s2/common-hal/audiobusio/__init__.c
msgid "xTaskCreate failed"
msgstr ""
msgstr "fallo en xTaskCreate"
#: shared-bindings/displayio/Shape.c
msgid "y should be an int"

View File

@ -1107,6 +1107,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1677,6 +1682,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Oversample ay dapat multiple ng 8."
@ -4154,6 +4164,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1129,6 +1129,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr "Échec d'initialisation par manque de mémoire"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr "L'entrée prend trop de temps"
@ -1702,6 +1707,11 @@ msgstr "Hors de mémoire"
msgid "Out of sockets"
msgstr "Plus de sockets"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Le sur-échantillonage doit être un multiple de 8."
@ -4214,6 +4224,11 @@ msgstr "chien de garde (watchdog) non initialisé"
msgid "watchdog timeout must be greater than 0"
msgstr "watchdog timeout doit être supérieur à 0"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "width doit être plus que zero"

View File

@ -1092,6 +1092,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1659,6 +1664,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -4101,6 +4111,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -7,25 +7,31 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"PO-Revision-Date: 2021-02-18 15:50+0000\n"
"Last-Translator: Luca De Filippo <luca.defilippo@translationcommons.org>\n"
"Language-Team: \n"
"Language: it_IT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.5\n"
#: main.c
msgid ""
"\n"
"Code done running.\n"
msgstr ""
"\n"
"Caricamento codice pronto.\n"
#: main.c
msgid ""
"\n"
"Code stopped by auto-reload.\n"
msgstr ""
"\n"
"Codice fermato dall'auto-ricarica.\n"
#: supervisor/shared/safe_mode.c
msgid ""
@ -33,6 +39,9 @@ msgid ""
"Please file an issue with the contents of your CIRCUITPY drive at \n"
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
"\n"
"Per favore, segnala il problema con il contenuto del tuo CIRCUITPY a\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c
msgid " File \"%q\""
@ -44,7 +53,7 @@ msgstr " File \"%q\", riga %d"
#: py/builtinhelp.c
msgid " is of type %q\n"
msgstr ""
msgstr " è di tipo %q\n"
#: main.c
msgid " output:\n"
@ -60,10 +69,11 @@ msgstr "%%c necessita di int o char"
msgid ""
"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"
msgstr ""
"%d pin indirizzo, %d pin rgb e %d tessere indicano l'altezza di %d, non %d"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
msgid "%q failure: %d"
msgstr ""
msgstr "%q fallito: %d"
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
@ -79,15 +89,15 @@ msgstr "indice %q fuori intervallo"
#: py/obj.c
msgid "%q indices must be integers, not %q"
msgstr ""
msgstr "%q gli indici devono essere interi, non %q"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
msgstr "lista %q deve essere una lista"
#: shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
msgstr "%q deve essere >= 0"
#: shared-bindings/_bleio/CharacteristicBuffer.c
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
@ -100,20 +110,19 @@ msgstr "slice del buffer devono essere della stessa lunghezza"
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
msgstr "%q deve essere una tupla di lunghezza 2"
#: shared-bindings/canio/Match.c
msgid "%q out of range"
msgstr ""
msgstr "%q oltre il limite"
#: ports/atmel-samd/common-hal/microcontroller/Pin.c
msgid "%q pin invalid"
msgstr ""
msgstr "%q pin non valido"
#: shared-bindings/fontio/BuiltinFont.c
#, fuzzy
msgid "%q should be an int"
msgstr "y dovrebbe essere un int"
msgstr "%q dovrebbe essere un int"
#: py/bc.c py/objnamedtuple.c
msgid "%q() takes %d positional arguments but %d were given"
@ -122,7 +131,7 @@ msgstr "%q() prende %d argomenti posizionali ma ne sono stati forniti %d"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
#, c-format
msgid "%s error 0x%x"
msgstr ""
msgstr "%s errore 0x%x"
#: py/argcheck.c
msgid "'%q' argument required"
@ -130,93 +139,93 @@ msgstr "'%q' argomento richiesto"
#: py/runtime.c
msgid "'%q' object cannot assign attribute '%q'"
msgstr ""
msgstr "L'oggetto '%q' non può assegnare l'attributo '%q'"
#: py/proto.c
msgid "'%q' object does not support '%q'"
msgstr ""
msgstr "L'oggetto '%q' non supporta '%q'"
#: py/obj.c
msgid "'%q' object does not support item assignment"
msgstr ""
msgstr "L'oggetto '%q' non supporta l'assegnazione dell'elemento"
#: py/obj.c
msgid "'%q' object does not support item deletion"
msgstr ""
msgstr "L'oggetto '%q' non supporta la rimozione dell'elemento"
#: py/runtime.c
msgid "'%q' object has no attribute '%q'"
msgstr ""
msgstr "L'oggetto '%q' non ha attributi '%q'"
#: py/runtime.c
msgid "'%q' object is not an iterator"
msgstr ""
msgstr "L'oggetto '%q' non è un iteratore"
#: py/objtype.c py/runtime.c
msgid "'%q' object is not callable"
msgstr ""
msgstr "L'oggetto '%q' non è richiamabile"
#: py/runtime.c
msgid "'%q' object is not iterable"
msgstr ""
msgstr "L'oggetto '%q' non è iterabile"
#: py/obj.c
msgid "'%q' object is not subscriptable"
msgstr ""
msgstr "l'oggetto '%q' non è riscrivibile"
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
msgstr "'%s' aspetta una etichetta"
msgstr "'%s' richiede una etichetta"
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a register"
msgstr "'%s' aspetta un registro"
msgstr "'%s' richiede un registro"
#: py/emitinlinethumb.c
#, fuzzy, c-format
#, c-format
msgid "'%s' expects a special register"
msgstr "'%s' aspetta un registro"
msgstr "'%s' richiede un registro speciale"
#: py/emitinlinethumb.c
#, fuzzy, c-format
#, c-format
msgid "'%s' expects an FPU register"
msgstr "'%s' aspetta un registro"
msgstr "'%s' richiede un registro FPU"
#: py/emitinlinethumb.c
#, fuzzy, c-format
#, c-format
msgid "'%s' expects an address of the form [a, b]"
msgstr "'%s' aspetta un registro"
msgstr "'%s' richiede un indirizzo dal modulo [a, b]"
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects an integer"
msgstr "'%s' aspetta un intero"
msgstr "'%s' richiede un valore intero"
#: py/emitinlinethumb.c
#, fuzzy, c-format
#, c-format
msgid "'%s' expects at most r%d"
msgstr "'%s' aspetta un registro"
msgstr "'%s' richiede almeno r%d"
#: py/emitinlinethumb.c
#, fuzzy, c-format
#, c-format
msgid "'%s' expects {r0, r1, ...}"
msgstr "'%s' aspetta un registro"
msgstr "'%s' richiede {r0, r1, ...}"
#: py/emitinlinextensa.c
#, fuzzy, c-format
#, c-format
msgid "'%s' integer %d is not within range %d..%d"
msgstr "intero '%s' non è nell'intervallo %d..%d"
msgstr "Valore intero '%s' %d non è nell'intervallo %d..%d"
#: py/emitinlinethumb.c
#, fuzzy, c-format
#, c-format
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "intero '%s' non è nell'intervallo %d..%d"
msgstr "Valore intero '%s' 0x%x non rientra nella maschera 0x%x"
#: py/objstr.c
msgid "'=' alignment not allowed in string format specifier"
msgstr "aligniamento '=' non è permesso per il specificatore formato string"
msgstr "Allineamento'=' non è permesso per lo specificatore formato stringa"
#: shared-module/struct/__init__.c
msgid "'S' and 'O' are not supported format types"
@ -233,22 +242,23 @@ msgstr "'await' al di fuori della funzione"
#: py/compile.c
msgid "'await', 'async for' or 'async with' outside async function"
msgstr ""
"'await', 'async for' o 'async with' fuori della funzione sincronizzazione"
#: py/compile.c
msgid "'break' outside loop"
msgstr "'break' al di fuori del ciclo"
msgstr "'break' fuori del ciclo"
#: py/compile.c
msgid "'continue' outside loop"
msgstr "'continue' al di fuori del ciclo"
msgstr "'continue' fuori del ciclo"
#: py/objgenerator.c
msgid "'coroutine' object is not an iterator"
msgstr ""
msgstr "L'oggetto 'coroutine' non è un iteratore"
#: py/compile.c
msgid "'data' requires at least 2 arguments"
msgstr "'data' richiede almeno 2 argomento"
msgstr "'data' richiede almeno 2 argomenti"
#: py/compile.c
msgid "'data' requires integer arguments"
@ -264,7 +274,7 @@ msgstr "'return' al di fuori della funzione"
#: py/compile.c
msgid "'yield from' inside async function"
msgstr ""
msgstr "'yield from' è nella funzione sincronizzazione"
#: py/compile.c
msgid "'yield' outside function"
@ -288,29 +298,29 @@ msgstr "pow() con tre argmomenti non supportata"
#: shared-module/msgpack/__init__.c
msgid "64 bit types"
msgstr ""
msgstr "Tipo 64 bits"
#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Un canale di interrupt hardware è già in uso"
msgstr "Un canale di interruzione hardware è già in uso"
#: ports/esp32s2/common-hal/analogio/AnalogIn.c
msgid "ADC2 is being used by WiFi"
msgstr ""
msgstr "ADC2 sta usando il WiFi"
#: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c
#, fuzzy, c-format
#, c-format
msgid "Address must be %d bytes long"
msgstr "la palette deve essere lunga 32 byte"
msgstr "L'indirizzo deve essere lungo %d byte"
#: shared-bindings/_bleio/Address.c
msgid "Address type out of range"
msgstr ""
msgstr "Tipo di indirizzo fuori intervallo"
#: ports/esp32s2/common-hal/canio/CAN.c
msgid "All CAN peripherals are in use"
msgstr ""
msgstr "Tutte le periferiche CAN sono in uso"
#: ports/esp32s2/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
msgid "All I2C peripherals are in use"
@ -320,13 +330,13 @@ msgstr "Tutte le periferiche I2C sono in uso"
#: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c
#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c
msgid "All PCNT units in use"
msgstr ""
msgstr "Tutte le unità PCNT sono in uso"
#: ports/atmel-samd/common-hal/canio/Listener.c
#: ports/esp32s2/common-hal/canio/Listener.c
#: ports/stm/common-hal/canio/Listener.c
msgid "All RX FIFOs in use"
msgstr ""
msgstr "Tutte le RX FIFO sono in uso"
#: ports/esp32s2/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c
msgid "All SPI peripherals are in use"
@ -343,7 +353,7 @@ msgstr "Tutti i canali eventi utilizati"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "All state machines in use"
msgstr ""
msgstr "Tutte le state machines sono in uso"
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "All sync event channels in use"
@ -376,16 +386,16 @@ msgstr ""
#: ports/atmel-samd/common-hal/canio/Listener.c
msgid "Already have all-matches listener"
msgstr ""
msgstr "Già in possesso di tutti i listener abbinati"
#: shared-module/memorymonitor/AllocationAlarm.c
#: shared-module/memorymonitor/AllocationSize.c
msgid "Already running"
msgstr ""
msgstr "Già in funzione"
#: ports/esp32s2/common-hal/wifi/Radio.c
msgid "Already scanning for wifi networks"
msgstr ""
msgstr "Già in ricerca di collegamenti WiFi"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
@ -417,24 +427,24 @@ msgstr "Array deve avere mezzoparole (typo 'H')"
#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c
msgid "Array values should be single bytes."
msgstr "Valori di Array dovrebbero essere bytes singulari"
msgstr "I valori dell'Array dovrebbero essere bytes singoli."
#: shared-bindings/microcontroller/Pin.c
msgid "At most %d %q may be specified (not %d)"
msgstr ""
msgstr "Almeno %d %q devono essere specificati (non %d)"
#: shared-module/memorymonitor/AllocationAlarm.c
#, c-format
msgid "Attempt to allocate %d blocks"
msgstr ""
msgstr "Provo ad allocare %d blocchi"
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
msgstr "Provo l'allocazione quando MicroPython VM non è attivo."
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
msgstr ""
msgstr "Autenticazione Fallita"
#: main.c
msgid "Auto-reload is off.\n"
@ -455,7 +465,7 @@ msgstr ""
#: shared-module/displayio/Display.c
#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
msgstr "Al di sotto del frame rate minimo"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Bit clock and word select must share a clock unit"
@ -465,15 +475,15 @@ msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid "Bit depth must be from 1 to 6 inclusive, not %d"
msgstr ""
msgstr "La profondità dei bit deve essere inclusiva da 1 a 6, non %d"
#: shared-bindings/audiobusio/PDMIn.c
msgid "Bit depth must be multiple of 8."
msgstr "La profondità di bit deve essere multipla di 8."
msgstr "La profondità di bit deve essere un multiplo di 8."
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Both RX and TX required for flow control"
msgstr ""
msgstr "Sia RX che TX richiedono il controllo del flow"
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "Both pins must support hardware interrupts"
@ -483,21 +493,21 @@ msgstr "Entrambi i pin devono supportare gli interrupt hardware"
#: shared-bindings/framebufferio/FramebufferDisplay.c
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "Brightness must be 0-1.0"
msgstr ""
msgstr "La luminosità deve essere tra 0-1.0"
#: shared-bindings/supervisor/__init__.c
msgid "Brightness must be between 0 and 255"
msgstr "La luminosità deve essere compreso tra 0 e 255"
msgstr "La luminosità deve essere compresa tra 0 e 255"
#: shared-bindings/displayio/Display.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "Illiminazione non è regolabile"
msgstr "Luminosità non è regolabile"
#: shared-bindings/_bleio/UUID.c
#, c-format
msgid "Buffer + offset too small %d %d %d"
msgstr ""
msgstr "Buffer + offset troppo piccolo %d %d %d"
#: shared-module/usb_hid/Device.c
#, c-format
@ -507,26 +517,26 @@ msgstr "Buffer di lunghezza non valida. Dovrebbe essere di %d bytes."
#: shared-bindings/displayio/Display.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
msgstr "Buffer non è un array di bites."
#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
msgstr "Buffer troppo piccolo"
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
msgstr "Lunghezza Buffer %d troppo grande. Deve essere meno di %d"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
#: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c
msgid "Buffer length must be a multiple of 512"
msgstr ""
msgstr "La lunghezza del buffer deve essere un multiplo di 512"
#: ports/stm/common-hal/sdioio/SDCard.c
msgid "Buffer must be a multiple of 512 bytes"
msgstr ""
msgstr "Il buffer deve essere un multiplo di 512 bytes"
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
@ -534,40 +544,39 @@ msgstr "Il buffer deve essere lungo almeno 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
msgstr "Buffer troppo grande ed impossibile allocare"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
msgstr ""
msgstr "Buffer troppo piccolo di %d bytes"
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, fuzzy, c-format
#, c-format
msgid "Bus pin %d is already in use"
msgstr "DAC già in uso"
msgstr "Bus pin %d è già in uso"
#: shared-bindings/_bleio/UUID.c
#, fuzzy
msgid "Byte buffer must be 16 bytes."
msgstr "i buffer devono essere della stessa lunghezza"
msgstr "I buffer byte devono essere di almeno 16 bytes."
#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c
msgid "Bytes must be between 0 and 255."
msgstr "I byte devono essere compresi tra 0 e 255"
msgstr "I byte devono essere compresi tra 0 e 255."
#: shared-bindings/aesio/aes.c
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
msgstr "I blocchi CBC devono essere multipli di 16 bytes"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""
msgstr "CRC o controllo totale è risultato non valido"
#: py/objtype.c
msgid "Call super().__init__() before accessing native object."
msgstr ""
msgstr "Chiama super().__init__() prima di accedere ad un oggetto nativo."
#: ports/esp32s2/common-hal/alarm/pin/PinAlarm.c
msgid "Can only alarm on RTC IO from deep sleep."
@ -1107,6 +1116,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1682,6 +1696,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "L'oversampling deve essere multiplo di 8."
@ -4162,6 +4181,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1105,6 +1105,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1674,6 +1679,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "オーバーサンプルは8の倍数でなければなりません"
@ -4132,6 +4142,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr "watchdogのtimeoutは0以上でなければなりません"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1095,6 +1095,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1662,6 +1667,11 @@ msgstr ""
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""
@ -4105,6 +4115,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr ""

View File

@ -1106,6 +1106,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr "De initialisatie is mislukt vanwege een gebrek aan geheugen"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr "Invoer duurt te lang"
@ -1679,6 +1684,11 @@ msgstr ""
msgid "Out of sockets"
msgstr "Geen sockets meer beschikbaar"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Oversample moet een meervoud van 8 zijn."
@ -4165,6 +4175,11 @@ msgstr "watchdog niet geïnitialiseerd"
msgid "watchdog timeout must be greater than 0"
msgstr "watchdog time-out moet groter zijn dan 0"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "breedte moet groter dan nul zijn"

View File

@ -1105,6 +1105,11 @@ msgstr ""
msgid "Initialization failed due to lack of memory"
msgstr "Inicjalizacja nie powiodła się z powodu braku pamięci"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
@ -1673,6 +1678,11 @@ msgstr "Brak pamięci"
msgid "Out of sockets"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Nadpróbkowanie musi być wielokrotnością 8."
@ -4124,6 +4134,11 @@ msgstr ""
msgid "watchdog timeout must be greater than 0"
msgstr ""
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "szerokość musi być większa niż zero"

View File

@ -1124,6 +1124,11 @@ msgstr "O tamanho do programa Init é inválido"
msgid "Initialization failed due to lack of memory"
msgstr "A inicialização falhou devido à falta de memória"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr "A entrada está demorando demais"
@ -1698,6 +1703,11 @@ msgstr "Sem memória"
msgid "Out of sockets"
msgstr "Sem soquetes"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "A superamostragem deve ser um múltiplo de 8."
@ -4205,6 +4215,11 @@ msgstr "o watchdog não foi inicializado"
msgid "watchdog timeout must be greater than 0"
msgstr "o tempo limite do watchdog deve ser maior que 0"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "a largura deve ser maior que zero"

View File

@ -1111,6 +1111,11 @@ msgstr "Storlek på init-program ogiltigt"
msgid "Initialization failed due to lack of memory"
msgstr "Initieringen misslyckades på grund av minnesbrist"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr "Indata tar för lång tid"
@ -1684,6 +1689,11 @@ msgstr "Slut på minne"
msgid "Out of sockets"
msgstr "Slut på sockets"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Översampling måste vara multipel av 8."
@ -4166,6 +4176,11 @@ msgstr "watchdog är inte initierad"
msgid "watchdog timeout must be greater than 0"
msgstr "watchdog timeout måste vara större än 0"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "width måste vara större än noll"

View File

@ -1110,6 +1110,11 @@ msgstr "Init chéng xù dà xiǎo wú xiào"
msgid "Initialization failed due to lack of memory"
msgstr "yóu yú nèi cún bù zú, chū shǐ huà shī bài"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Input buffer length (%d) must be a multiple of the strand count (%d)"
msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr "Shūrù shíjiānguò zhǎng"
@ -1683,6 +1688,11 @@ msgstr "nèi cún bù zú"
msgid "Out of sockets"
msgstr "tào jiē zì wài"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "Output buffer must be at least %d bytes"
msgstr ""
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr "Guò cǎiyàng bìxū shì 8 de bèishù."
@ -4159,6 +4169,11 @@ msgstr "wèi chū shǐ huà jiān shì qì"
msgid "watchdog timeout must be greater than 0"
msgstr "kān mén gǒu chāoshí bìxū dàyú 0"
#: shared-bindings/bitops/__init__.c
#, c-format
msgid "width must be from 2 to 8 (inclusive), not %d"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "width must be greater than zero"
msgstr "kuāndù bìxū dàyú líng"

26
main.c
View File

@ -69,6 +69,19 @@
#include "shared-bindings/alarm/__init__.h"
#endif
#if CIRCUITPY_BLEIO
#include "shared-bindings/_bleio/__init__.h"
#include "supervisor/shared/bluetooth.h"
#endif
#if CIRCUITPY_BOARD
#include "shared-module/board/__init__.h"
#endif
#if CIRCUITPY_CANIO
#include "common-hal/canio/CAN.h"
#endif
#if CIRCUITPY_DISPLAYIO
#include "shared-module/displayio/__init__.h"
#endif
@ -81,17 +94,8 @@
#include "shared-module/network/__init__.h"
#endif
#if CIRCUITPY_BOARD
#include "shared-module/board/__init__.h"
#endif
#if CIRCUITPY_BLEIO
#include "shared-bindings/_bleio/__init__.h"
#include "supervisor/shared/bluetooth.h"
#endif
#if CIRCUITPY_CANIO
#include "common-hal/canio/CAN.h"
#if CIRCUITPY_USB_CDC
#include "shared-module/usb_cdc/__init__.h"
#endif
#if CIRCUITPY_WIFI

View File

@ -122,7 +122,7 @@ CFLAGS += -ftree-vrp
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
#Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3 -Og
CFLAGS += -ggdb3 -Og -Os
# You may want to disable -flto if it interferes with debugging.
CFLAGS += -flto -flto-partition=none
# You may want to enable these flags to make setting breakpoints easier.

View File

@ -11,3 +11,4 @@ LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -18,7 +18,16 @@ ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32
# Number of USB endpoint pairs.
USB_NUM_EP = 8
######################################################################
# Put samd21-only choices here.
ifeq ($(CHIP_FAMILY),samd21)
# The ?='s allow overriding in mpconfigboard.mk.
@ -40,7 +49,9 @@ CIRCUITPY_SDCARDIO ?= 0
CIRCUITPY_FRAMEBUFFERIO ?= 0
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
# Because of that, there aren't enough endpoints for a secondary CDC serial connection.
USB_MSC_EP_NUM_OUT = 1
CIRCUITPY_USB_CDC = 0
CIRCUITPY_ULAB = 0
@ -55,9 +66,13 @@ CIRCUITPY_TERMINALIO = 0
endif
endif # samd21
######################################################################
######################################################################
# Put samd51-only choices here.
ifeq ($(CHIP_FAMILY),samd51)
# No native touchio on SAMD51.
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
@ -70,9 +85,4 @@ CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FULL_BUILD)
CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD)
endif # samd51
INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32
USB_NUM_EP = 8
######################################################################

View File

@ -27,10 +27,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -7,6 +7,9 @@ USB_CDC_EP_NUM_DATA_IN = 1
USB_MSC_EP_NUM_OUT = 5
USB_MSC_EP_NUM_IN = 4
# Number of USB endpoint pairs.
USB_NUM_EP = 6
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
CIRCUITPY_AUDIOBUSIO = 0

View File

@ -2,7 +2,6 @@ USB_VID = 0x303a
USB_PID = 0x8007
USB_PRODUCT = "TTGO T8 ESP32-S2"
USB_MANUFACTURER = "LILYGO"
USB_DEVICES = "CDC,MSC,HID"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

View File

@ -2,7 +2,6 @@ USB_VID = 0x239A
USB_PID = 0x80C6
USB_PRODUCT = "microS2"
USB_MANUFACTURER = "microDev"
USB_DEVICES = "CDC,MSC,HID"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

View File

@ -2,7 +2,6 @@ USB_VID = 0x239A
USB_PID = 0x80AC
USB_PRODUCT = "FeatherS2"
USB_MANUFACTURER = "UnexpectedMaker"
USB_DEVICES = "CDC,MSC,HID"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

View File

@ -2,7 +2,6 @@ USB_VID = 0x239A
USB_PID = 0x80AC
USB_PRODUCT = "FeatherS2"
USB_MANUFACTURER = "UnexpectedMaker"
USB_DEVICES = "CDC,MSC,HID"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -28,6 +28,8 @@ CIRCUITPY_FREQUENCYIO = 1
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_ROTARYIO = 1
CIRCUITPY_NVM = 1
CIRCUITPY_PS2IO ?= 1
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
# We don't have enough endpoints to include MIDI.
CIRCUITPY_USB_MIDI ?= 0
CIRCUITPY_USB_HID ?= 1
@ -35,14 +37,9 @@ CIRCUITPY_USB_HID ?= 1
CIRCUITPY_USB_VENDOR ?= 0
CIRCUITPY_WIFI = 1
CIRCUITPY_WATCHDOG ?= 1
CIRCUITPY_ESPIDF = 1
ifndef CIRCUITPY_PS2IO
CIRCUITPY_PS2IO = 1
endif
ifndef CIRCUITPY_TOUCHIO_USE_NATIVE
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
endif
CIRCUITPY_MODULE ?= none
USB_NUM_EP = 5

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -6,6 +6,9 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
# Internal math library is substantially smaller than toolchain one
INTERNAL_LIBM = 1
# Number of USB endpoint pairs.
USB_NUM_EP = 16
# Chip supplied serial number, in bytes
USB_SERIAL_NUMBER_LENGTH = 30

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -17,6 +17,9 @@ INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32
USB_HIGHSPEED = 1
# Number of USB endpoint pairs.
USB_NUM_EP = 8
INTERNAL_FLASH_FILESYSTEM = 1
CIRCUITPY_AUDIOIO = 0

View File

@ -40,7 +40,7 @@
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#if CIRCUITPY_SERIAL_BLE
#if CIRCUITPY_REPL_BLE
static const char default_name[] = "CP-REPL"; // max 8 chars or uuid won't fit in adv data
static const char NUS_UUID[] = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
@ -190,4 +190,4 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
}
}
#endif // CIRCUITPY_SERIAL_BLE
#endif // CIRCUITPY_REPL_BLE

View File

@ -30,27 +30,27 @@
#define MICROPY_HW_BOARD_NAME "TG-Watch"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_HW_NEOPIXEL (&pin_P0_16)
#define MICROPY_HW_LED_STATUS (&pin_P1_15)
// TG-Gui requires a deeper call stack than normal CircuitPython
// TG-Gui requires a deeper call stack than normal CircuitPython, this is intentional overkill
#define CIRCUITPY_PYSTACK_SIZE 8192 // 1536 is the normal size, (32 bytes/frame * 48 frames)
#define BOARD_HAS_CRYSTAL 0
// the board has a 32mhz crystal but NOT a 32khz one
#define BOARD_HAS_32KHZ_XTAL 0
#define BOARD_HAS_CRYSTAL 1
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
#endif
#if SPI_FLASH_FILESYSTEM
#define SPI_FLASH_MOSI_PIN &pin_P0_17
#define SPI_FLASH_MISO_PIN &pin_P0_22
#define SPI_FLASH_SCK_PIN &pin_P0_19
#define SPI_FLASH_CS_PIN &pin_P0_20
#define SPI_FLASH_MOSI_PIN &pin_P0_17
#define SPI_FLASH_MISO_PIN &pin_P0_22
#define SPI_FLASH_SCK_PIN &pin_P0_19
#define SPI_FLASH_CS_PIN &pin_P0_20
#endif
#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)

View File

@ -29,6 +29,7 @@ CIRCUITPY_BUSDEVICE = 0
MICROPY_PY_ASYNC_AWAIT = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

View File

@ -3,8 +3,6 @@ USB_PID = 0xc051
USB_PRODUCT = "Simmel"
USB_MANUFACTURER = "Betrusted"
CIRCUITPY_DEVICES="CDC,MSC,HID"
MCU_CHIP = nrf52833
# SPI_FLASH_FILESYSTEM = 1
@ -31,6 +29,7 @@ CIRCUITPY_RTC = 1
CIRCUITPY_SDCARDIO = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_ULAB = 0
CIRCUITPY_USB_CDC = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_WATCHDOG = 1

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -11,6 +11,9 @@ INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 16
# Number of USB endpoint pairs.
USB_NUM_EP = 8
# All nRF ports have longints.
LONGINT_IMPL = MPZ

View File

@ -28,15 +28,15 @@
#include "supervisor/serial.h"
#if CIRCUITPY_SERIAL_BLE
#if CIRCUITPY_REPL_BLE
#include "ble_uart.h"
#elif CIRCUITPY_SERIAL_UART
#elif CIRCUITPY_REPL_UART
#include <string.h>
#include "nrf_gpio.h"
#include "nrfx_uarte.h"
#endif
#if CIRCUITPY_SERIAL_BLE
#if CIRCUITPY_REPL_BLE
void serial_init(void) {
ble_uart_init();
@ -58,7 +58,7 @@ void serial_write(const char *text) {
ble_uart_stdout_tx_str(text);
}
#elif CIRCUITPY_SERIAL_UART
#elif CIRCUITPY_REPL_UART
uint8_t serial_received_char;
nrfx_uarte_t serial_instance = NRFX_UARTE_INSTANCE(0);
@ -124,4 +124,4 @@ void serial_write_substring(const char *text, uint32_t len) {
}
}
#endif // CIRCUITPY_SERIAL_UART
#endif // CIRCUITPY_REPL_UART

View File

@ -199,6 +199,7 @@ SRC_C += \
audio_dma.c \
background.c \
peripherals/pins.c \
extmod/crypto-algorithms/sha256.c \
fatfs_port.c \
lib/libc/string0.c \
lib/mp-readline/readline.c \

View File

@ -30,6 +30,11 @@
#include "py/objtuple.h"
#include "py/qstr.h"
#include "extmod/crypto-algorithms/sha256.h"
#include "hardware/structs/rosc.h"
#include <string.h>
STATIC const qstr os_uname_info_fields[] = {
MP_QSTR_sysname, MP_QSTR_nodename,
@ -57,6 +62,64 @@ mp_obj_t common_hal_os_uname(void) {
return (mp_obj_t)&os_uname_info_obj;
}
bool common_hal_os_urandom(uint8_t* buffer, uint32_t length) {
return false;
// NIST Special Publication 800-90B (draft) recommends several extractors,
// including the SHA hash family and states that if the amount of entropy input
// is twice the number of bits output from them, that output can be considered
// essentially fully random. If every RANDOM_SAFETY_MARGIN bits from
// `rosc_hw->randombit` have at least 1 bit of entropy, then this criterion is met.
//
// This works by seeding the `random_state` with plenty of random bits (SHA256
// as entropy harvesting function), then using that state it as a counter input
// (SHA256 as a CSPRNG), re-seeding at least every 256 blocks (8kB).
//
// In practice, `PractRand` doesn't detect any gross problems with the output
// random numbers on samples of 1 to 8 megabytes, no matter the setting of
// RANDOM_SAFETY_MARGIN. (it does detect "unusual" results from time to time,
// as it will with any RNG)
#define RANDOM_SAFETY_MARGIN (4)
static BYTE random_state[SHA256_BLOCK_SIZE];
static void seed_random_bits(BYTE out[SHA256_BLOCK_SIZE]) {
CRYAL_SHA256_CTX context;
sha256_init(&context);
for (int i=0; i<2*RANDOM_SAFETY_MARGIN; i++) {
for(int j=0; j<SHA256_BLOCK_SIZE; j++) {
out[j] = rosc_hw->randombit & 1;
for(int k=0; k<8; k++) {
out[j] = (out[j] << 1) ^ (rosc_hw->randombit & 1);
}
}
sha256_update(&context, out, SHA256_BLOCK_SIZE);
}
sha256_final(&context, out);
}
static void get_random_bits(BYTE out[SHA256_BLOCK_SIZE]) {
if (!random_state[0]++) {
seed_random_bits(random_state);
}
CRYAL_SHA256_CTX context;
sha256_init(&context);
sha256_update(&context, random_state, SHA256_BLOCK_SIZE);
sha256_final(&context, out);
}
bool common_hal_os_urandom(uint8_t* buffer, uint32_t length) {
#define ROSC_POWER_SAVE (1) // assume ROSC is not necessarily active all the time
#if ROSC_POWER_SAVE
uint32_t old_rosc_ctrl = rosc_hw->ctrl;
rosc_hw->ctrl = (old_rosc_ctrl & ~ROSC_CTRL_ENABLE_BITS) | (ROSC_CTRL_ENABLE_VALUE_ENABLE << 12);
#endif
while (length) {
size_t n = MIN(length, SHA256_BLOCK_SIZE);
BYTE sha_buf[SHA256_BLOCK_SIZE];
get_random_bits(sha_buf);
memcpy(buffer, sha_buf, n);
buffer += n;
length -= n;
}
#if ROSC_POWER_SAVE
rosc_hw->ctrl = old_rosc_ctrl;
#endif
return true;
}

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -24,6 +24,7 @@ CIRCUITPY_NEOPIXEL_WRITE = 0
endif
CIRCUITPY_FULL_BUILD = 1
CIRCUITPY_BITOPS = 1
CIRCUITPY_PWMIO = 1
# Things that need to be implemented.
@ -49,4 +50,5 @@ INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 16
# Number of USB endpoint pairs.
USB_NUM_EP = 8

View File

@ -21,5 +21,6 @@ LD_FILE = boards/STM32F401xd_fs.ld
# meantime
CIRCUITPY_ULAB = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_FRAMEBUFFERIO = 0
SUPEROPT_GC = 0

View File

@ -16,5 +16,3 @@ MCU_PACKAGE = LQFP144
LD_COMMON = boards/common_default.ld
LD_FILE = boards/STM32F412_fs.ld
CIRCUITPY_USB_HID = 1

View File

@ -2,7 +2,9 @@ USB_VID = 0x239A
USB_PID = 0x8071
USB_PRODUCT = "Thunderpack STM32F411"
USB_MANUFACTURER = "Jeremy Gillick"
USB_DEVICES = "CDC,MSC"
# Turn off HID devices
CIRCUITPY_USB_HID = 0
LONGINT_IMPL = NONE

View File

@ -61,6 +61,7 @@ STATIC bool never_reset_i2c[MAX_I2C];
#define ALL_CLOCKS 0xFF
STATIC void i2c_clock_enable(uint8_t mask);
STATIC void i2c_clock_disable(uint8_t mask);
STATIC void i2c_assign_irq(busio_i2c_obj_t *self, I2C_TypeDef * I2Cx);
void i2c_reset(void) {
uint16_t never_reset_mask = 0x00;
@ -136,6 +137,10 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
i2c_clock_enable(1 << (self->sda->periph_index - 1));
reserved_i2c[self->sda->periph_index - 1] = true;
// Create root pointer and assign IRQ
MP_STATE_PORT(cpy_i2c_obj_all)[self->sda->periph_index - 1] = self;
i2c_assign_irq(self, I2Cx);
// Handle the HAL handle differences
#if (CPY_STM32H7 || CPY_STM32F7)
if (frequency == 400000) {
@ -163,6 +168,13 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
}
common_hal_mcu_pin_claim(sda);
common_hal_mcu_pin_claim(scl);
self->frame_in_prog = false;
//start the receive interrupt chain
HAL_NVIC_DisableIRQ(self->irq); //prevent handle lock contention
HAL_NVIC_SetPriority(self->irq, 1, 0);
HAL_NVIC_EnableIRQ(self->irq);
}
void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) {
@ -229,15 +241,46 @@ void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) {
uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr,
const uint8_t *data, size_t len, bool transmit_stop_bit) {
HAL_StatusTypeDef result = HAL_I2C_Master_Transmit(&(self->handle), (uint16_t)(addr << 1),
HAL_StatusTypeDef result;
if (!transmit_stop_bit) {
uint32_t xfer_opt;
if (!self->frame_in_prog) {
xfer_opt = I2C_FIRST_FRAME;
} else {
// handle rare possibility of multiple restart writes in a row
xfer_opt = I2C_NEXT_FRAME;
}
result = HAL_I2C_Master_Seq_Transmit_IT(&(self->handle),
(uint16_t)(addr << 1), (uint8_t *)data,
(uint16_t)len, xfer_opt);
while (HAL_I2C_GetState(&(self->handle)) != HAL_I2C_STATE_READY)
{
RUN_BACKGROUND_TASKS;
}
self->frame_in_prog = true;
} else {
result = HAL_I2C_Master_Transmit(&(self->handle), (uint16_t)(addr << 1),
(uint8_t *)data, (uint16_t)len, 500);
}
return result == HAL_OK ? 0 : MP_EIO;
}
uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr,
uint8_t *data, size_t len) {
return HAL_I2C_Master_Receive(&(self->handle), (uint16_t)(addr<<1), data, (uint16_t)len, 500)
if (!self->frame_in_prog) {
return HAL_I2C_Master_Receive(&(self->handle), (uint16_t)(addr<<1), data, (uint16_t)len, 500)
== HAL_OK ? 0 : MP_EIO;
} else {
HAL_StatusTypeDef result = HAL_I2C_Master_Seq_Receive_IT(&(self->handle),
(uint16_t)(addr << 1), (uint8_t *)data,
(uint16_t)len, I2C_LAST_FRAME);
while (HAL_I2C_GetState(&(self->handle)) != HAL_I2C_STATE_READY)
{
RUN_BACKGROUND_TASKS;
}
self->frame_in_prog = false;
return result;
}
}
STATIC void i2c_clock_enable(uint8_t mask) {
@ -294,3 +337,48 @@ STATIC void i2c_clock_disable(uint8_t mask) {
}
#endif
}
STATIC void i2c_assign_irq(busio_i2c_obj_t *self, I2C_TypeDef * I2Cx) {
#ifdef I2C1
if (I2Cx == I2C1) {
self->irq = I2C1_EV_IRQn;
}
#endif
#ifdef I2C2
if (I2Cx == I2C2) {
self->irq = I2C2_EV_IRQn;
}
#endif
#ifdef I2C3
if (I2Cx == I2C3) {
self->irq = I2C3_EV_IRQn;
}
#endif
#ifdef I2C4
if (I2Cx == I2C4) {
self->irq = I2C4_EV_IRQn;
}
#endif
}
STATIC void call_hal_irq(int i2c_num) {
//Create casted context pointer
busio_i2c_obj_t * context = (busio_i2c_obj_t*)MP_STATE_PORT(cpy_i2c_obj_all)[i2c_num - 1];
if (context != NULL) {
HAL_NVIC_ClearPendingIRQ(context->irq);
HAL_I2C_EV_IRQHandler(&context->handle);
}
}
void I2C1_EV_IRQHandler(void) {
call_hal_irq(1);
}
void I2C2_EV_IRQHandler(void) {
call_hal_irq(2);
}
void I2C3_EV_IRQHandler(void) {
call_hal_irq(3);
}
void I2C4_EV_IRQHandler(void) {
call_hal_irq(4);
}

View File

@ -37,6 +37,8 @@
typedef struct {
mp_obj_base_t base;
I2C_HandleTypeDef handle;
IRQn_Type irq;
bool frame_in_prog;
bool has_lock;
const mcu_periph_obj_t *scl;
const mcu_periph_obj_t *sda;

View File

@ -28,10 +28,10 @@
#include "shared-bindings/supervisor/Runtime.h"
#include "supervisor/serial.h"
bool common_hal_get_serial_connected(void) {
bool common_hal_supervisor_runtime_get_serial_connected(void) {
return (bool) serial_connected();
}
bool common_hal_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
bool common_hal_supervisor_runtime_get_serial_bytes_available(void) {
return (bool) serial_bytes_available();
}

View File

@ -52,10 +52,14 @@ extern uint8_t _ld_default_stack_size;
#define BOARD_NO_VBUS_SENSE (0)
#endif
#define MAX_UART 10 //how many UART are implemented
// Peripheral implementation counts
#define MAX_UART 10
#define MAX_I2C 4
#define MAX_SPI 6
#define MICROPY_PORT_ROOT_POINTERS \
void *cpy_uart_obj_all[MAX_UART]; \
void *cpy_i2c_obj_all[MAX_I2C]; \
CIRCUITPY_COMMON_ROOT_POINTERS
#endif // __INCLUDED_MPCONFIGPORT_H

View File

@ -8,6 +8,7 @@ ifeq ($(MCU_VARIANT),STM32F405xx)
CIRCUITPY_FRAMEBUFFERIO ?= 1
CIRCUITPY_RGBMATRIX ?= 1
CIRCUITPY_SDIOIO ?= 1
# Number of USB endpoint pairs.
USB_NUM_EP = 4
endif
@ -23,6 +24,8 @@ ifeq ($(MCU_SERIES),F4)
CIRCUITPY_RTC ?= 0
CIRCUITPY_USB_MIDI ?= 0
CIRCUITPY_USB_HID ?= 0
USB_NUM_EP = 4
endif
ifeq ($(MCU_SERIES),H7)
@ -40,6 +43,8 @@ ifeq ($(MCU_SERIES),H7)
CIRCUITPY_RTC ?= 0
CIRCUITPY_USB_HID ?= 0
CIRCUITPY_USB_MIDI ?= 0
USB_NUM_EP = 9
endif
ifeq ($(MCU_SERIES),F7)
@ -56,4 +61,6 @@ ifeq ($(MCU_SERIES),F7)
CIRCUITPY_RTC ?= 0
CIRCUITPY_USB_HID ?= 0
CIRCUITPY_USB_MIDI ?= 0
USB_NUM_EP = 6
endif

View File

@ -139,6 +139,9 @@ endif
ifeq ($(CIRCUITPY_BITBANG_APA102),1)
SRC_PATTERNS += bitbangio/SPI%
endif
ifeq ($(CIRCUITPY_BITOPS),1)
SRC_PATTERNS += bitops/%
endif
ifeq ($(CIRCUITPY_BLEIO),1)
SRC_PATTERNS += _bleio/%
endif
@ -286,6 +289,9 @@ endif
ifeq ($(CIRCUITPY_UHEAP),1)
SRC_PATTERNS += uheap/%
endif
ifeq ($(CIRCUITPY_USB_CDC),1)
SRC_PATTERNS += usb_cdc/%
endif
ifeq ($(CIRCUITPY_USB_HID),1)
SRC_PATTERNS += usb_hid/%
endif
@ -466,6 +472,7 @@ SRC_SHARED_MODULE_ALL = \
bitbangio/OneWire.c \
bitbangio/SPI.c \
bitbangio/__init__.c \
bitops/__init__.c \
board/__init__.c \
adafruit_bus_device/__init__.c \
adafruit_bus_device/I2CDevice.c \

View File

@ -306,6 +306,14 @@ extern const struct _mp_obj_module_t bitbangio_module;
#define BITBANGIO_MODULE
#endif
#if CIRCUITPY_BITOPS
extern const struct _mp_obj_module_t bitops_module;
#define BITOPS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_bitops),(mp_obj_t)&bitops_module },
#else
#define BITOPS_MODULE
#endif
#if CIRCUITPY_BLEIO
#define BLEIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__bleio), (mp_obj_t)&bleio_module },
extern const struct _mp_obj_module_t bleio_module;
@ -736,6 +744,13 @@ extern const struct _mp_obj_module_t uheap_module;
#define UHEAP_MODULE
#endif
#if CIRCUITPY_USB_CDC
extern const struct _mp_obj_module_t usb_cdc_module;
#define USB_CDC_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_usb_cdc),(mp_obj_t)&usb_cdc_module },
#else
#define USB_CDC_MODULE
#endif
#if CIRCUITPY_USB_HID
extern const struct _mp_obj_module_t usb_hid_module;
#define USB_HID_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module },
@ -820,6 +835,7 @@ extern const struct _mp_obj_module_t msgpack_module;
AUDIOPWMIO_MODULE \
BINASCII_MODULE \
BITBANGIO_MODULE \
BITOPS_MODULE \
BLEIO_MODULE \
BOARD_MODULE \
BUSDEVICE_MODULE \
@ -875,6 +891,7 @@ extern const struct _mp_obj_module_t msgpack_module;
SUPERVISOR_MODULE \
TOUCHIO_MODULE \
UHEAP_MODULE \
USB_CDC_MODULE \
USB_HID_MODULE \
USB_MIDI_MODULE \
USTACK_MODULE \

View File

@ -89,9 +89,15 @@ CFLAGS += -DCIRCUITPY_AUDIOMP3=$(CIRCUITPY_AUDIOMP3)
CIRCUITPY_BINASCII ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_BINASCII=$(CIRCUITPY_BINASCII)
CIRCUITPY_BITBANG_APA102 ?= 0
CFLAGS += -DCIRCUITPY_BITBANG_APA102=$(CIRCUITPY_BITBANG_APA102)
CIRCUITPY_BITBANGIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_BITBANGIO=$(CIRCUITPY_BITBANGIO)
CIRCUITPY_BITOPS ?= 0
CFLAGS += -DCIRCUITPY_BITOPS=$(CIRCUITPY_BITOPS)
# _bleio can be supported on most any board via HCI
CIRCUITPY_BLEIO_HCI ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_BLEIO_HCI=$(CIRCUITPY_BLEIO_HCI)
@ -100,6 +106,9 @@ CFLAGS += -DCIRCUITPY_BLEIO_HCI=$(CIRCUITPY_BLEIO_HCI)
CIRCUITPY_BLEIO ?= $(CIRCUITPY_BLEIO_HCI)
CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO)
CIRCUITPY_BLE_FILE_SERVICE ?= 0
CFLAGS += -DCIRCUITPY_BLE_FILE_SERVICE=$(CIRCUITPY_BLE_FILE_SERVICE)
CIRCUITPY_BOARD ?= 1
CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD)
@ -127,6 +136,13 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
CIRCUITPY_DUALBANK ?= 0
CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK)
# Enabled micropython.native decorator (experimental)
CIRCUITPY_ENABLE_MPY_NATIVE ?= 0
CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE)
CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO)
@ -179,6 +195,9 @@ CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR)
CIRCUITPY_MICROCONTROLLER ?= 1
CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER)
CIRCUITPY_MSGPACK ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK)
CIRCUITPY_NEOPIXEL_WRITE ?= 1
CFLAGS += -DCIRCUITPY_NEOPIXEL_WRITE=$(CIRCUITPY_NEOPIXEL_WRITE)
@ -192,8 +211,8 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM)
CIRCUITPY_OS ?= 1
CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS)
CIRCUITPY_DUALBANK ?= 0
CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK)
CIRCUITPY_PEW ?= 0
CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW)
CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF)
@ -216,6 +235,20 @@ CFLAGS += -DCIRCUITPY_RANDOM=$(CIRCUITPY_RANDOM)
CIRCUITPY_RE ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_RE=$(CIRCUITPY_RE)
CIRCUITPY_REPL_BLE ?= 0
CFLAGS += -DCIRCUITPY_REPL_BLE=$(CIRCUITPY_REPL_BLE)
CIRCUITPY_REPL_UART ?= 0
CFLAGS += -DCIRCUITPY_REPL_UART=$(CIRCUITPY_REPL_UART)
CIRCUITPY_REPL_USB ?= 1
CFLAGS += -DCIRCUITPY_REPL_USB=$(CIRCUITPY_REPL_USB)
# Should busio.I2C() check for pullups?
# Some boards in combination with certain peripherals may not want this.
CIRCUITPY_REQUIRE_I2C_PULLUPS ?= 1
CFLAGS += -DCIRCUITPY_REQUIRE_I2C_PULLUPS=$(CIRCUITPY_REQUIRE_I2C_PULLUPS)
# CIRCUITPY_RP2PIO is handled in the raspberrypi tree.
# Only for rp2 chips.
# Assume not a rp2 build.
@ -282,46 +315,54 @@ CFLAGS += -DCIRCUITPY_TOUCHIO=$(CIRCUITPY_TOUCHIO)
CIRCUITPY_UHEAP ?= 0
CFLAGS += -DCIRCUITPY_UHEAP=$(CIRCUITPY_UHEAP)
# Secondary CDC is usually available if there are at least 8 endpoints.
CIRCUITPY_USB_CDC ?= $(shell expr $(USB_NUM_EP) '>=' 8)
CFLAGS += -DCIRCUITPY_USB_CDC=$(CIRCUITPY_USB_CDC)
CIRCUITPY_USB_HID ?= 1
CFLAGS += -DCIRCUITPY_USB_HID=$(CIRCUITPY_USB_HID)
CIRCUITPY_USB_HID_CONSUMER ?= 1
CFLAGS += -DCIRCUITPY_USB_HID_CONSUMER=$(CIRCUITPY_USB_HID_CONSUMER)
CIRCUITPY_USB_HID_DIGITIZER ?= 0
CFLAGS += -DCIRCUITPY_USB_HID_DIGITIZER=$(CIRCUITPY_USB_HID_DIGITIZER)
CIRCUITPY_USB_HID_GAMEPAD ?= 1
CFLAGS += -DCIRCUITPY_USB_HID_GAMEPAD=$(CIRCUITPY_USB_HID_GAMEPAD)
CIRCUITPY_USB_HID_KEYBOARD ?= 1
CFLAGS += -DCIRCUITPY_USB_HID_KEYBOARD=$(CIRCUITPY_USB_HID_KEYBOARD)
CIRCUITPY_USB_HID_MOUSE ?= 1
CFLAGS += -DCIRCUITPY_USB_HID_MOUSE=$(CIRCUITPY_USB_HID_MOUSE)
CIRCUITPY_USB_HID_SYS_CONTROL ?= 0
CFLAGS += -DCIRCUITPY_USB_HID_CONTROL=$(CIRCUITPY_USB_HID_CONTROL)
CIRCUITPY_USB_HID_XAC_COMPATIBLE_GAMEPAD ?= 0
CFLAGS += -DCIRCUITPY_USB_HID_XAC_COMPATIBLE_GAMEPAD=$(CIRCUITPY_USB_HID_XAC_COMPATIBLE_GAMEPAD)
CIRCUITPY_USB_MIDI ?= 1
CFLAGS += -DCIRCUITPY_USB_MIDI=$(CIRCUITPY_USB_MIDI)
CIRCUITPY_USB_MSC ?= 1
CFLAGS += -DCIRCUITPY_USB_MSC=$(CIRCUITPY_USB_MSC)
# Defaulting this to OFF initially because it has only been tested on a
# limited number of platforms, and the other platforms do not have this
# setting in their mpconfigport.mk and/or mpconfigboard.mk files yet.
CIRCUITPY_USB_VENDOR ?= 0
CFLAGS += -DCIRCUITPY_USB_VENDOR=$(CIRCUITPY_USB_VENDOR)
CIRCUITPY_PEW ?= 0
CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW)
ifndef USB_NUM_EP
$(error "USB_NUM_EP (number of USB endpoint pairs)must be defined")
endif
# For debugging.
CIRCUITPY_USTACK ?= 0
CFLAGS += -DCIRCUITPY_USTACK=$(CIRCUITPY_USTACK)
# Non-module conditionals
CIRCUITPY_BITBANG_APA102 ?= 0
CFLAGS += -DCIRCUITPY_BITBANG_APA102=$(CIRCUITPY_BITBANG_APA102)
# Should busio.I2C() check for pullups?
# Some boards in combination with certain peripherals may not want this.
CIRCUITPY_REQUIRE_I2C_PULLUPS ?= 1
CFLAGS += -DCIRCUITPY_REQUIRE_I2C_PULLUPS=$(CIRCUITPY_REQUIRE_I2C_PULLUPS)
# REPL over BLE
CIRCUITPY_SERIAL_BLE ?= 0
CFLAGS += -DCIRCUITPY_SERIAL_BLE=$(CIRCUITPY_SERIAL_BLE)
CIRCUITPY_BLE_FILE_SERVICE ?= 0
CFLAGS += -DCIRCUITPY_BLE_FILE_SERVICE=$(CIRCUITPY_BLE_FILE_SERVICE)
# REPL over UART
CIRCUITPY_SERIAL_UART ?= 0
CFLAGS += -DCIRCUITPY_SERIAL_UART=$(CIRCUITPY_SERIAL_UART)
# ulab numerics library
CIRCUITPY_ULAB ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_ULAB=$(CIRCUITPY_ULAB)
@ -332,10 +373,3 @@ CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG)
CIRCUITPY_WIFI ?= 0
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI)
# Enabled micropython.native decorator (experimental)
CIRCUITPY_ENABLE_MPY_NATIVE ?= 0
CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE)
CIRCUITPY_MSGPACK ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK)

View File

@ -99,14 +99,22 @@ const mp_stream_p_t *mp_get_stream_raise(mp_obj_t self_in, int flags) {
STATIC mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte flags) {
// What to do if sz < -1? Python docs don't specify this case.
// CPython does a readall, but here we silently let negatives through,
// and they will cause a MemoryError.
// CPython does a readall, let's do the same.
mp_int_t sz;
if (n_args == 1 || args[1] == mp_const_none || ((sz = mp_obj_get_int(args[1])) == -1)) {
return stream_readall(args[0]);
}
const mp_stream_p_t *stream_p = mp_get_stream(args[0]);
if (stream_p->pyserial_read_compatibility) {
// Pyserial defaults to sz=1 if not specified.
if (n_args == 1) {
sz = 1;
} else {
// Pyserial treats negative size as 0.
sz = MAX(0, mp_obj_get_int(args[1]));
}
} else {
if (n_args == 1 || args[1] == mp_const_none || (sz = mp_obj_get_int(args[1])) <= -1) {
return stream_readall(args[0]);
}
}
#if MICROPY_PY_BUILTINS_STR_UNICODE
if (stream_p->is_text) {
@ -284,7 +292,7 @@ STATIC mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
// https://docs.python.org/3/library/socket.html#socket.socket.recv_into
mp_uint_t len = bufinfo.len;
if (n_args > 2) {
if (mp_get_stream(args[0])->pyserial_compatibility) {
if (mp_get_stream(args[0])->pyserial_readinto_compatibility) {
mp_raise_ValueError(translate("length argument not allowed for this type"));
}
len = mp_obj_get_int(args[2]);
@ -297,7 +305,10 @@ STATIC mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
mp_uint_t out_sz = mp_stream_read_exactly(args[0], bufinfo.buf, len, &error);
if (error != 0) {
if (mp_is_nonblocking_error(error)) {
return mp_const_none;
// pyserial readinto never returns None, just 0.
return mp_get_stream(args[0])->pyserial_dont_return_none_compatibility
? MP_OBJ_NEW_SMALL_INT(0)
: mp_const_none;
}
mp_raise_OSError(error);
} else {
@ -323,7 +334,10 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) {
// If we read nothing, return None, just like read().
// Otherwise, return data read so far.
if (total_size == 0) {
return mp_const_none;
// pyserial read() never returns None, just b''.
return stream_p->pyserial_dont_return_none_compatibility
? mp_const_empty_bytes
: mp_const_none;
}
break;
}

View File

@ -72,7 +72,9 @@ typedef struct _mp_stream_p_t {
mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode);
mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *errcode);
mp_uint_t is_text : 1; // default is bytes, set this for text stream
bool pyserial_compatibility: 1; // adjust API to match pyserial more closely
bool pyserial_readinto_compatibility: 1; // Disallow size parameter in readinto()
bool pyserial_read_compatibility: 1; // Disallow omitting read(size) size parameter
bool pyserial_dont_return_none_compatibility: 1; // Don't return None for read() or readinto()
} mp_stream_p_t;
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read_obj);

View File

@ -231,8 +231,8 @@ STATIC const mp_stream_p_t characteristic_buffer_stream_p = {
.write = bleio_characteristic_buffer_write,
.ioctl = bleio_characteristic_buffer_ioctl,
.is_text = false,
// Match PySerial when possible, such as disallowing optional length argument for .readinto()
.pyserial_compatibility = true,
// Disallow readinto() size parameter.
.pyserial_readinto_compatibility = true,
};

View File

@ -0,0 +1,101 @@
/*
* This file is part of the Circuit Python project, https://github.com/adafruit/circuitpython
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler 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 "py/obj.h"
#include "py/runtime.h"
#include "shared-bindings/bitops/__init__.h"
//| """Routines for low-level manipulation of binary data"""
//|
//|
//| def bit_transpose(input: ReadableBuffer, output: WriteableBuffer, width:int = 8) -> WriteableBuffer:
//| """"Transpose" a buffer by assembling each output byte with bits taken from each of ``width`` different input bytes.
//|
//| This can be useful to convert a sequence of pixel values into a single
//| stream of bytes suitable for sending via a parallel conversion method.
//|
//| The number of bytes in the input buffer must be a multiple of the width,
//| and the width can be any value from 2 to 8. If the width is fewer than 8,
//| then the remaining (less significant) bits of the output are set to zero.
//|
//| Let ``stride = len(input)//width``. Then the first byte is made out of the
//| most significant bits of ``[input[0], input[stride], input[2*stride], ...]``.
//| The second byte is made out of the second bits, and so on until the 8th output
//| byte which is made of the first bits of ``input[1], input[1+stride,
//| input[2*stride], ...]``.
//|
//| The required output buffer size is ``len(input) * 8 // width``.
//|
//| Returns the output buffer."""
//| ...
STATIC mp_obj_t bit_transpose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_input, ARG_output, ARG_width };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_input, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_output, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_width, MP_ARG_INT, { .u_int = 8 } },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
int width = args[ARG_width].u_int;
if (width < 2 || width > 8) {
mp_raise_ValueError_varg(translate("width must be from 2 to 8 (inclusive), not %d"), width);
}
mp_buffer_info_t input_bufinfo;
mp_get_buffer_raise(args[ARG_input].u_obj, &input_bufinfo, MP_BUFFER_READ);
int inlen = input_bufinfo.len;
if (inlen % width != 0) {
mp_raise_ValueError_varg(translate("Input buffer length (%d) must be a multiple of the strand count (%d)"), inlen, width);
}
mp_buffer_info_t output_bufinfo;
mp_get_buffer_raise(args[ARG_output].u_obj, &output_bufinfo, MP_BUFFER_WRITE);
int avail = output_bufinfo.len;
int outlen = 8 * (inlen / width);
if (avail < outlen) {
mp_raise_ValueError_varg(translate("Output buffer must be at least %d bytes"), outlen);
}
common_hal_bitops_bit_transpose(output_bufinfo.buf, input_bufinfo.buf, inlen, width);
return args[ARG_output].u_obj;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitops_bit_transpose_obj, 1, bit_transpose);
STATIC const mp_rom_map_elem_t bitops_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bitops) },
{ MP_ROM_QSTR(MP_QSTR_bit_transpose), MP_ROM_PTR(&bitops_bit_transpose_obj) },
};
STATIC MP_DEFINE_CONST_DICT(bitops_module_globals, bitops_module_globals_table);
const mp_obj_module_t bitops_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&bitops_module_globals,
};

View File

@ -0,0 +1,32 @@
/*
* This file is part of the Circuit Python project, https://github.com/adafruit/circuitpython
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler
*
* 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.
*/
#pragma once
#include <stdint.h>
#include <stdlib.h>
void common_hal_bitops_bit_transpose(uint8_t *result, const uint8_t *src, size_t inlen, size_t num_strands);

View File

@ -415,8 +415,8 @@ STATIC const mp_stream_p_t uart_stream_p = {
.write = busio_uart_write,
.ioctl = busio_uart_ioctl,
.is_text = false,
// Match PySerial when possible, such as disallowing optional length argument for .readinto()
.pyserial_compatibility = true,
// Disallow optional length argument for .readinto()
.pyserial_readinto_compatibility = true,
};
const mp_obj_type_t busio_uart_type = {

View File

@ -55,59 +55,46 @@ STATIC supervisor_run_reason_t _run_reason;
//| serial_connected: bool
//| """Returns the USB serial communication status (read-only)."""
//|
STATIC mp_obj_t supervisor_get_serial_connected(mp_obj_t self){
if (!common_hal_get_serial_connected()) {
return mp_const_false;
}
else {
return mp_const_true;
}
STATIC mp_obj_t supervisor_runtime_get_serial_connected(mp_obj_t self){
return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial_connected());
}
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_serial_connected_obj, supervisor_get_serial_connected);
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial_connected_obj, supervisor_runtime_get_serial_connected);
const mp_obj_property_t supervisor_serial_connected_obj = {
const mp_obj_property_t supervisor_runtime_serial_connected_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&supervisor_get_serial_connected_obj,
.proxy = {(mp_obj_t)&supervisor_runtime_get_serial_connected_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| serial_bytes_available: int
//| """Returns the whether any bytes are available to read
//| on the USB serial input. Allows for polling to see whether
//| to call the built-in input() or wait. (read-only)"""
//|
STATIC mp_obj_t supervisor_get_serial_bytes_available(mp_obj_t self){
if (!common_hal_get_serial_bytes_available()) {
return mp_const_false;
}
else {
return mp_const_true;
}
STATIC mp_obj_t supervisor_runtime_get_serial_bytes_available(mp_obj_t self){
return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial_bytes_available());
}
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_serial_bytes_available_obj, supervisor_get_serial_bytes_available);
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial_bytes_available_obj, supervisor_runtime_get_serial_bytes_available);
const mp_obj_property_t supervisor_serial_bytes_available_obj = {
const mp_obj_property_t supervisor_runtime_serial_bytes_available_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&supervisor_get_serial_bytes_available_obj,
.proxy = {(mp_obj_t)&supervisor_runtime_get_serial_bytes_available_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| run_reason: RunReason
//| """Returns why CircuitPython started running this particular time."""
//|
STATIC mp_obj_t supervisor_get_run_reason(mp_obj_t self) {
STATIC mp_obj_t supervisor_runtime_get_run_reason(mp_obj_t self) {
return cp_enum_find(&supervisor_run_reason_type, _run_reason);
}
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_run_reason_obj, supervisor_get_run_reason);
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_run_reason_obj, supervisor_runtime_get_run_reason);
const mp_obj_property_t supervisor_run_reason_obj = {
const mp_obj_property_t supervisor_runtime_run_reason_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&supervisor_get_run_reason_obj,
.proxy = {(mp_obj_t)&supervisor_runtime_get_run_reason_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
@ -117,9 +104,9 @@ void supervisor_set_run_reason(supervisor_run_reason_t run_reason) {
}
STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_serial_connected_obj) },
{ MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_serial_bytes_available_obj) },
{ MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_run_reason_obj) },
{ MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_runtime_serial_connected_obj) },
{ MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_runtime_serial_bytes_available_obj) },
{ MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_runtime_run_reason_obj) },
};
STATIC MP_DEFINE_CONST_DICT(supervisor_runtime_locals_dict, supervisor_runtime_locals_dict_table);

View File

@ -36,12 +36,12 @@ extern const mp_obj_type_t supervisor_runtime_type;
void supervisor_set_run_reason(supervisor_run_reason_t run_reason);
bool common_hal_get_serial_connected(void);
bool common_hal_supervisor_runtime_get_serial_connected(void);
bool common_hal_get_serial_bytes_available(void);
bool common_hal_supervisor_runtime_get_serial_bytes_available(void);
//TODO: placeholders for future functions
//bool common_hal_get_repl_active(void);
//bool common_hal_get_usb_enumerated(void);
//bool common_hal_get_supervisor_runtime_repl_active(void);
//bool common_hal_get_supervisor_runtime_usb_enumerated(void);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR_RUNTIME_H

View File

@ -0,0 +1,293 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdint.h>
#include "shared-bindings/usb_cdc/Serial.h"
#include "shared-bindings/util.h"
#include "py/ioctl.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "supervisor/shared/translate.h"
//| class Serial:
//| """Receives cdc commands over USB"""
//|
//| def __init__(self) -> None:
//| """You cannot create an instance of `usb_cdc.Serial`.
//|
//| Serial objects are pre-constructed for each CDC device in the USB
//| descriptor and added to the ``usb_cdc.ports`` tuple."""
//| ...
//|
//| def read(self, size: int = 1) -> bytes:
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size
//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``,
//| and fewer than ``size`` bytes are available, keep waiting until the timeout
//| expires or ``size`` bytes are available.
//|
//| :return: Data read
//| :rtype: bytes"""
//| ...
//|
//| def readinto(self, buf: WriteableBuffer) -> int:
//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
//| that many bytes, subject to `timeout`. Otherwise, read at most ``len(buf)`` bytes.
//|
//| :return: number of bytes read and stored into ``buf``
//| :rtype: bytes"""
//| ...
//|
//| def write(self, buf: ReadableBuffer) -> int:
//| """Write as many bytes as possible from the buffer of bytes.
//|
//| :return: the number of bytes written
//| :rtype: int"""
//| ...
//|
//| def flush(self) -> None:
//| """Force out any unwritten bytes, waiting until they are written."""
//| ...
//|
// These three methods are used by the shared stream methods.
STATIC mp_uint_t usb_cdc_serial_read_stream(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
byte *buf = buf_in;
// make sure we want at least 1 char
if (size == 0) {
return 0;
}
return common_hal_usb_cdc_serial_read(self, buf, size, errcode);
}
STATIC mp_uint_t usb_cdc_serial_write_stream(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
const byte *buf = buf_in;
return common_hal_usb_cdc_serial_write(self, buf, size, errcode);
}
STATIC mp_uint_t usb_cdc_serial_ioctl_stream(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret = 0;
switch (request) {
case MP_IOCTL_POLL: {
mp_uint_t flags = arg;
ret = 0;
if ((flags & MP_IOCTL_POLL_RD) && common_hal_usb_cdc_serial_get_in_waiting(self) > 0) {
ret |= MP_IOCTL_POLL_RD;
}
if ((flags & MP_IOCTL_POLL_WR) && common_hal_usb_cdc_serial_get_out_waiting(self) == 0) {
ret |= MP_IOCTL_POLL_WR;
}
break;
}
case MP_STREAM_FLUSH:
common_hal_usb_cdc_serial_flush(self);
break;
default:
*errcode = MP_EINVAL;
ret = MP_STREAM_ERROR;
}
return ret;
}
//| connected: bool
//| """True if this Serial is connected to a host. (read-only)"""
//|
STATIC mp_obj_t usb_cdc_serial_get_connected(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(common_hal_usb_cdc_serial_get_connected(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_get_connected_obj, usb_cdc_serial_get_connected);
const mp_obj_property_t usb_cdc_serial_connected_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&usb_cdc_serial_get_connected_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| in_waiting: int
//| """Returns the number of bytes waiting to be read on the USB serial input. (read-only)"""
//|
STATIC mp_obj_t usb_cdc_serial_get_in_waiting(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(common_hal_usb_cdc_serial_get_in_waiting(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_get_in_waiting_obj, usb_cdc_serial_get_in_waiting);
const mp_obj_property_t usb_cdc_serial_in_waiting_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&usb_cdc_serial_get_in_waiting_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| out_waiting: int
//| """Returns the number of bytes waiting to be written on the USB serial output. (read-only)"""
//|
STATIC mp_obj_t usb_cdc_serial_get_out_waiting(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(common_hal_usb_cdc_serial_get_out_waiting(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_get_out_waiting_obj, usb_cdc_serial_get_out_waiting);
const mp_obj_property_t usb_cdc_serial_out_waiting_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&usb_cdc_serial_get_out_waiting_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| def reset_input_buffer(self) -> None:
//| """Clears any unread bytes."""
//| ...
//|
STATIC mp_obj_t usb_cdc_serial_reset_input_buffer(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_usb_cdc_serial_reset_input_buffer(self);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_reset_input_buffer_obj, usb_cdc_serial_reset_input_buffer);
//| def reset_output_buffer(self) -> None:
//| """Clears any unwritten bytes."""
//| ...
//|
STATIC mp_obj_t usb_cdc_serial_reset_output_buffer(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_usb_cdc_serial_reset_output_buffer(self);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_reset_output_buffer_obj, usb_cdc_serial_reset_output_buffer);
//| timeout: Optional[float]
//| """The initial value of `timeout` is ``None``. If ``None``, wait indefinitely to satisfy
//| the conditions of a read operation. If 0, do not wait. If > 0, wait only ``timeout`` seconds."""
//|
STATIC mp_obj_t usb_cdc_serial_get_timeout(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_float_t timeout = common_hal_usb_cdc_serial_get_timeout(self);
return (timeout < 0.0f) ? mp_const_none : mp_obj_new_float(self->timeout);
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_get_timeout_obj, usb_cdc_serial_get_timeout);
STATIC mp_obj_t usb_cdc_serial_set_timeout(mp_obj_t self_in, mp_obj_t timeout_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_usb_cdc_serial_set_timeout(self,
timeout_in == mp_const_none ? -1.0f : mp_obj_get_float(timeout_in));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(usb_cdc_serial_set_timeout_obj, usb_cdc_serial_set_timeout);
const mp_obj_property_t usb_cdc_serial_timeout_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&usb_cdc_serial_get_timeout_obj,
(mp_obj_t)&usb_cdc_serial_set_timeout_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| write_timeout: Optional[float]
//| """The initial value of `write_timeout` is ``None``. If ``None``, wait indefinitely to finish
//| writing all the bytes passed to ``write()``.If 0, do not wait.
//| If > 0, wait only ``write_timeout`` seconds."""
//|
STATIC mp_obj_t usb_cdc_serial_get_write_timeout(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_float_t write_timeout = common_hal_usb_cdc_serial_get_write_timeout(self);
return (write_timeout < 0.0f) ? mp_const_none : mp_obj_new_float(self->write_timeout);
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_get_write_timeout_obj, usb_cdc_serial_get_write_timeout);
STATIC mp_obj_t usb_cdc_serial_set_write_timeout(mp_obj_t self_in, mp_obj_t write_timeout_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_usb_cdc_serial_set_write_timeout(self,
write_timeout_in == mp_const_none ? -1.0f : mp_obj_get_float(write_timeout_in));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(usb_cdc_serial_set_write_timeout_obj, usb_cdc_serial_set_write_timeout);
const mp_obj_property_t usb_cdc_serial_write_timeout_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&usb_cdc_serial_get_write_timeout_obj,
(mp_obj_t)&usb_cdc_serial_set_write_timeout_obj,
(mp_obj_t)&mp_const_none_obj},
};
STATIC const mp_rom_map_elem_t usb_cdc_serial_locals_dict_table[] = {
// Standard stream methods.
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&mp_stream_flush_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj)},
{ MP_ROM_QSTR(MP_QSTR_readlines), MP_ROM_PTR(&mp_stream_unbuffered_readlines_obj)},
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
// Other pyserial-inspired attributes.
{ MP_OBJ_NEW_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&usb_cdc_serial_in_waiting_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_out_waiting), MP_ROM_PTR(&usb_cdc_serial_out_waiting_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset_input_buffer), MP_ROM_PTR(&usb_cdc_serial_reset_input_buffer_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset_output_buffer), MP_ROM_PTR(&usb_cdc_serial_reset_output_buffer_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_timeout), MP_ROM_PTR(&usb_cdc_serial_timeout_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_write_timeout), MP_ROM_PTR(&usb_cdc_serial_write_timeout_obj) },
// Not in pyserial protocol.
{ MP_OBJ_NEW_QSTR(MP_QSTR_connected), MP_ROM_PTR(&usb_cdc_serial_connected_obj) },
};
STATIC MP_DEFINE_CONST_DICT(usb_cdc_serial_locals_dict, usb_cdc_serial_locals_dict_table);
STATIC const mp_stream_p_t usb_cdc_serial_stream_p = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = usb_cdc_serial_read_stream,
.write = usb_cdc_serial_write_stream,
.ioctl = usb_cdc_serial_ioctl_stream,
.is_text = false,
.pyserial_read_compatibility = true,
.pyserial_readinto_compatibility = true,
.pyserial_dont_return_none_compatibility = true,
};
const mp_obj_type_t usb_cdc_serial_type = {
{ &mp_type_type },
.name = MP_QSTR_Serial,
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &usb_cdc_serial_stream_p,
.locals_dict = (mp_obj_dict_t*)&usb_cdc_serial_locals_dict,
};

View File

@ -0,0 +1,53 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_USB_CDC_SERIAL_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_USB_CDC_SERIAL_H
#include "shared-module/usb_cdc/Serial.h"
extern const mp_obj_type_t usb_cdc_serial_type;
extern size_t common_hal_usb_cdc_serial_read(usb_cdc_serial_obj_t *self, uint8_t *data, size_t len, int *errcode);
extern size_t common_hal_usb_cdc_serial_write(usb_cdc_serial_obj_t *self, const uint8_t *data, size_t len, int *errcode);
extern uint32_t common_hal_usb_cdc_serial_get_in_waiting(usb_cdc_serial_obj_t *self);
extern uint32_t common_hal_usb_cdc_serial_get_out_waiting(usb_cdc_serial_obj_t *self);
extern void common_hal_usb_cdc_serial_reset_input_buffer(usb_cdc_serial_obj_t *self);
extern uint32_t common_hal_usb_cdc_serial_reset_output_buffer(usb_cdc_serial_obj_t *self);
extern uint32_t common_hal_usb_cdc_serial_flush(usb_cdc_serial_obj_t *self);
extern bool common_hal_usb_cdc_serial_get_connected(usb_cdc_serial_obj_t *self);
extern mp_float_t common_hal_usb_cdc_serial_get_timeout(usb_cdc_serial_obj_t *self);
extern void common_hal_usb_cdc_serial_set_timeout(usb_cdc_serial_obj_t *self, mp_float_t timeout);
extern mp_float_t common_hal_usb_cdc_serial_get_write_timeout(usb_cdc_serial_obj_t *self);
extern void common_hal_usb_cdc_serial_set_write_timeout(usb_cdc_serial_obj_t *self, mp_float_t write_timeout);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_USB_CDC_SERIAL_H

View File

@ -0,0 +1,59 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Dan Halbertfor Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdint.h>
#include "py/obj.h"
#include "py/runtime.h"
#include "shared-bindings/usb_cdc/__init__.h"
#include "shared-bindings/usb_cdc/Serial.h"
#include "py/runtime.h"
//| """USB CDC Serial streams
//|
//| The `usb_cdc` module allows access to USB CDC (serial) communications."""
//|
//| serials: Tuple[Serial, ...]
//| """Tuple of all CDC streams. Each item is a `Serial`.
//| ``serials[0]`` is the USB REPL connection.
//| ``serials[1]`` is a second USB serial connection, unconnected to the REPL.
//| """
//|
static const mp_map_elem_t usb_cdc_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_usb_cdc) },
{ MP_ROM_QSTR(MP_QSTR_Serial), MP_OBJ_FROM_PTR(&usb_cdc_serial_type) },
{ MP_ROM_QSTR(MP_QSTR_serials), MP_OBJ_FROM_PTR(&usb_cdc_serials_tuple) },
};
static MP_DEFINE_CONST_DICT(usb_cdc_module_globals, usb_cdc_module_globals_table);
const mp_obj_module_t usb_cdc_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&usb_cdc_module_globals,
};

View File

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

View File

@ -0,0 +1,151 @@
/*
* This file is part of the Circuit Python project, https://github.com/adafruit/circuitpython
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler 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/bitops/__init__.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifdef __GNUC__
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH ((void)0) /* FALLTHROUGH */
#endif
// adapted from "Hacker's Delight" - Figure 7-2 Transposing an 8x8-bit matrix
// basic idea is:
// > First, treat the 8x8-bit matrix as 16 2x2-bit matrices, and transpose each
// > of the 16 2x2-bit matrices. Second, treat the matrix as four 2x2 submatrices
// > whose elements are 2x2-bit matrices and transpose each of the four 2x2
// > submatrices. Finally, treat the matrix as a 2x2 matrix whose elements are
// > 4x4-bit matrices, and transpose the 2x2 matrix. These transformations are
// > illustrated below.
// We want a different definition of bit/byte order, deal with strides differently, etc.
// so the code is heavily re-worked compared to the original.
static void transpose_var(uint32_t *result, const uint8_t *src, int src_stride, int num_strands) {
uint32_t x = 0, y = 0, t;
src += (num_strands-1) * src_stride;
switch(num_strands) {
case 7:
x |= *src << 16;
src -= src_stride;
FALLTHROUGH;
case 6:
x |= *src << 8;
src -= src_stride;
FALLTHROUGH;
case 5:
x |= *src;
src -= src_stride;
FALLTHROUGH;
case 4:
y |= *src << 24;
src -= src_stride;
FALLTHROUGH;
case 3:
y |= *src << 16;
src -= src_stride;
FALLTHROUGH;
case 2:
y |= *src << 8;
src -= src_stride;
y |= *src;
}
t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
x = t;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
x = __builtin_bswap32(x);
y = __builtin_bswap32(y);
#endif
result[0] = x;
result[1] = y;
}
static void transpose_8(uint32_t *result, const uint8_t *src, int src_stride) {
uint32_t x, y, t;
y = *src; src += src_stride;
y |= (*src << 8); src += src_stride;
y |= (*src << 16); src += src_stride;
y |= (*src << 24); src += src_stride;
x = *src; src += src_stride;
x |= (*src << 8); src += src_stride;
x |= (*src << 16); src += src_stride;
x |= (*src << 24); src += src_stride;
t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
x = t;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
x = __builtin_bswap32(x);
y = __builtin_bswap32(y);
#endif
result[0] = x;
result[1] = y;
}
static void bit_transpose_8(uint32_t *result, const uint8_t *src, size_t src_stride, size_t n) {
for(size_t i=0; i<n; i++) {
transpose_8(result, src, src_stride);
result += 2;
src += 1;
}
}
static void bit_transpose_var(uint32_t *result, const uint8_t *src, size_t src_stride, size_t n, int num_strands) {
for(size_t i=0; i<n; i++) {
transpose_var(result, src, src_stride, num_strands);
result += 2;
src += 1;
}
}
void common_hal_bitops_bit_transpose(uint8_t *result, const uint8_t *src, size_t inlen, size_t num_strands) {
if(num_strands == 8) {
bit_transpose_8((uint32_t*)(void*)result, src, inlen/8, inlen/8);
} else {
bit_transpose_var((uint32_t*)(void*)result, src, inlen/num_strands, inlen/num_strands, num_strands);
}
}

View File

@ -0,0 +1,27 @@
/*
* This file is part of the Circuit Python project, https://github.com/adafruit/circuitpython
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler
*
* 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.
*/
#pragma once

View File

@ -0,0 +1,147 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "lib/utils/interrupt_char.h"
#include "shared-module/usb_cdc/Serial.h"
#include "supervisor/shared/tick.h"
#include "tusb.h"
size_t common_hal_usb_cdc_serial_read(usb_cdc_serial_obj_t *self, uint8_t *data, size_t len, int *errcode) {
const bool wait_forever = self->timeout < 0.0f;
const bool wait_for_timeout = self->timeout > 0.0f;
// Read up to len bytes immediately.
// The number of bytes read will not be larger than what is already in the TinyUSB FIFO.
uint32_t total_num_read = tud_cdc_n_read(self->idx, data, len);
if (wait_forever || wait_for_timeout) {
// Read more if we have time.
uint64_t timeout_ms = self->timeout * 1000; // Junk value if timeout < 0.
uint64_t start_ticks = supervisor_ticks_ms64();
uint32_t num_read = 0;
while (total_num_read < len &&
(wait_forever || supervisor_ticks_ms64() - start_ticks <= timeout_ms)) {
// Wait for a bit, and check for ctrl-C.
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
return 0;
}
// Advance buffer pointer and reduce number of bytes that need to be read.
len -= num_read;
data += num_read;
// Try to read another batch of bytes.
num_read = tud_cdc_n_read(self->idx, data, len);
total_num_read += num_read;
}
}
return total_num_read;
}
size_t common_hal_usb_cdc_serial_write(usb_cdc_serial_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
const bool wait_forever = self->write_timeout < 0.0f;
const bool wait_for_timeout = self->write_timeout > 0.0f;
// Write as many bytes as possible immediately.
// The number of bytes written at once will not be larger than what can fit in the TinyUSB FIFO.
uint32_t total_num_written = tud_cdc_n_write(self->idx, data, len);
tud_cdc_n_write_flush(self->idx);
if (wait_forever || wait_for_timeout) {
// Write more if we have time.
uint64_t timeout_ms = self->write_timeout * 1000; // Junk value if write_timeout < 0.
uint64_t start_ticks = supervisor_ticks_ms64();
uint32_t num_written = 0;
while (total_num_written < len &&
(wait_forever || supervisor_ticks_ms64() - start_ticks <= timeout_ms)) {
// Wait for a bit, and check for ctrl-C.
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
return 0;
}
// Advance buffer pointer and reduce number of bytes that need to be written.
len -= num_written;
data += num_written;
// Try to write another batch of bytes.
num_written = tud_cdc_n_write(self->idx, data, len);
tud_cdc_n_write_flush(self->idx);
total_num_written += num_written;
}
}
return total_num_written;
}
uint32_t common_hal_usb_cdc_serial_get_in_waiting(usb_cdc_serial_obj_t *self) {
return tud_cdc_n_available(self->idx);
}
uint32_t common_hal_usb_cdc_serial_get_out_waiting(usb_cdc_serial_obj_t *self) {
// Return number of FIFO bytes currently occupied.
return CFG_TUD_CDC_TX_BUFSIZE - tud_cdc_n_write_available(self->idx);
}
void common_hal_usb_cdc_serial_reset_input_buffer(usb_cdc_serial_obj_t *self) {
tud_cdc_n_read_flush(self->idx);
}
uint32_t common_hal_usb_cdc_serial_reset_output_buffer(usb_cdc_serial_obj_t *self) {
return tud_cdc_n_write_clear(self->idx);
}
uint32_t common_hal_usb_cdc_serial_flush(usb_cdc_serial_obj_t *self) {
return tud_cdc_n_write_flush(self->idx);
}
bool common_hal_usb_cdc_serial_get_connected(usb_cdc_serial_obj_t *self) {
return tud_cdc_n_connected(self->idx);
}
mp_float_t common_hal_usb_cdc_serial_get_timeout(usb_cdc_serial_obj_t *self) {
return self->timeout;
}
void common_hal_usb_cdc_serial_set_timeout(usb_cdc_serial_obj_t *self, mp_float_t timeout) {
self->timeout = timeout;
}
mp_float_t common_hal_usb_cdc_serial_get_write_timeout(usb_cdc_serial_obj_t *self) {
return self->write_timeout;
}
void common_hal_usb_cdc_serial_set_write_timeout(usb_cdc_serial_obj_t *self, mp_float_t write_timeout) {
self->write_timeout = write_timeout;
}

View File

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

View File

@ -0,0 +1,61 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "genhdr/autogen_usb_descriptor.h"
#include "py/gc.h"
#include "py/obj.h"
#include "py/mphal.h"
#include "py/runtime.h"
#include "py/objtuple.h"
#include "shared-bindings/usb_cdc/__init__.h"
#include "shared-bindings/usb_cdc/Serial.h"
#include "tusb.h"
#if CFG_TUD_CDC != 2
#error CFG_TUD_CDC must be exactly 2
#endif
static usb_cdc_serial_obj_t serial_objs[CFG_TUD_CDC] = {
{ .base.type = &usb_cdc_serial_type,
.timeout = -1.0f,
.write_timeout = -1.0f,
.idx = 0,
}, {
.base.type = &usb_cdc_serial_type,
.timeout = -1.0f,
.write_timeout = -1.0f,
.idx = 1,
}
};
const mp_rom_obj_tuple_t usb_cdc_serials_tuple = {
.base.type = &mp_type_tuple,
.len = CFG_TUD_CDC,
.items = {
&serial_objs[0],
&serial_objs[1],
},
};

View File

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

View File

@ -131,7 +131,6 @@ bool serial_bytes_available(void) {
return tud_cdc_available() > 0;
#endif
}
void serial_write_substring(const char* text, uint32_t length) {
if (length == 0) {
return;

View File

@ -61,10 +61,15 @@
// DEVICE CONFIGURATION
//--------------------------------------------------------------------+
#define CFG_TUD_ENDOINT0_SIZE 64
#define CFG_TUD_ENDPOINT0_SIZE 64
//------------- CLASS -------------//
// Could be 2 if secondary CDC channel requested.
#ifndef CFG_TUD_CDC
#define CFG_TUD_CDC 1
#endif
#define CFG_TUD_MSC 1
#define CFG_TUD_HID CIRCUITPY_USB_HID
#define CFG_TUD_MIDI CIRCUITPY_USB_MIDI

View File

@ -26,7 +26,6 @@
#include "py/objstr.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-module/usb_midi/__init__.h"
#include "supervisor/background_callback.h"
#include "supervisor/port.h"
#include "supervisor/serial.h"
@ -35,6 +34,10 @@
#include "lib/utils/interrupt_char.h"
#include "lib/mp-readline/readline.h"
#if CIRCUITPY_USB_MIDI
#include "shared-module/usb_midi/__init__.h"
#endif
#include "tusb.h"
#if CIRCUITPY_USB_VENDOR
@ -216,7 +219,7 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
return true;
}
#endif CIRCUITPY_USB_VENDOR
#endif // CIRCUITPY_USB_VENDOR
#if MICROPY_KBD_EXCEPTION

View File

@ -43,12 +43,14 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index) {
return usb_desc_cfg;
}
#if CIRCUITPY_USB_HID
// Invoked when received GET HID REPORT DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_hid_descriptor_report_cb(void) {
return hid_report_descriptor;
}
#endif
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete

View File

@ -14,23 +14,15 @@ SRC_SUPERVISOR = \
supervisor/shared/tick.c \
supervisor/shared/translate.c
ifndef $(NO_USB)
NO_USB = $(wildcard supervisor/usb.c)
endif
NO_USB ?= $(wildcard supervisor/usb.c)
ifndef INTERNAL_FLASH_FILESYSTEM
INTERNAL_FLASH_FILESYSTEM = 0
endif
INTERNAL_FLASH_FILESYSTEM ?= 0
CFLAGS += -DINTERNAL_FLASH_FILESYSTEM=$(INTERNAL_FLASH_FILESYSTEM)
ifndef QSPI_FLASH_FILESYSTEM
QSPI_FLASH_FILESYSTEM = 0
endif
QSPI_FLASH_FILESYSTEM ?= 0
CFLAGS += -DQSPI_FLASH_FILESYSTEM=$(QSPI_FLASH_FILESYSTEM)
ifndef SPI_FLASH_FILESYSTEM
SPI_FLASH_FILESYSTEM = 0
endif
SPI_FLASH_FILESYSTEM ?= 0
CFLAGS += -DSPI_FLASH_FILESYSTEM=$(SPI_FLASH_FILESYSTEM)
ifeq ($(CIRCUITPY_BLEIO),1)
@ -41,154 +33,180 @@ endif
# (Right now INTERNAL_FLASH_FILESYSTEM and (Q)SPI_FLASH_FILESYSTEM are mutually exclusive.
# But that might not be true in the future.)
ifdef EXTERNAL_FLASH_DEVICES
CFLAGS += -DEXTERNAL_FLASH_DEVICES=$(EXTERNAL_FLASH_DEVICES) \
-DEXTERNAL_FLASH_DEVICE_COUNT=$(EXTERNAL_FLASH_DEVICE_COUNT)
CFLAGS += -DEXTERNAL_FLASH_DEVICES=$(EXTERNAL_FLASH_DEVICES) \
-DEXTERNAL_FLASH_DEVICE_COUNT=$(EXTERNAL_FLASH_DEVICE_COUNT)
SRC_SUPERVISOR += supervisor/shared/external_flash/external_flash.c
ifeq ($(SPI_FLASH_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/shared/external_flash/spi_flash.c
else
endif
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c
endif
SRC_SUPERVISOR += supervisor/shared/external_flash/external_flash.c
ifeq ($(SPI_FLASH_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/shared/external_flash/spi_flash.c
endif
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c
endif
else
ifeq ($(DISABLE_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/stub/internal_flash.c
else
SRC_SUPERVISOR += supervisor/internal_flash.c
endif
ifeq ($(DISABLE_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/stub/internal_flash.c
else
SRC_SUPERVISOR += supervisor/internal_flash.c
endif
endif
ifeq ($(USB),FALSE)
ifeq ($(wildcard supervisor/serial.c),)
SRC_SUPERVISOR += supervisor/stub/serial.c
else
SRC_SUPERVISOR += supervisor/serial.c
endif
ifeq ($(wildcard supervisor/serial.c),)
SRC_SUPERVISOR += supervisor/stub/serial.c
else
SRC_SUPERVISOR += supervisor/serial.c
endif
else
SRC_SUPERVISOR += \
lib/tinyusb/src/common/tusb_fifo.c \
lib/tinyusb/src/device/usbd.c \
lib/tinyusb/src/device/usbd_control.c \
lib/tinyusb/src/class/msc/msc_device.c \
lib/tinyusb/src/class/cdc/cdc_device.c \
lib/tinyusb/src/tusb.c \
supervisor/shared/serial.c \
supervisor/shared/workflow.c \
supervisor/usb.c \
supervisor/shared/usb/usb_desc.c \
supervisor/shared/usb/usb.c \
supervisor/shared/usb/usb_msc_flash.c \
$(BUILD)/autogen_usb_descriptor.c
SRC_SUPERVISOR += \
lib/tinyusb/src/class/cdc/cdc_device.c \
lib/tinyusb/src/common/tusb_fifo.c \
lib/tinyusb/src/device/usbd.c \
lib/tinyusb/src/device/usbd_control.c \
lib/tinyusb/src/tusb.c \
supervisor/shared/serial.c \
supervisor/shared/workflow.c \
supervisor/usb.c \
supervisor/shared/usb/usb_desc.c \
supervisor/shared/usb/usb.c \
$(BUILD)/autogen_usb_descriptor.c \
ifeq ($(CIRCUITPY_USB_HID), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/hid/hid_device.c \
shared-bindings/usb_hid/__init__.c \
shared-bindings/usb_hid/Device.c \
shared-module/usb_hid/__init__.c \
shared-module/usb_hid/Device.c
endif
ifeq ($(CIRCUITPY_USB_CDC), 1)
SRC_SUPERVISOR += \
shared-bindings/usb_cdc/__init__.c \
shared-bindings/usb_cdc/Serial.c \
shared-module/usb_cdc/__init__.c \
shared-module/usb_cdc/Serial.c \
ifeq ($(CIRCUITPY_USB_MIDI), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/midi/midi_device.c \
shared-bindings/usb_midi/__init__.c \
shared-bindings/usb_midi/PortIn.c \
shared-bindings/usb_midi/PortOut.c \
shared-module/usb_midi/__init__.c \
shared-module/usb_midi/PortIn.c \
shared-module/usb_midi/PortOut.c
endif
endif
ifeq ($(CIRCUITPY_USB_VENDOR), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/vendor/vendor_device.c
endif
ifeq ($(CIRCUITPY_USB_HID), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/hid/hid_device.c \
shared-bindings/usb_hid/__init__.c \
shared-bindings/usb_hid/Device.c \
shared-module/usb_hid/__init__.c \
shared-module/usb_hid/Device.c \
CFLAGS += -DUSB_AVAILABLE
endif
ifeq ($(CIRCUITPY_USB_MIDI), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/midi/midi_device.c \
shared-bindings/usb_midi/__init__.c \
shared-bindings/usb_midi/PortIn.c \
shared-bindings/usb_midi/PortOut.c \
shared-module/usb_midi/__init__.c \
shared-module/usb_midi/PortIn.c \
shared-module/usb_midi/PortOut.c \
endif
ifeq ($(CIRCUITPY_USB_MSC), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/msc/msc_device.c \
supervisor/shared/usb/usb_msc_flash.c \
endif
ifeq ($(CIRCUITPY_USB_VENDOR), 1)
SRC_SUPERVISOR += \
lib/tinyusb/src/class/vendor/vendor_device.c \
endif
CFLAGS += -DUSB_AVAILABLE
endif
SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o))
ifeq ($(CIRCUITPY_DISPLAYIO), 1)
SRC_SUPERVISOR += \
supervisor/shared/display.c
SRC_SUPERVISOR += \
supervisor/shared/display.c
ifeq ($(CIRCUITPY_TERMINALIO), 1)
SUPERVISOR_O += $(BUILD)/autogen_display_resources.o
endif
ifeq ($(CIRCUITPY_TERMINALIO), 1)
SUPERVISOR_O += $(BUILD)/autogen_display_resources.o
endif
endif
ifndef USB_INTERFACE_NAME
USB_INTERFACE_NAME = "CircuitPython"
USB_INTERFACE_NAME ?= "CircuitPython"
ifneq ($(USB_VID),)
CFLAGS += -DUSB_VID=$(USB_VID)
CFLAGS += -DSUB_PID=$(USB_PID)
CFLAGS += -DUSB_MANUFACTURER=$(USB_MANUFACTURER)
CFLAGS += -DUSB_PRODUCT=$(USB_PRODUCT)
endif
# In the following URL, don't include the https:// prefix.
# It gets added automatically.
ifndef USB_WEBUSB_URL
USB_WEBUSB_URL = "circuitpython.org"
USB_WEBUSB_URL ?= "circuitpython.org"
ifeq ($(CIRCUITPY_REPL_USB),1)
USB_DEVICES += CDC
endif
USB_DEVICES_COMPUTED := CDC,MSC
ifeq ($(CIRCUITPY_USB_MIDI),1)
USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),AUDIO
endif
ifeq ($(CIRCUITPY_USB_HID),1)
USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),HID
USB_DEVICES += HID
endif
ifeq ($(CIRCUITPY_USB_MIDI),1)
USB_DEVICES += AUDIO
endif
ifeq ($(CIRCUITPY_USB_MSC),1)
USB_DEVICES += MSC
endif
ifeq ($(CIRCUITPY_USB_CDC),1)
# Inform TinyUSB there are two CDC devices.
CFLAGS += -DCFG_TUD_CDC=2
USB_DEVICES += CDC2
endif
ifeq ($(CIRCUITPY_USB_VENDOR),1)
USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),VENDOR
endif
USB_DEVICES ?= "$(USB_DEVICES_COMPUTED)"
ifndef USB_HID_DEVICES
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
USB_DEVICES += VENDOR
endif
ifndef USB_HIGHSPEED
USB_HIGHSPEED = 0
USB_HID_DEVICES =
ifeq ($(CIRCUITPY_USB_HID_CONSUMER),1)
USB_HID_DEVICES += CONSUMER
endif
ifeq ($(CIRCUITPY_USB_HID_DIGITIZER),1)
USB_HID_DEVICES += DIGITIZER
endif
ifeq ($(CIRCUITPY_USB_HID_GAMEPAD),1)
USB_HID_DEVICES += GAMEPAD
endif
ifeq ($(CIRCUITPY_USB_HID_KEYBOARD),1)
USB_HID_DEVICES += KEYBOARD
endif
ifeq ($(CIRCUITPY_USB_HID_MOUSE),1)
USB_HID_DEVICES += MOUSE
endif
ifeq ($(CIRCUITPY_USB_HID_SYS_CONTROL),1)
USB_HID_DEVICES += SYS_CONTROL
endif
ifeq ($(CIRCUITPY_USB_HID_XAC_COMPATIBLE_GAMEPAD),1)
USB_HID_DEVICES += XAC_COMPATIBLE_GAMEPAD
endif
ifndef USB_CDC_EP_NUM_NOTIFICATION
USB_CDC_EP_NUM_NOTIFICATION = 0
# RAW is not compatible with other HID devices.
ifeq ($(CIRCUITPY_USB_HID_RAW),1)
ifneq ($(CIRCUITPY_USB_HID_DEVICES,)
$(error HID RAW must not be combined with other HID devices)
endif
USB_HID_DEVICES += MOUSE
endif
ifndef USB_CDC_EP_NUM_DATA_OUT
USB_CDC_EP_NUM_DATA_OUT = 0
endif
USB_HIGHSPEED ?= 0
ifndef USB_CDC_EP_NUM_DATA_IN
USB_CDC_EP_NUM_DATA_IN = 0
endif
ifndef USB_MSC_EP_NUM_OUT
USB_MSC_EP_NUM_OUT = 0
endif
ifndef USB_MSC_EP_NUM_IN
USB_MSC_EP_NUM_IN = 0
endif
ifndef USB_HID_EP_NUM_OUT
USB_HID_EP_NUM_OUT = 0
endif
ifndef USB_HID_EP_NUM_IN
USB_HID_EP_NUM_IN = 0
endif
ifndef USB_MIDI_EP_NUM_OUT
USB_MIDI_EP_NUM_OUT = 0
endif
ifndef USB_MIDI_EP_NUM_IN
USB_MIDI_EP_NUM_IN = 0
endif
ifndef USB_NUM_EP
USB_NUM_EP = 0
endif
USB_CDC_EP_NUM_NOTIFICATION ?= 0
USB_CDC_EP_NUM_DATA_OUT ?= 0
USB_CDC_EP_NUM_DATA_IN ?= 0
USB_MSC_EP_NUM_OUT ?= 0
USB_MSC_EP_NUM_IN ?= 0
USB_HID_EP_NUM_OUT ?= 0
USB_HID_EP_NUM_IN ?= 0
USB_MIDI_EP_NUM_OUT ?= 0
USB_MIDI_EP_NUM_IN ?= 0
USB_NUM_EP ?= 0
USB_DESCRIPTOR_ARGS = \
--manufacturer $(USB_MANUFACTURER)\
@ -197,8 +215,8 @@ USB_DESCRIPTOR_ARGS = \
--pid $(USB_PID)\
--serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\
--interface_name $(USB_INTERFACE_NAME)\
--devices $(USB_DEVICES)\
--hid_devices $(USB_HID_DEVICES)\
--devices "$(USB_DEVICES)"\
--hid_devices "$(USB_HID_DEVICES)"\
--max_ep $(USB_NUM_EP) \
--cdc_ep_num_notification $(USB_CDC_EP_NUM_NOTIFICATION)\
--cdc_ep_num_data_out $(USB_CDC_EP_NUM_DATA_OUT)\

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