From 8ae103e07ce2332918340463f419f7aad6528c55 Mon Sep 17 00:00:00 2001 From: Dale Hawkins Date: Mon, 16 Mar 2020 09:07:10 -0600 Subject: [PATCH 001/277] Fix documentation typo: tm_minute should be tm_min --- shared-bindings/time/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 8d7f2f3fd2..aa2f4fc6a5 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -107,7 +107,7 @@ mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp //| * ``tm_month``: the month, range [1, 12] //| * ``tm_mday``: the day of the month, range [1, 31] //| * ``tm_hour``: the hour, range [0, 23] -//| * ``tm_minute``: the minute, range [0, 59] +//| * ``tm_min``: the minute, range [0, 59] //| * ``tm_sec``: the second, range [0, 61] //| * ``tm_wday``: the day of the week, range [0, 6], Monday is 0 //| * ``tm_yday``: the day of the year, range [1, 366], -1 indicates not known From f572b723060382bbc9ca7a3edc88cb7c30fdcc30 Mon Sep 17 00:00:00 2001 From: AndrewR-L <59139513+AndrewR-L@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:10:36 +0100 Subject: [PATCH 002/277] busio/UART: Correct and clarify readline() return. Surely readline() "rtype" is string not int as stated (and not bytes as some might expect). Also it is not totally unambiguous what happens on a timeout so it would help to clarify in docs that on a timeout it does NOT return with what it has read so far, rather it leaves all that in the buffer ready for a future read and returns nothing. Likewise clarify that if timeout=0 but there is no newline it DOES return what it has read so far (NOT None). At least this is what I think it does and/or is supposed to do! Python docs are generally not too explicit about what is the proper treatment, so perhaps all the more reason to clarify the interpretation adopted? --- shared-bindings/busio/UART.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 02c5afb16e..e4a6b93d9d 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -201,13 +201,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| :rtype: int or None (on a non-blocking error) //| //| *New in CircuitPython 4.0:* No length parameter is permitted. - +//| //| .. method:: readline() //| -//| Read a line, ending in a newline character. +//| Read a line, ending in a newline character, or +//| return None if a timeout occurs sooner, or +//| return everything readable if no newline is found and timeout=0 //| //| :return: the line read -//| :rtype: int or None +//| :rtype: str or None //| //| .. method:: write(buf) //| From d0401f02a947a468d3019e70b5b0f5f633429c5d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 28 May 2020 15:51:33 -0700 Subject: [PATCH 003/277] Add initial I2C support, not quite working fully though --- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/busio/I2C.c | 239 +++++++++++ ports/esp32s2/common-hal/busio/I2C.h | 49 +++ ports/esp32s2/common-hal/busio/OneWire.h | 33 ++ ports/esp32s2/common-hal/busio/SPI.c | 249 +++++++++++ ports/esp32s2/common-hal/busio/SPI.h | 44 ++ ports/esp32s2/common-hal/busio/UART.c | 405 ++++++++++++++++++ ports/esp32s2/common-hal/busio/UART.h | 48 +++ ports/esp32s2/common-hal/busio/__init__.c | 1 + .../esp32s2/common-hal/microcontroller/Pin.c | 4 + .../esp32s2/common-hal/microcontroller/Pin.h | 1 + ports/esp32s2/mpconfigport.mk | 4 +- ports/esp32s2/supervisor/port.c | 10 +- 13 files changed, 1085 insertions(+), 3 deletions(-) create mode 100644 ports/esp32s2/common-hal/busio/I2C.c create mode 100644 ports/esp32s2/common-hal/busio/I2C.h create mode 100644 ports/esp32s2/common-hal/busio/OneWire.h create mode 100644 ports/esp32s2/common-hal/busio/SPI.c create mode 100644 ports/esp32s2/common-hal/busio/SPI.h create mode 100644 ports/esp32s2/common-hal/busio/UART.c create mode 100644 ports/esp32s2/common-hal/busio/UART.h create mode 100644 ports/esp32s2/common-hal/busio/__init__.c diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 5ad5c2f1d3..4eac07f99f 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -78,6 +78,7 @@ INC += -Iesp-idf/components/freertos/xtensa/include INC += -Iesp-idf/components/esp32s2/include INC += -Iesp-idf/components/xtensa/esp32s2/include INC += -Iesp-idf/components/esp_common/include +INC += -Iesp-idf/components/esp_ringbuf/include INC += -Iesp-idf/components/esp_rom/include INC += -Iesp-idf/components/xtensa/include INC += -Iesp-idf/components/esp_timer/include diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c new file mode 100644 index 0000000000..80743dc894 --- /dev/null +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -0,0 +1,239 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/busio/I2C.h" +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "driver/i2c.h" + +#include "esp_log.h" + +#include "shared-bindings/microcontroller/__init__.h" +#include "supervisor/shared/translate.h" + +// Number of times to try to send packet if failed. +#define ATTEMPTS 2 + +static const char* TAG = "CircuitPython I2C"; + +typedef enum { + STATUS_FREE = 0, + STATUS_IN_USE, + STATUS_NEVER_RESET +} i2c_status_t; + +static i2c_status_t i2c_status[I2C_NUM_MAX]; + +void never_reset_i2c(i2c_port_t num) { + i2c_status[num] = STATUS_NEVER_RESET; +} + +void i2c_reset(void) { + for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { + if (i2c_status[num] == STATUS_IN_USE) { + i2c_driver_delete(num); + i2c_status[num] = STATUS_FREE; + } + } +} + +void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, + const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) { + + // Make sure scl and sda aren't input only + +#if CIRCUITPY_REQUIRE_I2C_PULLUPS + // // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) + // gpio_set_pin_function(sda->number, GPIO_PIN_FUNCTION_OFF); + // gpio_set_pin_function(scl->number, GPIO_PIN_FUNCTION_OFF); + // gpio_set_pin_direction(sda->number, GPIO_DIRECTION_IN); + // gpio_set_pin_direction(scl->number, GPIO_DIRECTION_IN); + + // gpio_set_pin_pull_mode(sda->number, GPIO_PULL_DOWN); + // gpio_set_pin_pull_mode(scl->number, GPIO_PULL_DOWN); + + // common_hal_mcu_delay_us(10); + + // gpio_set_pin_pull_mode(sda->number, GPIO_PULL_OFF); + // gpio_set_pin_pull_mode(scl->number, GPIO_PULL_OFF); + + // // We must pull up within 3us to achieve 400khz. + // common_hal_mcu_delay_us(3); + + // if (!gpio_get_pin_level(sda->number) || !gpio_get_pin_level(scl->number)) { + // reset_pin_number(sda->number); + // reset_pin_number(scl->number); + // mp_raise_RuntimeError(translate("SDA or SCL needs a pull up")); + // } +#endif + ESP_EARLY_LOGW(TAG, "create I2C"); + + + self->semaphore_handle = xSemaphoreCreateBinaryStatic(&self->semaphore); + xSemaphoreGive(self->semaphore_handle); + ESP_EARLY_LOGW(TAG, "new I2C lock %x", self->semaphore_handle); + self->sda_pin = sda; + self->scl_pin = scl; + ESP_EARLY_LOGW(TAG, "scl %d sda %d", self->sda_pin->number, self->scl_pin->number); + self->i2c_num = I2C_NUM_MAX; + for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { + if (i2c_status[num] == STATUS_FREE) { + self->i2c_num = num; + } + } + if (self->i2c_num == I2C_NUM_MAX) { + mp_raise_ValueError(translate("All I2C peripherals are in use")); + } + i2c_status[self->i2c_num] = STATUS_IN_USE; + i2c_config_t i2c_conf = { + .mode = I2C_MODE_MASTER, + .sda_io_num = self->sda_pin->number, + .scl_io_num = self->scl_pin->number, + .sda_pullup_en = GPIO_PULLUP_DISABLE, /*!< Internal GPIO pull mode for I2C sda signal*/ + .scl_pullup_en = GPIO_PULLUP_DISABLE, /*!< Internal GPIO pull mode for I2C scl signal*/ + + .master = { + .clk_speed = frequency, + } + }; + // ESP_EARLY_LOGW(TAG, "param config %p %p %d %d", &i2c_conf, &(i2c_conf.mode), i2c_conf.mode, I2C_MODE_MAX); + ESP_EARLY_LOGW(TAG, "param config %p %d %d", &i2c_conf, i2c_conf.mode, I2C_MODE_MAX); + esp_err_t result = i2c_param_config(self->i2c_num, &i2c_conf); + if (result != ESP_OK) { + ESP_EARLY_LOGW(TAG, "error %d %p %d %d", result, &i2c_conf, (&i2c_conf)->mode, I2C_MODE_MAX); + vTaskDelay(0); + mp_raise_ValueError(translate("Invalid pins")); + } + ESP_EARLY_LOGW(TAG, "param config I2C done"); + result = i2c_driver_install(self->i2c_num, + I2C_MODE_MASTER, + 0, + 0, + 0); + if (result != ESP_OK) { + mp_raise_OSError(MP_EIO); + } + + claim_pin(sda); + claim_pin(scl); + ESP_EARLY_LOGW(TAG, "create I2C done"); +} + +bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) { + return self->sda_pin == NULL; +} + +void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { + if (common_hal_busio_i2c_deinited(self)) { + return; + } + + i2c_driver_delete(self->i2c_num); + i2c_status[self->i2c_num] = STATUS_FREE; + + reset_pin(self->sda_pin); + reset_pin(self->scl_pin); + self->sda_pin = NULL; + self->scl_pin = NULL; +} + +bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, addr << 1, true); + i2c_master_stop(cmd); + esp_err_t result = i2c_master_cmd_begin(self->i2c_num, cmd, 100); + i2c_cmd_link_delete(cmd); + return result == ESP_OK; +} + +bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) { + ESP_EARLY_LOGW(TAG, "locking I2C %x", self->semaphore_handle); + self->has_lock = xSemaphoreTake(self->semaphore_handle, 0) == pdTRUE; + if (self->has_lock) { + ESP_EARLY_LOGW(TAG, "lock grabbed"); + } else { + ESP_EARLY_LOGW(TAG, "unable to grab lock"); + } + return self->has_lock; +} + +bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) { + return self->has_lock; +} + +void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) { + ESP_EARLY_LOGW(TAG, "unlocking I2C"); + xSemaphoreGive(self->semaphore_handle); + self->has_lock = false; +} + +uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, + const uint8_t *data, size_t len, bool transmit_stop_bit) { + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, addr << 1, true); + i2c_master_write(cmd, (uint8_t*) data, len, true); + if (transmit_stop_bit) { + i2c_master_stop(cmd); + } + esp_err_t result = i2c_master_cmd_begin(self->i2c_num, cmd, 100 /* wait in ticks */); + i2c_cmd_link_delete(cmd); + + if (result == ESP_OK) { + return 0; + } else if (result == ESP_FAIL) { + return MP_ENODEV; + } + return MP_EIO; +} + +uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, + uint8_t *data, size_t len) { + + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, addr << 1 | 1, true); // | 1 to indicate read + i2c_master_read(cmd, data, len, true); + i2c_master_stop(cmd); + esp_err_t result = i2c_master_cmd_begin(self->i2c_num, cmd, 100 /* wait in ticks */); + i2c_cmd_link_delete(cmd); + + if (result == ESP_OK) { + return 0; + } else if (result == ESP_FAIL) { + return MP_ENODEV; + } + return MP_EIO; +} + +void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { + never_reset_i2c(self->i2c_num); + + never_reset_pin(self->scl_pin); + never_reset_pin(self->sda_pin); +} diff --git a/ports/esp32s2/common-hal/busio/I2C.h b/ports/esp32s2/common-hal/busio/I2C.h new file mode 100644 index 0000000000..d90fb2713a --- /dev/null +++ b/ports/esp32s2/common-hal/busio/I2C.h @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_I2C_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_I2C_H + +#include "common-hal/microcontroller/Pin.h" + +#include "esp-idf/components/soc/include/hal/i2c_types.h" +#include "FreeRTOS.h" +#include "freertos/semphr.h" +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t* scl_pin; + const mcu_pin_obj_t* sda_pin; + i2c_port_t i2c_num; + StaticSemaphore_t semaphore; + SemaphoreHandle_t semaphore_handle; + bool has_lock; +} busio_i2c_obj_t; + +void i2c_reset(void); + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_H diff --git a/ports/esp32s2/common-hal/busio/OneWire.h b/ports/esp32s2/common-hal/busio/OneWire.h new file mode 100644 index 0000000000..bb6a014190 --- /dev/null +++ b/ports/esp32s2/common-hal/busio/OneWire.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_ONEWIRE_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_ONEWIRE_H + +// Use bitbangio. +#include "shared-module/busio/OneWire.h" + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_ONEWIRE_H diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c new file mode 100644 index 0000000000..e761eb49be --- /dev/null +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -0,0 +1,249 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/busio/SPI.h" +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "boards/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/rgb_led_status.h" + +void spi_reset(void) { + +} + +void common_hal_busio_spi_construct(busio_spi_obj_t *self, + const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, + const mcu_pin_obj_t * miso) { + // uint8_t sercom_index; + // uint32_t clock_pinmux = 0; + // bool mosi_none = mosi == NULL; + // bool miso_none = miso == NULL; + // uint32_t mosi_pinmux = 0; + // uint32_t miso_pinmux = 0; + // uint8_t clock_pad = 0; + // uint8_t mosi_pad = 0; + // uint8_t miso_pad = 0; + // uint8_t dopo = 255; + + // if (sercom == NULL) { + // mp_raise_ValueError(translate("Invalid pins")); + // } + + // // Set up SPI clocks on SERCOM. + // samd_peripherals_sercom_clock_init(sercom, sercom_index); + + #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102 + // // if we're re-using the dotstar sercom, make sure it is disabled or the init will fail out + // hri_sercomspi_clear_CTRLA_ENABLE_bit(sercom); + #endif + // if (spi_m_sync_init(&self->spi_desc, sercom) != ERR_NONE) { + // mp_raise_OSError(MP_EIO); + // } + + // Pads must be set after spi_m_sync_init(), which uses default values from + // the prototypical SERCOM. + // hri_sercomspi_write_CTRLA_DOPO_bf(sercom, dopo); + // hri_sercomspi_write_CTRLA_DIPO_bf(sercom, miso_pad); + + // Always start at 250khz which is what SD cards need. They are sensitive to + // SPI bus noise before they are put into SPI mode. + // uint8_t baud_value = samd_peripherals_spi_baudrate_to_baud_reg_value(250000); + // if (spi_m_sync_set_baudrate(&self->spi_desc, baud_value) != ERR_NONE) { + // // spi_m_sync_set_baudrate does not check for validity, just whether the device is + // // busy or not + // mp_raise_OSError(MP_EIO); + // } + + // gpio_set_pin_direction(clock->number, GPIO_DIRECTION_OUT); + // gpio_set_pin_pull_mode(clock->number, GPIO_PULL_OFF); + // gpio_set_pin_function(clock->number, clock_pinmux); + // claim_pin(clock); + // self->clock_pin = clock->number; + + // if (mosi_none) { + // self->MOSI_pin = NO_PIN; + // } else { + // gpio_set_pin_direction(mosi->number, GPIO_DIRECTION_OUT); + // gpio_set_pin_pull_mode(mosi->number, GPIO_PULL_OFF); + // gpio_set_pin_function(mosi->number, mosi_pinmux); + // self->MOSI_pin = mosi->number; + // claim_pin(mosi); + // } + + // if (miso_none) { + // self->MISO_pin = NO_PIN; + // } else { + // gpio_set_pin_direction(miso->number, GPIO_DIRECTION_IN); + // gpio_set_pin_pull_mode(miso->number, GPIO_PULL_OFF); + // gpio_set_pin_function(miso->number, miso_pinmux); + // self->MISO_pin = miso->number; + // claim_pin(miso); + // } + + // spi_m_sync_enable(&self->spi_desc); +} + +void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) { + // never_reset_sercom(self->spi_desc.dev.prvt); + + never_reset_pin(self->clock_pin); + never_reset_pin(self->MOSI_pin); + never_reset_pin(self->MISO_pin); +} + +bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) { + return self->clock_pin == NULL; +} + +void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { + if (common_hal_busio_spi_deinited(self)) { + return; + } + // allow_reset_sercom(self->spi_desc.dev.prvt); + + // spi_m_sync_disable(&self->spi_desc); + // spi_m_sync_deinit(&self->spi_desc); + reset_pin(self->clock_pin); + reset_pin(self->MOSI_pin); + reset_pin(self->MISO_pin); + self->clock_pin = NULL; +} + +bool common_hal_busio_spi_configure(busio_spi_obj_t *self, + uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) { + // If the settings are already what we want then don't reset them. + // if (hri_sercomspi_get_CTRLA_CPHA_bit(hw) == phase && + // hri_sercomspi_get_CTRLA_CPOL_bit(hw) == polarity && + // hri_sercomspi_read_CTRLB_CHSIZE_bf(hw) == ((uint32_t)bits - 8) && + // hri_sercomspi_read_BAUD_BAUD_bf(hw) == baud_reg_value) { + // return true; + // } + + // Disable, set values (most or all are enable-protected), and re-enable. + // spi_m_sync_disable(&self->spi_desc); + // hri_sercomspi_wait_for_sync(hw, SERCOM_SPI_SYNCBUSY_MASK); + + // hri_sercomspi_write_CTRLA_CPHA_bit(hw, phase); + // hri_sercomspi_write_CTRLA_CPOL_bit(hw, polarity); + // hri_sercomspi_write_CTRLB_CHSIZE_bf(hw, bits - 8); + // hri_sercomspi_write_BAUD_BAUD_bf(hw, baud_reg_value); + // hri_sercomspi_wait_for_sync(hw, SERCOM_SPI_SYNCBUSY_MASK); + + // spi_m_sync_enable(&self->spi_desc); + // hri_sercomspi_wait_for_sync(hw, SERCOM_SPI_SYNCBUSY_MASK); + + return true; +} + +bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) { + bool grabbed_lock = false; + // CRITICAL_SECTION_ENTER() + if (!self->has_lock) { + grabbed_lock = true; + self->has_lock = true; + } + // CRITICAL_SECTION_LEAVE(); + return grabbed_lock; +} + +bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) { + return self->has_lock; +} + +void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { + self->has_lock = false; +} + +bool common_hal_busio_spi_write(busio_spi_obj_t *self, + const uint8_t *data, size_t len) { + if (len == 0) { + return true; + } + // int32_t status; + if (len >= 16) { + // status = sercom_dma_write(self->spi_desc.dev.prvt, data, len); + } else { + // struct io_descriptor *spi_io; + // spi_m_sync_get_io_descriptor(&self->spi_desc, &spi_io); + // status = spi_io->write(spi_io, data, len); + } + return false; // Status is number of chars read or an error code < 0. +} + +bool common_hal_busio_spi_read(busio_spi_obj_t *self, + uint8_t *data, size_t len, uint8_t write_value) { + if (len == 0) { + return true; + } + // int32_t status; + if (len >= 16) { + // status = sercom_dma_read(self->spi_desc.dev.prvt, data, len, write_value); + } else { + // self->spi_desc.dev.dummy_byte = write_value; + + // struct io_descriptor *spi_io; + // spi_m_sync_get_io_descriptor(&self->spi_desc, &spi_io); + + // status = spi_io->read(spi_io, data, len); + } + return false; // Status is number of chars read or an error code < 0. +} + +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) { + if (len == 0) { + return true; + } + // int32_t status; + if (len >= 16) { + // status = sercom_dma_transfer(self->spi_desc.dev.prvt, data_out, data_in, len); + } else { + // struct spi_xfer xfer; + // xfer.txbuf = data_out; + // xfer.rxbuf = data_in; + // xfer.size = len; + // status = spi_m_sync_transfer(&self->spi_desc, &xfer); + } + return false; // Status is number of chars read or an error code < 0. +} + +uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) { + // return samd_peripherals_spi_baud_reg_value_to_baudrate(hri_sercomspi_read_BAUD_reg(self->spi_desc.dev.prvt)); + return 0; +} + +uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) { + // void * hw = self->spi_desc.dev.prvt; + // return hri_sercomspi_get_CTRLA_CPHA_bit(hw); + return 0; +} + +uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) { + // void * hw = self->spi_desc.dev.prvt; + // return hri_sercomspi_get_CTRLA_CPOL_bit(hw); + return 0; +} diff --git a/ports/esp32s2/common-hal/busio/SPI.h b/ports/esp32s2/common-hal/busio/SPI.h new file mode 100644 index 0000000000..0ff1a4f7ea --- /dev/null +++ b/ports/esp32s2/common-hal/busio/SPI.h @@ -0,0 +1,44 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_SPI_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_SPI_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + bool has_lock; + const mcu_pin_obj_t* clock_pin; + const mcu_pin_obj_t* MOSI_pin; + const mcu_pin_obj_t* MISO_pin; +} busio_spi_obj_t; + +void spi_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_SPI_H diff --git a/ports/esp32s2/common-hal/busio/UART.c b/ports/esp32s2/common-hal/busio/UART.c new file mode 100644 index 0000000000..4a016ad1a8 --- /dev/null +++ b/ports/esp32s2/common-hal/busio/UART.c @@ -0,0 +1,405 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Damien P. George + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/busio/UART.h" + +#include "mpconfigport.h" +#include "lib/utils/interrupt_char.h" +#include "py/gc.h" +#include "py/mperrno.h" +#include "py/runtime.h" +#include "py/stream.h" +#include "supervisor/shared/translate.h" +#include "supervisor/shared/tick.h" + +#define UART_DEBUG(...) (void)0 +// #define UART_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) + +// Do-nothing callback needed so that usart_async code will enable rx interrupts. +// See comment below re usart_async_register_callback() +// static void usart_async_rxc_callback(const struct usart_async_descriptor *const descr) { +// // Nothing needs to be done by us. +// } + +void uart_reset(void) { + +} + +void common_hal_busio_uart_construct(busio_uart_obj_t *self, + const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, + const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, + const mcu_pin_obj_t * rs485_dir, bool rs485_invert, + uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, + bool sigint_enabled) { + + // uint8_t sercom_index = 255; // Unset index + // uint32_t rx_pinmux = 0; + // uint8_t rx_pad = 255; // Unset pad + // uint32_t tx_pinmux = 0; + // uint8_t tx_pad = 255; // Unset pad + + // if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) { + // mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); + // } + + // if (bits > 8) { + // mp_raise_NotImplementedError(translate("bytes > 8 bits not supported")); + // } + + bool have_tx = tx != NULL; + bool have_rx = rx != NULL; + if (!have_tx && !have_rx) { + mp_raise_ValueError(translate("tx and rx cannot both be None")); + } + + self->baudrate = baudrate; + self->character_bits = bits; + self->timeout_ms = timeout * 1000; + + // This assignment is only here because the usart_async routines take a *const argument. +// struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + +// for (int i = 0; i < NUM_SERCOMS_PER_PIN; i++) { +// Sercom* potential_sercom = NULL; +// if (have_tx) { +// sercom_index = tx->sercom[i].index; +// if (sercom_index >= SERCOM_INST_NUM) { +// continue; +// } +// potential_sercom = sercom_insts[sercom_index]; +// #ifdef SAMD21 +// if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || +// !(tx->sercom[i].pad == 0 || +// tx->sercom[i].pad == 2)) { +// continue; +// } +// #endif +// #ifdef SAMD51 +// if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || +// !(tx->sercom[i].pad == 0)) { +// continue; +// } +// #endif +// tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D); +// tx_pad = tx->sercom[i].pad; +// if (rx == NULL) { +// sercom = potential_sercom; +// break; +// } +// } +// for (int j = 0; j < NUM_SERCOMS_PER_PIN; j++) { +// if (((!have_tx && rx->sercom[j].index < SERCOM_INST_NUM && +// sercom_insts[rx->sercom[j].index]->USART.CTRLA.bit.ENABLE == 0) || +// sercom_index == rx->sercom[j].index) && +// rx->sercom[j].pad != tx_pad) { +// rx_pinmux = PINMUX(rx->number, (j == 0) ? MUX_C : MUX_D); +// rx_pad = rx->sercom[j].pad; +// sercom = sercom_insts[rx->sercom[j].index]; +// sercom_index = rx->sercom[j].index; +// break; +// } +// } +// if (sercom != NULL) { +// break; +// } +// } + // if (sercom == NULL) { + // mp_raise_ValueError(translate("Invalid pins")); + // } + // if (!have_tx) { + // tx_pad = 0; + // if (rx_pad == 0) { + // tx_pad = 2; + // } + // } + // if (!have_rx) { + // rx_pad = (tx_pad + 1) % 4; + // } + + // // Set up clocks on SERCOM. + // samd_peripherals_sercom_clock_init(sercom, sercom_index); + + // if (rx && receiver_buffer_size > 0) { + // self->buffer_length = receiver_buffer_size; + // // Initially allocate the UART's buffer in the long-lived part of the + // // heap. UARTs are generally long-lived objects, but the "make long- + // // lived" machinery is incapable of moving internal pointers like + // // self->buffer, so do it manually. (However, as long as internal + // // pointers like this are NOT moved, allocating the buffer + // // in the long-lived pool is not strictly necessary) + // self->buffer = (uint8_t *) gc_alloc(self->buffer_length * sizeof(uint8_t), false, true); + // if (self->buffer == NULL) { + // common_hal_busio_uart_deinit(self); + // mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t)); + // } + // } else { + // self->buffer_length = 0; + // self->buffer = NULL; + // } + + // if (usart_async_init(usart_desc_p, sercom, self->buffer, self->buffer_length, NULL) != ERR_NONE) { + // mp_raise_ValueError(translate("Could not initialize UART")); + // } + + // usart_async_init() sets a number of defaults based on a prototypical SERCOM + // which don't necessarily match what we need. After calling it, set the values + // specific to this instantiation of UART. + + // Set pads computed for this SERCOM. + // TXPO: + // 0x0: TX pad 0; no RTS/CTS + // 0x1: TX pad 2; no RTS/CTS + // 0x2: TX pad 0; RTS: pad 2, CTS: pad 3 (not used by us right now) + // So divide by 2 to map pad to value. + // RXPO: + // 0x0: RX pad 0 + // 0x1: RX pad 1 + // 0x2: RX pad 2 + // 0x3: RX pad 3 + + // Doing a group mask and set of the registers saves 60 bytes over setting the bitfields individually. + + // sercom->USART.CTRLA.reg &= ~(SERCOM_USART_CTRLA_TXPO_Msk | + // SERCOM_USART_CTRLA_RXPO_Msk | + // SERCOM_USART_CTRLA_FORM_Msk); + // sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) | + // SERCOM_USART_CTRLA_RXPO(rx_pad) | + // (parity == PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1)); + + // Enable tx and/or rx based on whether the pins were specified. + // CHSIZE is 0 for 8 bits, 5, 6, 7 for 5, 6, 7 bits. 1 for 9 bits, but we don't support that. + // sercom->USART.CTRLB.reg &= ~(SERCOM_USART_CTRLB_TXEN | + // SERCOM_USART_CTRLB_RXEN | + // SERCOM_USART_CTRLB_PMODE | + // SERCOM_USART_CTRLB_SBMODE | + // SERCOM_USART_CTRLB_CHSIZE_Msk); + // sercom->USART.CTRLB.reg |= (have_tx ? SERCOM_USART_CTRLB_TXEN : 0) | + // (have_rx ? SERCOM_USART_CTRLB_RXEN : 0) | + // (parity == PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) | + // (stop > 1 ? SERCOM_USART_CTRLB_SBMODE : 0) | + // SERCOM_USART_CTRLB_CHSIZE(bits % 8); + + // Set baud rate + // common_hal_busio_uart_set_baudrate(self, baudrate); + + // Turn on rx interrupt handling. The UART async driver has its own set of internal callbacks, + // which are set up by uart_async_init(). These in turn can call user-specified callbacks. + // In fact, the actual interrupts are not enabled unless we set up a user-specified callback. + // This is confusing. It's explained in the Atmel START User Guide -> Implementation Description -> + // Different read function behavior in some asynchronous drivers. As of this writing: + // http://start.atmel.com/static/help/index.html?GUID-79201A5A-226F-4FBB-B0B8-AB0BE0554836 + // Look at the ASFv4 code example for async USART. + // usart_async_register_callback(usart_desc_p, USART_ASYNC_RXC_CB, usart_async_rxc_callback); + + + // if (have_tx) { + // gpio_set_pin_direction(tx->number, GPIO_DIRECTION_OUT); + // gpio_set_pin_pull_mode(tx->number, GPIO_PULL_OFF); + // gpio_set_pin_function(tx->number, tx_pinmux); + // self->tx_pin = tx->number; + // claim_pin(tx); + // } else { + // self->tx_pin = NO_PIN; + // } + + // if (have_rx) { + // gpio_set_pin_direction(rx->number, GPIO_DIRECTION_IN); + // gpio_set_pin_pull_mode(rx->number, GPIO_PULL_OFF); + // gpio_set_pin_function(rx->number, rx_pinmux); + // self->rx_pin = rx->number; + // claim_pin(rx); + // } else { + // self->rx_pin = NO_PIN; + // } + + // usart_async_enable(usart_desc_p); +} + +bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { + return self->rx_pin == NULL && self->tx_pin == NULL; +} + +void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { + if (common_hal_busio_uart_deinited(self)) { + return; + } + // // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // usart_async_disable(usart_desc_p); + // usart_async_deinit(usart_desc_p); + reset_pin(self->rx_pin); + reset_pin(self->tx_pin); + self->rx_pin = NULL; + self->tx_pin = NULL; +} + +// Read characters. +size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { + if (self->rx_pin == NULL) { + mp_raise_ValueError(translate("No RX pin")); + } + + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + + if (len == 0) { + // Nothing to read. + return 0; + } + + // struct io_descriptor *io; + // usart_async_get_io_descriptor(usart_desc_p, &io); + + // size_t total_read = 0; + // uint64_t start_ticks = supervisor_ticks_ms64(); + + // Busy-wait until timeout or until we've read enough chars. + // while (supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) { + // // Read as many chars as we can right now, up to len. + // size_t num_read = io_read(io, data, len); + + // // Advance pointer in data buffer, and decrease how many chars left to read. + // data += num_read; + // len -= num_read; + // total_read += num_read; + // if (len == 0) { + // // Don't need to read any more: data buf is full. + // break; + // } + // if (num_read > 0) { + // // Reset the timeout on every character read. + // start_ticks = supervisor_ticks_ms64(); + // } + // RUN_BACKGROUND_TASKS; + // // Allow user to break out of a timeout with a KeyboardInterrupt. + // if (mp_hal_is_interrupted()) { + // break; + // } + // // If we are zero timeout, make sure we don't loop again (in the event + // // we read in under 1ms) + // if (self->timeout_ms == 0) { + // break; + // } + // } + + // if (total_read == 0) { + // *errcode = EAGAIN; + // return MP_STREAM_ERROR; + // } + + // return total_read; + return 0; +} + +// Write characters. +size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { + if (self->tx_pin == NULL) { + mp_raise_ValueError(translate("No TX pin")); + } + + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + + // struct io_descriptor *io; + // usart_async_get_io_descriptor(usart_desc_p, &io); + + // // Start writing characters. This is non-blocking and will + // // return immediately after setting up the write. + // if (io_write(io, data, len) < 0) { + // *errcode = MP_EAGAIN; + // return MP_STREAM_ERROR; + // } + + // // Busy-wait until all characters transmitted. + // struct usart_async_status async_status; + // while (true) { + // usart_async_get_status(usart_desc_p, &async_status); + // if (async_status.txcnt >= len) { + // break; + // } + // RUN_BACKGROUND_TASKS; + // } + + return len; +} + +uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) { + return self->baudrate; +} + +void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate) { + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // usart_async_set_baud_rate(usart_desc_p, + // // Samples and ARITHMETIC vs FRACTIONAL must correspond to USART_SAMPR in + // // hpl_sercom_config.h. + // _usart_async_calculate_baud_rate(baudrate, // e.g. 9600 baud + // PROTOTYPE_SERCOM_USART_ASYNC_CLOCK_FREQUENCY, + // 16, // samples + // USART_BAUDRATE_ASYNCH_ARITHMETIC, + // 0 // fraction - not used for ARITHMETIC + // )); + self->baudrate = baudrate; +} + +mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) { + return (mp_float_t) (self->timeout_ms / 1000.0f); +} + +void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout) { + self->timeout_ms = timeout * 1000; +} + +uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) { + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // struct usart_async_status async_status; + // usart_async_get_status(usart_desc_p, &async_status); + // return async_status.rxcnt; + return 0; +} + +void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) { + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // usart_async_flush_rx_buffer(usart_desc_p); + +} + +// True if there are no characters still to be written. +bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) { + if (self->tx_pin == NULL) { + return false; + } + // This assignment is only here because the usart_async routines take a *const argument. + // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + // struct usart_async_status async_status; + // usart_async_get_status(usart_desc_p, &async_status); + // return !(async_status.flags & USART_ASYNC_STATUS_BUSY); + return false; +} diff --git a/ports/esp32s2/common-hal/busio/UART.h b/ports/esp32s2/common-hal/busio/UART.h new file mode 100644 index 0000000000..3c2bd1dac5 --- /dev/null +++ b/ports/esp32s2/common-hal/busio/UART.h @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_UART_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_UART_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t* rx_pin; + const mcu_pin_obj_t* tx_pin; + uint8_t character_bits; + bool rx_error; + uint32_t baudrate; + uint32_t timeout_ms; + uint32_t buffer_length; + uint8_t* buffer; +} busio_uart_obj_t; + +void uart_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_UART_H diff --git a/ports/esp32s2/common-hal/busio/__init__.c b/ports/esp32s2/common-hal/busio/__init__.c new file mode 100644 index 0000000000..41761b6743 --- /dev/null +++ b/ports/esp32s2/common-hal/busio/__init__.c @@ -0,0 +1 @@ +// No busio module functions. diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 4c39eea164..fd815518d5 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -49,6 +49,10 @@ void reset_pin_number(gpio_num_t pin_number) { in_use[pin_number / 32] &= ~(1 << pin_number % 32); } +void reset_pin(const mcu_pin_obj_t* pin) { + reset_pin_number(pin->number); +} + void reset_all_pins(void) { for (uint8_t i = 0; i < GPIO_PIN_COUNT; i++) { uint32_t iomux_address = GPIO_PIN_MUX_REG[i]; diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index 6f47b1ed31..573eec392b 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -35,6 +35,7 @@ void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. void reset_pin_number(gpio_num_t pin_number); +void reset_pin(const mcu_pin_obj_t* pin); void claim_pin(const mcu_pin_obj_t* pin); bool pin_number_is_free(gpio_num_t pin_number); void never_reset_pin_number(gpio_num_t pin_number); diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index c9df81db03..9f59c1b467 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -16,10 +16,10 @@ CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_ANALOGIO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 -CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_BITBANGIO = 1 CIRCUITPY_BOARD = 1 CIRCUITPY_DIGITALIO = 1 -CIRCUITPY_BUSIO = 0 +CIRCUITPY_BUSIO = 1 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CSLAVE = 0 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 2437b4f341..fbfbc9f2eb 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -35,6 +35,9 @@ #include "freertos/task.h" #include "common-hal/microcontroller/Pin.h" +#include "common-hal/busio/I2C.h" +#include "common-hal/busio/SPI.h" +#include "common-hal/busio/UART.h" #include "supervisor/memory.h" #include "supervisor/shared/tick.h" @@ -64,8 +67,13 @@ safe_mode_t port_init(void) { } void reset_port(void) { - reset_all_pins(); + +#if CIRCUITPY_BUSIO + i2c_reset(); + spi_reset(); + uart_reset(); +#endif } void reset_to_bootloader(void) { From ae52d052cb6b4fb6cd89702dafe8448565b4aa5e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 29 May 2020 16:32:31 -0700 Subject: [PATCH 004/277] Fix I2C thanks to Mark! --- ports/esp32s2/common-hal/busio/I2C.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 80743dc894..0a696bed61 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -218,7 +218,10 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, addr << 1 | 1, true); // | 1 to indicate read - i2c_master_read(cmd, data, len, true); + if (len > 1) { + i2c_master_read(cmd, data, len - 1, 0); + } + i2c_master_read_byte(cmd, data + len - 1, 1); i2c_master_stop(cmd); esp_err_t result = i2c_master_cmd_begin(self->i2c_num, cmd, 100 /* wait in ticks */); i2c_cmd_link_delete(cmd); From 6f050d7af368afb3eb45ac34533727794fa66c58 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 3 Jun 2020 14:05:21 -0700 Subject: [PATCH 005/277] Add pull up testing, proper us delay and stop supporting 45 and 46 for I2C --- ports/esp32s2/common-hal/busio/I2C.c | 72 ++++++++++------------------ ports/esp32s2/mphalport.c | 3 +- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 0a696bed61..fd983619ff 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,16 +30,9 @@ #include "driver/i2c.h" -#include "esp_log.h" - #include "shared-bindings/microcontroller/__init__.h" #include "supervisor/shared/translate.h" -// Number of times to try to send packet if failed. -#define ATTEMPTS 2 - -static const char* TAG = "CircuitPython I2C"; - typedef enum { STATUS_FREE = 0, STATUS_IN_USE, @@ -63,42 +56,43 @@ void i2c_reset(void) { void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) { - - // Make sure scl and sda aren't input only + // Pins 45 and 46 are "strapping" pins that impact start up behavior. They usually need to + // be pulled-down so pulling them up for I2C is a bad idea. To make this hard, we don't + // support I2C on these pins. + // + // 46 is also input-only so it'll never work. + if (scl->number == 45 || scl->number == 46 || sda->number == 45 || sda->number == 46) { + mp_raise_ValueError(translate("Invalid pins")); + } #if CIRCUITPY_REQUIRE_I2C_PULLUPS - // // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) - // gpio_set_pin_function(sda->number, GPIO_PIN_FUNCTION_OFF); - // gpio_set_pin_function(scl->number, GPIO_PIN_FUNCTION_OFF); - // gpio_set_pin_direction(sda->number, GPIO_DIRECTION_IN); - // gpio_set_pin_direction(scl->number, GPIO_DIRECTION_IN); + // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) + gpio_set_direction(sda->number, GPIO_MODE_DEF_INPUT); + gpio_set_direction(scl->number, GPIO_MODE_DEF_INPUT); - // gpio_set_pin_pull_mode(sda->number, GPIO_PULL_DOWN); - // gpio_set_pin_pull_mode(scl->number, GPIO_PULL_DOWN); + gpio_pulldown_en(sda->number); + gpio_pulldown_en(scl->number); - // common_hal_mcu_delay_us(10); + common_hal_mcu_delay_us(10); - // gpio_set_pin_pull_mode(sda->number, GPIO_PULL_OFF); - // gpio_set_pin_pull_mode(scl->number, GPIO_PULL_OFF); + gpio_pulldown_dis(sda->number); + gpio_pulldown_dis(scl->number); - // // We must pull up within 3us to achieve 400khz. - // common_hal_mcu_delay_us(3); + // We must pull up within 3us to achieve 400khz. + common_hal_mcu_delay_us(3); - // if (!gpio_get_pin_level(sda->number) || !gpio_get_pin_level(scl->number)) { - // reset_pin_number(sda->number); - // reset_pin_number(scl->number); - // mp_raise_RuntimeError(translate("SDA or SCL needs a pull up")); - // } + if (gpio_get_level(sda->number) == 0 || gpio_get_level(scl->number) == 0) { + reset_pin_number(sda->number); + reset_pin_number(scl->number); + mp_raise_RuntimeError(translate("SDA or SCL needs a pull up")); + } #endif - ESP_EARLY_LOGW(TAG, "create I2C"); self->semaphore_handle = xSemaphoreCreateBinaryStatic(&self->semaphore); xSemaphoreGive(self->semaphore_handle); - ESP_EARLY_LOGW(TAG, "new I2C lock %x", self->semaphore_handle); self->sda_pin = sda; self->scl_pin = scl; - ESP_EARLY_LOGW(TAG, "scl %d sda %d", self->sda_pin->number, self->scl_pin->number); self->i2c_num = I2C_NUM_MAX; for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { if (i2c_status[num] == STATUS_FREE) { @@ -120,15 +114,10 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, .clk_speed = frequency, } }; - // ESP_EARLY_LOGW(TAG, "param config %p %p %d %d", &i2c_conf, &(i2c_conf.mode), i2c_conf.mode, I2C_MODE_MAX); - ESP_EARLY_LOGW(TAG, "param config %p %d %d", &i2c_conf, i2c_conf.mode, I2C_MODE_MAX); esp_err_t result = i2c_param_config(self->i2c_num, &i2c_conf); if (result != ESP_OK) { - ESP_EARLY_LOGW(TAG, "error %d %p %d %d", result, &i2c_conf, (&i2c_conf)->mode, I2C_MODE_MAX); - vTaskDelay(0); mp_raise_ValueError(translate("Invalid pins")); } - ESP_EARLY_LOGW(TAG, "param config I2C done"); result = i2c_driver_install(self->i2c_num, I2C_MODE_MASTER, 0, @@ -140,7 +129,6 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, claim_pin(sda); claim_pin(scl); - ESP_EARLY_LOGW(TAG, "create I2C done"); } bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) { @@ -166,19 +154,13 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { i2c_master_start(cmd); i2c_master_write_byte(cmd, addr << 1, true); i2c_master_stop(cmd); - esp_err_t result = i2c_master_cmd_begin(self->i2c_num, cmd, 100); + esp_err_t result = i2c_master_cmd_begin(self->i2c_num, cmd, 10); i2c_cmd_link_delete(cmd); return result == ESP_OK; } bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) { - ESP_EARLY_LOGW(TAG, "locking I2C %x", self->semaphore_handle); self->has_lock = xSemaphoreTake(self->semaphore_handle, 0) == pdTRUE; - if (self->has_lock) { - ESP_EARLY_LOGW(TAG, "lock grabbed"); - } else { - ESP_EARLY_LOGW(TAG, "unable to grab lock"); - } return self->has_lock; } @@ -187,7 +169,6 @@ bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) { } void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) { - ESP_EARLY_LOGW(TAG, "unlocking I2C"); xSemaphoreGive(self->semaphore_handle); self->has_lock = false; } @@ -213,8 +194,7 @@ uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, } uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, - uint8_t *data, size_t len) { - + uint8_t *data, size_t len) { i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, addr << 1 | 1, true); // | 1 to indicate read diff --git a/ports/esp32s2/mphalport.c b/ports/esp32s2/mphalport.c index da5258b0e2..e1662a6ce2 100644 --- a/ports/esp32s2/mphalport.c +++ b/ports/esp32s2/mphalport.c @@ -32,9 +32,10 @@ #include "py/gc.h" #include "esp-idf/components/xtensa/include/esp_debug_helpers.h" +#include "esp-idf/components/esp_rom/include/esp32s2/rom/ets_sys.h" void mp_hal_delay_us(mp_uint_t delay) { - mp_hal_delay_ms(delay / 1000); + ets_delay_us(delay); } // This is provided by the esp-idf/components/xtensa/esp32s2/libhal.a binary From a26102607e3fe5b6f888fcd246e20ac82a70af7b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 9 Jun 2020 18:28:02 -0700 Subject: [PATCH 006/277] Add UART support --- Makefile | 9 + ports/atmel-samd/common-hal/busio/UART.c | 6 +- ports/cxd56/common-hal/busio/UART.c | 4 +- ports/esp32s2/common-hal/busio/UART.c | 480 ++++++++++------------- ports/esp32s2/common-hal/busio/UART.h | 7 +- ports/esp32s2/esp-idf | 2 +- ports/mimxrt10xx/common-hal/busio/UART.c | 4 +- ports/nrf/common-hal/busio/UART.c | 6 +- ports/stm/common-hal/busio/UART.c | 6 +- shared-bindings/busio/UART.c | 14 +- shared-bindings/busio/UART.h | 10 +- shared-module/board/__init__.c | 2 +- 12 files changed, 250 insertions(+), 300 deletions(-) diff --git a/Makefile b/Makefile index 55f64b17df..0df1950938 100644 --- a/Makefile +++ b/Makefile @@ -243,3 +243,12 @@ stubs: update-frozen-libraries: @echo "Updating all frozen libraries to latest tagged version." cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done + +one-of-each: all-source + make -C ports/atmel-samd BOARD=trinket_m0 + make -C ports/atmel-samd BOARD=feather_m4_express + make -C ports/esp32s2 BOARD=espressif_saola_1_wroom + make -C ports/litex BOARD=fomu + make -C ports/mimxrt10xx BOARD=feather_mimxrt1011 + make -C ports/nrf BOARD=feather_nrf52840_express + make -C ports/stm BOARD=feather_stm32f405_express diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 9f740dc8af..9e213e061a 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -58,7 +58,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { @@ -195,7 +195,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, SERCOM_USART_CTRLA_FORM_Msk); sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) | SERCOM_USART_CTRLA_RXPO(rx_pad) | - (parity == PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1)); + (parity == BUSIO_UART_PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1)); // Enable tx and/or rx based on whether the pins were specified. // CHSIZE is 0 for 8 bits, 5, 6, 7 for 5, 6, 7 bits. 1 for 9 bits, but we don't support that. @@ -206,7 +206,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, SERCOM_USART_CTRLB_CHSIZE_Msk); sercom->USART.CTRLB.reg |= (have_tx ? SERCOM_USART_CTRLB_TXEN : 0) | (have_rx ? SERCOM_USART_CTRLB_RXEN : 0) | - (parity == PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) | + (parity == BUSIO_UART_PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) | (stop > 1 ? SERCOM_USART_CTRLB_SBMODE : 0) | SERCOM_USART_CTRLB_CHSIZE(bits % 8); diff --git a/ports/cxd56/common-hal/busio/UART.c b/ports/cxd56/common-hal/busio/UART.c index e455b0568d..52d2afc0c2 100644 --- a/ports/cxd56/common-hal/busio/UART.c +++ b/ports/cxd56/common-hal/busio/UART.c @@ -56,7 +56,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { struct termios tio; @@ -69,7 +69,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_raise_ValueError(translate("Could not initialize UART")); } - if (parity != PARITY_NONE) { + if (parity != BUSIO_UART_PARITY_NONE) { mp_raise_ValueError(translate("Could not initialize UART")); } diff --git a/ports/esp32s2/common-hal/busio/UART.c b/ports/esp32s2/common-hal/busio/UART.c index 4a016ad1a8..d52e50cade 100644 --- a/ports/esp32s2/common-hal/busio/UART.c +++ b/ports/esp32s2/common-hal/busio/UART.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,6 +27,8 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/busio/UART.h" +#include "driver/uart.h" + #include "mpconfigport.h" #include "lib/utils/interrupt_char.h" #include "py/gc.h" @@ -36,208 +38,178 @@ #include "supervisor/shared/translate.h" #include "supervisor/shared/tick.h" -#define UART_DEBUG(...) (void)0 -// #define UART_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) - -// Do-nothing callback needed so that usart_async code will enable rx interrupts. -// See comment below re usart_async_register_callback() -// static void usart_async_rxc_callback(const struct usart_async_descriptor *const descr) { -// // Nothing needs to be done by us. -// } - void uart_reset(void) { - + for (uart_port_t num = 0; num < UART_NUM_MAX; num++) { + // Ignore the UART used by the IDF. + #ifdef CONFIG_CONSOLE_UART_NUM + if (num == CONFIG_CONSOLE_UART_NUM) { + continue; + } + #endif + if (uart_is_driver_installed(num)) { + uart_driver_delete(num); + } + } } void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { - // uint8_t sercom_index = 255; // Unset index - // uint32_t rx_pinmux = 0; - // uint8_t rx_pad = 255; // Unset pad - // uint32_t tx_pinmux = 0; - // uint8_t tx_pad = 255; // Unset pad - - // if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) { - // mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); - // } - - // if (bits > 8) { - // mp_raise_NotImplementedError(translate("bytes > 8 bits not supported")); - // } + if (bits > 8) { + mp_raise_NotImplementedError(translate("bytes > 8 bits not supported")); + } bool have_tx = tx != NULL; bool have_rx = rx != NULL; + bool have_rts = rts != NULL; + bool have_cts = cts != NULL; + bool have_rs485_dir = rs485_dir != NULL; if (!have_tx && !have_rx) { mp_raise_ValueError(translate("tx and rx cannot both be None")); } - self->baudrate = baudrate; - self->character_bits = bits; + // Filter for sane settings for RS485 + if (have_rs485_dir) { + if (have_rts || have_cts) { + mp_raise_ValueError(translate("Cannot specify RTS or CTS in RS485 mode")); + } + } else if (rs485_invert) { + mp_raise_ValueError(translate("RS485 inversion specified when not in RS485 mode")); + } + self->timeout_ms = timeout * 1000; - // This assignment is only here because the usart_async routines take a *const argument. -// struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; + self->uart_num = UART_NUM_MAX; + for (uart_port_t num = 0; num < UART_NUM_MAX; num++) { + if (!uart_is_driver_installed(num)) { + self->uart_num = num; + } + } + if (self->uart_num == UART_NUM_MAX) { + mp_raise_ValueError(translate("All UART peripherals are in use")); + } -// for (int i = 0; i < NUM_SERCOMS_PER_PIN; i++) { -// Sercom* potential_sercom = NULL; -// if (have_tx) { -// sercom_index = tx->sercom[i].index; -// if (sercom_index >= SERCOM_INST_NUM) { -// continue; -// } -// potential_sercom = sercom_insts[sercom_index]; -// #ifdef SAMD21 -// if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || -// !(tx->sercom[i].pad == 0 || -// tx->sercom[i].pad == 2)) { -// continue; -// } -// #endif -// #ifdef SAMD51 -// if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || -// !(tx->sercom[i].pad == 0)) { -// continue; -// } -// #endif -// tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D); -// tx_pad = tx->sercom[i].pad; -// if (rx == NULL) { -// sercom = potential_sercom; -// break; -// } -// } -// for (int j = 0; j < NUM_SERCOMS_PER_PIN; j++) { -// if (((!have_tx && rx->sercom[j].index < SERCOM_INST_NUM && -// sercom_insts[rx->sercom[j].index]->USART.CTRLA.bit.ENABLE == 0) || -// sercom_index == rx->sercom[j].index) && -// rx->sercom[j].pad != tx_pad) { -// rx_pinmux = PINMUX(rx->number, (j == 0) ? MUX_C : MUX_D); -// rx_pad = rx->sercom[j].pad; -// sercom = sercom_insts[rx->sercom[j].index]; -// sercom_index = rx->sercom[j].index; -// break; -// } -// } -// if (sercom != NULL) { -// break; -// } -// } - // if (sercom == NULL) { - // mp_raise_ValueError(translate("Invalid pins")); - // } - // if (!have_tx) { - // tx_pad = 0; - // if (rx_pad == 0) { - // tx_pad = 2; - // } - // } - // if (!have_rx) { - // rx_pad = (tx_pad + 1) % 4; - // } + uart_mode_t mode = UART_MODE_UART; + uart_hw_flowcontrol_t flow_control = UART_HW_FLOWCTRL_DISABLE; + if (have_rs485_dir) { + mode = UART_MODE_RS485_HALF_DUPLEX; + if (!rs485_invert) { + uart_set_line_inverse(self->uart_num, UART_SIGNAL_DTR_INV); + } + } else if (have_rts && have_cts) { + flow_control = UART_HW_FLOWCTRL_CTS_RTS; + } else if (have_rts) { + flow_control = UART_HW_FLOWCTRL_RTS; + } else if (have_rts) { + flow_control = UART_HW_FLOWCTRL_CTS; + } - // // Set up clocks on SERCOM. - // samd_peripherals_sercom_clock_init(sercom, sercom_index); + if (receiver_buffer_size <= UART_FIFO_LEN) { + receiver_buffer_size = UART_FIFO_LEN + 8; + } - // if (rx && receiver_buffer_size > 0) { - // self->buffer_length = receiver_buffer_size; - // // Initially allocate the UART's buffer in the long-lived part of the - // // heap. UARTs are generally long-lived objects, but the "make long- - // // lived" machinery is incapable of moving internal pointers like - // // self->buffer, so do it manually. (However, as long as internal - // // pointers like this are NOT moved, allocating the buffer - // // in the long-lived pool is not strictly necessary) - // self->buffer = (uint8_t *) gc_alloc(self->buffer_length * sizeof(uint8_t), false, true); - // if (self->buffer == NULL) { - // common_hal_busio_uart_deinit(self); - // mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t)); - // } - // } else { - // self->buffer_length = 0; - // self->buffer = NULL; - // } - - // if (usart_async_init(usart_desc_p, sercom, self->buffer, self->buffer_length, NULL) != ERR_NONE) { - // mp_raise_ValueError(translate("Could not initialize UART")); - // } - - // usart_async_init() sets a number of defaults based on a prototypical SERCOM - // which don't necessarily match what we need. After calling it, set the values - // specific to this instantiation of UART. - - // Set pads computed for this SERCOM. - // TXPO: - // 0x0: TX pad 0; no RTS/CTS - // 0x1: TX pad 2; no RTS/CTS - // 0x2: TX pad 0; RTS: pad 2, CTS: pad 3 (not used by us right now) - // So divide by 2 to map pad to value. - // RXPO: - // 0x0: RX pad 0 - // 0x1: RX pad 1 - // 0x2: RX pad 2 - // 0x3: RX pad 3 - - // Doing a group mask and set of the registers saves 60 bytes over setting the bitfields individually. - - // sercom->USART.CTRLA.reg &= ~(SERCOM_USART_CTRLA_TXPO_Msk | - // SERCOM_USART_CTRLA_RXPO_Msk | - // SERCOM_USART_CTRLA_FORM_Msk); - // sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) | - // SERCOM_USART_CTRLA_RXPO(rx_pad) | - // (parity == PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1)); - - // Enable tx and/or rx based on whether the pins were specified. - // CHSIZE is 0 for 8 bits, 5, 6, 7 for 5, 6, 7 bits. 1 for 9 bits, but we don't support that. - // sercom->USART.CTRLB.reg &= ~(SERCOM_USART_CTRLB_TXEN | - // SERCOM_USART_CTRLB_RXEN | - // SERCOM_USART_CTRLB_PMODE | - // SERCOM_USART_CTRLB_SBMODE | - // SERCOM_USART_CTRLB_CHSIZE_Msk); - // sercom->USART.CTRLB.reg |= (have_tx ? SERCOM_USART_CTRLB_TXEN : 0) | - // (have_rx ? SERCOM_USART_CTRLB_RXEN : 0) | - // (parity == PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) | - // (stop > 1 ? SERCOM_USART_CTRLB_SBMODE : 0) | - // SERCOM_USART_CTRLB_CHSIZE(bits % 8); + uint8_t rx_threshold = UART_FIFO_LEN - 8; + // Install the driver before we change the settings. + if (uart_driver_install(self->uart_num, receiver_buffer_size, 0, 0, NULL, 0) != ESP_OK || + uart_set_mode(self->uart_num, mode) != ESP_OK) { + mp_raise_ValueError(translate("Could not initialize UART")); + } + uart_set_hw_flow_ctrl(self->uart_num, flow_control, rx_threshold); // Set baud rate - // common_hal_busio_uart_set_baudrate(self, baudrate); + common_hal_busio_uart_set_baudrate(self, baudrate); - // Turn on rx interrupt handling. The UART async driver has its own set of internal callbacks, - // which are set up by uart_async_init(). These in turn can call user-specified callbacks. - // In fact, the actual interrupts are not enabled unless we set up a user-specified callback. - // This is confusing. It's explained in the Atmel START User Guide -> Implementation Description -> - // Different read function behavior in some asynchronous drivers. As of this writing: - // http://start.atmel.com/static/help/index.html?GUID-79201A5A-226F-4FBB-B0B8-AB0BE0554836 - // Look at the ASFv4 code example for async USART. - // usart_async_register_callback(usart_desc_p, USART_ASYNC_RXC_CB, usart_async_rxc_callback); + uart_word_length_t word_length = UART_DATA_8_BITS; + switch (bits) { + // Shared bindings prevents data < 7 bits. + // case 5: + // word_length = UART_DATA_5_BITS; + // break; + // case 6: + // word_length = UART_DATA_6_BITS; + // break; + case 7: + word_length = UART_DATA_7_BITS; + break; + case 8: + word_length = UART_DATA_8_BITS; + break; + default: + // Won't hit this because shared-bindings limits to 7-9 bits. We error on 9 above. + break; + } + uart_set_word_length(self->uart_num, word_length); + uart_parity_t parity_mode = UART_PARITY_DISABLE; + switch (parity) { + case BUSIO_UART_PARITY_NONE: + parity_mode = UART_PARITY_DISABLE; + break; + case BUSIO_UART_PARITY_EVEN: + parity_mode = UART_PARITY_EVEN; + break; + case BUSIO_UART_PARITY_ODD: + parity_mode = UART_PARITY_ODD; + break; + default: + // Won't reach here because the input is an enum that is completely handled. + break; + } + uart_set_parity(self->uart_num, parity_mode); - // if (have_tx) { - // gpio_set_pin_direction(tx->number, GPIO_DIRECTION_OUT); - // gpio_set_pin_pull_mode(tx->number, GPIO_PULL_OFF); - // gpio_set_pin_function(tx->number, tx_pinmux); - // self->tx_pin = tx->number; - // claim_pin(tx); - // } else { - // self->tx_pin = NO_PIN; - // } + // Stop is 1 or 2 always. + uart_stop_bits_t stop_bits= UART_STOP_BITS_1; + if (stop == 2) { + stop_bits = UART_STOP_BITS_2; + } + uart_set_stop_bits(self->uart_num, stop_bits); - // if (have_rx) { - // gpio_set_pin_direction(rx->number, GPIO_DIRECTION_IN); - // gpio_set_pin_pull_mode(rx->number, GPIO_PULL_OFF); - // gpio_set_pin_function(rx->number, rx_pinmux); - // self->rx_pin = rx->number; - // claim_pin(rx); - // } else { - // self->rx_pin = NO_PIN; - // } + self->tx_pin = NULL; + self->rx_pin = NULL; + self->rts_pin = NULL; + self->cts_pin = NULL; + int tx_num = -1; + int rx_num = -1; + int rts_num = -1; + int cts_num = -1; + if (have_tx) { + claim_pin(tx); + self->tx_pin = tx; + tx_num = tx->number; + } - // usart_async_enable(usart_desc_p); + if (have_rx) { + claim_pin(rx); + self->rx_pin = rx; + rx_num = rx->number; + } + + if (have_rts) { + claim_pin(rts); + self->rts_pin = rts; + rts_num = rts->number; + } + + if (have_cts) { + claim_pin(cts); + self->cts_pin = cts; + cts_num = cts->number; + } + + if (have_rs485_dir) { + claim_pin(rs485_dir); + // RTS is used for RS485 direction. + self->rts_pin = rs485_dir; + rts_num = rs485_dir->number; + } + if (uart_set_pin(self->uart_num, tx_num, rx_num, rts_num, cts_num) != ESP_OK) { + mp_raise_ValueError(translate("Invalid pins")); + } } bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { @@ -248,14 +220,16 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { if (common_hal_busio_uart_deinited(self)) { return; } - // // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - // usart_async_disable(usart_desc_p); - // usart_async_deinit(usart_desc_p); + uart_driver_delete(self->uart_num); + reset_pin(self->rx_pin); reset_pin(self->tx_pin); + reset_pin(self->rts_pin); + reset_pin(self->cts_pin); self->rx_pin = NULL; self->tx_pin = NULL; + self->cts_pin = NULL; + self->rts_pin = NULL; } // Read characters. @@ -263,57 +237,49 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t if (self->rx_pin == NULL) { mp_raise_ValueError(translate("No RX pin")); } - - // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - if (len == 0) { // Nothing to read. return 0; } - // struct io_descriptor *io; - // usart_async_get_io_descriptor(usart_desc_p, &io); - - // size_t total_read = 0; - // uint64_t start_ticks = supervisor_ticks_ms64(); + size_t total_read = 0; + uint64_t start_ticks = supervisor_ticks_ms64(); // Busy-wait until timeout or until we've read enough chars. - // while (supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) { - // // Read as many chars as we can right now, up to len. - // size_t num_read = io_read(io, data, len); + while (supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) { + // Read as many chars as we can right now, up to len. + size_t num_read = uart_read_bytes(self->uart_num, data, len, 0); - // // Advance pointer in data buffer, and decrease how many chars left to read. - // data += num_read; - // len -= num_read; - // total_read += num_read; - // if (len == 0) { - // // Don't need to read any more: data buf is full. - // break; - // } - // if (num_read > 0) { - // // Reset the timeout on every character read. - // start_ticks = supervisor_ticks_ms64(); - // } - // RUN_BACKGROUND_TASKS; - // // Allow user to break out of a timeout with a KeyboardInterrupt. - // if (mp_hal_is_interrupted()) { - // break; - // } - // // If we are zero timeout, make sure we don't loop again (in the event - // // we read in under 1ms) - // if (self->timeout_ms == 0) { - // break; - // } - // } + // Advance pointer in data buffer, and decrease how many chars left to read. + data += num_read; + len -= num_read; + total_read += num_read; + if (len == 0) { + // Don't need to read any more: data buf is full. + break; + } + if (num_read > 0) { + // Reset the timeout on every character read. + start_ticks = supervisor_ticks_ms64(); + } + RUN_BACKGROUND_TASKS; + // Allow user to break out of a timeout with a KeyboardInterrupt. + if (mp_hal_is_interrupted()) { + break; + } + // If we are zero timeout, make sure we don't loop again (in the event + // we read in under 1ms) + if (self->timeout_ms == 0) { + break; + } + } - // if (total_read == 0) { - // *errcode = EAGAIN; - // return MP_STREAM_ERROR; - // } + if (total_read == 0) { + *errcode = EAGAIN; + return MP_STREAM_ERROR; + } - // return total_read; - return 0; + return total_read; } // Write characters. @@ -322,49 +288,34 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, mp_raise_ValueError(translate("No TX pin")); } - // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - - // struct io_descriptor *io; - // usart_async_get_io_descriptor(usart_desc_p, &io); - - // // Start writing characters. This is non-blocking and will - // // return immediately after setting up the write. - // if (io_write(io, data, len) < 0) { - // *errcode = MP_EAGAIN; - // return MP_STREAM_ERROR; - // } - - // // Busy-wait until all characters transmitted. - // struct usart_async_status async_status; - // while (true) { - // usart_async_get_status(usart_desc_p, &async_status); - // if (async_status.txcnt >= len) { - // break; - // } - // RUN_BACKGROUND_TASKS; - // } + while (len > 0) { + int count = uart_tx_chars(self->uart_num, (const char*) data, len); + if (count < 0) { + *errcode = MP_EAGAIN; + return MP_STREAM_ERROR; + } + len -= count; + data += count; + RUN_BACKGROUND_TASKS; + } + while (uart_wait_tx_done(self->uart_num, 0) == ESP_ERR_TIMEOUT) { + RUN_BACKGROUND_TASKS; + } return len; } uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) { - return self->baudrate; + uint32_t baudrate; + uart_get_baudrate(self->uart_num, &baudrate); + return baudrate; } void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate) { - // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - // usart_async_set_baud_rate(usart_desc_p, - // // Samples and ARITHMETIC vs FRACTIONAL must correspond to USART_SAMPR in - // // hpl_sercom_config.h. - // _usart_async_calculate_baud_rate(baudrate, // e.g. 9600 baud - // PROTOTYPE_SERCOM_USART_ASYNC_CLOCK_FREQUENCY, - // 16, // samples - // USART_BAUDRATE_ASYNCH_ARITHMETIC, - // 0 // fraction - not used for ARITHMETIC - // )); - self->baudrate = baudrate; + if (baudrate > UART_BITRATE_MAX || + uart_set_baudrate(self->uart_num, baudrate) != ESP_OK) { + mp_raise_ValueError(translate("Unsupported baudrate")); + } } mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) { @@ -376,19 +327,13 @@ void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeou } uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) { - // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - // struct usart_async_status async_status; - // usart_async_get_status(usart_desc_p, &async_status); - // return async_status.rxcnt; - return 0; + size_t count; + uart_get_buffered_data_len(self->uart_num, &count); + return count; } void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) { - // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - // usart_async_flush_rx_buffer(usart_desc_p); - + uart_flush(self->uart_num); } // True if there are no characters still to be written. @@ -396,10 +341,5 @@ bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) { if (self->tx_pin == NULL) { return false; } - // This assignment is only here because the usart_async routines take a *const argument. - // struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc; - // struct usart_async_status async_status; - // usart_async_get_status(usart_desc_p, &async_status); - // return !(async_status.flags & USART_ASYNC_STATUS_BUSY); - return false; + return uart_wait_tx_done(self->uart_num, 0) != ESP_ERR_TIMEOUT; } diff --git a/ports/esp32s2/common-hal/busio/UART.h b/ports/esp32s2/common-hal/busio/UART.h index 3c2bd1dac5..b3cc929665 100644 --- a/ports/esp32s2/common-hal/busio/UART.h +++ b/ports/esp32s2/common-hal/busio/UART.h @@ -29,18 +29,19 @@ #include "common-hal/microcontroller/Pin.h" +#include "esp-idf/components/soc/include/hal/uart_types.h" #include "py/obj.h" typedef struct { mp_obj_base_t base; const mcu_pin_obj_t* rx_pin; const mcu_pin_obj_t* tx_pin; + const mcu_pin_obj_t* rts_pin; + const mcu_pin_obj_t* cts_pin; + uart_port_t uart_num; uint8_t character_bits; bool rx_error; - uint32_t baudrate; uint32_t timeout_ms; - uint32_t buffer_length; - uint8_t* buffer; } busio_uart_obj_t; void uart_reset(void); diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 7aae7f034b..648f959037 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 7aae7f034bab68d2dd6aaa763924c91eb697d87e +Subproject commit 648f959037896cff887a05b67105748790bfe63a diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 5ef347e591..4ca2f8e497 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -85,7 +85,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { @@ -94,7 +94,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->timeout_ms = timeout * 1000; // We are transmitting one direction if one pin is NULL and the other isn't. - bool is_onedirection = (rx != NULL) != (tx != NULL); + bool is_onedirection = (rx == NULL) != (tx == NULL); bool uart_taken = false; const uint32_t rx_count = MP_ARRAY_SIZE(mcu_uart_rx_list); diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 89f3c9f327..012ebc3b5e 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -133,7 +133,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { @@ -162,7 +162,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_raise_ValueError(translate("Invalid buffer size")); } - if ( parity == PARITY_ODD ) { + if ( parity == BUSIO_UART_PARITY_ODD ) { mp_raise_ValueError(translate("Odd parity is not supported")); } @@ -176,7 +176,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, .interrupt_priority = 7, .hal_cfg = { .hwfc = NRF_UARTE_HWFC_DISABLED, - .parity = (parity == PARITY_NONE) ? NRF_UARTE_PARITY_EXCLUDED : NRF_UARTE_PARITY_INCLUDED + .parity = (parity == BUSIO_UART_PARITY_NONE) ? NRF_UARTE_PARITY_EXCLUDED : NRF_UARTE_PARITY_INCLUDED } }; diff --git a/ports/stm/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c index 86a932290a..7450f9897a 100644 --- a/ports/stm/common-hal/busio/UART.c +++ b/ports/stm/common-hal/busio/UART.c @@ -79,7 +79,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled) { @@ -201,8 +201,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->handle.Init.BaudRate = baudrate; self->handle.Init.WordLength = (bits == 9) ? UART_WORDLENGTH_9B : UART_WORDLENGTH_8B; self->handle.Init.StopBits = (stop > 1) ? UART_STOPBITS_2 : UART_STOPBITS_1; - self->handle.Init.Parity = (parity == PARITY_ODD) ? UART_PARITY_ODD : - (parity == PARITY_EVEN) ? UART_PARITY_EVEN : + self->handle.Init.Parity = (parity == BUSIO_UART_PARITY_ODD) ? UART_PARITY_ODD : + (parity == BUSIO_UART_PARITY_EVEN) ? UART_PARITY_EVEN : UART_PARITY_NONE; self->handle.Init.Mode = (self->tx != NULL && self->rx != NULL) ? UART_MODE_TX_RX : (self->tx != NULL) ? UART_MODE_TX : diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 8c0811266c..018ded1828 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -52,8 +52,8 @@ //| :param ~microcontroller.Pin rx: the pin to receive on, or ``None`` if this ``UART`` is transmit-only. //| :param ~microcontroller.Pin rts: the pin for rts, or ``None`` if rts not in use. //| :param ~microcontroller.Pin cts: the pin for cts, or ``None`` if cts not in use. -//| :param ~microcontroller.Pin rs485_dir: the pin for rs485 direction setting, or ``None`` if rs485 not in use. -//| :param bool rs485_invert: set to invert the sense of the rs485_dir pin. +//| :param ~microcontroller.Pin rs485_dir: the output pin for rs485 direction setting, or ``None`` if rs485 not in use. +//| :param bool rs485_invert: rs485_dir pin active high when set. Active low otherwise. //| :param int baudrate: the transmit and receive speed. //| :param int bits: the number of bits per byte, 7, 8 or 9. //| :param Parity parity: the parity used for error checking. @@ -87,8 +87,8 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co enum { ARG_tx, ARG_rx, ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_timeout, ARG_receiver_buffer_size, ARG_rts, ARG_cts, ARG_rs485_dir,ARG_rs485_invert}; static const mp_arg_t allowed_args[] = { - { MP_QSTR_tx, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_rx, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_tx, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_rx, MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 9600} }, { MP_QSTR_bits, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} }, { MP_QSTR_parity, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, @@ -115,11 +115,11 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co mp_raise_ValueError(translate("bits must be 7, 8 or 9")); } - uart_parity_t parity = PARITY_NONE; + busio_uart_parity_t parity = BUSIO_UART_PARITY_NONE; if (args[ARG_parity].u_obj == &busio_uart_parity_even_obj) { - parity = PARITY_EVEN; + parity = BUSIO_UART_PARITY_EVEN; } else if (args[ARG_parity].u_obj == &busio_uart_parity_odd_obj) { - parity = PARITY_ODD; + parity = BUSIO_UART_PARITY_ODD; } uint8_t stop = args[ARG_stop].u_int; diff --git a/shared-bindings/busio/UART.h b/shared-bindings/busio/UART.h index 3aed4e534c..ce8da1445c 100644 --- a/shared-bindings/busio/UART.h +++ b/shared-bindings/busio/UART.h @@ -34,17 +34,17 @@ extern const mp_obj_type_t busio_uart_type; typedef enum { - PARITY_NONE, - PARITY_EVEN, - PARITY_ODD -} uart_parity_t; + BUSIO_UART_PARITY_NONE, + BUSIO_UART_PARITY_EVEN, + BUSIO_UART_PARITY_ODD +} busio_uart_parity_t; // Construct an underlying UART object. extern void common_hal_busio_uart_construct(busio_uart_obj_t *self, const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts, const mcu_pin_obj_t * rs485_dir, bool rs485_invert, - uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop, + uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop, mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer, bool sigint_enabled); diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 0fbf916cd9..2c9139d8af 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -123,7 +123,7 @@ mp_obj_t common_hal_board_create_uart(void) { #endif common_hal_busio_uart_construct(self, tx, rx, rts, cts, rs485_dir, rs485_invert, - 9600, 8, PARITY_NONE, 1, 1.0f, 64, NULL, false); + 9600, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, 64, NULL, false); MP_STATE_VM(shared_uart_bus) = MP_OBJ_FROM_PTR(self); return MP_STATE_VM(shared_uart_bus); } From 7b56617f8ef6cf9af9a5a8dbdadbc678918d52ca Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 10 Jun 2020 13:50:10 -0700 Subject: [PATCH 007/277] Turn off stub so flash works over native usb --- ports/esp32s2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4eac07f99f..570eab0213 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -275,7 +275,7 @@ $(BUILD)/firmware.bin: $(BUILD)/esp-idf/partition_table/partition-table.bin $(BU $(Q)$(PYTHON) ../../tools/join_bins.py $@ 0x1000 $(BUILD)/esp-idf/bootloader/bootloader.bin 0x8000 $(BUILD)/esp-idf/partition_table/partition-table.bin 0x10000 $(BUILD)/circuitpython-firmware.bin flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ include $(TOP)/py/mkrules.mk From f52f60b17d7fe5b7f139484e8b9988e3cf96eac1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 17 Jun 2020 10:57:52 -0700 Subject: [PATCH 008/277] Add UF2 build target --- ports/esp32s2/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 570eab0213..29504065e9 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -258,7 +258,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-id FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) -all: $(BUILD)/firmware.bin +all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.elf: $(OBJ) | $(ESP_IDF_COMPONENTS_EXPANDED) $(ESP_AUTOGEN_LD) $(STEPECHO) "LINK $@" @@ -274,6 +274,10 @@ $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.bin: $(BUILD)/esp-idf/partition_table/partition-table.bin $(BUILD)/esp-idf/bootloader/bootloader.bin $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON) ../../tools/join_bins.py $@ 0x1000 $(BUILD)/esp-idf/bootloader/bootloader.bin 0x8000 $(BUILD)/esp-idf/partition_table/partition-table.bin 0x10000 $(BUILD)/circuitpython-firmware.bin +$(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin + $(STEPECHO) "Create $@" + $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ + flash: $(BUILD)/firmware.bin esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ From fc9c0ba5731a7eb1188366841a9a564074e7052f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 17 Jun 2020 13:45:21 -0700 Subject: [PATCH 009/277] Initial SPI implementation. Almost certainly doesn't compile --- .../espressif_saola_1_wroom/mpconfigboard.mk | 2 - .../boards/unexpectedmaker_feathers2/board.c | 56 ++++ .../unexpectedmaker_feathers2/mpconfigboard.h | 36 +++ .../mpconfigboard.mk | 21 ++ .../boards/unexpectedmaker_feathers2/pins.c | 57 ++++ .../unexpectedmaker_feathers2/sdkconfig | 0 ports/esp32s2/common-hal/busio/I2C.c | 4 +- ports/esp32s2/common-hal/busio/SPI.c | 282 +++++++++++------- ports/esp32s2/common-hal/busio/SPI.h | 12 +- ports/esp32s2/common-hal/busio/UART.c | 8 +- .../esp32s2/common-hal/microcontroller/Pin.c | 5 +- .../esp32s2/common-hal/microcontroller/Pin.h | 5 +- 12 files changed, 366 insertions(+), 122 deletions(-) create mode 100644 ports/esp32s2/boards/unexpectedmaker_feathers2/board.c create mode 100644 ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h create mode 100644 ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c create mode 100644 ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk index cd27356153..94e3b60f2d 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -12,8 +12,6 @@ LONGINT_IMPL = MPZ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_DIGITALIO = 0 -CIRCUITPY_MICROCONTROLLER = 0 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=40m diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c new file mode 100644 index 0000000000..8890ec4c16 --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -0,0 +1,56 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // USB + never_reset_pin(&pin_GPIO19); + never_reset_pin(&pin_GPIO20); + + // Debug UART + never_reset_pin(&pin_GPIO43); + never_reset_pin(&pin_GPIO44); + + // SPI Flash and RAM + never_reset_pin(&pin_GPIO26); + never_reset_pin(&pin_GPIO27); + never_reset_pin(&pin_GPIO28); + never_reset_pin(&pin_GPIO29); + never_reset_pin(&pin_GPIO30); + never_reset_pin(&pin_GPIO31); + never_reset_pin(&pin_GPIO32); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h new file mode 100644 index 0000000000..93fb0c573d --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "FeatherS2" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define AUTORESET_DELAY_MS 500 + +// Doesn't work with this on. +// #define MICROPY_HW_APA102_MOSI (&pin_GPIO44) +// #define MICROPY_HW_APA102_SCK (&pin_GPIO45) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.mk b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.mk new file mode 100644 index 0000000000..ea3484d2fa --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.mk @@ -0,0 +1,21 @@ +USB_VID = 0x239A +USB_PID = 0x80AC +USB_PRODUCT = "FeatherS2" +USB_MANUFACTURER = "UnexpectedMaker" +USB_DEVICES = "CDC,MSC,HID" + + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_NEOPIXEL_WRITE = 0 + +CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=16MB + +CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c new file mode 100644 index 0000000000..e8dd2edf6a --- /dev/null +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c @@ -0,0 +1,57 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + + // Moving to 9 and 8 + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO44) }, // MTDO + { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO45) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig b/ports/esp32s2/boards/unexpectedmaker_feathers2/sdkconfig new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index fd983619ff..51817c95e2 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -143,8 +143,8 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { i2c_driver_delete(self->i2c_num); i2c_status[self->i2c_num] = STATUS_FREE; - reset_pin(self->sda_pin); - reset_pin(self->scl_pin); + common_hal_reset_pin(self->sda_pin); + common_hal_reset_pin(self->scl_pin); self->sda_pin = NULL; self->scl_pin = NULL; } diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index e761eb49be..92a3dd4436 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -32,84 +32,141 @@ #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" -void spi_reset(void) { +static bool spi_never_reset[SOC_SPI_PERIPH_NUM]; +void spi_reset(void) { + for (spi_host_device_t host_id = SPI2_HOST; host_id < SOC_SPI_PERIPH_NUM; host_id++) { + if (spi_never_reset[host_id]) { + continue; + } + spi_bus_free(host_id); + } +} + +// This is copied in from the ESP-IDF because it is static. +// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +static bool bus_uses_iomux_pins(spi_host_device_t host, const spi_bus_config_t* bus_config) +{ + if (bus_config->sclk_io_num>=0 && + bus_config->sclk_io_num != spi_periph_signal[host].spiclk_iomux_pin) return false; + if (bus_config->quadwp_io_num>=0 && + bus_config->quadwp_io_num != spi_periph_signal[host].spiwp_iomux_pin) return false; + if (bus_config->quadhd_io_num>=0 && + bus_config->quadhd_io_num != spi_periph_signal[host].spihd_iomux_pin) return false; + if (bus_config->mosi_io_num >= 0 && + bus_config->mosi_io_num != spi_periph_signal[host].spid_iomux_pin) return false; + if (bus_config->miso_io_num>=0 && + bus_config->miso_io_num != spi_periph_signal[host].spiq_iomux_pin) return false; + + return true; +} + +// End copied code. + +static bool spi_bus_free(spi_host_device_t host_id) { + return spi_bus_get_attr(host_id) == NULL; } void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, const mcu_pin_obj_t * miso) { - // uint8_t sercom_index; - // uint32_t clock_pinmux = 0; - // bool mosi_none = mosi == NULL; - // bool miso_none = miso == NULL; - // uint32_t mosi_pinmux = 0; - // uint32_t miso_pinmux = 0; - // uint8_t clock_pad = 0; - // uint8_t mosi_pad = 0; - // uint8_t miso_pad = 0; - // uint8_t dopo = 255; + spi_bus_config_t bus_config; + bus_config.mosi_io_num = mosi != NULL ? mosi->number : -1; + bus_config.miso_io_num = miso != NULL ? miso->number : -1; + bus_config.sclk_io_num = clock != NULL ? clock->number : -1; + bus_config.quadwp_io_num = -1; + bus_config.quadhd_io_num = -1; + bus_config.max_transfer_sz = 0; // Uses the default + bus_config.flags = SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_SCLK | + mosi != NULL ? SPICOMMON_BUSFLAG_MOSI : 0 | + miso != NULL ? SPICOMMON_BUSFLAG_MISO : 0; + bus_config.intr_flags = 0; - // if (sercom == NULL) { - // mp_raise_ValueError(translate("Invalid pins")); - // } + // RAM and Flash is often on SPI1 and is unsupported by the IDF so use it as + // a flag value. + spi_host_device_t host_id = SPI1_HOST; + self->connected_through_gpio = true; + // Try and save SPI2 for pins that are on the IOMUX + if (bus_uses_iomux_pins(SPI2_HOST, &bus_config) && spi_bus_free(SPI2_HOST)) { + host_id = SPI2_HOST; + self->connected_through_gpio = false; + } else if (spi_bus_free(SPI3_HOST)) { + host_id = SPI3_HOST; + } else if (spi_bus_free(SPI2_HOST)) { + host_id = SPI2_HOST; + } + if (host_id == SPI1_HOST) { + mp_raise_ValueError(translate("All SPI peripherals are in use")); + } - // // Set up SPI clocks on SERCOM. - // samd_peripherals_sercom_clock_init(sercom, sercom_index); + esp_err_t result = spi_bus_initialize(host_id, &bus_config, 0 /* dma channel */); + if (result == ESP_ERR_NO_MEM) { + mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); + } else if (result = ESP_INVALID_ARG) { + mp_raise_ValueError(translate("Invalid pins")); + } + spi_bus_lock_dev_config_t config = { .flags = 0 }; + result = spi_bus_lock_register_dev(spi_bus_get_attr(host_id)->lock, + spi_bus_lock_dev_config_t *config, + &self->lock); + if (result == ESP_ERR_NO_MEM) { + mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); + } - #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102 - // // if we're re-using the dotstar sercom, make sure it is disabled or the init will fail out - // hri_sercomspi_clear_CTRLA_ENABLE_bit(sercom); - #endif - // if (spi_m_sync_init(&self->spi_desc, sercom) != ERR_NONE) { - // mp_raise_OSError(MP_EIO); - // } - // Pads must be set after spi_m_sync_init(), which uses default values from - // the prototypical SERCOM. - // hri_sercomspi_write_CTRLA_DOPO_bf(sercom, dopo); - // hri_sercomspi_write_CTRLA_DIPO_bf(sercom, miso_pad); + err = esp_intr_alloc(spicommon_irqsource_for_host(host_id), + bus_config.intr_flags | ESP_INTR_FLAG_INTRDISABLED, + spi_interrupt_handler, self, &self->intr); + if (result == ESP_ERR_NO_MEM) { + mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); + } - // Always start at 250khz which is what SD cards need. They are sensitive to - // SPI bus noise before they are put into SPI mode. - // uint8_t baud_value = samd_peripherals_spi_baudrate_to_baud_reg_value(250000); - // if (spi_m_sync_set_baudrate(&self->spi_desc, baud_value) != ERR_NONE) { - // // spi_m_sync_set_baudrate does not check for validity, just whether the device is - // // busy or not - // mp_raise_OSError(MP_EIO); - // } + spi_hal_context_t* hal = &self->hal_context; + hal->hw = NULL; // Set by spi_hal_init + hal->dmadesc_tx = NULL; + hal->dmadesc_rx = NULL; + hal->dmadesc_n = 0; - // gpio_set_pin_direction(clock->number, GPIO_DIRECTION_OUT); - // gpio_set_pin_pull_mode(clock->number, GPIO_PULL_OFF); - // gpio_set_pin_function(clock->number, clock_pinmux); - // claim_pin(clock); - // self->clock_pin = clock->number; + // We don't use native CS. + hal->cs_setup = 0; + hal->cs_hold = 0; + hal->cs_pin_id = -1; + hal->timing_conf = &self->timing_conf; - // if (mosi_none) { - // self->MOSI_pin = NO_PIN; - // } else { - // gpio_set_pin_direction(mosi->number, GPIO_DIRECTION_OUT); - // gpio_set_pin_pull_mode(mosi->number, GPIO_PULL_OFF); - // gpio_set_pin_function(mosi->number, mosi_pinmux); - // self->MOSI_pin = mosi->number; - // claim_pin(mosi); - // } + hal->sio = 1; + hal->half_duplex = 0; + hal->tx_lsbfirst = 0; + hal->rx_lsbfirst = 0; + hal->dma_enabled = 0; + hal->no_compensate = 1; + // Ignore CS bits - // if (miso_none) { - // self->MISO_pin = NO_PIN; - // } else { - // gpio_set_pin_direction(miso->number, GPIO_DIRECTION_IN); - // gpio_set_pin_pull_mode(miso->number, GPIO_PULL_OFF); - // gpio_set_pin_function(miso->number, miso_pinmux); - // self->MISO_pin = miso->number; - // claim_pin(miso); - // } + // We don't use cmd, addr or dummy bits. + hal->cmd = 0; + hal->cmd_bits = 0; + hal->addr_bits = 0; + hal->dummy_bits = 0; + hal->addr = 0; - // spi_m_sync_enable(&self->spi_desc); + hal->io_mode = SPI_LL_IO_MODE_NORMAL; + + spi_hal_init(hal, host_id); } void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) { - // never_reset_sercom(self->spi_desc.dev.prvt); + spi_never_reset[self->host_id] = true; never_reset_pin(self->clock_pin); never_reset_pin(self->MOSI_pin); @@ -124,51 +181,50 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { if (common_hal_busio_spi_deinited(self)) { return; } - // allow_reset_sercom(self->spi_desc.dev.prvt); + spi_never_reset[self->host_id] = false; + spi_bus_free(self->host_id); - // spi_m_sync_disable(&self->spi_desc); - // spi_m_sync_deinit(&self->spi_desc); - reset_pin(self->clock_pin); - reset_pin(self->MOSI_pin); - reset_pin(self->MISO_pin); + common_hal_reset_pin(self->clock_pin); + common_hal_reset_pin(self->MOSI_pin); + common_hal_reset_pin(self->MISO_pin); self->clock_pin = NULL; } bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) { - // If the settings are already what we want then don't reset them. - // if (hri_sercomspi_get_CTRLA_CPHA_bit(hw) == phase && - // hri_sercomspi_get_CTRLA_CPOL_bit(hw) == polarity && - // hri_sercomspi_read_CTRLB_CHSIZE_bf(hw) == ((uint32_t)bits - 8) && - // hri_sercomspi_read_BAUD_BAUD_bf(hw) == baud_reg_value) { - // return true; - // } - - // Disable, set values (most or all are enable-protected), and re-enable. - // spi_m_sync_disable(&self->spi_desc); - // hri_sercomspi_wait_for_sync(hw, SERCOM_SPI_SYNCBUSY_MASK); - - // hri_sercomspi_write_CTRLA_CPHA_bit(hw, phase); - // hri_sercomspi_write_CTRLA_CPOL_bit(hw, polarity); - // hri_sercomspi_write_CTRLB_CHSIZE_bf(hw, bits - 8); - // hri_sercomspi_write_BAUD_BAUD_bf(hw, baud_reg_value); - // hri_sercomspi_wait_for_sync(hw, SERCOM_SPI_SYNCBUSY_MASK); - - // spi_m_sync_enable(&self->spi_desc); - // hri_sercomspi_wait_for_sync(hw, SERCOM_SPI_SYNCBUSY_MASK); + if (baudrate == self->target_frequency && + polarity == self->polarity && + phase == self->phase && + bits == self->bits) { + return true; + } + self->hal_context->mode = polarity << 1 | phase; + self->polarity = polarity; + self->phase = phase; + self->bits = bits; + self->target_frequency = baudrate; + esp_err_t result = spi_hal_get_clock_conf(self->hal_context, + self->target_frequency, + 128 /* duty_cycle */, + self->connected_through_gpio, + 0 /* input_delay_ns */, + &self->real_frequency, + &self->timing_conf); + spi_hal_setup_device(&self->hal_context); return true; } bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) { - bool grabbed_lock = false; - // CRITICAL_SECTION_ENTER() - if (!self->has_lock) { - grabbed_lock = true; - self->has_lock = true; - } - // CRITICAL_SECTION_LEAVE(); - return grabbed_lock; + // If our lock has already been taken then return false because someone else + // may already grabbed it in our call stack. + if (self->has_lock) { + return false; + } + // Wait to grab the lock from another task. + esp_err_t ret = spi_bus_lock_acquire_start(self->lock, portMAX_DELAY); + self->has_lock = true; + return true; } bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) { @@ -176,6 +232,7 @@ bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) { } void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { + spi_bus_lock_acquire_end(self->lock); self->has_lock = false; } @@ -218,32 +275,35 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin if (len == 0) { return true; } - // int32_t status; - if (len >= 16) { - // status = sercom_dma_transfer(self->spi_desc.dev.prvt, data_out, data_in, len); + + spi_hal_context_t* hal = &self->hal_context; + hal->tx_bitlen = len * 8; + hal->rx_bitlen = len * 8; + hal->send_buffer = data_out; + hal->rcv_buffer = data_in; + + spi_hal_setup_trans(hal); + spi_hal_prepare_data(hal); + spi_hal_user_start(hal); + if (len >= 16 && false) { + // Set up the interrupt and wait on the lock. } else { - // struct spi_xfer xfer; - // xfer.txbuf = data_out; - // xfer.rxbuf = data_in; - // xfer.size = len; - // status = spi_m_sync_transfer(&self->spi_desc, &xfer); + while (!spi_hal_usr_is_done(hal)) { + RUN_BACKGROUND_TASKS(); + } } - return false; // Status is number of chars read or an error code < 0. + + return false; } uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) { - // return samd_peripherals_spi_baud_reg_value_to_baudrate(hri_sercomspi_read_BAUD_reg(self->spi_desc.dev.prvt)); - return 0; + return self->real_frequency; } uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) { - // void * hw = self->spi_desc.dev.prvt; - // return hri_sercomspi_get_CTRLA_CPHA_bit(hw); - return 0; + return self->phase; } uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) { - // void * hw = self->spi_desc.dev.prvt; - // return hri_sercomspi_get_CTRLA_CPOL_bit(hw); - return 0; + return self->polarity; } diff --git a/ports/esp32s2/common-hal/busio/SPI.h b/ports/esp32s2/common-hal/busio/SPI.h index 0ff1a4f7ea..0c2f286078 100644 --- a/ports/esp32s2/common-hal/busio/SPI.h +++ b/ports/esp32s2/common-hal/busio/SPI.h @@ -33,10 +33,20 @@ typedef struct { mp_obj_base_t base; - bool has_lock; const mcu_pin_obj_t* clock_pin; const mcu_pin_obj_t* MOSI_pin; const mcu_pin_obj_t* MISO_pin; + spi_host_device_t host_id; + spi_bus_lock_dev_handle_t lock; + spi_hal_context_t hal_context; + spi_hal_timing_conf_t timing_conf; + uint32_t target_frequency; + uint32_t real_frequency; + uint8_t polarity; + uint8_t phase; + uint8_t bits; + bool has_lock; + bool connected_through_gpio; } busio_spi_obj_t; void spi_reset(void); diff --git a/ports/esp32s2/common-hal/busio/UART.c b/ports/esp32s2/common-hal/busio/UART.c index d52e50cade..f73f5c993d 100644 --- a/ports/esp32s2/common-hal/busio/UART.c +++ b/ports/esp32s2/common-hal/busio/UART.c @@ -222,10 +222,10 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { } uart_driver_delete(self->uart_num); - reset_pin(self->rx_pin); - reset_pin(self->tx_pin); - reset_pin(self->rts_pin); - reset_pin(self->cts_pin); + common_hal_reset_pin(self->rx_pin); + common_hal_reset_pin(self->tx_pin); + common_hal_reset_pin(self->rts_pin); + common_hal_reset_pin(self->cts_pin); self->rx_pin = NULL; self->tx_pin = NULL; self->cts_pin = NULL; diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index fd815518d5..075f80abc6 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -35,6 +35,9 @@ STATIC uint32_t never_reset_pins[2]; STATIC uint32_t in_use[2]; +bool apa102_mosi_in_use; +bool apa102_sck_in_use; + void never_reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] |= 1 << pin_number % 32; } @@ -49,7 +52,7 @@ void reset_pin_number(gpio_num_t pin_number) { in_use[pin_number / 32] &= ~(1 << pin_number % 32); } -void reset_pin(const mcu_pin_obj_t* pin) { +void common_hal_reset_pin(const mcu_pin_obj_t* pin) { reset_pin_number(pin->number); } diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index 573eec392b..ab06b388f8 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -31,11 +31,14 @@ #include "peripherals/pins.h" +extern bool apa102_mosi_in_use; +extern bool apa102_sck_in_use; + void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. void reset_pin_number(gpio_num_t pin_number); -void reset_pin(const mcu_pin_obj_t* pin); +void common_hal_reset_pin(const mcu_pin_obj_t* pin); void claim_pin(const mcu_pin_obj_t* pin); bool pin_number_is_free(gpio_num_t pin_number); void never_reset_pin_number(gpio_num_t pin_number); From c5fa9730a87b47f569a2bc4a7599e67b198826e6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 23 Jun 2020 12:58:01 -0700 Subject: [PATCH 010/277] Compiles! --- ports/atmel-samd/common-hal/busio/SPI.c | 4 +- .../espressif_saola_1_wrover/mpconfigboard.mk | 2 - ports/esp32s2/common-hal/busio/SPI.c | 82 ++++++++----------- ports/esp32s2/common-hal/busio/SPI.h | 6 +- ports/esp32s2/esp-idf | 2 +- ports/mimxrt10xx/common-hal/busio/SPI.c | 4 +- ports/nrf/common-hal/busio/SPI.c | 6 +- ports/stm/common-hal/busio/SPI.c | 4 +- shared-bindings/busio/SPI.h | 2 +- 9 files changed, 48 insertions(+), 64 deletions(-) diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c index 1dc389027d..921713d690 100644 --- a/ports/atmel-samd/common-hal/busio/SPI.c +++ b/ports/atmel-samd/common-hal/busio/SPI.c @@ -341,7 +341,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, return status >= 0; // Status is number of chars read or an error code < 0. } -bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) { +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { if (len == 0) { return true; } @@ -350,7 +350,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin status = sercom_dma_transfer(self->spi_desc.dev.prvt, data_out, data_in, len); } else { struct spi_xfer xfer; - xfer.txbuf = data_out; + xfer.txbuf = (uint8_t*) data_out; xfer.rxbuf = data_in; xfer.size = len; status = spi_m_sync_transfer(&self->spi_desc, &xfer); diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.mk b/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.mk index 0b847de943..08f2770f58 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.mk @@ -12,8 +12,6 @@ LONGINT_IMPL = MPZ CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_DIGITALIO = 0 -CIRCUITPY_MICROCONTROLLER = 0 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=40m diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 92a3dd4436..db28dee661 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -75,10 +75,14 @@ static bool bus_uses_iomux_pins(spi_host_device_t host, const spi_bus_config_t* // End copied code. -static bool spi_bus_free(spi_host_device_t host_id) { +static bool _spi_bus_free(spi_host_device_t host_id) { return spi_bus_get_attr(host_id) == NULL; } +static void spi_interrupt_handler(void *arg) { + +} + void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, const mcu_pin_obj_t * miso) { @@ -90,8 +94,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, bus_config.quadhd_io_num = -1; bus_config.max_transfer_sz = 0; // Uses the default bus_config.flags = SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_SCLK | - mosi != NULL ? SPICOMMON_BUSFLAG_MOSI : 0 | - miso != NULL ? SPICOMMON_BUSFLAG_MISO : 0; + (mosi != NULL ? SPICOMMON_BUSFLAG_MOSI : 0) | + (miso != NULL ? SPICOMMON_BUSFLAG_MISO : 0); bus_config.intr_flags = 0; // RAM and Flash is often on SPI1 and is unsupported by the IDF so use it as @@ -99,12 +103,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, spi_host_device_t host_id = SPI1_HOST; self->connected_through_gpio = true; // Try and save SPI2 for pins that are on the IOMUX - if (bus_uses_iomux_pins(SPI2_HOST, &bus_config) && spi_bus_free(SPI2_HOST)) { + if (bus_uses_iomux_pins(SPI2_HOST, &bus_config) && _spi_bus_free(SPI2_HOST)) { host_id = SPI2_HOST; self->connected_through_gpio = false; - } else if (spi_bus_free(SPI3_HOST)) { + } else if (_spi_bus_free(SPI3_HOST)) { host_id = SPI3_HOST; - } else if (spi_bus_free(SPI2_HOST)) { + } else if (_spi_bus_free(SPI2_HOST)) { host_id = SPI2_HOST; } if (host_id == SPI1_HOST) { @@ -114,21 +118,21 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, esp_err_t result = spi_bus_initialize(host_id, &bus_config, 0 /* dma channel */); if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); - } else if (result = ESP_INVALID_ARG) { + } else if (result == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("Invalid pins")); } spi_bus_lock_dev_config_t config = { .flags = 0 }; result = spi_bus_lock_register_dev(spi_bus_get_attr(host_id)->lock, - spi_bus_lock_dev_config_t *config, + &config, &self->lock); if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } - err = esp_intr_alloc(spicommon_irqsource_for_host(host_id), - bus_config.intr_flags | ESP_INTR_FLAG_INTRDISABLED, - spi_interrupt_handler, self, &self->intr); + result = esp_intr_alloc(spicommon_irqsource_for_host(host_id), + bus_config.intr_flags | ESP_INTR_FLAG_INTRDISABLED, + spi_interrupt_handler, self, &self->interrupt); if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } @@ -198,18 +202,21 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, bits == self->bits) { return true; } - self->hal_context->mode = polarity << 1 | phase; + self->hal_context.mode = polarity << 1 | phase; self->polarity = polarity; self->phase = phase; self->bits = bits; self->target_frequency = baudrate; - esp_err_t result = spi_hal_get_clock_conf(self->hal_context, + esp_err_t result = spi_hal_get_clock_conf(&self->hal_context, self->target_frequency, 128 /* duty_cycle */, self->connected_through_gpio, 0 /* input_delay_ns */, &self->real_frequency, &self->timing_conf); + if (result != ESP_OK) { + return false; + } spi_hal_setup_device(&self->hal_context); return true; @@ -222,9 +229,9 @@ bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) { return false; } // Wait to grab the lock from another task. - esp_err_t ret = spi_bus_lock_acquire_start(self->lock, portMAX_DELAY); - self->has_lock = true; - return true; + esp_err_t result = spi_bus_lock_acquire_start(self->lock, portMAX_DELAY); + self->has_lock = result == ESP_OK; + return self->has_lock; } bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) { @@ -238,62 +245,37 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *data, size_t len) { - if (len == 0) { - return true; - } - // int32_t status; - if (len >= 16) { - // status = sercom_dma_write(self->spi_desc.dev.prvt, data, len); - } else { - // struct io_descriptor *spi_io; - // spi_m_sync_get_io_descriptor(&self->spi_desc, &spi_io); - // status = spi_io->write(spi_io, data, len); - } - return false; // Status is number of chars read or an error code < 0. + return common_hal_busio_spi_transfer(self, data, NULL, len); } bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_value) { - if (len == 0) { - return true; - } - // int32_t status; - if (len >= 16) { - // status = sercom_dma_read(self->spi_desc.dev.prvt, data, len, write_value); - } else { - // self->spi_desc.dev.dummy_byte = write_value; - - // struct io_descriptor *spi_io; - // spi_m_sync_get_io_descriptor(&self->spi_desc, &spi_io); - - // status = spi_io->read(spi_io, data, len); - } - return false; // Status is number of chars read or an error code < 0. + return common_hal_busio_spi_transfer(self, NULL, data, len); } -bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) { +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { if (len == 0) { return true; } spi_hal_context_t* hal = &self->hal_context; - hal->tx_bitlen = len * 8; - hal->rx_bitlen = len * 8; - hal->send_buffer = data_out; + hal->tx_bitlen = len * self->bits; + hal->rx_bitlen = len * self->bits; + hal->send_buffer = (uint8_t*) data_out; hal->rcv_buffer = data_in; spi_hal_setup_trans(hal); spi_hal_prepare_data(hal); spi_hal_user_start(hal); - if (len >= 16 && false) { + if (len >= SOC_SPI_MAXIMUM_BUFFER_SIZE && false) { // Set up the interrupt and wait on the lock. } else { while (!spi_hal_usr_is_done(hal)) { - RUN_BACKGROUND_TASKS(); + RUN_BACKGROUND_TASKS; } } - return false; + return true; } uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) { diff --git a/ports/esp32s2/common-hal/busio/SPI.h b/ports/esp32s2/common-hal/busio/SPI.h index 0c2f286078..38fbe42ffc 100644 --- a/ports/esp32s2/common-hal/busio/SPI.h +++ b/ports/esp32s2/common-hal/busio/SPI.h @@ -29,6 +29,9 @@ #include "common-hal/microcontroller/Pin.h" +#include "esp-idf/components/driver/include/driver/spi_common_internal.h" +#include "esp-idf/components/soc/include/hal/spi_hal.h" +#include "esp-idf/components/soc/include/hal/spi_types.h" #include "py/obj.h" typedef struct { @@ -40,8 +43,9 @@ typedef struct { spi_bus_lock_dev_handle_t lock; spi_hal_context_t hal_context; spi_hal_timing_conf_t timing_conf; + intr_handle_t interrupt; uint32_t target_frequency; - uint32_t real_frequency; + int32_t real_frequency; uint8_t polarity; uint8_t phase; uint8_t bits; diff --git a/ports/esp32s2/esp-idf b/ports/esp32s2/esp-idf index 648f959037..160ba4924d 160000 --- a/ports/esp32s2/esp-idf +++ b/ports/esp32s2/esp-idf @@ -1 +1 @@ -Subproject commit 648f959037896cff887a05b67105748790bfe63a +Subproject commit 160ba4924d8b588e718f76e3a0d0e92c11052fa3 diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index c51aef4daa..8fe1b799d6 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -321,7 +321,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, return (status == kStatus_Success); } -bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) { +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { if (len == 0) { return true; } @@ -332,7 +332,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin LPSPI_SetDummyData(self->spi, 0xFF); lpspi_transfer_t xfer = { 0 }; - xfer.txData = data_out; + xfer.txData = (uint8_t *)data_out; xfer.rxData = data_in; xfer.dataSize = len; diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c index 3f205e7782..f27f0e267b 100644 --- a/ports/nrf/common-hal/busio/SPI.c +++ b/ports/nrf/common-hal/busio/SPI.c @@ -271,13 +271,13 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, return true; } -bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) { +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { const bool is_spim3 = self->spim_peripheral->spim.p_reg == NRF_SPIM3; - uint8_t *next_chunk_out = data_out; + const uint8_t *next_chunk_out = data_out; uint8_t *next_chunk_in = data_in; while (len > 0) { - uint8_t *chunk_out = next_chunk_out; + const uint8_t *chunk_out = next_chunk_out; size_t chunk_size = MIN(len, self->spim_peripheral->max_xfer_size); if (is_spim3) { // If SPIM3, copy into unused RAM block, and do DMA from there. diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 65eeb8ebcf..c76705cd85 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -380,12 +380,12 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, } bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, - uint8_t *data_out, uint8_t *data_in, size_t len) { + const uint8_t *data_out, uint8_t *data_in, size_t len) { if (self->miso == NULL || self->mosi == NULL) { mp_raise_ValueError(translate("Missing MISO or MOSI Pin")); } HAL_StatusTypeDef result = HAL_SPI_TransmitReceive (&self->handle, - data_out, data_in, (uint16_t)len,HAL_MAX_DELAY); + (uint8_t *) data_out, data_in, (uint16_t)len,HAL_MAX_DELAY); return result == HAL_OK; } diff --git a/shared-bindings/busio/SPI.h b/shared-bindings/busio/SPI.h index b7b0715d13..f1a3b041ff 100644 --- a/shared-bindings/busio/SPI.h +++ b/shared-bindings/busio/SPI.h @@ -56,7 +56,7 @@ extern bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *dat extern bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_value); // Reads and write len bytes simultaneously. -extern bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len); +extern bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len); // Return actual SPI bus frequency. uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self); From 496e16d99b2277a09ab8a518ee94450653e63317 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 23 Jun 2020 17:02:16 -0700 Subject: [PATCH 011/277] Handle memory (hopefully). Short TX works --- ports/esp32s2/Makefile | 3 ++ ports/esp32s2/common-hal/busio/SPI.c | 79 +++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 29504065e9..ee1e8107a6 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -281,6 +281,9 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin flash: $(BUILD)/firmware.bin esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x0000 $^ +flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin + esptool.py --chip esp32s2 -p $(PORT) --no-stub -b 460800 --before=default_reset --after=hard_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + include $(TOP)/py/mkrules.mk # Print out the value of a make variable. diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index db28dee661..9790c516ff 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -32,14 +32,35 @@ #include "common-hal/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" +#include "esp_log.h" + +static const char* TAG = "CircuitPython SPI"; + static bool spi_never_reset[SOC_SPI_PERIPH_NUM]; +// Store one lock handle per device so that we can free it. +static spi_bus_lock_dev_handle_t lock_dev_handle[SOC_SPI_PERIPH_NUM]; +static intr_handle_t intr_handle[SOC_SPI_PERIPH_NUM]; + void spi_reset(void) { for (spi_host_device_t host_id = SPI2_HOST; host_id < SOC_SPI_PERIPH_NUM; host_id++) { if (spi_never_reset[host_id]) { continue; } - spi_bus_free(host_id); + bool in_use = false; + if (lock_dev_handle[host_id] != NULL) { + spi_bus_lock_unregister_dev(lock_dev_handle[host_id]); + lock_dev_handle[host_id] = NULL; + in_use = true; + } + if (intr_handle[host_id] != NULL) { + esp_intr_free(intr_handle[host_id]); + intr_handle[host_id] = NULL; + in_use = true; + } + if (in_use) { + spi_bus_free(host_id); + } } } @@ -75,12 +96,24 @@ static bool bus_uses_iomux_pins(spi_host_device_t host, const spi_bus_config_t* // End copied code. -static bool _spi_bus_free(spi_host_device_t host_id) { +static bool spi_bus_is_free(spi_host_device_t host_id) { return spi_bus_get_attr(host_id) == NULL; } static void spi_interrupt_handler(void *arg) { + // busio_spi_obj_t *self = arg; +} +// The interrupt may get invoked by the bus lock. +static void spi_bus_intr_enable(void *self) +{ + esp_intr_enable(((busio_spi_obj_t *)self)->interrupt); +} + +// The interrupt is always disabled by the ISR itself, not exposed +static void spi_bus_intr_disable(void *self) +{ + esp_intr_disable(((busio_spi_obj_t *)self)->interrupt); } void common_hal_busio_spi_construct(busio_spi_obj_t *self, @@ -103,12 +136,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, spi_host_device_t host_id = SPI1_HOST; self->connected_through_gpio = true; // Try and save SPI2 for pins that are on the IOMUX - if (bus_uses_iomux_pins(SPI2_HOST, &bus_config) && _spi_bus_free(SPI2_HOST)) { + if (bus_uses_iomux_pins(SPI2_HOST, &bus_config) && spi_bus_is_free(SPI2_HOST)) { host_id = SPI2_HOST; self->connected_through_gpio = false; - } else if (_spi_bus_free(SPI3_HOST)) { + } else if (spi_bus_is_free(SPI3_HOST)) { host_id = SPI3_HOST; - } else if (_spi_bus_free(SPI2_HOST)) { + } else if (spi_bus_is_free(SPI2_HOST)) { host_id = SPI2_HOST; } if (host_id == SPI1_HOST) { @@ -121,21 +154,33 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, } else if (result == ESP_ERR_INVALID_ARG) { mp_raise_ValueError(translate("Invalid pins")); } + + // After this point, we need to deinit to free IDF memory so fill out self's pins. + self->clock_pin = clock; + self->MOSI_pin = mosi; + self->MISO_pin = miso; + spi_bus_lock_dev_config_t config = { .flags = 0 }; + // The returned lock is stored in the bus lock but must be freed separately with + // spi_bus_lock_unregister_dev. result = spi_bus_lock_register_dev(spi_bus_get_attr(host_id)->lock, &config, &self->lock); if (result == ESP_ERR_NO_MEM) { + common_hal_busio_spi_deinit(self); mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } - + lock_dev_handle[host_id] = self->lock; result = esp_intr_alloc(spicommon_irqsource_for_host(host_id), bus_config.intr_flags | ESP_INTR_FLAG_INTRDISABLED, spi_interrupt_handler, self, &self->interrupt); if (result == ESP_ERR_NO_MEM) { + common_hal_busio_spi_deinit(self); mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } + intr_handle[host_id] = self->interrupt; + spi_bus_lock_set_bg_control(spi_bus_get_attr(host_id)->lock, spi_bus_intr_enable, spi_bus_intr_disable, self); spi_hal_context_t* hal = &self->hal_context; hal->hw = NULL; // Set by spi_hal_init @@ -146,8 +191,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // We don't use native CS. hal->cs_setup = 0; hal->cs_hold = 0; - hal->cs_pin_id = -1; - hal->timing_conf = &self->timing_conf; + hal->cs_pin_id = 0; hal->sio = 1; hal->half_duplex = 0; @@ -167,6 +211,13 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, hal->io_mode = SPI_LL_IO_MODE_NORMAL; spi_hal_init(hal, host_id); + // This must be set after spi_hal_init. + hal->timing_conf = &self->timing_conf; + if (hal->hw == NULL) { + ESP_LOGE(TAG, "SPI error %p", hal->hw); + } + + common_hal_busio_spi_configure(self, 250000, 0, 0, 8); } void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) { @@ -186,6 +237,14 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { return; } spi_never_reset[self->host_id] = false; + if (self->lock != NULL) { + spi_bus_lock_unregister_dev(self->lock); + lock_dev_handle[self->host_id] = NULL; + } + if (self->interrupt != NULL) { + esp_intr_free(self->interrupt); + intr_handle[self->host_id] = NULL; + } spi_bus_free(self->host_id); common_hal_reset_pin(self->clock_pin); @@ -218,7 +277,11 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, return false; } + ESP_LOGI(TAG, "configure"); + ESP_LOGI(TAG, "real frequency %d", self->real_frequency); + ESP_LOGI(TAG, "timing_conf %p", self->hal_context.timing_conf); spi_hal_setup_device(&self->hal_context); + ESP_LOGI(TAG, "setup done"); return true; } From ed6e81d688469138b555f3579b1083f521485382 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 24 Jun 2020 12:46:36 -0700 Subject: [PATCH 012/277] Switch SPI to polling DMA and enable displayio --- ports/esp32s2/background.c | 6 +- .../boards/espressif_saola_1_wrover/board.c | 8 +- ports/esp32s2/common-hal/busio/I2C.c | 5 +- ports/esp32s2/common-hal/busio/SPI.c | 80 +++++++++++-------- ports/esp32s2/common-hal/busio/SPI.h | 4 + .../common-hal/displayio/ParallelBus.c | 66 +++++++++++++++ .../common-hal/displayio/ParallelBus.h | 36 +++++++++ .../esp32s2/common-hal/microcontroller/Pin.c | 2 +- .../esp32s2/common-hal/microcontroller/Pin.h | 1 - ports/esp32s2/modules/wroom.c | 12 +-- ports/esp32s2/modules/wrover.c | 14 ++-- ports/esp32s2/mpconfigport.mk | 2 +- shared-module/displayio/Display.h | 4 + shared-module/displayio/EPaperDisplay.h | 1 - 14 files changed, 182 insertions(+), 59 deletions(-) create mode 100644 ports/esp32s2/common-hal/displayio/ParallelBus.c create mode 100644 ports/esp32s2/common-hal/displayio/ParallelBus.h diff --git a/ports/esp32s2/background.c b/ports/esp32s2/background.c index e22cf4aacc..e979d78311 100644 --- a/ports/esp32s2/background.c +++ b/ports/esp32s2/background.c @@ -54,9 +54,9 @@ void run_background_tasks(void) { running_background_tasks = true; filesystem_background(); - // #if CIRCUITPY_DISPLAYIO - // displayio_background(); - // #endif + #if CIRCUITPY_DISPLAYIO + displayio_background(); + #endif running_background_tasks = false; assert_heap_ok(); diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c index b7b2c4ef5b..9f708874bf 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/board.c @@ -30,12 +30,12 @@ void board_init(void) { // USB - never_reset_pin(&pin_GPIO19); - never_reset_pin(&pin_GPIO20); + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); // Debug UART - never_reset_pin(&pin_GPIO43); - never_reset_pin(&pin_GPIO44); + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 51817c95e2..391d7323c5 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -31,6 +31,7 @@ #include "driver/i2c.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/translate.h" typedef enum { @@ -217,6 +218,6 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { never_reset_i2c(self->i2c_num); - never_reset_pin(self->scl_pin); - never_reset_pin(self->sda_pin); + common_hal_never_reset_pin(self->scl_pin); + common_hal_never_reset_pin(self->sda_pin); } diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 9790c516ff..686f44cbc2 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "boards/board.h" -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" #include "esp_log.h" @@ -101,7 +101,8 @@ static bool spi_bus_is_free(spi_host_device_t host_id) { } static void spi_interrupt_handler(void *arg) { - // busio_spi_obj_t *self = arg; + busio_spi_obj_t *self = arg; + ESP_LOGE(TAG, "SPI interrupt %p", self); } // The interrupt may get invoked by the bus lock. @@ -148,7 +149,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, mp_raise_ValueError(translate("All SPI peripherals are in use")); } - esp_err_t result = spi_bus_initialize(host_id, &bus_config, 0 /* dma channel */); + esp_err_t result = spi_bus_initialize(host_id, &bus_config, host_id /* dma channel */); if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } else if (result == ESP_ERR_INVALID_ARG) { @@ -183,34 +184,35 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, spi_bus_lock_set_bg_control(spi_bus_get_attr(host_id)->lock, spi_bus_intr_enable, spi_bus_intr_disable, self); spi_hal_context_t* hal = &self->hal_context; - hal->hw = NULL; // Set by spi_hal_init - hal->dmadesc_tx = NULL; - hal->dmadesc_rx = NULL; - hal->dmadesc_n = 0; + + // spi_hal_init clears the given hal context so set everything after. + spi_hal_init(hal, host_id); + hal->dmadesc_tx = &self->tx_dma; + hal->dmadesc_rx = &self->rx_dma; + hal->dmadesc_n = 1; // We don't use native CS. - hal->cs_setup = 0; - hal->cs_hold = 0; - hal->cs_pin_id = 0; + // hal->cs_setup = 0; + // hal->cs_hold = 0; + // hal->cs_pin_id = 0; hal->sio = 1; - hal->half_duplex = 0; - hal->tx_lsbfirst = 0; - hal->rx_lsbfirst = 0; - hal->dma_enabled = 0; + // hal->half_duplex = 0; + // hal->tx_lsbfirst = 0; + // hal->rx_lsbfirst = 0; + hal->dma_enabled = 1; hal->no_compensate = 1; // Ignore CS bits // We don't use cmd, addr or dummy bits. - hal->cmd = 0; - hal->cmd_bits = 0; - hal->addr_bits = 0; - hal->dummy_bits = 0; - hal->addr = 0; + // hal->cmd = 0; + // hal->cmd_bits = 0; + // hal->addr_bits = 0; + // hal->dummy_bits = 0; + // hal->addr = 0; hal->io_mode = SPI_LL_IO_MODE_NORMAL; - spi_hal_init(hal, host_id); // This must be set after spi_hal_init. hal->timing_conf = &self->timing_conf; if (hal->hw == NULL) { @@ -223,9 +225,9 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) { spi_never_reset[self->host_id] = true; - never_reset_pin(self->clock_pin); - never_reset_pin(self->MOSI_pin); - never_reset_pin(self->MISO_pin); + common_hal_never_reset_pin(self->clock_pin); + common_hal_never_reset_pin(self->MOSI_pin); + common_hal_never_reset_pin(self->MISO_pin); } bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) { @@ -322,17 +324,29 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou } spi_hal_context_t* hal = &self->hal_context; - hal->tx_bitlen = len * self->bits; - hal->rx_bitlen = len * self->bits; - hal->send_buffer = (uint8_t*) data_out; - hal->rcv_buffer = data_in; + hal->send_buffer = NULL; + hal->rcv_buffer = NULL; + // This rounds up. + size_t dma_count = (len + LLDESC_MAX_NUM_PER_DESC - 1) / LLDESC_MAX_NUM_PER_DESC; + for (size_t i = 0; i < dma_count; i++) { + size_t offset = LLDESC_MAX_NUM_PER_DESC * i; + size_t dma_len = len - offset; + if (dma_len > LLDESC_MAX_NUM_PER_DESC) { + dma_len = LLDESC_MAX_NUM_PER_DESC; + } + hal->tx_bitlen = dma_len * self->bits; + hal->rx_bitlen = dma_len * self->bits; + if (data_out != NULL) { + hal->send_buffer = (uint8_t*) data_out + offset; + } + if (data_in != NULL) { + hal->rcv_buffer = data_in + offset; + } - spi_hal_setup_trans(hal); - spi_hal_prepare_data(hal); - spi_hal_user_start(hal); - if (len >= SOC_SPI_MAXIMUM_BUFFER_SIZE && false) { - // Set up the interrupt and wait on the lock. - } else { + spi_hal_setup_trans(hal); + spi_hal_prepare_data(hal); + spi_hal_user_start(hal); + // TODO: Switch to waiting on a lock that is given by an interrupt. while (!spi_hal_usr_is_done(hal)) { RUN_BACKGROUND_TASKS; } diff --git a/ports/esp32s2/common-hal/busio/SPI.h b/ports/esp32s2/common-hal/busio/SPI.h index 38fbe42ffc..6d82038317 100644 --- a/ports/esp32s2/common-hal/busio/SPI.h +++ b/ports/esp32s2/common-hal/busio/SPI.h @@ -44,6 +44,10 @@ typedef struct { spi_hal_context_t hal_context; spi_hal_timing_conf_t timing_conf; intr_handle_t interrupt; + // IDF allocates these in DMA accessible memory so they may need to move when + // we use external RAM for CircuitPython. + lldesc_t tx_dma; + lldesc_t rx_dma; uint32_t target_frequency; int32_t real_frequency; uint8_t polarity; diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.c b/ports/esp32s2/common-hal/displayio/ParallelBus.c new file mode 100644 index 0000000000..314b72ff73 --- /dev/null +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.c @@ -0,0 +1,66 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/displayio/ParallelBus.h" + +#include + +#include "common-hal/microcontroller/Pin.h" +#include "py/runtime.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/microcontroller/__init__.h" + +void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self, + const mcu_pin_obj_t* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select, + const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) { + + mp_raise_NotImplementedError(translate("ParallelBus not yet supported")); +} + +void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) { + +} + +bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) { + return false; +} + +bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { + return false; +} + +bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { + + return false; +} + +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { + +} + +void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) { + +} diff --git a/ports/esp32s2/common-hal/displayio/ParallelBus.h b/ports/esp32s2/common-hal/displayio/ParallelBus.h new file mode 100644 index 0000000000..cd636921d9 --- /dev/null +++ b/ports/esp32s2/common-hal/displayio/ParallelBus.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H + +#include "common-hal/digitalio/DigitalInOut.h" + +typedef struct { + mp_obj_base_t base; +} displayio_parallelbus_obj_t; + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 075f80abc6..5a059f0bbc 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -42,7 +42,7 @@ void never_reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] |= 1 << pin_number % 32; } -void never_reset_pin(const mcu_pin_obj_t* pin) { +void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { never_reset_pin_number(pin->number); } diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index ab06b388f8..19985bda6f 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -42,6 +42,5 @@ void common_hal_reset_pin(const mcu_pin_obj_t* pin); void claim_pin(const mcu_pin_obj_t* pin); bool pin_number_is_free(gpio_num_t pin_number); void never_reset_pin_number(gpio_num_t pin_number); -void never_reset_pin(const mcu_pin_obj_t* pin); #endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/esp32s2/modules/wroom.c b/ports/esp32s2/modules/wroom.c index 16c5861187..5e530701bf 100644 --- a/ports/esp32s2/modules/wroom.c +++ b/ports/esp32s2/modules/wroom.c @@ -28,10 +28,10 @@ void never_reset_module_internal_pins(void) { // SPI Flash - never_reset_pin(&pin_GPIO27); - never_reset_pin(&pin_GPIO28); - never_reset_pin(&pin_GPIO29); - never_reset_pin(&pin_GPIO30); - never_reset_pin(&pin_GPIO31); - never_reset_pin(&pin_GPIO32); + common_hal_never_reset_pin(&pin_GPIO27); + common_hal_never_reset_pin(&pin_GPIO28); + common_hal_never_reset_pin(&pin_GPIO29); + common_hal_never_reset_pin(&pin_GPIO30); + common_hal_never_reset_pin(&pin_GPIO31); + common_hal_never_reset_pin(&pin_GPIO32); } diff --git a/ports/esp32s2/modules/wrover.c b/ports/esp32s2/modules/wrover.c index d589a8fd4d..23fa7ee5ca 100644 --- a/ports/esp32s2/modules/wrover.c +++ b/ports/esp32s2/modules/wrover.c @@ -28,11 +28,11 @@ void never_reset_module_internal_pins(void) { // SPI Flash and RAM - never_reset_pin(&pin_GPIO26); - never_reset_pin(&pin_GPIO27); - never_reset_pin(&pin_GPIO28); - never_reset_pin(&pin_GPIO29); - never_reset_pin(&pin_GPIO30); - never_reset_pin(&pin_GPIO31); - never_reset_pin(&pin_GPIO32); + common_hal_never_reset_pin(&pin_GPIO26); + common_hal_never_reset_pin(&pin_GPIO27); + common_hal_never_reset_pin(&pin_GPIO28); + common_hal_never_reset_pin(&pin_GPIO29); + common_hal_never_reset_pin(&pin_GPIO30); + common_hal_never_reset_pin(&pin_GPIO31); + common_hal_never_reset_pin(&pin_GPIO32); } diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 9f59c1b467..8e2745a8c6 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -20,7 +20,7 @@ CIRCUITPY_BITBANGIO = 1 CIRCUITPY_BOARD = 1 CIRCUITPY_DIGITALIO = 1 CIRCUITPY_BUSIO = 1 -CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_MICROCONTROLLER = 1 diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index 8adaf597f9..861a38fd7c 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -29,7 +29,9 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/displayio/Group.h" +#if CIRCUITPY_PULSEIO #include "shared-bindings/pulseio/PWMOut.h" +#endif #include "shared-module/displayio/area.h" #include "shared-module/displayio/display_core.h" @@ -39,7 +41,9 @@ typedef struct { displayio_display_core_t core; union { digitalio_digitalinout_obj_t backlight_inout; + #if CIRCUITPY_PULSEIO pulseio_pwmout_obj_t backlight_pwm; + #endif }; uint64_t last_backlight_refresh; uint64_t last_refresh_call; diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index d08bed5462..3b9f6e3680 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -29,7 +29,6 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/displayio/Group.h" -#include "shared-bindings/pulseio/PWMOut.h" #include "shared-module/displayio/area.h" #include "shared-module/displayio/display_core.h" From 03e5043af4de14bd8115a4eeb608a2726ab59c6e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 24 Jun 2020 13:10:31 -0700 Subject: [PATCH 013/277] Turn off Idle WDT and speed up CPU --- ports/esp32s2/background.c | 6 ++---- ports/esp32s2/sdkconfig.defaults | 28 ++++++++++++++++------------ ports/esp32s2/supervisor/port.c | 3 +++ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ports/esp32s2/background.c b/ports/esp32s2/background.c index e979d78311..a90fa7d0aa 100644 --- a/ports/esp32s2/background.c +++ b/ports/esp32s2/background.c @@ -47,10 +47,8 @@ void run_background_tasks(void) { return; } - // Delay for 1 tick so that we don't starve the idle task. - // TODO: 1 tick is 10ms which is a long time! Can we delegate to idle for a minimal amount of - // time? - vTaskDelay(1); + // Zero delay in case FreeRTOS wants to switch to something else. + vTaskDelay(0); running_background_tasks = true; filesystem_background(); diff --git a/ports/esp32s2/sdkconfig.defaults b/ports/esp32s2/sdkconfig.defaults index 958e1852ea..729ebac889 100644 --- a/ports/esp32s2/sdkconfig.defaults +++ b/ports/esp32s2/sdkconfig.defaults @@ -190,9 +190,9 @@ CONFIG_EFUSE_MAX_BLK_LEN=256 # ESP32S2-specific # # CONFIG_ESP32S2_DEFAULT_CPU_FREQ_80 is not set -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_160=y -# CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240 is not set -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ=160 +# CONFIG_ESP32S2_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ=240 # # Memory protection @@ -271,10 +271,7 @@ CONFIG_ESP_CONSOLE_UART_RX_GPIO=3 CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 CONFIG_ESP_INT_WDT=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_TASK_WDT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +# CONFIG_ESP_TASK_WDT is not set CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y # end of Common ESP-related @@ -528,6 +525,7 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set # CONFIG_MBEDTLS_DEBUG is not set # @@ -547,8 +545,12 @@ CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_HARDWARE_GCM=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set CONFIG_MBEDTLS_HAVE_TIME=y # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set +CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y +CONFIG_MBEDTLS_SHA512_C=y CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y # CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set # CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set @@ -627,6 +629,10 @@ CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +# CONFIG_MBEDTLS_POLY1305_C is not set +# CONFIG_MBEDTLS_CHACHA20_C is not set +# CONFIG_MBEDTLS_HKDF_C is not set +# CONFIG_MBEDTLS_THREADING_C is not set # CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS @@ -705,6 +711,7 @@ CONFIG_WPA_MBEDTLS_CRYPTO=y # CONFIG_WPA_DEBUG_PRINT is not set # CONFIG_WPA_TESTING_OPTIONS is not set # CONFIG_WPA_TLS_V12 is not set +# CONFIG_WPA_WPS_WARS is not set # end of Supplicant # end of Component config @@ -756,7 +763,7 @@ CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y CONFIG_ADC2_DISABLE_DAC=y CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=3584 +CONFIG_MAIN_TASK_STACK_SIZE=8192 CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set @@ -767,10 +774,7 @@ CONFIG_CONSOLE_UART_RX_GPIO=3 CONFIG_CONSOLE_UART_BAUDRATE=115200 CONFIG_INT_WDT=y CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_TASK_WDT=y -# CONFIG_TASK_WDT_PANIC is not set -CONFIG_TASK_WDT_TIMEOUT_S=5 -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +# CONFIG_TASK_WDT is not set # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index fbfbc9f2eb..ebf0020399 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -69,6 +69,9 @@ safe_mode_t port_init(void) { void reset_port(void) { reset_all_pins(); + // A larger delay so the idle task can run and do any IDF cleanup needed. + vTaskDelay(4); + #if CIRCUITPY_BUSIO i2c_reset(); spi_reset(); From 436b15e558868ff836ba7205e7e799046bb53b64 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Thu, 25 Jun 2020 10:26:33 +0200 Subject: [PATCH 014/277] spresense: add elf32.h for mkspk --- ports/cxd56/mkspk/elf32.h | 175 ++++++++++++++++++++++++++++++++++++++ ports/cxd56/mkspk/mkspk.h | 12 ++- 2 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 ports/cxd56/mkspk/elf32.h diff --git a/ports/cxd56/mkspk/elf32.h b/ports/cxd56/mkspk/elf32.h new file mode 100644 index 0000000000..94a9c81ba3 --- /dev/null +++ b/ports/cxd56/mkspk/elf32.h @@ -0,0 +1,175 @@ +/**************************************************************************** + * include/elf32.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Reference: System V Application Binary Interface, Edition 4.1, March 18, + * 1997, The Santa Cruz Operation, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_ELF32_H +#define __INCLUDE_ELF32_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define EI_NIDENT 16 /* Size of e_ident[] */ + +#define ELF32_ST_BIND(i) ((i) >> 4) +#define ELF32_ST_TYPE(i) ((i) & 0xf) +#define ELF32_ST_INFO(b,t) (((b) << 4) | ((t) & 0xf)) + +/* Definitions for Elf32_Rel*::r_info */ + +#define ELF32_R_SYM(i) ((i) >> 8) +#define ELF32_R_TYPE(i) ((i) & 0xff) +#define ELF32_R_INFO(s,t) (((s)<< 8) | ((t) & 0xff)) + +#define ELF_R_SYM(i) ELF32_R_SYM(i) + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/* Figure 4.2: 32-Bit Data Types */ + +typedef uint32_t Elf32_Addr; /* Unsigned program address */ +typedef uint16_t Elf32_Half; /* Unsigned medium integer */ +typedef uint32_t Elf32_Off; /* Unsigned file offset */ +typedef int32_t Elf32_Sword; /* Signed large integer */ +typedef uint32_t Elf32_Word; /* Unsigned large integer */ + +/* Figure 4-3: ELF Header */ + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +/* Figure 4-8: Section Header */ + +typedef struct +{ + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +/* Figure 4-15: Symbol Table Entry */ + +typedef struct +{ + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + +/* Figure 4-19: Relocation Entries */ + +typedef struct +{ + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct +{ + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +/* Figure 5-1: Program Header */ + +typedef struct +{ + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +/* Figure 5-9: Dynamic Structure */ + +typedef struct +{ + Elf32_Sword d_tag; + union + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef Elf32_Addr Elf_Addr; +typedef Elf32_Ehdr Elf_Ehdr; +typedef Elf32_Rel Elf_Rel; +typedef Elf32_Rela Elf_Rela; +typedef Elf32_Sym Elf_Sym; +typedef Elf32_Shdr Elf_Shdr; +typedef Elf32_Word Elf_Word; + +#endif /* __INCLUDE_ELF32_H */ diff --git a/ports/cxd56/mkspk/mkspk.h b/ports/cxd56/mkspk/mkspk.h index 5a67bb3dd4..5c1b979c04 100644 --- a/ports/cxd56/mkspk/mkspk.h +++ b/ports/cxd56/mkspk/mkspk.h @@ -36,12 +36,22 @@ ****************************************************************************/ #include "clefia.h" -#include "elf.h" +#include "elf32.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#define EI_MAG0 0 /* File identification */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 + +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 + +#define PT_LOAD 1 + #define alignup(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) #define swap(a, b) { (a) ^= (b); (b) ^= (a); (a) ^= (b); } From 6c91af7d5601c0577e9f1909968bbb5aa2bf7b25 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 25 Jun 2020 17:27:01 -0400 Subject: [PATCH 015/277] WIP --- ports/stm/common-hal/pulseio/PulseOut.c | 3 - ports/stm/peripherals/timers.c | 272 ++++++++++++++++++++++++ ports/stm/peripherals/timers.h | 40 ++++ 3 files changed, 312 insertions(+), 3 deletions(-) create mode 100644 ports/stm/peripherals/timers.c create mode 100644 ports/stm/peripherals/timers.h diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c index c7c879c883..c31b238304 100644 --- a/ports/stm/common-hal/pulseio/PulseOut.c +++ b/ports/stm/common-hal/pulseio/PulseOut.c @@ -81,9 +81,6 @@ STATIC void pulseout_event_handler(void) { return; //invalid interrupt } - HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 1); - HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 0); - pulse_array_index++; // No more pulses. Turn off output and don't restart. diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c new file mode 100644 index 0000000000..81242f34b6 --- /dev/null +++ b/ports/stm/peripherals/timers.c @@ -0,0 +1,272 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)]; +static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)]; +static void *stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)](void); + +STATIC void tim_clock_enable(uint16_t mask); +STATIC void tim_clock_disable(uint16_t mask); + +// Get the frequency (in Hz) of the source clock for the given timer. +// On STM32F405/407/415/417 there are 2 cases for how the clock freq is set. +// If the APB prescaler is 1, then the timer clock is equal to its respective +// APB clock. Otherwise (APB prescaler > 1) the timer clock is twice its +// respective APB clock. See DM00031020 Rev 4, page 115. +STATIC uint32_t timer_get_source_freq(uint32_t tim_id) { + uint32_t source, clk_div; + if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) { + // TIM{1,8,9,10,11} are on APB2 + source = HAL_RCC_GetPCLK2Freq(); + clk_div = RCC->CFGR & RCC_CFGR_PPRE2; + } else { + // TIM{2,3,4,5,6,7,12,13,14} are on APB1 + source = HAL_RCC_GetPCLK1Freq(); + clk_div = RCC->CFGR & RCC_CFGR_PPRE1; + } + if (clk_div != 0) { + // APB prescaler for this timer is > 1 + source *= 2; + } + return source; +} + +TIM_TypeDef * stm_peripherals_find_timer(void) { + // TODO: check for unreserved timers from already claimed pins + + // Work backwards - higher index timers have fewer pin allocations + for (size_t i = MP_ARRAY_SIZE(stm_timer_reserved); i>=0; i--) { + if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) { + return mcu_tim_banks[i]; + } + } + mp_raise_RuntimeError(translate("All timers in use")); + return NULL; +} + +void stm_peripherals_timer_set_callback(void(*callback)(void), TIM_TypeDef * timer) { + stm_timer_callback[stm_peripherals_timer_get_index] +} + +void stm_peripherals_timer_free(TIM_TypeDef * instance) { + +} +void stm_peripherals_timer_never_reset(TIM_TypeDef * instance); +void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance); +void stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance); +void stm_peripherals_timer_is_reserved(TIM_TypeDef * instance); +size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance); + +STATIC void tim_clock_enable(uint16_t mask) { + #ifdef TIM1 + if (mask & (1 << 0)) { + __HAL_RCC_TIM1_CLK_ENABLE(); + } + #endif + #ifdef TIM2 + if (mask & (1 << 1)) { + __HAL_RCC_TIM2_CLK_ENABLE(); + } + #endif + #ifdef TIM3 + if (mask & (1 << 2)) { + __HAL_RCC_TIM3_CLK_ENABLE(); + } + #endif + #ifdef TIM4 + if (mask & (1 << 3)) { + __HAL_RCC_TIM4_CLK_ENABLE(); + } + #endif + #ifdef TIM5 + if (mask & (1 << 4)) { + __HAL_RCC_TIM5_CLK_ENABLE(); + } + #endif + //6 and 7 are reserved ADC timers + #ifdef TIM8 + if (mask & (1 << 7)) { + __HAL_RCC_TIM8_CLK_ENABLE(); + } + #endif + #ifdef TIM9 + if (mask & (1 << 8)) { + __HAL_RCC_TIM9_CLK_ENABLE(); + } + #endif + #ifdef TIM10 + if (mask & (1 << 9)) { + __HAL_RCC_TIM10_CLK_ENABLE(); + } + #endif + #ifdef TIM11 + if (mask & (1 << 10)) { + __HAL_RCC_TIM11_CLK_ENABLE(); + } + #endif + #ifdef TIM12 + if (mask & (1 << 11)) { + __HAL_RCC_TIM12_CLK_ENABLE(); + } + #endif + #ifdef TIM13 + if (mask & (1 << 12)) { + __HAL_RCC_TIM13_CLK_ENABLE(); + } + #endif + #ifdef TIM14 + if (mask & (1 << 13)) { + __HAL_RCC_TIM14_CLK_ENABLE(); + } + #endif +} + +STATIC void tim_clock_disable(uint16_t mask) { + #ifdef TIM1 + if (mask & (1 << 0)) { + __HAL_RCC_TIM1_CLK_DISABLE(); + } + #endif + #ifdef TIM2 + if (mask & (1 << 1)) { + __HAL_RCC_TIM2_CLK_DISABLE(); + } + #endif + #ifdef TIM3 + if (mask & (1 << 2)) { + __HAL_RCC_TIM3_CLK_DISABLE(); + } + #endif + #ifdef TIM4 + if (mask & (1 << 3)) { + __HAL_RCC_TIM4_CLK_DISABLE(); + } + #endif + #ifdef TIM5 + if (mask & (1 << 4)) { + __HAL_RCC_TIM5_CLK_DISABLE(); + } + #endif + //6 and 7 are reserved ADC timers + #ifdef TIM8 + if (mask & (1 << 7)) { + __HAL_RCC_TIM8_CLK_DISABLE(); + } + #endif + #ifdef TIM9 + if (mask & (1 << 8)) { + __HAL_RCC_TIM9_CLK_DISABLE(); + } + #endif + #ifdef TIM10 + if (mask & (1 << 9)) { + __HAL_RCC_TIM10_CLK_DISABLE(); + } + #endif + #ifdef TIM11 + if (mask & (1 << 10)) { + __HAL_RCC_TIM11_CLK_DISABLE(); + } + #endif + #ifdef TIM12 + if (mask & (1 << 11)) { + __HAL_RCC_TIM12_CLK_DISABLE(); + } + #endif + #ifdef TIM13 + if (mask & (1 << 12)) { + __HAL_RCC_TIM13_CLK_DISABLE(); + } + #endif + #ifdef TIM14 + if (mask & (1 << 13)) { + __HAL_RCC_TIM14_CLK_DISABLE(); + } + #endif +} + +STATIC void callback_router(size_t index) { + if (stm_timer_callback[index]) { + (*stm_timer_callback[index])(); + } +} + +void TIM1_CC_IRQHandler(void) { // Advanced timer + callback_router(1); +} +void TIM2_IRQHandler(void) { + callback_router(2); +} +void TIM3_IRQHandler(void) { + callback_router(3); +} +void TIM4_IRQHandler(void) { + callback_router(4); +} +void TIM5_IRQHandler(void) { + callback_router(5); +} +void TIM6_DAC_IRQHandler(void) { // Basic timer (DAC) + callback_router(6); +} +void TIM7_IRQHandler(void) { // Basic timer + callback_router(7); +} +void TIM8_CC_IRQHandler(void) { // Advanced timer + callback_router(8); +} + +// Advanced timer interrupts are currently unused. +void TIM1_BRK_TIM9_IRQHandler(void) { + callback_router(9); +} +void TIM1_UP_TIM10_IRQHandler(void) { + callback_router(10); +} +void TIM1_TRG_COM_TIM11_IRQHandler(void) { + callback_router(11); +} +void TIM8_BRK_TIM12_IRQHandler(void) { + callback_router(12); +} +void TIM8_UP_TIM13_IRQHandler(void) { + callback_router(13); +} +void TIM8_TRG_COM_TIM14_IRQHandler(void) { + callback_router(14); +} + +#if (CPY_STM32H7) +void TIM15_IRQHandler(void) { + callback_router(15); +} +void TIM16_IRQHandler(void) { + callback_router(16); +} +void TIM17_IRQHandler(void) { + callback_router(17); +} +#endif diff --git a/ports/stm/peripherals/timers.h b/ports/stm/peripherals/timers.h new file mode 100644 index 0000000000..b0f594b775 --- /dev/null +++ b/ports/stm/peripherals/timers.h @@ -0,0 +1,40 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +typedef struct { + TIM_TypeDef * p_reg; + uint8_t instance_id; + uint8_t cc_channel_count; +} nrfx_timer_t; + +void timers_reset(void); +TIM_TypeDef * stm_peripherals_find_timer(void); +void stm_peripherals_timer_free(TIM_TypeDef * instance); +void stm_peripherals_timer_never_reset(TIM_TypeDef * instance); +void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance); +void stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance); +void stm_peripherals_timer_is_reserved(TIM_TypeDef * instance); +size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance); From 57fde2e07bb2ee4dcff342deed08e4e7799da799 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 6 May 2020 11:04:53 -0500 Subject: [PATCH 016/277] sdcardio: implement new library for SD card I/O Testing performed: That a card is successfully mounted on Pygamer with the built in SD card slot This module is enabled for most FULL_BUILD boards, but is disabled for samd21 ("M0"), litex, and pca10100 for various reasons. --- locale/circuitpython.pot | 37 +- ports/atmel-samd/mpconfigport.mk | 2 + ports/litex/mpconfigport.mk | 3 +- ports/nrf/boards/pca10100/mpconfigboard.mk | 1 + py/circuitpy_defns.mk | 5 + py/circuitpy_mpconfig.h | 8 + py/circuitpy_mpconfig.mk | 3 + shared-bindings/busio/SPI.c | 7 + shared-bindings/busio/SPI.h | 2 + shared-bindings/sdcardio/SDCard.c | 184 ++++++++ shared-bindings/sdcardio/SDCard.h | 30 ++ shared-bindings/sdcardio/__init__.c | 47 +++ shared-bindings/sdcardio/__init__.h | 0 shared-module/sdcardio/SDCard.c | 466 +++++++++++++++++++++ shared-module/sdcardio/SDCard.h | 51 +++ shared-module/sdcardio/__init__.c | 0 shared-module/sdcardio/__init__.h | 0 17 files changed, 843 insertions(+), 3 deletions(-) create mode 100644 shared-bindings/sdcardio/SDCard.c create mode 100644 shared-bindings/sdcardio/SDCard.h create mode 100644 shared-bindings/sdcardio/__init__.c create mode 100644 shared-bindings/sdcardio/__init__.h create mode 100644 shared-module/sdcardio/SDCard.c create mode 100644 shared-module/sdcardio/SDCard.h create mode 100644 shared-module/sdcardio/__init__.c create mode 100644 shared-module/sdcardio/__init__.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1582b746ca..55147dc03e 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -417,6 +417,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -698,7 +702,8 @@ msgstr "" msgid "Error in regex" msgstr "" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -1358,6 +1363,10 @@ msgstr "" msgid "Running in safe mode! Not running saved code.\n" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -1979,6 +1988,10 @@ msgstr "" msgid "can't send non-None value to a just-started generator" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "" @@ -2105,6 +2118,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2662,6 +2679,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "" @@ -2683,6 +2704,10 @@ msgstr "" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "" @@ -3073,6 +3098,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index 92d47b186a..face79fad7 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -37,6 +37,8 @@ ifndef CIRCUITPY_TOUCHIO_USE_NATIVE CIRCUITPY_TOUCHIO_USE_NATIVE = 1 endif +CIRCUITPY_SDCARDIO ?= 0 + # SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic. USB_MSC_EP_NUM_OUT = 1 diff --git a/ports/litex/mpconfigport.mk b/ports/litex/mpconfigport.mk index 311c87b5d5..427e9ea841 100644 --- a/ports/litex/mpconfigport.mk +++ b/ports/litex/mpconfigport.mk @@ -18,6 +18,7 @@ CIRCUITPY_AUDIOIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_BOARD = 0 CIRCUITPY_BUSIO = 0 +CIRCUITPY_COUNTIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 @@ -25,7 +26,7 @@ CIRCUITPY_NVM = 0 CIRCUITPY_PULSEIO = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 -CIRCUITPY_COUNTIO = 0 +CIRCUITPY_SDCARDIO = 0 # Enable USB support CIRCUITPY_USB_HID = 1 CIRCUITPY_USB_MIDI = 1 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 385870a654..318bc02065 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -21,6 +21,7 @@ CIRCUITPY_PIXELBUF = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 1 +CIRCUITPY_SDCARDIO = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_ULAB = 0 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 74d8f548dd..f40f506c23 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -213,6 +213,9 @@ endif ifeq ($(CIRCUITPY_SAMD),1) SRC_PATTERNS += samd/% endif +ifeq ($(CIRCUITPY_SDCARDIO),1) +SRC_PATTERNS += sdcardio/% +endif ifeq ($(CIRCUITPY_STAGE),1) SRC_PATTERNS += _stage/% endif @@ -384,6 +387,8 @@ SRC_SHARED_MODULE_ALL = \ fontio/__init__.c \ framebufferio/FramebufferDisplay.c \ framebufferio/__init__.c \ + sdcardio/SDCard.c \ + sdcardio/__init__.c \ gamepad/GamePad.c \ gamepad/__init__.c \ gamepadshift/GamePadShift.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index c92cb1b669..10f91167b7 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -537,6 +537,13 @@ extern const struct _mp_obj_module_t samd_module; #define SAMD_MODULE #endif +#if CIRCUITPY_SDCARDIO +extern const struct _mp_obj_module_t sdcardio_module; +#define SDCARDIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sdcardio), (mp_obj_t)&sdcardio_module }, +#else +#define SDCARDIO_MODULE +#endif + #if CIRCUITPY_STAGE extern const struct _mp_obj_module_t stage_module; #define STAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module }, @@ -709,6 +716,7 @@ extern const struct _mp_obj_module_t watchdog_module; ROTARYIO_MODULE \ RTC_MODULE \ SAMD_MODULE \ + SDCARDIO_MODULE \ STAGE_MODULE \ STORAGE_MODULE \ STRUCT_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 3459bff6d7..0850c195a0 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -166,6 +166,9 @@ CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC) CIRCUITPY_SAMD ?= 0 CFLAGS += -DCIRCUITPY_SAMD=$(CIRCUITPY_SAMD) +CIRCUITPY_SDCARDIO ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_SDCARDIO=$(CIRCUITPY_SDCARDIO) + # Currently always off. CIRCUITPY_STAGE ?= 0 CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE) diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 22f001d2dc..793ab4f671 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -418,3 +418,10 @@ const mp_obj_type_t busio_spi_type = { .make_new = busio_spi_make_new, .locals_dict = (mp_obj_dict_t*)&busio_spi_locals_dict, }; + +busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj) { + if (!MP_OBJ_IS_TYPE(obj, &busio_spi_type)) { + mp_raise_TypeError_varg(translate("Expected a %q"), busio_spi_type.name); + } + return MP_OBJ_TO_PTR(obj); +} diff --git a/shared-bindings/busio/SPI.h b/shared-bindings/busio/SPI.h index b7b0715d13..aa7d715b9f 100644 --- a/shared-bindings/busio/SPI.h +++ b/shared-bindings/busio/SPI.h @@ -70,4 +70,6 @@ uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self); // This is used by the supervisor to claim SPI devices indefinitely. extern void common_hal_busio_spi_never_reset(busio_spi_obj_t *self); +extern busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj_in); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_SPI_H diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c new file mode 100644 index 0000000000..54ca39f806 --- /dev/null +++ b/shared-bindings/sdcardio/SDCard.c @@ -0,0 +1,184 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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/objproperty.h" +#include "py/runtime.h" +#include "py/objarray.h" + +#include "shared-bindings/sdcardio/SDCard.h" +#include "shared-module/sdcardio/SDCard.h" +#include "common-hal/busio/SPI.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/flash.h" + +//| class SDCard: +//| """SD Card Block Interface +//| +//| Controls an SD card over SPI. This built-in module has higher read +//| performance than the library adafruit_sdcard, but it is only compatible with +//| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used +//| with ``storage.VfsFat`` to allow file I/O to an SD card.""" +//| +//| def __init__(bus:busio.SPI, cs=digitalio.DigitalInOut, baudrate=8000000): +//| """Construct an SPI SD Card object with the given properties +//| +//| :param busio.SPI spi: The SPI bus +//| :param microcontroller.Pin cs: The chip select connected to the card +//| :param int baudrate: The SPI data rate to use after card setup +//| :param busio.SDIO sdio: The SDIO bus. Mutually exclusive with spi and cs. +//| +//| Note that during detection and configuration, a hard-coded low baudrate is used. +//| Data transfers use the specified baurate (rounded down to one that is supported by +//| the microcontroller) +//| +//| Example usage: +//| +//| .. code-block:: python +//| +//| import os +//| +//| import board +//| import sdcardio +//| import storage +//| +//| sd = sdcardio.SDCard(board.SPI(), board.SD_CS) +//| vfs = storage.VfsFat(sd) +//| storage.mount(vfs, '/sd') +//| os.listdir('/sd')""" + +STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_spi, ARG_cs, ARG_baudrate, ARG_sdio, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_spi, MP_ARG_OBJ, {.u_obj = mp_const_none } }, + { MP_QSTR_cs, MP_ARG_OBJ, {.u_obj = mp_const_none } }, + { MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 8000000} }, + { MP_QSTR_sdio, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_int = 8000000} }, + }; + MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS ); + 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); + + busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi].u_obj); + mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj); + + sdcardio_sdcard_obj_t *self = m_new_obj(sdcardio_sdcard_obj_t); + self->base.type = &sdcardio_SDCard_type; + + common_hal_sdcardio_sdcard_construct(self, spi, cs, args[ARG_baudrate].u_int); + + return self; +} + + +//| def count() -> int: +//| """Returns the total number of sectors +//| +//| Due to technical limitations, this is a function and not a property. +//| +//| :return: The number of 512-byte blocks, as a number""" +//| +mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { + sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in; + return mp_obj_new_int_from_ull(common_hal_sdcardio_sdcard_get_blockcount(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count); + +//| def deinit() -> None: +//| """Disable permanently. +//| +//| :return: None""" +//| +mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { + sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in; + common_hal_sdcardio_sdcard_deinit(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); + + +//| def readblocks(start_block: int, buf: bytearray) -> None: +//| +//| """Read one or more blocks from the card +//| +//| :param int start_block: The block to start reading from +//| :param bytearray buf: The buffer to write into. Length must be multiple of 512. +//| +//| :return: None""" +//| + +mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { + uint32_t start_block = mp_obj_get_int(start_block_in); + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); + sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in; + int result = common_hal_sdcardio_sdcard_readblocks(self, start_block, &bufinfo); + if (result < 0) { + mp_raise_OSError(-result); + } + return mp_const_none; +} + +MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readblocks); + +//| def writeblocks(start_block: int, buf: bytearray) -> None: +//| +//| """Write one or more blocks to the card +//| +//| :param int start_block: The block to start writing from +//| :param bytearray buf: The buffer to read from. Length must be multiple of 512. +//| +//| :return: None""" +//| + +mp_obj_t sdcardio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { + uint32_t start_block = mp_obj_get_int(start_block_in); + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); + sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in; + int result = common_hal_sdcardio_sdcard_writeblocks(self, start_block, &bufinfo); + if (result < 0) { + mp_raise_OSError(-result); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_writeblocks_obj, sdcardio_sdcard_writeblocks); + +STATIC const mp_rom_map_elem_t sdcardio_sdcard_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&sdcardio_sdcard_count_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&sdcardio_sdcard_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&sdcardio_sdcard_readblocks_obj) }, + { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&sdcardio_sdcard_writeblocks_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(sdcardio_sdcard_locals_dict, sdcardio_sdcard_locals_dict_table); + +const mp_obj_type_t sdcardio_SDCard_type = { + { &mp_type_type }, + .name = MP_QSTR_SDCard, + .make_new = sdcardio_sdcard_make_new, + .locals_dict = (mp_obj_dict_t*)&sdcardio_sdcard_locals_dict, +}; diff --git a/shared-bindings/sdcardio/SDCard.h b/shared-bindings/sdcardio/SDCard.h new file mode 100644 index 0000000000..5986d5b814 --- /dev/null +++ b/shared-bindings/sdcardio/SDCard.h @@ -0,0 +1,30 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017, 2018 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 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. + */ + +#pragma once + +extern const mp_obj_type_t sdcardio_SDCard_type; diff --git a/shared-bindings/sdcardio/__init__.c b/shared-bindings/sdcardio/__init__.c new file mode 100644 index 0000000000..746aa5588e --- /dev/null +++ b/shared-bindings/sdcardio/__init__.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 + +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/sdcardio/SDCard.h" + +//| """Interface to an SD card via the SPI bus""" + +STATIC const mp_rom_map_elem_t sdcardio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sdcardio) }, + { MP_ROM_QSTR(MP_QSTR_SDCard), MP_ROM_PTR(&sdcardio_SDCard_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(sdcardio_module_globals, sdcardio_module_globals_table); + +const mp_obj_module_t sdcardio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&sdcardio_module_globals, +}; diff --git a/shared-bindings/sdcardio/__init__.h b/shared-bindings/sdcardio/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/sdcardio/SDCard.c b/shared-module/sdcardio/SDCard.c new file mode 100644 index 0000000000..9e861279d3 --- /dev/null +++ b/shared-module/sdcardio/SDCard.c @@ -0,0 +1,466 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +// This implementation largely follows the structure of adafruit_sdcard.py + +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/time/__init__.h" +#include "shared-bindings/util.h" +#include "shared-module/sdcardio/SDCard.h" + +#include "py/mperrno.h" + +#if 0 +#define DEBUG_PRINT(...) ((void)mp_printf(&mp_plat_print, ## __VA_ARGS__)) +#else +#define DEBUG_PRINT(...) ((void)0) +#endif + +#define CMD_TIMEOUT (200) + +#define R1_IDLE_STATE (1<<0) +#define R1_ILLEGAL_COMMAND (1<<2) + +#define TOKEN_CMD25 (0xFC) +#define TOKEN_STOP_TRAN (0xFD) +#define TOKEN_DATA (0xFE) + +STATIC bool lock_and_configure_bus(sdcardio_sdcard_obj_t *self) { + if (!common_hal_busio_spi_try_lock(self->bus)) { + return false; + } + common_hal_busio_spi_configure(self->bus, self->baudrate, 0, 0, 8); + common_hal_digitalio_digitalinout_set_value(&self->cs, false); + return true; +} + +STATIC void lock_bus_or_throw(sdcardio_sdcard_obj_t *self) { + if (!lock_and_configure_bus(self)) { + mp_raise_OSError(EAGAIN); + } +} + +STATIC void clock_card(sdcardio_sdcard_obj_t *self, int bytes) { + uint8_t buf[] = {0xff}; + common_hal_digitalio_digitalinout_set_value(&self->cs, true); + for (int i=0; ibus, buf, 1); + } +} + +STATIC void extraclock_and_unlock_bus(sdcardio_sdcard_obj_t *self) { + clock_card(self, 1); + common_hal_busio_spi_unlock(self->bus); +} + +static uint8_t CRC7(const uint8_t* data, uint8_t n) { + uint8_t crc = 0; + for (uint8_t i = 0; i < n; i++) { + uint8_t d = data[i]; + for (uint8_t j = 0; j < 8; j++) { + crc <<= 1; + if ((d & 0x80) ^ (crc & 0x80)) { + crc ^= 0x09; + } + d <<= 1; + } + } + return (crc << 1) | 1; +} + +#define READY_TIMEOUT_NS (300 * 1000 * 1000) // 300ms +STATIC void wait_for_ready(sdcardio_sdcard_obj_t *self) { + uint64_t deadline = common_hal_time_monotonic_ns() + READY_TIMEOUT_NS; + while (common_hal_time_monotonic_ns() < deadline) { + uint8_t b; + common_hal_busio_spi_read(self->bus, &b, 1, 0xff); + if (b == 0xff) { + break; + } + } +} + +// In Python API, defaults are response=None, data_block=True, wait=True +STATIC int cmd(sdcardio_sdcard_obj_t *self, int cmd, int arg, void *response_buf, size_t response_len, bool data_block, bool wait) { + DEBUG_PRINT("cmd % 3d [%02x] arg=% 11d [%08x] len=%d%s%s\n", cmd, cmd, arg, arg, response_len, data_block ? " data" : "", wait ? " wait" : ""); + uint8_t cmdbuf[6]; + cmdbuf[0] = cmd | 0x40; + cmdbuf[1] = (arg >> 24) & 0xff; + cmdbuf[2] = (arg >> 16) & 0xff; + cmdbuf[3] = (arg >> 8) & 0xff; + cmdbuf[4] = arg & 0xff; + cmdbuf[5] = CRC7(cmdbuf, 5); + + if (wait) { + wait_for_ready(self); + } + + common_hal_busio_spi_write(self->bus, cmdbuf, sizeof(cmdbuf)); + + // Wait for the response (response[7] == 0) + bool response_received = false; + for (int i=0; ibus, cmdbuf, 1, 0xff); + if ((cmdbuf[0] & 0x80) == 0) { + response_received = true; + break; + } + } + + if (!response_received) { + return -EIO; + } + + if (response_buf) { + + if (data_block) { + cmdbuf[1] = 0xff; + do { + // Wait for the start block byte + common_hal_busio_spi_read(self->bus, cmdbuf+1, 1, 0xff); + } while (cmdbuf[1] != 0xfe); + } + + common_hal_busio_spi_read(self->bus, response_buf, response_len, 0xff); + + if (data_block) { + // Read and discard the CRC-CCITT checksum + common_hal_busio_spi_read(self->bus, cmdbuf+1, 2, 0xff); + } + + } + + return cmdbuf[0]; +} + +STATIC int block_cmd(sdcardio_sdcard_obj_t *self, int cmd_, int block, void *response_buf, size_t response_len, bool data_block, bool wait) { + return cmd(self, cmd_, block * self->cdv, response_buf, response_len, true, true); +} + +STATIC bool cmd_nodata(sdcardio_sdcard_obj_t* self, int cmd, int response) { + uint8_t cmdbuf[2] = {cmd, 0xff}; + + common_hal_busio_spi_write(self->bus, cmdbuf, sizeof(cmdbuf)); + + // Wait for the response (response[7] == response) + for (int i=0; ibus, cmdbuf, 1, 0xff); + if (cmdbuf[0] == response) { + return 0; + } + } + return -EIO; +} + +STATIC const compressed_string_t *init_card_v1(sdcardio_sdcard_obj_t *self) { + for (int i=0; icdv = 1; + } + return NULL; + } + } + return translate("timeout waiting for v2 card"); +} + +STATIC const compressed_string_t *init_card(sdcardio_sdcard_obj_t *self) { + clock_card(self, 10); + + common_hal_digitalio_digitalinout_set_value(&self->cs, false); + + // CMD0: init card: should return _R1_IDLE_STATE (allow 5 attempts) + { + bool reached_idle_state = false; + for (int i=0; i<5; i++) { + if (cmd(self, 0, 0, NULL, 0, true, true) == R1_IDLE_STATE) { + reached_idle_state = true; + break; + } + } + if (!reached_idle_state) { + return translate("no SD card"); + } + } + + // CMD8: determine card version + { + uint8_t rb7[4]; + int response = cmd(self, 8, 0x1AA, rb7, sizeof(rb7), false, true); + if (response == R1_IDLE_STATE) { + const compressed_string_t *result =init_card_v2(self); + if (result != NULL) { + return result; + } + } else if (response == (R1_IDLE_STATE | R1_ILLEGAL_COMMAND)) { + const compressed_string_t *result =init_card_v1(self); + if (result != NULL) { + return result; + } + } else { + return translate("couldn't determine SD card version"); + } + } + + // CMD9: get number of sectors + { + uint8_t csd[16]; + int response = cmd(self, 9, 0, csd, sizeof(csd), true, true); + if (response != 0) { + return translate("no response from SD card"); + } + int csd_version = (csd[0] & 0xC0) >> 6; + if (csd_version >= 2) { + return translate("SD card CSD format not supported"); + } + + if (csd_version == 1) { + self->sectors = ((csd[8] << 8 | csd[9]) + 1) * 1024; + } else { + uint32_t block_length = 1 << (csd[5] & 0xF); + uint32_t c_size = ((csd[6] & 0x3) << 10) | (csd[7] << 2) | ((csd[8] & 0xC) >> 6); + uint32_t mult = 1 << (((csd[9] & 0x3) << 1 | (csd[10] & 0x80) >> 7) + 2); + self->sectors = block_length / 512 * mult * (c_size + 1); + } + } + + // CMD16: set block length to 512 bytes + { + int response = cmd(self, 16, 512, NULL, 0, true, true); + if (response != 0) { + return translate("can't set 512 block size"); + } + } + + return NULL; +} + +void common_hal_sdcardio_sdcard_construct(sdcardio_sdcard_obj_t *self, busio_spi_obj_t *bus, mcu_pin_obj_t *cs, int baudrate) { + self->bus = bus; + common_hal_digitalio_digitalinout_construct(&self->cs, cs); + common_hal_digitalio_digitalinout_switch_to_output(&self->cs, true, DRIVE_MODE_PUSH_PULL); + + self->cdv = 512; + self->sectors = 0; + self->baudrate = 250000; + + lock_bus_or_throw(self); + const compressed_string_t *result = init_card(self); + extraclock_and_unlock_bus(self); + + if (result != NULL) { + common_hal_digitalio_digitalinout_deinit(&self->cs); + mp_raise_OSError_msg(result); + } + + self->baudrate = baudrate; +} + +void common_hal_sdcardio_sdcard_deinit(sdcardio_sdcard_obj_t *self) { + if (!self->bus) { + return; + } + self->bus = 0; + common_hal_digitalio_digitalinout_deinit(&self->cs); +} + +void common_hal_sdcardio_check_for_deinit(sdcardio_sdcard_obj_t *self) { + if (!self->bus) { + raise_deinited_error(); + } +} + +int common_hal_sdcardio_sdcard_get_blockcount(sdcardio_sdcard_obj_t *self) { + common_hal_sdcardio_check_for_deinit(self); + return self->sectors; +} + +int readinto(sdcardio_sdcard_obj_t *self, void *buf, size_t size) { + uint8_t aux[2] = {0, 0}; + while (aux[0] != 0xfe) { + common_hal_busio_spi_read(self->bus, aux, 1, 0xff); + } + + common_hal_busio_spi_read(self->bus, buf, size, 0xff); + + // Read checksum and throw it away + common_hal_busio_spi_read(self->bus, aux, sizeof(aux), 0xff); + return 0; +} + +int readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { + uint32_t nblocks = buf->len / 512; + if (nblocks == 1) { + // Use CMD17 to read a single block + return block_cmd(self, 17, start_block, buf->buf, buf->len, true, true); + } else { + // Use CMD18 to read multiple blocks + int r = block_cmd(self, 18, start_block, NULL, 0, true, true); + if (r < 0) { + return r; + } + + uint8_t *ptr = buf->buf; + while (nblocks--) { + r = readinto(self, ptr, 512); + if (r < 0) { + return r; + } + ptr += 512; + } + + // End the multi-block read + r = cmd(self, 12, 0, NULL, 0, true, false); + + // Return first status 0 or last before card ready (0xff) + while (r != 0) { + uint8_t single_byte; + common_hal_busio_spi_read(self->bus, &single_byte, 1, 0xff); + if (single_byte & 0x80) { + return r; + } + r = single_byte; + } + } + return 0; +} + +int common_hal_sdcardio_sdcard_readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { + common_hal_sdcardio_check_for_deinit(self); + if (buf->len % 512 != 0) { + mp_raise_ValueError(translate("Buffer length must be a multiple of 512")); + } + + lock_and_configure_bus(self); + int r = readblocks(self, start_block, buf); + extraclock_and_unlock_bus(self); + return r; +} + +int _write(sdcardio_sdcard_obj_t *self, uint8_t token, void *buf, size_t size) { + wait_for_ready(self); + + uint8_t cmd[2]; + cmd[0] = token; + + common_hal_busio_spi_write(self->bus, cmd, 1); + common_hal_busio_spi_write(self->bus, buf, size); + + cmd[0] = cmd[1] = 0xff; + common_hal_busio_spi_write(self->bus, cmd, 2); + + // Check the response + // This differs from the traditional adafruit_sdcard handling, + // but adafruit_sdcard also ignored the return value of SDCard._write(!) + // so nobody noticed + // + // + // Response is as follows: + // x x x 0 STAT 1 + // 7 6 5 4 3..1 0 + // with STATUS 010 indicating "data accepted", and other status bit + // combinations indicating failure. + // In practice, I was seeing cmd[0] as 0xe5, indicating success + for (int i=0; ibus, cmd, 1, 0xff); + DEBUG_PRINT("i=%02d cmd[0] = 0x%02x\n", i, cmd[0]); + if ((cmd[0] & 0b00010001) == 0b00000001) { + if ((cmd[0] & 0x1f) != 0x5) { + return -EIO; + } else { + break; + } + } + } + + // Wait for the write to finish + do { + common_hal_busio_spi_read(self->bus, cmd, 1, 0xff); + } while (cmd[0] == 0); + + // Success + return 0; +} + +int writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { + common_hal_sdcardio_check_for_deinit(self); + uint32_t nblocks = buf->len / 512; + if (nblocks == 1) { + // Use CMD24 to write a single block + int r = block_cmd(self, 24, start_block, NULL, 0, true, true); + if (r < 0) { + return r; + } + r = _write(self, TOKEN_DATA, buf->buf, buf->len); + if (r < 0) { + return r; + } + } else { + // Use CMD25 to write multiple block + int r = block_cmd(self, 25, start_block, NULL, 0, true, true); + if (r < 0) { + return r; + } + + uint8_t *ptr = buf->buf; + while (nblocks--) { + r = _write(self, TOKEN_CMD25, ptr, 512); + if (r < 0) { + return r; + } + ptr += 512; + } + + cmd_nodata(self, TOKEN_STOP_TRAN, 0); + } + return 0; +} + +int common_hal_sdcardio_sdcard_writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { + common_hal_sdcardio_check_for_deinit(self); + if (buf->len % 512 != 0) { + mp_raise_ValueError(translate("Buffer length must be a multiple of 512")); + } + lock_and_configure_bus(self); + int r = writeblocks(self, start_block, buf); + extraclock_and_unlock_bus(self); + return r; +} diff --git a/shared-module/sdcardio/SDCard.h b/shared-module/sdcardio/SDCard.h new file mode 100644 index 0000000000..76c906029f --- /dev/null +++ b/shared-module/sdcardio/SDCard.h @@ -0,0 +1,51 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#pragma once + +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/objarray.h" + +#include "common-hal/busio/SPI.h" +#include "common-hal/digitalio/DigitalInOut.h" + +typedef struct { + mp_obj_base_t base; + busio_spi_obj_t *bus; + digitalio_digitalinout_obj_t cs; + int cdv; + int baudrate; + uint32_t sectors; +} sdcardio_sdcard_obj_t; + +void common_hal_sdcardio_sdcard_construct(sdcardio_sdcard_obj_t *self, busio_spi_obj_t *spi, mcu_pin_obj_t *cs, int baudrate); +void common_hal_sdcardio_sdcard_deinit(sdcardio_sdcard_obj_t *self); +void common_hal_sdcardio_sdcard_check_for_deinit(sdcardio_sdcard_obj_t *self); +int common_hal_sdcardio_sdcard_get_blockcount(sdcardio_sdcard_obj_t *self); +int common_hal_sdcardio_sdcard_readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf); +int common_hal_sdcardio_sdcard_writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf); diff --git a/shared-module/sdcardio/__init__.c b/shared-module/sdcardio/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/sdcardio/__init__.h b/shared-module/sdcardio/__init__.h new file mode 100644 index 0000000000..e69de29bb2 From 159728b550c70f239e03c267a23f3950de635d3a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 27 May 2020 09:09:39 -0500 Subject: [PATCH 017/277] shared-bindings: Factor out validate_list_is_free_pins This will ultimately be used by SDIO, where a variable length list of data lines is called for. --- locale/circuitpython.pot | 2 +- shared-bindings/microcontroller/Pin.c | 12 ++++++++++++ shared-bindings/microcontroller/Pin.h | 1 + shared-bindings/rgbmatrix/RGBMatrix.c | 11 ++++------- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 55147dc03e..9a5a788b08 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -338,7 +338,7 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index 765e602e5f..d5b971ae5e 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -101,6 +101,18 @@ mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj) { return pin; } +// Validate every element in the list to be a free pin. +void validate_list_is_free_pins(qstr what, mcu_pin_obj_t **pins_out, mp_int_t max_pins, mp_obj_t seq, uint8_t *count_out) { + mp_int_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(seq)); + if (len > max_pins) { + mp_raise_ValueError_varg(translate("At most %d %q may be specified (not %d)"), max_pins, what, len); + } + *count_out = len; + for (mp_int_t i=0; i max_pins) { - mp_raise_ValueError_varg(translate("At most %d %q may be specified (not %d)"), max_pins, what, len); - } - *count_out = len; - for (mp_int_t i=0; i Date: Fri, 26 Jun 2020 10:10:39 -0500 Subject: [PATCH 018/277] sdioio: Add shared-bindings There is no implementation yet. --- locale/circuitpython.pot | 4 + py/circuitpy_defns.mk | 5 + py/circuitpy_mpconfig.h | 8 + py/circuitpy_mpconfig.mk | 3 + shared-bindings/sdioio/SDCard.c | 310 ++++++++++++++++++++++++++++++ shared-bindings/sdioio/SDCard.h | 66 +++++++ shared-bindings/sdioio/__init__.c | 47 +++++ shared-bindings/sdioio/__init__.h | 0 8 files changed, 443 insertions(+) create mode 100644 shared-bindings/sdioio/SDCard.c create mode 100644 shared-bindings/sdioio/SDCard.h create mode 100644 shared-bindings/sdioio/__init__.c create mode 100644 shared-bindings/sdioio/__init__.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 9a5a788b08..481d29f248 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -863,6 +863,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index f40f506c23..32d3640069 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -216,6 +216,9 @@ endif ifeq ($(CIRCUITPY_SDCARDIO),1) SRC_PATTERNS += sdcardio/% endif +ifeq ($(CIRCUITPY_SDIOIO),1) +SRC_PATTERNS += sdioio/% +endif ifeq ($(CIRCUITPY_STAGE),1) SRC_PATTERNS += _stage/% endif @@ -314,6 +317,8 @@ SRC_COMMON_HAL_ALL = \ rotaryio/__init__.c \ rtc/RTC.c \ rtc/__init__.c \ + sdioio/SDCard.c \ + sdioio/__init__.c \ supervisor/Runtime.c \ supervisor/__init__.c \ watchdog/WatchDogMode.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 10f91167b7..d05a246fce 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -544,6 +544,13 @@ extern const struct _mp_obj_module_t sdcardio_module; #define SDCARDIO_MODULE #endif +#if CIRCUITPY_SDIOIO +extern const struct _mp_obj_module_t sdioio_module; +#define SDIOIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sdioio), (mp_obj_t)&sdioio_module }, +#else +#define SDIOIO_MODULE +#endif + #if CIRCUITPY_STAGE extern const struct _mp_obj_module_t stage_module; #define STAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module }, @@ -717,6 +724,7 @@ extern const struct _mp_obj_module_t watchdog_module; RTC_MODULE \ SAMD_MODULE \ SDCARDIO_MODULE \ + SDIOIO_MODULE \ STAGE_MODULE \ STORAGE_MODULE \ STRUCT_MODULE \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 0850c195a0..302368f74a 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -169,6 +169,9 @@ CFLAGS += -DCIRCUITPY_SAMD=$(CIRCUITPY_SAMD) CIRCUITPY_SDCARDIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_SDCARDIO=$(CIRCUITPY_SDCARDIO) +CIRCUITPY_SDIOIO ?= 0 +CFLAGS += -DCIRCUITPY_SDIOIO=$(CIRCUITPY_SDIOIO) + # Currently always off. CIRCUITPY_STAGE ?= 0 CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE) diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c new file mode 100644 index 0000000000..c6b1d280ba --- /dev/null +++ b/shared-bindings/sdioio/SDCard.c @@ -0,0 +1,310 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// This file contains all of the Python API definitions for the +// sdioio.SDCard class. + +#include + +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/sdioio/SDCard.h" +#include "shared-bindings/util.h" + +#include "lib/utils/buffer_helper.h" +#include "lib/utils/context_manager_helpers.h" +#include "py/mperrno.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +//| class SDCard: +//| """SD Card Block Interface with SDIO +//| +//| Controls an SD card over SDIO. SDIO is a parallel protocol designed +//| for SD cards. It uses a clock pin, a command pin, and 1 or 4 +//| data pins. It can be operated at a high frequency such as +//| 25MHz. Usually an SDCard object is used with ``storage.VfsFat`` +//| to allow file I/O to an SD card.""" +//| +//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int): +//| """Construct an SDIO SD Card object with the given properties +//| +//| :param ~microcontroller.Pin clock: the pin to use for the clock. +//| :param ~microcontroller.Pin command: the pin to use for the command. +//| :param data: A sequence of pins to use for data. +//| :param frequency: The frequency of the bus in Hz +//| +//| Example usage: +//| +//| .. code-block:: python +//| +//| import os +//| +//| import board +//| import sdioio +//| import storage +//| +//| sd = sdioio.SDCard( +//| clock=board.SDIO_CLOCK, +//| command=board.SDIO_COMMAND, +//| data=board.SDIO_DATA, +//| frequency=25000000) +//| vfs = storage.VfsFat(sd) +//| storage.mount(vfs, '/sd') +//| os.listdir('/sd')""" +//| ... +//| + +STATIC mp_obj_t sdioio_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + sdioio_sdcard_obj_t *self = m_new_obj(sdioio_sdcard_obj_t); + self->base.type = &sdioio_SDCard_type; + enum { ARG_clock, ARG_command, ARG_data, ARG_frequency, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_clock, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ }, + { MP_QSTR_command, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ }, + { MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ }, + { MP_QSTR_frequency, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT }, + }; + MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS ); + 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); + + const mcu_pin_obj_t* clock = validate_obj_is_free_pin(args[ARG_clock].u_obj); + const mcu_pin_obj_t* command = validate_obj_is_free_pin(args[ARG_command].u_obj); + mcu_pin_obj_t *data_pins[4]; + uint8_t num_data; + validate_list_is_free_pins(MP_QSTR_data, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data].u_obj, &num_data); + + common_hal_sdioio_sdcard_construct(self, clock, command, num_data, data_pins, args[ARG_frequency].u_int); + return MP_OBJ_FROM_PTR(self); +} + +STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) { + if (common_hal_sdioio_sdcard_deinited(self)) { + raise_deinited_error(); + } +} + +//| def configure(*, frequency=0, width=0) -> None: +//| """Configures the SDIO bus. +//| +//| :param int frequency: the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the `frequency` attribute for the actual clock rate. +//| :param int width: the number of data lines to use. Must be 1 or 4 and must also not exceed the number of data lines at construction +//| +//| .. note:: Leaving a value unspecified or 0 means the current setting is kept""" +//| +STATIC mp_obj_t sdioio_sdcard_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_frequency, ARG_width, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_frequency, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_width, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + }; + sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS ); + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_int_t frequency = args[ARG_frequency].u_int; + if (frequency < 0) { + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_baudrate); + } + + uint8_t width = args[ARG_width].u_int; + if (width != 0 && width != 1 && width != 4) { + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_width); + } + + if (!common_hal_sdioio_sdcard_configure(self, frequency, width)) { + mp_raise_OSError(MP_EIO); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(sdioio_sdcard_configure_obj, 1, sdioio_sdcard_configure); + +//| def count() -> int: +//| """Returns the total number of sectors +//| +//| Due to technical limitations, this is a function and not a property. +//| +//| :return: The number of 512-byte blocks, as a number""" +//| +STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { + sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_sdioio_sdcard_get_count(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); + +//| def readblocks(start_block: int, buf: bytearray) -> None: +//| +//| """Read one or more blocks from the card +//| +//| :param int start_block: The block to start reading from +//| :param bytearray buf: The buffer to write into. Length must be multiple of 512. +//| +//| :return: None""" +mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { + uint32_t start_block = mp_obj_get_int(start_block_in); + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); + sdioio_sdcard_obj_t *self = (sdioio_sdcard_obj_t*)self_in; + int result = common_hal_sdioio_sdcard_readblocks(self, start_block, &bufinfo); + if (result < 0) { + mp_raise_OSError(-result); + } + return mp_const_none; +} + +MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); + +//| def writeblocks(start_block: int, buf: bytearray) -> None: +//| +//| """Write one or more blocks to the card +//| +//| :param int start_block: The block to start writing from +//| :param bytearray buf: The buffer to read from. Length must be multiple of 512. +//| +//| :return: None""" +//| +mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { + uint32_t start_block = mp_obj_get_int(start_block_in); + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); + sdioio_sdcard_obj_t *self = (sdioio_sdcard_obj_t*)self_in; + int result = common_hal_sdioio_sdcard_writeblocks(self, start_block, &bufinfo); + if (result < 0) { + mp_raise_OSError(-result); + } + return mp_const_none; +} + +MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_writeblocks_obj, sdioio_sdcard_writeblocks); + +//| @property +//| def frequency(self) -> int: +//| """The actual SDIO bus frequency. This may not match the frequency +//| requested due to internal limitations.""" +//| ... +//| +STATIC mp_obj_t sdioio_sdcard_obj_get_frequency(mp_obj_t self_in) { + sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_sdioio_sdcard_get_frequency(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_get_frequency_obj, sdioio_sdcard_obj_get_frequency); + +const mp_obj_property_t sdioio_sdcard_frequency_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&sdioio_sdcard_get_frequency_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| @property +//| def width(self) -> int: +//| """The actual SDIO bus width, in bits""" +//| ... +//| +STATIC mp_obj_t sdioio_sdcard_obj_get_width(mp_obj_t self_in) { + sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_sdioio_sdcard_get_width(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_get_width_obj, sdioio_sdcard_obj_get_width); + +const mp_obj_property_t sdioio_sdcard_width_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&sdioio_sdcard_get_width_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| def deinit() -> None: +//| """Disable permanently. +//| +//| :return: None""" +STATIC mp_obj_t sdioio_sdcard_obj_deinit(mp_obj_t self_in) { + sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_sdioio_sdcard_deinit(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_deinit_obj, sdioio_sdcard_obj_deinit); + +//| def __enter__(self, ) -> Any: +//| """No-op used by Context Managers. +//| Provided by context manager helper.""" +//| ... +//| + +//| def __exit__(self, ) -> Any: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t sdioio_sdcard_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + common_hal_sdioio_sdcard_deinit(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(sdioio_sdcard_obj___exit___obj, 4, 4, sdioio_sdcard_obj___exit__); + +STATIC const mp_rom_map_elem_t sdioio_sdcard_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&sdioio_sdcard_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&sdioio_sdcard_obj___exit___obj) }, + + { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&sdioio_sdcard_configure_obj) }, + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&sdioio_sdcard_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&sdioio_sdcard_width_obj) }, + + { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&sdioio_sdcard_count_obj) }, + { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&sdioio_sdcard_readblocks_obj) }, + { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&sdioio_sdcard_writeblocks_obj) }, + +// Methods in STM HAL: +// InitCard +// ReadBlocks +// WriteBlocks +// Erase +// GetCardState +// GetCardCID +// GetCardCSD +// GetCardInfo +// GetState +// GetError +// Abort + +}; +STATIC MP_DEFINE_CONST_DICT(sdioio_sdcard_locals_dict, sdioio_sdcard_locals_dict_table); + +const mp_obj_type_t sdioio_SDCard_type = { + { &mp_type_type }, + .name = MP_QSTR_SDCard, + .make_new = sdioio_sdcard_make_new, + .locals_dict = (mp_obj_dict_t*)&sdioio_sdcard_locals_dict, +}; diff --git a/shared-bindings/sdioio/SDCard.h b/shared-bindings/sdioio/SDCard.h new file mode 100644 index 0000000000..7f62ee7a65 --- /dev/null +++ b/shared-bindings/sdioio/SDCard.h @@ -0,0 +1,66 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_SDIO_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_SDIO_H + +#include "py/obj.h" + +#include "common-hal/microcontroller/Pin.h" +#include "common-hal/sdioio/SDCard.h" + +// Type object used in Python. Should be shared between ports. +extern const mp_obj_type_t sdioio_SDCard_type; + +// Construct an underlying SDIO object. +extern void common_hal_sdioio_sdcard_construct(sdioio_sdcard_obj_t *self, + const mcu_pin_obj_t * clock, const mcu_pin_obj_t * command, + uint8_t num_data, mcu_pin_obj_t ** data, uint32_t frequency); + +extern void common_hal_sdioio_sdcard_deinit(sdioio_sdcard_obj_t *self); +extern bool common_hal_sdioio_sdcard_deinited(sdioio_sdcard_obj_t *self); + +extern bool common_hal_sdioio_sdcard_configure(sdioio_sdcard_obj_t *self, uint32_t baudrate, uint8_t width); + +extern void common_hal_sdioio_sdcard_unlock(sdioio_sdcard_obj_t *self); + +// Return actual SDIO bus frequency. +uint32_t common_hal_sdioio_sdcard_get_frequency(sdioio_sdcard_obj_t* self); + +// Return SDIO bus width. +uint8_t common_hal_sdioio_sdcard_get_width(sdioio_sdcard_obj_t* self); + +// Return number of device blocks +uint32_t common_hal_sdioio_sdcard_get_count(sdioio_sdcard_obj_t* self); + +// Read or write blocks +int common_hal_sdioio_sdcard_readblocks(sdioio_sdcard_obj_t* self, uint32_t start_block, mp_buffer_info_t *bufinfo); +int common_hal_sdioio_sdcard_writeblocks(sdioio_sdcard_obj_t* self, uint32_t start_block, mp_buffer_info_t *bufinfo); + +// This is used by the supervisor to claim SDIO devices indefinitely. +extern void common_hal_sdioio_sdcard_never_reset(sdioio_sdcard_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_SDIO_H diff --git a/shared-bindings/sdioio/__init__.c b/shared-bindings/sdioio/__init__.c new file mode 100644 index 0000000000..b88e5c3a96 --- /dev/null +++ b/shared-bindings/sdioio/__init__.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 + +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/sdioio/SDCard.h" + +//| """Interface to an SD card via the SDIO bus""" + +STATIC const mp_rom_map_elem_t sdioio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sdio) }, + { MP_ROM_QSTR(MP_QSTR_SDCard), MP_ROM_PTR(&sdioio_SDCard_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(sdioio_module_globals, sdioio_module_globals_table); + +const mp_obj_module_t sdioio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&sdioio_module_globals, +}; diff --git a/shared-bindings/sdioio/__init__.h b/shared-bindings/sdioio/__init__.h new file mode 100644 index 0000000000..e69de29bb2 From d4b945851285c0b5d3a38094223d97184449e7e1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 9 Jun 2020 11:19:51 -0500 Subject: [PATCH 019/277] samd: sdio: Add needed files from atmel start --- ports/atmel-samd/sd_mmc/conf_sd_mmc.h | 79 + ports/atmel-samd/sd_mmc/sd_mmc.c | 1671 +++++++++++++++++++++ ports/atmel-samd/sd_mmc/sd_mmc.h | 310 ++++ ports/atmel-samd/sd_mmc/sd_mmc_protocol.h | 1001 ++++++++++++ 4 files changed, 3061 insertions(+) create mode 100644 ports/atmel-samd/sd_mmc/conf_sd_mmc.h create mode 100644 ports/atmel-samd/sd_mmc/sd_mmc.c create mode 100644 ports/atmel-samd/sd_mmc/sd_mmc.h create mode 100644 ports/atmel-samd/sd_mmc/sd_mmc_protocol.h diff --git a/ports/atmel-samd/sd_mmc/conf_sd_mmc.h b/ports/atmel-samd/sd_mmc/conf_sd_mmc.h new file mode 100644 index 0000000000..735dd3783c --- /dev/null +++ b/ports/atmel-samd/sd_mmc/conf_sd_mmc.h @@ -0,0 +1,79 @@ +/* Auto-generated config file conf_sd_mmc.h */ +#ifndef CONF_SD_MMC_H +#define CONF_SD_MMC_H + +// <<< Use Configuration Wizard in Context Menu >>> + +// Enable the SDIO support +// conf_sdio_support +#ifndef CONF_SDIO_SUPPORT +#define CONF_SDIO_SUPPORT 0 +#endif + +// Enable the MMC card support +// conf_mmc_support +#ifndef CONF_MMC_SUPPORT +#define CONF_MMC_SUPPORT 0 +#endif + +// Enable the OS support +// conf_sd_mmc_os_support +#ifndef CONF_OS_SUPPORT +#define CONF_OS_SUPPORT 0 +#endif + +// Detection (card/write protect) timeout (ms/ticks) +// conf_sd_mmc_debounce +#ifndef CONF_SD_MMC_DEBOUNCE +#define CONF_SD_MMC_DEBOUNCE 1000 +#endif + +#ifndef CONF_SD_MMC_MEM_CNT +#define CONF_SD_MMC_MEM_CNT 1 +#endif + +// SD/MMC Slot 0 +// conf_sd_mmc_0_enable +#ifndef CONF_SD_MMC_0_ENABLE +#define CONF_SD_MMC_0_ENABLE 1 +#endif + +// Card Detect (CD) 0 Enable +// conf_sd_mmc_0_cd_detect_en +#ifndef CONF_SD_MMC_0_CD_DETECT_EN +#define CONF_SD_MMC_0_CD_DETECT_EN 0 +#endif + +// Card Detect (CD) detection level +// <1=> High +// <0=> Low +// conf_sd_mmc_0_cd_detect_value +#ifndef CONF_SD_MMC_0_CD_DETECT_VALUE +#define CONF_SD_MMC_0_CD_DETECT_VALUE 0 +#endif +// + +// Write Protect (WP) 0 Enable +// conf_sd_mmc_0_wp_detect_en +#ifndef CONF_SD_MMC_0_WP_DETECT_EN +#define CONF_SD_MMC_0_WP_DETECT_EN 0 +#endif + +// Write Protect (WP) detection level +// <1=> High +// <0=> Low +// conf_sd_mmc_0_wp_detect_value +#ifndef CONF_SD_MMC_0_WP_DETECT_VALUE +#define CONF_SD_MMC_0_WP_DETECT_VALUE 1 +#endif +// + +// + +#ifndef CONF_MCI_OS_SUPPORT +#define CONF_MCI_OS_SUPPORT 0 +#endif + +// <<< end of configuration section >>> + +#endif // CONF_SD_MMC_H diff --git a/ports/atmel-samd/sd_mmc/sd_mmc.c b/ports/atmel-samd/sd_mmc/sd_mmc.c new file mode 100644 index 0000000000..5ea9d830e9 --- /dev/null +++ b/ports/atmel-samd/sd_mmc/sd_mmc.c @@ -0,0 +1,1671 @@ +/** + * \file + * + * \brief Common SD/MMC stack + * + * Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries. + * + * \asf_license_start + * + * \page License + * + * Subject to your compliance with these terms, you may use Microchip + * software and any derivatives exclusively with Microchip products. + * It is your responsibility to comply with third party license terms applicable + * to your use of third party software (including open source software) that + * may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, + * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, + * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE + * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL + * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE + * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE + * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT + * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY + * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + * + * \asf_license_stop + * + */ +/* + * Support and FAQ: visit Microchip Support + */ + +#include + +#include "conf_sd_mmc.h" + +#include "sd_mmc_protocol.h" +#include "sd_mmc.h" + +#if CONF_OS_SUPPORT +#include +#endif +#include +#include +#include +#include + +#define TPASTE2(a, b) a##b +#define ATPASTE2(a, b) TPASTE2(a, b) + +/** + * \ingroup sd_mmc_stack + * \defgroup sd_mmc_stack_internal Implementation of SD/MMC/SDIO Stack + * @{ + */ + +#ifndef CONF_SD_MMC_MEM_CNT +#define CONF_SD_MMC_MEM_CNT 0 +#endif + +/* Macros to switch SD MMC stack to the correct driver (MCI or SPI) */ +#if (CONF_SD_MMC_MEM_CNT != 0) +#if CONF_MCI_OS_SUPPORT +#include "hal_mci_os.h" +#else +#include "hal_mci_sync.h" +#endif +#define driver mci +#else +#error No MCI or HSMCI interfaces are defined for SD MMC stack. \ + CONF_SD_MMC_MEM_CNT must be added in board.h file. +#endif + +#if CONF_MCI_OS_SUPPORT +#define driver_select_device ATPASTE2(driver, _os_select_device) +#define driver_deselect_device ATPASTE2(driver, _os_deselect_device) +#define driver_get_bus_width ATPASTE2(driver, _os_get_bus_width) +#define driver_is_high_speed_capable ATPASTE2(driver, _os_is_high_speed_capable) +#define driver_send_clock ATPASTE2(driver, _os_send_init_sequence) +#define driver_send_cmd ATPASTE2(driver, _os_send_cmd) +#define driver_get_response ATPASTE2(driver, _os_get_response) +#define driver_get_response_128 ATPASTE2(driver, _os_get_response_128) +#define driver_adtc_start ATPASTE2(driver, _os_adtc_start) +#define driver_adtc_stop ATPASTE2(driver, _os_send_cmd) +#define driver_read_word ATPASTE2(driver, _os_read_bytes) +#define driver_write_word ATPASTE2(driver, _os_write_bytes) +#define driver_start_read_blocks ATPASTE2(driver, _os_start_read_blocks) +#define driver_wait_end_of_read_blocks ATPASTE2(driver, _os_wait_end_of_read_blocks) +#define driver_start_write_blocks ATPASTE2(driver, _os_start_write_blocks) +#define driver_wait_end_of_write_blocks ATPASTE2(driver, _os_wait_end_of_write_blocks) +#else +#define driver_select_device ATPASTE2(driver, _sync_select_device) +#define driver_deselect_device ATPASTE2(driver, _sync_deselect_device) +#define driver_get_bus_width ATPASTE2(driver, _sync_get_bus_width) +#define driver_is_high_speed_capable ATPASTE2(driver, _sync_is_high_speed_capable) +#define driver_send_clock ATPASTE2(driver, _sync_send_clock) +#define driver_send_cmd ATPASTE2(driver, _sync_send_cmd) +#define driver_get_response ATPASTE2(driver, _sync_get_response) +#define driver_get_response_128 ATPASTE2(driver, _sync_get_response_128) +#define driver_adtc_start ATPASTE2(driver, _sync_adtc_start) +#define driver_adtc_stop ATPASTE2(driver, _sync_send_cmd) +#define driver_read_word ATPASTE2(driver, _sync_read_word) +#define driver_write_word ATPASTE2(driver, _sync_write_word) +#define driver_start_read_blocks ATPASTE2(driver, _sync_start_read_blocks) +#define driver_wait_end_of_read_blocks ATPASTE2(driver, _sync_wait_end_of_read_blocks) +#define driver_start_write_blocks ATPASTE2(driver, _sync_start_write_blocks) +#define driver_wait_end_of_write_blocks ATPASTE2(driver, _sync_wait_end_of_write_blocks) +#endif + +#if (CONF_SDIO_SUPPORT == 1) +#define IS_SDIO() (sd_mmc_card->type & CARD_TYPE_SDIO) +#else +#define IS_SDIO() false +#endif + +/** This SD MMC stack supports only the high voltage */ +#define SD_MMC_VOLTAGE_SUPPORT \ + (OCR_VDD_27_28 | OCR_VDD_28_29 | OCR_VDD_29_30 | OCR_VDD_30_31 | OCR_VDD_31_32 | OCR_VDD_32_33) + +/** SD/MMC card states */ +enum card_state { + SD_MMC_CARD_STATE_READY = 0, /**< Ready to use */ + SD_MMC_CARD_STATE_DEBOUNCE = 1, /**< Debounce on going */ + SD_MMC_CARD_STATE_INIT = 2, /**< Initialization on going */ + SD_MMC_CARD_STATE_UNUSABLE = 3, /**< Unusable card */ + SD_MMC_CARD_STATE_NO_CARD = 4 /**< No SD/MMC card inserted */ +}; + +/** SD/MMC card information structure */ +struct sd_mmc_card { + uint32_t clock; /**< Card access clock */ + uint32_t capacity; /**< Card capacity in KBytes */ + uint16_t rca; /**< Relative card address */ + enum card_state state; /**< Card state */ + card_type_t type; /**< Card type */ + card_version_t version; /**< Card version */ + uint8_t bus_width; /**< Number of DATA lin on bus (MCI only) */ + uint8_t csd[CSD_REG_BSIZE]; /**< CSD register */ + uint8_t high_speed; /**< High speed card (1) */ +}; + +/** Card detect pin */ +static sd_mmc_detect_t *_cd; +/** Write protect pin */ +static sd_mmc_detect_t *_wp; + +/** SD/MMC card list */ +/** Note: Initialize card detect pin fields if present */ +static struct sd_mmc_card sd_mmc_cards[CONF_SD_MMC_MEM_CNT]; + +/** HAL driver instance */ +static void *sd_mmc_hal; +/** Index of current slot configurated */ +static uint8_t sd_mmc_slot_sel; +/** Pointer on current slot configurated */ +static struct sd_mmc_card *sd_mmc_card; +/** Number of block to read or write on the current transfer */ +static uint16_t sd_mmc_nb_block_to_tranfer = 0; +/** Number of block remaining to read or write on the current transfer */ +static uint16_t sd_mmc_nb_block_remaining = 0; + +/** SD/MMC transfer rate unit codes (10K) list */ +const uint32_t sd_mmc_trans_units[7] = {10, 100, 1000, 10000, 0, 0, 0}; +/** SD transfer multiplier factor codes (1/10) list */ +const uint32_t sd_trans_multipliers[16] = {0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80}; +/** MMC transfer multiplier factor codes (1/10) list */ +const uint32_t mmc_trans_multipliers[16] = {0, 10, 12, 13, 15, 20, 26, 30, 35, 40, 45, 52, 55, 60, 70, 80}; + +/** \name MMC, SD and SDIO commands process */ +/** @{ */ +#if CONF_MMC_SUPPORT +static bool mmc_mci_op_cond(void); +static bool mmc_cmd6_set_bus_width(uint8_t bus_width); +static bool mmc_cmd6_set_high_speed(void); +static bool mmc_cmd8(uint8_t *b_authorize_high_speed); +static void mmc_decode_csd(void); +#endif +static bool sd_mci_op_cond(uint8_t v2); +static bool sdio_op_cond(void); +static bool sdio_get_max_speed(void); +static bool sdio_cmd52_set_bus_width(void); +static bool sdio_cmd52_set_high_speed(void); +static bool sd_cm6_set_high_speed(void); +static bool sd_cmd8(uint8_t *v2); +static bool sd_mmc_cmd9_mci(void); +static void sd_decode_csd(void); +static bool sd_mmc_cmd13(void); +#if (CONF_SDIO_SUPPORT == 1) +static bool sdio_cmd52(uint8_t rw_flag, uint8_t func_nb, uint32_t reg_addr, uint8_t rd_after_wr, uint8_t *io_data); +static bool sdio_cmd53(uint8_t rw_flag, uint8_t func_nb, uint32_t reg_addr, uint8_t inc_addr, uint32_t size, + bool access_block); +#endif +static bool sd_acmd6(void); +static bool sd_acmd51(void); +/** @} */ + +/** \name Internal function to process the initialization and install */ +/** @{ */ +static sd_mmc_err_t sd_mmc_select_slot(uint8_t slot); +static void sd_mmc_configure_slot(void); +static void sd_mmc_deselect_slot(void); +static bool sd_mmc_mci_card_init(void); +#if CONF_MMC_SUPPORT +static bool sd_mmc_mci_install_mmc(void); +#endif +/** @} */ + +/** \name Internal functions to manage a large timeout after a card insertion */ +/** @{ */ +#if CONF_OS_SUPPORT +#define SD_MMC_START_TIMEOUT() os_sleep(CONF_SD_MMC_DEBOUNCE) +#else +#define SD_MMC_START_TIMEOUT() +#endif +#define SD_MMC_IS_TIMEOUT() true +#define SD_MMC_STOP_TIMEOUT() +/** @} */ + +#if CONF_MMC_SUPPORT +/** + * \brief Sends operation condition command and read OCR (MCI only) + * - CMD1 sends operation condition command + * - CMD1 reads OCR + * + * \return true if success, otherwise false + */ +static bool mmc_mci_op_cond(void) +{ + uint32_t retry, resp; + + /* + * Timeout 1s = 400KHz / ((6+6)*8) cylces = 4200 retry + * 6 = cmd byte size + * 6 = response byte size + */ + retry = 4200; + do { + if (!driver_send_cmd(sd_mmc_hal, MMC_MCI_CMD1_SEND_OP_COND, SD_MMC_VOLTAGE_SUPPORT | OCR_ACCESS_MODE_SECTOR)) { + return false; + } + /* Check busy flag */ + resp = driver_get_response(sd_mmc_hal); + if (resp & OCR_POWER_UP_BUSY) { + /* Check OCR value */ + if ((resp & OCR_ACCESS_MODE_MASK) == OCR_ACCESS_MODE_SECTOR) { + sd_mmc_card->type |= CARD_TYPE_HC; + } + break; + } + if (retry-- == 0) { + return false; + } + } while (1); + return true; +} +#endif + +/** + * \brief Ask to all cards to send their operations conditions (MCI only). + * - ACMD41 sends operation condition command. + * - ACMD41 reads OCR + * + * \param v2 Shall be 1 if it is a SD card V2 + * + * \return true if success, otherwise false + */ +static bool sd_mci_op_cond(uint8_t v2) +{ + uint32_t arg, retry, resp; + + /* + * Timeout 1s = 400KHz / ((6+6+6+6)*8) cylces = 2100 retry + * 6 = cmd byte size + * 6 = response byte size + * 6 = cmd byte size + * 6 = response byte size + */ + retry = 2100; + do { + /* CMD55 - Indicate to the card that the next command is an + * application specific command rather than a standard command.*/ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD55_APP_CMD, 0)) { + return false; + } + + /* (ACMD41) Sends host OCR register */ + arg = SD_MMC_VOLTAGE_SUPPORT; + if (v2) { + arg |= SD_ACMD41_HCS; + } + /* Check response */ + if (!driver_send_cmd(sd_mmc_hal, SD_MCI_ACMD41_SD_SEND_OP_COND, arg)) { + return false; + } + resp = driver_get_response(sd_mmc_hal); + if (resp & OCR_POWER_UP_BUSY) { + /* Card is ready */ + if ((resp & OCR_CCS) != 0) { + sd_mmc_card->type |= CARD_TYPE_HC; + } + break; + } + if (retry-- == 0) { + return false; + } + } while (1); + return true; +} + +#if (CONF_SDIO_SUPPORT == 1) +/** + * \brief Try to get the SDIO card's operating condition + * - CMD5 to read OCR NF field + * - CMD5 to wait OCR power up busy + * - CMD5 to read OCR MP field + * sd_mmc_card->type is updated + * + * \return true if success, otherwise false + */ +static bool sdio_op_cond(void) +{ + uint32_t resp; + + /* CMD5 - SDIO send operation condition (OCR) command. */ + if (!driver_send_cmd(sd_mmc_hal, SDIO_CMD5_SEND_OP_COND, 0)) { + return true; /* No error but card type not updated */ + } + resp = driver_get_response(sd_mmc_hal); + if ((resp & OCR_SDIO_NF) == 0) { + return true; /* No error but card type not updated */ + } + + /* + * Wait card ready + * Timeout 1s = 400KHz / ((6+4)*8) cylces = 5000 retry + * 6 = cmd byte size + * 4(SPI) 6(MCI) = response byte size + */ + uint32_t cmd5_retry = 5000; + while (1) { + /* CMD5 - SDIO send operation condition (OCR) command.*/ + if (!driver_send_cmd(sd_mmc_hal, SDIO_CMD5_SEND_OP_COND, resp & SD_MMC_VOLTAGE_SUPPORT)) { + return false; + } + resp = driver_get_response(sd_mmc_hal); + if ((resp & OCR_POWER_UP_BUSY) == OCR_POWER_UP_BUSY) { + break; + } + if (cmd5_retry-- == 0) { + return false; + } + } + /* Update card type at the end of busy */ + if ((resp & OCR_SDIO_MP) > 0) { + sd_mmc_card->type = CARD_TYPE_SD_COMBO; + } else { + sd_mmc_card->type = CARD_TYPE_SDIO; + } + return true; /* No error and card type updated with SDIO type */ +} + +/** + * \brief Get SDIO max transfer speed in Hz. + * - CMD53 reads CIS area address in CCCR area. + * - Nx CMD53 search Fun0 tuple in CIS area + * - CMD53 reads TPLFE_MAX_TRAN_SPEED in Fun0 tuple + * - Compute maximum speed of SDIO + * and update sd_mmc_card->clock + * + * \return true if success, otherwise false + */ +static bool sdio_get_max_speed(void) +{ + uint32_t addr_new, addr_old; + uint8_t buf[6]; + uint32_t unit; + uint32_t mul; + uint8_t tplfe_max_tran_speed, i; + uint8_t addr_cis[4]; + + /* Read CIS area address in CCCR area */ + addr_old = SDIO_CCCR_CIS_PTR; + for (i = 0; i < 4; i++) { + sdio_cmd52(SDIO_CMD52_READ_FLAG, SDIO_CIA, addr_old, 0, &addr_cis[i]); + addr_old++; + } + addr_old = addr_cis[0] + (addr_cis[1] << 8) + (addr_cis[2] << 16) + (addr_cis[3] << 24); + addr_new = addr_old; + + while (1) { + /* Read a sample of CIA area */ + for (i = 0; i < 3; i++) { + sdio_cmd52(SDIO_CMD52_READ_FLAG, SDIO_CIA, addr_new, 0, &buf[i]); + addr_new++; + } + if (buf[0] == SDIO_CISTPL_END) { + return false; /* Tuple error */ + } + if (buf[0] == SDIO_CISTPL_FUNCE && buf[2] == 0x00) { + break; /* Fun0 tuple found */ + } + if (buf[1] == 0) { + return false; /* Tuple error */ + } + /* Next address */ + addr_new += buf[1] - 1; + if (addr_new > (addr_old + 256)) { + return false; /* Outoff CIS area */ + } + } + + /* Read all Fun0 tuple fields: fn0_blk_siz & max_tran_speed */ + addr_new -= 3; + for (i = 0; i < 6; i++) { + sdio_cmd52(SDIO_CMD52_READ_FLAG, SDIO_CIA, addr_new, 0, &buf[i]); + addr_new++; + } + + tplfe_max_tran_speed = buf[5]; + if (tplfe_max_tran_speed > 0x32) { + /* Error on SDIO register, the high speed is not activated + * and the clock can not be more than 25MHz. + * This error is present on specific SDIO card + * (H&D wireless card - HDG104 WiFi SIP). + */ + tplfe_max_tran_speed = 0x32; /* 25Mhz */ + } + + /* Decode transfer speed in Hz.*/ + unit = sd_mmc_trans_units[tplfe_max_tran_speed & 0x7]; + mul = sd_trans_multipliers[(tplfe_max_tran_speed >> 3) & 0xF]; + sd_mmc_card->clock = unit * mul * 1000; + /** + * Note: A combo card shall be a Full-Speed SDIO card + * which supports upto 25MHz. + * A SDIO card alone can be: + * - a Low-Speed SDIO card which supports 400Khz minimum + * - a Full-Speed SDIO card which supports upto 25MHz + */ + return true; +} + +/** + * \brief CMD52 for SDIO - Switches the bus width mode to 4 + * + * \note sd_mmc_card->bus_width is updated. + * + * \return true if success, otherwise false + */ +static bool sdio_cmd52_set_bus_width(void) +{ + /** + * A SD memory card always supports bus 4bit + * A SD COMBO card always supports bus 4bit + * A SDIO Full-Speed alone always supports 4bit + * A SDIO Low-Speed alone can supports 4bit (Optional) + */ + uint8_t u8_value; + + /* Check 4bit support in 4BLS of "Card Capability" register */ + if (!sdio_cmd52(SDIO_CMD52_READ_FLAG, SDIO_CIA, SDIO_CCCR_CAP, 0, &u8_value)) { + return false; + } + if ((u8_value & SDIO_CAP_4BLS) != SDIO_CAP_4BLS) { + /* No supported, it is not a protocol error */ + return true; + } + /* HS mode possible, then enable */ + u8_value = SDIO_BUSWIDTH_4B; + if (!sdio_cmd52(SDIO_CMD52_WRITE_FLAG, SDIO_CIA, SDIO_CCCR_BUS_CTRL, 1, &u8_value)) { + return false; + } + sd_mmc_card->bus_width = 4; + return true; +} + +/** + * \brief CMD52 for SDIO - Enable the high speed mode + * + * \note sd_mmc_card->high_speed is updated. + * \note sd_mmc_card->clock is updated. + * + * \return true if success, otherwise false + */ +static bool sdio_cmd52_set_high_speed(void) +{ + uint8_t u8_value; + + /* Check CIA.HS */ + if (!sdio_cmd52(SDIO_CMD52_READ_FLAG, SDIO_CIA, SDIO_CCCR_HS, 0, &u8_value)) { + return false; + } + if ((u8_value & SDIO_SHS) != SDIO_SHS) { + /* No supported, it is not a protocol error */ + return true; + } + /* HS mode possible, then enable */ + u8_value = SDIO_EHS; + if (!sdio_cmd52(SDIO_CMD52_WRITE_FLAG, SDIO_CIA, SDIO_CCCR_HS, 1, &u8_value)) { + return false; + } + sd_mmc_card->high_speed = 1; + sd_mmc_card->clock *= 2; + return true; +} + +#else +static bool sdio_op_cond(void) +{ + return true; /* No error but card type not updated */ +} +static bool sdio_get_max_speed(void) +{ + return false; +} +static bool sdio_cmd52_set_bus_width(void) +{ + return false; +} +static bool sdio_cmd52_set_high_speed(void) +{ + return false; +} +#endif + +/** + * \brief CMD6 for SD - Switch card in high speed mode + * + * \note CMD6 for SD is valid under the "trans" state. + * \note sd_mmc_card->high_speed is updated. + * \note sd_mmc_card->clock is updated. + * + * \return true if success, otherwise false + */ +static bool sd_cm6_set_high_speed(void) +{ + uint8_t switch_status[SD_SW_STATUS_BSIZE] = {0}; + + if (!driver_adtc_start(sd_mmc_hal, + SD_CMD6_SWITCH_FUNC, + SD_CMD6_MODE_SWITCH | SD_CMD6_GRP6_NO_INFLUENCE | SD_CMD6_GRP5_NO_INFLUENCE + | SD_CMD6_GRP4_NO_INFLUENCE | SD_CMD6_GRP3_NO_INFLUENCE | SD_CMD6_GRP2_DEFAULT + | SD_CMD6_GRP1_HIGH_SPEED, + SD_SW_STATUS_BSIZE, + 1, + true)) { + return false; + } + if (!driver_start_read_blocks(sd_mmc_hal, switch_status, 1)) { + return false; + } + if (!driver_wait_end_of_read_blocks(sd_mmc_hal)) { + return false; + } + + if (driver_get_response(sd_mmc_hal) & CARD_STATUS_SWITCH_ERROR) { + return false; + } + if (SD_SW_STATUS_FUN_GRP1_RC(switch_status) == SD_SW_STATUS_FUN_GRP_RC_ERROR) { + /* No supported, it is not a protocol error */ + return true; + } + if (SD_SW_STATUS_FUN_GRP1_BUSY(switch_status)) { + return false; + } + /* CMD6 function switching period is within 8 clocks + * after the end bit of status data.*/ + driver_send_clock(sd_mmc_hal); + sd_mmc_card->high_speed = 1; + sd_mmc_card->clock *= 2; + return true; +} + +#if CONF_MMC_SUPPORT + +/** + * \brief CMD6 for MMC - Switches the bus width mode + * + * \note CMD6 is valid under the "trans" state. + * \note sd_mmc_card->bus_width is updated. + * + * \param bus_width Bus width to set + * + * \return true if success, otherwise false + */ +static bool mmc_cmd6_set_bus_width(uint8_t bus_width) +{ + uint32_t arg; + + switch (bus_width) { + case 8: + arg = MMC_CMD6_ACCESS_SET_BITS | MMC_CMD6_INDEX_BUS_WIDTH | MMC_CMD6_VALUE_BUS_WIDTH_8BIT; + break; + case 4: + arg = MMC_CMD6_ACCESS_SET_BITS | MMC_CMD6_INDEX_BUS_WIDTH | MMC_CMD6_VALUE_BUS_WIDTH_4BIT; + break; + default: + arg = MMC_CMD6_ACCESS_SET_BITS | MMC_CMD6_INDEX_BUS_WIDTH | MMC_CMD6_VALUE_BUS_WIDTH_1BIT; + break; + } + if (!driver_send_cmd(sd_mmc_hal, MMC_CMD6_SWITCH, arg)) { + return false; + } + if (driver_get_response(sd_mmc_hal) & CARD_STATUS_SWITCH_ERROR) { + /* No supported, it is not a protocol error */ + return false; + } + sd_mmc_card->bus_width = bus_width; + return true; +} + +/** + * \brief CMD6 for MMC - Switches in high speed mode + * + * \note CMD6 is valid under the "trans" state. + * \note sd_mmc_card->high_speed is updated. + * \note sd_mmc_card->clock is updated. + * + * \return true if success, otherwise false + */ +static bool mmc_cmd6_set_high_speed(void) +{ + if (!driver_send_cmd(sd_mmc_hal, + MMC_CMD6_SWITCH, + MMC_CMD6_ACCESS_WRITE_BYTE | MMC_CMD6_INDEX_HS_TIMING | MMC_CMD6_VALUE_HS_TIMING_ENABLE)) { + return false; + } + if (driver_get_response(sd_mmc_hal) & CARD_STATUS_SWITCH_ERROR) { + /* No supported, it is not a protocol error */ + return false; + } + sd_mmc_card->high_speed = 1; + sd_mmc_card->clock = 52000000lu; + return true; +} +#endif + +/** + * \brief CMD8 for SD card - Send Interface Condition Command. + * + * \note + * Send SD Memory Card interface condition, which includes host supply + * voltage information and asks the card whether card supports voltage. + * Should be performed at initialization time to detect the card type. + * + * \param v2 Pointer to v2 flag to update + * + * \return true if success, otherwise false + * with a update of \ref sd_mmc_err. + */ +static bool sd_cmd8(uint8_t *v2) +{ + uint32_t resp; + + *v2 = 0; + /* Test for SD version 2 */ + if (!driver_send_cmd(sd_mmc_hal, SD_CMD8_SEND_IF_COND, SD_CMD8_PATTERN | SD_CMD8_HIGH_VOLTAGE)) { + return true; /* It is not a V2 */ + } + /* Check R7 response */ + resp = driver_get_response(sd_mmc_hal); + if (resp == 0xFFFFFFFF) { + /* No compliance R7 value */ + return true; /* It is not a V2 */ + } + if ((resp & (SD_CMD8_MASK_PATTERN | SD_CMD8_MASK_VOLTAGE)) != (SD_CMD8_PATTERN | SD_CMD8_HIGH_VOLTAGE)) { + return false; + } + *v2 = 1; + return true; +} + +#if CONF_MMC_SUPPORT +/** + * \brief CMD8 - The card sends its EXT_CSD register as a block of data. + * + * \param b_authorize_high_speed Pointer to update with the high speed + * support information + * + * \return true if success, otherwise false + */ +static bool mmc_cmd8(uint8_t *b_authorize_high_speed) +{ + uint16_t i; + uint32_t ext_csd; + uint32_t sec_count; + + if (!driver_adtc_start(sd_mmc_hal, MMC_CMD8_SEND_EXT_CSD, 0, EXT_CSD_BSIZE, 1, false)) { + return false; + } + /* Read and decode Extended Extended CSD + * Note: The read access is done in byte to avoid a buffer + * of EXT_CSD_BSIZE Byte in stack.*/ + + /* Read card type */ + for (i = 0; i < (EXT_CSD_CARD_TYPE_INDEX + 4) / 4; i++) { + if (!driver_read_word(sd_mmc_hal, &ext_csd)) { + return false; + } + } + *b_authorize_high_speed = (ext_csd >> ((EXT_CSD_CARD_TYPE_INDEX % 4) * 8)) & MMC_CTYPE_52MHZ; + + if (MMC_CSD_C_SIZE(sd_mmc_card->csd) == 0xFFF) { + /* For high capacity SD/MMC card, + * memory capacity = SEC_COUNT * 512 byte */ + for (; i < (EXT_CSD_SEC_COUNT_INDEX + 4) / 4; i++) { + if (!driver_read_word(sd_mmc_hal, &sec_count)) { + return false; + } + } + sd_mmc_card->capacity = sec_count / 2; + } + for (; i < EXT_CSD_BSIZE / 4; i++) { + if (!driver_read_word(sd_mmc_hal, &sec_count)) { + return false; + } + } + return true; +} + +#endif + +/** + * \brief CMD9: Addressed card sends its card-specific + * data (CSD) on the CMD line mci. + * + * \return true if success, otherwise false + */ +static bool sd_mmc_cmd9_mci(void) +{ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_MCI_CMD9_SEND_CSD, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + driver_get_response_128(sd_mmc_hal, sd_mmc_card->csd); + return true; +} + +#if CONF_MMC_SUPPORT +/** + * \brief Decodes MMC CSD register + */ +static void mmc_decode_csd(void) +{ + uint32_t unit; + uint32_t mul; + uint32_t tran_speed; + + /* Get MMC System Specification version supported by the card */ + switch (MMC_CSD_SPEC_VERS(sd_mmc_card->csd)) { + default: + case 0: + sd_mmc_card->version = CARD_VER_MMC_1_2; + break; + + case 1: + sd_mmc_card->version = CARD_VER_MMC_1_4; + break; + + case 2: + sd_mmc_card->version = CARD_VER_MMC_2_2; + break; + + case 3: + sd_mmc_card->version = CARD_VER_MMC_3; + break; + + case 4: + sd_mmc_card->version = CARD_VER_MMC_4; + break; + } + + /* Get MMC memory max transfer speed in Hz.*/ + tran_speed = CSD_TRAN_SPEED(sd_mmc_card->csd); + unit = sd_mmc_trans_units[tran_speed & 0x7]; + mul = mmc_trans_multipliers[(tran_speed >> 3) & 0xF]; + sd_mmc_card->clock = unit * mul * 1000; + + /* + * Get card capacity. + * ---------------------------------------------------- + * For normal SD/MMC card: + * memory capacity = BLOCKNR * BLOCK_LEN + * Where + * BLOCKNR = (C_SIZE+1) * MULT + * MULT = 2 ^ (C_SIZE_MULT+2) (C_SIZE_MULT < 8) + * BLOCK_LEN = 2 ^ READ_BL_LEN (READ_BL_LEN < 12) + * ---------------------------------------------------- + * For high capacity SD/MMC card: + * memory capacity = SEC_COUNT * 512 byte + */ + if (MMC_CSD_C_SIZE(sd_mmc_card->csd) != 0xFFF) { + uint32_t blocknr + = ((MMC_CSD_C_SIZE(sd_mmc_card->csd) + 1) * (1 << (MMC_CSD_C_SIZE_MULT(sd_mmc_card->csd) + 2))); + sd_mmc_card->capacity = blocknr * (1 << MMC_CSD_READ_BL_LEN(sd_mmc_card->csd)) / 1024; + } +} +#endif + +/** + * \brief Decodes SD CSD register + */ +static void sd_decode_csd(void) +{ + uint32_t unit; + uint32_t mul; + uint32_t tran_speed; + + /* Get SD memory maximum transfer speed in Hz. */ + tran_speed = CSD_TRAN_SPEED(sd_mmc_card->csd); + unit = sd_mmc_trans_units[tran_speed & 0x7]; + mul = sd_trans_multipliers[(tran_speed >> 3) & 0xF]; + sd_mmc_card->clock = unit * mul * 1000; + + /* + * Get card capacity. + * ---------------------------------------------------- + * For normal SD/MMC card: + * memory capacity = BLOCKNR * BLOCK_LEN + * Where + * BLOCKNR = (C_SIZE+1) * MULT + * MULT = 2 ^ (C_SIZE_MULT+2) (C_SIZE_MULT < 8) + * BLOCK_LEN = 2 ^ READ_BL_LEN (READ_BL_LEN < 12) + * ---------------------------------------------------- + * For high capacity SD card: + * memory capacity = (C_SIZE+1) * 512K byte + */ + if (CSD_STRUCTURE_VERSION(sd_mmc_card->csd) >= SD_CSD_VER_2_0) { + sd_mmc_card->capacity = (SD_CSD_2_0_C_SIZE(sd_mmc_card->csd) + 1) * 512; + } else { + uint32_t blocknr + = ((SD_CSD_1_0_C_SIZE(sd_mmc_card->csd) + 1) * (1 << (SD_CSD_1_0_C_SIZE_MULT(sd_mmc_card->csd) + 2))); + sd_mmc_card->capacity = blocknr * (1 << SD_CSD_1_0_READ_BL_LEN(sd_mmc_card->csd)) / 1024; + } +} + +/** + * \brief CMD13 - Addressed card sends its status register. + * This function waits the clear of the busy flag + * + * \return true if success, otherwise false + */ +static bool sd_mmc_cmd13(void) +{ + uint32_t nec_timeout; + + /* Wait for data ready status. + * Nec timing: 0 to unlimited + * However a timeout is used. + * 200 000 * 8 cycles + */ + nec_timeout = 200000; + do { + if (!driver_send_cmd(sd_mmc_hal, SDMMC_MCI_CMD13_SEND_STATUS, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + /* Check busy flag */ + if (driver_get_response(sd_mmc_hal) & CARD_STATUS_READY_FOR_DATA) { + break; + } + if (nec_timeout-- == 0) { + return false; + } + } while (1); + + return true; +} + +#if (CONF_SDIO_SUPPORT == 1) +/** + * \brief CMD52 - SDIO IO_RW_DIRECT command + * + * \param rw_flag Direction, 1:write, 0:read. + * \param func_nb Number of the function. + * \param rd_after_wr Read after Write flag. + * \param reg_addr register address. + * \param io_data Pointer to input argument and response buffer. + * + * \return true if success, otherwise false + */ +static bool sdio_cmd52(uint8_t rw_flag, uint8_t func_nb, uint32_t reg_addr, uint8_t rd_after_wr, uint8_t *io_data) +{ + ASSERT(io_data != NULL); + if (!driver_send_cmd(sd_mmc_hal, + SDIO_CMD52_IO_RW_DIRECT, + ((uint32_t)*io_data << SDIO_CMD52_WR_DATA) | ((uint32_t)rw_flag << SDIO_CMD52_RW_FLAG) + | ((uint32_t)func_nb << SDIO_CMD52_FUNCTION_NUM) + | ((uint32_t)rd_after_wr << SDIO_CMD52_RAW_FLAG) + | ((uint32_t)reg_addr << SDIO_CMD52_REG_ADRR))) { + return false; + } + *io_data = driver_get_response(sd_mmc_hal) & 0xFF; + return true; +} + +/** + * \brief CMD53 - SDIO IO_RW_EXTENDED command + * This implementation support only the SDIO multi-byte transfer mode which is + * similar to the single block transfer on memory. + * Note: The SDIO block transfer mode is optional for SDIO card. + * + * \param rw_flag Direction, 1:write, 0:read. + * \param func_nb Number of the function. + * \param reg_addr Register address. + * \param inc_addr 1:Incrementing address, 0: fixed. + * \param size Transfer data size. + * \param access_block true, if the block access (DMA) is used + * + * \return true if success, otherwise false + */ +static bool sdio_cmd53(uint8_t rw_flag, uint8_t func_nb, uint32_t reg_addr, uint8_t inc_addr, uint32_t size, + bool access_block) +{ + ASSERT(size != 0); + ASSERT(size <= 512); + + return driver_adtc_start( + sd_mmc_hal, + (rw_flag == SDIO_CMD53_READ_FLAG) ? SDIO_CMD53_IO_R_BYTE_EXTENDED : SDIO_CMD53_IO_W_BYTE_EXTENDED, + ((size % 512) << SDIO_CMD53_COUNT) | ((uint32_t)reg_addr << SDIO_CMD53_REG_ADDR) + | ((uint32_t)inc_addr << SDIO_CMD53_OP_CODE) | ((uint32_t)0 << SDIO_CMD53_BLOCK_MODE) + | ((uint32_t)func_nb << SDIO_CMD53_FUNCTION_NUM) | ((uint32_t)rw_flag << SDIO_CMD53_RW_FLAG), + size, + 1, + access_block); +} +#endif + +/** + * \brief ACMD6 - Define the data bus width to 4 bits bus + * + * \return true if success, otherwise false + */ +static bool sd_acmd6(void) +{ + /* CMD55 - Indicate to the card that the next command is an + * application specific command rather than a standard command.*/ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD55_APP_CMD, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + /* 10b = 4 bits bus */ + if (!driver_send_cmd(sd_mmc_hal, SD_ACMD6_SET_BUS_WIDTH, 0x2)) { + return false; + } + sd_mmc_card->bus_width = 4; + return true; +} + +/** + * \brief ACMD51 - Read the SD Configuration Register. + * + * \note + * SD Card Configuration Register (SCR) provides information on the SD Memory + * Card's special features that were configured into the given card. The size + * of SCR register is 64 bits. + * + * + * \return true if success, otherwise false + */ +static bool sd_acmd51(void) +{ + uint8_t scr[SD_SCR_REG_BSIZE]; + + /* CMD55 - Indicate to the card that the next command is an + * application specific command rather than a standard command.*/ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD55_APP_CMD, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + if (!driver_adtc_start(sd_mmc_hal, SD_ACMD51_SEND_SCR, 0, SD_SCR_REG_BSIZE, 1, true)) { + return false; + } + if (!driver_start_read_blocks(sd_mmc_hal, scr, 1)) { + return false; + } + if (!driver_wait_end_of_read_blocks(sd_mmc_hal)) { + return false; + } + + /* Get SD Memory Card - Spec. Version */ + switch (SD_SCR_SD_SPEC(scr)) { + case SD_SCR_SD_SPEC_1_0_01: + sd_mmc_card->version = CARD_VER_SD_1_0; + break; + + case SD_SCR_SD_SPEC_1_10: + sd_mmc_card->version = CARD_VER_SD_1_10; + break; + + case SD_SCR_SD_SPEC_2_00: + if (SD_SCR_SD_SPEC3(scr) == SD_SCR_SD_SPEC_3_00) { + sd_mmc_card->version = CARD_VER_SD_3_0; + } else { + sd_mmc_card->version = CARD_VER_SD_2_0; + } + break; + + default: + sd_mmc_card->version = CARD_VER_SD_1_0; + break; + } + return true; +} + +/** + * \brief Select a card slot and initialize the associated driver + * + * \param slot Card slot number + * + * \retval SD_MMC_ERR_SLOT Wrong slot number + * \retval SD_MMC_ERR_NO_CARD No card present on slot + * \retval SD_MMC_ERR_UNUSABLE Unusable card + * \retval SD_MMC_INIT_ONGOING Card initialization requested + * \retval SD_MMC_OK Card present + */ +static sd_mmc_err_t sd_mmc_select_slot(uint8_t slot) +{ + if (slot >= CONF_SD_MMC_MEM_CNT) { + return SD_MMC_ERR_SLOT; + } + + if (_cd && _cd[slot].pin != -1) { + /** Card Detect pins */ + if (gpio_get_pin_level(_cd[slot].pin) != _cd[slot].val) { + if (sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_DEBOUNCE) { + SD_MMC_STOP_TIMEOUT(); + } + sd_mmc_cards[slot].state = SD_MMC_CARD_STATE_NO_CARD; + return SD_MMC_ERR_NO_CARD; + } + if (sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_NO_CARD) { + /* A card plug on going, but this is not initialized */ + sd_mmc_cards[slot].state = SD_MMC_CARD_STATE_DEBOUNCE; + /* Debounce + Power On Setup */ + SD_MMC_START_TIMEOUT(); + return SD_MMC_ERR_NO_CARD; + } + if (sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_DEBOUNCE) { + if (!SD_MMC_IS_TIMEOUT()) { + /* Debounce on going */ + return SD_MMC_ERR_NO_CARD; + } + /* Card is not initialized */ + sd_mmc_cards[slot].state = SD_MMC_CARD_STATE_INIT; + /* Set 1-bit bus width and low clock for initialization */ + sd_mmc_cards[slot].clock = SDMMC_CLOCK_INIT; + sd_mmc_cards[slot].bus_width = 1; + sd_mmc_cards[slot].high_speed = 0; + } + if (sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_UNUSABLE) { + return SD_MMC_ERR_UNUSABLE; + } + } else { + /* No pin card detection, then always try to install it */ + if ((sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_NO_CARD) + || (sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_UNUSABLE)) { + /* Card is not initialized */ + sd_mmc_cards[slot].state = SD_MMC_CARD_STATE_INIT; + /* Set 1-bit bus width and low clock for initialization */ + sd_mmc_cards[slot].clock = SDMMC_CLOCK_INIT; + sd_mmc_cards[slot].bus_width = 1; + sd_mmc_cards[slot].high_speed = 0; + } + } + + ASSERT(!(sd_mmc_slot_sel != slot && sd_mmc_nb_block_remaining != 0)); + + /* Initialize interface */ + sd_mmc_slot_sel = slot; + sd_mmc_card = &sd_mmc_cards[slot]; + sd_mmc_configure_slot(); + return (sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_INIT) ? SD_MMC_INIT_ONGOING : SD_MMC_OK; +} + +/** + * \brief Configures the driver with the selected card configuration + */ +static void sd_mmc_configure_slot(void) +{ + driver_select_device( + sd_mmc_hal, sd_mmc_slot_sel, sd_mmc_card->clock, sd_mmc_card->bus_width, sd_mmc_card->high_speed); +} + +/** + * \brief Deselect the current card slot + */ +static void sd_mmc_deselect_slot(void) +{ + if (sd_mmc_slot_sel < CONF_SD_MMC_MEM_CNT) { + driver_deselect_device(sd_mmc_hal, sd_mmc_slot_sel); + } +} + +/** + * \brief Initialize the SD card in MCI mode. + * + * \note + * This function runs the initialization procedure and the identification + * process, then it sets the SD/MMC card in transfer state. + * At last, it will automaticly enable maximum bus width and transfer speed. + * + * \return true if success, otherwise false + */ +static bool sd_mmc_mci_card_init(void) +{ + uint8_t v2 = 0; +#if (CONF_SDIO_SUPPORT == 1) + uint8_t data = 0x08; +#endif + + /* In first, try to install SD/SDIO card */ + sd_mmc_card->type = CARD_TYPE_SD; + sd_mmc_card->version = CARD_VER_UNKNOWN; + sd_mmc_card->rca = 0; + + /* Card need of 74 cycles clock minimum to start */ + driver_send_clock(sd_mmc_hal); + +#if (CONF_SDIO_SUPPORT == 1) + /* CMD52 Reset SDIO */ + sdio_cmd52(SDIO_CMD52_WRITE_FLAG, SDIO_CIA, SDIO_CCCR_IOA, 0, &data); +#endif + + /* CMD0 - Reset all cards to idle state.*/ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_MCI_CMD0_GO_IDLE_STATE, 0)) { + return false; + } + if (!sd_cmd8(&v2)) { + return false; + } + /* Try to get the SDIO card's operating condition */ + if (!sdio_op_cond()) { + return false; + } + + if (sd_mmc_card->type & CARD_TYPE_SD) { + /* Try to get the SD card's operating condition */ + if (!sd_mci_op_cond(v2)) { + /* It is not a SD card */ +#if CONF_MMC_SUPPORT + sd_mmc_card->type = CARD_TYPE_MMC; + return sd_mmc_mci_install_mmc(); +#else + sd_mmc_card->type = CARD_TYPE_UNKNOWN; + return false; +#endif + } + } + + if (sd_mmc_card->type & CARD_TYPE_SD) { + /* SD MEMORY, Put the Card in Identify Mode + * Note: The CID is not used in this stack */ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD2_ALL_SEND_CID, 0)) { + return false; + } + } + /* Ask the card to publish a new relative address (RCA).*/ + if (!driver_send_cmd(sd_mmc_hal, SD_CMD3_SEND_RELATIVE_ADDR, 0)) { + return false; + } + sd_mmc_card->rca = (driver_get_response(sd_mmc_hal) >> 16) & 0xFFFF; + + /* SD MEMORY, Get the Card-Specific Data */ + if (sd_mmc_card->type & CARD_TYPE_SD) { + if (!sd_mmc_cmd9_mci()) { + return false; + } + sd_decode_csd(); + } + /* Select the and put it into Transfer Mode */ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD7_SELECT_CARD_CMD, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + /* SD MEMORY, Read the SCR to get card version */ + if (sd_mmc_card->type & CARD_TYPE_SD) { + if (!sd_acmd51()) { + return false; + } + } + if (IS_SDIO()) { + if (!sdio_get_max_speed()) { + return false; + } + } + if ((4 <= driver_get_bus_width(sd_mmc_hal, sd_mmc_slot_sel))) { + /* TRY to enable 4-bit mode */ + if (IS_SDIO()) { + if (!sdio_cmd52_set_bus_width()) { + return false; + } + } + if (sd_mmc_card->type & CARD_TYPE_SD) { + if (!sd_acmd6()) { + return false; + } + } + /* Switch to selected bus mode */ + sd_mmc_configure_slot(); + } + if (driver_is_high_speed_capable(sd_mmc_hal)) { + /* TRY to enable High-Speed Mode */ + if (IS_SDIO()) { + if (!sdio_cmd52_set_high_speed()) { + return false; + } + } + if (sd_mmc_card->type & CARD_TYPE_SD) { + if (sd_mmc_card->version > CARD_VER_SD_1_0) { + if (!sd_cm6_set_high_speed()) { + return false; + } + } + } + /* Valid new configuration */ + sd_mmc_configure_slot(); + } + /* SD MEMORY, Set default block size */ + if (sd_mmc_card->type & CARD_TYPE_SD) { + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD16_SET_BLOCKLEN, SD_MMC_BLOCK_SIZE)) { + return false; + } + } + return true; +} + +#if CONF_MMC_SUPPORT +/** + * \brief Initialize the MMC card in MCI mode. + * + * \note + * This function runs the initialization procedure and the identification + * process, then it sets the SD/MMC card in transfer state. + * At last, it will automaticly enable maximum bus width and transfer speed. + * + * \return true if success, otherwise false + */ +static bool sd_mmc_mci_install_mmc(void) +{ + uint8_t b_authorize_high_speed; + + /* CMD0 - Reset all cards to idle state. */ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_MCI_CMD0_GO_IDLE_STATE, 0)) { + return false; + } + + if (!mmc_mci_op_cond()) { + return false; + } + + /* Put the Card in Identify Mode + * Note: The CID is not used in this stack*/ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD2_ALL_SEND_CID, 0)) { + return false; + } + /* Assign relative address to the card.*/ + sd_mmc_card->rca = 1; + if (!driver_send_cmd(sd_mmc_hal, MMC_CMD3_SET_RELATIVE_ADDR, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + /* Get the Card-Specific Data */ + if (!sd_mmc_cmd9_mci()) { + return false; + } + mmc_decode_csd(); + /* Select the and put it into Transfer Mode */ + if (!driver_send_cmd(sd_mmc_hal, SDMMC_CMD7_SELECT_CARD_CMD, (uint32_t)sd_mmc_card->rca << 16)) { + return false; + } + if (sd_mmc_card->version >= CARD_VER_MMC_4) { + /* For MMC 4.0 Higher version + * Get EXT_CSD */ + if (!mmc_cmd8(&b_authorize_high_speed)) { + return false; + } + if (4 <= driver_get_bus_width(sd_mmc_hal, sd_mmc_slot_sel)) { + /* Enable more bus width */ + if (!mmc_cmd6_set_bus_width(driver_get_bus_width(sd_mmc_hal, sd_mmc_slot_sel))) { + return false; + } + /* Reinitialize the slot with the bus width */ + sd_mmc_configure_slot(); + } + if (driver_is_high_speed_capable(sd_mmc_hal) && b_authorize_high_speed) { + /* Enable HS */ + if (!mmc_cmd6_set_high_speed()) { + return false; + } + /* Reinitialize the slot with the new speed */ + sd_mmc_configure_slot(); + } + } else { + /* Reinitialize the slot with the new speed */ + sd_mmc_configure_slot(); + } + + uint8_t retry = 10; + while (retry--) { + /* Retry is a WORKAROUND for no compliance card (Atmel Internal ref. MMC19): + * These cards seem not ready immediatly + * after the end of busy of mmc_cmd6_set_high_speed()*/ + + /* Set default block size */ + if (driver_send_cmd(sd_mmc_hal, SDMMC_CMD16_SET_BLOCKLEN, SD_MMC_BLOCK_SIZE)) { + return true; + } + } + return false; +} +#endif + +/*--------------------- PUBLIC FUNCTIONS ----------------------------*/ + +void sd_mmc_init(void *hal, sd_mmc_detect_t *card_detects, sd_mmc_detect_t *wp_detects) +{ + /* GPIO will be used to detect card and write protect. + * The related clocks and pinmux must be configurated in good + * condition. */ + + for (uint8_t slot = 0; slot < CONF_SD_MMC_MEM_CNT; slot++) { + sd_mmc_cards[slot].state = SD_MMC_CARD_STATE_NO_CARD; + } + sd_mmc_slot_sel = 0xFF; /* No slot configurated */ + sd_mmc_hal = hal; + _cd = card_detects; + _wp = wp_detects; +} + +uint8_t sd_mmc_nb_slot(void) +{ + return CONF_SD_MMC_MEM_CNT; +} + +sd_mmc_err_t sd_mmc_check(uint8_t slot) +{ + sd_mmc_err_t sd_mmc_err; + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_INIT_ONGOING) { + sd_mmc_deselect_slot(); + return sd_mmc_err; + } + + /* Initialization of the card requested */ + if (sd_mmc_mci_card_init()) { + sd_mmc_card->state = SD_MMC_CARD_STATE_READY; + sd_mmc_deselect_slot(); + /* To notify that the card has been just initialized + * It is necessary for USB Device MSC */ + return SD_MMC_INIT_ONGOING; + } + sd_mmc_card->state = SD_MMC_CARD_STATE_UNUSABLE; + sd_mmc_deselect_slot(); + return SD_MMC_ERR_UNUSABLE; +} + +card_type_t sd_mmc_get_type(uint8_t slot) +{ + if (SD_MMC_OK != sd_mmc_select_slot(slot)) { + return CARD_TYPE_UNKNOWN; + } + sd_mmc_deselect_slot(); + return sd_mmc_card->type; +} + +card_version_t sd_mmc_get_version(uint8_t slot) +{ + if (SD_MMC_OK != sd_mmc_select_slot(slot)) { + return CARD_VER_UNKNOWN; + } + sd_mmc_deselect_slot(); + return sd_mmc_card->version; +} + +uint32_t sd_mmc_get_capacity(uint8_t slot) +{ + if (SD_MMC_OK != sd_mmc_select_slot(slot)) { + return 0; + } + sd_mmc_deselect_slot(); + return sd_mmc_card->capacity; +} + +bool sd_mmc_is_write_protected(uint8_t slot) +{ + /* No detection, always writable */ + if (!_wp || _wp[slot].pin == -1) { + return false; + } + /* Write Protect Detect */ + if (gpio_get_pin_level(_wp[slot].pin) == _wp[slot].val) { + return true; + } + return false; +} + +sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start, uint16_t nb_block) +{ + sd_mmc_err_t sd_mmc_err; + uint32_t cmd, arg, resp; + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_OK) { + return sd_mmc_err; + } + + /* Wait for data ready status */ + if (!sd_mmc_cmd13()) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + if (nb_block > 1) { + cmd = SDMMC_CMD18_READ_MULTIPLE_BLOCK; + } else { + cmd = SDMMC_CMD17_READ_SINGLE_BLOCK; + } + /* + * SDSC Card (CCS=0) uses byte unit address, + * SDHC and SDXC Cards (CCS=1) use block unit address (512 Bytes unit). + */ + if (sd_mmc_card->type & CARD_TYPE_HC) { + arg = start; + } else { + arg = (start * SD_MMC_BLOCK_SIZE); + } + + if (!driver_adtc_start(sd_mmc_hal, cmd, arg, SD_MMC_BLOCK_SIZE, nb_block, true)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + /* Check response */ + resp = driver_get_response(sd_mmc_hal); + if (resp & CARD_STATUS_ERR_RD_WR) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + sd_mmc_nb_block_remaining = nb_block; + sd_mmc_nb_block_to_tranfer = nb_block; + return SD_MMC_OK; +} + +sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block) +{ + ASSERT(sd_mmc_nb_block_remaining >= nb_block); + + if (!driver_start_read_blocks(sd_mmc_hal, dest, nb_block)) { + sd_mmc_nb_block_remaining = 0; + return SD_MMC_ERR_COMM; + } + sd_mmc_nb_block_remaining -= nb_block; + return SD_MMC_OK; +} + +sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort) +{ + if (!driver_wait_end_of_read_blocks(sd_mmc_hal)) { + return SD_MMC_ERR_COMM; + } + if (abort) { + sd_mmc_nb_block_remaining = 0; + } else if (sd_mmc_nb_block_remaining) { + return SD_MMC_OK; + } + + /* All blocks are transfered then stop read operation */ + if (sd_mmc_nb_block_to_tranfer == 1) { + /* Single block transfer, then nothing to do */ + sd_mmc_deselect_slot(); + return SD_MMC_OK; + } + /* WORKAROUND for no compliance card (Atmel Internal ref. !MMC7 !SD19): + * The errors on this command must be ignored + * and one retry can be necessary in SPI mode for no compliance card.*/ + if (!driver_adtc_stop(sd_mmc_hal, SDMMC_CMD12_STOP_TRANSMISSION, 0)) { + driver_adtc_stop(sd_mmc_hal, SDMMC_CMD12_STOP_TRANSMISSION, 0); + } + sd_mmc_deselect_slot(); + return SD_MMC_OK; +} + +sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_block) +{ + sd_mmc_err_t sd_mmc_err; + uint32_t cmd, arg, resp; + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_OK) { + return sd_mmc_err; + } + if (sd_mmc_is_write_protected(slot)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_WP; + } + + if (nb_block > 1) { + cmd = SDMMC_CMD25_WRITE_MULTIPLE_BLOCK; + } else { + cmd = SDMMC_CMD24_WRITE_BLOCK; + } + /* + * SDSC Card (CCS=0) uses byte unit address, + * SDHC and SDXC Cards (CCS=1) use block unit address (512 Bytes unit). + */ + if (sd_mmc_card->type & CARD_TYPE_HC) { + arg = start; + } else { + arg = (start * SD_MMC_BLOCK_SIZE); + } + if (!driver_adtc_start(sd_mmc_hal, cmd, arg, SD_MMC_BLOCK_SIZE, nb_block, true)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + /* Check response */ + resp = driver_get_response(sd_mmc_hal); + if (resp & CARD_STATUS_ERR_RD_WR) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + sd_mmc_nb_block_remaining = nb_block; + sd_mmc_nb_block_to_tranfer = nb_block; + return SD_MMC_OK; +} + +sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block) +{ + ASSERT(sd_mmc_nb_block_remaining >= nb_block); + if (!driver_start_write_blocks(sd_mmc_hal, src, nb_block)) { + sd_mmc_nb_block_remaining = 0; + return SD_MMC_ERR_COMM; + } + sd_mmc_nb_block_remaining -= nb_block; + return SD_MMC_OK; +} + +sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort) +{ + if (!driver_wait_end_of_write_blocks(sd_mmc_hal)) { + return SD_MMC_ERR_COMM; + } + if (abort) { + sd_mmc_nb_block_remaining = 0; + } else if (sd_mmc_nb_block_remaining) { + return SD_MMC_OK; + } + + /* All blocks are transfered then stop write operation */ + if (sd_mmc_nb_block_to_tranfer == 1) { + /* Single block transfer, then nothing to do */ + sd_mmc_deselect_slot(); + return SD_MMC_OK; + } + + /* Note: SPI multiblock writes terminate using a special + * token, not a STOP_TRANSMISSION request.*/ + if (!driver_adtc_stop(sd_mmc_hal, SDMMC_CMD12_STOP_TRANSMISSION, 0)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + sd_mmc_deselect_slot(); + return SD_MMC_OK; +} + +#if (CONF_SDIO_SUPPORT == 1) +sd_mmc_err_t sdio_read_direct(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t *dest) +{ + sd_mmc_err_t sd_mmc_err; + + if (dest == NULL) { + return SD_MMC_ERR_PARAM; + } + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_OK) { + return sd_mmc_err; + } + + if (!sdio_cmd52(SDIO_CMD52_READ_FLAG, func_num, addr, 0, dest)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + sd_mmc_deselect_slot(); + return SD_MMC_OK; +} + +sd_mmc_err_t sdio_write_direct(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t data) +{ + sd_mmc_err_t sd_mmc_err; + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_OK) { + return sd_mmc_err; + } + + if (!sdio_cmd52(SDIO_CMD52_WRITE_FLAG, func_num, addr, 0, &data)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + sd_mmc_deselect_slot(); + return SD_MMC_OK; +} + +sd_mmc_err_t sdio_read_extended(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t inc_addr, uint8_t *dest, + uint16_t size) +{ + sd_mmc_err_t sd_mmc_err; + + if ((size == 0) || (size > 512)) { + return SD_MMC_ERR_PARAM; + } + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_OK) { + return sd_mmc_err; + } + + if (!sdio_cmd53(SDIO_CMD53_READ_FLAG, func_num, addr, inc_addr, size, true)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + if (!driver_start_read_blocks(sd_mmc_hal, dest, 1)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + if (!driver_wait_end_of_read_blocks(sd_mmc_hal)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + sd_mmc_deselect_slot(); + return SD_MMC_OK; +} + +sd_mmc_err_t sdio_write_extended(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t inc_addr, uint8_t *src, + uint16_t size) +{ + sd_mmc_err_t sd_mmc_err; + + if ((size == 0) || (size > 512)) { + return SD_MMC_ERR_PARAM; + } + + sd_mmc_err = sd_mmc_select_slot(slot); + if (sd_mmc_err != SD_MMC_OK) { + return sd_mmc_err; + } + + if (!sdio_cmd53(SDIO_CMD53_WRITE_FLAG, func_num, addr, inc_addr, size, true)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + if (!driver_start_write_blocks(sd_mmc_hal, src, 1)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + if (!driver_wait_end_of_write_blocks(sd_mmc_hal)) { + sd_mmc_deselect_slot(); + return SD_MMC_ERR_COMM; + } + + sd_mmc_deselect_slot(); + return SD_MMC_OK; +} +#endif + +/** @} */ diff --git a/ports/atmel-samd/sd_mmc/sd_mmc.h b/ports/atmel-samd/sd_mmc/sd_mmc.h new file mode 100644 index 0000000000..1437e5efd5 --- /dev/null +++ b/ports/atmel-samd/sd_mmc/sd_mmc.h @@ -0,0 +1,310 @@ +/** + * \file + * + * \brief Common SD/MMC stack header file + * + * Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries. + * + * \asf_license_start + * + * \page License + * + * Subject to your compliance with these terms, you may use Microchip + * software and any derivatives exclusively with Microchip products. + * It is your responsibility to comply with third party license terms applicable + * to your use of third party software (including open source software) that + * may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, + * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, + * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE + * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL + * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE + * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE + * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT + * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY + * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + * + * \asf_license_stop + * + */ +/* + * Support and FAQ: visit Microchip Support + */ + +#ifndef SD_MMC_H_INCLUDED +#define SD_MMC_H_INCLUDED + +#include "compiler.h" +#include "conf_sd_mmc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \ingroup common_memory + * \defgroup sd_mmc_stack_group SD/MMC/SDIO common stack + * + * SD/MMC/SDIO basic APIs used by SD/MMC/SDIO memory + * APIs (\ref sd_mmc_stack_mem_group). + * Also, it can be used by application which use the SDIO card + * or specific application which does not need of File System. + * + * For usual application which use the SD/MMC card in + * memory mode with a file system, please refer to + * \ref sd_mmc_stack_mem_group. + * @{ + */ + +typedef uint8_t sd_mmc_err_t; /**< Type of return error code */ + +/** \name Return error codes */ +/** @{ */ +#define SD_MMC_OK 0 /**< No error */ +#define SD_MMC_INIT_ONGOING 1 /**< Card not initialized */ +#define SD_MMC_ERR_NO_CARD 2 /**< No SD/MMC card inserted */ +#define SD_MMC_ERR_UNUSABLE 3 /**< Unusable card */ +#define SD_MMC_ERR_SLOT 4 /**< Slot unknow */ +#define SD_MMC_ERR_COMM 5 /**< General communication error */ +#define SD_MMC_ERR_PARAM 6 /**< Illeage input parameter */ +#define SD_MMC_ERR_WP 7 /**< Card write protected */ +/** @} */ + +typedef uint8_t card_type_t; /**< Type of card type */ + +/** \name Card Types */ +/** @{ */ +#define CARD_TYPE_UNKNOWN (0) /**< Unknown type card */ +#define CARD_TYPE_SD (1 << 0) /**< SD card */ +#define CARD_TYPE_MMC (1 << 1) /**< MMC card */ +#define CARD_TYPE_SDIO (1 << 2) /**< SDIO card */ +#define CARD_TYPE_HC (1 << 3) /**< High capacity card */ +/** SD combo card (io + memory) */ +#define CARD_TYPE_SD_COMBO (CARD_TYPE_SD | CARD_TYPE_SDIO) +/** @} */ + +typedef uint8_t card_version_t; /**< Type of card version */ + +/** \name Card Versions */ +/** @{ */ +#define CARD_VER_UNKNOWN (0) /**< Unknown card version */ +#define CARD_VER_SD_1_0 (0x10) /**< SD version 1.0 and 1.01 */ +#define CARD_VER_SD_1_10 (0x1A) /**< SD version 1.10 */ +#define CARD_VER_SD_2_0 (0X20) /**< SD version 2.00 */ +#define CARD_VER_SD_3_0 (0X30) /**< SD version 3.0X */ +#define CARD_VER_MMC_1_2 (0x12) /**< MMC version 1.2 */ +#define CARD_VER_MMC_1_4 (0x14) /**< MMC version 1.4 */ +#define CARD_VER_MMC_2_2 (0x22) /**< MMC version 2.2 */ +#define CARD_VER_MMC_3 (0x30) /**< MMC version 3 */ +#define CARD_VER_MMC_4 (0x40) /**< MMC version 4 */ +/** @} */ + +/** Card detect setting */ +typedef struct sd_mmc_detect { + int16_t pin; /**< Detection pin, -1 if no such pin */ + uint16_t val; /**< Detection value */ +} sd_mmc_detect_t; + +/** This SD MMC stack uses the maximum block size autorized (512 bytes) */ +#define SD_MMC_BLOCK_SIZE 512 + +/** + * \brief Initialize the SD/MMC stack and low level driver required + * \param[in] hal Pointer to HAL instance + * \param[in] card_detects Pointer to list of card detect settings, + * list size should be \ref CONF_SD_MMC_MEM_CNT + * \param[in] wp_detects Pointer to list of write protect detect settings + * list size should be \ref CONF_SD_MMC_MEM_CNT + */ +void sd_mmc_init(void *hal, sd_mmc_detect_t *card_detects, sd_mmc_detect_t *wp_detects); + +/** \brief Return the number of slot available + * + * \return Number of card slot available + */ +uint8_t sd_mmc_nb_slot(void); + +/** \brief Performs a card checks + * + * \param[in] slot Card slot to use + * + * \retval SD_MMC_OK Card ready + * \retval SD_MMC_INIT_ONGOING Initialization on going + * \retval SD_MMC_ERR_NO_CARD Card not present in slot + * \retval Other value for error cases, see \ref sd_mmc_err_t + */ +sd_mmc_err_t sd_mmc_check(uint8_t slot); + +/** \brief Get the card type + * + * \param[in] slot Card slot + * + * \return Card type (\ref card_type_t) + */ +card_type_t sd_mmc_get_type(uint8_t slot); + +/** \brief Get the card version + * + * \param[in] slot Card slot + * + * \return Card version (\ref card_version_t) + */ +card_version_t sd_mmc_get_version(uint8_t slot); + +/** \brief Get the memory capacity + * + * \param[in] slot Card slot + * + * \return Capacity (unit KB) + */ +uint32_t sd_mmc_get_capacity(uint8_t slot); + +/** \brief Get the card write protection status + * + * \param[in] slot Card slot + * + * \return true, if write portected + */ +bool sd_mmc_is_write_protected(uint8_t slot); + +/** + * \brief Initialize the read blocks of data from the card. + * + * \param[in] slot Card slot to use + * \param[in] start Start block number to to read. + * \param[in] nb_block Total number of blocks to be read. + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start, uint16_t nb_block); + +/** + * \brief Start the read blocks of data from the card. + * + * \param[out] dest Pointer to read buffer. + * \param[in] nb_block Number of blocks to be read. + * + * \return return SD_MMC_OK if started, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block); + +/** + * \brief Wait the end of read blocks of data from the card. + * + * \param[in] abort Abort reading process initialized by + * \ref sd_mmc_init_read_blocks() after the reading issued by + * \ref sd_mmc_start_read_blocks() is done + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort); + +/** + * \brief Initialize the write blocks of data + * + * \param[in] slot Card slot to use + * \param[in] start Start block number to be written. + * \param[in] nb_block Total number of blocks to be written. + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_block); + +/** + * \brief Start the write blocks of data + * + * \param[in] src Pointer to write buffer. + * \param[in] nb_block Number of blocks to be written. + * + * \return return SD_MMC_OK if started, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block); + +/** + * \brief Wait the end of write blocks of data + * + * \param[in] abort Abort writing process initialized by + * \ref sd_mmc_init_write_blocks() after the writing issued by + * \ref sd_mmc_start_write_blocks() is done + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort); + +#if (CONF_SDIO_SUPPORT == 1) +/** + * \brief Read one byte from SDIO using RW_DIRECT command. + * + * \param[in] slot Card slot to use + * \param[in] func_num Function number. + * \param[in] addr Register address to read from. + * \param[out] dest Pointer to read buffer. + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sdio_read_direct(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t *dest); +/** + * \brief Write one byte to SDIO using RW_DIRECT command. + * + * \param[in] slot Card slot to use + * \param[in] func_num Function number. + * \param[in] addr Register address to read from. + * \param[in] data Data to be written. + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sdio_write_direct(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t data); + +/** + * \brief Read bytes from SDIO using RW_EXTENDED command. + * + * \param[in] slot Card slot to use + * \param[in] func_num Function number. + * \param[in] addr First register address to read from. + * \param[in] inc_addr 0 - The data address is fixed. + * 1 - The data address increase automatically. + * \param[out] dest Pointer to read buffer. + * \param[in] size Number of bytes to read (1 ~ 512). + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sdio_read_extended(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t inc_addr, uint8_t *dest, + uint16_t size); + +/** + * \brief Write bytes to SDIO using RW_EXTENDED command. + * + * \param[in] slot Card slot to use + * \param[in] func_num Function number. + * \param[in] addr First register address to write to. + * \param[in] inc_addr 0 - The data address is fixed. + * 1 - The data address increase automatically. + * \param[in] src Pointer to write buffer. + * \param[in] size Number of bytes to read (1 ~ 512). + * + * \return return SD_MMC_OK if success, + * otherwise return an error code (\ref sd_mmc_err_t). + */ +sd_mmc_err_t sdio_write_extended(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t inc_addr, uint8_t *src, + uint16_t size); +#endif /* SDIO_SUPPORT_ENABLE */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* SD_MMC_H_INCLUDED */ diff --git a/ports/atmel-samd/sd_mmc/sd_mmc_protocol.h b/ports/atmel-samd/sd_mmc/sd_mmc_protocol.h new file mode 100644 index 0000000000..0516e4fd10 --- /dev/null +++ b/ports/atmel-samd/sd_mmc/sd_mmc_protocol.h @@ -0,0 +1,1001 @@ +/** + * \file + * + * \brief SD/MMC protocol definitions. + * + * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries. + * + * \asf_license_start + * + * \page License + * + * Subject to your compliance with these terms, you may use Microchip + * software and any derivatives exclusively with Microchip products. + * It is your responsibility to comply with third party license terms applicable + * to your use of third party software (including open source software) that + * may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, + * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, + * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE + * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL + * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE + * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE + * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT + * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY + * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + * + * \asf_license_stop + * + */ +/* + * Support and FAQ: visit Microchip Support + */ + +#ifndef SD_MMC_PROTOCOL_H_INCLUDED +#define SD_MMC_PROTOCOL_H_INCLUDED + +#include "compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \addtogroup sd_mmc_protocol SD/MMC Protocol Definition + * \ingroup sd_mmc_stack_group + * @{ + */ + +// SD/MMC/SDIO default clock frequency for initialization (400KHz) +#define SDMMC_CLOCK_INIT 400000 + +/** + * \name Macros for command definition + * + * Commands types: + * - broadcast commands (bc), no response + * - broadcast commands with response (bcr) (Note: No open drain on SD card) + * - addressed (point-to-point) commands (ac), no data transfer on DAT lines + * - addressed (point-to-point) data transfer commands (adtc), data transfer + * on DAT lines + * + * Specific MMC norms: + * CMD1, CMD2 & CMD3 are processed in the open-drain mode. + * The CMD line is driven with push-pull drivers. + * + * Specific SD norms: + * There is no open drain mode in SD memory card. + * + *************************************** + * Responses types: + * + * R1, R3, R4 & R5 use a 48 bits response protected by a 7bit CRC checksum + * - R1 receiv data not specified + * - R3 receiv OCR + * - R4, R5 RCA management (MMC only) + * - R6, R7 RCA management (SD only) + * + * R1b assert the BUSY signal and respond with R1. + * If the busy signal is asserted, it is done two clock cycles (Nsr time) + * after the end bit of the command. The DAT0 line is driven low. + * DAT1-DAT7 lines are driven by the card though their values are not relevant. + * + * R2 use a 136 bits response protected by a 7bit CRC checksum + * The content is CID or CSD + * + * Specific MMC norms: + * - R4 (Fast I/O) return RCA + * - R5 (interrupt request) return RCA null + * + * Specific SD norms: + * - R6 (Published RCA) return RCA + * - R7 (Card interface condition) return RCA null + * + * @{ + */ + +//! Value to define a SD/MMC/SDIO command +typedef uint32_t sdmmc_cmd_def_t; + +//! \name Flags used to define a SD/MMC/SDIO command +//! @{ +#define SDMMC_CMD_GET_INDEX(cmd) (cmd & 0x3F) +//! Have response (MCI only) +#define SDMMC_RESP_PRESENT (1lu << 8) +//! 8 bit response (SPI only) +#define SDMMC_RESP_8 (1lu << 9) +//! 32 bit response (SPI only) +#define SDMMC_RESP_32 (1lu << 10) +//! 136 bit response (MCI only) +#define SDMMC_RESP_136 (1lu << 11) +//! Expect valid crc (MCI only) +#define SDMMC_RESP_CRC (1lu << 12) +//! Card may send busy +#define SDMMC_RESP_BUSY (1lu << 13) +// Open drain for a braodcast command (bc) +// or to enter in inactive state (MCI only) +#define SDMMC_CMD_OPENDRAIN (1lu << 14) +//! To signal a data write operation +#define SDMMC_CMD_WRITE (1lu << 15) +//! To signal a SDIO tranfer in multi byte mode +#define SDMMC_CMD_SDIO_BYTE (1lu << 16) +//! To signal a SDIO tranfer in block mode +#define SDMMC_CMD_SDIO_BLOCK (1lu << 17) +//! To signal a data transfer in stream mode +#define SDMMC_CMD_STREAM (1lu << 18) +//! To signal a data transfer in single block mode +#define SDMMC_CMD_SINGLE_BLOCK (1lu << 19) +//! To signal a data transfer in multi block mode +#define SDMMC_CMD_MULTI_BLOCK (1lu << 20) +//! @} + +//! \name Set of flags to define a reponse type +//! @{ +#define SDMMC_CMD_NO_RESP (0) +#define SDMMC_CMD_R1 (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC) +#define SDMMC_CMD_R1B (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC | SDMMC_RESP_BUSY) +#define SDMMC_CMD_R2 (SDMMC_RESP_PRESENT | SDMMC_RESP_8 | SDMMC_RESP_136 | SDMMC_RESP_CRC) +#define SDMMC_CMD_R3 (SDMMC_RESP_PRESENT | SDMMC_RESP_32) +#define SDMMC_CMD_R4 (SDMMC_RESP_PRESENT | SDMMC_RESP_32) +#define SDMMC_CMD_R5 (SDMMC_RESP_PRESENT | SDMMC_RESP_8 | SDMMC_RESP_CRC) +#define SDMMC_CMD_R6 (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC) +#define SDMMC_CMD_R7 (SDMMC_RESP_PRESENT | SDMMC_RESP_32 | SDMMC_RESP_CRC) +//! @} + +//! \name SD/MMC/SDIO command definitions +//! SDMMC_CMDx are include in SD and MMC norms +//! MMC_CMDx are include in MMC norms only +//! SD_CMDx are include in SD norms only +//! SDIO_CMDx are include in SDIO norms only +//! @{ + +/* + * --- Basic commands and read-stream command (class 0 and class 1) --- + */ + +/** Cmd0(bc): Reset all cards to idle state */ +#define SDMMC_SPI_CMD0_GO_IDLE_STATE (0 | SDMMC_CMD_R1) +#define SDMMC_MCI_CMD0_GO_IDLE_STATE (0 | SDMMC_CMD_NO_RESP | SDMMC_CMD_OPENDRAIN) +/** MMC Cmd1(bcr, R3): Ask the card to send its Operating Conditions */ +#define MMC_SPI_CMD1_SEND_OP_COND (1 | SDMMC_CMD_R1) +#define MMC_MCI_CMD1_SEND_OP_COND (1 | SDMMC_CMD_R3 | SDMMC_CMD_OPENDRAIN) +/** Cmd2(bcr, R2): Ask the card to send its CID number (stuff but arg 0 used) */ +#define SDMMC_CMD2_ALL_SEND_CID (2 | SDMMC_CMD_R2 | SDMMC_CMD_OPENDRAIN) +/** SD Cmd3(bcr, R6): Ask the card to publish a new relative address (RCA) */ +#define SD_CMD3_SEND_RELATIVE_ADDR (3 | SDMMC_CMD_R6 | SDMMC_CMD_OPENDRAIN) +/** MMC Cmd3(ac, R1): Assigns relative address to the card */ +#define MMC_CMD3_SET_RELATIVE_ADDR (3 | SDMMC_CMD_R1) +/** Cmd4(bc): Program the DSR of all cards (MCI only) */ +#define SDMMC_CMD4_SET_DSR (4 | SDMMC_CMD_NO_RESP) +/** MMC Cmd5(ac, R1b): Toggle the card between Sleep state and Standby state. */ +#define MMC_CMD5_SLEEP_AWAKE (5 | SDMMC_CMD_R1B) +/** Cmd7(ac, R1/R1b): Select/Deselect card + * For SD: R1b only from the selected card. + * For MMC: R1 while selecting from Stand-By State to Transfer State; + * R1b while selecting from Disconnected State to Programming State. + */ +#define SDMMC_CMD7_SELECT_CARD_CMD (7 | SDMMC_CMD_R1B) +#define SDMMC_CMD7_DESELECT_CARD_CMD (7 | SDMMC_CMD_R1) +/** MMC Cmd8(adtc, R1): Send EXT_CSD register as a block of data */ +#define MMC_CMD8_SEND_EXT_CSD (8 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK) +/** SD Cmd8(bcr, R7) : Send SD Memory Card interface condition */ +#define SD_CMD8_SEND_IF_COND (8 | SDMMC_CMD_R7 | SDMMC_CMD_OPENDRAIN) +/** Cmd9 SPI (R1): Addressed card sends its card-specific data (CSD) */ +#define SDMMC_SPI_CMD9_SEND_CSD (9 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK) +/** Cmd9 MCI (ac, R2): Addressed card sends its card-specific data (CSD) */ +#define SDMMC_MCI_CMD9_SEND_CSD (9 | SDMMC_CMD_R2) +/** Cmd10(ac, R2): Addressed card sends its card identification (CID) */ +#define SDMMC_CMD10_SEND_CID (10 | SDMMC_CMD_R2) +/** + * MMC Cmd11(adtc, R1): Read data stream from the card, starting at the given + * address, until a STOP_TRANSMISSION follows. + */ +#define MMC_CMD11_READ_DAT_UNTIL_STOP (11 | SDMMC_CMD_R1) +/* SD Cmd11 MCI (ac, R1): Voltage switching */ +#define SD_CMD11_READ_DAT_UNTIL_STOP (11 | SDMMC_CMD_R1) +/** Cmd12(ac, R1b): Force the card to stop transmission */ +#define SDMMC_CMD12_STOP_TRANSMISSION (12 | SDMMC_CMD_R1B) +/** Cmd13(R2): Addressed card sends its status register. */ +#define SDMMC_SPI_CMD13_SEND_STATUS (13 | SDMMC_CMD_R2) +/** Cmd13(ac, R1): Addressed card sends its status register. */ +#define SDMMC_MCI_CMD13_SEND_STATUS (13 | SDMMC_CMD_R1) +/** MMC Cmd14(adtc, R1): Read the reversed bus testing data pattern from a card. */ +#define MMC_CMD14_BUSTEST_R (14 | SDMMC_CMD_R1) +/** Cmd15(ac): Send an addressed card into the Inactive State. */ +// Note: It is a ac cmd, but it must be send like bc cmd to open drain +#define SDMMC_CMD15_GO_INACTIVE_STATE (15 | SDMMC_CMD_NO_RESP | SDMMC_CMD_OPENDRAIN) +/** MMC Cmd19(adtc, R1): Send the bus test data pattern */ +#define MMC_CMD19_BUSTEST_W (19 | SDMMC_CMD_R1) +/** Cmd58(R3): Reads the OCR register of a card */ +#define SDMMC_SPI_CMD58_READ_OCR (58 | SDMMC_CMD_R3) +/** Cmd59(R1): Turns the CRC option on or off */ +#define SDMMC_SPI_CMD59_CRC_ON_OFF (59 | SDMMC_CMD_R1) + +/* + * --- Block-oriented read commands (class 2) --- + */ +/** Cmd16(ac, R1): Set the block length (in bytes) */ +#define SDMMC_CMD16_SET_BLOCKLEN (16 | SDMMC_CMD_R1) +/** Cmd17(adtc, R1): Read single block */ +#define SDMMC_CMD17_READ_SINGLE_BLOCK (17 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK) +/** Cmd18(adtc, R1): Read multiple block */ +#define SDMMC_CMD18_READ_MULTIPLE_BLOCK (18 | SDMMC_CMD_R1 | SDMMC_CMD_MULTI_BLOCK) + +/* + * --- Sequential write commands (class 3) --- + */ + +/** + * MMC Cmd20(adtc, R1): Write a data stream from the host, starting at the + * given address, until a STOP_TRANSMISSION follows. + */ +#define MMC_CMD20_WRITE_DAT_UNTIL_STOP (20 | SDMMC_CMD_R1) + +/* + * --- Block-oriented write commands (class 4) --- + */ +/** MMC Cmd23(ac, R1): Set block count */ +#define MMC_CMD23_SET_BLOCK_COUNT (23 | SDMMC_CMD_R1) +/** Cmd24(adtc, R1): Write block */ +#define SDMMC_CMD24_WRITE_BLOCK (24 | SDMMC_CMD_R1 | SDMMC_CMD_WRITE | SDMMC_CMD_SINGLE_BLOCK) +/** Cmd25(adtc, R1): Write multiple block */ +#define SDMMC_CMD25_WRITE_MULTIPLE_BLOCK (25 | SDMMC_CMD_R1 | SDMMC_CMD_WRITE | SDMMC_CMD_MULTI_BLOCK) +/** MMC Cmd26(adtc, R1): Programming of the card identification register. */ +#define MMC_CMD26_PROGRAM_CID (26 | SDMMC_CMD_R1) +/** Cmd27(adtc, R1): Programming of the programmable bits of the CSD. */ +#define SDMMC_CMD27_PROGRAM_CSD (27 | SDMMC_CMD_R1) + +/* + * --- Erase commands (class 5) --- + */ +/** SD Cmd32(ac, R1): */ +#define SD_CMD32_ERASE_WR_BLK_START (32 | SDMMC_CMD_R1) +/** SD Cmd33(ac, R1): */ +#define SD_CMD33_ERASE_WR_BLK_END (33 | SDMMC_CMD_R1) +/** MMC Cmd35(ac, R1): */ +#define MMC_CMD35_ERASE_GROUP_START (35 | SDMMC_CMD_R1) +/** MMC Cmd36(ac, R1): */ +#define MMC_CMD36_ERASE_GROUP_END (36 | SDMMC_CMD_R1) +/** Cmd38(ac, R1B): */ +#define SDMMC_CMD38_ERASE (38 | SDMMC_CMD_R1B) + +/* + * --- Block Oriented Write Protection Commands (class 6) --- + */ +/** Cmd28(ac, R1b): Set write protection */ +#define SDMMC_CMD28_SET_WRITE_PROT (28 | SDMMC_CMD_R1B) +/** Cmd29(ac, R1b): Clr write protection */ +#define SDMMC_CMD29_CLR_WRITE_PROT (29 | SDMMC_CMD_R1B) +/** Cmd30(adtc, R1b): Send write protection */ +#define SDMMC_CMD30_SEND_WRITE_PROT (30 | SDMMC_CMD_R1) + +/* + * --- Lock Card (class 7) --- + */ +/** Cmd42(adtc, R1): Used to set/reset the password or lock/unlock the card. */ +#define SDMMC_CMD42_LOCK_UNLOCK (42 | SDMMC_CMD_R1) + +/* + * --- Application-specific commands (class 8) --- + */ +/** + * Cmd55(ac, R1): Indicate to the card that the next command is an application + * specific command rather than a standard command. + */ +#define SDMMC_CMD55_APP_CMD (55 | SDMMC_CMD_R1) +/** + * Cmd 56(adtc, R1): Used either to transfer a data block to the card or to get + * a data block from the card for general purpose/application specific commands. + */ +#define SDMMC_CMD56_GEN_CMD (56 | SDMMC_CMD_R1) + +/** + * MMC Cmd6(ac, R1b) : Switche the mode of operation of the selected card + * or modifies the EXT_CSD registers. + */ +#define MMC_CMD6_SWITCH (6 | SDMMC_CMD_R1B) +/** + * SD Cmd6(adtc, R1) : Check switchable function (mode 0) + * and switch card function (mode 1). + */ +#define SD_CMD6_SWITCH_FUNC (6 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK) +/** ACMD6(ac, R1): Define the data bus width */ +#define SD_ACMD6_SET_BUS_WIDTH (6 | SDMMC_CMD_R1) +/** ACMD13(adtc, R1): Send the SD Status. */ +#define SD_ACMD13_SD_STATUS (13 | SDMMC_CMD_R1) +/** + * ACMD22(adtc, R1): Send the number of the written (with-out errors) write + * blocks. + */ +#define SD_ACMD22_SEND_NUM_WR_BLOCKS (22 | SDMMC_CMD_R1) +/** + * ACMD23(ac, R1): Set the number of write blocks to be pre-erased before + * writing + */ +#define SD_ACMD23_SET_WR_BLK_ERASE_COUNT (23 | SDMMC_CMD_R1) +/** + * ACMD41(bcr, R3): Send host capacity support information (HCS) and asks the + * accessed card to send its operating condition register (OCR) content + * in the response + */ +#define SD_MCI_ACMD41_SD_SEND_OP_COND (41 | SDMMC_CMD_R3 | SDMMC_CMD_OPENDRAIN) +/** + * ACMD41(R1): Send host capacity support information (HCS) and activates the + * card's initilization process + */ +#define SD_SPI_ACMD41_SD_SEND_OP_COND (41 | SDMMC_CMD_R1) +/** + * ACMD42(ac, R1): Connect[1]/Disconnect[0] the 50 KOhm pull-up resistor on + * CD/DAT3 (pin 1) of the card. + */ +#define SD_ACMD42_SET_CLR_CARD_DETECT (42 | SDMMC_CMD_R1) +/** ACMD51(adtc, R1): Read the SD Configuration Register (SCR). */ +#define SD_ACMD51_SEND_SCR (51 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK) + +/* + * --- I/O mode commands (class 9) --- + */ +/** MMC Cmd39(ac, R4): Used to write and read 8 bit (register) data fields. */ +#define MMC_CMD39_FAST_IO (39 | SDMMC_CMD_R4) +/** MMC Cmd40(bcr, R5): Set the system into interrupt mode */ +#define MMC_CMD40_GO_IRQ_STATE (40 | SDMMC_CMD_R5 | SDMMC_CMD_OPENDRAIN) +/** SDIO Cmd5(R4): Send operation condition */ +#define SDIO_CMD5_SEND_OP_COND (5 | SDMMC_CMD_R4 | SDMMC_CMD_OPENDRAIN) +/** SDIO CMD52(R5): Direct IO read/write */ +#define SDIO_CMD52_IO_RW_DIRECT (52 | SDMMC_CMD_R5) +/** SDIO CMD53(R5): Extended IO read/write */ +#define SDIO_CMD53_IO_R_BYTE_EXTENDED (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BYTE) +#define SDIO_CMD53_IO_W_BYTE_EXTENDED (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BYTE | SDMMC_CMD_WRITE) +#define SDIO_CMD53_IO_R_BLOCK_EXTENDED (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BLOCK) +#define SDIO_CMD53_IO_W_BLOCK_EXTENDED (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BLOCK | SDMMC_CMD_WRITE) +//! @} +//! @} + +//! \name Macros for command argument definition +//! @{ + +//! \name MMC CMD6 argument structure +//! @{ +//! [31:26] Set to 0 +//! [25:24] Access +#define MMC_CMD6_ACCESS_COMMAND_SET (0lu << 24) +#define MMC_CMD6_ACCESS_SET_BITS (1lu << 24) +#define MMC_CMD6_ACCESS_CLEAR_BITS (2lu << 24) +#define MMC_CMD6_ACCESS_WRITE_BYTE (3lu << 24) +//! [23:16] Index for Mode Segment +#define MMC_CMD6_INDEX_CMD_SET (EXT_CSD_CMD_SET_INDEX << 16) +#define MMC_CMD6_INDEX_CMD_SET_REV (EXT_CSD_CMD_SET_REV_INDEX << 16) +#define MMC_CMD6_INDEX_POWER_CLASS (EXT_CSD_POWER_CLASS_INDEX << 16) +#define MMC_CMD6_INDEX_HS_TIMING (EXT_CSD_HS_TIMING_INDEX << 16) +#define MMC_CMD6_INDEX_BUS_WIDTH (EXT_CSD_BUS_WIDTH_INDEX << 16) +#define MMC_CMD6_INDEX_ERASED_MEM_CONT (EXT_CSD_ERASED_MEM_CONT_INDEX << 16) +#define MMC_CMD6_INDEX_BOOT_CONFIG (EXT_CSD_BOOT_CONFIG_INDEX << 16) +#define MMC_CMD6_INDEX_BOOT_BUS_WIDTH (EXT_CSD_BOOT_BUS_WIDTH_INDEX << 16) +#define MMC_CMD6_INDEX_ERASE_GROUP_DEF (EXT_CSD_ERASE_GROUP_DEF_INDEX << 16) +//! [15:8] Value +#define MMC_CMD6_VALUE_BUS_WIDTH_1BIT (0x0lu << 8) +#define MMC_CMD6_VALUE_BUS_WIDTH_4BIT (0x1lu << 8) +#define MMC_CMD6_VALUE_BUS_WIDTH_8BIT (0x2lu << 8) +#define MMC_CMD6_VALUE_HS_TIMING_ENABLE (0x1lu << 8) +#define MMC_CMD6_VALUE_HS_TIMING_DISABLE (0x0lu << 8) +//! [7:3] Set to 0 +//! [2:0] Cmd Set +//! @} + +//! \name SD CMD6 argument structure +//! @{ +//! CMD6 arg[ 3: 0] function group 1, access mode +#define SD_CMD6_GRP1_HIGH_SPEED (0x1lu << 0) +#define SD_CMD6_GRP1_DEFAULT (0x0lu << 0) +//! CMD6 arg[ 7: 4] function group 2, command system +#define SD_CMD6_GRP2_NO_INFLUENCE (0xFlu << 4) +#define SD_CMD6_GRP2_DEFAULT (0x0lu << 4) +//! CMD6 arg[11: 8] function group 3, 0xF or 0x0 +#define SD_CMD6_GRP3_NO_INFLUENCE (0xFlu << 8) +#define SD_CMD6_GRP3_DEFAULT (0x0lu << 8) +//! CMD6 arg[15:12] function group 4, 0xF or 0x0 +#define SD_CMD6_GRP4_NO_INFLUENCE (0xFlu << 12) +#define SD_CMD6_GRP4_DEFAULT (0x0lu << 12) +//! CMD6 arg[19:16] function group 5, 0xF or 0x0 +#define SD_CMD6_GRP5_NO_INFLUENCE (0xFlu << 16) +#define SD_CMD6_GRP5_DEFAULT (0x0lu << 16) +//! CMD6 arg[23:20] function group 6, 0xF or 0x0 +#define SD_CMD6_GRP6_NO_INFLUENCE (0xFlu << 20) +#define SD_CMD6_GRP6_DEFAULT (0x0lu << 20) +//! CMD6 arg[30:24] reserved 0 +//! CMD6 arg[31 ] Mode, 0: Check, 1: Switch +#define SD_CMD6_MODE_CHECK (0lu << 31) +#define SD_CMD6_MODE_SWITCH (1lu << 31) +//! @} + +//! \name SD CMD8 argument structure +//! @{ +#define SD_CMD8_PATTERN 0xAA +#define SD_CMD8_MASK_PATTERN 0xFF +#define SD_CMD8_HIGH_VOLTAGE 0x100 +#define SD_CMD8_MASK_VOLTAGE 0xF00 +//! @} + +//! \name SD ACMD41 arguments +//! @{ +#define SD_ACMD41_HCS (1lu << 30) //!< (SD) Host Capacity Support + //! @} +//! @} + +//! \name SDIO definitions +//! @{ + +//! \name SDIO state (in R5) +//! @{ +#define SDIO_R5_COM_CRC_ERROR (1lu << 15) /**< CRC check error */ +#define SDIO_R5_ILLEGAL_COMMAND (1lu << 14) /**< Illegal command */ +#define SDIO_R5_STATE (3lu << 12) /**< SDIO R5 state mask */ +#define SDIO_R5_STATE_DIS (0lu << 12) /**< Disabled */ +#define SDIO_R5_STATE_CMD (1lu << 12) /**< DAT lines free */ +#define SDIO_R5_STATE_TRN (2lu << 12) /**< Transfer */ +#define SDIO_R5_STATE_RFU (3lu << 12) /**< Reserved */ +#define SDIO_R5_ERROR (1lu << 11) /**< General error */ +#define SDIO_R5_FUNC_NUM (1lu << 9) /**< Invalid function number */ +#define SDIO_R5_OUT_OF_RANGE (1lu << 8) /**< Argument out of range */ +#define SDIO_R5_STATUS_ERR (SDIO_R5_ERROR | SDIO_R5_FUNC_NUM | SDIO_R5_OUT_OF_RANGE) //!< Errro status bits mask + //! @} + +//! \name SDIO state (in R6) +//! @{ +/** The CRC check of the previous command failed. */ +#define SDIO_R6_COM_CRC_ERROR (1lu << 15) +/** Command not legal for the card state. */ +#define SDIO_R6_ILLEGAL_COMMAND (1lu << 14) +/** A general or an unknown error occurred during the operation. */ +#define SDIO_R6_ERROR (1lu << 13) +/** Status bits mask for SDIO R6 */ +#define SDIO_STATUS_R6 (SDIO_R6_COM_CRC_ERROR | SDIO_R6_ILLEGAL_COMMAND | SDIO_R6_ERROR) +//! @} + +//! \name SDIO CMD52 argument bit offset +//! @{ +//! CMD52 arg[ 7: 0] Write data or stuff bits +#define SDIO_CMD52_WR_DATA 0 +//! CMD52 arg[ 8] Reserved +#define SDIO_CMD52_STUFF0 8 +//! CMD52 arg[25: 9] Register address +#define SDIO_CMD52_REG_ADRR 9 +//! CMD52 arg[ 26] Reserved +#define SDIO_CMD52_STUFF1 26 +//! CMD52 arg[ 27] Read after Write flag +#define SDIO_CMD52_RAW_FLAG 27 +//! CMD52 arg[30:28] Number of the function +#define SDIO_CMD52_FUNCTION_NUM 28 +//! CMD52 arg[ 31] Direction, 1:write, 0:read. +#define SDIO_CMD52_RW_FLAG 31 +#define SDIO_CMD52_READ_FLAG 0 +#define SDIO_CMD52_WRITE_FLAG 1 +//! @} + +//! \name SDIO CMD53 argument structure +//! @{ +/** + * [ 8: 0] Byte mode: number of bytes to transfer, + * 0 cause 512 bytes transfer. + * Block mode: number of blocks to transfer, + * 0 set count to infinite. + */ +#define SDIO_CMD53_COUNT 0 +//! CMD53 arg[25: 9] Start Address I/O register +#define SDIO_CMD53_REG_ADDR 9 +//! CMD53 arg[ 26] 1:Incrementing address, 0: fixed +#define SDIO_CMD53_OP_CODE 26 +//! CMD53 arg[ 27] (Optional) 1:block mode +#define SDIO_CMD53_BLOCK_MODE 27 +//! CMD53 arg[30:28] Number of the function +#define SDIO_CMD53_FUNCTION_NUM 28 +//! CMD53 arg[ 31] Direction, 1:WR, 0:RD +#define SDIO_CMD53_RW_FLAG 31 +#define SDIO_CMD53_READ_FLAG 0 +#define SDIO_CMD53_WRITE_FLAG 1 +//! @} + +//! \name SDIO Functions +//! @{ +#define SDIO_CIA 0 /**< SDIO Function 0 (CIA) */ +#define SDIO_FN0 0 /**< SDIO Function 0 */ +#define SDIO_FN1 1 /**< SDIO Function 1 */ +#define SDIO_FN2 2 /**< SDIO Function 2 */ +#define SDIO_FN3 3 /**< SDIO Function 3 */ +#define SDIO_FN4 4 /**< SDIO Function 4 */ +#define SDIO_FN5 5 /**< SDIO Function 5 */ +#define SDIO_FN6 6 /**< SDIO Function 6 */ +#define SDIO_FN7 7 /**< SDIO Function 7 */ + //! @} + +//! \name SDIO Card Common Control Registers (CCCR) +//! @{ +#define SDIO_CCCR_SDIO_REV 0x00 /**< CCCR/SDIO revision (RO) */ +#define SDIO_CCCR_REV (0xFlu << 0) /**< CCCR/FBR Version */ +#define SDIO_CCCR_REV_1_00 (0x0lu << 0) /**< CCCR/FBR Version 1.00 */ +#define SDIO_CCCR_REV_1_10 (0x1lu << 0) /**< CCCR/FBR Version 1.10 */ +#define SDIO_CCCR_REV_2_00 (0x2lu << 0) /**< CCCR/FBR Version 2.00 */ +#define SDIO_CCCR_REV_3_00 (0x3lu << 0) /**< CCCR/FBR Version 3.00 */ +#define SDIO_SDIO_REV (0xFlu << 4) /**< SDIO Spec */ +#define SDIO_SDIO_REV_1_00 (0x0lu << 4) /**< SDIO Spec 1.00 */ +#define SDIO_SDIO_REV_1_10 (0x1lu << 4) /**< SDIO Spec 1.10 */ +#define SDIO_SDIO_REV_1_20 (0x2lu << 4) /**< SDIO Spec 1.20(unreleased) */ +#define SDIO_SDIO_REV_2_00 (0x3lu << 4) /**< SDIO Spec Version 2.00 */ +#define SDIO_SDIO_REV_3_00 (0x4lu << 4) /**< SDIO Spec Version 3.00 */ +#define SDIO_CCCR_SD_REV 0x01 /**< SD Spec Revision (RO) */ +#define SDIO_SD_REV (0xFlu << 0) /**< SD Physical Spec */ +#define SDIO_SD_REV_1_01 (0x0lu << 0) /**< SD 1.01 (Mar 2000) */ +#define SDIO_SD_REV_1_10 (0x1lu << 0) /**< SD 1.10 (Oct 2004) */ +#define SDIO_SD_REV_2_00 (0x2lu << 0) /**< SD 2.00 (May 2006) */ +#define SDIO_SD_REV_3_00 (0x3lu << 0) /**< SD 3.00 */ +#define SDIO_CCCR_IOE 0x02 /**< I/O Enable (R/W) */ +#define SDIO_IOE (0xFElu << 1) /**< Functions Enable/Disable */ +#define SDIO_IOE_FN1 (0x1lu << 1) /**< Function 1 Enable/Disable */ +#define SDIO_IOE_FN2 (0x1lu << 2) /**< Function 2 Enable/Disable */ +#define SDIO_IOE_FN3 (0x1lu << 3) /**< Function 3 Enable/Disable */ +#define SDIO_IOE_FN4 (0x1lu << 4) /**< Function 4 Enable/Disable */ +#define SDIO_IOE_FN5 (0x1lu << 5) /**< Function 5 Enable/Disable */ +#define SDIO_IOE_FN6 (0x1lu << 6) /**< Function 6 Enable/Disable */ +#define SDIO_IOE_FN7 (0x1lu << 7) /**< Function 7 Enable/Disable */ +#define SDIO_CCCR_IOR 0x03 /**< I/O Ready (RO) */ +#define SDIO_IOR (0xFElu << 1) /**< Functions ready */ +#define SDIO_IOR_FN1 (0x1lu << 1) /**< Function 1 ready */ +#define SDIO_IOR_FN2 (0x1lu << 2) /**< Function 2 ready */ +#define SDIO_IOR_FN3 (0x1lu << 3) /**< Function 3 ready */ +#define SDIO_IOR_FN4 (0x1lu << 4) /**< Function 4 ready */ +#define SDIO_IOR_FN5 (0x1lu << 5) /**< Function 5 ready */ +#define SDIO_IOR_FN6 (0x1lu << 6) /**< Function 6 ready */ +#define SDIO_IOR_FN7 (0x1lu << 7) /**< Function 7 ready */ +#define SDIO_CCCR_IEN 0x04 /**< Int Enable */ +#define SDIO_IENM (0x1lu << 0) /**< Int Enable Master (R/W) */ +#define SDIO_IEN (0xFElu << 1) /**< Functions Int Enable */ +#define SDIO_IEN_FN1 (0x1lu << 1) /**< Function 1 Int Enable */ +#define SDIO_IEN_FN2 (0x1lu << 2) /**< Function 2 Int Enable */ +#define SDIO_IEN_FN3 (0x1lu << 3) /**< Function 3 Int Enable */ +#define SDIO_IEN_FN4 (0x1lu << 4) /**< Function 4 Int Enable */ +#define SDIO_IEN_FN5 (0x1lu << 5) /**< Function 5 Int Enable */ +#define SDIO_IEN_FN6 (0x1lu << 6) /**< Function 6 Int Enable */ +#define SDIO_IEN_FN7 (0x1lu << 7) /**< Function 7 Int Enable */ +#define SDIO_CCCR_INT 0x05 /**< Int Pending */ +#define SDIO_INT (0xFElu << 1) /**< Functions Int pending */ +#define SDIO_INT_FN1 (0x1lu << 1) /**< Function 1 Int pending */ +#define SDIO_INT_FN2 (0x1lu << 2) /**< Function 2 Int pending */ +#define SDIO_INT_FN3 (0x1lu << 3) /**< Function 3 Int pending */ +#define SDIO_INT_FN4 (0x1lu << 4) /**< Function 4 Int pending */ +#define SDIO_INT_FN5 (0x1lu << 5) /**< Function 5 Int pending */ +#define SDIO_INT_FN6 (0x1lu << 6) /**< Function 6 Int pending */ +#define SDIO_INT_FN7 (0x1lu << 7) /**< Function 7 Int pending */ +#define SDIO_CCCR_IOA 0x06 /**< I/O Abort */ +#define SDIO_AS (0x7lu << 0) /**< Abort Select In Order (WO) */ +#define SDIO_AS_FN1 (0x1lu << 0) /**< Abort function 1 IO */ +#define SDIO_AS_FN2 (0x2lu << 0) /**< Abort function 2 IO */ +#define SDIO_AS_FN3 (0x3lu << 0) /**< Abort function 3 IO */ +#define SDIO_AS_FN4 (0x4lu << 0) /**< Abort function 4 IO */ +#define SDIO_AS_FN5 (0x5lu << 0) /**< Abort function 5 IO */ +#define SDIO_AS_FN6 (0x6lu << 0) /**< Abort function 6 IO */ +#define SDIO_AS_FN7 (0x7lu << 0) /**< Abort function 7 IO */ +#define SDIO_RES (0x1lu << 3) /**< IO CARD RESET (WO) */ +#define SDIO_CCCR_BUS_CTRL 0x07 /**< Bus Interface Control */ +#define SDIO_BUSWIDTH (0x3lu << 0) /**< Data bus width (R/W) */ +#define SDIO_BUSWIDTH_1B (0x0lu << 0) /**< 1-bit data bus */ +#define SDIO_BUSWIDTH_4B (0x2lu << 0) /**< 4-bit data bus */ +/** Enable Continuous SPI interrupt (R/W) */ +#define SDIO_BUS_ECSI (0x1lu << 5) +/** Support Continuous SPI interrupt (RO) */ +#define SDIO_BUS_SCSI (0x1lu << 6) +/** Connect(0)/Disconnect(1) pull-up on CD/DAT[3] (R/W) */ +#define SDIO_BUS_CD_DISABLE (0x1lu << 7) +#define SDIO_CCCR_CAP 0x08 /**< Card Capability */ +/** Support Direct Commands during data transfer (RO) */ +#define SDIO_CAP_SDC (0x1lu << 0) +/** Support Multi-Block (RO) */ +#define SDIO_CAP_SMB (0x1lu << 1) +/** Support Read Wait (RO) */ +#define SDIO_CAP_SRW (0x1lu << 2) +/** Support Suspend/Resume (RO) */ +#define SDIO_CAP_SBS (0x1lu << 3) +/** Support interrupt between blocks of data in 4-bit SD mode (RO) */ +#define SDIO_CAP_S4MI (0x1lu << 4) +/** Enable interrupt between blocks of data in 4-bit SD mode (R/W) */ +#define SDIO_CAP_E4MI (0x1lu << 5) +/** Low-Speed Card (RO) */ +#define SDIO_CAP_LSC (0x1lu << 6) +/** 4-bit support for Low-Speed Card (RO) */ +#define SDIO_CAP_4BLS (0x1lu << 7) +/** Pointer to CIS (3B, LSB first) */ +#define SDIO_CCCR_CIS_PTR 0x09 +/** Bus Suspend */ +#define SDIO_CCCR_BUS_SUSPEND 0x0C +/** Bus Status (transfer on DAT[x] lines) (RO) */ +#define SDIO_BS (0x1lu << 0) +/** Bus Release Request/Status (R/W) */ +#define SDIO_BR (0x1lu << 1) +#define SDIO_CCCR_FUN_SEL 0x0D /**< Function select */ +#define SDIO_DF (0x1lu << 7) /**< Resume Data Flag (RO) */ +#define SDIO_FS (0xFlu << 0) /**< Select Function (R/W) */ +#define SDIO_FS_CIA (0x0lu << 0) /**< Select CIA (function 0) */ +#define SDIO_FS_FN1 (0x1lu << 0) /**< Select Function 1 */ +#define SDIO_FS_FN2 (0x2lu << 0) /**< Select Function 2 */ +#define SDIO_FS_FN3 (0x3lu << 0) /**< Select Function 3 */ +#define SDIO_FS_FN4 (0x4lu << 0) /**< Select Function 4 */ +#define SDIO_FS_FN5 (0x5lu << 0) /**< Select Function 5 */ +#define SDIO_FS_FN6 (0x6lu << 0) /**< Select Function 6 */ +#define SDIO_FS_FN7 (0x7lu << 0) /**< Select Function 7 */ +#define SDIO_FS_MEM (0x8lu << 0) /**< Select memory in combo card */ +#define SDIO_CCCR_EXEC 0x0E /**< Exec Flags (RO) */ +#define SDIO_EXM (0x1lu << 0) /**< Executing status of memory */ +#define SDIO_EX (0xFElu << 1) /**< Executing functions status */ +#define SDIO_EX_FN1 (0x1lu << 1) /**< Executing status of func 1 */ +#define SDIO_EX_FN2 (0x1lu << 2) /**< Executing status of func 2 */ +#define SDIO_EX_FN3 (0x1lu << 3) /**< Executing status of func 3 */ +#define SDIO_EX_FN4 (0x1lu << 4) /**< Executing status of func 4 */ +#define SDIO_EX_FN5 (0x1lu << 5) /**< Executing status of func 5 */ +#define SDIO_EX_FN6 (0x1lu << 6) /**< Executing status of func 6 */ +#define SDIO_EX_FN7 (0x1lu << 7) /**< Executing status of func 7 */ +#define SDIO_CCCR_READY 0x0F /**< Ready Flags (RO) */ +#define SDIO_RFM (0x1lu << 0) /**< Ready Flag for memory */ +#define SDIO_RF (0xFElu) /**< Ready Flag for functions */ +#define SDIO_RF_FN1 (0x1lu << 1) /**< Ready Flag for function 1 */ +#define SDIO_RF_FN2 (0x1lu << 2) /**< Ready Flag for function 2 */ +#define SDIO_RF_FN3 (0x1lu << 3) /**< Ready Flag for function 3 */ +#define SDIO_RF_FN4 (0x1lu << 4) /**< Ready Flag for function 4 */ +#define SDIO_RF_FN5 (0x1lu << 5) /**< Ready Flag for function 5 */ +#define SDIO_RF_FN6 (0x1lu << 6) /**< Ready Flag for function 6 */ +#define SDIO_RF_FN7 (0x1lu << 7) /**< Ready Flag for function 7 */ +#define SDIO_CCCR_FN0_BLKSIZ 0x10 /**< FN0 Block Size (2B, LSB first) (R/W) */ +#define SDIO_CCCR_POWER 0x12 /**< Power Control */ +#define SDIO_SMPC (0x1lu << 0) /**< Support Master Power Control*/ +#define SDIO_EMPC (0x1lu << 1) /**< Enable Master Power Control */ +#define SDIO_CCCR_HS 0x13 /**< High-Speed */ +#define SDIO_SHS (0x1lu << 0) /**< Support High-Speed (RO) */ +#define SDIO_EHS (0x1lu << 1) /**< Enable High-Speed (R/W) */ + //! @} + +//! \name SDIO Function Basic Registers (FBR) +//! @{ +#define SDIO_FBR_ADDR(fn, x) (0x100 * (fn) + (x)) +#define SDIO_FBR_CSA_IF 0x0 /**< CSA and function interface code (RO) */ +#define SDIO_IFC (0xFUL << 0) /**< Standard SDIO Fun Interface Code */ +#define SDIO_IFC_NO_IF (0x0UL << 0) /**< No SDIO standard interface */ +#define SDIO_IFC_UART (0x1UL << 0) /**< UART */ +#define SDIO_IFC_TA_BT (0x2UL << 0) /**< Type-A Bluetooth */ +#define SDIO_IFC_TB_BT (0x3UL << 0) /**< Type-B Bluetooth */ +#define SDIO_IFC_GPS (0x4UL << 0) /**< GPS */ +#define SDIO_IFC_CAMERA (0x5UL << 0) /**< Camera */ +#define SDIO_IFC_PHS (0x6UL << 0) /**< PHS */ +#define SDIO_IFC_WLAN (0x7UL << 0) /**< WLAN */ +#define SDIO_IFC_ATA (0x8UL << 0) /**< Embedded SDIO-ATA */ +#define SDIO_IFC_EXT (0xFUL << 0) /**< Check EXT interface code */ +#define SDIO_SCSA (0x1UL << 6) /**< Function supports Code Storage Area (CSA) */ +#define SDIO_FBR_CSA (0x1UL << 7) /**< Function CSA enable */ +#define SDIO_FBR_EXT_IF 0x1 /**< Extended function interface code (RO) */ +#define SDIO_FBR_PWR 0x2 /**< function power control */ +#define SDIO_SPS (0x1UL << 0) /**< function support power selection (RO) */ +#define SDIO_EPS (0x1UL << 1) /**< Low Current Mode/High Current Mode (R/W) */ +#define SDIO_FBR_CIS_PTR 0x9 /**< Address pointer to function CIS (3B, LSB first) (RO) */ +#define SDIO_FBR_CSA_PTR 0xC /**< Address pointer to CSA (3B, LSB first) (R/W) */ +#define SDIO_FBR_CSA_DATA 0xF /**< Read/Write fifo to CSA (R/W) */ +#define SDIO_FBR_BLK_SIZ 0x10 /**< Block size (2B, LSB first) (R/W) */ + //! @} + +//! \name SDIO Card Metaformat +//! @{ +/** Null tuple (PCMCIA 3.1.9) */ +#define SDIO_CISTPL_NULL 0x00 +/** Device tuple (PCMCIA 3.2.2) */ +#define SDIO_CISTPL_DEVICE 0x01 +/** Checksum control (PCMCIA 3.1.1) */ +#define SDIO_CISTPL_CHECKSUM 0x10 +/** Level 1 version (PCMCIA 3.2.10) */ +#define SDIO_CISTPL_VERS_1 0x15 +/** Alternate Language String (PCMCIA 3.2.1) */ +#define SDIO_CISTPL_ALTSTR 0x16 +/** Manufacturer Identification String (PCMCIA 3.2.9) */ +#define SDIO_CISTPL_MANFID 0x20 +/** Function Identification (PCMCIA 3.2.7) */ +#define SDIO_CISTPL_FUNCID 0x21 +/** Function Extensions (PCMCIA 3.2.6) */ +#define SDIO_CISTPL_FUNCE 0x22 +/** Additional information for SDIO (PCMCIA 6.1.2) */ +#define SDIO_CISTPL_SDIO_STD 0x91 +/** Reserved for future SDIO (PCMCIA 6.1.3) */ +#define SDIO_CISTPL_SDIO_EXT 0x92 +/** The End-of-chain Tuple (PCMCIA 3.1.2) */ +#define SDIO_CISTPL_END 0xFF +//! @} + +//! @} + +//! \name CSD, OCR, SCR, Switch status, extend CSD definitions +//! @{ + +/** + * \brief Macro function to extract a bits field from a large SD MMC register + * Used by : CSD, SCR, Switch status + */ +static inline uint32_t SDMMC_UNSTUFF_BITS(uint8_t *reg, uint16_t reg_size, uint16_t pos, uint8_t size) +{ + uint32_t value; + value = reg[((reg_size - pos + 7) / 8) - 1] >> (pos % 8); + if (((pos % 8) + size) > 8) { + value |= (uint32_t)reg[((reg_size - pos + 7) / 8) - 2] << (8 - (pos % 8)); + } + if (((pos % 8) + size) > 16) { + value |= (uint32_t)reg[((reg_size - pos + 7) / 8) - 3] << (16 - (pos % 8)); + } + if (((pos % 8) + size) > 24) { + value |= (uint32_t)reg[((reg_size - pos + 7) / 8) - 3] << (24 - (pos % 8)); + } + value &= ((uint32_t)1 << size) - 1; + return value; +} + + //! \name CSD Fields + //! @{ +#define CSD_REG_BIT_SIZE 128 //!< 128 bits +#define CSD_REG_BSIZE (CSD_REG_BIT_SIZE / 8) //!< 16 bytes +#define CSD_STRUCTURE(csd, pos, size) SDMMC_UNSTUFF_BITS(csd, CSD_REG_BIT_SIZE, pos, size) +#define CSD_STRUCTURE_VERSION(csd) CSD_STRUCTURE(csd, 126, 2) +#define SD_CSD_VER_1_0 0 +#define SD_CSD_VER_2_0 1 +#define MMC_CSD_VER_1_0 0 +#define MMC_CSD_VER_1_1 1 +#define MMC_CSD_VER_1_2 2 +#define CSD_TRAN_SPEED(csd) CSD_STRUCTURE(csd, 96, 8) +#define SD_CSD_1_0_C_SIZE(csd) CSD_STRUCTURE(csd, 62, 12) +#define SD_CSD_1_0_C_SIZE_MULT(csd) CSD_STRUCTURE(csd, 47, 3) +#define SD_CSD_1_0_READ_BL_LEN(csd) CSD_STRUCTURE(csd, 80, 4) +#define SD_CSD_2_0_C_SIZE(csd) CSD_STRUCTURE(csd, 48, 22) +#define MMC_CSD_C_SIZE(csd) CSD_STRUCTURE(csd, 62, 12) +#define MMC_CSD_C_SIZE_MULT(csd) CSD_STRUCTURE(csd, 47, 3) +#define MMC_CSD_READ_BL_LEN(csd) CSD_STRUCTURE(csd, 80, 4) +#define MMC_CSD_SPEC_VERS(csd) CSD_STRUCTURE(csd, 122, 4) + //! @} + + //! \name OCR Register Fields + //! @{ +#define OCR_REG_BSIZE (32 / 8) /**< 32 bits, 4 bytes */ +#define OCR_VDD_170_195 (1lu << 7) +#define OCR_VDD_20_21 (1lu << 8) +#define OCR_VDD_21_22 (1lu << 9) +#define OCR_VDD_22_23 (1lu << 10) +#define OCR_VDD_23_24 (1lu << 11) +#define OCR_VDD_24_25 (1lu << 12) +#define OCR_VDD_25_26 (1lu << 13) +#define OCR_VDD_26_27 (1lu << 14) +#define OCR_VDD_27_28 (1lu << 15) +#define OCR_VDD_28_29 (1lu << 16) +#define OCR_VDD_29_30 (1lu << 17) +#define OCR_VDD_30_31 (1lu << 18) +#define OCR_VDD_31_32 (1lu << 19) +#define OCR_VDD_32_33 (1lu << 20) +#define OCR_VDD_33_34 (1lu << 21) +#define OCR_VDD_34_35 (1lu << 22) +#define OCR_VDD_35_36 (1lu << 23) +#define OCR_SDIO_S18R (1lu << 24) /**< Switching to 1.8V Accepted */ +#define OCR_SDIO_MP (1lu << 27) /**< Memory Present */ +#define OCR_SDIO_NF (7lu << 28) /**< Number of I/O Functions */ +#define OCR_ACCESS_MODE_MASK (3lu << 29) /**< (MMC) Access mode mask */ +#define OCR_ACCESS_MODE_BYTE (0lu << 29) /**< (MMC) Byte access mode */ +#define OCR_ACCESS_MODE_SECTOR (2lu << 29) /**< (MMC) Sector access mode */ +#define OCR_CCS (1lu << 30) /**< (SD) Card Capacity Status */ +#define OCR_POWER_UP_BUSY (1lu << 31) /**< Card power up status bit */ + //! @} + + //! \name SD SCR Register Fields + //! @{ +#define SD_SCR_REG_BIT_SIZE 64 //!< 64 bits +#define SD_SCR_REG_BSIZE (SD_SCR_REG_BIT_SIZE / 8) //!< 8 bytes +#define SD_SCR_STRUCTURE(scr, pos, size) SDMMC_UNSTUFF_BITS(scr, SD_SCR_REG_BIT_SIZE, pos, size) +#define SD_SCR_SCR_STRUCTURE(scr) SD_SCR_STRUCTURE(scr, 60, 4) +#define SD_SCR_SCR_STRUCTURE_1_0 0 +#define SD_SCR_SD_SPEC(scr) SD_SCR_STRUCTURE(scr, 56, 4) +#define SD_SCR_SD_SPEC_1_0_01 0 +#define SD_SCR_SD_SPEC_1_10 1 +#define SD_SCR_SD_SPEC_2_00 2 +#define SD_SCR_DATA_STATUS_AFTER_ERASE(scr) SD_SCR_STRUCTURE(scr, 55, 1) +#define SD_SCR_SD_SECURITY(scr) SD_SCR_STRUCTURE(scr, 52, 3) +#define SD_SCR_SD_SECURITY_NO 0 +#define SD_SCR_SD_SECURITY_NOTUSED 1 +#define SD_SCR_SD_SECURITY_1_01 2 +#define SD_SCR_SD_SECURITY_2_00 3 +#define SD_SCR_SD_SECURITY_3_00 4 +#define SD_SCR_SD_BUS_WIDTHS(scr) SD_SCR_STRUCTURE(scr, 48, 4) +#define SD_SCR_SD_BUS_WIDTH_1BITS (1lu << 0) +#define SD_SCR_SD_BUS_WIDTH_4BITS (1lu << 2) +#define SD_SCR_SD_SPEC3(scr) SD_SCR_STRUCTURE(scr, 47, 1) +#define SD_SCR_SD_SPEC_3_00 1 +#define SD_SCR_SD_EX_SECURITY(scr) SD_SCR_STRUCTURE(scr, 43, 4) +#define SD_SCR_SD_CMD_SUPPORT(scr) SD_SCR_STRUCTURE(scr, 32, 2) + //! @} + + //! \name SD Switch Status Fields + //! @{ +#define SD_SW_STATUS_BIT_SIZE 512 //!< 512 bits +#define SD_SW_STATUS_BSIZE (SD_SW_STATUS_BIT_SIZE / 8) //!< 64 bytes +#define SD_SW_STATUS_STRUCTURE(sd_sw_status, pos, size) \ + SDMMC_UNSTUFF_BITS(sd_sw_status, SD_SW_STATUS_BIT_SIZE, pos, size) +#define SD_SW_STATUS_MAX_CURRENT_CONSUMPTION(status) SD_SW_STATUS_STRUCTURE(status, 496, 16) +#define SD_SW_STATUS_FUN_GRP6_INFO(status) SD_SW_STATUS_STRUCTURE(status, 480, 16) +#define SD_SW_STATUS_FUN_GRP5_INFO(status) SD_SW_STATUS_STRUCTURE(status, 464, 16) +#define SD_SW_STATUS_FUN_GRP4_INFO(status) SD_SW_STATUS_STRUCTURE(status, 448, 16) +#define SD_SW_STATUS_FUN_GRP3_INFO(status) SD_SW_STATUS_STRUCTURE(status, 432, 16) +#define SD_SW_STATUS_FUN_GRP2_INFO(status) SD_SW_STATUS_STRUCTURE(status, 416, 16) +#define SD_SW_STATUS_FUN_GRP1_INFO(status) SD_SW_STATUS_STRUCTURE(status, 400, 16) +#define SD_SW_STATUS_FUN_GRP6_RC(status) SD_SW_STATUS_STRUCTURE(status, 396, 4) +#define SD_SW_STATUS_FUN_GRP5_RC(status) SD_SW_STATUS_STRUCTURE(status, 392, 4) +#define SD_SW_STATUS_FUN_GRP4_RC(status) SD_SW_STATUS_STRUCTURE(status, 388, 4) +#define SD_SW_STATUS_FUN_GRP3_RC(status) SD_SW_STATUS_STRUCTURE(status, 384, 4) +#define SD_SW_STATUS_FUN_GRP2_RC(status) SD_SW_STATUS_STRUCTURE(status, 380, 4) +#define SD_SW_STATUS_FUN_GRP1_RC(status) SD_SW_STATUS_STRUCTURE(status, 376, 4) +#define SD_SW_STATUS_FUN_GRP_RC_ERROR 0xFU +#define SD_SW_STATUS_DATA_STRUCT_VER(status) SD_SW_STATUS_STRUCTURE(status, 368, 8) +#define SD_SW_STATUS_FUN_GRP6_BUSY(status) SD_SW_STATUS_STRUCTURE(status, 352, 16) +#define SD_SW_STATUS_FUN_GRP5_BUSY(status) SD_SW_STATUS_STRUCTURE(status, 336, 16) +#define SD_SW_STATUS_FUN_GRP4_BUSY(status) SD_SW_STATUS_STRUCTURE(status, 320, 16) +#define SD_SW_STATUS_FUN_GRP3_BUSY(status) SD_SW_STATUS_STRUCTURE(status, 304, 16) +#define SD_SW_STATUS_FUN_GRP2_BUSY(status) SD_SW_STATUS_STRUCTURE(status, 288, 16) +#define SD_SW_STATUS_FUN_GRP1_BUSY(status) SD_SW_STATUS_STRUCTURE(status, 272, 16) + //! @} + + //! \name Card Status Fields + //! @{ +#define CARD_STATUS_APP_CMD (1lu << 5) +#define CARD_STATUS_SWITCH_ERROR (1lu << 7) +#define CARD_STATUS_READY_FOR_DATA (1lu << 8) +#define CARD_STATUS_STATE_IDLE (0lu << 9) +#define CARD_STATUS_STATE_READY (1lu << 9) +#define CARD_STATUS_STATE_IDENT (2lu << 9) +#define CARD_STATUS_STATE_STBY (3lu << 9) +#define CARD_STATUS_STATE_TRAN (4lu << 9) +#define CARD_STATUS_STATE_DATA (5lu << 9) +#define CARD_STATUS_STATE_RCV (6lu << 9) +#define CARD_STATUS_STATE_PRG (7lu << 9) +#define CARD_STATUS_STATE_DIS (8lu << 9) +#define CARD_STATUS_STATE (0xFlu << 9) +#define CARD_STATUS_ERASE_RESET (1lu << 13) +#define CARD_STATUS_WP_ERASE_SKIP (1lu << 15) +#define CARD_STATUS_CIDCSD_OVERWRITE (1lu << 16) +#define CARD_STATUS_OVERRUN (1lu << 17) +#define CARD_STATUS_UNERRUN (1lu << 18) +#define CARD_STATUS_ERROR (1lu << 19) +#define CARD_STATUS_CC_ERROR (1lu << 20) +#define CARD_STATUS_CARD_ECC_FAILED (1lu << 21) +#define CARD_STATUS_ILLEGAL_COMMAND (1lu << 22) +#define CARD_STATUS_COM_CRC_ERROR (1lu << 23) +#define CARD_STATUS_UNLOCK_FAILED (1lu << 24) +#define CARD_STATUS_CARD_IS_LOCKED (1lu << 25) +#define CARD_STATUS_WP_VIOLATION (1lu << 26) +#define CARD_STATUS_ERASE_PARAM (1lu << 27) +#define CARD_STATUS_ERASE_SEQ_ERROR (1lu << 28) +#define CARD_STATUS_BLOCK_LEN_ERROR (1lu << 29) +#define CARD_STATUS_ADDRESS_MISALIGN (1lu << 30) +#define CARD_STATUS_ADDR_OUT_OF_RANGE (1lu << 31) + +#define CARD_STATUS_ERR_RD_WR \ + (CARD_STATUS_ADDR_OUT_OF_RANGE | CARD_STATUS_ADDRESS_MISALIGN | CARD_STATUS_BLOCK_LEN_ERROR \ + | CARD_STATUS_WP_VIOLATION | CARD_STATUS_ILLEGAL_COMMAND | CARD_STATUS_CC_ERROR | CARD_STATUS_ERROR) + //! @} + + //! \name SD Status Field + //! @{ +#define SD_STATUS_BSIZE (512 / 8) /**< 512 bits, 64bytes */ + //! @} + + //! \name MMC Extended CSD Register Field + //! @{ +#define EXT_CSD_BSIZE 512 /**< 512 bytes. */ +/* Below belongs to Properties Segment */ +#define EXT_CSD_S_CMD_SET_INDEX 504lu +#define EXT_CSD_BOOT_INFO_INDEX 228lu +#define EXT_CSD_BOOT_SIZE_MULTI_INDEX 226lu +#define EXT_CSD_ACC_SIZE_INDEX 225lu +#define EXT_CSD_HC_ERASE_GRP_SIZE_INDEX 224lu +#define EXT_CSD_ERASE_TIMEOUT_MULT_INDEX 223lu +#define EXT_CSD_REL_WR_SEC_C_INDEX 222lu +#define EXT_CSD_HC_WP_GRP_SIZE_INDEX 221lu +#define EXT_CSD_S_C_VCC_INDEX 220lu +#define EXT_CSD_S_C_VCCQ_INDEX 219lu +#define EXT_CSD_S_A_TIMEOUT_INDEX 217lu +#define EXT_CSD_SEC_COUNT_INDEX 212lu +#define EXT_CSD_MIN_PERF_W_8_52_INDEX 210lu +#define EXT_CSD_MIN_PERF_R_8_52_INDEX 209lu +#define EXT_CSD_MIN_PERF_W_8_26_4_52_INDEX 208lu +#define EXT_CSD_MIN_PERF_R_8_26_4_52_INDEX 207lu +#define EXT_CSD_MIN_PERF_W_4_26_INDEX 206lu +#define EXT_CSD_MIN_PERF_R_4_26_INDEX 205lu +#define EXT_CSD_PWR_CL_26_360_INDEX 203lu +#define EXT_CSD_PWR_CL_52_360_INDEX 202lu +#define EXT_CSD_PWR_CL_26_195_INDEX 201lu +#define EXT_CSD_PWR_CL_52_195_INDEX 200lu +#define EXT_CSD_CARD_TYPE_INDEX 196lu +/* MMC card type */ +#define MMC_CTYPE_26MHZ 0x1 +#define MMC_CTYPE_52MHZ 0x2 +#define EXT_CSD_CSD_STRUCTURE_INDEX 194lu +#define EXT_CSD_EXT_CSD_REV_INDEX 192lu + +/* Below belongs to Mode Segment */ +#define EXT_CSD_CMD_SET_INDEX 191lu +#define EXT_CSD_CMD_SET_REV_INDEX 189lu +#define EXT_CSD_POWER_CLASS_INDEX 187lu +#define EXT_CSD_HS_TIMING_INDEX 185lu +#define EXT_CSD_BUS_WIDTH_INDEX 183lu +#define EXT_CSD_ERASED_MEM_CONT_INDEX 181lu +#define EXT_CSD_BOOT_CONFIG_INDEX 179lu +#define EXT_CSD_BOOT_BUS_WIDTH_INDEX 177lu +#define EXT_CSD_ERASE_GROUP_DEF_INDEX 175lu + //! @} +//! @} + +//! \name Definition for SPI mode only +//! @{ + +//! SPI commands start with a start bit "0" and a transmit bit "1" +#define SPI_CMD_ENCODE(x) (0x40 | (x & 0x3F)) + +//! \name Register R1 definition for SPI mode +//! The R1 register is always send after a command. +//! @{ +#define R1_SPI_IDLE (1lu << 0) +#define R1_SPI_ERASE_RESET (1lu << 1) +#define R1_SPI_ILLEGAL_COMMAND (1lu << 2) +#define R1_SPI_COM_CRC (1lu << 3) +#define R1_SPI_ERASE_SEQ (1lu << 4) +#define R1_SPI_ADDRESS (1lu << 5) +#define R1_SPI_PARAMETER (1lu << 6) +// R1 bit 7 is always zero, reuse this bit for error +#define R1_SPI_ERROR (1lu << 7) +//! @} + +//! \name Register R2 definition for SPI mode +//! The R2 register can be send after R1 register. +//! @{ +#define R2_SPI_CARD_LOCKED (1lu << 0) +#define R2_SPI_WP_ERASE_SKIP (1lu << 1) +#define R2_SPI_LOCK_UNLOCK_FAIL R2_SPI_WP_ERASE_SKIP +#define R2_SPI_ERROR (1lu << 2) +#define R2_SPI_CC_ERROR (1lu << 3) +#define R2_SPI_CARD_ECC_ERROR (1lu << 4) +#define R2_SPI_WP_VIOLATION (1lu << 5) +#define R2_SPI_ERASE_PARAM (1lu << 6) +#define R2_SPI_OUT_OF_RANGE (1lu << 7) +#define R2_SPI_CSD_OVERWRITE R2_SPI_OUT_OF_RANGE +//! @} + +//! \name Control Tokens in SPI Mode +//! @{ +//! \name Tokens used for a read operation +//! @{ +#define SPI_TOKEN_SINGLE_MULTI_READ 0xFE +#define SPI_TOKEN_DATA_ERROR_VALID(token) (((token)&0xF0) == 0) +#define SPI_TOKEN_DATA_ERROR_ERRORS (0x0F) +#define SPI_TOKEN_DATA_ERROR_ERROR (1lu << 0) +#define SPI_TOKEN_DATA_ERROR_CC_ERROR (1lu << 1) +#define SPI_TOKEN_DATA_ERROR_ECC_ERROR (1lu << 2) +#define SPI_TOKEN_DATA_ERROR_OUT_RANGE (1lu << 3) + //! @} + //! \name Tokens used for a write operation + //! @{ +#define SPI_TOKEN_SINGLE_WRITE 0xFE +#define SPI_TOKEN_MULTI_WRITE 0xFC +#define SPI_TOKEN_STOP_TRAN 0xFD +#define SPI_TOKEN_DATA_RESP_VALID(token) ((((token) & (1 << 4)) == 0) && (((token) & (1 << 0)) == 1)) +#define SPI_TOKEN_DATA_RESP_CODE(token) ((token)&0x1E) +#define SPI_TOKEN_DATA_RESP_ACCEPTED (2lu << 1) +#define SPI_TOKEN_DATA_RESP_CRC_ERR (5lu << 1) +#define SPI_TOKEN_DATA_RESP_WRITE_ERR (6lu << 1) + //! @} + //! @} + //! @} + + //! @} end of sd_mmc_protocol + +#ifdef __cplusplus +} +#endif + +#endif /* SD_MMC_PROTOCOL_H_INCLUDED */ From f496c0b58d63f594ce42bd5b34cf8421674b4108 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 26 Jun 2020 10:58:54 -0500 Subject: [PATCH 020/277] atmel-samd: Add SDIO SD card interface --- locale/circuitpython.pot | 10 +- ports/atmel-samd/Makefile | 15 + ports/atmel-samd/asf4 | 2 +- .../asf4_conf/samd51/hpl_sdhc_config.h | 24 ++ .../asf4_conf/samd51/peripheral_clk_config.h | 164 +++++++++++ .../asf4_conf/same54/hpl_sdhc_config.h | 24 ++ .../asf4_conf/same54/peripheral_clk_config.h | 164 +++++++++++ .../grandcentral_m4_express/mpconfigboard.mk | 2 + .../boards/grandcentral_m4_express/pins.c | 17 ++ .../boards/same54_xplained/mpconfigboard.mk | 3 +- .../atmel-samd/boards/same54_xplained/pins.c | 17 ++ ports/atmel-samd/common-hal/sdioio/SDCard.c | 272 ++++++++++++++++++ ports/atmel-samd/common-hal/sdioio/SDCard.h | 40 +++ ports/atmel-samd/common-hal/sdioio/__init__.c | 0 ports/atmel-samd/common-hal/sdioio/__init__.h | 0 tools/mksdiodata.py | 40 +++ 16 files changed, 791 insertions(+), 3 deletions(-) create mode 100644 ports/atmel-samd/asf4_conf/samd51/hpl_sdhc_config.h create mode 100644 ports/atmel-samd/asf4_conf/same54/hpl_sdhc_config.h create mode 100644 ports/atmel-samd/common-hal/sdioio/SDCard.c create mode 100644 ports/atmel-samd/common-hal/sdioio/SDCard.h create mode 100644 ports/atmel-samd/common-hal/sdioio/__init__.c create mode 100644 ports/atmel-samd/common-hal/sdioio/__init__.h create mode 100755 tools/mksdiodata.py diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 481d29f248..3a3b159a04 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -58,6 +58,10 @@ msgstr "" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" @@ -85,6 +89,10 @@ msgstr "" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "" @@ -417,7 +425,7 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: shared-module/sdcardio/SDCard.c +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c msgid "Buffer length must be a multiple of 512" msgstr "" diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 5f901a1991..c308105a32 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -246,6 +246,14 @@ SRC_ASF += \ endif +ifeq ($(CIRCUITPY_SDIOIO),1) +SRC_ASF += \ + hal/src/hal_mci_sync.c \ + hpl/sdhc/hpl_sdhc.c \ + +$(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align +endif + SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF)) SRC_C = \ @@ -290,6 +298,9 @@ SRC_C = \ supervisor/shared/memory.c \ timer_handler.c \ +ifeq ($(CIRCUITPY_SDIOIO),1) +SRC_C += ports/atmel-samd/sd_mmc/sd_mmc.c +endif ifeq ($(CIRCUITPY_NETWORK),1) CFLAGS += -DMICROPY_PY_NETWORK=1 @@ -346,6 +357,10 @@ endif OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) +SRC_QSTR += $(HEADER_BUILD)/sdiodata.h +$(HEADER_BUILD)/sdiodata.h: $(TOP)/tools/mksdiodata.py | $(HEADER_BUILD) + $(Q)$(PYTHON3) $< > $@ + SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) # Sources that only hold QSTRs after pre-processing. SRC_QSTR_PREPROCESSOR += peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/clocks.c diff --git a/ports/atmel-samd/asf4 b/ports/atmel-samd/asf4 index c0eef7b751..35a1525796 160000 --- a/ports/atmel-samd/asf4 +++ b/ports/atmel-samd/asf4 @@ -1 +1 @@ -Subproject commit c0eef7b75124fc946af5f75e12d82d6d01315ab1 +Subproject commit 35a1525796c7ef8a3893d90befdad2f267fca20e diff --git a/ports/atmel-samd/asf4_conf/samd51/hpl_sdhc_config.h b/ports/atmel-samd/asf4_conf/samd51/hpl_sdhc_config.h new file mode 100644 index 0000000000..daa6620517 --- /dev/null +++ b/ports/atmel-samd/asf4_conf/samd51/hpl_sdhc_config.h @@ -0,0 +1,24 @@ +/* Auto-generated config file hpl_sdhc_config.h */ +#ifndef HPL_SDHC_CONFIG_H +#define HPL_SDHC_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +#include "peripheral_clk_config.h" + +#ifndef CONF_BASE_FREQUENCY +#define CONF_BASE_FREQUENCY CONF_SDHC0_FREQUENCY +#endif + +// Clock Generator Select +// <0=> Divided Clock mode +// <1=> Programmable Clock mode +// This defines the clock generator mode in the SDCLK Frequency Select field +// sdhc_clk_gsel +#ifndef CONF_SDHC0_CLK_GEN_SEL +#define CONF_SDHC0_CLK_GEN_SEL 0 +#endif + +// <<< end of configuration section >>> + +#endif // HPL_SDHC_CONFIG_H diff --git a/ports/atmel-samd/asf4_conf/samd51/peripheral_clk_config.h b/ports/atmel-samd/asf4_conf/samd51/peripheral_clk_config.h index 030a90a7a9..59fe8730e6 100644 --- a/ports/atmel-samd/asf4_conf/samd51/peripheral_clk_config.h +++ b/ports/atmel-samd/asf4_conf/samd51/peripheral_clk_config.h @@ -1001,6 +1001,170 @@ #define CONF_GCLK_USB_FREQUENCY 48000000 #endif +// SDHC Clock Settings +// SDHC Clock source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_gclk_selection +#ifndef CONF_GCLK_SDHC0_SRC +#define CONF_GCLK_SDHC0_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif + +// SDHC clock slow source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_slow_gclk_selection +#ifndef CONF_GCLK_SDHC0_SLOW_SRC +#define CONF_GCLK_SDHC0_SLOW_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif +// + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock frequency + */ +#ifndef CONF_SDHC0_FREQUENCY +#define CONF_SDHC0_FREQUENCY 12000000 +#endif + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock slow frequency + */ +#ifndef CONF_SDHC0_SLOW_FREQUENCY +#define CONF_SDHC0_SLOW_FREQUENCY 12000000 +#endif + +// SDHC Clock Settings +// SDHC Clock source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_gclk_selection +#ifndef CONF_GCLK_SDHC1_SRC +#define CONF_GCLK_SDHC1_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif + +// SDHC clock slow source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_slow_gclk_selection +#ifndef CONF_GCLK_SDHC1_SLOW_SRC +#define CONF_GCLK_SDHC1_SLOW_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif +// + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock frequency + */ +#ifndef CONF_SDHC1_FREQUENCY +#define CONF_SDHC1_FREQUENCY 12000000 +#endif + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock slow frequency + */ +#ifndef CONF_SDHC1_SLOW_FREQUENCY +#define CONF_SDHC1_SLOW_FREQUENCY 12000000 +#endif + // <<< end of configuration section >>> #endif // PERIPHERAL_CLK_CONFIG_H diff --git a/ports/atmel-samd/asf4_conf/same54/hpl_sdhc_config.h b/ports/atmel-samd/asf4_conf/same54/hpl_sdhc_config.h new file mode 100644 index 0000000000..daa6620517 --- /dev/null +++ b/ports/atmel-samd/asf4_conf/same54/hpl_sdhc_config.h @@ -0,0 +1,24 @@ +/* Auto-generated config file hpl_sdhc_config.h */ +#ifndef HPL_SDHC_CONFIG_H +#define HPL_SDHC_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +#include "peripheral_clk_config.h" + +#ifndef CONF_BASE_FREQUENCY +#define CONF_BASE_FREQUENCY CONF_SDHC0_FREQUENCY +#endif + +// Clock Generator Select +// <0=> Divided Clock mode +// <1=> Programmable Clock mode +// This defines the clock generator mode in the SDCLK Frequency Select field +// sdhc_clk_gsel +#ifndef CONF_SDHC0_CLK_GEN_SEL +#define CONF_SDHC0_CLK_GEN_SEL 0 +#endif + +// <<< end of configuration section >>> + +#endif // HPL_SDHC_CONFIG_H diff --git a/ports/atmel-samd/asf4_conf/same54/peripheral_clk_config.h b/ports/atmel-samd/asf4_conf/same54/peripheral_clk_config.h index 030a90a7a9..59fe8730e6 100644 --- a/ports/atmel-samd/asf4_conf/same54/peripheral_clk_config.h +++ b/ports/atmel-samd/asf4_conf/same54/peripheral_clk_config.h @@ -1001,6 +1001,170 @@ #define CONF_GCLK_USB_FREQUENCY 48000000 #endif +// SDHC Clock Settings +// SDHC Clock source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_gclk_selection +#ifndef CONF_GCLK_SDHC0_SRC +#define CONF_GCLK_SDHC0_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif + +// SDHC clock slow source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_slow_gclk_selection +#ifndef CONF_GCLK_SDHC0_SLOW_SRC +#define CONF_GCLK_SDHC0_SLOW_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif +// + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock frequency + */ +#ifndef CONF_SDHC0_FREQUENCY +#define CONF_SDHC0_FREQUENCY 12000000 +#endif + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock slow frequency + */ +#ifndef CONF_SDHC0_SLOW_FREQUENCY +#define CONF_SDHC0_SLOW_FREQUENCY 12000000 +#endif + +// SDHC Clock Settings +// SDHC Clock source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_gclk_selection +#ifndef CONF_GCLK_SDHC1_SRC +#define CONF_GCLK_SDHC1_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif + +// SDHC clock slow source + +// Generic clock generator 0 + +// Generic clock generator 1 + +// Generic clock generator 2 + +// Generic clock generator 3 + +// Generic clock generator 4 + +// Generic clock generator 5 + +// Generic clock generator 6 + +// Generic clock generator 7 + +// Generic clock generator 8 + +// Generic clock generator 9 + +// Generic clock generator 10 + +// Generic clock generator 11 + +// Select the clock source for SDHC. +// sdhc_slow_gclk_selection +#ifndef CONF_GCLK_SDHC1_SLOW_SRC +#define CONF_GCLK_SDHC1_SLOW_SRC GCLK_GENCTRL_SRC_DFLL_Val +#endif +// + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock frequency + */ +#ifndef CONF_SDHC1_FREQUENCY +#define CONF_SDHC1_FREQUENCY 12000000 +#endif + +/** + * \def SDHC FREQUENCY + * \brief SDHC's Clock slow frequency + */ +#ifndef CONF_SDHC1_SLOW_FREQUENCY +#define CONF_SDHC1_SLOW_FREQUENCY 12000000 +#endif + // <<< end of configuration section >>> #endif // PERIPHERAL_CLK_CONFIG_H diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.mk index ab81ec5a29..08eb5c98ba 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.mk @@ -10,3 +10,5 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C" LONGINT_IMPL = MPZ + +CIRCUITPY_SDIOIO = 1 diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/pins.c b/ports/atmel-samd/boards/grandcentral_m4_express/pins.c index 6b09c62bf3..b125aca086 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/pins.c +++ b/ports/atmel-samd/boards/grandcentral_m4_express/pins.c @@ -1,5 +1,18 @@ +#include "py/objtuple.h" #include "shared-bindings/board/__init__.h" +STATIC const mp_rom_obj_tuple_t sdio_data_tuple = { + {&mp_type_tuple}, + 4, + { + MP_ROM_PTR(&pin_PB18), + MP_ROM_PTR(&pin_PB19), + MP_ROM_PTR(&pin_PB20), + MP_ROM_PTR(&pin_PB21), + } +}; + + // This mapping only includes functional names because pins broken // out on connectors are labeled with their MCU name available from // microcontroller.pin. @@ -129,5 +142,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_SDIO_CLOCK), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_COMMAND), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_DATA), MP_ROM_PTR(&sdio_data_tuple) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk index ffc4f567f9..7ac1265149 100644 --- a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk +++ b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk @@ -10,4 +10,5 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "N25Q256A" LONGINT_IMPL = MPZ -LONGINT_IMPL = MPZ + +CIRCUITPY_SDIOIO = 1 diff --git a/ports/atmel-samd/boards/same54_xplained/pins.c b/ports/atmel-samd/boards/same54_xplained/pins.c index 5b9373724e..8a864ab97d 100644 --- a/ports/atmel-samd/boards/same54_xplained/pins.c +++ b/ports/atmel-samd/boards/same54_xplained/pins.c @@ -1,5 +1,18 @@ +#include "py/objtuple.h" #include "shared-bindings/board/__init__.h" +STATIC const mp_rom_obj_tuple_t sdio_data_tuple = { + {&mp_type_tuple}, + 4, + { + MP_ROM_PTR(&pin_PB18), + MP_ROM_PTR(&pin_PB19), + MP_ROM_PTR(&pin_PB20), + MP_ROM_PTR(&pin_PB21), + } +}; + + // This mapping only includes functional names because pins broken // out on connectors are labeled with their MCU name available from // microcontroller.pin. @@ -95,5 +108,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_SDIO_CLOCK), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_COMMAND), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_DATA), MP_ROM_PTR(&sdio_data_tuple) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.c b/ports/atmel-samd/common-hal/sdioio/SDCard.c new file mode 100644 index 0000000000..6014bd8abf --- /dev/null +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -0,0 +1,272 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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 + +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "boards/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/sdioio/SDCard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "supervisor/shared/translate.h" + +#include "genhdr/sdiodata.h" + +#include "sd_mmc/sd_mmc.h" +#include "sd_mmc/conf_sd_mmc.h" +#include "peripheral_clk_config.h" + +#ifndef DEBUG_SDIO +#define DEBUG_SDIO (1) +#endif + +#if DEBUG_SDIO +#define DEBUG_PRINT(...) ((void)mp_printf(&mp_plat_print, __VA_ARGS__)) +#define DEBUG_PRINT_OBJ(o) ((void)mp_obj_print_helper(&mp_plat_print, (mp_obj_t)o, PRINT_REPR)) +#else +#define DEBUG_PRINT(...) ((void)0) +#define DEBUG_PRINT_OBJ(...) ((void)0) +#endif +#define DEBUG_PRINT_OBJ_NL(o) (DEBUG_PRINT_OBJ(o), DEBUG_PRINT("\n")) + +#define GPIO_PIN_FUNCTION_SDIO (GPIO_PIN_FUNCTION_I) + +static Sdhc *sdhc_insts[] = SDHC_INSTS; + +STATIC pin_function_t *find_pin_function(pin_function_t *table, const mcu_pin_obj_t *pin, int instance, uint16_t name) { + DEBUG_PRINT("\n\n[inst=% 2d] %q: ", instance, name); + DEBUG_PRINT_OBJ_NL(pin); + + for(; table->obj; table++) { + DEBUG_PRINT("[inst=% 2d] considering table @%p: "); + DEBUG_PRINT_OBJ(table->obj); + DEBUG_PRINT(" %d %d\n", table->instance, table->pin); + if (instance != -1 && instance != table->instance) { + continue; + } + if (pin == table->obj) { + return table; + } + } + mp_raise_ValueError_varg(translate("%q pin invalid"), name); +} + +void common_hal_sdioio_sdcard_construct(sdioio_sdcard_obj_t *self, + const mcu_pin_obj_t * clock, const mcu_pin_obj_t * command, + uint8_t num_data, mcu_pin_obj_t ** data, uint32_t frequency) { + /* +SD breakout as assembled ("*" = minimum viable set) + +PURPLE 9 DAT2 SDA +BLUE 1 DAT3 SCL +GREEN 2 CMD * D32 +YELLOW 3 VSS1 +RED 4 VDD * 3.3V +BROWN 5 CLK * BROWN +BLACK 6 VSS2 * GND +WHITE 7 DAT0 * D8 +GREY 8 DAT1 D29 + +DAT0..3 PB18..21 (D8 D29 D20 D21) WHITE GREY PURPLE BLUE +CMD PA20 PCC_D? (D33) GREEN +CLK PA21 PCC_D? (D32) BROWN + +*/ + + pin_function_t *functions[6] = {}; + functions[0] = find_pin_function(sdio_cmd, command, -1, MP_QSTR_command); + int instance = functions[0]->instance; + functions[1] = find_pin_function(sdio_ck, clock, instance, MP_QSTR_clock); + functions[2] = find_pin_function(sdio_dat0, data[0], instance, MP_QSTR_data0); + if(num_data == 4) { + functions[3] = find_pin_function(sdio_dat1, data[1], instance, MP_QSTR_data1); + functions[4] = find_pin_function(sdio_dat2, data[2], instance, MP_QSTR_data2); + functions[5] = find_pin_function(sdio_dat3, data[3], instance, MP_QSTR_data3); + } + + // We've verified all pins, now set their special functions + self->command_pin = common_hal_mcu_pin_number(functions[0]->obj); + self->clock_pin = common_hal_mcu_pin_number(functions[1]->obj); + + for(int i=0; idata_pins[i] = common_hal_mcu_pin_number(function->obj); + } else { + self->data_pins[i] = COMMON_HAL_MCU_NO_PIN; + } + } + + for(size_t i=0; iobj) { + break; + } + + gpio_set_pin_direction(functions[i]->pin, GPIO_DIRECTION_OUT); + gpio_set_pin_level(functions[i]->pin, false); + // Enable pullups on all pins except CLK and DAT3 + gpio_set_pin_pull_mode(functions[i]->pin, + (i == 1 || i == 5) ? GPIO_PULL_OFF : GPIO_PULL_UP); + gpio_set_pin_function(functions[i]->pin, GPIO_PIN_FUNCTION_SDIO); + + common_hal_never_reset_pin(functions[i]->obj); + } + + self->num_data = num_data; + self->frequency = frequency; + + if(instance == 0) { + hri_mclk_set_AHBMASK_SDHC0_bit(MCLK); + hri_gclk_write_PCHCTRL_reg(GCLK, SDHC0_GCLK_ID, CONF_GCLK_SDHC0_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); + hri_gclk_write_PCHCTRL_reg(GCLK, SDHC0_GCLK_ID_SLOW, CONF_GCLK_SDHC0_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); + } else { +#ifdef SDHC1_GCLK_ID + hri_mclk_set_AHBMASK_SDHC1_bit(MCLK); + hri_gclk_write_PCHCTRL_reg(GCLK, SDHC1_GCLK_ID, CONF_GCLK_SDHC1_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); + hri_gclk_write_PCHCTRL_reg(GCLK, SDHC1_GCLK_ID_SLOW, CONF_GCLK_SDHC1_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); +#endif + } + + DEBUG_PRINT("instance %d @%p\n", instance, sdhc_insts[instance]); + mci_sync_init(&self->IO_BUS, sdhc_insts[instance]); + sd_mmc_init(&self->IO_BUS, NULL, NULL); + + sd_mmc_err_t result = SD_MMC_INIT_ONGOING; + + for (int i=0; result == SD_MMC_INIT_ONGOING && i<100; i++) { + result = sd_mmc_check(0); + DEBUG_PRINT("sd_mmc_check(0) -> %d\n", result); + } + + if (result != SD_MMC_OK) { + mp_raise_OSError_msg_varg(translate("%q failure: %d"), MP_QSTR_sd_mmc_check, (int)result); + } + // sd_mmc_get_capacity() is in KiB, but our "capacity" is in 512-byte blocks + self->capacity = sd_mmc_get_capacity(0) * 2; + + DEBUG_PRINT("capacity=%u\n", self->capacity); +} + +uint32_t common_hal_sdioio_sdcard_get_count(sdioio_sdcard_obj_t *self) { + return self->capacity; +} + +uint32_t common_hal_sdioio_sdcard_get_frequency(sdioio_sdcard_obj_t *self) { + return self->frequency; // self->frequency; +} + +uint8_t common_hal_sdioio_sdcard_get_width(sdioio_sdcard_obj_t *self) { + return self->num_data; // self->width; +} + +STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) { +} + +STATIC void check_whole_block(mp_buffer_info_t *bufinfo) { + if (bufinfo->len % 512) { + mp_raise_ValueError(translate("Buffer length must be a multiple of 512")); + } +} + +STATIC void wait_write_complete(sdioio_sdcard_obj_t *self) { + if (self->state_programming) { + sd_mmc_wait_end_of_write_blocks(0); + self->state_programming = 0; + } +} + +STATIC void debug_print_state(sdioio_sdcard_obj_t *self, const char *what, sd_mmc_err_t r) { +#if DEBUG_SDIO + DEBUG_PRINT("%s: %d\n", what, r); +#endif +} + +int common_hal_sdioio_sdcard_writeblocks(sdioio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *bufinfo) { + check_for_deinit(self); + check_whole_block(bufinfo); + wait_write_complete(self); + self->state_programming = true; + sd_mmc_err_t r = sd_mmc_init_write_blocks(0, start_block, bufinfo->len / 512); + if (r != SD_MMC_OK) { + debug_print_state(self, "sd_mmc_init_write_blocks", r); + return -EIO; + } + r = sd_mmc_start_write_blocks(bufinfo->buf, bufinfo->len / 512); + if (r != SD_MMC_OK) { + debug_print_state(self, "sd_mmc_start_write_blocks", r); + return -EIO; + } + // debug_print_state(self, "after writeblocks OK"); + return 0; +} + +int common_hal_sdioio_sdcard_readblocks(sdioio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *bufinfo) { + check_for_deinit(self); + check_whole_block(bufinfo); + wait_write_complete(self); + sd_mmc_err_t r = sd_mmc_init_read_blocks(0, start_block, bufinfo->len / 512); + if (r != SD_MMC_OK) { + debug_print_state(self, "sd_mmc_init_read_blocks", r); + return -EIO; + } + r = sd_mmc_start_read_blocks(bufinfo->buf, bufinfo->len / 512); + if (r != SD_MMC_OK) { + debug_print_state(self, "sd_mmc_start_read_blocks", r); + return -EIO; + } + sd_mmc_wait_end_of_write_blocks(0); + return 0; +} + +bool common_hal_sdioio_sdcard_configure(sdioio_sdcard_obj_t *self, uint32_t frequency, uint8_t bits) { + check_for_deinit(self); + return true; +} + +bool common_hal_sdioio_sdcard_deinited(sdioio_sdcard_obj_t *self) { + return self->command_pin == COMMON_HAL_MCU_NO_PIN; +} + +void common_hal_sdioio_sdcard_deinit(sdioio_sdcard_obj_t *self) { + reset_pin_number(self->command_pin); + reset_pin_number(self->clock_pin); + reset_pin_number(self->data_pins[0]); + reset_pin_number(self->data_pins[1]); + reset_pin_number(self->data_pins[2]); + reset_pin_number(self->data_pins[3]); + + self->command_pin = COMMON_HAL_MCU_NO_PIN; + self->clock_pin = COMMON_HAL_MCU_NO_PIN; + self->data_pins[0] = COMMON_HAL_MCU_NO_PIN; + self->data_pins[1] = COMMON_HAL_MCU_NO_PIN; + self->data_pins[2] = COMMON_HAL_MCU_NO_PIN; + self->data_pins[3] = COMMON_HAL_MCU_NO_PIN; +} + +void common_hal_sdioio_sdcard_never_reset(sdioio_sdcard_obj_t *self) { +} diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.h b/ports/atmel-samd/common-hal/sdioio/SDCard.h new file mode 100644 index 0000000000..2baba38f0d --- /dev/null +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "hal_mci_sync.h" + +typedef struct { + mp_obj_base_t base; + struct mci_sync_desc IO_BUS; + uint32_t frequency; + uint32_t capacity; + uint8_t num_data:3, state_programming:1, has_lock:1; + uint8_t command_pin; + uint8_t clock_pin; + uint8_t data_pins[4]; +} sdioio_sdcard_obj_t; diff --git a/ports/atmel-samd/common-hal/sdioio/__init__.c b/ports/atmel-samd/common-hal/sdioio/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/atmel-samd/common-hal/sdioio/__init__.h b/ports/atmel-samd/common-hal/sdioio/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/mksdiodata.py b/tools/mksdiodata.py new file mode 100755 index 0000000000..0cce3819f3 --- /dev/null +++ b/tools/mksdiodata.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 + +def defines(name, function): + print(f'pin_function_t {name} [] = {{') + for instance in (0, 1): + for port in 'ABCD': + for idx in range(32): + pin = f'P{port}{idx:02d}' + pinmux = f'PINMUX_{pin}I_SDHC{instance}_{function}' + print(f'''\ +#if defined({pinmux}) && ! defined(IGNORE_PIN_{pin}) + {{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}}, +#endif''') + print(f'{{NULL, 0, 0}}') + print(f'}};') + print() + +print('''\ +#include +#include "py/obj.h" +#include "sam.h" +#include "samd/pins.h" +#include "mpconfigport.h" +#include "atmel_start_pins.h" +#include "hal/include/hal_gpio.h" + +typedef struct { + const mcu_pin_obj_t *obj; + uint8_t instance; + uint8_t pin; + uint16_t function; +} pin_function_t; +''') + +defines('sdio_ck', 'SDCK') +defines('sdio_cmd', 'SDCMD') +defines('sdio_dat0', 'SDDAT0') +defines('sdio_dat1', 'SDDAT1') +defines('sdio_dat2', 'SDDAT2') +defines('sdio_dat3', 'SDDAT3') From 0f2fb93d1416b0be1c9a2f94b0ef25eda8b05d1f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 26 Jun 2020 13:15:30 -0500 Subject: [PATCH 021/277] Update shared-bindings/sdcardio/SDCard.c Co-authored-by: Scott Shawcroft --- shared-bindings/sdcardio/SDCard.c | 1 - 1 file changed, 1 deletion(-) diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 54ca39f806..1d8c4bafbe 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -50,7 +50,6 @@ //| :param busio.SPI spi: The SPI bus //| :param microcontroller.Pin cs: The chip select connected to the card //| :param int baudrate: The SPI data rate to use after card setup -//| :param busio.SDIO sdio: The SDIO bus. Mutually exclusive with spi and cs. //| //| Note that during detection and configuration, a hard-coded low baudrate is used. //| Data transfers use the specified baurate (rounded down to one that is supported by From c5db97c50f3dd2a8d71958b22efe9fe728e0d7f4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 26 Jun 2020 13:16:16 -0500 Subject: [PATCH 022/277] atmel-sam: sdio: disable debug prints by default --- ports/atmel-samd/common-hal/sdioio/SDCard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.c b/ports/atmel-samd/common-hal/sdioio/SDCard.c index 6014bd8abf..8cd077ecd7 100644 --- a/ports/atmel-samd/common-hal/sdioio/SDCard.c +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -42,7 +42,7 @@ #include "peripheral_clk_config.h" #ifndef DEBUG_SDIO -#define DEBUG_SDIO (1) +#define DEBUG_SDIO (0) #endif #if DEBUG_SDIO From 472a04ba4bd107575b42cab102e4849d6943779e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 26 Jun 2020 13:17:00 -0500 Subject: [PATCH 023/277] sdioio: Remove junk in comments --- shared-bindings/sdioio/SDCard.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index c6b1d280ba..77b41ce127 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -285,20 +285,6 @@ STATIC const mp_rom_map_elem_t sdioio_sdcard_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&sdioio_sdcard_count_obj) }, { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&sdioio_sdcard_readblocks_obj) }, { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&sdioio_sdcard_writeblocks_obj) }, - -// Methods in STM HAL: -// InitCard -// ReadBlocks -// WriteBlocks -// Erase -// GetCardState -// GetCardCID -// GetCardCSD -// GetCardInfo -// GetState -// GetError -// Abort - }; STATIC MP_DEFINE_CONST_DICT(sdioio_sdcard_locals_dict, sdioio_sdcard_locals_dict_table); From a9f257bcd645b342bdc473e0ab2804a3c099126c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 26 Jun 2020 12:32:56 -0700 Subject: [PATCH 024/277] Store host_id so that never reset works --- ports/esp32s2/common-hal/busio/SPI.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 686f44cbc2..60514df389 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -160,6 +160,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, self->clock_pin = clock; self->MOSI_pin = mosi; self->MISO_pin = miso; + self->host_id = host_id; spi_bus_lock_dev_config_t config = { .flags = 0 }; // The returned lock is stored in the bus lock but must be freed separately with From 2d579cc9953a3ba965973c6d5139c007b3c1b38d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 26 Jun 2020 12:33:50 -0700 Subject: [PATCH 025/277] Use NULL for deinited DigitalInOut This fixes a Display issue where no backlight pin is given but it's still deinitialized. --- ports/esp32s2/common-hal/digitalio/DigitalInOut.c | 4 ++-- ports/litex/common-hal/digitalio/DigitalInOut.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/digitalio/DigitalInOut.c b/ports/esp32s2/common-hal/digitalio/DigitalInOut.c index 7745a9c0a3..fb3ee10ad7 100644 --- a/ports/esp32s2/common-hal/digitalio/DigitalInOut.c +++ b/ports/esp32s2/common-hal/digitalio/DigitalInOut.c @@ -46,7 +46,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct( } bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) { - return self->pin == mp_const_none; + return self->pin == NULL; } void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self) { @@ -55,7 +55,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self } reset_pin_number(self->pin->number); - self->pin = mp_const_none; + self->pin = NULL; } void common_hal_digitalio_digitalinout_switch_to_input( diff --git a/ports/litex/common-hal/digitalio/DigitalInOut.c b/ports/litex/common-hal/digitalio/DigitalInOut.c index 26f79f16df..53df637c43 100644 --- a/ports/litex/common-hal/digitalio/DigitalInOut.c +++ b/ports/litex/common-hal/digitalio/DigitalInOut.c @@ -46,7 +46,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct( } bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) { - return self->pin == mp_const_none; + return self->pin == NULL; } void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self) { @@ -55,7 +55,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self } // reset_pin_number(0, self->pin->number); - self->pin = mp_const_none; + self->pin = NULL; } void common_hal_digitalio_digitalinout_switch_to_input( From ba0911b0f6f03238d1f81b010f85192678fb7fa4 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Fri, 26 Jun 2020 17:01:25 -0500 Subject: [PATCH 026/277] add custom css for 'viewing-old-docs' message --- docs/static/customstyle.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/static/customstyle.css b/docs/static/customstyle.css index 6c964b762c..2f6e10bd83 100644 --- a/docs/static/customstyle.css +++ b/docs/static/customstyle.css @@ -9,7 +9,19 @@ margin: 4px; } +/* custom CSS to sticky the ' viewing outdated version' + warning +*/ +.document > .admonition { + position: sticky; + top: 0px; + background-color: salmon; + z-index: 2; +} +body { + overflow-x: unset!important; +} /* override table width restrictions */ @media screen and (min-width: 767px) { From 08749630a28527f45a01cbfa3c1db417030feacf Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 26 Jun 2020 16:30:24 -0700 Subject: [PATCH 027/277] Fix SPI RX and remove debug prints --- ports/esp32s2/common-hal/busio/SPI.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 60514df389..73d7d0595e 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -32,10 +32,6 @@ #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" -#include "esp_log.h" - -static const char* TAG = "CircuitPython SPI"; - static bool spi_never_reset[SOC_SPI_PERIPH_NUM]; // Store one lock handle per device so that we can free it. @@ -101,8 +97,7 @@ static bool spi_bus_is_free(spi_host_device_t host_id) { } static void spi_interrupt_handler(void *arg) { - busio_spi_obj_t *self = arg; - ESP_LOGE(TAG, "SPI interrupt %p", self); + // busio_spi_obj_t *self = arg; } // The interrupt may get invoked by the bus lock. @@ -197,8 +192,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // hal->cs_hold = 0; // hal->cs_pin_id = 0; - hal->sio = 1; - // hal->half_duplex = 0; + hal->sio = 0; + hal->half_duplex = 0; // hal->tx_lsbfirst = 0; // hal->rx_lsbfirst = 0; hal->dma_enabled = 1; @@ -216,9 +211,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // This must be set after spi_hal_init. hal->timing_conf = &self->timing_conf; - if (hal->hw == NULL) { - ESP_LOGE(TAG, "SPI error %p", hal->hw); - } common_hal_busio_spi_configure(self, 250000, 0, 0, 8); } @@ -280,11 +272,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, return false; } - ESP_LOGI(TAG, "configure"); - ESP_LOGI(TAG, "real frequency %d", self->real_frequency); - ESP_LOGI(TAG, "timing_conf %p", self->hal_context.timing_conf); spi_hal_setup_device(&self->hal_context); - ESP_LOGI(TAG, "setup done"); return true; } @@ -351,6 +339,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou while (!spi_hal_usr_is_done(hal)) { RUN_BACKGROUND_TASKS; } + spi_hal_fetch_result(hal); } return true; From 7f6bef3251d295120fe8f89e666b277dc2f596b1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 26 Jun 2020 16:56:17 -0700 Subject: [PATCH 028/277] Remove debug prints --- ports/esp32s2/supervisor/internal_flash.c | 36 ++++++++--------------- ports/esp32s2/supervisor/port.c | 24 ++------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/ports/esp32s2/supervisor/internal_flash.c b/ports/esp32s2/supervisor/internal_flash.c index a8d3fa485c..5cf77c8010 100644 --- a/ports/esp32s2/supervisor/internal_flash.c +++ b/ports/esp32s2/supervisor/internal_flash.c @@ -39,11 +39,6 @@ #include "esp-idf/components/spi_flash/include/esp_partition.h" -#include "esp_log.h" - - -static const char* TAG = "CircuitPython Internal Flash"; - #include "supervisor/usb.h" STATIC const esp_partition_t * _partition; @@ -52,8 +47,6 @@ void supervisor_flash_init(void) { _partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, NULL); - - ESP_EARLY_LOGW(TAG, "fatfs partition %p", _partition); } uint32_t supervisor_flash_get_block_size(void) { @@ -74,11 +67,10 @@ STATIC uint8_t _cache[SECTOR_SIZE]; STATIC uint32_t _cache_lba; mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) { - esp_err_t ok = esp_partition_read(_partition, - block * FILESYSTEM_BLOCK_SIZE, - dest, - num_blocks * FILESYSTEM_BLOCK_SIZE); - ESP_EARLY_LOGW(TAG, "read %d", ok); + esp_partition_read(_partition, + block * FILESYSTEM_BLOCK_SIZE, + dest, + num_blocks * FILESYSTEM_BLOCK_SIZE); return 0; } @@ -90,13 +82,11 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 uint32_t sector_offset = block_address / blocks_per_sector * SECTOR_SIZE; uint8_t block_offset = block_address % blocks_per_sector; - esp_err_t result; if (_cache_lba != block_address) { - result = esp_partition_read(_partition, - sector_offset, - _cache, - SECTOR_SIZE); - ESP_EARLY_LOGW(TAG, "flash read before write %d", result); + esp_partition_read(_partition, + sector_offset, + _cache, + SECTOR_SIZE); _cache_lba = sector_offset; } for (uint8_t b = block_offset; b < blocks_per_sector; b++) { @@ -109,11 +99,11 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 FILESYSTEM_BLOCK_SIZE); block++; } - result = esp_partition_erase_range(_partition, sector_offset, SECTOR_SIZE); - result = esp_partition_write(_partition, - sector_offset, - _cache, - SECTOR_SIZE); + esp_partition_erase_range(_partition, sector_offset, SECTOR_SIZE); + esp_partition_write(_partition, + sector_offset, + _cache, + SECTOR_SIZE); } return 0; // success diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ebf0020399..a80550b309 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -41,10 +41,6 @@ #include "supervisor/memory.h" #include "supervisor/shared/tick.h" -#include "esp_log.h" - -static const char* TAG = "CircuitPython"; - STATIC esp_timer_handle_t _tick_timer; void tick_timer_cb(void* arg) { @@ -57,12 +53,8 @@ safe_mode_t port_init(void) { args.arg = NULL; args.dispatch_method = ESP_TIMER_TASK; args.name = "CircuitPython Tick"; - esp_err_t result = esp_timer_create(&args, &_tick_timer); - if (result != ESP_OK) { - ESP_EARLY_LOGE(TAG, "Unable to create tick timer."); - } + esp_timer_create(&args, &_tick_timer); never_reset_module_internal_pins(); - ESP_EARLY_LOGW(TAG, "port init done"); return NO_SAFE_MODE; } @@ -109,12 +101,8 @@ uint32_t *port_stack_get_top(void) { supervisor_allocation _fixed_stack; supervisor_allocation* port_fixed_stack(void) { - - ESP_EARLY_LOGW(TAG, "port fixed stack"); _fixed_stack.ptr = port_stack_get_limit(); - ESP_EARLY_LOGW(TAG, "got limit %p", _fixed_stack.ptr); _fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t); - ESP_EARLY_LOGW(TAG, "got length %d", _fixed_stack.length); return &_fixed_stack; } @@ -139,10 +127,7 @@ uint64_t port_get_raw_ticks(uint8_t* subticks) { // Enable 1/1024 second tick. void port_enable_tick(void) { - esp_err_t result = esp_timer_start_periodic(_tick_timer, 1000000 / 1024); - if (result != ESP_OK) { - ESP_EARLY_LOGE(TAG, "Unable to start tick timer."); - } + esp_timer_start_periodic(_tick_timer, 1000000 / 1024); } // Disable 1/1024 second tick. @@ -153,14 +138,12 @@ void port_disable_tick(void) { TickType_t sleep_time_set; TickType_t sleep_time_duration; void port_interrupt_after_ticks(uint32_t ticks) { - // ESP_EARLY_LOGW(TAG, "after ticks"); sleep_time_set = xTaskGetTickCount(); sleep_time_duration = ticks / portTICK_PERIOD_MS; // esp_sleep_enable_timer_wakeup(uint64_t time_in_us) } void port_sleep_until_interrupt(void) { - // ESP_EARLY_LOGW(TAG, "sleep until"); // FreeRTOS delay here maybe. // Light sleep shuts down BLE and wifi. // esp_light_sleep_start() @@ -174,8 +157,5 @@ void port_sleep_until_interrupt(void) { // Wrap main in app_main that the IDF expects. extern void main(void); void app_main(void) { - ESP_EARLY_LOGW(TAG, "Hello from CircuitPython"); - // ESP_LOGW(TAG, "Hello from CircuitPython"); - main(); } From 39fc16deae265c691c4057d270641e5fd63fb166 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 25 Jun 2020 18:08:47 +0200 Subject: [PATCH 029/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 2 +- locale/cs.po | 2 +- locale/de_DE.po | 2 +- locale/es.po | 2 +- locale/fil.po | 2 +- locale/fr.po | 2 +- locale/it_IT.po | 2 +- locale/ko.po | 2 +- locale/nl.po | 2 +- locale/pl.po | 2 +- locale/pt_BR.po | 2 +- locale/sv.po | 2 +- locale/zh_Latn_pinyin.po | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index ae057fbd7a..5a20dd965a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/locale/cs.po b/locale/cs.po index b23144fc8c..4fc8309216 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" diff --git a/locale/de_DE.po b/locale/de_DE.po index eff611b20d..dfe85323ab 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" diff --git a/locale/es.po b/locale/es.po index 22597249bd..7c0203565d 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2020-06-24 18:32+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" diff --git a/locale/fil.po b/locale/fil.po index e4c5678d27..8652cca634 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" diff --git a/locale/fr.po b/locale/fr.po index 5a49fd5f91..8fb8a72a1f 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" diff --git a/locale/it_IT.po b/locale/it_IT.po index c47d0e8e3e..a0cc25b740 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" diff --git a/locale/ko.po b/locale/ko.po index 156f40d9b6..edab1d7377 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" diff --git a/locale/nl.po b/locale/nl.po index 77cc11cab3..f7586d7432 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2020-06-02 19:50+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" diff --git a/locale/pl.po b/locale/pl.po index 888ce64285..ca32e190e3 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index e951df1080..68c829ca57 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" diff --git a/locale/sv.po b/locale/sv.po index df2431c4e0..f7c1278c6d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2020-06-03 18:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4f85c5fa86..16f79f8ff2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-24 11:10+0200\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" From b0440a90a7f1d2833cc3570f8d362e1a75d58fae Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 25 Jun 2020 19:51:56 +0200 Subject: [PATCH 030/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 2 +- locale/cs.po | 2 +- locale/de_DE.po | 2 +- locale/es.po | 2 +- locale/fil.po | 2 +- locale/fr.po | 2 +- locale/it_IT.po | 2 +- locale/ko.po | 2 +- locale/nl.po | 2 +- locale/pl.po | 2 +- locale/pt_BR.po | 2 +- locale/sv.po | 2 +- locale/zh_Latn_pinyin.po | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 5a20dd965a..ae057fbd7a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/locale/cs.po b/locale/cs.po index 4fc8309216..b23144fc8c 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" diff --git a/locale/de_DE.po b/locale/de_DE.po index dfe85323ab..eff611b20d 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" diff --git a/locale/es.po b/locale/es.po index 7c0203565d..22597249bd 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2020-06-24 18:32+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" diff --git a/locale/fil.po b/locale/fil.po index 8652cca634..e4c5678d27 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" diff --git a/locale/fr.po b/locale/fr.po index 8fb8a72a1f..5a49fd5f91 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" diff --git a/locale/it_IT.po b/locale/it_IT.po index a0cc25b740..c47d0e8e3e 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" diff --git a/locale/ko.po b/locale/ko.po index edab1d7377..156f40d9b6 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" diff --git a/locale/nl.po b/locale/nl.po index f7586d7432..77cc11cab3 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2020-06-02 19:50+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" diff --git a/locale/pl.po b/locale/pl.po index ca32e190e3..888ce64285 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 68c829ca57..e951df1080 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" diff --git a/locale/sv.po b/locale/sv.po index f7c1278c6d..df2431c4e0 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2020-06-03 18:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 16f79f8ff2..4f85c5fa86 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-24 11:10+0200\n" +"POT-Creation-Date: 2020-06-25 11:44-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" From c9d8cfc9faa3a7e351de0b5d789e7fa3a85ac333 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 26 Jun 2020 09:11:07 +0000 Subject: [PATCH 031/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 24.3% (185 of 759 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 109 +++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 62 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index e951df1080..33d98d5bdb 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -3,25 +3,28 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-25 11:44-0500\n" -"PO-Revision-Date: 2018-10-02 21:14-0000\n" -"Last-Translator: \n" +"PO-Revision-Date: 2020-06-26 16:42+0000\n" +"Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\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.2-dev\n" #: main.c msgid "" "\n" "Code done running. Waiting for reload.\n" msgstr "" +"\n" +"O código concluiu a execução. Esperando pela recarga.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -29,12 +32,17 @@ msgid "" "Please file an issue with the contents of your CIRCUITPY drive at \n" "https://github.com/adafruit/circuitpython/issues\n" msgstr "" +"\n" +"Registre um problema com o conteúdo do seu controlador no CIRCUITPY\n" +"https://github.com/adafruit/circuitpython/issues\n" #: supervisor/shared/safe_mode.c msgid "" "\n" "To exit, please reset the board without " msgstr "" +"\n" +"Para encerrar, redefina a placa sem " #: py/obj.c msgid " File \"%q\"" @@ -56,7 +64,7 @@ msgstr "%%c requer int ou char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "" +msgstr "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -78,18 +86,16 @@ msgstr "" #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c #: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c #: shared-bindings/vectorio/Rectangle.c -#, fuzzy msgid "%q must be >= 1" -msgstr "buffers devem ser o mesmo tamanho" +msgstr "%q deve ser >= 1" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" msgstr "" #: shared-bindings/fontio/BuiltinFont.c -#, fuzzy msgid "%q should be an int" -msgstr "y deve ser um int" +msgstr "%q deve ser um int" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -261,9 +267,9 @@ msgid "A hardware interrupt channel is already in use" msgstr "Um canal de interrupção de hardware já está em uso" #: shared-bindings/_bleio/Address.c -#, fuzzy, c-format +#, c-format msgid "Address must be %d bytes long" -msgstr "buffers devem ser o mesmo tamanho" +msgstr "O endereço deve ter %d bytes de comprimento" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" @@ -278,9 +284,8 @@ msgid "All SPI peripherals are in use" msgstr "Todos os periféricos SPI estão em uso" #: ports/nrf/common-hal/busio/UART.c -#, fuzzy msgid "All UART peripherals are in use" -msgstr "Todos os periféricos I2C estão em uso" +msgstr "Todos os periféricos UART estão em uso" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" @@ -435,14 +440,13 @@ msgstr "" #: ports/atmel-samd/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 em uso" +msgstr "O pino bus %d já está em uso" #: shared-bindings/_bleio/UUID.c -#, fuzzy msgid "Byte buffer must be 16 bytes." -msgstr "buffers devem ser o mesmo tamanho" +msgstr "O buffer deve ter 16 bytes." #: shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." @@ -471,9 +475,8 @@ msgid "Cannot get pull while in output mode" msgstr "" #: ports/nrf/common-hal/microcontroller/Processor.c -#, fuzzy msgid "Cannot get temperature" -msgstr "Não pode obter a temperatura. status: 0x%02x" +msgstr "Não é possível obter a temperatura" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." @@ -527,7 +530,7 @@ msgstr "" #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." -msgstr "Não é possível ler sem um pino MOSI" +msgstr "Não é possível fazer a escrita sem um pino MOSI." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -561,9 +564,8 @@ msgstr "" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c -#, fuzzy msgid "Command must be an int between 0 and 255" -msgstr "Os bytes devem estar entre 0 e 255." +msgstr "O comando deve ser um int entre 0 e 255" #: shared-bindings/_bleio/Connection.c msgid "" @@ -659,9 +661,8 @@ msgid "Data chunk must follow fmt chunk" msgstr "Pedaço de dados deve seguir o pedaço de cortes" #: ports/nrf/common-hal/_bleio/Adapter.c -#, fuzzy msgid "Data too large for advertisement packet" -msgstr "Não é possível ajustar dados no pacote de anúncios." +msgstr "Os dados são grandes demais para o pacote de publicidade" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -713,9 +714,8 @@ msgstr "Esperado um" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/Descriptor.c shared-bindings/_bleio/PacketBuffer.c -#, fuzzy msgid "Expected a Characteristic" -msgstr "Não é possível adicionar Característica." +msgstr "Uma característica é necessária" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" @@ -723,9 +723,8 @@ msgstr "" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c -#, fuzzy msgid "Expected a UUID" -msgstr "Esperado um" +msgstr "Um UUID é necessário" #: shared-bindings/_bleio/Adapter.c msgid "Expected an Address" @@ -749,9 +748,9 @@ msgid "Failed sending command." msgstr "Falha ao enviar comando." #: ports/nrf/sd_mutex.c -#, fuzzy, c-format +#, c-format msgid "Failed to acquire mutex, err 0x%04x" -msgstr "Não é possível ler o valor do atributo. status: 0x%02x" +msgstr "Houve uma falha na aquisição do mutex, err 0x%04x" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c msgid "Failed to allocate RX buffer" @@ -779,9 +778,9 @@ msgid "Failed to parse MP3 file" msgstr "" #: ports/nrf/sd_mutex.c -#, fuzzy, c-format +#, c-format msgid "Failed to release mutex, err 0x%04x" -msgstr "Não é possível ler o valor do atributo. status: 0x%02x" +msgstr "Houve uma falha ao liberar o mutex, err 0x%04x" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." @@ -911,9 +910,8 @@ msgid "Invalid bits per value" msgstr "" #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -#, fuzzy msgid "Invalid buffer size" -msgstr "Arquivo inválido" +msgstr "O tamanho do buffer é inválido" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "Invalid byteorder string" @@ -924,13 +922,12 @@ msgid "Invalid capture period. Valid range: 1 - 500" msgstr "" #: shared-bindings/audiomixer/Mixer.c -#, fuzzy msgid "Invalid channel count" -msgstr "certificado inválido" +msgstr "A contagem do canal é inválido" #: shared-bindings/digitalio/DigitalInOut.c msgid "Invalid direction." -msgstr "Direção inválida" +msgstr "Direção inválida." #: shared-module/audiocore/WaveFile.c msgid "Invalid file" @@ -1008,9 +1005,8 @@ msgid "Invalid voice" msgstr "" #: shared-bindings/audiomixer/Mixer.c -#, fuzzy msgid "Invalid voice count" -msgstr "certificado inválido" +msgstr "A contagem da voz é inválida" #: shared-module/audiocore/WaveFile.c msgid "Invalid wave file" @@ -1046,7 +1042,7 @@ msgstr "" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." -msgstr "Inicialização do pino MISO falhou" +msgstr "A inicialização do pino MISO falhou." #: shared-module/bitbangio/SPI.c msgid "MOSI pin init failed." @@ -1187,9 +1183,8 @@ msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c #: shared-bindings/_bleio/CharacteristicBuffer.c -#, fuzzy msgid "Not connected" -msgstr "Não é possível conectar-se ao AP" +msgstr "Não Conectado" #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c #: shared-bindings/audiopwmio/PWMAudioOut.c @@ -1203,9 +1198,8 @@ msgstr "" "Objeto foi desinicializado e não pode ser mais usaado. Crie um novo objeto." #: ports/nrf/common-hal/busio/UART.c -#, fuzzy msgid "Odd parity is not supported" -msgstr "I2C operação não suportada" +msgstr "A paridade ímpar não é compatível" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " @@ -1276,9 +1270,8 @@ msgid "" msgstr "" #: py/builtinhelp.c -#, fuzzy msgid "Plus any modules on the filesystem\n" -msgstr "Não é possível remontar o sistema de arquivos" +msgstr "Além de quaisquer módulos no sistema de arquivos\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" @@ -1347,9 +1340,8 @@ msgid "Read-only filesystem" msgstr "Sistema de arquivos somente leitura" #: shared-module/displayio/Bitmap.c -#, fuzzy msgid "Read-only object" -msgstr "Somente leitura" +msgstr "Objeto de leitura apenas" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1638,9 +1630,8 @@ msgid "Unsupported baudrate" msgstr "Taxa de transmissão não suportada" #: shared-module/displayio/display_core.c -#, fuzzy msgid "Unsupported display bus type" -msgstr "Taxa de transmissão não suportada" +msgstr "Não há suporte para o tipo do display bus" #: shared-module/audiocore/WaveFile.c msgid "Unsupported format" @@ -1716,7 +1707,7 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "You requested starting safe mode by " -msgstr "Você solicitou o início do modo de segurança" +msgstr "Você solicitou o início do modo de segurança através do " #: py/objtype.c msgid "__init__() should return None" @@ -1830,23 +1821,20 @@ msgid "bits must be 7, 8 or 9" msgstr "" #: shared-bindings/audiomixer/Mixer.c -#, fuzzy msgid "bits_per_sample must be 8 or 16" -msgstr "bits devem ser 8" +msgstr "bits_per_sample deve ser 8 ou 16" #: py/emitinlinethumb.c -#, fuzzy msgid "branch not in range" -msgstr "Calibração está fora do intervalo" +msgstr "ramo fora do alcance" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" #: shared-module/struct/__init__.c -#, fuzzy msgid "buffer size must match format" -msgstr "buffers devem ser o mesmo tamanho" +msgstr "o tamanho do buffer deve coincidir com o formato" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "buffer slices must be of equal length" @@ -2193,9 +2181,8 @@ msgid "end of format while looking for conversion specifier" msgstr "" #: shared-bindings/displayio/Shape.c -#, fuzzy msgid "end_x should be an int" -msgstr "y deve ser um int" +msgstr "end_x deve ser um int" #: ports/nrf/common-hal/busio/UART.c #, c-format @@ -3015,9 +3002,8 @@ msgid "start/end indices" msgstr "" #: shared-bindings/displayio/Shape.c -#, fuzzy msgid "start_x should be an int" -msgstr "y deve ser um int" +msgstr "start_x deve ser um int" #: shared-bindings/random/__init__.c msgid "step must be non-zero" @@ -3093,9 +3079,8 @@ msgid "timeout must be 0.0-100.0 seconds" msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c -#, fuzzy msgid "timeout must be >= 0.0" -msgstr "bits devem ser 8" +msgstr "o tempo limite deve ser >= 0,0" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" From 87e4f47866853c938a5a624c5a1a416a831692c8 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 29 Jun 2020 00:17:12 -0500 Subject: [PATCH 032/277] docs/shared_bindings_matrix.py: changes to allow usage in 'tools/build_board_info.py'; includes root dir finder, and output board name option. --- docs/shared_bindings_matrix.py | 49 +++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 02ef683492..c0d07d4b41 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -23,6 +23,7 @@ import json import os +import pathlib import re import subprocess import sys @@ -30,17 +31,39 @@ import sys SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm'] +def get_circuitpython_root_dir(): + """ The path to the root './circuitpython' directory + """ + cwd = pathlib.Path('.').resolve() + cwd_parts = cwd.parts + + root_idx = len(cwd_parts) + + # Search the path from tail to head, so that we capture the + # deepest folder. This avoids overshooting in instances like: + # '/home/user/circuitpython_v5/circuitpython' + for idx, val in enumerate(cwd_parts[::-1]): + if val.startswith("circuitpython"): + root_idx = root_idx - idx + break + + root_dir = '/'.join(cwd_parts[:root_idx]) + + return pathlib.Path(root_dir).resolve() + def get_shared_bindings(): """ Get a list of modules in shared-bindings based on folder names """ - return [item for item in os.listdir("./shared-bindings")] + shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings" + return [item.name for item in shared_bindings_dir.iterdir()] def read_mpconfig(): """ Open 'circuitpy_mpconfig.mk' and return the contents. """ configs = [] - with open("py/circuitpy_mpconfig.mk") as mpconfig: + cpy_mpcfg = get_circuitpython_root_dir() / "py" / "circuitpy_mpconfig.mk" + with open(cpy_mpcfg) as mpconfig: configs = mpconfig.read() return configs @@ -120,7 +143,7 @@ def lookup_setting(settings, key, default=''): key = value[2:-1] return value -def support_matrix_by_board(): +def support_matrix_by_board(use_branded_name=True): """ Compiles a list of the available core modules available for each board. """ @@ -129,20 +152,22 @@ def support_matrix_by_board(): boards = dict() for port in SUPPORTED_PORTS: - port_dir = "ports/{}/boards".format(port) - for entry in os.scandir(port_dir): + port_dir = get_circuitpython_root_dir() / "ports" / port + for entry in (port_dir / "boards").iterdir(): if not entry.is_dir(): continue board_modules = [] + board_name = entry.name - settings = get_settings_from_makefile(f'ports/{port}', entry.name) + settings = get_settings_from_makefile(str(port_dir), entry.name) - with open(os.path.join(entry.path, "mpconfigboard.h")) as get_name: - board_contents = get_name.read() - board_name_re = re.search("(?<=MICROPY_HW_BOARD_NAME)\s+(.+)", - board_contents) - if board_name_re: - board_name = board_name_re.group(1).strip('"') + if use_branded_name: + with open(os.path.join(entry.path, "mpconfigboard.h")) as get_name: + board_contents = get_name.read() + board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)", + board_contents) + if board_name_re: + board_name = board_name_re.group(1).strip('"') board_modules = [] for module in base: From 928433f2e3d16ac04032f495fa4a83fd4a296ca3 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 29 Jun 2020 00:27:45 -0500 Subject: [PATCH 033/277] tools/build_board_info.py: add built-in modules information for each board for use on circuitpython.org; uses 'docs/shared_bindings_matrix.py' --- tools/build_board_info.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 6c670930f4..20a5866b7f 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -9,6 +9,9 @@ import base64 from datetime import date from sh.contrib import git +sys.path.append("../docs") +import shared_bindings_matrix + sys.path.append("adabot") import adabot.github_requests as github @@ -246,6 +249,10 @@ def generate_download_info(): languages = get_languages() + support_matrix = shared_bindings_matrix.support_matrix_by_board( + use_branded_name=False + ) + new_stable = "-" not in new_tag previous_releases = set() @@ -283,6 +290,7 @@ def generate_download_info(): new_version = { "stable": new_stable, "version": new_tag, + "modules": support_matrix.get(alias, "[]"), "files": {} } for language in languages: From d911dc98d9a9acd76a337232933ee0776370a66c Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 29 Jun 2020 01:09:04 -0500 Subject: [PATCH 034/277] docs/shared_binding_matrix.py: fix usage with the branded name (building docs) --- docs/shared_bindings_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index c0d07d4b41..12a7b7eb86 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -162,7 +162,7 @@ def support_matrix_by_board(use_branded_name=True): settings = get_settings_from_makefile(str(port_dir), entry.name) if use_branded_name: - with open(os.path.join(entry.path, "mpconfigboard.h")) as get_name: + with open(entry / "mpconfigboard.h") as get_name: board_contents = get_name.read() board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)", board_contents) From c84c30846cded89bfef889ae3bd92f9102fab816 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 29 Jun 2020 09:02:04 -0500 Subject: [PATCH 035/277] docs/shared_bindings_matrix.py: use '__file__' to ascertain root dir --- docs/shared_bindings_matrix.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 12a7b7eb86..4abf5b8859 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -34,22 +34,10 @@ SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm'] def get_circuitpython_root_dir(): """ The path to the root './circuitpython' directory """ - cwd = pathlib.Path('.').resolve() - cwd_parts = cwd.parts + file_path = pathlib.Path(__file__).resolve() + root_dir = file_path.parent.parent - root_idx = len(cwd_parts) - - # Search the path from tail to head, so that we capture the - # deepest folder. This avoids overshooting in instances like: - # '/home/user/circuitpython_v5/circuitpython' - for idx, val in enumerate(cwd_parts[::-1]): - if val.startswith("circuitpython"): - root_idx = root_idx - idx - break - - root_dir = '/'.join(cwd_parts[:root_idx]) - - return pathlib.Path(root_dir).resolve() + return root_dir def get_shared_bindings(): """ Get a list of modules in shared-bindings based on folder names From ceb2efcbc3b4b5e34fda51abed7bd1bfb4d5a6db Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 29 Jun 2020 16:34:37 -0700 Subject: [PATCH 036/277] Add new UnexpectedMaker FeatherS2 to CI. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00454cc2da..80cbc9b748 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -371,6 +371,7 @@ jobs: board: - "espressif_saola_1_wroom" - "espressif_saola_1_wrover" + - "unexpectedmaker_feathers2" steps: - name: Set up Python 3.8 From fc0cb8fb293839e1ed22cc219ad8df995af02bd5 Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Sun, 28 Jun 2020 18:25:01 +0000 Subject: [PATCH 037/277] Translated using Weblate (Spanish) Currently translated at 89.0% (676 of 759 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 121 +++++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 56 deletions(-) diff --git a/locale/es.po b/locale/es.po index 22597249bd..ebffaeb984 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-25 11:44-0500\n" -"PO-Revision-Date: 2020-06-24 18:32+0000\n" +"PO-Revision-Date: 2020-06-29 13:13+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" @@ -441,7 +441,7 @@ msgstr "Buffer demasiado grande e incapaz de asignar" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "Búfer muy corto por %d bytes" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c @@ -592,7 +592,7 @@ msgstr "Código crudo corrupto" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" -msgstr "" +msgstr "No se pudo inicializar el GNSS" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" @@ -628,7 +628,7 @@ msgstr "No se pudo iniciar la interrupción, RX ocupado" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" +msgstr "No se pudo encontrar el decodificador" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c @@ -637,7 +637,7 @@ msgstr "No se pudo asignar el primer buffer" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate input buffer" -msgstr "" +msgstr "No se pudo encontrar el búfer de entrada" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c @@ -702,7 +702,7 @@ msgstr "Modo Drive no se usa cuando la dirección es input." #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" -msgstr "" +msgstr "ECB solo opera sobre 16 bytes a la vez" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -1285,6 +1285,8 @@ msgid "" "bytes. If this cannot be avoided, pass allow_inefficient=True to the " "constructor" msgstr "" +"El pinout utiliza %d bytes por elemento, lo que consume más del ideal de %d " +"bytes. Si esto no se puede evitar, pase allow_inefficient=True al constructor" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" @@ -1321,7 +1323,7 @@ msgstr "PulseOut no es compatible con este chip" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" -msgstr "" +msgstr "Error de desinicializado del RNG" #: ports/stm/common-hal/os/__init__.c msgid "RNG Init Error" @@ -1329,7 +1331,7 @@ msgstr "Error de inicialización de RNG" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" -msgstr "" +msgstr "Se especifica inversión de RS485 sin estar en modo RS485" #: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c #: ports/nrf/common-hal/rtc/RTC.c @@ -1343,7 +1345,7 @@ msgstr "RTC no soportado en esta placa" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" +msgstr "Sin capacidad de RTS/CTS/RS485 para este dispositivo" #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" @@ -1435,7 +1437,7 @@ msgstr "Rebanadas no soportadas" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" -msgstr "" +msgstr "Los búferes de fuente y destino deben ser del mismo tamaño" #: extmod/modure.c msgid "Splitting with sub-captures" @@ -1472,6 +1474,8 @@ msgid "" "The `microcontroller` module was used to boot into safe mode. Press reset to " "exit safe mode.\n" msgstr "" +"El módulo de `microcontroller` fue utilizado para bootear en modo seguro. " +"Presione reset para salir del modo seguro.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -1479,6 +1483,11 @@ msgid "" "enough power for the whole circuit and press reset (after ejecting " "CIRCUITPY).\n" msgstr "" +"La alimentación de la microntroladora bajó. Asegúrate que tu fuente de " +"poder\n" +"pueda suplir suficiente energía para todo el circuito y presione reset (" +"luego de\n" +"expulsar CIRCUITPY)\n" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -1533,7 +1542,7 @@ msgstr "Muchos displays" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than outgoing_packet_length" -msgstr "" +msgstr "Los datos totales a escribir son más grandes que outgoing_packet_length" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -1545,7 +1554,7 @@ msgstr "Argumento tuple o struct_time requerido" #: ports/stm/common-hal/busio/UART.c msgid "UART Buffer allocation error" -msgstr "" +msgstr "No se pudo encontrar el búfer para UART" #: ports/stm/common-hal/busio/UART.c msgid "UART De-init error" @@ -1643,6 +1652,8 @@ msgid "" "Unspecified issue. Can be that the pairing prompt on the other device was " "declined or ignored." msgstr "" +"Problema no especificado. Puede ser que la señal de emparejamiento del otro " +"dispositivo fue declinada o ignorada." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/I2C.c @@ -1650,9 +1661,8 @@ msgid "Unsupported baudrate" msgstr "Baudrate no soportado" #: shared-module/displayio/display_core.c -#, fuzzy msgid "Unsupported display bus type" -msgstr "tipo de bitmap no soportado" +msgstr "Sin capacidad de bus tipo display" #: shared-module/audiocore/WaveFile.c msgid "Unsupported format" @@ -1669,12 +1679,12 @@ msgstr "valor pull no soportado." #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" -msgstr "" +msgstr "Tamaño del valor != del tamaño fijo requerido" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" -msgstr "" +msgstr "Tamaño de valor > max_length" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -1682,7 +1692,7 @@ msgstr "funciones Viper actualmente no soportan más de 4 argumentos." #: ports/stm/common-hal/microcontroller/Processor.c msgid "Voltage read timed out" -msgstr "" +msgstr "Tiempo de espera agotado para lectura de voltaje" #: main.c msgid "WARNING: Your code filename has two extensions\n" @@ -1730,7 +1740,7 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "You are in safe mode: something unanticipated happened.\n" -msgstr "" +msgstr "Estás en modo seguro: algo inesperado ha sucedido.\n" #: supervisor/shared/safe_mode.c msgid "You requested starting safe mode by " @@ -1772,7 +1782,7 @@ msgstr "addresses esta vacío" #: extmod/ulab/code/vectorise.c msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" +msgstr "arctan2 se encuentra implementado solo para escalares y ndarrays" #: py/modbuiltins.c msgid "arg is an empty sequence" @@ -1780,7 +1790,7 @@ msgstr "argumento es una secuencia vacía" #: extmod/ulab/code/numerical.c msgid "argsort argument must be an ndarray" -msgstr "" +msgstr "El argumento para argsort debe ser un ndarray" #: py/runtime.c msgid "argument has wrong type" @@ -1797,7 +1807,7 @@ msgstr "argumento deberia ser un '%q' no un '%q'" #: extmod/ulab/code/linalg.c msgid "arguments must be ndarrays" -msgstr "" +msgstr "argumentos deben ser ndarrays" #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -1805,7 +1815,7 @@ msgstr "array/bytes requeridos en el lado derecho" #: extmod/ulab/code/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "" +msgstr "se trató de traer argmin/argmax de una secuencia vacía" #: py/objstr.c msgid "attributes not supported yet" @@ -1813,15 +1823,15 @@ msgstr "atributos aún no soportados" #: extmod/ulab/code/numerical.c msgid "axis must be -1, 0, None, or 1" -msgstr "" +msgstr "eje debe ser -1, 0, None o 1" #: extmod/ulab/code/numerical.c msgid "axis must be -1, 0, or 1" -msgstr "" +msgstr "eje debe ser -1, 0, o 1" #: extmod/ulab/code/numerical.c msgid "axis must be None, 0, or 1" -msgstr "" +msgstr "eje debe ser None, 0, o 1" #: py/builtinevex.c msgid "bad compile mode" @@ -1852,9 +1862,8 @@ msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample debe ser 8 ó 16" #: py/emitinlinethumb.c -#, fuzzy msgid "branch not in range" -msgstr "El argumento de chr() no esta en el rango(256)" +msgstr "la rama no está dentro del rango" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" @@ -1883,7 +1892,7 @@ msgstr "codigo byte no implementado" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "byteorder is not a string" -msgstr "" +msgstr "byteorder no es una cadena" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -2065,7 +2074,7 @@ msgstr "no se puedo realizar importación relativa" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array (incompatible input/output shape)" -msgstr "" +msgstr "no se puede reformar el arreglo (forma de entrada/salida incompatible)" #: py/emitnative.c msgid "casting" @@ -2085,7 +2094,7 @@ msgstr "El argumento de chr() no esta en el rango(256)" #: shared-module/vectorio/Circle.c msgid "circle can only be registered in one parent" -msgstr "" +msgstr "circle solo puede ser registrado con un pariente" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2093,7 +2102,7 @@ msgstr "color buffer debe ser 3 bytes (RGB) ó 4 bytes (RGB + pad byte)" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a buffer, tuple, list, or int" -msgstr "" +msgstr "el búfer de color debe ser un búfer, una tupla, una lista o un entero" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a bytearray or array of type 'b' or 'B'" @@ -2149,11 +2158,11 @@ msgstr "" #: extmod/ulab/code/approx.c msgid "data must be iterable" -msgstr "" +msgstr "los datos deben permitir iteración" #: extmod/ulab/code/approx.c msgid "data must be of equal length" -msgstr "" +msgstr "los datos deben ser de igual tamaño" #: extmod/ulab/code/numerical.c msgid "ddof must be smaller than length of data set" @@ -2291,19 +2300,19 @@ msgstr "sistema de archivos debe proporcionar método de montaje" #: extmod/ulab/code/vectorise.c msgid "first argument must be a callable" -msgstr "" +msgstr "se debe poder llamar al primer argumento" #: extmod/ulab/code/approx.c msgid "first argument must be a function" -msgstr "" +msgstr "el primer argumento debe ser una función" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" -msgstr "" +msgstr "el primer argumento debe permitir iteración" #: extmod/ulab/code/vectorise.c msgid "first argument must be an ndarray" -msgstr "" +msgstr "el primer argumento debe ser ndarray" #: py/objtype.c msgid "first argument to super() must be type" @@ -2319,7 +2328,7 @@ msgstr "" #: py/objint.c msgid "float too big" -msgstr "" +msgstr "punto flotante muy grande" #: shared-bindings/_stage/Text.c msgid "font must be 2048 bytes long" @@ -2352,7 +2361,7 @@ msgstr "" #: extmod/ulab/code/compare.c msgid "function is implemented for scalars and ndarrays only" -msgstr "" +msgstr "la función está implementada solo para escalares y ndarrays" #: py/argcheck.c #, c-format @@ -2411,7 +2420,7 @@ msgstr "formato incompleto" #: py/objstr.c msgid "incomplete format key" -msgstr "" +msgstr "formato de llave incompleto" #: extmod/modubinascii.c msgid "incorrect padding" @@ -2419,7 +2428,7 @@ msgstr "relleno (padding) incorrecto" #: extmod/ulab/code/ndarray.c msgid "index is out of bounds" -msgstr "" +msgstr "el índice está fuera de límites" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -2434,11 +2443,11 @@ msgstr "indices deben ser enteros" #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" -msgstr "" +msgstr "los índices deben ser enteros, particiones o listas de booleanos" #: extmod/ulab/code/approx.c msgid "initial values must be iterable" -msgstr "" +msgstr "los valores iniciales deben permitir iteración" #: py/compile.c msgid "inline assembler must be a function" @@ -2446,35 +2455,35 @@ msgstr "ensamblador en línea debe ser una función" #: extmod/ulab/code/create.c msgid "input argument must be an integer or a 2-tuple" -msgstr "" +msgstr "el argumento de entrada debe ser un entero o una tupla de par" #: extmod/ulab/code/fft.c msgid "input array length must be power of 2" -msgstr "" +msgstr "el tamaño del arreglo de entrada debe ser potencia de 2" #: extmod/ulab/code/poly.c msgid "input data must be an iterable" -msgstr "" +msgstr "los datos de entrada deben permitir iteración" #: extmod/ulab/code/linalg.c msgid "input matrix is asymmetric" -msgstr "" +msgstr "la matriz de entrada es asimétrica" #: extmod/ulab/code/linalg.c msgid "input matrix is singular" -msgstr "" +msgstr "la matriz de entrada es singular" #: extmod/ulab/code/linalg.c msgid "input must be square matrix" -msgstr "" +msgstr "la entrada debe ser una matriz cuadrada" #: extmod/ulab/code/numerical.c msgid "input must be tuple, list, range, or ndarray" -msgstr "" +msgstr "la entrada debe ser una tupla, lista, rango o ndarray" #: extmod/ulab/code/poly.c msgid "input vectors must be of equal length" -msgstr "" +msgstr "los vectores de entrada deben ser de igual tamaño" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" @@ -2491,7 +2500,7 @@ msgstr "" #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" -msgstr "" +msgstr "el intervalo debe ser der rango %s-%s" #: lib/netutils/netutils.c msgid "invalid arguments" @@ -2523,7 +2532,7 @@ msgstr "decorador de micropython inválido" #: shared-bindings/random/__init__.c msgid "invalid step" -msgstr "" +msgstr "paso inválido" #: py/compile.c py/parse.c msgid "invalid syntax" @@ -2552,11 +2561,11 @@ msgstr "issubclass() arg 2 debe ser una clase o tuple de clases" #: extmod/ulab/code/ndarray.c msgid "iterables are not of the same length" -msgstr "" +msgstr "los iterables no son del mismo tamaño" #: extmod/ulab/code/linalg.c msgid "iterations did not converge" -msgstr "" +msgstr "las iteraciones no convergen" #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" @@ -2587,7 +2596,7 @@ msgstr "argumento length no permitido para este tipo" #: shared-bindings/audiomixer/MixerVoice.c msgid "level must be between 0 and 1" -msgstr "" +msgstr "el nivel debe ser entre 0 y 1" #: py/objarray.c msgid "lhs and rhs should be compatible" From 4d9fcc6ed01d88de8747df3b47e2aab387903a99 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Mon, 29 Jun 2020 22:48:56 +0000 Subject: [PATCH 038/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 56.9% (432 of 759 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 506 ++++++++++++++++++++++++++---------------------- 1 file changed, 279 insertions(+), 227 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 33d98d5bdb..6b921ffdfe 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-25 11:44-0500\n" -"PO-Revision-Date: 2020-06-26 16:42+0000\n" +"PO-Revision-Date: 2020-06-29 22:52+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -64,7 +64,7 @@ msgstr "%%c requer int ou char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d" +msgstr "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -72,15 +72,15 @@ msgstr "%q em uso" #: py/obj.c msgid "%q index out of range" -msgstr "" +msgstr "O índice %q está fora do intervalo" #: py/obj.c msgid "%q indices must be integers, not %s" -msgstr "" +msgstr "Os índices %q devem ser inteiros, e não %s" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" -msgstr "" +msgstr "A lista %q deve ser uma lista" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c @@ -91,7 +91,7 @@ msgstr "%q deve ser >= 1" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" -msgstr "" +msgstr "%q deve ser uma tupla de comprimento 2" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -99,7 +99,7 @@ msgstr "%q deve ser um int" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "" +msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" #: py/argcheck.c msgid "'%q' argument required" @@ -108,98 +108,100 @@ msgstr "'%q' argumento(s) requerido(s)" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" -msgstr "" +msgstr "'%s' exige um rótulo" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a register" -msgstr "" +msgstr "'%s' exige um registro" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects a special register" -msgstr "" +msgstr "'%s' exige um registro especial" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects an FPU register" -msgstr "" +msgstr "'%s' exige um registro FPU" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects an address of the form [a, b]" -msgstr "" +msgstr "'%s' exige um endereço no formato [a, b]" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects an integer" -msgstr "" +msgstr "'%s' exige um número inteiro" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects at most r%d" -msgstr "" +msgstr "'%s' exige no máximo r%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "" +msgstr "'%s' exige {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format msgid "'%s' integer %d is not within range %d..%d" -msgstr "" +msgstr "O número inteiro '%s' %d não está dentro do intervalo %d..%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' integer 0x%x does not fit in mask 0x%x" -msgstr "" +msgstr "O número inteiro '%s' 0x%x não cabe na máscara 0x%x" #: py/runtime.c msgid "'%s' object cannot assign attribute '%q'" -msgstr "" +msgstr "O objeto '%s' não pode definir o atributo '%q'" #: py/proto.c msgid "'%s' object does not support '%q'" -msgstr "" +msgstr "O objeto '%s' não é compatível com '%q'" #: py/obj.c #, c-format msgid "'%s' object does not support item assignment" -msgstr "" +msgstr "O objeto '%s' não compatível com a atribuição dos itens" #: py/obj.c #, c-format msgid "'%s' object does not support item deletion" -msgstr "" +msgstr "O objeto '%s' não é compatível com exclusão do item" #: py/runtime.c msgid "'%s' object has no attribute '%q'" -msgstr "" +msgstr "O objeto '%s' não possui o atributo '%q'" #: py/runtime.c #, c-format msgid "'%s' object is not an iterator" -msgstr "" +msgstr "O objeto '%s' não é um iterador" #: py/objtype.c py/runtime.c #, c-format msgid "'%s' object is not callable" -msgstr "" +msgstr "O objeto '%s' não é invocável" #: py/runtime.c #, c-format msgid "'%s' object is not iterable" -msgstr "" +msgstr "O objeto '%s' não é iterável" #: py/obj.c #, c-format msgid "'%s' object is not subscriptable" -msgstr "" +msgstr "O objeto '%s' não é subroteirizável" #: py/objstr.c msgid "'=' alignment not allowed in string format specifier" msgstr "" +"'=' alinhamento não permitido no especificador do formato da cadeia de " +"caracteres" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" @@ -207,59 +209,59 @@ msgstr "'S' e 'O' não são tipos de formato suportados" #: py/compile.c msgid "'align' requires 1 argument" -msgstr "" +msgstr "O 'align' exige 1 argumento" #: py/compile.c msgid "'async for' or 'async with' outside async function" -msgstr "" +msgstr "'assíncrono para' ou 'assíncrono com' função assíncrona externa" #: py/compile.c msgid "'await' outside function" -msgstr "" +msgstr "'aguardar' fora da função" #: py/compile.c msgid "'break' outside loop" -msgstr "" +msgstr "'break' fora do loop" #: py/compile.c msgid "'continue' outside loop" -msgstr "" +msgstr "'continue' fora do loop" #: py/compile.c msgid "'data' requires at least 2 arguments" -msgstr "" +msgstr "'data' exige pelo menos 2 argumentos" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "" +msgstr "'data' exige argumentos inteiros" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "" +msgstr "'label' exige 1 argumento" #: py/compile.c msgid "'return' outside function" -msgstr "" +msgstr "função externa 'return'" #: py/compile.c msgid "'yield' outside function" -msgstr "" +msgstr "função externa 'yield'" #: py/compile.c msgid "*x must be assignment target" -msgstr "" +msgstr "*x deve ser o destino da atribuição" #: py/obj.c msgid ", in %q\n" -msgstr "" +msgstr ", em %q\n" #: py/objcomplex.c msgid "0.0 to a complex power" -msgstr "" +msgstr "0,0 para uma potência complexa" #: py/modbuiltins.c msgid "3-arg pow() not supported" -msgstr "" +msgstr "3-arg pow() não compatível" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -273,7 +275,7 @@ msgstr "O endereço deve ter %d bytes de comprimento" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" -msgstr "" +msgstr "O tipo do endereço está fora do alcance" #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -293,7 +295,7 @@ msgstr "Todos os canais de eventos em uso" #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "All sync event channels in use" -msgstr "" +msgstr "Todos os canais dos eventos de sincronização em uso" #: shared-bindings/pulseio/PWMOut.c msgid "All timers for this pin are in use" @@ -313,11 +315,11 @@ msgstr "Todos os temporizadores em uso" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." -msgstr "" +msgstr "Já está anunciando." #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" -msgstr "" +msgstr "O AnalogIn não é compatível no pino informado" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c @@ -327,7 +329,7 @@ msgstr "Funcionalidade AnalogOut não suportada" #: shared-bindings/analogio/AnalogOut.c msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" +msgstr "O AnalogOut é de apenas 16 bits. O valor deve ser menor que 65536." #: ports/atmel-samd/common-hal/analogio/AnalogOut.c msgid "AnalogOut not supported on given pin" @@ -344,15 +346,17 @@ msgstr "Array deve conter meias palavras (tipo 'H')" #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "" +msgstr "Os valores da matriz devem ser bytes simples." #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "At most %d %q may be specified (not %d)" -msgstr "" +msgstr "Pelo menos %d %q pode ser definido (não %d)" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" +"A tentativa da área de alocação dinâmica de variáveis (heap) quando o " +"MicroPython VM não está em execução." #: main.c msgid "Auto-reload is off.\n" @@ -363,19 +367,23 @@ msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" +"O recarregamento automático está ativo. Simplesmente salve os arquivos via " +"USB para executá-los ou digite REPL para desativar.\n" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "" +msgstr "Abaixo da taxa mínima de quadros" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "" +"O clock de bits e a seleção de palavras devem compartilhar uma unidade de " +"clock" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." -msgstr "" +msgstr "A profundidade de bits deve ser o múltiplo de 8." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" @@ -389,7 +397,7 @@ msgstr "Ambos os pinos devem suportar interrupções de hardware" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" -msgstr "" +msgstr "O brilho deve ser 0-1,0" #: shared-bindings/supervisor/__init__.c msgid "Brightness must be between 0 and 255" @@ -398,12 +406,12 @@ msgstr "O brilho deve estar entre 0 e 255" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" -msgstr "" +msgstr "Brilho não ajustável" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "O buffer + desvio é muito pequeno %d %d %d" #: shared-module/usb_hid/Device.c #, c-format @@ -413,30 +421,30 @@ msgstr "Buffer de tamanho incorreto. Deve ser %d bytes." #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "" +msgstr "O buffer não é um bytearray." #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" -msgstr "" +msgstr "O buffer é muito pequeno" #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "" +msgstr "O tamanho do buffer %d é muito grande. Deve ser menor que %d" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" -msgstr "" +msgstr "O comprimento do buffer deve ter pelo menos 1" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Buffer too large and unable to allocate" -msgstr "" +msgstr "O buffer é muito grande e incapaz de alocar" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "O buffer é muito curto em %d bytes" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c @@ -454,15 +462,15 @@ msgstr "Os bytes devem estar entre 0 e 255." #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" -msgstr "" +msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "" +msgstr "Chame super().__init__() antes de acessar o objeto nativo." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "" +msgstr "Não é possível definir o CCCD com a característica local" #: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" @@ -472,7 +480,7 @@ msgstr "Não é possível excluir valores" #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "" +msgstr "Não é possível obter pull enquanto está modo de saída" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" @@ -481,10 +489,12 @@ msgstr "Não é possível obter a temperatura" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" +"Não é possível ter respostas da verificação para os anúncios estendidos e " +"conectáveis." #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Cannot output both channels on the same pin" -msgstr "" +msgstr "Não é possível emitir os dois canais no mesmo pino" #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." @@ -503,18 +513,19 @@ msgstr "Não é possível remontar '/' enquanto o USB estiver ativo." #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c msgid "Cannot reset into bootloader because no bootloader is present." msgstr "" +"Não é possível redefinir para o bootloader porque o mesmo não está presente." #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "" +msgstr "Não é possível definir o valor quando a direção é inserida." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Cannot specify RTS or CTS in RS485 mode" -msgstr "" +msgstr "Não é possível definir o RTS ou CTS no modo RS485" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "" +msgstr "Não é possível subclassificar a fatia" #: shared-module/bitbangio/SPI.c msgid "Cannot transfer without MOSI and MISO pins." @@ -522,11 +533,11 @@ msgstr "Não é possível transferir sem os pinos MOSI e MISO." #: extmod/moductypes.c msgid "Cannot unambiguously get sizeof scalar" -msgstr "" +msgstr "Não é possível obter inequivocamente o tamanho do escalar" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" -msgstr "" +msgstr "Não é possível variar a frequência em um timer que já esteja em uso" #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." @@ -534,17 +545,20 @@ msgstr "Não é possível fazer a escrita sem um pino MOSI." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "" +msgstr "Escrita CharacteristicBuffer não informada" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "" +msgstr "O núcleo principal do CircuitPython falhou feio. Ops!\n" #: supervisor/shared/safe_mode.c msgid "" "CircuitPython is in safe mode because you pressed the reset button during " "boot. Press again to exit safe mode.\n" msgstr "" +"O CircuitPython está no modo de segurança porque você pressionou o botão de " +"redefinição durante a inicialização. Pressione novamente para sair do modo " +"de segurança.\n" #: shared-module/bitbangio/SPI.c msgid "Clock pin init failed." @@ -560,7 +574,7 @@ msgstr "Unidade de Clock em uso" #: shared-bindings/_pew/PewPew.c msgid "Column entry must be digitalio.DigitalInOut" -msgstr "" +msgstr "A entrada da coluna deve ser digitalio.DigitalInOut" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c @@ -572,14 +586,15 @@ msgid "" "Connection has been disconnected and can no longer be used. Create a new " "connection." msgstr "" +"A conexão foi desconectada e não pode mais ser usada. Crie uma nova conexão." #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "" +msgstr "Arquivo .mpy corrompido" #: py/emitglue.c msgid "Corrupt raw code" -msgstr "" +msgstr "Código bruto corrompido" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" @@ -591,35 +606,35 @@ msgstr "Não foi possível inicializar o UART" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not initialize channel" -msgstr "" +msgstr "Não foi possível inicializar o canal" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not initialize timer" -msgstr "" +msgstr "Não foi possível inicializar o temporizador" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not re-init channel" -msgstr "" +msgstr "Não foi possível reiniciar o canal" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not re-init timer" -msgstr "" +msgstr "Não foi possível reiniciar o temporizador" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not restart PWM" -msgstr "" +msgstr "Não foi possível reiniciar o PWM" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not start PWM" -msgstr "" +msgstr "Não foi possível iniciar o PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" -msgstr "" +msgstr "Não foi possível iniciar a interrupção, RX ocupado" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" +msgstr "Não foi possível alocar o decodificador" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c @@ -628,7 +643,7 @@ msgstr "Não pôde alocar primeiro buffer" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate input buffer" -msgstr "" +msgstr "Não foi possível alocar o buffer de entrada" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c @@ -637,15 +652,15 @@ msgstr "Não pôde alocar segundo buffer" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "" +msgstr "Falha no HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "" +msgstr "Erro de Inicialização do Canal DAC" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" -msgstr "" +msgstr "Erro de Inicialização do Dispositivo DAC" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" @@ -654,7 +669,7 @@ msgstr "DAC em uso" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c msgid "Data 0 pin must be byte aligned" -msgstr "" +msgstr "O pino de dados 0 deve ser alinhado por bytes" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" @@ -666,34 +681,34 @@ msgstr "Os dados são grandes demais para o pacote de publicidade" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." -msgstr "" +msgstr "A capacidade do destino é menor que destination_length." #: ports/nrf/common-hal/audiobusio/I2SOut.c msgid "Device in use" -msgstr "" +msgstr "Dispositivo em uso" #: ports/cxd56/common-hal/digitalio/DigitalInOut.c msgid "DigitalInOut not supported on given pin" -msgstr "" +msgstr "O DigitalInOut não é compatível em um determinado pino" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." -msgstr "" +msgstr "O monitor deve ter um espaço de cores com 16 bits." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" -msgstr "" +msgstr "A rotação da tela deve estar em incrementos de 90 graus" #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." -msgstr "" +msgstr "O modo do controlador não é usado quando a direção for inserida." #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" -msgstr "" +msgstr "O BCE opera apenas com 16 bytes por vez" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -719,7 +734,7 @@ msgstr "Uma característica é necessária" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" -msgstr "" +msgstr "Esperava um Serviço" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c @@ -728,20 +743,20 @@ msgstr "Um UUID é necessário" #: shared-bindings/_bleio/Adapter.c msgid "Expected an Address" -msgstr "" +msgstr "Um endereço esperado" #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" -msgstr "" +msgstr "Tupla esperada com comprimento %d, obteve %d" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Extended advertisements with scan response not supported." -msgstr "" +msgstr "Anúncios estendidos não compatíveis com a resposta da varredura." #: extmod/ulab/code/fft.c msgid "FFT is defined for ndarrays only" -msgstr "" +msgstr "O FFT é definido apenas para ndarrays" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." @@ -767,15 +782,15 @@ msgstr "Falha ao alocar buffer RX de %d bytes" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: internal error" -msgstr "" +msgstr "Falha ao conectar: erro interno" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: timeout" -msgstr "" +msgstr "Falha ao conectar: tempo limite" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" -msgstr "" +msgstr "Falha ao analisar o arquivo MP3" #: ports/nrf/sd_mutex.c #, c-format @@ -784,7 +799,7 @@ msgstr "Houve uma falha ao liberar o mutex, err 0x%04x" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." -msgstr "" +msgstr "Falha ao gravar o flash interno." #: py/moduerrno.c msgid "File exists" @@ -793,21 +808,23 @@ msgstr "Arquivo já existe" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Frequency captured is above capability. Capture Paused." msgstr "" +"A frequência capturada está acima da capacidade. A captura está em pausa." #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" +"A frequência deve coincidir com o PWMOut existente usando este temporizador" #: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c #: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c msgid "Function requires lock" -msgstr "" +msgstr "A função requer bloqueio" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" -msgstr "" +msgstr "O grupo já está em uso" #: shared-module/displayio/Group.c msgid "Group full" @@ -816,11 +833,11 @@ msgstr "Grupo cheio" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c msgid "Hardware busy, try alternative pins" -msgstr "" +msgstr "O hardware está ocupado, tente os pinos alternativos" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Hardware in use, try alternative pins" -msgstr "" +msgstr "O hardware está em uso, tente os pinos alternativos" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" @@ -828,43 +845,45 @@ msgstr "Operação I/O no arquivo fechado" #: ports/stm/common-hal/busio/I2C.c msgid "I2C Init Error" -msgstr "" +msgstr "Erro de inicialização do I2C" #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" -msgstr "" +msgstr "O IV deve ter %d bytes de comprimento" #: py/persistentcode.c msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" +"Arquivo .mpy incompatível. Atualize todos os arquivos .mpy. Consulte " +"http://adafru.it/mpy-update para mais informações." #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" -msgstr "" +msgstr "O tamanho do buffer está incorreto" #: py/moduerrno.c msgid "Input/output error" -msgstr "" +msgstr "Erro de entrada/saída" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" -msgstr "" +msgstr "Autenticação insuficiente" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient encryption" -msgstr "" +msgstr "Criptografia insuficiente" #: ports/stm/common-hal/busio/UART.c msgid "Internal define error" -msgstr "" +msgstr "Erro interno de definição" #: shared-module/rgbmatrix/RGBMatrix.c #, c-format msgid "Internal error #%d" -msgstr "" +msgstr "Erro interno #%d" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -873,7 +892,7 @@ msgstr "Pino do %q inválido" #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" -msgstr "" +msgstr "Valor inválido da unidade ADC" #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" @@ -881,11 +900,11 @@ msgstr "Arquivo BMP inválido" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "Invalid DAC pin supplied" -msgstr "" +msgstr "O pino DAC informado é inválido" #: ports/stm/common-hal/busio/I2C.c msgid "Invalid I2C pin selection" -msgstr "" +msgstr "A seleção dos pinos I2C é inválido" #: ports/atmel-samd/common-hal/pulseio/PWMOut.c #: ports/cxd56/common-hal/pulseio/PWMOut.c @@ -895,11 +914,11 @@ msgstr "Frequência PWM inválida" #: ports/stm/common-hal/busio/SPI.c msgid "Invalid SPI pin selection" -msgstr "" +msgstr "A seleção do pino SPI é inválido" #: ports/stm/common-hal/busio/UART.c msgid "Invalid UART pin selection" -msgstr "" +msgstr "A seleção dos pinos UART é inválido" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" @@ -907,7 +926,7 @@ msgstr "Argumento inválido" #: shared-module/displayio/Bitmap.c msgid "Invalid bits per value" -msgstr "" +msgstr "Os valores por bits são inválidos" #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Invalid buffer size" @@ -915,11 +934,11 @@ msgstr "O tamanho do buffer é inválido" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "Invalid byteorder string" -msgstr "" +msgstr "A cadeia de bytes é inválida" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" +msgstr "O período de captura é inválido. O intervalo válido é: 1 - 500" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid channel count" @@ -939,11 +958,11 @@ msgstr "Tamanho do pedaço de formato inválido" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Invalid frequency supplied" -msgstr "" +msgstr "A frequência informada é inválida" #: supervisor/shared/safe_mode.c msgid "Invalid memory access." -msgstr "" +msgstr "O acesso da memória é inválido." #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid number of bits" @@ -981,28 +1000,28 @@ msgstr "Pinos inválidos" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Invalid pins for PWMOut" -msgstr "" +msgstr "Os pinos para o PWMOut são inválidos" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c #: shared-bindings/displayio/FourWire.c msgid "Invalid polarity" -msgstr "" +msgstr "Polaridade inválida" #: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" -msgstr "" +msgstr "Propriedades inválidas" #: shared-bindings/microcontroller/__init__.c msgid "Invalid run mode." -msgstr "" +msgstr "O modo de execução é inválido." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "" +msgstr "O Security_mode é inválido" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" -msgstr "" +msgstr "A voz é inválida" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice count" @@ -1014,23 +1033,23 @@ msgstr "Aqruivo de ondas inválido" #: ports/stm/common-hal/busio/UART.c msgid "Invalid word/bit length" -msgstr "" +msgstr "O comprimento do bit/palavra são inválidos" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" -msgstr "" +msgstr "A chave deve ter 16, 24 ou 32 bytes de comprimento" #: py/compile.c msgid "LHS of keyword arg must be an id" -msgstr "" +msgstr "O LHS da palavra-chave arg deve ser um ID" #: shared-module/displayio/Group.c msgid "Layer already in a group." -msgstr "" +msgstr "A camada já existe em um grupo." #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass." -msgstr "" +msgstr "A camada deve ser uma subclasse Group ou TileGrid." #: py/objslice.c msgid "Length must be an int" @@ -1038,7 +1057,7 @@ msgstr "Tamanho deve ser um int" #: py/objslice.c msgid "Length must be non-negative" -msgstr "" +msgstr "O comprimento deve ser positivo" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1051,44 +1070,44 @@ msgstr "Inicialização do pino MOSI falhou." #: shared-module/displayio/Shape.c #, c-format msgid "Maximum x value when mirrored is %d" -msgstr "" +msgstr "O valor máximo de x quando espelhado é %d" #: supervisor/shared/safe_mode.c msgid "MicroPython NLR jump failed. Likely memory corruption." -msgstr "" +msgstr "O salto do MicroPython NLR falhou. Possível corrupção de memória." #: supervisor/shared/safe_mode.c msgid "MicroPython fatal error." -msgstr "" +msgstr "Houve um erro fatal do MicroPython." #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" -msgstr "" +msgstr "O atraso na inicialização do microfone deve estar entre 0,0 e 1,0" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" -msgstr "" +msgstr "O pino MISO ou MOSI está ausente" #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." -msgstr "" +msgstr "Deve ser uma subclasse %q." #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c msgid "Must provide MISO or MOSI pin" -msgstr "" +msgstr "Deve informar os pinos MISO ou MOSI" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" -msgstr "" +msgstr "Deve utilizar um múltiplo de 6 pinos rgb, não %d" #: py/parse.c msgid "Name too long" -msgstr "" +msgstr "Nome muito longo" #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" -msgstr "" +msgstr "Não há nenhum CCCD para esta característica" #: ports/atmel-samd/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1102,11 +1121,11 @@ msgstr "Nenhum canal DMA encontrado" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c msgid "No MISO Pin" -msgstr "" +msgstr "Nenhum pino MISO" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c msgid "No MOSI Pin" -msgstr "" +msgstr "Nenhum pino MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1122,11 +1141,11 @@ msgstr "Nenhum pino TX" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" -msgstr "" +msgstr "Nenhum clock disponível" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" -msgstr "" +msgstr "Sem conexão: o comprimento não pode ser determinado" #: shared-bindings/board/__init__.c msgid "No default %q bus" @@ -1138,7 +1157,7 @@ msgstr "Não há GCLKs livre" #: shared-bindings/os/__init__.c msgid "No hardware random available" -msgstr "" +msgstr "Nenhum hardware aleatório está disponível" #: ports/atmel-samd/common-hal/ps2io/Ps2.c msgid "No hardware support on clk pin" @@ -1151,35 +1170,35 @@ msgstr "Nenhum suporte de hardware no pino" #: shared-bindings/aesio/aes.c msgid "No key was specified" -msgstr "" +msgstr "Nenhuma chave foi definida" #: shared-bindings/time/__init__.c msgid "No long integer support" -msgstr "" +msgstr "Não há compatibilidade com inteiro longo" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "No more timers available on this pin." -msgstr "" +msgstr "Não há mais temporizadores disponíveis neste pino." #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" -msgstr "" +msgstr "Não há pulldown no pino; É recomendável utilizar um resistor de 1M ohm" #: py/moduerrno.c msgid "No space left on device" -msgstr "" +msgstr "Não resta espaço no dispositivo" #: py/moduerrno.c msgid "No such file/directory" -msgstr "" +msgstr "Este arquivo/diretório não existe" #: shared-module/rgbmatrix/RGBMatrix.c msgid "No timer available" -msgstr "" +msgstr "Não há um temporizador disponível" #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." -msgstr "" +msgstr "Declaração de falha do dispositivo Nordic Soft." #: ports/nrf/common-hal/_bleio/__init__.c #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -1189,7 +1208,7 @@ msgstr "Não Conectado" #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c #: shared-bindings/audiopwmio/PWMAudioOut.c msgid "Not playing" -msgstr "" +msgstr "Não está jogando" #: shared-bindings/util.c msgid "" @@ -1203,13 +1222,15 @@ msgstr "A paridade ímpar não é compatível" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " -msgstr "" +msgstr "Apenas mono com 8 ou 16 bits com " #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" "Only Windows format, uncompressed BMP supported: given header size is %d" msgstr "" +"O BMP descompactado é compatível apenas no formato Windows: o tamanho do " +"cabeçalho é %d" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1217,25 +1238,31 @@ msgid "" "Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " "%d bpp given" msgstr "" +"São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " +"16bpp ou superior: determinado %d bpp" #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." -msgstr "" +msgstr "A superamostragem deve ser um múltiplo de 8." #: shared-bindings/pulseio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" msgstr "" +"O duty_cycle do PWM deve estar entre 0 e inclusive 65535 (com resolução de " +"16 bits)" #: shared-bindings/pulseio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" +"A frequência do PWM não pode ser gravada quando variable_frequency for False " +"na construção." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c msgid "ParallelBus not yet supported" -msgstr "" +msgstr "O ParallelBus ainda não é compatível" #: py/moduerrno.c msgid "Permission denied" @@ -1255,11 +1282,11 @@ msgstr "" #: ports/atmel-samd/common-hal/countio/Counter.c msgid "Pin must support hardware interrupts" -msgstr "" +msgstr "O pino deve ser compatível com as interrupções do hardware" #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin number already reserved by EXTI" -msgstr "" +msgstr "Número do PIN já está reservado através da EXTI" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1268,6 +1295,9 @@ msgid "" "bytes. If this cannot be avoided, pass allow_inefficient=True to the " "constructor" msgstr "" +"A pinagem utiliza %d bytes por elemento, que consome mais do que %d bytes do " +"ideal. Caso isso não possa ser evitado, passe allow_inefficient=True ao " +"construtor" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" @@ -1284,34 +1314,37 @@ msgstr "Buffer Ps2 vazio" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" +"O buffer do prefixo deve estar na área de alocação dinâmica de variáveis " +"(heap)" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload." msgstr "" +"Pressione qualquer tecla para entrar no REPL. Use CTRL-D para recarregar." #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." -msgstr "" +msgstr "O Pull não foi usado quando a direção for gerada." #: ports/stm/common-hal/pulseio/PulseIn.c msgid "PulseIn not supported on this chip" -msgstr "" +msgstr "O PulseIn não é compatível neste CI" #: ports/stm/common-hal/pulseio/PulseOut.c msgid "PulseOut not supported on this chip" -msgstr "" +msgstr "O PulseOut não é compatível neste CI" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" -msgstr "" +msgstr "Erro DeInit RNG" #: ports/stm/common-hal/os/__init__.c msgid "RNG Init Error" -msgstr "" +msgstr "Houve um erro na inicialização do RNG" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" -msgstr "" +msgstr "A definição da inversão do RS485 quando não está no modo RS485" #: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c #: ports/nrf/common-hal/rtc/RTC.c @@ -1325,11 +1358,11 @@ msgstr "O RTC não é suportado nesta placa" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" +msgstr "RTS/CTS/RS485 Ainda não é compatível neste dispositivo" #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" -msgstr "" +msgstr "Houve um erro na geração do número aleatório" #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" @@ -1345,11 +1378,11 @@ msgstr "Objeto de leitura apenas" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" -msgstr "" +msgstr "A recarga foi cedo demais" #: shared-bindings/aesio/aes.c msgid "Requested AES mode is unsupported" -msgstr "" +msgstr "O modo AES solicitado não é compatível" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -1357,7 +1390,7 @@ msgstr "Canal direito não suportado" #: shared-bindings/_pew/PewPew.c msgid "Row entry must be digitalio.DigitalInOut" -msgstr "" +msgstr "A entrada da linha deve ser digitalio.DigitalInOut" #: main.c msgid "Running in safe mode! Auto-reload is off.\n" @@ -1374,15 +1407,15 @@ msgstr "SDA ou SCL precisa de um pull up" #: ports/stm/common-hal/busio/SPI.c msgid "SPI Init Error" -msgstr "" +msgstr "Houve um erro na inicialização SPI" #: ports/stm/common-hal/busio/SPI.c msgid "SPI Re-initialization error" -msgstr "" +msgstr "Houve um erro na reinicialização SPI" #: shared-bindings/audiomixer/Mixer.c msgid "Sample rate must be positive" -msgstr "" +msgstr "A taxa de amostragem deve ser positiva" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #, c-format @@ -1391,15 +1424,15 @@ msgstr "Taxa de amostragem muito alta. Deve ser menor que %d" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Scan already in progess. Stop with stop_scan." -msgstr "" +msgstr "O escaneamento já está em andamento. Interrompa com stop_scan." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected CTS pin not valid" -msgstr "" +msgstr "O pino CTS selecionado é inválido" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Selected RTS pin not valid" -msgstr "" +msgstr "O pino RTS selecionado é inválido" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1408,20 +1441,20 @@ msgstr "Serializer em uso" #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." -msgstr "" +msgstr "Fatie e avalie os diferentes comprimentos." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c #: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" -msgstr "" +msgstr "Fatiamento não compatível" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" -msgstr "" +msgstr "Os buffers da origem e do destino devem ter o mesmo comprimento" #: extmod/modure.c msgid "Splitting with sub-captures" -msgstr "" +msgstr "Divisão com sub-capturas" #: shared-bindings/supervisor/__init__.c msgid "Stack size must be at least 256" @@ -1429,11 +1462,11 @@ msgstr "O tamanho da pilha deve ser pelo menos 256" #: shared-bindings/multiterminal/__init__.c msgid "Stream missing readinto() or write() method." -msgstr "" +msgstr "Transmita o método ausente readinto() ou write()." #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" -msgstr "" +msgstr "Forneça pelo menos um pino UART" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" @@ -1441,19 +1474,24 @@ msgstr "" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" -msgstr "" +msgstr "A leitura da temperatura expirou" #: supervisor/shared/safe_mode.c msgid "" "The CircuitPython heap was corrupted because the stack was too small.\n" "Please increase the stack size if you know how, or if not:" msgstr "" +"A área de alocação dinâmica de variáveis (heap) do CircuitPython foi " +"corrompida porque a pilha de funções (stack) era muito pequena.\n" +"Aumente o tamanho da pilha de funções caso saiba como, ou caso não saiba:" #: supervisor/shared/safe_mode.c msgid "" "The `microcontroller` module was used to boot into safe mode. Press reset to " "exit safe mode.\n" msgstr "" +"O módulo `microcontrolador` foi utilizado para inicializar no modo de " +"segurança. Pressione reset para encerrar do modo de segurança.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -1461,38 +1499,42 @@ msgid "" "enough power for the whole circuit and press reset (after ejecting " "CIRCUITPY).\n" msgstr "" +"A força do microcontrolador caiu. Verifique se a fonte de alimentação " +"fornece\n" +"energia suficiente para todo o circuito e pressione reset (após a ejeção " +"CIRCUITPY).\n" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" -msgstr "" +msgstr "A amostragem bits_per_sample não coincide com a do mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's channel count does not match the mixer's" -msgstr "" +msgstr "A contagem da amostragem dos canais não coincide com o a do mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's sample rate does not match the mixer's" -msgstr "" +msgstr "A taxa de amostragem da amostra não coincide com a do mixer" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's signedness does not match the mixer's" -msgstr "" +msgstr "A amostragem \"signedness\" não coincide com a do mixer" #: shared-bindings/displayio/TileGrid.c msgid "Tile height must exactly divide bitmap height" -msgstr "" +msgstr "A altura do bloco deve dividir exatamente com a altura do bitmap" #: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" -msgstr "" +msgstr "O índice do bloco está fora dos limites" #: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" -msgstr "" +msgstr "O valor do bloco está fora dos limites" #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" -msgstr "" +msgstr "A largura do bloco deve dividir exatamente com a largura do bitmap" #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format @@ -1505,43 +1547,43 @@ msgstr "Muitos canais na amostra." #: shared-module/displayio/__init__.c msgid "Too many display busses" -msgstr "" +msgstr "Muitos barramentos estão sendo exibidos" #: shared-module/displayio/__init__.c msgid "Too many displays" -msgstr "" +msgstr "Exibições demais" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than outgoing_packet_length" -msgstr "" +msgstr "O total dos dados que serão gravados é maior que outgoing_packet_length" #: py/obj.c msgid "Traceback (most recent call last):\n" -msgstr "" +msgstr "Traceback (a última chamada mais recente):\n" #: shared-bindings/time/__init__.c msgid "Tuple or struct_time argument required" -msgstr "" +msgstr "O argumento de tupla ou struct_time é necessário" #: ports/stm/common-hal/busio/UART.c msgid "UART Buffer allocation error" -msgstr "" +msgstr "Houve um erro na alocação do Buffer UART" #: ports/stm/common-hal/busio/UART.c msgid "UART De-init error" -msgstr "" +msgstr "Houve um erro da não inicialização do UART" #: ports/stm/common-hal/busio/UART.c msgid "UART Init Error" -msgstr "" +msgstr "Houve um erro na inicialização do UART" #: ports/stm/common-hal/busio/UART.c msgid "UART Re-init error" -msgstr "" +msgstr "Houve um erro na reinicialização do UART" #: ports/stm/common-hal/busio/UART.c msgid "UART write error" -msgstr "" +msgstr "Houve um erro na gravação UART" #: shared-module/usb_hid/Device.c msgid "USB Busy" @@ -1553,15 +1595,15 @@ msgstr "Erro na USB" #: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" -msgstr "" +msgstr "O valor inteiro UUID deve ser 0-0xffff" #: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -msgstr "" +msgstr "A cadeia de caracteres UUID não 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" #: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" -msgstr "" +msgstr "O valor UUID não é um buffer str, int ou byte" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -1571,7 +1613,7 @@ msgstr "Não é possível alocar buffers para conversão assinada" #: shared-module/displayio/I2CDisplay.c #, c-format msgid "Unable to find I2C Display at %x" -msgstr "" +msgstr "Não foi possível encontrar a tela I2C no %x" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1580,11 +1622,11 @@ msgstr "Não é possível encontrar GCLK livre" #: py/parse.c msgid "Unable to init parser" -msgstr "" +msgstr "Não foi possível iniciar o analisador" #: shared-module/displayio/OnDiskBitmap.c msgid "Unable to read color palette data" -msgstr "" +msgstr "Não foi possível ler os dados da paleta de cores" #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -1592,37 +1634,39 @@ msgstr "Não é possível gravar no nvm." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" -msgstr "" +msgstr "Tipo uuid nrfx inesperado" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown gatt error: 0x%04x" -msgstr "" +msgstr "Erro gatt desconhecido: 0x%04x" #: supervisor/shared/safe_mode.c msgid "Unknown reason." -msgstr "" +msgstr "Motivo desconhecido." #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown security error: 0x%04x" -msgstr "" +msgstr "Erro de segurança desconhecido: 0x%04x" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown soft device error: %04x" -msgstr "" +msgstr "Erro desconhecido do dispositivo de soft: %04x" #: shared-bindings/_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." -msgstr "" +msgstr "Quantidade inigualável de itens no RHS (%d esperado, obteve %d)." #: ports/nrf/common-hal/_bleio/__init__.c msgid "" "Unspecified issue. Can be that the pairing prompt on the other device was " "declined or ignored." msgstr "" +"Problema desconhecido. Pode ser que o prompt de emparelhamento no outro " +"dispositivo tenha sido recusado ou ignorado." #: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/I2C.c @@ -1639,29 +1683,29 @@ msgstr "Formato não suportado" #: py/moduerrno.c msgid "Unsupported operation" -msgstr "" +msgstr "Operação não suportada" #: shared-bindings/digitalio/DigitalInOut.c msgid "Unsupported pull value." -msgstr "" +msgstr "O valor pull não é compatível." #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" -msgstr "" +msgstr "Comprimento do valor != comprimento fixo necessário" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" -msgstr "" +msgstr "O comprimento do valor é > max_length" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" -msgstr "" +msgstr "Atualmente, as funções do Viper não suportam mais de 4 argumentos" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Voltage read timed out" -msgstr "" +msgstr "O tempo limite de leitura da tensão expirou" #: main.c msgid "WARNING: Your code filename has two extensions\n" @@ -1696,6 +1740,12 @@ msgid "" "\n" "To list built-in modules please do `help(\"modules\")`.\n" msgstr "" +"Bem-vindo ao Adafruit CircuitPython% s!\n" +"\n" +"Visite learn.adafruit.com/category/circuitpython para obter guias de projeto." +"\n" +"\n" +"Para listar os módulos internos, faça `help (\" modules \")`.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" @@ -2166,7 +2216,7 @@ msgstr "vazio" #: extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" -msgstr "heap vazia" +msgstr "a área de alocação dinâmica de variáveis (heap) está vazia" #: py/objstr.c msgid "empty separator" @@ -2360,7 +2410,7 @@ msgstr "" #: extmod/moduheapq.c msgid "heap must be a list" -msgstr "heap deve ser uma lista" +msgstr "a área de alocação dinâmica de variáveis (heap) deve ser uma lista" #: py/compile.c msgid "identifier redefined as global" @@ -2609,6 +2659,8 @@ msgstr "" #: py/runtime.c msgid "memory allocation failed, heap is locked" msgstr "" +"falha na alocação de memória, a área de alocação dinâmica de variáveis (heap)" +" está bloqueada" #: py/builtinimport.c msgid "module not found" From 3f764d99eefb02cb2f19cf366ffe3f5831d6a675 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Mon, 29 Jun 2020 23:49:52 +0000 Subject: [PATCH 039/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 69.3% (526 of 759 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 195 +++++++++++++++++++++++++----------------------- 1 file changed, 102 insertions(+), 93 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 6b921ffdfe..6ade65a33f 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-25 11:44-0500\n" -"PO-Revision-Date: 2020-06-29 22:52+0000\n" +"PO-Revision-Date: 2020-06-29 23:50+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1740,20 +1740,20 @@ msgid "" "\n" "To list built-in modules please do `help(\"modules\")`.\n" msgstr "" -"Bem-vindo ao Adafruit CircuitPython% s!\n" +"Bem-vindo ao Adafruit CircuitPython %s!\n" "\n" -"Visite learn.adafruit.com/category/circuitpython para obter guias de projeto." +"Para obter guias de projeto, visite learn.adafruit.com/category/" +"circuitpython.\n" "\n" -"\n" -"Para listar os módulos internos, faça `help (\" modules \")`.\n" +"Para listar os módulos internos, faça `help(\"modules\")`.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" -msgstr "" +msgstr "A escrita não é compatível na Característica" #: supervisor/shared/safe_mode.c msgid "You are in safe mode: something unanticipated happened.\n" -msgstr "" +msgstr "Você está no modo de segurança: algo inesperado aconteceu.\n" #: supervisor/shared/safe_mode.c msgid "You requested starting safe mode by " @@ -1761,20 +1761,20 @@ msgstr "Você solicitou o início do modo de segurança através do " #: py/objtype.c msgid "__init__() should return None" -msgstr "" +msgstr "O __init__() deve retornar Nenhum" #: py/objtype.c #, c-format msgid "__init__() should return None, not '%s'" -msgstr "" +msgstr "O __init__() deve retornar Nenhum, não '%s'" #: py/objobject.c msgid "__new__ arg must be a user-type" -msgstr "" +msgstr "O argumento __new__ deve ser um tipo usuário" #: extmod/modubinascii.c extmod/moduhashlib.c msgid "a bytes-like object is required" -msgstr "" +msgstr "é necessário objetos tipo bytes" #: lib/embed/abort_.c msgid "abort() called" @@ -1787,23 +1787,23 @@ msgstr "endereço %08x não está alinhado com %d bytes" #: shared-bindings/i2cperipheral/I2CPeripheral.c msgid "address out of bounds" -msgstr "" +msgstr "endereço fora dos limites" #: shared-bindings/i2cperipheral/I2CPeripheral.c msgid "addresses is empty" -msgstr "" +msgstr "os endereços estão vazios" #: extmod/ulab/code/vectorise.c msgid "arctan2 is implemented for scalars and ndarrays only" -msgstr "" +msgstr "O arctan2 está implementado apenas para escalares e ndarrays" #: py/modbuiltins.c msgid "arg is an empty sequence" -msgstr "" +msgstr "o arg é uma sequência vazia" #: extmod/ulab/code/numerical.c msgid "argsort argument must be an ndarray" -msgstr "" +msgstr "O argumento argsort deve ser um ndarray" #: py/runtime.c msgid "argument has wrong type" @@ -1812,23 +1812,23 @@ msgstr "argumento tem tipo errado" #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c msgid "argument num/types mismatch" -msgstr "" +msgstr "o argumento num/tipos não combinam" #: py/runtime.c msgid "argument should be a '%q' not a '%q'" -msgstr "" +msgstr "o argumento deve ser um '%q' e não um '%q'" #: extmod/ulab/code/linalg.c msgid "arguments must be ndarrays" -msgstr "" +msgstr "os argumentos devem ser ndarrays" #: py/objarray.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" -msgstr "" +msgstr "matriz/bytes são necessários no lado direito" #: extmod/ulab/code/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "" +msgstr "tente obter argmin/argmax de uma sequência vazia" #: py/objstr.c msgid "attributes not supported yet" @@ -1836,39 +1836,39 @@ msgstr "atributos ainda não suportados" #: extmod/ulab/code/numerical.c msgid "axis must be -1, 0, None, or 1" -msgstr "" +msgstr "o eixo deve ser -1, 0, Nenhum ou 1" #: extmod/ulab/code/numerical.c msgid "axis must be -1, 0, or 1" -msgstr "" +msgstr "o eixo deve ser -1, 0 ou 1" #: extmod/ulab/code/numerical.c msgid "axis must be None, 0, or 1" -msgstr "" +msgstr "o eixo deve ser Nenhum, 0 ou 1" #: py/builtinevex.c msgid "bad compile mode" -msgstr "" +msgstr "modo de compilação ruim" #: py/objstr.c msgid "bad conversion specifier" -msgstr "" +msgstr "especificador de conversão incorreto" #: py/objstr.c msgid "bad format string" -msgstr "" +msgstr "formato da string incorreta" #: py/binary.c msgid "bad typecode" -msgstr "" +msgstr "typecode incorreto" #: py/emitnative.c msgid "binary op %q not implemented" -msgstr "" +msgstr "a operação binário %q não foi implementada" #: shared-bindings/busio/UART.c msgid "bits must be 7, 8 or 9" -msgstr "" +msgstr "os bits devem ser 7, 8 ou 9" #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" @@ -1880,7 +1880,7 @@ msgstr "ramo fora do alcance" #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" -msgstr "" +msgstr "o buffer deve ser um objeto como bytes" #: shared-module/struct/__init__.c msgid "buffer size must match format" @@ -1888,24 +1888,24 @@ msgstr "o tamanho do buffer deve coincidir com o formato" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "buffer slices must be of equal length" -msgstr "" +msgstr "as fatias do buffer devem ter o mesmo comprimento" #: py/modstruct.c shared-bindings/struct/__init__.c #: shared-module/struct/__init__.c msgid "buffer too small" -msgstr "" +msgstr "o buffer é muito pequeno" #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" -msgstr "" +msgstr "os botões devem ser digitalio.DigitalInOut" #: py/vm.c msgid "byte code not implemented" -msgstr "" +msgstr "o código dos bytes ainda não foi implementado" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "byteorder is not a string" -msgstr "" +msgstr "a ordem dos bytes não é uma cadeia de caracteres" #: ports/atmel-samd/common-hal/busio/UART.c msgid "bytes > 8 bits not supported" @@ -1913,7 +1913,7 @@ msgstr "bytes > 8 bits não suportado" #: py/objstr.c msgid "bytes value out of range" -msgstr "" +msgstr "o valor dos bytes estão fora do alcance" #: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" @@ -1929,144 +1929,148 @@ msgstr "Valor de calibração fora do intervalo +/- 127" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" -msgstr "" +msgstr "só pode haver até 4 parâmetros para a montagem Thumb" #: py/emitinlinextensa.c msgid "can only have up to 4 parameters to Xtensa assembly" -msgstr "" +msgstr "só pode haver até 4 parâmetros para a montagem Xtensa" #: py/persistentcode.c msgid "can only save bytecode" -msgstr "" +msgstr "apenas o bytecode pode ser salvo" #: py/objtype.c msgid "can't add special method to already-subclassed class" -msgstr "" +msgstr "não é possível adicionar o método especial à classe já subclassificada" #: py/compile.c msgid "can't assign to expression" -msgstr "" +msgstr "a expressão não pode ser atribuída" #: py/obj.c #, c-format msgid "can't convert %s to complex" -msgstr "" +msgstr "Não é possível converter %s para complex" #: py/obj.c #, c-format msgid "can't convert %s to float" -msgstr "" +msgstr "Não é possível converter %s para float" #: py/obj.c #, c-format msgid "can't convert %s to int" -msgstr "" +msgstr "Não é possível converter %s para int" #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" -msgstr "" +msgstr "não é possível converter implicitamente o objeto '%q' para %q" #: py/objint.c msgid "can't convert NaN to int" -msgstr "" +msgstr "Não é possível converter NaN para int" #: shared-bindings/i2cperipheral/I2CPeripheral.c msgid "can't convert address to int" -msgstr "" +msgstr "não é possível converter o endereço para int" #: py/objint.c msgid "can't convert inf to int" -msgstr "" +msgstr "não é possível converter inf para int" #: py/obj.c msgid "can't convert to complex" -msgstr "" +msgstr "não é possível converter para complex" #: py/obj.c msgid "can't convert to float" -msgstr "" +msgstr "não é possível converter para float" #: py/obj.c msgid "can't convert to int" -msgstr "" +msgstr "não é possível converter para int" #: py/objstr.c msgid "can't convert to str implicitly" -msgstr "" +msgstr "não é possível converter implicitamente para str" #: py/compile.c msgid "can't declare nonlocal in outer code" -msgstr "" +msgstr "não é possível declarar nonlocal no código externo" #: py/compile.c msgid "can't delete expression" -msgstr "" +msgstr "não é possível excluir a expressão" #: py/emitnative.c msgid "can't do binary op between '%q' and '%q'" -msgstr "" +msgstr "não é possível executar uma operação binária entre '%q' e '%q'" #: py/objcomplex.c msgid "can't do truncated division of a complex number" -msgstr "" +msgstr "não é possível fazer a divisão truncada de um número complexo" #: py/compile.c msgid "can't have multiple **x" -msgstr "" +msgstr "não pode haver vários **x" #: py/compile.c msgid "can't have multiple *x" -msgstr "" +msgstr "não pode haver vários *x" #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" -msgstr "" +msgstr "não é possível converter implicitamente '%q' em 'bool'" #: py/emitnative.c msgid "can't load from '%q'" -msgstr "" +msgstr "não é possível carregar a partir de '%q'" #: py/emitnative.c msgid "can't load with '%q' index" -msgstr "" +msgstr "não é possível carregar com o índice '%q'" #: py/objgenerator.c msgid "can't pend throw to just-started generator" -msgstr "" +msgstr "não pode pendurar o lançamento para o gerador recém-iniciado" #: py/objgenerator.c msgid "can't send non-None value to a just-started generator" msgstr "" +"Não é possível enviar algo que não seja um valor para um gerador recém-" +"iniciado" #: py/objnamedtuple.c msgid "can't set attribute" -msgstr "" +msgstr "não é possível definir o atributo" #: py/emitnative.c msgid "can't store '%q'" -msgstr "" +msgstr "não é possível armazenar '%q'" #: py/emitnative.c msgid "can't store to '%q'" -msgstr "" +msgstr "não é possível armazenar em '%q'" #: py/emitnative.c msgid "can't store with '%q' index" -msgstr "" +msgstr "não é possível armazenar com o índice '%q'" #: py/objstr.c msgid "" "can't switch from automatic field numbering to manual field specification" msgstr "" +"não é possível alternar entre a numeração automática dos campos para a manual" #: py/objstr.c msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +"não é possível alternar da especificação de campo manual para a automática" #: py/objtype.c msgid "cannot create '%q' instances" -msgstr "" +msgstr "não é possível criar instâncias '%q'" #: py/objtype.c msgid "cannot create instance" @@ -2078,43 +2082,46 @@ msgstr "não pode importar nome %q" #: py/builtinimport.c msgid "cannot perform relative import" -msgstr "" +msgstr "não pode executar a importação relativa" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array (incompatible input/output shape)" msgstr "" +"não é possível remodelar a matriz (formato de entrada/saída incompatível)" #: py/emitnative.c msgid "casting" -msgstr "" +msgstr "fundição" #: shared-bindings/_stage/Text.c msgid "chars buffer too small" -msgstr "" +msgstr "o buffer dos caracteres é muito pequeno" #: py/modbuiltins.c msgid "chr() arg not in range(0x110000)" -msgstr "" +msgstr "o arg chr() está fora do intervalo(0x110000)" #: py/modbuiltins.c msgid "chr() arg not in range(256)" -msgstr "" +msgstr "o arg chr() está fora do intervalo(256)" #: shared-module/vectorio/Circle.c msgid "circle can only be registered in one parent" -msgstr "" +msgstr "o círculo só pode ser registrado em um pai" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" -msgstr "" +msgstr "o buffer das cores deve ter 3 bytes (RGB) ou 4 bytes (RGB + pad byte)" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a buffer, tuple, list, or int" -msgstr "" +msgstr "O buffer das cores deve ser um buffer, tupla, lista ou int" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a bytearray or array of type 'b' or 'B'" msgstr "" +"O buffer das cores deve ser uma matriz de bytes ou uma matriz do tipo 'b' ou " +"'B'" #: shared-bindings/displayio/Palette.c msgid "color must be between 0x000000 and 0xffffff" @@ -2126,15 +2133,15 @@ msgstr "cor deve ser um int" #: py/objcomplex.c msgid "complex division by zero" -msgstr "" +msgstr "divisão complexa por zero" #: py/objfloat.c py/parsenum.c msgid "complex values not supported" -msgstr "" +msgstr "os valores complexos não compatíveis" #: extmod/moduzlib.c msgid "compression header" -msgstr "" +msgstr "compressão do cabeçalho" #: py/parse.c msgid "constant must be an integer" @@ -2142,27 +2149,27 @@ msgstr "constante deve ser um inteiro" #: py/emitnative.c msgid "conversion to object" -msgstr "" +msgstr "conversão para o objeto" #: extmod/ulab/code/filter.c msgid "convolve arguments must be linear arrays" -msgstr "" +msgstr "os argumentos convolutivos devem ser matrizes lineares" #: extmod/ulab/code/filter.c msgid "convolve arguments must be ndarrays" -msgstr "" +msgstr "os argumentos convolutivos devem ser ndarrays" #: extmod/ulab/code/filter.c msgid "convolve arguments must not be empty" -msgstr "" +msgstr "os argumentos convolutivos não devem estar vazios" #: extmod/ulab/code/ndarray.c msgid "could not broadast input array from shape" -msgstr "" +msgstr "não foi possível transmitir a matriz da entrada a partir da forma" #: extmod/ulab/code/poly.c msgid "could not invert Vandermonde matrix" -msgstr "" +msgstr "não foi possível inverter a matriz Vandermonde" #: extmod/ulab/code/approx.c msgid "data must be iterable" @@ -2174,24 +2181,26 @@ msgstr "" #: extmod/ulab/code/numerical.c msgid "ddof must be smaller than length of data set" -msgstr "" +msgstr "O ddof deve ser menor que o comprimento do conjunto dos dados" #: py/parsenum.c msgid "decimal numbers not supported" -msgstr "" +msgstr "os números decimais não são compatíveis" #: py/compile.c msgid "default 'except' must be last" -msgstr "" +msgstr "a predefinição 'exceto' deve ser o último" #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" msgstr "" +"o buffer do destino deve ser um bytearray ou matriz do tipo 'B' para " +"bit_depth = 8" #: shared-bindings/audiobusio/PDMIn.c msgid "destination buffer must be an array of type 'H' for bit_depth = 16" -msgstr "" +msgstr "o buffer do destino deve ser uma matriz do tipo 'H' para bit_depth = 16" #: shared-bindings/audiobusio/PDMIn.c msgid "destination_length must be an int >= 0" @@ -2199,11 +2208,11 @@ msgstr "destination_length deve ser um int >= 0" #: py/objdict.c msgid "dict update sequence has wrong length" -msgstr "" +msgstr "sequência da atualização dict tem o comprimento errado" #: extmod/ulab/code/numerical.c msgid "diff argument must be an ndarray" -msgstr "" +msgstr "O argumento diff deve ser um ndarray" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2220,7 +2229,7 @@ msgstr "a área de alocação dinâmica de variáveis (heap) está vazia" #: py/objstr.c msgid "empty separator" -msgstr "" +msgstr "separador vazio" #: shared-bindings/random/__init__.c msgid "empty sequence" @@ -2228,7 +2237,7 @@ msgstr "seqüência vazia" #: py/objstr.c msgid "end of format while looking for conversion specifier" -msgstr "" +msgstr "final de formato enquanto procura pelo especificador de conversão" #: shared-bindings/displayio/Shape.c msgid "end_x should be an int" From c1e7a254a3b6aceb66637a5b71efb47c0b928275 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 30 Jun 2020 01:50:07 +0200 Subject: [PATCH 040/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 51 +++++++++++++++++++++++++++++-- locale/cs.po | 51 +++++++++++++++++++++++++++++-- locale/de_DE.po | 51 +++++++++++++++++++++++++++++-- locale/es.po | 58 +++++++++++++++++++++++++++++++---- locale/fil.po | 51 +++++++++++++++++++++++++++++-- locale/fr.po | 51 +++++++++++++++++++++++++++++-- locale/it_IT.po | 51 +++++++++++++++++++++++++++++-- locale/ko.po | 51 +++++++++++++++++++++++++++++-- locale/nl.po | 51 +++++++++++++++++++++++++++++-- locale/pl.po | 51 +++++++++++++++++++++++++++++-- locale/pt_BR.po | 65 ++++++++++++++++++++++++++++++++++------ locale/sv.po | 51 +++++++++++++++++++++++++++++-- locale/zh_Latn_pinyin.po | 51 +++++++++++++++++++++++++++++-- 13 files changed, 636 insertions(+), 48 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index ae057fbd7a..8d89115d7a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -58,6 +58,10 @@ msgstr "" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" @@ -86,6 +90,10 @@ msgstr "buffers harus mempunyai panjang yang sama" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "" @@ -340,7 +348,7 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -421,6 +429,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -709,7 +721,8 @@ msgstr "Channel EXTINT sedang digunakan" msgid "Error in regex" msgstr "Error pada regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -869,6 +882,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1374,6 +1391,10 @@ msgid "Running in safe mode! Not running saved code.\n" msgstr "" "Berjalan di mode aman(safe mode)! tidak menjalankan kode yang tersimpan.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2003,6 +2024,10 @@ msgstr "" msgid "can't send non-None value to a just-started generator" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "" @@ -2129,6 +2154,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2686,6 +2715,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "" @@ -2707,6 +2740,10 @@ msgstr "tidak ada modul yang bernama '%q'" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "" @@ -3099,6 +3136,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "bits harus memilki nilai 8" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index b23144fc8c..3869cd45ab 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -66,6 +66,10 @@ msgstr "%% c vyžaduje int nebo char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "%d adresní piny a %d rgb piny označují výšku %d, nikoli %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q se nyní používá" @@ -93,6 +97,10 @@ msgstr "% q musí být > = 1" msgid "%q must be a tuple of length 2" msgstr "% q musí být n-tice délky 2" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "% q by měl být int" @@ -346,7 +354,7 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -425,6 +433,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "" @@ -706,7 +718,8 @@ msgstr "" msgid "Error in regex" msgstr "" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -866,6 +879,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1366,6 +1383,10 @@ msgstr "" msgid "Running in safe mode! Not running saved code.\n" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -1987,6 +2008,10 @@ msgstr "" msgid "can't send non-None value to a just-started generator" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "" @@ -2113,6 +2138,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2670,6 +2699,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "" @@ -2691,6 +2724,10 @@ msgstr "" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "" @@ -3081,6 +3118,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index eff611b20d..567a2f8ba2 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -65,6 +65,10 @@ msgstr "%%c erwartet int oder char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "%d Adress-Pins und %d rgb-Pins zeigen eine Höhe von %d, nicht von %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in Benutzung" @@ -92,6 +96,10 @@ msgstr "%q muss >= 1 sein" msgid "%q must be a tuple of length 2" msgstr "%q muss ein Tupel der Länge 2 sein" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q sollte ein integer sein" @@ -345,7 +353,7 @@ msgstr "Array muss Halbwörter enthalten (type 'H')" msgid "Array values should be single bytes." msgstr "Array-Werte sollten aus Einzelbytes bestehen." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "Es darf höchstens %d %q spezifiziert werden (nicht %d)" @@ -428,6 +436,10 @@ msgstr "Der Puffer ist zu klein" msgid "Buffer length %d too big. It must be less than %d" msgstr "Die Pufferlänge %d ist zu groß. Sie muss kleiner als %d sein" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" @@ -716,7 +728,8 @@ msgstr "EXTINT Kanal ist schon in Benutzung" msgid "Error in regex" msgstr "Fehler in regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -883,6 +896,10 @@ msgstr "Interner Definitionsfehler" msgid "Internal error #%d" msgstr "Interner Fehler #%d" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1396,6 +1413,10 @@ msgstr "Sicherheitsmodus aktiv! Automatisches Neuladen ist deaktiviert.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Sicherheitsmodus aktiv! Gespeicherter Code wird nicht ausgeführt\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2048,6 +2069,10 @@ msgstr "" "Nicht \"None\" Werte können nicht an einen gerade gestarteten Generator " "gesendet werden" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "kann Attribut nicht setzen" @@ -2181,6 +2206,10 @@ msgstr "Eingabearray konnte nicht aus der Form übertragen werden" msgid "could not invert Vandermonde matrix" msgstr "Vandermonde-Matrix konnte nicht invertiert werden" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2747,6 +2776,10 @@ msgstr "negative Potenz ohne Gleitkomma (float) Unterstützung" msgid "negative shift count" msgstr "Negative shift Anzahl" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "Keine aktive Ausnahme zu verusachen (raise)" @@ -2768,6 +2801,10 @@ msgstr "Kein Modul mit dem Namen '%q'" msgid "no reset pin available" msgstr "kein Reset Pin verfügbar" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "kein solches Attribut" @@ -3165,6 +3202,14 @@ msgstr "Das Zeitlimit muss 0,0-100,0 Sekunden betragen" msgid "timeout must be >= 0.0" msgstr "timeout muss >= 0.0 sein" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "Zeitstempel außerhalb des Bereichs für Plattform time_t" diff --git a/locale/es.po b/locale/es.po index ebffaeb984..aad07ddf4f 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-06-29 13:13+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -67,6 +67,10 @@ msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" "%d pines de dirección y %d pines rgb indican una altura de %d, no de %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q está siendo utilizado" @@ -94,6 +98,10 @@ msgstr "%q debe ser >= 1" msgid "%q must be a tuple of length 2" msgstr "%q debe ser una tupla de longitud 2" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q debe ser un int" @@ -349,7 +357,7 @@ msgstr "Array debe contener media palabra (type 'H')" msgid "Array values should be single bytes." msgstr "Valores del array deben ser bytes individuales." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "Como máximo %d %q se puede especificar (no %d)" @@ -430,6 +438,10 @@ msgstr "El buffer es muy pequeño" msgid "Buffer length %d too big. It must be less than %d" msgstr "La longitud del buffer %d es muy grande. Debe ser menor a %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer debe ser de longitud 1 como minimo" @@ -715,7 +727,8 @@ msgstr "El canal EXTINT ya está siendo utilizado" msgid "Error in regex" msgstr "Error en regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -878,6 +891,10 @@ msgstr "" msgid "Internal error #%d" msgstr "Error interno #%d" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1387,6 +1404,10 @@ msgstr "Ejecutando en modo seguro! La auto-recarga esta deshabilitada.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -1485,8 +1506,8 @@ msgid "" msgstr "" "La alimentación de la microntroladora bajó. Asegúrate que tu fuente de " "poder\n" -"pueda suplir suficiente energía para todo el circuito y presione reset (" -"luego de\n" +"pueda suplir suficiente energía para todo el circuito y presione reset " +"(luego de\n" "expulsar CIRCUITPY)\n" #: shared-module/audiomixer/MixerVoice.c @@ -1542,7 +1563,8 @@ msgstr "Muchos displays" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than outgoing_packet_length" -msgstr "Los datos totales a escribir son más grandes que outgoing_packet_length" +msgstr "" +"Los datos totales a escribir son más grandes que outgoing_packet_length" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -2026,6 +2048,10 @@ msgid "can't send non-None value to a just-started generator" msgstr "" "no se puede enviar un valor que no sea None a un generador recién iniciado" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "no se puede asignar el atributo" @@ -2156,6 +2182,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "los datos deben permitir iteración" @@ -2718,6 +2748,10 @@ msgstr "potencia negativa sin float support" msgid "negative shift count" msgstr "cuenta de corrimientos negativo" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "exception no activa para reraise" @@ -2739,6 +2773,10 @@ msgstr "ningún módulo se llama '%q'" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "no hay tal atributo" @@ -3136,6 +3174,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "tiempo muerto debe ser >= 0.0" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp fuera de rango para plataform time_t" diff --git a/locale/fil.po b/locale/fil.po index e4c5678d27..4f155ecc58 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -58,6 +58,10 @@ msgstr "%%c nangangailangan ng int o char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q ay ginagamit" @@ -86,6 +90,10 @@ msgstr "aarehas na haba dapat ang buffer slices" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c #, fuzzy msgid "%q should be an int" @@ -342,7 +350,7 @@ msgstr "May halfwords (type 'H') dapat ang array" msgid "Array values should be single bytes." msgstr "Array values ay dapat single bytes." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -423,6 +431,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer dapat ay hindi baba sa 1 na haba" @@ -710,7 +722,8 @@ msgstr "Ginagamit na ang EXTINT channel" msgid "Error in regex" msgstr "May pagkakamali sa REGEX" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -874,6 +887,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1381,6 +1398,10 @@ msgstr "Tumatakbo sa safe mode! Awtomatikong pag re-reload ay OFF.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Tumatakbo sa safe mode! Hindi tumatakbo ang nai-save na code.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2015,6 +2036,10 @@ msgstr "hindi mapadala ang send throw sa isang kaka umpisang generator" msgid "can't send non-None value to a just-started generator" msgstr "hindi mapadala ang non-None value sa isang kaka umpisang generator" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "hindi ma i-set ang attribute" @@ -2145,6 +2170,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2712,6 +2741,10 @@ msgstr "negatibong power na walang float support" msgid "negative shift count" msgstr "negative shift count" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "walang aktibong exception para i-reraise" @@ -2733,6 +2766,10 @@ msgstr "walang module na '%q'" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "walang ganoon na attribute" @@ -3129,6 +3166,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "bits ay dapat walo (8)" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "wala sa sakop ng timestamp ang platform time_t" diff --git a/locale/fr.po b/locale/fr.po index 5a49fd5f91..392b779894 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" @@ -69,6 +69,10 @@ msgstr "" "Les broches d'adresse %d et les broches RVB %d indiquent une hauteur de %d, " "pas %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q utilisé" @@ -96,6 +100,10 @@ msgstr "%q doit être >=1" msgid "%q must be a tuple of length 2" msgstr "%q doit être un tuple de longueur 2" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q doit être un entier (int)" @@ -350,7 +358,7 @@ msgstr "Le tableau doit contenir des demi-mots (type 'H')" msgid "Array values should be single bytes." msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "Au plus %d %q peut être spécifié (pas %d)" @@ -433,6 +441,10 @@ msgstr "Le tampon est trop petit" msgid "Buffer length %d too big. It must be less than %d" msgstr "La longueur du tampon %d est trop grande. Il doit être inférieur à %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Le tampon doit être de longueur au moins 1" @@ -723,7 +735,8 @@ msgstr "Canal EXTINT déjà utilisé" msgid "Error in regex" msgstr "Erreur dans l'expression régulière" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -887,6 +900,10 @@ msgstr "Erreur de définition interne" msgid "Internal error #%d" msgstr "Erreur interne #%d" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1400,6 +1417,10 @@ msgstr "Mode sans-échec ! Auto-chargement désactivé.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Mode sans-échec ! Le code sauvegardé n'est pas éxecuté.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2052,6 +2073,10 @@ msgstr "" "on ne peut envoyer une valeur autre que 'None' à un générateur fraîchement " "démarré" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "attribut non modifiable" @@ -2185,6 +2210,10 @@ msgstr "n'a pas pu diffuser le tableau d'entrée à partir de la forme" msgid "could not invert Vandermonde matrix" msgstr "n'a pas pu inverser la matrice Vandermonde" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "les données doivent être les objets iterables" @@ -2752,6 +2781,10 @@ msgstr "puissance négative sans support des nombres à virgule flottante" msgid "negative shift count" msgstr "compte de décalage négatif" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "aucune exception active à relever" @@ -2773,6 +2806,10 @@ msgstr "pas de module '%q'" msgid "no reset pin available" msgstr "pas de broche de réinitialisation disponible" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "pas de tel attribut" @@ -3171,6 +3208,14 @@ msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" msgid "timeout must be >= 0.0" msgstr "'timeout' doit être >= 0.0" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "'timestamp' hors bornes pour 'time_t' de la plateforme" diff --git a/locale/it_IT.po b/locale/it_IT.po index c47d0e8e3e..13651437b7 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -58,6 +58,10 @@ msgstr "%%c necessita di int o char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in uso" @@ -86,6 +90,10 @@ msgstr "slice del buffer devono essere della stessa lunghezza" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c #, fuzzy msgid "%q should be an int" @@ -341,7 +349,7 @@ msgstr "Array deve avere mezzoparole (typo 'H')" msgid "Array values should be single bytes." msgstr "Valori di Array dovrebbero essere bytes singulari" -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -423,6 +431,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Il buffer deve essere lungo almeno 1" @@ -710,7 +722,8 @@ msgstr "Canale EXTINT già in uso" msgid "Error in regex" msgstr "Errore nella regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -874,6 +887,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1390,6 +1407,10 @@ msgstr "Modalità sicura in esecuzione! Auto-reload disattivato.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Modalità sicura in esecuzione! Codice salvato non in esecuzione.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2019,6 +2040,10 @@ msgstr "" msgid "can't send non-None value to a just-started generator" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "impossibile impostare attributo" @@ -2147,6 +2172,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2714,6 +2743,10 @@ msgstr "potenza negativa senza supporto per float" msgid "negative shift count" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "nessuna eccezione attiva da rilanciare" @@ -2736,6 +2769,10 @@ msgstr "nessun modulo chiamato '%q'" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "attributo inesistente" @@ -3136,6 +3173,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "i bit devono essere 8" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp è fuori intervallo per il time_t della piattaforma" diff --git a/locale/ko.po b/locale/ko.po index 156f40d9b6..73926d47bd 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -60,6 +60,10 @@ msgstr "%%c 전수(int)또는 캐릭터(char)필요합니다" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q 사용 중입니다" @@ -87,6 +91,10 @@ msgstr "%q 는 >=1이어야합니다" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q 는 정수(int) 여야합니다" @@ -340,7 +348,7 @@ msgstr "" msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -421,6 +429,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "잘못된 크기의 버퍼. >1 여야합니다" @@ -702,7 +714,8 @@ msgstr "" msgid "Error in regex" msgstr "Regex에 오류가 있습니다." -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -862,6 +875,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1362,6 +1379,10 @@ msgstr "" msgid "Running in safe mode! Not running saved code.\n" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -1984,6 +2005,10 @@ msgstr "" msgid "can't send non-None value to a just-started generator" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "" @@ -2110,6 +2135,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2667,6 +2696,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "" @@ -2688,6 +2721,10 @@ msgstr "" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "" @@ -3078,6 +3115,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 77cc11cab3..b9fd85e163 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-06-02 19:50+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -66,6 +66,10 @@ msgstr "%%c vereist een int of char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "%d adres pins en %d RGB pins geven een hoogte van %d aan, niet %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in gebruik" @@ -93,6 +97,10 @@ msgstr "%q moet >= 1 zijn" msgid "%q must be a tuple of length 2" msgstr "%q moet een tuple van lengte 2 zijn" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q moet een int zijn" @@ -346,7 +354,7 @@ msgstr "Array moet halfwords (type 'H') bevatten" msgid "Array values should be single bytes." msgstr "Array waardes moet enkele bytes zijn." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "Op zijn meest %d %q mogen worden gespecificeerd (niet %d)" @@ -427,6 +435,10 @@ msgstr "Buffer is te klein" msgid "Buffer length %d too big. It must be less than %d" msgstr "Buffer lengte %d te groot. Het moet kleiner zijn dan %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Buffer moet op zijn minst lengte 1 zijn" @@ -714,7 +726,8 @@ msgstr "EXTINT kanaal al in gebruik" msgid "Error in regex" msgstr "Fout in regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -878,6 +891,10 @@ msgstr "Interne define fout" msgid "Internal error #%d" msgstr "Interne fout #%d" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1392,6 +1409,10 @@ msgstr "Draaiende in veilige modus! Auto-herlaad is uit.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Draaiende in veilige modus! Opgeslagen code wordt niet uitgevoerd.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2033,6 +2054,10 @@ msgstr "kan throw niet aan net gestartte generator toevoegen" msgid "can't send non-None value to a just-started generator" msgstr "kan geen niet-'None' waarde naar een net gestartte generator sturen" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "kan attribute niet instellen" @@ -2160,6 +2185,10 @@ msgstr "kon de invoerarray niet vanuit vorm uitzenden" msgid "could not invert Vandermonde matrix" msgstr "kon de Vandermonde matrix niet omkeren" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "data moet itereerbaar zijn" @@ -2723,6 +2752,10 @@ msgstr "negatieve macht terwijl er geen ondersteuning is voor float" msgid "negative shift count" msgstr "negatieve verschuivingstelling (shift count)" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "geen actieve uitzondering om opnieuw op te werpen (raise)" @@ -2744,6 +2777,10 @@ msgstr "geen module met naam '%q'" msgid "no reset pin available" msgstr "geen reset pin beschikbaar" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "niet zo'n attribuut" @@ -3137,6 +3174,14 @@ msgstr "timeout moet tussen 0.0 en 100.0 seconden zijn" msgid "timeout must be >= 0.0" msgstr "timeout moet groter dan 0.0 zijn" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp buiten bereik voor platform time_t" diff --git a/locale/pl.po b/locale/pl.po index 888ce64285..1f2e9a61bc 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -59,6 +59,10 @@ msgstr "%%c wymaga int lub char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q w użyciu" @@ -86,6 +90,10 @@ msgstr "%q musi być >= 1" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q powinno być typu int" @@ -339,7 +347,7 @@ msgstr "Tablica musi zawierać pół-słowa (typ 'H')" msgid "Array values should be single bytes." msgstr "Wartości powinny być bajtami." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -420,6 +428,10 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufor musi mieć długość 1 lub więcej" @@ -701,7 +713,8 @@ msgstr "Kanał EXTINT w użyciu" msgid "Error in regex" msgstr "Błąd w regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -863,6 +876,10 @@ msgstr "" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1363,6 +1380,10 @@ msgstr "Uruchomiony tryb bezpieczeństwa! Samo-przeładowanie wyłączone.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Uruchomiony tryb bezpieczeństwa! Zapisany kod nie jest uruchamiany.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -1987,6 +2008,10 @@ msgstr "nie można skoczyć do świeżo stworzonego generatora" msgid "can't send non-None value to a just-started generator" msgstr "świeżo stworzony generator może tylko przyjąć None" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "nie można ustawić atrybutu" @@ -2113,6 +2138,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2671,6 +2700,10 @@ msgstr "ujemna potęga, ale brak obsługi liczb zmiennoprzecinkowych" msgid "negative shift count" msgstr "ujemne przesunięcie" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "brak wyjątku do ponownego rzucenia" @@ -2692,6 +2725,10 @@ msgstr "brak modułu o nazwie '%q'" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "nie ma takiego atrybutu" @@ -3084,6 +3121,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "timeout musi być >= 0.0" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp poza zakresem dla time_t na tej platformie" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 6ade65a33f..30d77864b3 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-06-29 23:50+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -66,6 +66,10 @@ msgstr "%%c requer int ou char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q em uso" @@ -93,6 +97,10 @@ msgstr "%q deve ser >= 1" msgid "%q must be a tuple of length 2" msgstr "%q deve ser uma tupla de comprimento 2" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q deve ser um int" @@ -348,7 +356,7 @@ msgstr "Array deve conter meias palavras (tipo 'H')" msgid "Array values should be single bytes." msgstr "Os valores da matriz devem ser bytes simples." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "Pelo menos %d %q pode ser definido (não %d)" @@ -433,6 +441,10 @@ msgstr "O buffer é muito pequeno" msgid "Buffer length %d too big. It must be less than %d" msgstr "O tamanho do buffer %d é muito grande. Deve ser menor que %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "O comprimento do buffer deve ter pelo menos 1" @@ -721,7 +733,8 @@ msgstr "Canal EXTINT em uso" msgid "Error in regex" msgstr "Erro no regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -857,8 +870,8 @@ msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" -"Arquivo .mpy incompatível. Atualize todos os arquivos .mpy. Consulte " -"http://adafru.it/mpy-update para mais informações." +"Arquivo .mpy incompatível. Atualize todos os arquivos .mpy. Consulte http://" +"adafru.it/mpy-update para mais informações." #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" @@ -885,6 +898,10 @@ msgstr "Erro interno de definição" msgid "Internal error #%d" msgstr "Erro interno #%d" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1400,6 +1417,10 @@ msgstr "Rodando em modo seguro! Atualização automática está desligada.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Rodando em modo seguro! Não está executando o código salvo.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -1555,7 +1576,8 @@ msgstr "Exibições demais" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than outgoing_packet_length" -msgstr "O total dos dados que serão gravados é maior que outgoing_packet_length" +msgstr "" +"O total dos dados que serão gravados é maior que outgoing_packet_length" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -2040,6 +2062,10 @@ msgstr "" "Não é possível enviar algo que não seja um valor para um gerador recém-" "iniciado" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "não é possível definir o atributo" @@ -2171,6 +2197,10 @@ msgstr "não foi possível transmitir a matriz da entrada a partir da forma" msgid "could not invert Vandermonde matrix" msgstr "não foi possível inverter a matriz Vandermonde" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2200,7 +2230,8 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "destination buffer must be an array of type 'H' for bit_depth = 16" -msgstr "o buffer do destino deve ser uma matriz do tipo 'H' para bit_depth = 16" +msgstr "" +"o buffer do destino deve ser uma matriz do tipo 'H' para bit_depth = 16" #: shared-bindings/audiobusio/PDMIn.c msgid "destination_length must be an int >= 0" @@ -2668,8 +2699,8 @@ msgstr "" #: py/runtime.c msgid "memory allocation failed, heap is locked" msgstr "" -"falha na alocação de memória, a área de alocação dinâmica de variáveis (heap)" -" está bloqueada" +"falha na alocação de memória, a área de alocação dinâmica de variáveis " +"(heap) está bloqueada" #: py/builtinimport.c msgid "module not found" @@ -2732,6 +2763,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "" @@ -2753,6 +2788,10 @@ msgstr "" msgid "no reset pin available" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "" @@ -3143,6 +3182,14 @@ msgstr "" msgid "timeout must be >= 0.0" msgstr "o tempo limite deve ser >= 0,0" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp fora do intervalo para a plataforma time_t" diff --git a/locale/sv.po b/locale/sv.po index df2431c4e0..6a38d35702 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2020-06-03 18:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -66,6 +66,10 @@ msgstr "%%c kräver int eller char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "%d adresspinnar och %d RGB-pinnar indikerar en höjd av %d, inte %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q används redan" @@ -93,6 +97,10 @@ msgstr "%q måste vara >= 1" msgid "%q must be a tuple of length 2" msgstr "%q måste vara en tuple av längd 2" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q ska vara en int" @@ -346,7 +354,7 @@ msgstr "Matrisen måste innehålla halfwords (typ \"H\")" msgid "Array values should be single bytes." msgstr "Matrisvärden ska bestå av enstaka bytes." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "Högst %d %q kan anges (inte %d)" @@ -427,6 +435,10 @@ msgstr "Bufferten är för liten" msgid "Buffer length %d too big. It must be less than %d" msgstr "Buffertlängd %d för stor. Den måste vara mindre än %d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Bufferten måste ha minst längd 1" @@ -714,7 +726,8 @@ msgstr "EXTINT-kanalen används redan" msgid "Error in regex" msgstr "Fel i regex" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -876,6 +889,10 @@ msgstr "Internt define-fel" msgid "Internal error #%d" msgstr "Internt fel #%d" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1388,6 +1405,10 @@ msgstr "Kör i säkert läge! Autoladdning är avstängd.\n" msgid "Running in safe mode! Not running saved code.\n" msgstr "Kör i säkert läge! Sparad kod körs inte.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2025,6 +2046,10 @@ msgstr "kan inte 'pend throw' för nystartad generator" msgid "can't send non-None value to a just-started generator" msgstr "kan inte skicka icke-None värde till nystartad generator" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "kan inte att ange attribut" @@ -2153,6 +2178,10 @@ msgstr "Kan inte sända indatamatris från form" msgid "could not invert Vandermonde matrix" msgstr "kan inte invertera Vandermonde-matris" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "data måste vara itererbar" @@ -2716,6 +2745,10 @@ msgstr "negativ exponent utan stöd för flyttal" msgid "negative shift count" msgstr "negativt skiftantal" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "ingen aktiv exception för reraise" @@ -2737,6 +2770,10 @@ msgstr "ingen modul med namnet '%q'" msgid "no reset pin available" msgstr "ingen reset-pinne tillgänglig" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "inget sådant attribut" @@ -3130,6 +3167,14 @@ msgstr "timeout måste vara 0.0-100.0 sekunder" msgid "timeout must be >= 0.0" msgstr "timeout måste vara >= 0.0" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp utom räckvidd för plattformens \"time_t\"" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4f85c5fa86..1609f672cd 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-25 11:44-0500\n" +"POT-Creation-Date: 2020-06-26 11:50-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -65,6 +65,10 @@ msgstr "%%c xūyào zhěngshù huò char" msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q failure: %d" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q zhèngzài shǐyòng" @@ -92,6 +96,10 @@ msgstr "%q bìxū dàyú huò děngyú 1" msgid "%q must be a tuple of length 2" msgstr "" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c +msgid "%q pin invalid" +msgstr "" + #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" msgstr "%q yīnggāi shì yīgè int" @@ -345,7 +353,7 @@ msgstr "Shùzǔ bìxū bāohán bàn zìshù (type 'H')" msgid "Array values should be single bytes." msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié." -#: shared-bindings/rgbmatrix/RGBMatrix.c +#: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" msgstr "" @@ -426,6 +434,10 @@ msgstr "Huǎnchōng qū tài xiǎo" msgid "Buffer length %d too big. It must be less than %d" msgstr "Huǎnchōng qū chángdù%d tài dà. Tā bìxū xiǎoyú%d" +#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +msgid "Buffer length must be a multiple of 512" +msgstr "" + #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1" @@ -709,7 +721,8 @@ msgstr "EXTINT píndào yǐjīng shǐyòng" msgid "Error in regex" msgstr "Zhèngzé biǎodá shì cuòwù" -#: shared-bindings/aesio/aes.c shared-bindings/microcontroller/Pin.c +#: shared-bindings/aesio/aes.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" @@ -871,6 +884,10 @@ msgstr "Nèibù dìngyì cuòwù" msgid "Internal error #%d" msgstr "" +#: shared-bindings/sdioio/SDCard.c +msgid "Invalid %q" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Invalid %q pin" @@ -1377,6 +1394,10 @@ msgstr "Zài ānquán móshì xià yùnxíng! Zìdòng chóngxīn jiāzài yǐ g msgid "Running in safe mode! Not running saved code.\n" msgstr "Zài ānquán móshì xià yùnxíng! Bù yùnxíng yǐ bǎocún de dàimǎ.\n" +#: shared-module/sdcardio/SDCard.c +msgid "SD card CSD format not supported" +msgstr "" + #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c msgid "SDA or SCL needs a pull up" @@ -2012,6 +2033,10 @@ msgstr "bùnéng bǎ tā rēng dào gāng qǐdòng de fā diànjī shàng" msgid "can't send non-None value to a just-started generator" msgstr "wúfǎ xiàng gānggāng qǐdòng de shēngchéng qì fāsòng fēi zhí" +#: shared-module/sdcardio/SDCard.c +msgid "can't set 512 block size" +msgstr "" + #: py/objnamedtuple.c msgid "can't set attribute" msgstr "wúfǎ shèzhì shǔxìng" @@ -2141,6 +2166,10 @@ msgstr "" msgid "could not invert Vandermonde matrix" msgstr "" +#: shared-module/sdcardio/SDCard.c +msgid "couldn't determine SD card version" +msgstr "" + #: extmod/ulab/code/approx.c msgid "data must be iterable" msgstr "" @@ -2701,6 +2730,10 @@ msgstr "méiyǒu fú diǎn zhīchí de xiāojí gōnglǜ" msgid "negative shift count" msgstr "fù zhuǎnyí jìshù" +#: shared-module/sdcardio/SDCard.c +msgid "no SD card" +msgstr "" + #: py/vm.c msgid "no active exception to reraise" msgstr "méiyǒu jīhuó de yìcháng lái chóngxīn píngjià" @@ -2722,6 +2755,10 @@ msgstr "méiyǒu mókuài '%q'" msgid "no reset pin available" msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" +#: shared-module/sdcardio/SDCard.c +msgid "no response from SD card" +msgstr "" + #: py/runtime.c msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" @@ -3114,6 +3151,14 @@ msgstr "Chāo shí shíjiān bìxū wèi 0.0 Dào 100.0 Miǎo" msgid "timeout must be >= 0.0" msgstr "chāoshí bìxū shì >= 0.0" +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v1 card" +msgstr "" + +#: shared-module/sdcardio/SDCard.c +msgid "timeout waiting for v2 card" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "time_t shíjiān chuō chāochū píngtái fànwéi" From 1a0c10c328842300aca8ed5113815cfb5bf95d26 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 29 Jun 2020 17:15:01 -0700 Subject: [PATCH 041/277] Fix debug UART call --- supervisor/shared/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 513022667a..8eb78a90e5 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -55,7 +55,7 @@ void serial_early_init(void) { const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEBUG_UART_TX); common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL, - false, 115200, 8, PARITY_NONE, 1, 1.0f, 64, + false, 115200, 8, UART_PARITY_NONE, 1, 1.0f, 64, buf_array, true); common_hal_busio_uart_never_reset(&debug_uart); #endif From 965a40b6a19a9eb35ecc4256aa850d41c88a0137 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 29 Jun 2020 17:17:46 -0700 Subject: [PATCH 042/277] Fix cxd56 function signature --- ports/cxd56/common-hal/busio/SPI.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/cxd56/common-hal/busio/SPI.c b/ports/cxd56/common-hal/busio/SPI.c index 718a8ff16e..2d365d4826 100644 --- a/ports/cxd56/common-hal/busio/SPI.c +++ b/ports/cxd56/common-hal/busio/SPI.c @@ -130,7 +130,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, return true; } -bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) { +bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { SPI_EXCHANGE(self->spi_dev, data_out, data_in, len); return true; From 69b3d475647b14a87891e38fe00a525b916c5d8a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 29 Jun 2020 18:21:53 -0700 Subject: [PATCH 043/277] Fix other esp builds --- .../boards/espressif_saola_1_wroom/board.c | 8 +++---- .../boards/unexpectedmaker_feathers2/board.c | 22 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c index b7b2c4ef5b..9f708874bf 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/board.c +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/board.c @@ -30,12 +30,12 @@ void board_init(void) { // USB - never_reset_pin(&pin_GPIO19); - never_reset_pin(&pin_GPIO20); + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); // Debug UART - never_reset_pin(&pin_GPIO43); - never_reset_pin(&pin_GPIO44); + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index 8890ec4c16..1dc30b5af8 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -30,21 +30,21 @@ void board_init(void) { // USB - never_reset_pin(&pin_GPIO19); - never_reset_pin(&pin_GPIO20); + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); // Debug UART - never_reset_pin(&pin_GPIO43); - never_reset_pin(&pin_GPIO44); + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); // SPI Flash and RAM - never_reset_pin(&pin_GPIO26); - never_reset_pin(&pin_GPIO27); - never_reset_pin(&pin_GPIO28); - never_reset_pin(&pin_GPIO29); - never_reset_pin(&pin_GPIO30); - never_reset_pin(&pin_GPIO31); - never_reset_pin(&pin_GPIO32); + common_hal_never_reset_pin(&pin_GPIO26); + common_hal_never_reset_pin(&pin_GPIO27); + common_hal_never_reset_pin(&pin_GPIO28); + common_hal_never_reset_pin(&pin_GPIO29); + common_hal_never_reset_pin(&pin_GPIO30); + common_hal_never_reset_pin(&pin_GPIO31); + common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { From 5028804878addc988548b91d173b5fb88380435f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 30 Jun 2020 15:29:42 -0700 Subject: [PATCH 044/277] Remove fixed pointers and check UART return --- ports/esp32s2/common-hal/busio/I2C.c | 10 ++++++---- ports/esp32s2/common-hal/busio/I2C.h | 1 - ports/esp32s2/common-hal/busio/SPI.c | 6 +++--- ports/esp32s2/common-hal/busio/UART.c | 3 +++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 391d7323c5..74b3896fc2 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -90,8 +90,10 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, #endif - self->semaphore_handle = xSemaphoreCreateBinaryStatic(&self->semaphore); - xSemaphoreGive(self->semaphore_handle); + if (xSemaphoreCreateBinaryStatic(&self->semaphore) != &self->semaphore) { + mp_raise_RuntimeError(translate("Unable to create lock")); + } + xSemaphoreGive(&self->semaphore); self->sda_pin = sda; self->scl_pin = scl; self->i2c_num = I2C_NUM_MAX; @@ -161,7 +163,7 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { } bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) { - self->has_lock = xSemaphoreTake(self->semaphore_handle, 0) == pdTRUE; + self->has_lock = xSemaphoreTake(&self->semaphore, 0) == pdTRUE; return self->has_lock; } @@ -170,7 +172,7 @@ bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) { } void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) { - xSemaphoreGive(self->semaphore_handle); + xSemaphoreGive(&self->semaphore); self->has_lock = false; } diff --git a/ports/esp32s2/common-hal/busio/I2C.h b/ports/esp32s2/common-hal/busio/I2C.h index d90fb2713a..24a3fd4951 100644 --- a/ports/esp32s2/common-hal/busio/I2C.h +++ b/ports/esp32s2/common-hal/busio/I2C.h @@ -40,7 +40,6 @@ typedef struct { const mcu_pin_obj_t* sda_pin; i2c_port_t i2c_num; StaticSemaphore_t semaphore; - SemaphoreHandle_t semaphore_handle; bool has_lock; } busio_i2c_obj_t; diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 73d7d0595e..a22075cd59 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -209,9 +209,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, hal->io_mode = SPI_LL_IO_MODE_NORMAL; - // This must be set after spi_hal_init. - hal->timing_conf = &self->timing_conf; - common_hal_busio_spi_configure(self, 250000, 0, 0, 8); } @@ -261,6 +258,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, self->phase = phase; self->bits = bits; self->target_frequency = baudrate; + self->hal_context.timing_conf = &self->timing_conf; esp_err_t result = spi_hal_get_clock_conf(&self->hal_context, self->target_frequency, 128 /* duty_cycle */, @@ -315,6 +313,8 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou spi_hal_context_t* hal = &self->hal_context; hal->send_buffer = NULL; hal->rcv_buffer = NULL; + // Reset timing_conf in case we've moved since the last time we used it. + hal->timing_conf = &self->timing_conf; // This rounds up. size_t dma_count = (len + LLDESC_MAX_NUM_PER_DESC - 1) / LLDESC_MAX_NUM_PER_DESC; for (size_t i = 0; i < dma_count; i++) { diff --git a/ports/esp32s2/common-hal/busio/UART.c b/ports/esp32s2/common-hal/busio/UART.c index f73f5c993d..b0162adba9 100644 --- a/ports/esp32s2/common-hal/busio/UART.c +++ b/ports/esp32s2/common-hal/busio/UART.c @@ -249,6 +249,9 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t while (supervisor_ticks_ms64() - start_ticks <= self->timeout_ms) { // Read as many chars as we can right now, up to len. size_t num_read = uart_read_bytes(self->uart_num, data, len, 0); + if (num_read < 0) { + break; + } // Advance pointer in data buffer, and decrease how many chars left to read. data += num_read; From c3d1256d765a7de12d787c2641017de25dbde7d0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 30 Jun 2020 15:30:07 -0700 Subject: [PATCH 045/277] Add one-of-each build target at the top level. --- Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 0df1950938..d45dae8b90 100644 --- a/Makefile +++ b/Makefile @@ -244,11 +244,48 @@ update-frozen-libraries: @echo "Updating all frozen libraries to latest tagged version." cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done -one-of-each: all-source - make -C ports/atmel-samd BOARD=trinket_m0 - make -C ports/atmel-samd BOARD=feather_m4_express - make -C ports/esp32s2 BOARD=espressif_saola_1_wroom - make -C ports/litex BOARD=fomu - make -C ports/mimxrt10xx BOARD=feather_mimxrt1011 - make -C ports/nrf BOARD=feather_nrf52840_express - make -C ports/stm BOARD=feather_stm32f405_express +one-of-each: samd21 samd51 esp32s2 litex mimxrt10xx nrf stm + +samd21: + $(MAKE) -C ports/atmel-samd BOARD=trinket_m0 + +samd51: + $(MAKE) -C ports/atmel-samd BOARD=feather_m4_express + +esp32s2: + $(MAKE) -C ports/esp32s2 BOARD=espressif_saola_1_wroom + +litex: + $(MAKE) -C ports/litex BOARD=fomu + +mimxrt10xx: + $(MAKE) -C ports/mimxrt10xx BOARD=feather_mimxrt1011 + +nrf: + $(MAKE) -C ports/nrf BOARD=feather_nrf52840_express + +stm: + $(MAKE) -C ports/stm BOARD=feather_stm32f405_express + +clean-one-of-each: clean-samd21 clean-samd51 clean-esp32s2 clean-litex clean-mimxrt10xx clean-nrf clean-stm + +clean-samd21: + $(MAKE) -C ports/atmel-samd BOARD=trinket_m0 clean + +clean-samd51: + $(MAKE) -C ports/atmel-samd BOARD=feather_m4_express clean + +clean-esp32s2: + $(MAKE) -C ports/esp32s2 BOARD=espressif_saola_1_wroom clean + +clean-litex: + $(MAKE) -C ports/litex BOARD=fomu clean + +clean-mimxrt10xx: + $(MAKE) -C ports/mimxrt10xx BOARD=feather_mimxrt1011 clean + +clean-nrf: + $(MAKE) -C ports/nrf BOARD=feather_nrf52840_express clean + +clean-stm: + $(MAKE) -C ports/stm BOARD=feather_stm32f405_express clean From 0a9c6fbb7f4381ab758945d4c02d9f156757a39c Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 30 Jun 2020 07:55:11 +0000 Subject: [PATCH 046/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (770 of 770 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 488 +++++++++++++++++++++++++----------------------- 1 file changed, 252 insertions(+), 236 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 30d77864b3..acabdb197e 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-26 11:50-0500\n" -"PO-Revision-Date: 2020-06-29 23:50+0000\n" +"PO-Revision-Date: 2020-06-30 17:48+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -68,7 +68,7 @@ msgstr "%d endereços dos pinos e %d pinos rgb indicam uma altura do %d, não %d #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q falha: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -99,7 +99,7 @@ msgstr "%q deve ser uma tupla de comprimento 2" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q pin invalid" -msgstr "" +msgstr "%q pino inválido" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -395,7 +395,7 @@ msgstr "A profundidade de bits deve ser o múltiplo de 8." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" -msgstr "" +msgstr "Ambos os RX e TX são necessários para o controle do fluxo" #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" @@ -443,7 +443,7 @@ msgstr "O tamanho do buffer %d é muito grande. Deve ser menor que %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c msgid "Buffer length must be a multiple of 512" -msgstr "" +msgstr "O comprimento do Buffer deve ser um múltiplo de 512" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" @@ -610,7 +610,7 @@ msgstr "Código bruto corrompido" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" -msgstr "" +msgstr "Não foi possível inicializar o GNSS" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" @@ -900,7 +900,7 @@ msgstr "Erro interno #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "%q Inválido" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1295,7 +1295,7 @@ msgstr "O pino não tem recursos de ADC" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" -msgstr "" +msgstr "Apenas o pino de entrada" #: ports/atmel-samd/common-hal/countio/Counter.c msgid "Pin must support hardware interrupts" @@ -1322,7 +1322,7 @@ msgstr "Além de quaisquer módulos no sistema de arquivos\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "" +msgstr "O Polígono precisa de pelo menos 3 pontos" #: shared-bindings/ps2io/Ps2.c msgid "Pop from an empty Ps2 buffer" @@ -1419,7 +1419,7 @@ msgstr "Rodando em modo seguro! Não está executando o código salvo.\n" #: shared-module/sdcardio/SDCard.c msgid "SD card CSD format not supported" -msgstr "" +msgstr "O formato CSD do Cartão SD não é compatível" #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c @@ -1491,7 +1491,7 @@ msgstr "Forneça pelo menos um pino UART" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" -msgstr "" +msgstr "A entrada no sistema deve ser gnss.SatelliteSystem" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" @@ -1561,6 +1561,8 @@ msgstr "A largura do bloco deve dividir exatamente com a largura do bitmap" #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" +"O tempo limite é long demais: O comprimento máximo do tempo limite é de %d " +"segundos" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." @@ -1736,22 +1738,26 @@ msgstr "AVISO: Seu arquivo de código tem duas extensões\n" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" +"O WatchDogTimer não pode ser não-inicializado uma vez que o modo é definido " +"como RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer is not currently running" -msgstr "" +msgstr "O WatchDogTimer não está em execução" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgstr "" +"O WatchDogTimer.mode não pode ser alterado uma vez definido para WatchDogMode" +".RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.timeout must be greater than 0" -msgstr "" +msgstr "O WatchDogTimer.timeout deve ser maior que 0" #: supervisor/shared/safe_mode.c msgid "Watchdog timer expired." -msgstr "" +msgstr "O temporizador Watchdog expirou." #: py/builtinhelp.c #, c-format @@ -2064,7 +2070,7 @@ msgstr "" #: shared-module/sdcardio/SDCard.c msgid "can't set 512 block size" -msgstr "" +msgstr "não é possível definir o tamanho de 512 blocos" #: py/objnamedtuple.c msgid "can't set attribute" @@ -2199,15 +2205,15 @@ msgstr "não foi possível inverter a matriz Vandermonde" #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" -msgstr "" +msgstr "não foi possível determinar a versão do cartão SD" #: extmod/ulab/code/approx.c msgid "data must be iterable" -msgstr "" +msgstr "os dados devem ser iteráveis" #: extmod/ulab/code/approx.c msgid "data must be of equal length" -msgstr "" +msgstr "os dados devem ser de igual comprimento" #: extmod/ulab/code/numerical.c msgid "ddof must be smaller than length of data set" @@ -2281,31 +2287,31 @@ msgstr "erro = 0x%08lX" #: py/runtime.c msgid "exceptions must derive from BaseException" -msgstr "" +msgstr "as exceções devem derivar a partir do BaseException" #: py/objstr.c msgid "expected ':' after format specifier" -msgstr "" +msgstr "é esperado ':' após o especificador do formato" #: py/obj.c msgid "expected tuple/list" -msgstr "" +msgstr "é esperada tupla/lista" #: py/modthread.c msgid "expecting a dict for keyword args" -msgstr "" +msgstr "esperando um dicionário para os args da palavra-chave" #: py/compile.c msgid "expecting an assembler instruction" -msgstr "" +msgstr "esperando uma instrução assembler" #: py/compile.c msgid "expecting just a value for set" -msgstr "" +msgstr "esperando apenas um valor para o conjunto" #: py/compile.c msgid "expecting key:value for dict" -msgstr "" +msgstr "chave esperada: valor para dict" #: py/argcheck.c msgid "extra keyword arguments given" @@ -2317,28 +2323,28 @@ msgstr "argumentos extra posicionais passados" #: py/parse.c msgid "f-string expression part cannot include a '#'" -msgstr "" +msgstr "A parte da expressão f-string não pode incluir um '#'" #: py/parse.c msgid "f-string expression part cannot include a backslash" -msgstr "" +msgstr "A parte da expressão f-string não pode incluir uma barra invertida" #: py/parse.c msgid "f-string: empty expression not allowed" -msgstr "" +msgstr "f-string: expressão vazia não é permitida" #: py/parse.c msgid "f-string: expecting '}'" -msgstr "" +msgstr "f-string: esperando '}'" #: py/parse.c msgid "f-string: single '}' is not allowed" -msgstr "" +msgstr "f-string: um único '}' não é permitido" #: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c #: shared-bindings/displayio/OnDiskBitmap.c msgid "file must be a file opened in byte mode" -msgstr "" +msgstr "o arquivo deve ser um arquivo aberto no modo byte" #: shared-bindings/storage/__init__.c msgid "filesystem must provide mount method" @@ -2346,31 +2352,31 @@ msgstr "sistema de arquivos deve fornecer método de montagem" #: extmod/ulab/code/vectorise.c msgid "first argument must be a callable" -msgstr "" +msgstr "o primeiro argumento deve ser chamável" #: extmod/ulab/code/approx.c msgid "first argument must be a function" -msgstr "" +msgstr "o primeiro argumento deve ser uma função" #: extmod/ulab/code/ndarray.c msgid "first argument must be an iterable" -msgstr "" +msgstr "o primeiro argumento deve ser um iterável" #: extmod/ulab/code/vectorise.c msgid "first argument must be an ndarray" -msgstr "" +msgstr "o primeiro argumento deve ser um ndarray" #: py/objtype.c msgid "first argument to super() must be type" -msgstr "" +msgstr "o primeiro argumento para super() deve ser um tipo" #: extmod/ulab/code/ndarray.c msgid "flattening order must be either 'C', or 'F'" -msgstr "" +msgstr "a ordem do nivelamento deve ser 'C' ou 'F'" #: extmod/ulab/code/numerical.c msgid "flip argument must be an ndarray" -msgstr "" +msgstr "o argumento flip deve ser um ndarray" #: py/objint.c msgid "float too big" @@ -2378,11 +2384,11 @@ msgstr "float muito grande" #: shared-bindings/_stage/Text.c msgid "font must be 2048 bytes long" -msgstr "" +msgstr "a fonte deve ter 2048 bytes de comprimento" #: py/objstr.c msgid "format requires a dict" -msgstr "" +msgstr "formato requer um dict" #: py/objdeque.c msgid "full" @@ -2399,15 +2405,15 @@ msgstr "função esperada na maioria dos %d argumentos, obteve %d" #: py/bc.c py/objnamedtuple.c msgid "function got multiple values for argument '%q'" -msgstr "" +msgstr "A função obteve vários valores para o argumento '%q'" #: extmod/ulab/code/approx.c msgid "function has the same sign at the ends of interval" -msgstr "" +msgstr "a função tem o mesmo sinal nas extremidades do intervalo" #: extmod/ulab/code/compare.c msgid "function is implemented for scalars and ndarrays only" -msgstr "" +msgstr "A função foi implementada apenas para escalares e ndarrays" #: py/argcheck.c #, c-format @@ -2416,16 +2422,16 @@ msgstr "função ausente %d requer argumentos posicionais" #: py/bc.c msgid "function missing keyword-only argument" -msgstr "" +msgstr "falta apenas a palavra chave do argumento da função" #: py/bc.c msgid "function missing required keyword argument '%q'" -msgstr "" +msgstr "falta apenas a palavra chave do argumento '%q' da função" #: py/bc.c #, c-format msgid "function missing required positional argument #%d" -msgstr "" +msgstr "falta o argumento #%d da posição necessária da função" #: py/argcheck.c py/bc.c py/objnamedtuple.c #, c-format @@ -2438,15 +2444,15 @@ msgstr "função leva exatamente 9 argumentos" #: py/objgenerator.c msgid "generator already executing" -msgstr "" +msgstr "o gerador já está em execução" #: py/objgenerator.c msgid "generator ignored GeneratorExit" -msgstr "" +msgstr "ignorando o gerador GeneratorExit" #: shared-bindings/_stage/Layer.c msgid "graphic must be 2048 bytes long" -msgstr "" +msgstr "o gráfico deve ter 2048 bytes de comprimento" #: extmod/moduheapq.c msgid "heap must be a list" @@ -2454,11 +2460,11 @@ msgstr "a área de alocação dinâmica de variáveis (heap) deve ser uma lista" #: py/compile.c msgid "identifier redefined as global" -msgstr "" +msgstr "o identificador foi redefinido como global" #: py/compile.c msgid "identifier redefined as nonlocal" -msgstr "" +msgstr "o identificador foi redefinido como não-local" #: py/objstr.c msgid "incomplete format" @@ -2466,7 +2472,7 @@ msgstr "formato incompleto" #: py/objstr.c msgid "incomplete format key" -msgstr "" +msgstr "a chave do formato está incompleto" #: extmod/modubinascii.c msgid "incorrect padding" @@ -2474,7 +2480,7 @@ msgstr "preenchimento incorreto" #: extmod/ulab/code/ndarray.c msgid "index is out of bounds" -msgstr "" +msgstr "o índice está fora dos limites" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -2485,55 +2491,55 @@ msgstr "Índice fora do intervalo" #: py/obj.c msgid "indices must be integers" -msgstr "" +msgstr "os índices devem ser inteiros" #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" -msgstr "" +msgstr "os índices devem ser números inteiros, fatias ou listas booleanas" #: extmod/ulab/code/approx.c msgid "initial values must be iterable" -msgstr "" +msgstr "os valores iniciais devem ser iteráveis" #: py/compile.c msgid "inline assembler must be a function" -msgstr "" +msgstr "o assembler em linha deve ser uma função" #: extmod/ulab/code/create.c msgid "input argument must be an integer or a 2-tuple" -msgstr "" +msgstr "o argumento da entrada deve ser um número inteiro ou uma tupla de 2" #: extmod/ulab/code/fft.c msgid "input array length must be power of 2" -msgstr "" +msgstr "comprimento da matriz da entrada deve ter potência de 2" #: extmod/ulab/code/poly.c msgid "input data must be an iterable" -msgstr "" +msgstr "os dados da entrada devem ser iteráveis" #: extmod/ulab/code/linalg.c msgid "input matrix is asymmetric" -msgstr "" +msgstr "a matriz da entrada é assimétrica" #: extmod/ulab/code/linalg.c msgid "input matrix is singular" -msgstr "" +msgstr "a matriz da entrada é singular" #: extmod/ulab/code/linalg.c msgid "input must be square matrix" -msgstr "" +msgstr "a entrada deve ser uma matriz quadrada" #: extmod/ulab/code/numerical.c msgid "input must be tuple, list, range, or ndarray" -msgstr "" +msgstr "A entrada deve ser tupla, lista, intervalo ou matriz" #: extmod/ulab/code/poly.c msgid "input vectors must be of equal length" -msgstr "" +msgstr "os vetores da entrada devem ter o mesmo comprimento" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" +msgstr "int() arg 2 deve ser >= 2 e <= 36" #: py/objstr.c msgid "integer required" @@ -2541,12 +2547,12 @@ msgstr "inteiro requerido" #: extmod/ulab/code/approx.c msgid "interp is defined for 1D arrays of equal length" -msgstr "" +msgstr "o interp é definido para matrizes 1D de igual comprimento" #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" -msgstr "" +msgstr "o intervalo deve estar entre %s-%s" #: lib/netutils/netutils.c msgid "invalid arguments" @@ -2566,7 +2572,7 @@ msgstr "formato inválido" #: py/objstr.c msgid "invalid format specifier" -msgstr "" +msgstr "o especificador do formato é inválido" #: extmod/modussl_axtls.c msgid "invalid key" @@ -2574,7 +2580,7 @@ msgstr "chave inválida" #: py/compile.c msgid "invalid micropython decorator" -msgstr "" +msgstr "o decorador micropython é inválido" #: shared-bindings/random/__init__.c msgid "invalid step" @@ -2582,119 +2588,122 @@ msgstr "passo inválido" #: py/compile.c py/parse.c msgid "invalid syntax" -msgstr "" +msgstr "sintaxe inválida" #: py/parsenum.c msgid "invalid syntax for integer" -msgstr "" +msgstr "sintaxe inválida para o número inteiro" #: py/parsenum.c #, c-format msgid "invalid syntax for integer with base %d" -msgstr "" +msgstr "sintaxe inválida para o número inteiro com base %d" #: py/parsenum.c msgid "invalid syntax for number" -msgstr "" +msgstr "sintaxe inválida para o número" #: py/objtype.c msgid "issubclass() arg 1 must be a class" -msgstr "" +msgstr "issubclass() arg 1 deve ser uma classe" #: py/objtype.c msgid "issubclass() arg 2 must be a class or a tuple of classes" -msgstr "" +msgstr "issubclass() arg 2 deve ser uma classe ou uma tupla de classes" #: extmod/ulab/code/ndarray.c msgid "iterables are not of the same length" -msgstr "" +msgstr "os iteráveis não têm o mesmo comprimento" #: extmod/ulab/code/linalg.c msgid "iterations did not converge" -msgstr "" +msgstr "as iterações não convergiram" #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" msgstr "" +"join espera uma lista de objetos str/bytes consistentes com o próprio objeto" #: py/argcheck.c msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" +"o(s) argumento(s) de palavra-chave ainda não foi implementado - em vez " +"disso, use argumentos normais" #: py/bc.c msgid "keywords must be strings" -msgstr "" +msgstr "as palavras-chave devem ser uma cadeia de caracteres" #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" -msgstr "" +msgstr "o rótulo '%q' não foi definido" #: py/compile.c msgid "label redefined" -msgstr "" +msgstr "o rótulo foi redefinido" #: py/stream.c msgid "length argument not allowed for this type" -msgstr "" +msgstr "o argumento de comprimento não é permitido para este tipo" #: shared-bindings/audiomixer/MixerVoice.c msgid "level must be between 0 and 1" -msgstr "" +msgstr "o nível deve estar entre 0 e 1" #: py/objarray.c msgid "lhs and rhs should be compatible" -msgstr "" +msgstr "o lhs e rhs devem ser compatíveis" #: py/emitnative.c msgid "local '%q' has type '%q' but source is '%q'" -msgstr "" +msgstr "o local '%q' tem o tipo '%q', porém a origem é '%q'" #: py/emitnative.c msgid "local '%q' used before type known" -msgstr "" +msgstr "o local '%q' usado antes do tipo conhecido" #: py/vm.c msgid "local variable referenced before assignment" -msgstr "" +msgstr "a variável local referenciada antes da atribuição" #: py/objint.c msgid "long int not supported in this build" -msgstr "" +msgstr "o long int não é suportado nesta compilação" #: py/parse.c msgid "malformed f-string" -msgstr "" +msgstr "f-string malformado" #: shared-bindings/_stage/Layer.c msgid "map buffer too small" -msgstr "" +msgstr "o mapa do buffer é muito pequeno" #: py/modmath.c shared-bindings/math/__init__.c msgid "math domain error" -msgstr "" +msgstr "erro de domínio matemático" #: extmod/ulab/code/linalg.c msgid "matrix dimensions do not match" -msgstr "" +msgstr "as dimensões da matriz não coincidem" #: extmod/ulab/code/linalg.c msgid "matrix is not positive definite" -msgstr "" +msgstr "a matriz não é definitiva positiva" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" -msgstr "" +msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: py/runtime.c msgid "maximum recursion depth exceeded" -msgstr "" +msgstr "a recursão máxima da profundidade foi excedida" #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" -msgstr "" +msgstr "falha na alocação de memória, alocando %u bytes" #: py/runtime.c msgid "memory allocation failed, heap is locked" @@ -2704,39 +2713,39 @@ msgstr "" #: py/builtinimport.c msgid "module not found" -msgstr "" +msgstr "o módulo não foi encontrado" #: extmod/ulab/code/poly.c msgid "more degrees of freedom than data points" -msgstr "" +msgstr "mais graus de liberdade do que pontos de dados" #: py/compile.c msgid "multiple *x in assignment" -msgstr "" +msgstr "múltiplo *x na atribuição" #: py/objtype.c msgid "multiple bases have instance lay-out conflict" -msgstr "" +msgstr "várias bases possuem instâncias de layout com conflitos" #: py/objtype.c msgid "multiple inheritance not supported" -msgstr "" +msgstr "herança múltipla não suportada" #: py/emitnative.c msgid "must raise an object" -msgstr "" +msgstr "deve levantar um objeto" #: py/modbuiltins.c msgid "must use keyword argument for key function" -msgstr "" +msgstr "deve usar o argumento da palavra-chave para a função da chave" #: extmod/ulab/code/numerical.c msgid "n must be between 0, and 9" -msgstr "" +msgstr "n deve estar entre 0 e 9" #: py/runtime.c msgid "name '%q' is not defined" -msgstr "" +msgstr "o nome '%q' não está definido" #: py/runtime.c msgid "name not defined" @@ -2744,11 +2753,11 @@ msgstr "nome não definido" #: py/compile.c msgid "name reused for argument" -msgstr "" +msgstr "o nome foi reutilizado para o argumento" #: py/emitnative.c msgid "native yield" -msgstr "" +msgstr "rendimento nativo" #: py/runtime.c #, c-format @@ -2757,113 +2766,113 @@ msgstr "precisa de mais de %d valores para desempacotar" #: py/objint_longlong.c py/objint_mpz.c py/runtime.c msgid "negative power with no float support" -msgstr "" +msgstr "potência negativa sem suporte de flutuação" #: py/objint_mpz.c py/runtime.c msgid "negative shift count" -msgstr "" +msgstr "contagem de turnos negativos" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "" +msgstr "nenhum cartão SD" #: py/vm.c msgid "no active exception to reraise" -msgstr "" +msgstr "nenhuma exceção ativa para reraise" #: shared-bindings/socket/__init__.c shared-module/network/__init__.c msgid "no available NIC" -msgstr "" +msgstr "não há uma Placa de Rede disponível" #: py/compile.c msgid "no binding for nonlocal found" -msgstr "" +msgstr "nenhuma ligação para nonlocal foi encontrada" #: py/builtinimport.c msgid "no module named '%q'" -msgstr "" +msgstr "nenhum módulo chamado '%q'" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "no reset pin available" -msgstr "" +msgstr "nenhum pino de redefinição está disponível" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "" +msgstr "não houve resposta do cartão SD" #: py/runtime.c msgid "no such attribute" -msgstr "" +msgstr "não há tal atributo" #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" -msgstr "" +msgstr "um não UUID foi encontrado na lista service_uuids_whitelist" #: py/compile.c msgid "non-default argument follows default argument" -msgstr "" +msgstr "o argumento não predefinido segue o argumento predefinido" #: extmod/modubinascii.c msgid "non-hex digit found" -msgstr "" +msgstr "um dígito não hexadecimal foi encontrado" #: py/compile.c msgid "non-keyword arg after */**" -msgstr "" +msgstr "um arg sem palavra-chave após */ **" #: py/compile.c msgid "non-keyword arg after keyword arg" -msgstr "" +msgstr "um arg não-palavra-chave após a palavra-chave arg" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" -msgstr "" +msgstr "não é um UUID com 128 bits" #: py/objstr.c msgid "not all arguments converted during string formatting" -msgstr "" +msgstr "nem todos os argumentos são convertidos durante a formatação da string" #: py/objstr.c msgid "not enough arguments for format string" -msgstr "" +msgstr "argumentos insuficientes para o formato da string" #: extmod/ulab/code/poly.c msgid "number of arguments must be 2, or 3" -msgstr "" +msgstr "a quantidade dos argumentos deve ser 2 ou 3" #: extmod/ulab/code/create.c msgid "number of points must be at least 2" -msgstr "" +msgstr "a quantidade dos pontos deve ser pelo menos 2" #: py/obj.c #, c-format msgid "object '%s' is not a tuple or list" -msgstr "" +msgstr "o objeto '%s' não é uma tupla ou uma lista" #: py/obj.c msgid "object does not support item assignment" -msgstr "" +msgstr "O objeto não suporta a atribuição dos itens" #: py/obj.c msgid "object does not support item deletion" -msgstr "" +msgstr "objeto não suporta a exclusão do item" #: py/obj.c msgid "object has no len" -msgstr "" +msgstr "o objeto não tem len" #: py/obj.c msgid "object is not subscriptable" -msgstr "" +msgstr "O objeto não é subroteirizável" #: py/runtime.c msgid "object not an iterator" -msgstr "" +msgstr "o objeto não é um iterador" #: py/objtype.c py/runtime.c msgid "object not callable" -msgstr "" +msgstr "o objeto não é resgatável" #: py/sequence.c shared-bindings/displayio/Group.c msgid "object not in sequence" @@ -2876,121 +2885,126 @@ msgstr "objeto não iterável" #: py/obj.c #, c-format msgid "object of type '%s' has no len()" -msgstr "" +msgstr "O objeto do tipo '%s' não possui len()" #: py/obj.c msgid "object with buffer protocol required" -msgstr "" +msgstr "é necessário objeto com protocolo do buffer" #: extmod/modubinascii.c msgid "odd-length string" -msgstr "" +msgstr "sequência com comprimento ímpar" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" -msgstr "" +msgstr "desvio fora dos limites" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only bit_depth=16 is supported" -msgstr "" +msgstr "apenas bit_depth = 16 é compatível" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only sample_rate=16000 is supported" -msgstr "" +msgstr "apenas sample_rate = 16000 é compatível" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" +"apenas fatias com a etapa=1 (também conhecida como Nenhuma) são compatíveis" #: extmod/ulab/code/compare.c extmod/ulab/code/ndarray.c #: extmod/ulab/code/vectorise.c msgid "operands could not be broadcast together" -msgstr "" +msgstr "os operandos não puderam ser transmitidos juntos" #: extmod/ulab/code/numerical.c msgid "operation is not implemented on ndarrays" -msgstr "" +msgstr "a operação não foi implementada nos ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is not supported for given type" -msgstr "" +msgstr "operação não é compatível com o tipo informado" #: py/modbuiltins.c msgid "ord expects a character" -msgstr "" +msgstr "o ord espera um caractere" #: py/modbuiltins.c #, c-format msgid "ord() expected a character, but string of length %d found" msgstr "" +"o ord() esperava um caractere, porém a sequência do comprimento %d foi " +"encontrada" #: py/objint_mpz.c msgid "overflow converting long int to machine word" msgstr "" +"houve um transbordamento durante a conversão int longo para a palavra de " +"máquina" #: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c msgid "palette must be 32 bytes long" -msgstr "" +msgstr "a paleta deve ter 32 bytes de comprimento" #: shared-bindings/displayio/Palette.c msgid "palette_index should be an int" -msgstr "" +msgstr "palette_index deve ser um int" #: py/compile.c msgid "parameter annotation must be an identifier" -msgstr "" +msgstr "a anotação do parâmetro deve ser um identificador" #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" -msgstr "" +msgstr "os parâmetros devem ser registradores na sequência a2 até a5" #: py/emitinlinethumb.c msgid "parameters must be registers in sequence r0 to r3" -msgstr "" +msgstr "os parâmetros devem ser registradores na sequência r0 até r3" #: shared-bindings/displayio/Bitmap.c msgid "pixel coordinates out of bounds" -msgstr "" +msgstr "as coordenadas do pixel estão fora dos limites" #: shared-bindings/displayio/Bitmap.c msgid "pixel value requires too many bits" -msgstr "" +msgstr "o valor do pixel requer bits demais" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" +msgstr "o pixel_shader deve ser displayio.Palette ou displayio.ColorConverter" #: shared-module/vectorio/Polygon.c msgid "polygon can only be registered in one parent" -msgstr "" +msgstr "o polígono só pode ser registrado em um pai" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" -msgstr "" +msgstr "pop a partir de um PulseIn vazio" #: py/objset.c msgid "pop from an empty set" -msgstr "" +msgstr "pop a partir de um conjunto vazio" #: py/objlist.c msgid "pop from empty list" -msgstr "" +msgstr "pop a partir da lista vazia" #: py/objdict.c msgid "popitem(): dictionary is empty" -msgstr "" +msgstr "popitem(): o dicionário está vazio" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" -msgstr "" +msgstr "O terceiro argumento pow() não pode ser 0" #: py/objint_mpz.c msgid "pow() with 3 arguments requires integers" -msgstr "" +msgstr "o pow() com 3 argumentos requer números inteiros" #: extmod/modutimeq.c msgid "queue overflow" @@ -2998,52 +3012,54 @@ msgstr "estouro de fila" #: py/parse.c msgid "raw f-strings are not implemented" -msgstr "" +msgstr "o f-strings bruto não estão implementados" #: extmod/ulab/code/fft.c msgid "real and imaginary parts must be of equal length" -msgstr "" +msgstr "partes reais e imaginárias devem ter o mesmo comprimento" #: py/builtinimport.c msgid "relative import" -msgstr "" +msgstr "importação relativa" #: py/obj.c #, c-format msgid "requested length %d but object has length %d" -msgstr "" +msgstr "o comprimento solicitado %d, porém o objeto tem comprimento %d" #: py/compile.c msgid "return annotation must be an identifier" -msgstr "" +msgstr "a anotação do retorno deve ser um identificador" #: py/emitnative.c msgid "return expected '%q' but got '%q'" -msgstr "" +msgstr "o retorno esperado era '%q', porém obteve '% q'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "rgb_pins[%d] duplicates another pin assignment" -msgstr "" +msgstr "rgb_pins[%d] duplica outra atribuição dos pinos" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "rgb_pins[%d] is not on the same port as clock" -msgstr "" +msgstr "rgb_pins[%d] não está na mesma porta que o clock" #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" -msgstr "" +msgstr "o lado direito deve ser um ndarray ou um escalar" #: py/objstr.c msgid "rsplit(None,n)" -msgstr "" +msgstr "rsplit(Nenhum,n)" #: shared-bindings/audiocore/RawSample.c msgid "" "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " "'B'" msgstr "" +"O buffer sample_source deve ser um bytearray ou matriz do tipo 'h', 'H', 'b' " +"ou 'B'" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -3051,7 +3067,7 @@ msgstr "Taxa de amostragem fora do intervalo" #: py/modmicropython.c msgid "schedule stack full" -msgstr "" +msgstr "agende a pilha de função completa" #: lib/utils/pyexec.c py/builtinimport.c msgid "script compilation not supported" @@ -3059,47 +3075,47 @@ msgstr "compilação de script não suportada" #: extmod/ulab/code/ndarray.c msgid "shape must be a 2-tuple" -msgstr "" +msgstr "a forma deve ser uma tupla de 2" #: py/objstr.c msgid "sign not allowed in string format specifier" -msgstr "" +msgstr "sinal não permitido no especificador do formato da sequência" #: py/objstr.c msgid "sign not allowed with integer format specifier 'c'" -msgstr "" +msgstr "sinal não permitido com o especificador no formato inteiro 'c'" #: py/objstr.c msgid "single '}' encountered in format string" -msgstr "" +msgstr "único '}' encontrado na string do formato" #: extmod/ulab/code/linalg.c msgid "size is defined for ndarrays only" -msgstr "" +msgstr "o tamanho é definido apenas para os ndarrays" #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" -msgstr "" +msgstr "a duração do sleep não deve ser negativo" #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" -msgstr "" +msgstr "a etapa da fatia não pode ser zero" #: py/objint.c py/sequence.c msgid "small int overflow" -msgstr "" +msgstr "transbordamento int pequeno" #: main.c msgid "soft reboot\n" -msgstr "" +msgstr "reinicialização soft\n" #: extmod/ulab/code/numerical.c msgid "sort argument must be an ndarray" -msgstr "" +msgstr "o argumento da classificação deve ser um ndarray" #: py/objstr.c msgid "start/end indices" -msgstr "" +msgstr "os índices de início/fim" #: shared-bindings/displayio/Shape.c msgid "start_x should be an int" @@ -3111,28 +3127,28 @@ msgstr "o passo deve ser diferente de zero" #: shared-bindings/busio/UART.c msgid "stop must be 1 or 2" -msgstr "" +msgstr "o stop deve ser 1 ou 2" #: shared-bindings/random/__init__.c msgid "stop not reachable from start" -msgstr "" +msgstr "stop não está acessível a partir do início" #: py/stream.c msgid "stream operation not supported" -msgstr "" +msgstr "a operação do fluxo não é compatível" #: py/objstrunicode.c msgid "string index out of range" -msgstr "" +msgstr "o índice da string está fora do intervalo" #: py/objstrunicode.c #, c-format msgid "string indices must be integers, not %s" -msgstr "" +msgstr "o índices das string devem ser números inteiros, não %s" #: py/stream.c msgid "string not supported; use bytes or bytearray" -msgstr "" +msgstr "a string não é compatível; use bytes ou bytearray" #: extmod/moductypes.c msgid "struct: cannot index" @@ -3148,11 +3164,11 @@ msgstr "struct: sem campos" #: py/objstr.c msgid "substring not found" -msgstr "" +msgstr "a substring não foi encontrada" #: py/compile.c msgid "super() can't find self" -msgstr "" +msgstr "o super() não consegue se encontrar" #: extmod/modujson.c msgid "syntax error in JSON" @@ -3160,7 +3176,7 @@ msgstr "erro de sintaxe no JSON" #: extmod/moductypes.c msgid "syntax error in uctypes descriptor" -msgstr "" +msgstr "houve um erro de sintaxe no descritor uctypes" #: shared-bindings/touchio/TouchIn.c msgid "threshold must be in the range 0-65536" @@ -3168,15 +3184,15 @@ msgstr "Limite deve estar no alcance de 0-65536" #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" -msgstr "" +msgstr "time.struct_time() leva uma sequência com 9" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" -msgstr "" +msgstr "a duração do tempo limite excedeu o valor máximo suportado" #: shared-bindings/busio/UART.c msgid "timeout must be 0.0-100.0 seconds" -msgstr "" +msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" @@ -3184,11 +3200,11 @@ msgstr "o tempo limite deve ser >= 0,0" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "" +msgstr "o tempo limite na espera pelo cartão v1" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "" +msgstr "o tempo limite na espera pelo cartão v2" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" @@ -3200,24 +3216,24 @@ msgstr "Muitos argumentos fornecidos com o formato dado" #: extmod/ulab/code/ndarray.c msgid "too many indices" -msgstr "" +msgstr "índices demais" #: py/runtime.c #, c-format msgid "too many values to unpack (expected %d)" -msgstr "" +msgstr "valores demais para descompactar (esperado %d)" #: extmod/ulab/code/linalg.c py/objstr.c msgid "tuple index out of range" -msgstr "" +msgstr "o índice da tupla está fora do intervalo" #: py/obj.c msgid "tuple/list has wrong length" -msgstr "" +msgstr "a tupla/lista está com tamanho incorreto" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "tuple/list required on RHS" -msgstr "" +msgstr "a tupla/lista necessária no RHS" #: ports/atmel-samd/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: shared-bindings/busio/UART.c @@ -3226,69 +3242,69 @@ msgstr "TX e RX não podem ser ambos" #: py/objtype.c msgid "type '%q' is not an acceptable base type" -msgstr "" +msgstr "o tipo '%q' não é um tipo base aceitável" #: py/objtype.c msgid "type is not an acceptable base type" -msgstr "" +msgstr "tipo não é um tipo base aceitável" #: py/runtime.c msgid "type object '%q' has no attribute '%q'" -msgstr "" +msgstr "o objeto tipo '%q' não possuí atributo '%q'" #: py/objtype.c msgid "type takes 1 or 3 arguments" -msgstr "" +msgstr "o tipo usa 1 ou 3 argumentos" #: py/objint_longlong.c msgid "ulonglong too large" -msgstr "" +msgstr "ulonglong é muito grande" #: py/emitnative.c msgid "unary op %q not implemented" -msgstr "" +msgstr "op %q unário não foi implementado" #: py/parse.c msgid "unexpected indent" -msgstr "" +msgstr "recuo inesperado" #: py/bc.c msgid "unexpected keyword argument" -msgstr "" +msgstr "argumento inesperado da palavra-chave" #: py/bc.c py/objnamedtuple.c msgid "unexpected keyword argument '%q'" -msgstr "" +msgstr "argumento inesperado da palavra-chave '%q'" #: py/lexer.c msgid "unicode name escapes" -msgstr "" +msgstr "escapar o nome unicode" #: py/parse.c msgid "unindent does not match any outer indentation level" -msgstr "" +msgstr "o unindent não coincide com nenhum nível de recuo externo" #: py/objstr.c #, c-format msgid "unknown conversion specifier %c" -msgstr "" +msgstr "especificador de conversão desconhecido %c" #: py/objstr.c #, c-format msgid "unknown format code '%c' for object of type '%s'" -msgstr "" +msgstr "código de formato desconhecido '%c' para o objeto do tipo '%s'" #: py/compile.c msgid "unknown type" -msgstr "" +msgstr "tipo desconhecido" #: py/emitnative.c msgid "unknown type '%q'" -msgstr "" +msgstr "tipo desconhecido '%q'" #: py/objstr.c msgid "unmatched '{' in format" -msgstr "" +msgstr "um '{' sem par no formato" #: py/objtype.c py/runtime.c msgid "unreadable attribute" @@ -3297,83 +3313,83 @@ msgstr "atributo ilegível" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c msgid "unsupported %q type" -msgstr "" +msgstr "tipo %q não suportado" #: py/emitinlinethumb.c #, c-format msgid "unsupported Thumb instruction '%s' with %d arguments" -msgstr "" +msgstr "instrução Thumb '%s' não compatível com argumentos %d" #: py/emitinlinextensa.c #, c-format msgid "unsupported Xtensa instruction '%s' with %d arguments" -msgstr "" +msgstr "instrução Xtensa '%s' não compatível com argumentos %d" #: py/objstr.c #, c-format msgid "unsupported format character '%c' (0x%x) at index %d" -msgstr "" +msgstr "o caractere do formato não é compatível '%c' (0x%x) no índice %d" #: py/runtime.c msgid "unsupported type for %q: '%s'" -msgstr "" +msgstr "tipo não compatível para %q: '%s'" #: py/runtime.c msgid "unsupported type for operator" -msgstr "" +msgstr "tipo não compatível para o operador" #: py/runtime.c msgid "unsupported types for %q: '%s', '%s'" -msgstr "" +msgstr "tipos não compatíveis para %q: '%s', '%s'" #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" -msgstr "" +msgstr "o valor deve caber em %d byte(s)" #: shared-bindings/displayio/Bitmap.c msgid "value_count must be > 0" -msgstr "" +msgstr "o value_count deve ser > 0" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" -msgstr "" +msgstr "o tempo limite do watchdog deve ser maior que 0" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" -msgstr "" +msgstr "a janela deve ser <= intervalo" #: extmod/ulab/code/linalg.c msgid "wrong argument type" -msgstr "" +msgstr "tipo do argumento errado" #: extmod/ulab/code/ndarray.c msgid "wrong index type" -msgstr "" +msgstr "tipo do índice errado" #: extmod/ulab/code/vectorise.c msgid "wrong input type" -msgstr "" +msgstr "tipo da entrada incorreta" #: py/objstr.c msgid "wrong number of arguments" -msgstr "" +msgstr "quantidade errada dos argumentos" #: py/runtime.c msgid "wrong number of values to unpack" -msgstr "" +msgstr "quantidade incorreta dos valores para descompressão" #: extmod/ulab/code/ndarray.c msgid "wrong operand type" -msgstr "" +msgstr "tipo do operando errado" #: extmod/ulab/code/vectorise.c msgid "wrong output type" -msgstr "" +msgstr "tipo da saída incorreta" #: shared-module/displayio/Shape.c msgid "x value out of bounds" -msgstr "" +msgstr "a valor x está fora dos limites" #: shared-bindings/displayio/Shape.c msgid "y should be an int" @@ -3381,7 +3397,7 @@ msgstr "y deve ser um int" #: shared-module/displayio/Shape.c msgid "y value out of bounds" -msgstr "" +msgstr "o valor y está fora dos limites" #: py/objrange.c msgid "zero step" From ab9a64eafa7f2e5892e13053c5e9490437548263 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 1 Jul 2020 10:07:45 -0400 Subject: [PATCH 047/277] Add timer allocator, adjust pulsio to use general purpose timers --- ports/stm/Makefile | 1 + ports/stm/common-hal/pulseio/PWMOut.c | 176 +++--------------------- ports/stm/common-hal/pulseio/PulseIn.c | 77 +++++------ ports/stm/common-hal/pulseio/PulseOut.c | 132 ++++++++---------- ports/stm/mpconfigport.mk | 4 +- ports/stm/peripherals/timers.c | 138 ++++++++++++++++--- ports/stm/peripherals/timers.h | 27 +++- ports/stm/supervisor/port.c | 2 + 8 files changed, 253 insertions(+), 304 deletions(-) diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 08cb36ddf2..0db0775e2e 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -207,6 +207,7 @@ SRC_C += \ mphalport.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ + peripherals/timers.c \ peripherals/stm32$(MCU_SERIES_LOWER)/clocks.c \ peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/pins.c \ peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/gpio.c \ diff --git a/ports/stm/common-hal/pulseio/PWMOut.c b/ports/stm/common-hal/pulseio/PWMOut.c index 304a1539c0..a3c21330e0 100644 --- a/ports/stm/common-hal/pulseio/PWMOut.c +++ b/ports/stm/common-hal/pulseio/PWMOut.c @@ -35,38 +35,14 @@ #include STM32_HAL_H #include "common-hal/microcontroller/Pin.h" +#include "timers.h" + #define ALL_CLOCKS 0xFFFF STATIC uint8_t reserved_tim[TIM_BANK_ARRAY_LEN]; STATIC uint32_t tim_frequencies[TIM_BANK_ARRAY_LEN]; STATIC bool never_reset_tim[TIM_BANK_ARRAY_LEN]; -STATIC void tim_clock_enable(uint16_t mask); -STATIC void tim_clock_disable(uint16_t mask); - -// Get the frequency (in Hz) of the source clock for the given timer. -// On STM32F405/407/415/417 there are 2 cases for how the clock freq is set. -// If the APB prescaler is 1, then the timer clock is equal to its respective -// APB clock. Otherwise (APB prescaler > 1) the timer clock is twice its -// respective APB clock. See DM00031020 Rev 4, page 115. -STATIC uint32_t timer_get_source_freq(uint32_t tim_id) { - uint32_t source, clk_div; - if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) { - // TIM{1,8,9,10,11} are on APB2 - source = HAL_RCC_GetPCLK2Freq(); - clk_div = RCC->CFGR & RCC_CFGR_PPRE2; - } else { - // TIM{2,3,4,5,6,7,12,13,14} are on APB1 - source = HAL_RCC_GetPCLK1Freq(); - clk_div = RCC->CFGR & RCC_CFGR_PPRE1; - } - if (clk_div != 0) { - // APB prescaler for this timer is > 1 - source *= 2; - } - return source; -} - STATIC uint32_t timer_get_internal_duty(uint16_t duty, uint32_t period) { //duty cycle is duty/0xFFFF fraction x (number of pulses per period) return (duty*period) / ((1 << 16) - 1); @@ -97,7 +73,6 @@ void pwmout_reset(void) { never_reset_mask |= 1 << i; } } - tim_clock_disable(ALL_CLOCKS & ~(never_reset_mask)); } pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, @@ -107,6 +82,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, bool variable_frequency) { TIM_TypeDef * TIMx; uint8_t tim_num = MP_ARRAY_SIZE(mcu_tim_pin_list); + bool tim_taken_internal = false; bool tim_chan_taken = false; bool tim_taken_f_mismatch = false; bool var_freq_mismatch = false; @@ -119,8 +95,13 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, //if pin is same if (l_tim->pin == pin) { - //check if the timer has a channel active + //check if the timer has a channel active, or is reserved by main timer system if (reserved_tim[l_tim_index] != 0) { + // Timer has already been reserved by an internal module + if (stm_peripherals_timer_is_reserved(mcu_tim_banks[l_tim_index])) { + tim_taken_internal = true; + continue; //keep looking + } //is it the same channel? (or all channels reserved by a var-freq) if (reserved_tim[l_tim_index] & 1 << (l_tim_channel)) { tim_chan_taken = true; @@ -155,9 +136,12 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, reserved_tim[self->tim->tim_index - 1] |= 1 << (self->tim->channel_index - 1); } tim_frequencies[self->tim->tim_index - 1] = frequency; + stm_peripherals_timer_reserve(TIMx); } else { //no match found if (tim_chan_taken) { mp_raise_ValueError(translate("No more timers available on this pin.")); + } else if (tim_taken_internal) { + mp_raise_ValueError(translate("Timer was reserved for internal use - declare PWM pins earlier in the program")); } else if (tim_taken_f_mismatch) { mp_raise_ValueError(translate("Frequency must match existing PWMOut using this timer")); } else if (var_freq_mismatch) { @@ -182,8 +166,8 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, uint32_t prescaler = 0; //prescaler is 15 bit uint32_t period = 0; //period is 16 bit - timer_get_optimal_divisors(&period, &prescaler, frequency, - timer_get_source_freq(self->tim->tim_index)); + uint32_t source_freq = stm_peripherals_timer_get_source_freq(TIMx); + timer_get_optimal_divisors(&period, &prescaler, frequency, source_freq); //Timer init self->handle.Instance = TIMx; @@ -282,8 +266,8 @@ void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_ uint32_t prescaler = 0; uint32_t period = 0; - timer_get_optimal_divisors(&period, &prescaler, frequency, - timer_get_source_freq(self->tim->tim_index)); + uint32_t source_freq = stm_peripherals_timer_get_source_freq(self->handle.Instance); + timer_get_optimal_divisors(&period, &prescaler, frequency, source_freq); //shut down HAL_TIM_PWM_Stop(&self->handle, self->channel); @@ -318,131 +302,3 @@ uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) { bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self) { return self->variable_frequency; } - -STATIC void tim_clock_enable(uint16_t mask) { - #ifdef TIM1 - if (mask & (1 << 0)) { - __HAL_RCC_TIM1_CLK_ENABLE(); - } - #endif - #ifdef TIM2 - if (mask & (1 << 1)) { - __HAL_RCC_TIM2_CLK_ENABLE(); - } - #endif - #ifdef TIM3 - if (mask & (1 << 2)) { - __HAL_RCC_TIM3_CLK_ENABLE(); - } - #endif - #ifdef TIM4 - if (mask & (1 << 3)) { - __HAL_RCC_TIM4_CLK_ENABLE(); - } - #endif - #ifdef TIM5 - if (mask & (1 << 4)) { - __HAL_RCC_TIM5_CLK_ENABLE(); - } - #endif - //6 and 7 are reserved ADC timers - #ifdef TIM8 - if (mask & (1 << 7)) { - __HAL_RCC_TIM8_CLK_ENABLE(); - } - #endif - #ifdef TIM9 - if (mask & (1 << 8)) { - __HAL_RCC_TIM9_CLK_ENABLE(); - } - #endif - #ifdef TIM10 - if (mask & (1 << 9)) { - __HAL_RCC_TIM10_CLK_ENABLE(); - } - #endif - #ifdef TIM11 - if (mask & (1 << 10)) { - __HAL_RCC_TIM11_CLK_ENABLE(); - } - #endif - #ifdef TIM12 - if (mask & (1 << 11)) { - __HAL_RCC_TIM12_CLK_ENABLE(); - } - #endif - #ifdef TIM13 - if (mask & (1 << 12)) { - __HAL_RCC_TIM13_CLK_ENABLE(); - } - #endif - #ifdef TIM14 - if (mask & (1 << 13)) { - __HAL_RCC_TIM14_CLK_ENABLE(); - } - #endif -} - -STATIC void tim_clock_disable(uint16_t mask) { - #ifdef TIM1 - if (mask & (1 << 0)) { - __HAL_RCC_TIM1_CLK_DISABLE(); - } - #endif - #ifdef TIM2 - if (mask & (1 << 1)) { - __HAL_RCC_TIM2_CLK_DISABLE(); - } - #endif - #ifdef TIM3 - if (mask & (1 << 2)) { - __HAL_RCC_TIM3_CLK_DISABLE(); - } - #endif - #ifdef TIM4 - if (mask & (1 << 3)) { - __HAL_RCC_TIM4_CLK_DISABLE(); - } - #endif - #ifdef TIM5 - if (mask & (1 << 4)) { - __HAL_RCC_TIM5_CLK_DISABLE(); - } - #endif - //6 and 7 are reserved ADC timers - #ifdef TIM8 - if (mask & (1 << 7)) { - __HAL_RCC_TIM8_CLK_DISABLE(); - } - #endif - #ifdef TIM9 - if (mask & (1 << 8)) { - __HAL_RCC_TIM9_CLK_DISABLE(); - } - #endif - #ifdef TIM10 - if (mask & (1 << 9)) { - __HAL_RCC_TIM10_CLK_DISABLE(); - } - #endif - #ifdef TIM11 - if (mask & (1 << 10)) { - __HAL_RCC_TIM11_CLK_DISABLE(); - } - #endif - #ifdef TIM12 - if (mask & (1 << 11)) { - __HAL_RCC_TIM12_CLK_DISABLE(); - } - #endif - #ifdef TIM13 - if (mask & (1 << 12)) { - __HAL_RCC_TIM13_CLK_DISABLE(); - } - #endif - #ifdef TIM14 - if (mask & (1 << 13)) { - __HAL_RCC_TIM14_CLK_DISABLE(); - } - #endif -} diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index 9d82a18a01..8b93e52f20 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -32,39 +32,36 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/pulseio/PulseIn.h" +#include "timers.h" #include STM32_HAL_H #define STM32_GPIO_PORT_SIZE 16 - static pulseio_pulsein_obj_t* _objs[STM32_GPIO_PORT_SIZE]; -STATIC TIM_HandleTypeDef t6_handle; +STATIC TIM_HandleTypeDef tim_handle; static uint32_t overflow_count = 0; STATIC uint8_t refcount = 0; static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num); -void TIM6_IRQHandler(void) +void pulsein_timer_event_handler(void) { // Detect TIM Update event - if (__HAL_TIM_GET_FLAG(&t6_handle, TIM_FLAG_UPDATE) != RESET) + if (__HAL_TIM_GET_FLAG(&tim_handle, TIM_FLAG_UPDATE) != RESET) { - if (__HAL_TIM_GET_IT_SOURCE(&t6_handle, TIM_IT_UPDATE) != RESET) + if (__HAL_TIM_GET_IT_SOURCE(&tim_handle, TIM_IT_UPDATE) != RESET) { - __HAL_TIM_CLEAR_IT(&t6_handle, TIM_IT_UPDATE); + __HAL_TIM_CLEAR_IT(&tim_handle, TIM_IT_UPDATE); overflow_count++; } } } -static void pulsein_handler(uint8_t num) { +static void pulsein_exti_event_handler(uint8_t num) { // Grab the current time first. uint32_t current_overflow = overflow_count; - uint32_t current_count = 0; - #if HAS_BASIC_TIM - current_count = TIM6->CNT; - #endif + uint32_t current_count = tim_handle.Instance->CNT; // Interrupt register must be cleared manually EXTI->PR = 1 << num; @@ -105,17 +102,12 @@ void pulsein_reset(void) { } memset(_objs, 0, sizeof(_objs)); - #if HAS_BASIC_TIM - __HAL_RCC_TIM6_CLK_DISABLE(); + tim_clock_disable(stm_peripherals_timer_get_index(tim_handle.Instance)); refcount = 0; - #endif } void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin, uint16_t maxlen, bool idle_state) { -#if !(HAS_BASIC_TIM) - mp_raise_NotImplementedError(translate("PulseIn not supported on this chip")); -#else // STM32 has one shared EXTI for each pin number, 0-15 uint8_t p_num = pin->number; if(_objs[p_num]) { @@ -141,24 +133,33 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu self->last_count = 0; self->last_overflow = 0; - if (HAL_TIM_Base_GetState(&t6_handle) == HAL_TIM_STATE_RESET) { - // Set the new period - t6_handle.Instance = TIM6; - t6_handle.Init.Prescaler = 168; // HCLK is 168 mhz so divide down to 1mhz - t6_handle.Init.Period = 0xffff; - HAL_TIM_Base_Init(&t6_handle); + if (HAL_TIM_Base_GetState(&tim_handle) == HAL_TIM_STATE_RESET) { + // Find a suitable timer + TIM_TypeDef * tim_instance = stm_peripherals_find_timer(); + stm_peripherals_timer_reserve(tim_instance); - // TIM6 has limited HAL support, set registers manually - t6_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt - t6_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer - t6_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts - __HAL_TIM_ENABLE_IT(&t6_handle, TIM_IT_UPDATE); + // Calculate a 1ms period + uint32_t source = stm_peripherals_timer_get_source_freq(tim_instance); + uint32_t prescaler = source/1000000; // 1us intervals + + stm_peripherals_timer_preinit(tim_instance, 4, pulsein_timer_event_handler); + + // Set the new period + tim_handle.Instance = tim_instance; + tim_handle.Init.Prescaler = prescaler; // divide down to 1mhz + tim_handle.Init.Period = 0xffff; + HAL_TIM_Base_Init(&tim_handle); + + // Set registers manually + tim_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt + tim_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer + tim_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts + __HAL_TIM_ENABLE_IT(&tim_handle, TIM_IT_UPDATE); overflow_count = 0; } // Add to active PulseIns refcount++; -#endif // EXTI pins can also be read as an input GPIO_InitTypeDef GPIO_InitStruct = {0}; @@ -189,9 +190,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) { refcount--; if (refcount == 0) { - #if HAS_BASIC_TIM - __HAL_RCC_TIM6_CLK_DISABLE(); - #endif + tim_clock_disable(1<< stm_peripherals_timer_get_index(tim_handle.Instance)); } } @@ -299,23 +298,23 @@ static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num) { void EXTI0_IRQHandler(void) { - pulsein_handler(0); + pulsein_exti_event_handler(0); } void EXTI1_IRQHandler(void) { - pulsein_handler(1); + pulsein_exti_event_handler(1); } void EXTI2_IRQHandler(void) { - pulsein_handler(2); + pulsein_exti_event_handler(2); } void EXTI3_IRQHandler(void) { - pulsein_handler(3); + pulsein_exti_event_handler(3); } void EXTI4_IRQHandler(void) { - pulsein_handler(4); + pulsein_exti_event_handler(4); } void EXTI9_5_IRQHandler(void) @@ -323,7 +322,7 @@ void EXTI9_5_IRQHandler(void) uint32_t pending = EXTI->PR; for (uint i = 5; i <= 9; i++) { if(pending & (1 << i)) { - pulsein_handler(i); + pulsein_exti_event_handler(i); } } } @@ -333,7 +332,7 @@ void EXTI15_10_IRQHandler(void) uint32_t pending = EXTI->PR; for (uint i = 10; i <= 15; i++) { if(pending & (1 << i)) { - pulsein_handler(i); + pulsein_exti_event_handler(i); } } } diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c index c31b238304..ba817ae263 100644 --- a/ports/stm/common-hal/pulseio/PulseOut.c +++ b/ports/stm/common-hal/pulseio/PulseOut.c @@ -37,19 +37,19 @@ #include STM32_HAL_H #include "common-hal/microcontroller/Pin.h" +#include "timers.h" // A single timer is shared amongst all PulseOut objects under the assumption that // the code is single threaded. STATIC uint8_t refcount = 0; - STATIC uint16_t *pulse_array = NULL; STATIC volatile uint16_t pulse_array_index = 0; STATIC uint16_t pulse_array_length; - //Timer is shared, must be accessible by interrupt -STATIC TIM_HandleTypeDef t7_handle; +STATIC TIM_HandleTypeDef tim_handle; pulseio_pulseout_obj_t *curr_pulseout = NULL; + STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) { // Turn on PWM HAL_TIM_PWM_Start(&(pulseout->pwmout->handle), pulseout->pwmout->channel); @@ -65,88 +65,79 @@ STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) { STATIC void start_timer(void) { // Set the new period - t7_handle.Init.Period = pulse_array[pulse_array_index] - 1; - HAL_TIM_Base_Init(&t7_handle); + tim_handle.Init.Period = pulse_array[pulse_array_index] - 1; + HAL_TIM_Base_Init(&tim_handle); // TIM7 has limited HAL support, set registers manually - t7_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt - t7_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer - t7_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts - __HAL_TIM_ENABLE_IT(&t7_handle, TIM_IT_UPDATE); + tim_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt + tim_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer + tim_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts + __HAL_TIM_ENABLE_IT(&tim_handle, TIM_IT_UPDATE); } STATIC void pulseout_event_handler(void) { - if (curr_pulseout->pwmout == NULL) { - return; //invalid interrupt + // Detect TIM Update event + if (__HAL_TIM_GET_FLAG(&tim_handle, TIM_FLAG_UPDATE) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(&tim_handle, TIM_IT_UPDATE) != RESET) + { + __HAL_TIM_CLEAR_IT(&tim_handle, TIM_IT_UPDATE); + if (curr_pulseout->pwmout == NULL) { + return; //invalid interrupt + } + + pulse_array_index++; + + // No more pulses. Turn off output and don't restart. + if (pulse_array_index >= pulse_array_length) { + turn_off(curr_pulseout); + return; + } + + // Alternate on and off, starting with on. + if (pulse_array_index % 2 == 0) { + turn_on(curr_pulseout); + } else { + turn_off(curr_pulseout); + } + + // Count up to the next given value. + start_timer(); + } } - - pulse_array_index++; - - // No more pulses. Turn off output and don't restart. - if (pulse_array_index >= pulse_array_length) { - turn_off(curr_pulseout); - return; - } - - // Alternate on and off, starting with on. - if (pulse_array_index % 2 == 0) { - turn_on(curr_pulseout); - } else { - turn_off(curr_pulseout); - } - - // Count up to the next given value. - start_timer(); } void pulseout_reset() { - #if HAS_BASIC_TIM - __HAL_RCC_TIM7_CLK_DISABLE(); + stm_peripherals_timer_free(tim_handle.Instance); refcount = 0; - #endif } void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self, const pulseio_pwmout_obj_t* carrier) { -#if !(HAS_BASIC_TIM) - mp_raise_NotImplementedError(translate("PulseOut not supported on this chip")); -#else // Add to active PulseOuts refcount++; + TIM_TypeDef * tim_instance = stm_peripherals_find_timer(); + stm_peripherals_timer_reserve(tim_instance); - // Calculate a 1 ms period - uint32_t source, clk_div; - source = HAL_RCC_GetPCLK1Freq(); // TIM7 is on APB1 - clk_div = RCC->CFGR & RCC_CFGR_PPRE1; - // APB quirk, see See DM00031020 Rev 4, page 115. - if (clk_div != 0) { - // APB prescaler for this timer is > 1 - source *= 2; - } - + //calculate a 1ms period + uint32_t source = stm_peripherals_timer_get_source_freq(tim_instance); uint32_t prescaler = source/1000000; //1us intervals - __HAL_RCC_TIM7_CLK_ENABLE(); - HAL_NVIC_SetPriority(TIM7_IRQn, 4, 0); - HAL_NVIC_EnableIRQ(TIM7_IRQn); + stm_peripherals_timer_preinit(tim_instance, 4, pulseout_event_handler); + tim_handle.Instance = tim_instance; + tim_handle.Init.Period = 100; //immediately replaced. + tim_handle.Init.Prescaler = prescaler - 1; + tim_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + tim_handle.Init.CounterMode = TIM_COUNTERMODE_UP; + tim_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; - // Timers 6 and 7 have no pins, so using them doesn't affect PWM availability - t7_handle.Instance = TIM7; - t7_handle.Init.Period = 100; //immediately replaced. - t7_handle.Init.Prescaler = prescaler - 1; - t7_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; - t7_handle.Init.CounterMode = TIM_COUNTERMODE_UP; - t7_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; - - HAL_TIM_Base_Init(&t7_handle); - t7_handle.Instance->SR = 0; + HAL_TIM_Base_Init(&tim_handle); + tim_handle.Instance->SR = 0; // The HAL can't work with const, recast required. self->pwmout = (pulseio_pwmout_obj_t*)carrier; - turn_off(self); -#endif } bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) { @@ -162,9 +153,7 @@ void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) { refcount--; if (refcount == 0) { - #if HAS_BASIC_TIM - __HAL_RCC_TIM7_CLK_DISABLE(); - #endif + tim_clock_disable(1<< stm_peripherals_timer_get_index(tim_handle.Instance)); } } @@ -187,24 +176,11 @@ void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pu // signal. RUN_BACKGROUND_TASKS; - // Use when debugging, or issues are irrecoverable + // // Use when debugging, or issues are irrecoverable // if ((supervisor_ticks_ms64() - starttime ) > timeout ) { // mp_raise_RuntimeError(translate("Error: Send Timeout")); // } } //turn off timer counter. - t7_handle.Instance->CR1 &= ~TIM_CR1_CEN; -} - -void TIM7_IRQHandler(void) -{ - // Detect TIM Update event - if (__HAL_TIM_GET_FLAG(&t7_handle, TIM_FLAG_UPDATE) != RESET) - { - if (__HAL_TIM_GET_IT_SOURCE(&t7_handle, TIM_IT_UPDATE) != RESET) - { - __HAL_TIM_CLEAR_IT(&t7_handle, TIM_IT_UPDATE); - pulseout_event_handler(); - } - } + tim_handle.Instance->CR1 &= ~TIM_CR1_CEN; } diff --git a/ports/stm/mpconfigport.mk b/ports/stm/mpconfigport.mk index 7b720d1564..3b3a21bd24 100644 --- a/ports/stm/mpconfigport.mk +++ b/ports/stm/mpconfigport.mk @@ -4,8 +4,8 @@ INTERNAL_LIBM ?= 1 USB_SERIAL_NUMBER_LENGTH ?= 24 ifeq ($(MCU_VARIANT),STM32F405xx) - CIRCUITPY_FRAMEBUFFERIO ?= 1 - CIRCUITPY_RGBMATRIX ?= 1 + CIRCUITPY_FRAMEBUFFERIO ?= 0 + CIRCUITPY_RGBMATRIX ?= 0 endif ifeq ($(MCU_SERIES),F4) diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index 81242f34b6..f28b36eec7 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -23,20 +23,51 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "timers.h" + +#include "py/mpconfig.h" +#include "py/gc.h" +#include "py/obj.h" +#include "py/runtime.h" +#include "supervisor/shared/translate.h" + +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" + +#define ALL_CLOCKS 0xFFFF static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)]; static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)]; -static void *stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)](void); - -STATIC void tim_clock_enable(uint16_t mask); -STATIC void tim_clock_disable(uint16_t mask); +static void (*stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)])(void); +static size_t irq_map[] = { + TIM1_CC_IRQn, + TIM2_IRQn, + TIM3_IRQn, + TIM4_IRQn, + TIM5_IRQn, + TIM6_DAC_IRQn, + TIM7_IRQn, + TIM8_CC_IRQn, + TIM1_BRK_TIM9_IRQn, + TIM1_UP_TIM10_IRQn, + TIM1_TRG_COM_TIM11_IRQn, + TIM8_BRK_TIM12_IRQn, + TIM8_UP_TIM13_IRQn, + TIM8_TRG_COM_TIM14_IRQn, +#if (CPY_STM32H7) + TIM15_IRQn, + TIM16_IRQn, + TIM17_IRQn, +#endif +}; // Get the frequency (in Hz) of the source clock for the given timer. // On STM32F405/407/415/417 there are 2 cases for how the clock freq is set. // If the APB prescaler is 1, then the timer clock is equal to its respective // APB clock. Otherwise (APB prescaler > 1) the timer clock is twice its // respective APB clock. See DM00031020 Rev 4, page 115. -STATIC uint32_t timer_get_source_freq(uint32_t tim_id) { +uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer) { + size_t tim_id = stm_peripherals_timer_get_index(timer); uint32_t source, clk_div; if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) { // TIM{1,8,9,10,11} are on APB2 @@ -54,11 +85,44 @@ STATIC uint32_t timer_get_source_freq(uint32_t tim_id) { return source; } +void timers_reset(void) { + uint16_t never_reset_mask = 0x00; + for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) { + if (!stm_timer_never_reset[i]) { + stm_timer_reserved[i] = false; + } else { + never_reset_mask |= 1 << i; + } + } + tim_clock_disable(ALL_CLOCKS & ~(never_reset_mask)); +} + TIM_TypeDef * stm_peripherals_find_timer(void) { - // TODO: check for unreserved timers from already claimed pins + // Check for timers on pins outside the package size + // for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) { + // bool timer_in_package = false; + // // Find each timer instance on the given bank + // for (size_t j = 0; j < MP_ARRAY_SIZE(mcu_tim_pin_list); j++) { + // // If a pin is claimed, we skip it + // if ( (mcu_tim_pin_list[j].tim_index == i) + // && (common_hal_mcu_pin_is_free(mcu_tim_pin_list[j].pin) == true) ) { + // // Search whether any pins in the package array match it + // for (size_t k = 0; k < mcu_pin_globals.map.alloc; k++) { + // if ( (mcu_tim_pin_list[j].pin == (mcu_pin_obj_t*)(mcu_pin_globals.map.table[k].value)) ) { + // timer_in_package = true; + // } + // } + // } + // } + // // If no results are found, no unclaimed pins with this timer are in this package, + // // and it is safe to pick + // if (timer_in_package == false && mcu_tim_banks[i] != NULL) { + // return mcu_tim_banks[i]; + // } + // } // Work backwards - higher index timers have fewer pin allocations - for (size_t i = MP_ARRAY_SIZE(stm_timer_reserved); i>=0; i--) { + for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i>=0; i--) { if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) { return mcu_tim_banks[i]; } @@ -67,20 +131,58 @@ TIM_TypeDef * stm_peripherals_find_timer(void) { return NULL; } +void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void)) { + size_t tim_idx = stm_peripherals_timer_get_index(instance); + stm_timer_callback[tim_idx] = callback; + tim_clock_enable(1 << tim_idx); + HAL_NVIC_SetPriority(irq_map[tim_idx], prio, 0); + HAL_NVIC_EnableIRQ(irq_map[tim_idx]); +} + +void stm_peripherals_timer_reserve(TIM_TypeDef * instance) { + size_t tim_idx = stm_peripherals_timer_get_index(instance); + stm_timer_reserved[tim_idx] = true; +} + void stm_peripherals_timer_set_callback(void(*callback)(void), TIM_TypeDef * timer) { - stm_timer_callback[stm_peripherals_timer_get_index] + stm_timer_callback[stm_peripherals_timer_get_index(timer)] = callback; } void stm_peripherals_timer_free(TIM_TypeDef * instance) { - + size_t tim_idx = stm_peripherals_timer_get_index(instance); + stm_timer_callback[tim_idx] = NULL; + tim_clock_disable(1 << tim_idx); + stm_timer_reserved[tim_idx] = false; + stm_timer_never_reset[tim_idx] = false; } -void stm_peripherals_timer_never_reset(TIM_TypeDef * instance); -void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance); -void stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance); -void stm_peripherals_timer_is_reserved(TIM_TypeDef * instance); -size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance); -STATIC void tim_clock_enable(uint16_t mask) { +void stm_peripherals_timer_never_reset(TIM_TypeDef * instance) { + size_t tim_idx = stm_peripherals_timer_get_index(instance); + stm_timer_never_reset[tim_idx] = true; +} +void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance) { + size_t tim_idx = stm_peripherals_timer_get_index(instance); + stm_timer_never_reset[tim_idx] = false; +} +bool stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance){ + size_t tim_idx = stm_peripherals_timer_get_index(instance); + return stm_timer_never_reset[tim_idx]; +} +bool stm_peripherals_timer_is_reserved(TIM_TypeDef * instance) { + size_t tim_idx = stm_peripherals_timer_get_index(instance); + return stm_timer_reserved[tim_idx]; +} + +size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance) { + for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) { + if (instance == mcu_tim_banks[i]) { + return i; + } + } + return ~(size_t)0; +} + +void tim_clock_enable(uint16_t mask) { #ifdef TIM1 if (mask & (1 << 0)) { __HAL_RCC_TIM1_CLK_ENABLE(); @@ -144,7 +246,7 @@ STATIC void tim_clock_enable(uint16_t mask) { #endif } -STATIC void tim_clock_disable(uint16_t mask) { +void tim_clock_disable(uint16_t mask) { #ifdef TIM1 if (mask & (1 << 0)) { __HAL_RCC_TIM1_CLK_DISABLE(); @@ -209,8 +311,8 @@ STATIC void tim_clock_disable(uint16_t mask) { } STATIC void callback_router(size_t index) { - if (stm_timer_callback[index]) { - (*stm_timer_callback[index])(); + if (stm_timer_callback[index - 1]) { + (*stm_timer_callback[index - 1])(); } } diff --git a/ports/stm/peripherals/timers.h b/ports/stm/peripherals/timers.h index b0f594b775..8c8a80d53c 100644 --- a/ports/stm/peripherals/timers.h +++ b/ports/stm/peripherals/timers.h @@ -24,17 +24,30 @@ * THE SOFTWARE. */ -typedef struct { - TIM_TypeDef * p_reg; - uint8_t instance_id; - uint8_t cc_channel_count; -} nrfx_timer_t; +// typedef struct { +// TIM_TypeDef * timer; +// bool reserved; +// bool never_reset; +// void (*stm_timer_callback)(void); +// size_t irq; +// } stm_timer_t; +#include +#include "py/mphal.h" +#include "peripherals/periph.h" + +#include STM32_HAL_H + +void tim_clock_enable(uint16_t mask); +void tim_clock_disable(uint16_t mask); +uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer); void timers_reset(void); TIM_TypeDef * stm_peripherals_find_timer(void); +void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void)); +void stm_peripherals_timer_reserve(TIM_TypeDef * instance); void stm_peripherals_timer_free(TIM_TypeDef * instance); void stm_peripherals_timer_never_reset(TIM_TypeDef * instance); void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance); -void stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance); -void stm_peripherals_timer_is_reserved(TIM_TypeDef * instance); +bool stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance); +bool stm_peripherals_timer_is_reserved(TIM_TypeDef * instance); size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance); diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index 07a93c025b..7c9fcf750e 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -41,6 +41,7 @@ #include "common-hal/pulseio/PWMOut.h" #include "common-hal/pulseio/PulseOut.h" #include "common-hal/pulseio/PulseIn.h" +#include "timers.h" #endif #include "clocks.h" @@ -224,6 +225,7 @@ void reset_port(void) { uart_reset(); #endif #if CIRCUITPY_PULSEIO + timers_reset(); pwmout_reset(); pulseout_reset(); pulsein_reset(); From 783846c6057f96999687c5895bef97b28e47e1fa Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 1 Jul 2020 10:00:28 -0500 Subject: [PATCH 048/277] ulab: update to 0.51.1 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 0394801933..48cb939839 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 0394801933f6e68a5bc7cdb0da76c7884e8cf70a +Subproject commit 48cb939839fcf091fcdcdf742530b1b650066a15 From e33accae4d8439dbab0764d98e6f188c9489eb06 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 1 Jul 2020 10:15:09 -0500 Subject: [PATCH 049/277] ulab: document sosfilt --- shared-bindings/ulab/filter/__init__.pyi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/shared-bindings/ulab/filter/__init__.pyi b/shared-bindings/ulab/filter/__init__.pyi index fff404300b..5e7202e06c 100644 --- a/shared-bindings/ulab/filter/__init__.pyi +++ b/shared-bindings/ulab/filter/__init__.pyi @@ -17,3 +17,20 @@ def convolve(r, c=None): Convolution is most time-efficient when both inputs are of float type.""" ... + +def sosfilt(sos : ulab.array, x : ulab.array, *, xi : Optional[ulab.array] = None) -> Union[ulab.array, Tuple[ulab.array, ulab.array]]: + """ + :param ulab.array sos: Array of second-order filter coefficients, must have shape (n_sections, 6). Each row corresponds to a second-order section, with the first three columns providing the numerator coefficients and the last three providing the denominator coefficients. + :param ulab.array x: The data to be filtered + :param ulab.array zi: Optional initial conditions for the filter + + :return: If ``xi`` is not specified, the filter result alone is returned. If ``xi`` is specified, the return value is a 2-tuple of the filter result and the final filter conditions. + + Filter data along one dimension using cascaded second-order sections. + + Filter a data sequence, x, using a digital IIR filter defined by sos. + + The filter function is implemented as a series of second-order filters with direct-form II transposed structure. It is designed to minimize numerical precision errors for high-order filters. + + Filter coefficients can be generated by using scipy's filter generators such as ``signal.ellip(..., output='sos')``.""" + ... From 48bc4bd5d6159c55ebe4c4ef6f517d794a054502 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 1 Jul 2020 10:33:38 -0500 Subject: [PATCH 050/277] make translate --- locale/circuitpython.pot | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3a3b159a04..7141cc8722 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3009,6 +3009,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3025,6 +3029,18 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "" @@ -3314,3 +3330,15 @@ msgstr "" #: py/objrange.c msgid "zero step" msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" From b80dbb4b2c0437b5ab3eece24a271f460f7d21c3 Mon Sep 17 00:00:00 2001 From: svgops Date: Wed, 1 Jul 2020 12:06:59 -0600 Subject: [PATCH 051/277] add-ndgarage_ndbit6_v2 --- .../boards/ndgarage_ndbit6/mpconfigboard.h | 19 ++----- .../atmel-samd/boards/ndgarage_ndbit6/pins.c | 50 +++++++++---------- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h b/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h index 51be8d7c06..ed2d779f5b 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h @@ -1,13 +1,8 @@ -#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow" +#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow-v2" #define MICROPY_HW_MCU_NAME "samd21e18" #define MICROPY_HW_LED_STATUS (&pin_PA23) -#define SPI_FLASH_MOSI_PIN &pin_PA16 -#define SPI_FLASH_MISO_PIN &pin_PA18 -#define SPI_FLASH_SCK_PIN &pin_PA17 -#define SPI_FLASH_CS_PIN &pin_PA15 - #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) @@ -16,15 +11,11 @@ #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 CIRCUITPY_INTERNAL_NVM_SIZE) -#define DEFAULT_I2C_BUS_SCL (&pin_PA09) -#define DEFAULT_I2C_BUS_SDA (&pin_PA08) +#define DEFAULT_I2C_BUS_SCL (&pin_PA17) +#define DEFAULT_I2C_BUS_SDA (&pin_PA16) -#define DEFAULT_SPI_BUS_SCK (&pin_PA05) -#define DEFAULT_SPI_BUS_MOSI (&pin_PA04) -#define DEFAULT_SPI_BUS_MISO (&pin_PA06) - -#define DEFAULT_UART_BUS_RX (&pin_PA09) -#define DEFAULT_UART_BUS_TX (&pin_PA08) +#define DEFAULT_UART_BUS_RX (&pin_PA17) +#define DEFAULT_UART_BUS_TX (&pin_PA16) // USB is always used. #define IGNORE_PIN_PA24 1 diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c b/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c index 2ea5630079..562684fd8c 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c @@ -1,39 +1,35 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA09) }, - - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA23) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From c759c9a2aab89040b20aa4af43744987a569b14d Mon Sep 17 00:00:00 2001 From: ndgarage Date: Wed, 1 Jul 2020 13:58:07 -0600 Subject: [PATCH 052/277] add-ndgarage_ndbit6_v2-update --- .github/workflows/build.yml | 1 + .../boards/ndgarage_ndbit6_v2/board.c | 39 +++++++++++++++++++ .../boards/ndgarage_ndbit6_v2/mpconfigboard.h | 22 +++++++++++ .../ndgarage_ndbit6_v2/mpconfigboard.mk | 14 +++++++ .../boards/ndgarage_ndbit6_v2/pins.c | 35 +++++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c create mode 100644 ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00454cc2da..4c74df3391 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -204,6 +204,7 @@ jobs: - "mini_sam_m4" - "monster_m4sk" - "ndgarage_ndbit6" + - "ndgarage_ndbit6_v2" - "nfc_copy_cat" - "nice_nano" - "nucleo_f746zg" diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c new file mode 100644 index 0000000000..0f60736a24 --- /dev/null +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "hal/include/hal_gpio.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h new file mode 100644 index 0000000000..ed2d779f5b --- /dev/null +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h @@ -0,0 +1,22 @@ +#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow-v2" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_LED_STATUS (&pin_PA23) + +#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define CIRCUITPY_INTERNAL_NVM_SIZE 256 + +#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 CIRCUITPY_INTERNAL_NVM_SIZE) + +#define DEFAULT_I2C_BUS_SCL (&pin_PA17) +#define DEFAULT_I2C_BUS_SDA (&pin_PA16) + +#define DEFAULT_UART_BUS_RX (&pin_PA17) +#define DEFAULT_UART_BUS_TX (&pin_PA16) + +// USB is always used. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk new file mode 100644 index 0000000000..09804bc4e7 --- /dev/null +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk @@ -0,0 +1,14 @@ +LD_FILE = boards/samd21x18-bootloader.ld +USB_VID = 0x239A +USB_PID = 0x8066 +USB_PRODUCT = "Bit6" +USB_MANUFACTURER = "ndGarage" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 + +SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c new file mode 100644 index 0000000000..562684fd8c --- /dev/null +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c @@ -0,0 +1,35 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) }, + + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA23) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 0537f4e77543130b7b1962774a656cf7997d3c2c Mon Sep 17 00:00:00 2001 From: ndgarage Date: Wed, 1 Jul 2020 14:12:52 -0600 Subject: [PATCH 053/277] restore-ndgarage_ndbit6-to-original --- .../boards/ndgarage_ndbit6/mpconfigboard.h | 20 ++++++-- .../atmel-samd/boards/ndgarage_ndbit6/pins.c | 51 ++++++++++--------- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h b/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h index ed2d779f5b..869f207a16 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h @@ -1,8 +1,13 @@ -#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow-v2" +#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow" #define MICROPY_HW_MCU_NAME "samd21e18" #define MICROPY_HW_LED_STATUS (&pin_PA23) +#define SPI_FLASH_MOSI_PIN &pin_PA16 +#define SPI_FLASH_MISO_PIN &pin_PA18 +#define SPI_FLASH_SCK_PIN &pin_PA17 +#define SPI_FLASH_CS_PIN &pin_PA15 + #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) @@ -11,12 +16,17 @@ #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 CIRCUITPY_INTERNAL_NVM_SIZE) -#define DEFAULT_I2C_BUS_SCL (&pin_PA17) -#define DEFAULT_I2C_BUS_SDA (&pin_PA16) +#define DEFAULT_I2C_BUS_SCL (&pin_PA09) +#define DEFAULT_I2C_BUS_SDA (&pin_PA08) -#define DEFAULT_UART_BUS_RX (&pin_PA17) -#define DEFAULT_UART_BUS_TX (&pin_PA16) +#define DEFAULT_SPI_BUS_SCK (&pin_PA05) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA04) +#define DEFAULT_SPI_BUS_MISO (&pin_PA06) + +#define DEFAULT_UART_BUS_RX (&pin_PA09) +#define DEFAULT_UART_BUS_TX (&pin_PA08) // USB is always used. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 + diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c b/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c index 562684fd8c..8b3898b185 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c @@ -1,35 +1,40 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA09) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA23) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); + From 367d3800fc501bfe3ec05b4b517ed195cf8d07c4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 1 Jul 2020 14:35:25 -0700 Subject: [PATCH 054/277] Return false if we already have the lock --- ports/esp32s2/common-hal/busio/I2C.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 74b3896fc2..57270372f1 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -163,6 +163,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { } bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) { + if (self->has_lock) { + return false; + } self->has_lock = xSemaphoreTake(&self->semaphore, 0) == pdTRUE; return self->has_lock; } From 87d58b3b0a7b9d1c67e3234680a14a18ca55189c Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 1 Jul 2020 17:48:10 -0400 Subject: [PATCH 055/277] STM32: add debug flags, fix hang in simplex SPI --- ports/stm/Makefile | 4 ++-- ports/stm/common-hal/busio/SPI.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 08cb36ddf2..a982de765b 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -81,12 +81,12 @@ INC += -I../../supervisor/shared/usb #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb + CFLAGS += -ggdb3 # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra else CFLAGS += -Os -DNDEBUG - CFLAGS += -ggdb + CFLAGS += -ggdb3 # TODO: Test with -flto # CFLAGS += -flto endif diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 65eeb8ebcf..380302da65 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -238,8 +238,11 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, self->handle.Instance = SPIx; self->handle.Init.Mode = SPI_MODE_MASTER; - // Direction change only required for RX-only, see RefMan RM0090:884 - self->handle.Init.Direction = (self->mosi == NULL) ? SPI_DIRECTION_2LINES_RXONLY : SPI_DIRECTION_2LINES; + // Implementing one-directional recieve-only SPI as per [RefMan RM0090:884] + // results in BSY bit related hangs. Using MOSI as an IO works fine without it, + // so it's unclear why this mode is present in the first place. + //self->handle.Init.Direction = (self->mosi == NULL) ? SPI_DIRECTION_2LINES_RXONLY : SPI_DIRECTION_2LINES; + self->handle.Init.Direction = SPI_DIRECTION_2LINES; self->handle.Init.DataSize = SPI_DATASIZE_8BIT; self->handle.Init.CLKPolarity = SPI_POLARITY_LOW; self->handle.Init.CLKPhase = SPI_PHASE_1EDGE; From a301a9d9b12b69284a6f21e365505a96295e0743 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 1 Jul 2020 23:21:09 +0200 Subject: [PATCH 056/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 30 +++++++++++++++++++++++++++++- locale/cs.po | 30 +++++++++++++++++++++++++++++- locale/de_DE.po | 30 +++++++++++++++++++++++++++++- locale/es.po | 30 +++++++++++++++++++++++++++++- locale/fil.po | 30 +++++++++++++++++++++++++++++- locale/fr.po | 30 +++++++++++++++++++++++++++++- locale/it_IT.po | 30 +++++++++++++++++++++++++++++- locale/ko.po | 30 +++++++++++++++++++++++++++++- locale/nl.po | 30 +++++++++++++++++++++++++++++- locale/pl.po | 30 +++++++++++++++++++++++++++++- locale/pt_BR.po | 34 +++++++++++++++++++++++++++++++--- locale/sv.po | 30 +++++++++++++++++++++++++++++- locale/zh_Latn_pinyin.po | 30 +++++++++++++++++++++++++++++- 13 files changed, 379 insertions(+), 15 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 8d89115d7a..da4f7b904b 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3034,6 +3034,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3050,6 +3054,18 @@ msgstr "memulai ulang software(soft reboot)\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "" @@ -3341,6 +3357,18 @@ msgstr "" msgid "zero step" msgstr "" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "AP dibutuhkan" diff --git a/locale/cs.po b/locale/cs.po index 3869cd45ab..9029985397 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -3017,6 +3017,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3033,6 +3037,18 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "" @@ -3322,3 +3338,15 @@ msgstr "" #: py/objrange.c msgid "zero step" msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 567a2f8ba2..3b7c49b396 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -3100,6 +3100,10 @@ msgstr "Größe ist nur für ndarrays definiert" msgid "sleep length must be non-negative" msgstr "Die Schlafdauer darf nicht negativ sein" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "Der Slice-Schritt kann nicht Null sein" @@ -3116,6 +3120,18 @@ msgstr "weicher reboot\n" msgid "sort argument must be an ndarray" msgstr "sortierungs Argument muss ein ndarray sein" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "start/end Indizes" @@ -3411,6 +3427,18 @@ msgstr "y Wert außerhalb der Grenzen" msgid "zero step" msgstr "Nullschritt" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "AP erforderlich" diff --git a/locale/es.po b/locale/es.po index aad07ddf4f..9034024068 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-06-29 13:13+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -3072,6 +3072,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "la longitud de sleep no puede ser negativa" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "slice step no puede ser cero" @@ -3088,6 +3092,18 @@ msgstr "reinicio suave\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "índices inicio/final" @@ -3381,6 +3397,18 @@ msgstr "address fuera de límites" msgid "zero step" msgstr "paso cero" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "AP requerido" diff --git a/locale/fil.po b/locale/fil.po index 4f155ecc58..ff5cc6426d 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -3063,6 +3063,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "sleep length ay dapat hindi negatibo" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "slice step ay hindi puedeng 0" @@ -3079,6 +3083,18 @@ msgstr "malambot na reboot\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "start/end indeks" @@ -3373,6 +3389,18 @@ msgstr "wala sa sakop ang address" msgid "zero step" msgstr "zero step" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "AP kailangan" diff --git a/locale/fr.po b/locale/fr.po index 392b779894..7facdef043 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" @@ -3106,6 +3106,10 @@ msgstr "la taille est définie pour les ndarrays uniquement" msgid "sleep length must be non-negative" msgstr "la longueur de sleep ne doit pas être négative" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "le pas 'step' de la tranche ne peut être zéro" @@ -3122,6 +3126,18 @@ msgstr "redémarrage logiciel\n" msgid "sort argument must be an ndarray" msgstr "l'argument de «sort» doit être un ndarray" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "indices de début/fin" @@ -3413,6 +3429,18 @@ msgstr "valeur y hors limites" msgid "zero step" msgstr "'step' nul" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "'AP' requis" diff --git a/locale/it_IT.po b/locale/it_IT.po index 13651437b7..983b47b824 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -3070,6 +3070,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "la lunghezza di sleed deve essere non negativa" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "la step della slice non può essere zero" @@ -3086,6 +3090,18 @@ msgstr "soft reboot\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "" @@ -3380,6 +3396,18 @@ msgstr "indirizzo fuori limite" msgid "zero step" msgstr "zero step" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "AP richiesto" diff --git a/locale/ko.po b/locale/ko.po index 73926d47bd..ea3f564700 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -3014,6 +3014,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3030,6 +3034,18 @@ msgstr "" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "" @@ -3320,6 +3336,18 @@ msgstr "" msgid "zero step" msgstr "" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "Can't add services in Central mode" #~ msgstr "센트랄(중앙) 모드에서는 서비스를 추가 할 수 없습니다" diff --git a/locale/nl.po b/locale/nl.po index b9fd85e163..12a767b183 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-06-02 19:50+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -3073,6 +3073,10 @@ msgstr "omvang is alleen voor ndarrays gedefinieerd" msgid "sleep length must be non-negative" msgstr "de slaapduur mag niet negatief zijn" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "segmentstap mag niet nul zijn" @@ -3089,6 +3093,18 @@ msgstr "zachte herstart\n" msgid "sort argument must be an ndarray" msgstr "sorteerargument moet een ndarray zijn" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "start/stop indices" @@ -3379,6 +3395,18 @@ msgstr "y-waarde buiten bereik" msgid "zero step" msgstr "nul-stap" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "I2C operation not supported" #~ msgstr "I2C actie niet ondersteund" diff --git a/locale/pl.po b/locale/pl.po index 1f2e9a61bc..d626e8ebcf 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -3020,6 +3020,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "okres snu musi być nieujemny" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "zerowy krok" @@ -3036,6 +3040,18 @@ msgstr "programowy reset\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "początkowe/końcowe indeksy" @@ -3326,6 +3342,18 @@ msgstr "y poza zakresem" msgid "zero step" msgstr "zerowy krok" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "Address is not %d bytes long or is in wrong format" #~ msgstr "Adres nie ma długości %d bajtów lub zły format" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index acabdb197e..8094f4a2df 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-06-30 17:48+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1748,8 +1748,8 @@ msgstr "O WatchDogTimer não está em execução" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgstr "" -"O WatchDogTimer.mode não pode ser alterado uma vez definido para WatchDogMode" -".RESET" +"O WatchDogTimer.mode não pode ser alterado uma vez definido para " +"WatchDogMode.RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.timeout must be greater than 0" @@ -3097,6 +3097,10 @@ msgstr "o tamanho é definido apenas para os ndarrays" msgid "sleep length must be non-negative" msgstr "a duração do sleep não deve ser negativo" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "a etapa da fatia não pode ser zero" @@ -3113,6 +3117,18 @@ msgstr "reinicialização soft\n" msgid "sort argument must be an ndarray" msgstr "o argumento da classificação deve ser um ndarray" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "os índices de início/fim" @@ -3403,6 +3419,18 @@ msgstr "o valor y está fora dos limites" msgid "zero step" msgstr "passo zero" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "AP required" #~ msgstr "AP requerido" diff --git a/locale/sv.po b/locale/sv.po index 6a38d35702..f359eba275 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2020-06-03 18:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -3066,6 +3066,10 @@ msgstr "storlek är enbart definierad ndarrays" msgid "sleep length must be non-negative" msgstr "värdet för sleep måste vara positivt" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "segmentsteg får inte vara noll" @@ -3082,6 +3086,18 @@ msgstr "mjuk omstart\n" msgid "sort argument must be an ndarray" msgstr "argumentet sort måste vara en ndarray" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "start-/slutindex" @@ -3372,6 +3388,18 @@ msgstr "y-värde utanför intervall" msgid "zero step" msgstr "noll steg" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "I2C operation not supported" #~ msgstr "I2C-åtgärd stöds inte" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1609f672cd..bc9a7253b9 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-26 11:50-0500\n" +"POT-Creation-Date: 2020-07-01 10:33-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -3050,6 +3050,10 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "shuìmián chángdù bìxū shìfēi fùshù" +#: extmod/ulab/code/ndarray.c +msgid "slice step can't be zero" +msgstr "" + #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "qiēpiàn bù bùnéng wéi líng" @@ -3066,6 +3070,18 @@ msgstr "ruǎn chóngqǐ\n" msgid "sort argument must be an ndarray" msgstr "" +#: extmod/ulab/code/filter.c +msgid "sos array must be of shape (n_section, 6)" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sos[:, 3] should be all ones" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "sosfilt requires iterable arguments" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "kāishǐ/jiéshù zhǐshù" @@ -3356,6 +3372,18 @@ msgstr "y zhí chāochū biānjiè" msgid "zero step" msgstr "líng bù" +#: extmod/ulab/code/filter.c +msgid "zi must be an ndarray" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of float type" +msgstr "" + +#: extmod/ulab/code/filter.c +msgid "zi must be of shape (n_section, 2)" +msgstr "" + #~ msgid "Address is not %d bytes long or is in wrong format" #~ msgstr "Dìzhǐ bùshì %d zì jié zhǎng, huòzhě géshì cuòwù" From 75bcd73439bf038a1b88e1b4124059241ea054ff Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 1 Jul 2020 22:00:10 +0000 Subject: [PATCH 057/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (777 of 777 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 8094f4a2df..92cf0172d0 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-01 10:33-0500\n" -"PO-Revision-Date: 2020-06-30 17:48+0000\n" +"PO-Revision-Date: 2020-07-02 02:02+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -354,7 +354,7 @@ msgstr "Array deve conter meias palavras (tipo 'H')" #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "Os valores da matriz devem ser bytes simples." +msgstr "Os valores das matrizes devem ser bytes simples." #: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" @@ -3099,7 +3099,7 @@ msgstr "a duração do sleep não deve ser negativo" #: extmod/ulab/code/ndarray.c msgid "slice step can't be zero" -msgstr "" +msgstr "a etapa da fatia não pode ser zero" #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" @@ -3119,15 +3119,15 @@ msgstr "o argumento da classificação deve ser um ndarray" #: extmod/ulab/code/filter.c msgid "sos array must be of shape (n_section, 6)" -msgstr "" +msgstr "o sos da matriz deve estar na forma (n_section, 6)" #: extmod/ulab/code/filter.c msgid "sos[:, 3] should be all ones" -msgstr "" +msgstr "sos[:, 3] deve ser um em todos" #: extmod/ulab/code/filter.c msgid "sosfilt requires iterable arguments" -msgstr "" +msgstr "o sosfilt requer que os argumentos sejam iteráveis" #: py/objstr.c msgid "start/end indices" @@ -3421,15 +3421,15 @@ msgstr "passo zero" #: extmod/ulab/code/filter.c msgid "zi must be an ndarray" -msgstr "" +msgstr "zi deve ser um ndarray" #: extmod/ulab/code/filter.c msgid "zi must be of float type" -msgstr "" +msgstr "zi deve ser de um tipo float" #: extmod/ulab/code/filter.c msgid "zi must be of shape (n_section, 2)" -msgstr "" +msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "AP required" #~ msgstr "AP requerido" From f4a24744477abe0d924ef08781d6e30118cc9982 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Thu, 2 Jul 2020 15:24:59 +0200 Subject: [PATCH 058/277] spresense: Add support for sdioio --- ports/cxd56/boards/spresense/pins.c | 16 +++ ports/cxd56/common-hal/microcontroller/Pin.c | 6 + ports/cxd56/common-hal/microcontroller/Pin.h | 6 + ports/cxd56/common-hal/sdioio/SDCard.c | 141 +++++++++++++++++++ ports/cxd56/common-hal/sdioio/SDCard.h | 47 +++++++ ports/cxd56/common-hal/sdioio/__init__.c | 0 ports/cxd56/mpconfigport.mk | 3 + 7 files changed, 219 insertions(+) create mode 100644 ports/cxd56/common-hal/sdioio/SDCard.c create mode 100644 ports/cxd56/common-hal/sdioio/SDCard.h create mode 100644 ports/cxd56/common-hal/sdioio/__init__.c diff --git a/ports/cxd56/boards/spresense/pins.c b/ports/cxd56/boards/spresense/pins.c index fcc854590a..5028d91556 100644 --- a/ports/cxd56/boards/spresense/pins.c +++ b/ports/cxd56/boards/spresense/pins.c @@ -24,8 +24,21 @@ * THE SOFTWARE. */ +#include "py/objtuple.h" + #include "shared-bindings/board/__init__.h" +STATIC const mp_rom_obj_tuple_t sdio_data_tuple = { + {&mp_type_tuple}, + 4, + { + MP_ROM_PTR(&pin_SDIO_DATA0), + MP_ROM_PTR(&pin_SDIO_DATA1), + MP_ROM_PTR(&pin_SDIO_DATA2), + MP_ROM_PTR(&pin_SDIO_DATA3), + } +}; + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_UART2_RXD) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_UART2_TXD) }, @@ -76,5 +89,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_CLOCK), MP_ROM_PTR(&pin_SDIO_CLK) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_COMMAND), MP_ROM_PTR(&pin_SDIO_CMD) }, + { MP_ROM_QSTR(MP_QSTR_SDIO_DATA), MP_ROM_PTR(&sdio_data_tuple) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/cxd56/common-hal/microcontroller/Pin.c b/ports/cxd56/common-hal/microcontroller/Pin.c index 23377197c2..7aba1ad54b 100644 --- a/ports/cxd56/common-hal/microcontroller/Pin.c +++ b/ports/cxd56/common-hal/microcontroller/Pin.c @@ -72,6 +72,12 @@ const mcu_pin_obj_t pin_I2S1_BCK = PIN(PIN_I2S1_BCK, false); const mcu_pin_obj_t pin_I2S1_LRCK = PIN(PIN_I2S1_LRCK, false); const mcu_pin_obj_t pin_I2S1_DATA_IN = PIN(PIN_I2S1_DATA_IN, false); const mcu_pin_obj_t pin_I2S1_DATA_OUT = PIN(PIN_I2S1_DATA_OUT, false); +const mcu_pin_obj_t pin_SDIO_CLK = PIN(PIN_SDIO_CLK, false); +const mcu_pin_obj_t pin_SDIO_CMD = PIN(PIN_SDIO_CMD, false); +const mcu_pin_obj_t pin_SDIO_DATA0 = PIN(PIN_SDIO_DATA0, false); +const mcu_pin_obj_t pin_SDIO_DATA1 = PIN(PIN_SDIO_DATA1, false); +const mcu_pin_obj_t pin_SDIO_DATA2 = PIN(PIN_SDIO_DATA2, false); +const mcu_pin_obj_t pin_SDIO_DATA3 = PIN(PIN_SDIO_DATA3, false); const mcu_pin_obj_t pin_LPADC0 = PIN(0, true); const mcu_pin_obj_t pin_LPADC1 = PIN(1, true); const mcu_pin_obj_t pin_LPADC2 = PIN(2, true); diff --git a/ports/cxd56/common-hal/microcontroller/Pin.h b/ports/cxd56/common-hal/microcontroller/Pin.h index fe6524edb5..6759a2dcab 100644 --- a/ports/cxd56/common-hal/microcontroller/Pin.h +++ b/ports/cxd56/common-hal/microcontroller/Pin.h @@ -77,6 +77,12 @@ extern const mcu_pin_obj_t pin_I2S1_BCK; extern const mcu_pin_obj_t pin_I2S1_LRCK; extern const mcu_pin_obj_t pin_I2S1_DATA_IN; extern const mcu_pin_obj_t pin_I2S1_DATA_OUT; +extern const mcu_pin_obj_t pin_SDIO_CLK; +extern const mcu_pin_obj_t pin_SDIO_CMD; +extern const mcu_pin_obj_t pin_SDIO_DATA0; +extern const mcu_pin_obj_t pin_SDIO_DATA1; +extern const mcu_pin_obj_t pin_SDIO_DATA2; +extern const mcu_pin_obj_t pin_SDIO_DATA3; extern const mcu_pin_obj_t pin_LPADC0; extern const mcu_pin_obj_t pin_LPADC1; extern const mcu_pin_obj_t pin_LPADC2; diff --git a/ports/cxd56/common-hal/sdioio/SDCard.c b/ports/cxd56/common-hal/sdioio/SDCard.c new file mode 100644 index 0000000000..cf7de422c1 --- /dev/null +++ b/ports/cxd56/common-hal/sdioio/SDCard.c @@ -0,0 +1,141 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright 2020 Sony Semiconductor Solutions Corporation + * + * 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 +#include +#include + +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "shared-bindings/sdioio/SDCard.h" +#include "shared-bindings/util.h" + +#define DATA_PINS_NUM 4 + +void common_hal_sdioio_sdcard_construct(sdioio_sdcard_obj_t *self, + const mcu_pin_obj_t *clock, const mcu_pin_obj_t *command, + uint8_t num_data, mcu_pin_obj_t **data, uint32_t frequency) { + struct geometry geo; + + if (clock->number != PIN_SDIO_CLK || command->number != PIN_SDIO_CMD) { + mp_raise_ValueError(translate("Invalid pins")); + } + + uint8_t data_pins_num = 0; + for (uint8_t i = 0; i < DATA_PINS_NUM; i++) { + if (data[i]->number != PIN_SDIO_DATA0 || data[i]->number != PIN_SDIO_DATA1 || + data[i]->number != PIN_SDIO_DATA2 || data[i]->number != PIN_SDIO_DATA3) { + data_pins_num++; + } + } + + if (data_pins_num != DATA_PINS_NUM) { + mp_raise_ValueError(translate("Invalid pins")); + } + + if (open_blockdriver("/dev/mmcsd0", 0, &self->inode) < 0) { + mp_raise_ValueError(translate("Could not initialize SDCard")); + } + + self->inode->u.i_bops->geometry(self->inode, &geo); + + claim_pin(clock); + claim_pin(command); + self->clock_pin = clock; + self->command_pin = command; + for (uint8_t i = 0; i < DATA_PINS_NUM; i++) { + claim_pin(data[i]); + self->data_pins[i] = data[i]; + } + + self->count = geo.geo_nsectors; + self->frequency = frequency; + self->width = num_data; +} + +void common_hal_sdioio_sdcard_deinit(sdioio_sdcard_obj_t *self) { + close_blockdriver(self->inode); + self->inode = NULL; + + reset_pin_number(self->clock_pin->number); + reset_pin_number(self->command_pin->number); + for (uint8_t i = 0; i < DATA_PINS_NUM; i++) { + reset_pin_number(self->data_pins[i]->number); + } +} + +bool common_hal_sdioio_sdcard_deinited(sdioio_sdcard_obj_t *self) { + return self->inode == NULL; +} + +bool common_hal_sdioio_sdcard_configure(sdioio_sdcard_obj_t *self, uint32_t baudrate, uint8_t width) { + return true; +} + +uint32_t common_hal_sdioio_sdcard_get_frequency(sdioio_sdcard_obj_t* self) { + return self->frequency; +} + +uint8_t common_hal_sdioio_sdcard_get_width(sdioio_sdcard_obj_t* self) { + return self->width; +} + +uint32_t common_hal_sdioio_sdcard_get_count(sdioio_sdcard_obj_t* self) { + return self->count; +} + +STATIC void check_whole_block(mp_buffer_info_t *bufinfo) { + if (bufinfo->len % 512) { + mp_raise_ValueError(translate("Buffer length must be a multiple of 512")); + } +} + +int common_hal_sdioio_sdcard_readblocks(sdioio_sdcard_obj_t* self, uint32_t start_block, mp_buffer_info_t *bufinfo) { + if (common_hal_sdioio_sdcard_deinited(self)) { + raise_deinited_error(); + } + check_whole_block(bufinfo); + + return self->inode->u.i_bops->read(self->inode, bufinfo->buf, start_block, bufinfo->len / 512); +} + +int common_hal_sdioio_sdcard_writeblocks(sdioio_sdcard_obj_t* self, uint32_t start_block, mp_buffer_info_t *bufinfo) { + if (common_hal_sdioio_sdcard_deinited(self)) { + raise_deinited_error(); + } + check_whole_block(bufinfo); + + return self->inode->u.i_bops->write(self->inode, bufinfo->buf, start_block, bufinfo->len / 512);; +} + +void common_hal_sdioio_sdcard_never_reset(sdioio_sdcard_obj_t *self) { + never_reset_pin_number(self->clock_pin->number); + never_reset_pin_number(self->command_pin->number); + for (uint8_t i = 0; i < DATA_PINS_NUM; i++) { + never_reset_pin_number(self->data_pins[i]->number); + } +} diff --git a/ports/cxd56/common-hal/sdioio/SDCard.h b/ports/cxd56/common-hal/sdioio/SDCard.h new file mode 100644 index 0000000000..cbdcd47069 --- /dev/null +++ b/ports/cxd56/common-hal/sdioio/SDCard.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright 2020 Sony Semiconductor Solutions Corporation + * + * 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_CXD56_SDIOIO_SDCARD_H +#define MICROPY_INCLUDED_CXD56_SDIOIO_SDCARD_H + +#include + +#include "py/obj.h" + +#include "common-hal/microcontroller/Pin.h" + +typedef struct { + mp_obj_base_t base; + struct inode* inode; + uint32_t frequency; + uint32_t count; + uint8_t width; + const mcu_pin_obj_t *command_pin; + const mcu_pin_obj_t *clock_pin; + const mcu_pin_obj_t *data_pins[4]; +} sdioio_sdcard_obj_t; + +#endif // MICROPY_INCLUDED_CXD56_SDIOIO_SDCARD_H diff --git a/ports/cxd56/common-hal/sdioio/__init__.c b/ports/cxd56/common-hal/sdioio/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/cxd56/mpconfigport.mk b/ports/cxd56/mpconfigport.mk index 23f60f8a7f..eb077c07bd 100644 --- a/ports/cxd56/mpconfigport.mk +++ b/ports/cxd56/mpconfigport.mk @@ -7,6 +7,8 @@ USB_CDC_EP_NUM_DATA_IN = 1 USB_MSC_EP_NUM_OUT = 5 USB_MSC_EP_NUM_IN = 4 +MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz + CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_COUNTIO = 0 @@ -18,6 +20,7 @@ CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_SDIOIO = 1 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 From 7aa689823eee9a9c19050e313ce4665b9e192f1b Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 09:27:14 -0400 Subject: [PATCH 059/277] Added type hints to analogio --- shared-bindings/analogio/AnalogIn.c | 10 +++++----- shared-bindings/analogio/AnalogOut.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 400784b390..84a4bf5f43 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -70,7 +70,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Turn off the AnalogIn and release the pin for other use.""" //| ... //| @@ -86,13 +86,13 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> None: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -104,7 +104,7 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__); -//| value: Any = ... +//| value: int = ... //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only) //| //| Even if the underlying analog to digital converter (ADC) is lower @@ -124,7 +124,7 @@ const mp_obj_property_t analogio_analogin_value_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| reference_voltage: Any = ... +//| reference_voltage: Optional[float] = ... //| """The maximum voltage measurable (also known as the reference voltage) as a //| `float` in Volts.""" //| diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index a8edcc0ae1..f020096472 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -66,7 +66,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Turn off the AnalogOut and release the pin for other use.""" //| ... //| @@ -79,13 +79,13 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit); -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> None: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__); -//| value: Any = ... +//| value: None = ... //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only) //| //| Even if the underlying digital to analog converter (DAC) is lower From 22f0c14fdbdd457f700411781c601d428105d913 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Thu, 2 Jul 2020 15:26:05 +0200 Subject: [PATCH 060/277] locale: update translate --- locale/circuitpython.pot | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 7141cc8722..6e32ebab98 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -425,7 +425,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -589,6 +590,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "" @@ -982,7 +987,8 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" From 6fd6747e9eb27c04038ad53df79a2f8885485f3d Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 09:36:22 -0400 Subject: [PATCH 061/277] Added type hints for analogio --- shared-bindings/analogio/AnalogIn.c | 10 +++++----- shared-bindings/analogio/AnalogOut.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 400784b390..84a4bf5f43 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -70,7 +70,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Turn off the AnalogIn and release the pin for other use.""" //| ... //| @@ -86,13 +86,13 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> None: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -104,7 +104,7 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__); -//| value: Any = ... +//| value: int = ... //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only) //| //| Even if the underlying analog to digital converter (ADC) is lower @@ -124,7 +124,7 @@ const mp_obj_property_t analogio_analogin_value_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| reference_voltage: Any = ... +//| reference_voltage: Optional[float] = ... //| """The maximum voltage measurable (also known as the reference voltage) as a //| `float` in Volts.""" //| diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index a8edcc0ae1..f020096472 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -66,7 +66,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Turn off the AnalogOut and release the pin for other use.""" //| ... //| @@ -79,13 +79,13 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit); -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> None: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__); -//| value: Any = ... +//| value: None = ... //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only) //| //| Even if the underlying digital to analog converter (DAC) is lower From cb259de5ef01a9b8d590ab34f866fd6bce9a801a Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 10:23:17 -0400 Subject: [PATCH 062/277] Did busio, fixed up analogio --- shared-bindings/analogio/AnalogIn.c | 2 +- shared-bindings/analogio/AnalogOut.c | 2 +- shared-bindings/busio/I2C.c | 18 ++++++++--------- shared-bindings/busio/OneWire.c | 12 ++++++------ shared-bindings/busio/SPI.c | 20 +++++++++---------- shared-bindings/busio/UART.c | 29 ++++++++++++++-------------- 6 files changed, 42 insertions(+), 41 deletions(-) diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 84a4bf5f43..b41abc8478 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -86,7 +86,7 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> None: +//| def __enter__(self, ) -> AnalogIn: //| """No-op used by Context Managers.""" //| ... //| diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index f020096472..11957e8e9d 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -79,7 +79,7 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit); -//| def __enter__(self, ) -> None: +//| def __enter__(self, ) -> AnalogOut: //| """No-op used by Context Managers.""" //| ... //| diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index b61dd93f3a..7de9d5d4df 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -83,7 +83,7 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con return (mp_obj_t)self; } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... //| @@ -100,13 +100,13 @@ STATIC void check_for_deinit(busio_i2c_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> I2C: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -125,7 +125,7 @@ static void check_lock(busio_i2c_obj_t *self) { } } -//| def scan(self, ) -> Any: +//| def scan(self, ) -> list: //| //| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a //| list of those that respond. @@ -150,7 +150,7 @@ STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_scan_obj, busio_i2c_scan); -//| def try_lock(self, ) -> Any: +//| def try_lock(self, ) -> bool: //| """Attempts to grab the I2C lock. Returns True on success. //| //| :return: True when lock has been grabbed @@ -164,7 +164,7 @@ STATIC mp_obj_t busio_i2c_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_try_lock_obj, busio_i2c_obj_try_lock); -//| def unlock(self, ) -> Any: +//| def unlock(self, ) -> none: //| """Releases the I2C lock.""" //| ... //| @@ -176,7 +176,7 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> Any: +//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> Any: +//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address``. //| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be //| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and @@ -287,7 +287,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> Any: +//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/busio/OneWire.c b/shared-bindings/busio/OneWire.c index 723cc031a8..08a79daa9b 100644 --- a/shared-bindings/busio/OneWire.c +++ b/shared-bindings/busio/OneWire.c @@ -77,7 +77,7 @@ STATIC mp_obj_t busio_onewire_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialize the OneWire bus and release any hardware resources for reuse.""" //| ... //| @@ -94,13 +94,13 @@ STATIC void check_for_deinit(busio_onewire_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> OneWire: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -112,7 +112,7 @@ STATIC mp_obj_t busio_onewire_obj___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_onewire___exit___obj, 4, 4, busio_onewire_obj___exit__); -//| def reset(self, ) -> Any: +//| def reset(self, ) -> bool: //| """Reset the OneWire bus and read presence //| //| :returns: False when at least one device is present @@ -127,7 +127,7 @@ STATIC mp_obj_t busio_onewire_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_reset_obj, busio_onewire_obj_reset); -//| def read_bit(self, ) -> Any: +//| def read_bit(self, ) -> bool: //| """Read in a bit //| //| :returns: bit state read @@ -142,7 +142,7 @@ STATIC mp_obj_t busio_onewire_obj_read_bit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_read_bit_obj, busio_onewire_obj_read_bit); -//| def write_bit(self, value: Any) -> Any: +//| def write_bit(self, value: bool) -> None: //| """Write out a bit based on value.""" //| ... //| diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 793ab4f671..3d28adbcb5 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -100,7 +100,7 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Turn off the SPI bus.""" //| ... //| @@ -111,13 +111,13 @@ STATIC mp_obj_t busio_spi_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit); -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> SPI: //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... //| -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -142,7 +142,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) { } } -//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any: +//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None: //| """Configures the SPI bus. The SPI object must be locked. //| //| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower @@ -201,7 +201,7 @@ STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_ } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure); -//| def try_lock(self, ) -> Any: +//| def try_lock(self, ) -> bool: //| """Attempts to grab the SPI lock. Returns True on success. //| //| :return: True when lock has been grabbed @@ -215,7 +215,7 @@ STATIC mp_obj_t busio_spi_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock); -//| def unlock(self, ) -> Any: +//| def unlock(self, ) -> None: //| """Releases the SPI lock.""" //| ... //| @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock); -//| def write(self, buffer: bytearray, *, start: Any = 0, end: int = None) -> Any: +//| def write(self, buffer: bytes, *, start: int = 0, end: int = None) -> None: //| """Write the data contained in ``buffer``. The SPI object must be locked. //| If the buffer is empty, nothing happens. //| @@ -270,7 +270,7 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write); -//| def readinto(self, buffer: bytearray, *, start: Any = 0, end: int = None, write_value: int = 0) -> Any: +//| def readinto(self, buffer: bytearray, *, start: int = 0, end: int = None, write_value: int = 0) -> None: //| """Read into ``buffer`` while writing ``write_value`` for each byte read. //| The SPI object must be locked. //| If the number of bytes to read is 0, nothing happens. @@ -314,7 +314,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto); -//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any: +//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: int = 0, out_end: int = None, in_start: None = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The SPI object must be locked. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` @@ -377,7 +377,7 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_readinto); -//| frequency: Any = ... +//| frequency: int = ... //| """The actual SPI bus frequency. This may not match the frequency requested //| due to internal limitations.""" //| diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 018ded1828..133caee198 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -142,7 +142,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co return (mp_obj_t)self; } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the UART and releases any hardware resources for reuse.""" //| ... //| @@ -159,13 +159,13 @@ STATIC void check_for_deinit(busio_uart_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> UART: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -179,7 +179,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ // These are standard stream methods. Code is in py/stream.c. // -//| def read(self, nbytes: Any = None) -> Any: +//| def read(self, nbytes: int = None) -> Optional[bytes]: //| """Read characters. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended @@ -190,7 +190,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def readinto(self, buf: Any) -> Any: +//| def readinto(self, buf: bytes) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` @@ -200,7 +200,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def readline(self, ) -> Any: +//| def readline(self, ) -> Optional[int]: //| """Read a line, ending in a newline character. //| //| :return: the line read @@ -208,7 +208,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def write(self, buf: Any) -> Any: +//| def write(self, buf: bytearray) -> Optional[int]: //| """Write the buffer of bytes to the bus. //| //| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string. @@ -261,7 +261,7 @@ STATIC mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t return ret; } -//| baudrate: Any = ... +//| baudrate: int = ... //| """The current baudrate.""" //| STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) { @@ -287,7 +287,7 @@ const mp_obj_property_t busio_uart_baudrate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| in_waiting: Any = ... +//| in_waiting: int = ... //| """The number of bytes in the input buffer, available to be read""" //| STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) { @@ -304,7 +304,7 @@ const mp_obj_property_t busio_uart_in_waiting_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| timeout: Any = ... +//| timeout: float = ... //| """The current timeout, in seconds (float).""" //| STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) { @@ -332,8 +332,9 @@ const mp_obj_property_t busio_uart_timeout_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def reset_input_buffer(self, ) -> Any: ... -//| """Discard any unread characters in the input buffer.""" +//| def reset_input_buffer(self, ) -> None: +//| """Discard any unread characters in the input buffer.""" +//| ... //| STATIC mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) { busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -346,10 +347,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_o //| class Parity: //| """Enum-like class to define the parity used to verify correct data transfer.""" //| -//| ODD: Any = ... +//| ODD: int = ... //| """Total number of ones should be odd.""" //| -//| EVEN: Any = ... +//| EVEN: int = ... //| """Total number of ones should be even.""" //| const mp_obj_type_t busio_uart_parity_type; From d1664bdde2764e1a72a792dcfb23d4b650085e97 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 10:25:20 -0400 Subject: [PATCH 063/277] Fixed extract_pyi script to allow NoneType --- tools/extract_pyi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index d749d202b3..131cef15f2 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -1,3 +1,7 @@ +# Run with 'python tools/extract_pyi.py shared-bindings/ path/to/stub/dir +# You can also test a specific library in shared-bindings by putting the path +# to that directory instead + import os import sys import astroid @@ -58,8 +62,10 @@ def convert_folder(top_level, stub_directory): print(i.__dict__['name']) for j in i.body: if isinstance(j, astroid.scoped_nodes.FunctionDef): - if None in j.args.__dict__['annotations']: - print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") + for i in j.args.__dict__['annotations']: + if type(i) == astroid.node_classes.Name: + if i.name == 'Any': + print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") if j.returns: if 'Any' in j.returns.__dict__.values(): print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") From 1e96ca582ee1d5e728dd6cd8b744a40ea1c98fe5 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:10:43 -0400 Subject: [PATCH 064/277] Made more modifications to extract_pyi.py --- tools/extract_pyi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 131cef15f2..9d22af93af 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -62,10 +62,14 @@ def convert_folder(top_level, stub_directory): print(i.__dict__['name']) for j in i.body: if isinstance(j, astroid.scoped_nodes.FunctionDef): - for i in j.args.__dict__['annotations']: - if type(i) == astroid.node_classes.Name: - if i.name == 'Any': + for k, l in zip(j.args.__dict__['annotations'], j.args.__dict__['args']): + # K is type, l is name + if l.name != 'self': + if not k: print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") + elif str(type(k)) == "": + if k.name == 'Any': + print(f"'Any' parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") if j.returns: if 'Any' in j.returns.__dict__.values(): print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") From 627ecadb3f6f131f62a760bb58f3f329b9ad1c2c Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:10:53 -0400 Subject: [PATCH 065/277] Did aesio --- shared-bindings/aesio/aes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index f6a0a89b80..11505a0018 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -12,7 +12,7 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key, mode=0, iv=None, segment_size=8) -> Any: +//| def __init__(self, key: bytearray, mode: int=0, iv: bytearray=None, segment_size: int=8) -> AES: //| """Create a new AES state with the given key. //| //| :param bytearray key: A 16-, 24-, or 32-byte key @@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, } } -//| def encrypt_into(src, dest) -> None: +//| def encrypt_into(src: bytes, dest: bytearray) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the @@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); -//| def decrypt_into(src, dest) -> None: +//| def decrypt_into(src: bytes, dest: bytearray) -> None: //| //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the From 427733af04fa4d9d2075ec98e4083c48d1469695 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:30:42 -0400 Subject: [PATCH 066/277] More tweaks to extract_pyi.py --- tools/extract_pyi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 9d22af93af..1781cbd10d 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -76,7 +76,7 @@ def convert_folder(top_level, stub_directory): elif isinstance(j, astroid.node_classes.AnnAssign): if 'name' in j.__dict__['annotation'].__dict__: if j.__dict__['annotation'].__dict__['name'] == 'Any': - print(f"missing attribute type on line {j.__dict__['lineno']}") + print(f"missing attribute type: {j.__dict__['target'].name} on line {j.__dict__['lineno']}") ok += 1 except astroid.exceptions.AstroidSyntaxError as e: From 2681bd52b5ec3834024d8b189335315ea4cab7fc Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:33:18 -0400 Subject: [PATCH 067/277] Did audiobusio --- shared-bindings/audiobusio/I2SOut.c | 18 +++++++++--------- shared-bindings/audiobusio/PDMIn.c | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index fd71a6e852..dd212cdb54 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -112,7 +112,7 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the I2SOut and releases any hardware resources for reuse.""" //| ... //| @@ -128,13 +128,13 @@ STATIC void check_for_deinit(audiobusio_i2sout_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> I2SOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__); -//| def play(self, sample: Any, *, loop: Any = False) -> Any: +//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixe.Mixer], *, loop: Any = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -174,7 +174,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_play(size_t n_args, const mp_obj_t *pos_ar } MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_play); -//| def stop(self, ) -> Any: +//| def stop(self, ) -> None: //| """Stops playback.""" //| ... //| @@ -186,7 +186,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop); -//| playing: Any = ... +//| playing: bool = ... //| """True when the audio sample is being output. (read-only)""" //| STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) { @@ -203,7 +203,7 @@ const mp_obj_property_t audiobusio_i2sout_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def pause(self, ) -> Any: +//| def pause(self, ) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... //| @@ -219,7 +219,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pause); -//| def resume(self, ) -> Any: +//| def resume(self, ) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... //| @@ -235,7 +235,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume); -//| paused: Any = ... +//| paused: bool = ... //| """True when playback is paused. (read-only)""" //| STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) { diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 5b950297b5..4aa1787992 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -134,7 +134,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the PDMIn and releases any hardware resources for reuse.""" //| ... //| @@ -150,13 +150,13 @@ STATIC void check_for_deinit(audiobusio_pdmin_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> PDMIn: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context.""" //| ... //| @@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__); -//| def record(self, destination: Any, destination_length: Any) -> Any: +//| def record(self, destination: bytearray, destination_length: int) -> None: //| """Records destination_length bytes of samples to destination. This is //| blocking. //| @@ -210,7 +210,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat } MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record); -//| sample_rate: Any = ... +//| sample_rate: int = ... //| """The actual sample_rate of the recording. This may not match the constructed //| sample rate due to internal clock limitations.""" //| From b26ee6c1f666598bf3dd2bd66414916e3d7fe79f Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:37:24 -0400 Subject: [PATCH 068/277] Added type hints to audiocore --- shared-bindings/audiocore/RawSample.c | 8 ++++---- shared-bindings/audiocore/WaveFile.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 2eadf1fab4..dec029bf41 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -101,7 +101,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the AudioOut and releases any hardware resources for reuse.""" //| ... //| @@ -118,13 +118,13 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> RawSample: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__); -//| sample_rate: Any = ... +//| sample_rate: Optional(int) = ... //| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second). //| When the sample is looped, this can change the pitch output without changing the underlying //| sample. This will not change the sample rate of any active playback. Call ``play`` again to diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index a067f6cda8..6f7d270058 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -91,7 +91,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the WaveFile and releases all memory resources for reuse.""" //| ... STATIC mp_obj_t audioio_wavefile_deinit(mp_obj_t self_in) { @@ -107,13 +107,13 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> WaveFile: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__); -//| sample_rate: Any = ... +//| sample_rate: Optional(int) = ... //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" @@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bits_per_sample: Any = ... +//| bits_per_sample: int = ... //| """Bits per sample. (read only)""" //| STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) { @@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = { (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -//| channel_count: Any = ... +//| channel_count: int = ... //| """Number of audio channels. (read only)""" //| STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) { From 3d1e0051e6a1ccff0fbca760ce0781a5086a9676 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:46:08 -0400 Subject: [PATCH 069/277] Added type hints to audioio --- shared-bindings/audioio/AudioOut.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 9ba72bd41d..25b3d01ffa 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -111,7 +111,7 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the AudioOut and releases any hardware resources for reuse.""" //| ... //| @@ -127,13 +127,13 @@ STATIC void check_for_deinit(audioio_audioout_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> AudioOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -146,7 +146,7 @@ STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *arg STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__); -//| def play(self, sample: Any, *, loop: Any = False) -> Any: +//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -175,7 +175,7 @@ STATIC mp_obj_t audioio_audioout_obj_play(size_t n_args, const mp_obj_t *pos_arg } MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_play); -//| def stop(self, ) -> Any: +//| def stop(self, ) -> None: //| """Stops playback and resets to the start of the sample.""" //| ... //| @@ -187,7 +187,7 @@ STATIC mp_obj_t audioio_audioout_obj_stop(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop); -//| playing: Any = ... +//| playing: bool = ... //| """True when an audio sample is being output even if `paused`. (read-only)""" //| STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) { @@ -204,7 +204,7 @@ const mp_obj_property_t audioio_audioout_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def pause(self, ) -> Any: +//| def pause(self, ) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... //| @@ -220,7 +220,7 @@ STATIC mp_obj_t audioio_audioout_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause); -//| def resume(self, ) -> Any: +//| def resume(self, ) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... //| @@ -236,7 +236,7 @@ STATIC mp_obj_t audioio_audioout_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resume); -//| paused: Any = ... +//| paused: bool = ... //| """True when playback is paused. (read-only)""" //| STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) { From 24bca06db00ed032f645d69534b42625c9772776 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:55:27 -0400 Subject: [PATCH 070/277] Added type hints to audiomixer --- shared-bindings/audiomixer/Mixer.c | 16 ++++++++-------- shared-bindings/audiomixer/MixerVoice.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index 31e62cdae1..abd09790f8 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -121,7 +121,7 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the Mixer and releases any hardware resources for reuse.""" //| ... //| @@ -138,13 +138,13 @@ STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> Mixer: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -156,7 +156,7 @@ STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__); -//| playing: Any = ... +//| playing: bool = ... //| """True when any voice is being output. (read-only)""" //| STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) { @@ -173,7 +173,7 @@ const mp_obj_property_t audiomixer_mixer_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| sample_rate: Any = ... +//| sample_rate: int = ... //| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).""" //| STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| voice: Any = ... +//| voice: Tuple[audiomixer.MixerVoice, ...] = ... //| """A tuple of the mixer's `audiomixer.MixerVoice` object(s). //| //| .. code-block:: python @@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def play(self, sample: Any, *, voice: Any = 0, loop: Any = False) -> Any: +//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -244,7 +244,7 @@ STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_arg } MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_play); -//| def stop_voice(self, voice: Any = 0) -> Any: +//| def stop_voice(self, voice: int = 0) -> None: //| """Stops playback of the sample on the given voice.""" //| ... //| diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index ec5768d2f0..eb0c399d5e 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(self); } -//| def play(self, sample: Any, *, loop: Any = False) -> Any: +//| def play(self, sample: Union[audiocore.WaveFile, audiomixer.Mixer, audiocore.RawSample], *, loop: bool = False) -> None: //| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``. //| Does not block. Use `playing` to block. //| @@ -81,7 +81,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *po } MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play); -//| def stop(self, ) -> Any: +//| def stop(self, ) -> None: //| """Stops playback of the sample on this voice.""" //| ... //| @@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po } MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop); -//| level: Any = ... +//| level: None = ... //| """The volume level of a voice, as a floating point number between 0 and 1.""" //| STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) { @@ -136,7 +136,7 @@ const mp_obj_property_t audiomixer_mixervoice_level_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| playing: Any = ... +//| playing: bool = ... //| """True when this voice is being output. (read-only)""" //| From e114b31a7ab8a75dac542bdab0d4d1fb64246a06 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 12:00:40 -0400 Subject: [PATCH 071/277] Added type hints to audiomp3 --- shared-bindings/audiomp3/MP3Decoder.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index e6d48e32cb..4d4792cdc5 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -89,7 +89,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the MP3 and releases all memory resources for reuse.""" //| ... //| @@ -106,13 +106,13 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> MP3: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__); -//| file: Any = ... +//| file: Optional[file] = ... //| """File to play back.""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) { @@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = { -//| sample_rate: Any = ... +//| sample_rate: Optional[int] = ... //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" @@ -181,7 +181,7 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bits_per_sample: Any = ... +//| bits_per_sample: int = ... //| """Bits per sample. (read only)""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) { @@ -198,7 +198,7 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| channel_count: Any = ... +//| channel_count: int = ... //| """Number of audio channels. (read only)""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) { @@ -215,7 +215,7 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rms_level: Any = ... +//| rms_level: float = ... //| """The RMS audio level of a recently played moment of audio. (read only)""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) { From e169da3532f646e2498f2b326a52aeff896ae170 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 12:01:28 -0400 Subject: [PATCH 072/277] More extract_pyi tweaks --- tools/extract_pyi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 1781cbd10d..f504e634e2 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -59,6 +59,7 @@ def convert_folder(top_level, stub_directory): tree = astroid.parse(stub_contents) for i in tree.body: if 'name' in i.__dict__: + print() print(i.__dict__['name']) for j in i.body: if isinstance(j, astroid.scoped_nodes.FunctionDef): @@ -66,10 +67,10 @@ def convert_folder(top_level, stub_directory): # K is type, l is name if l.name != 'self': if not k: - print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") + print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}") elif str(type(k)) == "": if k.name == 'Any': - print(f"'Any' parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") + print(f"'Any' parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}") if j.returns: if 'Any' in j.returns.__dict__.values(): print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") From ed476a417cb3f0f197355c33b5c5e3db79dddd4e Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 12:07:03 -0400 Subject: [PATCH 073/277] Added type hints to audiopwmio --- shared-bindings/audiopwmio/PWMAudioOut.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index 812b7330d4..cb0b02fd66 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -114,7 +114,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_ return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse.""" //| ... //| @@ -130,13 +130,13 @@ STATIC void check_for_deinit(audiopwmio_pwmaudioout_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> PWMAudioOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__); -//| def play(self, sample: Any, *, loop: Any = False) -> Any: +//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -177,7 +177,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_play(size_t n_args, const mp_obj_t *p } MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaudioout_obj_play); -//| def stop(self, ) -> Any: +//| def stop(self, ) -> None: //| """Stops playback and resets to the start of the sample.""" //| ... //| @@ -189,7 +189,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop); -//| playing: Any = ... +//| playing: bool = ... //| """True when an audio sample is being output even if `paused`. (read-only)""" //| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) { @@ -206,7 +206,7 @@ const mp_obj_property_t audiopwmio_pwmaudioout_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def pause(self, ) -> Any: +//| def pause(self, ) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... //| @@ -222,7 +222,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioout_obj_pause); -//| def resume(self, ) -> Any: +//| def resume(self, ) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... //| @@ -238,7 +238,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume); -//| paused: Any = ... +//| paused: bool = ... //| """True when playback is paused. (read-only)""" //| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) { From ffc5f0c3382bf76e73cfcb9d0ba45b4c1fb19b26 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 12:37:03 -0400 Subject: [PATCH 074/277] Added type hints to bitbangio --- shared-bindings/bitbangio/I2C.c | 18 +++++++++--------- shared-bindings/bitbangio/OneWire.c | 12 ++++++------ shared-bindings/bitbangio/SPI.c | 18 +++++++++--------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 43fe11e628..ae5d613cfd 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -79,7 +79,7 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, return (mp_obj_t)self; } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... //| @@ -96,13 +96,13 @@ STATIC void check_for_deinit(bitbangio_i2c_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> I2C: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -120,7 +120,7 @@ static void check_lock(bitbangio_i2c_obj_t *self) { } } -//| def scan(self, ) -> Any: +//| def scan(self, ) -> list: //| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of //| those that respond. A device responds if it pulls the SDA line low after //| its address (including a read bit) is sent on the bus.""" @@ -142,7 +142,7 @@ STATIC mp_obj_t bitbangio_i2c_scan(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_scan_obj, bitbangio_i2c_scan); -//| def try_lock(self, ) -> Any: +//| def try_lock(self, ) -> bool: //| """Attempts to grab the I2C lock. Returns True on success.""" //| ... //| @@ -153,7 +153,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_try_lock_obj, bitbangio_i2c_obj_try_lock); -//| def unlock(self, ) -> Any: +//| def unlock(self, ) -> None: //| """Releases the I2C lock.""" //| ... //| @@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> Any: +//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> Any: +//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a //| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start //| before a read. @@ -277,7 +277,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> Any: +//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/bitbangio/OneWire.c b/shared-bindings/bitbangio/OneWire.c index a236f4c2aa..898eb3ba6f 100644 --- a/shared-bindings/bitbangio/OneWire.c +++ b/shared-bindings/bitbangio/OneWire.c @@ -78,7 +78,7 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Deinitialize the OneWire bus and release any hardware resources for reuse.""" //| ... //| @@ -95,13 +95,13 @@ STATIC void check_for_deinit(bitbangio_onewire_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> OneWire: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -113,7 +113,7 @@ STATIC mp_obj_t bitbangio_onewire_obj___exit__(size_t n_args, const mp_obj_t *ar } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_onewire___exit___obj, 4, 4, bitbangio_onewire_obj___exit__); -//| def reset(self, ) -> Any: +//| def reset(self, ) -> bool: //| """Reset the OneWire bus""" //| ... //| @@ -125,7 +125,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_reset_obj, bitbangio_onewire_obj_reset); -//| def read_bit(self, ) -> Any: +//| def read_bit(self, ) -> bool: //| """Read in a bit //| //| :returns: bit state read @@ -140,7 +140,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_read_bit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_read_bit_obj, bitbangio_onewire_obj_read_bit); -//| def write_bit(self, value: Any) -> Any: +//| def write_bit(self, value: bool) -> None: //| """Write out a bit based on value.""" //| ... //| diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 6d31037c75..f69b812360 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -90,7 +90,7 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args, return (mp_obj_t)self; } -//| def deinit(self, ) -> Any: +//| def deinit(self, ) -> None: //| """Turn off the SPI bus.""" //| ... //| @@ -107,13 +107,13 @@ STATIC void check_for_deinit(bitbangio_spi_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self, ) -> SPI: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self, ) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -132,7 +132,7 @@ static void check_lock(bitbangio_spi_obj_t *self) { } } -//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> Any: +//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None: //| """Configures the SPI bus. Only valid when locked. //| //| :param int baudrate: the clock rate in Hertz @@ -174,7 +174,7 @@ STATIC mp_obj_t bitbangio_spi_configure(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configure); -//| def try_lock(self, ) -> Any: +//| def try_lock(self, ) -> bool: //| """Attempts to grab the SPI lock. Returns True on success. //| //| :return: True when lock has been grabbed @@ -188,7 +188,7 @@ STATIC mp_obj_t bitbangio_spi_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_try_lock_obj, bitbangio_spi_obj_try_lock); -//| def unlock(self, ) -> Any: +//| def unlock(self, ) -> None: //| """Releases the SPI lock.""" //| ... //| @@ -200,7 +200,7 @@ STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock); -//| def write(self, buf: Any) -> Any: +//| def write(self, buf: bytes) -> None: //| """Write the data contained in ``buf``. Requires the SPI being locked. //| If the buffer is empty, nothing happens.""" //| ... @@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) { MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write); -//| def readinto(self, buf: Any) -> Any: +//| def readinto(self, buf: bytearray) -> None: //| """Read into the buffer specified by ``buf`` while writing zeroes. //| Requires the SPI being locked. //| If the number of bytes to read is 0, nothing happens.""" @@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto); -//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: Any = 0, out_end: int = None, in_start: Any = 0, in_end: int = None) -> Any: +//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` //| must be equal. From ac113fdc815f31b54d742f73265359787bd95290 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 12:39:17 -0400 Subject: [PATCH 075/277] Changed bytearray to a union --- shared-bindings/aesio/aes.c | 6 +++--- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/audiocore/WaveFile.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 2 +- shared-bindings/bitbangio/I2C.c | 6 +++--- shared-bindings/bitbangio/SPI.c | 6 +++--- shared-bindings/busio/I2C.c | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index 11505a0018..4fa6ac6e8f 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -12,7 +12,7 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key: bytearray, mode: int=0, iv: bytearray=None, segment_size: int=8) -> AES: +//| def __init__(self, key: Union[bytes, bytearray, memoryview], mode: int=0, iv: Union[bytes, bytearray, memoryview]=None, segment_size: int=8) -> AES: //| """Create a new AES state with the given key. //| //| :param bytearray key: A 16-, 24-, or 32-byte key @@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, } } -//| def encrypt_into(src: bytes, dest: bytearray) -> None: +//| def encrypt_into(src: Union[bytes, bytearray, memoryview], dest: Union[bytes, bytearray, memoryview]) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the @@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); -//| def decrypt_into(src: bytes, dest: bytearray) -> None: +//| def decrypt_into(src: Union[bytes, bytearray, memoryview], dest: Union[bytes, bytearray, memoryview]) -> None: //| //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 4aa1787992..7b2e04c34f 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__); -//| def record(self, destination: bytearray, destination_length: int) -> None: +//| def record(self, destination: Union[bytes, bytearray, memoryview], destination_length: int) -> None: //| """Records destination_length bytes of samples to destination. This is //| blocking. //| diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 6f7d270058..7df169cc97 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -40,7 +40,7 @@ //| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating //| an internal buffer.""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: bytearray): +//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytes, bytearray, memoryview]): //| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param typing.BinaryIO file: Already opened wave file diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 4d4792cdc5..d9ec490825 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -37,7 +37,7 @@ //| class MP3: //| """Load a mp3 file for audio playback""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: bytearray): +//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytes, bytearray, memoryview]): //| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index ae5d613cfd..37ed617703 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> None: +//| def writeto(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a //| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start //| before a read. @@ -277,7 +277,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index f69b812360..2e5a811cf0 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -200,7 +200,7 @@ STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock); -//| def write(self, buf: bytes) -> None: +//| def write(self, buf: Union[bytes, bytearray, memoryview]) -> None: //| """Write the data contained in ``buf``. Requires the SPI being locked. //| If the buffer is empty, nothing happens.""" //| ... @@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) { MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write); -//| def readinto(self, buf: bytearray) -> None: +//| def readinto(self, buf: Union[bytes, bytearray, memoryview]) -> None: //| """Read into the buffer specified by ``buf`` while writing zeroes. //| Requires the SPI being locked. //| If the number of bytes to read is 0, nothing happens.""" @@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto); -//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` //| must be equal. diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 7de9d5d4df..eb33a24594 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -164,7 +164,7 @@ STATIC mp_obj_t busio_i2c_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_try_lock_obj, busio_i2c_obj_try_lock); -//| def unlock(self, ) -> none: +//| def unlock(self, ) -> None: //| """Releases the I2C lock.""" //| ... //| @@ -176,7 +176,7 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: bytearray, *, start: int = 0, end: int = None, stop: bool = True) -> None: +//| def writeto(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address``. //| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be //| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and @@ -287,7 +287,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: bytearray, in_buffer: bytearray, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. From 522b17ca93d4e1d64bb113057c8a62992a22c4ab Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 13:25:07 -0400 Subject: [PATCH 076/277] Made suggested changes --- shared-bindings/aesio/aes.c | 4 ++-- shared-bindings/analogio/AnalogOut.c | 2 +- shared-bindings/audiobusio/I2SOut.c | 2 +- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/audiocore/WaveFile.c | 2 +- shared-bindings/audioio/AudioOut.c | 12 ++++++------ shared-bindings/audiomixer/MixerVoice.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 2 +- shared-bindings/bitbangio/I2C.c | 4 ++-- shared-bindings/bitbangio/SPI.c | 4 ++-- shared-bindings/busio/I2C.c | 4 ++-- shared-bindings/busio/SPI.c | 4 ++-- shared-bindings/busio/UART.c | 6 +++--- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index 4fa6ac6e8f..c8d4ee82ca 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, } } -//| def encrypt_into(src: Union[bytes, bytearray, memoryview], dest: Union[bytes, bytearray, memoryview]) -> None: +//| def encrypt_into(src: Union[bytearray, memoryview], dest: Union[bytearray, memoryview]) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the @@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); -//| def decrypt_into(src: Union[bytes, bytearray, memoryview], dest: Union[bytes, bytearray, memoryview]) -> None: +//| def decrypt_into(src: Union[bytearray, memoryview], dest: Union[bytearray, memoryview]) -> None: //| //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index 11957e8e9d..c8f7bc5d78 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__); -//| value: None = ... +//| value: int = ... //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only) //| //| Even if the underlying digital to analog converter (DAC) is lower diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index dd212cdb54..04fb8fa81c 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__); -//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixe.Mixer], *, loop: Any = False) -> None: +//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixe.Mixer], *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 7b2e04c34f..8c16a980f7 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__); -//| def record(self, destination: Union[bytes, bytearray, memoryview], destination_length: int) -> None: +//| def record(self, destination: Union[bytearray, memoryview], destination_length: int) -> None: //| """Records destination_length bytes of samples to destination. This is //| blocking. //| diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 7df169cc97..71ee78f781 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__); -//| sample_rate: Optional(int) = ... +//| sample_rate: Optional[int] = ... //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 25b3d01ffa..a500eb7c79 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -111,7 +111,7 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the AudioOut and releases any hardware resources for reuse.""" //| ... //| @@ -127,13 +127,13 @@ STATIC void check_for_deinit(audioio_audioout_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> AudioOut: +//| def __enter__(self) -> AudioOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -175,7 +175,7 @@ STATIC mp_obj_t audioio_audioout_obj_play(size_t n_args, const mp_obj_t *pos_arg } MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_play); -//| def stop(self, ) -> None: +//| def stop(self) -> None: //| """Stops playback and resets to the start of the sample.""" //| ... //| @@ -204,7 +204,7 @@ const mp_obj_property_t audioio_audioout_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def pause(self, ) -> None: +//| def pause(self) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... //| @@ -220,7 +220,7 @@ STATIC mp_obj_t audioio_audioout_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause); -//| def resume(self, ) -> None: +//| def resume(self) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... //| diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index eb0c399d5e..d1b0bcfcd1 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po } MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop); -//| level: None = ... +//| level: float = ... //| """The volume level of a voice, as a floating point number between 0 and 1.""" //| STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) { diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index d9ec490825..b790aecb51 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -37,7 +37,7 @@ //| class MP3: //| """Load a mp3 file for audio playback""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytes, bytearray, memoryview]): +//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytearray, memoryview]): //| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 37ed617703..b32cbe650e 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: Union[bytearray, memoryview], *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -277,7 +277,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 2e5a811cf0..8b69c04f23 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) { MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write); -//| def readinto(self, buf: Union[bytes, bytearray, memoryview]) -> None: +//| def readinto(self, buf: Union[bytearray, memoryview]) -> None: //| """Read into the buffer specified by ``buf`` while writing zeroes. //| Requires the SPI being locked. //| If the number of bytes to read is 0, nothing happens.""" @@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto); -//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` //| must be equal. diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index eb33a24594..0b4079d4f3 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -176,7 +176,7 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: Union[bytearray, memoryview], *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -287,7 +287,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 3d28adbcb5..12eccab95e 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock); -//| def write(self, buffer: bytes, *, start: int = 0, end: int = None) -> None: +//| def write(self, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None: //| """Write the data contained in ``buffer``. The SPI object must be locked. //| If the buffer is empty, nothing happens. //| @@ -314,7 +314,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto); -//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: int = 0, out_end: int = None, in_start: None = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The SPI object must be locked. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 133caee198..af0d4dbcd4 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -190,7 +190,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def readinto(self, buf: bytes) -> Optional[int]: +//| def readinto(self, buf: Union[bytearray, memoryview]) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` @@ -200,7 +200,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def readline(self, ) -> Optional[int]: +//| def readline(self, ) -> bytes: //| """Read a line, ending in a newline character. //| //| :return: the line read @@ -208,7 +208,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def write(self, buf: bytearray) -> Optional[int]: +//| def write(self, buf: Union[bytearray, memoryview]) -> Optional[int]: //| """Write the buffer of bytes to the bus. //| //| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string. From 54cb1feea04c0c93afe40868bc050ff7f645c61e Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 13:28:36 -0400 Subject: [PATCH 077/277] Removed all 'self, )' --- shared-bindings/_eve/__init__.c | 14 +++++++------- shared-bindings/_pixelbuf/PixelBuf.c | 2 +- shared-bindings/analogio/AnalogIn.c | 6 +++--- shared-bindings/analogio/AnalogOut.c | 6 +++--- shared-bindings/audiobusio/I2SOut.c | 12 ++++++------ shared-bindings/audiobusio/PDMIn.c | 6 +++--- shared-bindings/audiocore/RawSample.c | 6 +++--- shared-bindings/audiocore/WaveFile.c | 6 +++--- shared-bindings/audiomixer/Mixer.c | 6 +++--- shared-bindings/audiomixer/MixerVoice.c | 4 ++-- shared-bindings/audiomp3/MP3Decoder.c | 6 +++--- shared-bindings/audiopwmio/PWMAudioOut.c | 12 ++++++------ shared-bindings/bitbangio/I2C.c | 12 ++++++------ shared-bindings/bitbangio/OneWire.c | 10 +++++----- shared-bindings/bitbangio/SPI.c | 10 +++++----- shared-bindings/busio/I2C.c | 12 ++++++------ shared-bindings/busio/OneWire.c | 10 +++++----- shared-bindings/busio/SPI.c | 10 +++++----- shared-bindings/busio/UART.c | 10 +++++----- shared-bindings/digitalio/DigitalInOut.c | 4 ++-- shared-bindings/digitalio/Direction.c | 2 +- shared-bindings/digitalio/DriveMode.c | 2 +- shared-bindings/digitalio/Pull.c | 2 +- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/displayio/FourWire.c | 2 +- shared-bindings/displayio/Group.c | 2 +- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/displayio/Palette.c | 2 +- shared-bindings/displayio/ParallelBus.c | 2 +- shared-bindings/fontio/BuiltinFont.c | 4 ++-- shared-bindings/frequencyio/FrequencyIn.c | 12 ++++++------ shared-bindings/gamepad/GamePad.c | 4 ++-- shared-bindings/gamepadshift/GamePadShift.c | 4 ++-- shared-bindings/gnss/GNSS.c | 6 +++--- shared-bindings/gnss/PositionFix.c | 2 +- shared-bindings/gnss/SatelliteSystem.c | 2 +- shared-bindings/i2cperipheral/I2CPeripheral.c | 10 +++++----- shared-bindings/microcontroller/Pin.c | 2 +- shared-bindings/microcontroller/Processor.c | 2 +- shared-bindings/microcontroller/RunMode.c | 2 +- shared-bindings/nvm/ByteArray.c | 4 ++-- shared-bindings/ps2io/Ps2.c | 12 ++++++------ shared-bindings/pulseio/PWMOut.c | 6 +++--- shared-bindings/pulseio/PulseIn.c | 14 +++++++------- shared-bindings/pulseio/PulseOut.c | 6 +++--- shared-bindings/rgbmatrix/RGBMatrix.c | 2 +- shared-bindings/rotaryio/IncrementalEncoder.c | 6 +++--- shared-bindings/rtc/RTC.c | 2 +- shared-bindings/sdioio/SDCard.c | 4 ++-- shared-bindings/socket/__init__.c | 2 +- shared-bindings/supervisor/Runtime.c | 2 +- shared-bindings/touchio/TouchIn.c | 6 +++--- shared-bindings/usb_hid/Device.c | 2 +- shared-bindings/usb_midi/PortOut.c | 2 +- shared-bindings/watchdog/WatchDogMode.c | 2 +- shared-bindings/watchdog/WatchDogTimer.c | 2 +- 56 files changed, 153 insertions(+), 153 deletions(-) diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index 4fa48f2c75..8a329147b5 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -58,7 +58,7 @@ STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register); -//| def flush(self, ) -> Any: +//| def flush(self) -> Any: //| """Send any queued drawing commands directly to the hardware. //| //| :param int width: The width of the grid in tiles, or 1 for sprites.""" @@ -559,7 +559,7 @@ STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb); -//| def Display(self, ) -> Any: ... +//| def Display(self) -> Any: ... //| """End the display list""" //| @@ -570,7 +570,7 @@ STATIC mp_obj_t _display(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); -//| def End(self, ) -> Any: +//| def End(self) -> Any: //| """End drawing a graphics primitive //| //| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.""" @@ -628,7 +628,7 @@ STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro); -//| def Nop(self, ) -> Any: +//| def Nop(self) -> Any: //| """No operation""" //| ... //| @@ -672,7 +672,7 @@ STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); -//| def RestoreContext(self, ) -> Any: +//| def RestoreContext(self) -> Any: //| """Restore the current graphics context from the context stack""" //| ... //| @@ -684,7 +684,7 @@ STATIC mp_obj_t _restorecontext(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext); -//| def Return(self, ) -> Any: +//| def Return(self) -> Any: //| """Return from a previous call command""" //| ... //| @@ -696,7 +696,7 @@ STATIC mp_obj_t _return(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return); -//| def SaveContext(self, ) -> Any: +//| def SaveContext(self) -> Any: //| """Push the current graphics context on the context stack""" //| ... //| diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index c953951ea5..4c24776c3f 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -245,7 +245,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def show(self, ) -> Any: +//| def show(self) -> Any: //| """Transmits the color data to the pixels so that they are shown. This is done automatically //| when `auto_write` is True.""" //| ... diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index b41abc8478..e52d9b16be 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -70,7 +70,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Turn off the AnalogIn and release the pin for other use.""" //| ... //| @@ -86,13 +86,13 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> AnalogIn: +//| def __enter__(self) -> AnalogIn: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index c8f7bc5d78..9523b91a99 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -66,7 +66,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Turn off the AnalogOut and release the pin for other use.""" //| ... //| @@ -79,13 +79,13 @@ STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogout_deinit); -//| def __enter__(self, ) -> AnalogOut: +//| def __enter__(self) -> AnalogOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 04fb8fa81c..5d1c4f5957 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -112,7 +112,7 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the I2SOut and releases any hardware resources for reuse.""" //| ... //| @@ -128,13 +128,13 @@ STATIC void check_for_deinit(audiobusio_i2sout_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> I2SOut: +//| def __enter__(self) -> I2SOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -174,7 +174,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_play(size_t n_args, const mp_obj_t *pos_ar } MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_play); -//| def stop(self, ) -> None: +//| def stop(self) -> None: //| """Stops playback.""" //| ... //| @@ -203,7 +203,7 @@ const mp_obj_property_t audiobusio_i2sout_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def pause(self, ) -> None: +//| def pause(self) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... //| @@ -219,7 +219,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pause); -//| def resume(self, ) -> None: +//| def resume(self) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... //| diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 8c16a980f7..cfb19d7ce3 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -134,7 +134,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the PDMIn and releases any hardware resources for reuse.""" //| ... //| @@ -150,13 +150,13 @@ STATIC void check_for_deinit(audiobusio_pdmin_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> PDMIn: +//| def __enter__(self) -> PDMIn: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context.""" //| ... //| diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index dec029bf41..dc5cfd8200 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -101,7 +101,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the AudioOut and releases any hardware resources for reuse.""" //| ... //| @@ -118,13 +118,13 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) { } } -//| def __enter__(self, ) -> RawSample: +//| def __enter__(self) -> RawSample: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 71ee78f781..4eed5eaca5 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -91,7 +91,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the WaveFile and releases all memory resources for reuse.""" //| ... STATIC mp_obj_t audioio_wavefile_deinit(mp_obj_t self_in) { @@ -107,13 +107,13 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) { } } -//| def __enter__(self, ) -> WaveFile: +//| def __enter__(self) -> WaveFile: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index abd09790f8..dc08a11264 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -121,7 +121,7 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the Mixer and releases any hardware resources for reuse.""" //| ... //| @@ -138,13 +138,13 @@ STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) { } } -//| def __enter__(self, ) -> Mixer: +//| def __enter__(self) -> Mixer: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index d1b0bcfcd1..cb313e0fb1 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -42,7 +42,7 @@ //| //| Used to access and control samples with `audiomixer.Mixer`.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """MixerVoice instance object(s) created by `audiomixer.Mixer`.""" //| ... //| @@ -81,7 +81,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *po } MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play); -//| def stop(self, ) -> None: +//| def stop(self) -> None: //| """Stops playback of the sample on this voice.""" //| ... //| diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index b790aecb51..a4fd6e61f6 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -89,7 +89,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the MP3 and releases all memory resources for reuse.""" //| ... //| @@ -106,13 +106,13 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) { } } -//| def __enter__(self, ) -> MP3: +//| def __enter__(self) -> MP3: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index cb0b02fd66..b16538f174 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -114,7 +114,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_ return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse.""" //| ... //| @@ -130,13 +130,13 @@ STATIC void check_for_deinit(audiopwmio_pwmaudioout_obj_t *self) { raise_deinited_error(); } } -//| def __enter__(self, ) -> PWMAudioOut: +//| def __enter__(self) -> PWMAudioOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -177,7 +177,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_play(size_t n_args, const mp_obj_t *p } MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaudioout_obj_play); -//| def stop(self, ) -> None: +//| def stop(self) -> None: //| """Stops playback and resets to the start of the sample.""" //| ... //| @@ -206,7 +206,7 @@ const mp_obj_property_t audiopwmio_pwmaudioout_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def pause(self, ) -> None: +//| def pause(self) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... //| @@ -222,7 +222,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioout_obj_pause); -//| def resume(self, ) -> None: +//| def resume(self) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... //| diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index b32cbe650e..b10110430e 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -79,7 +79,7 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, return (mp_obj_t)self; } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... //| @@ -96,13 +96,13 @@ STATIC void check_for_deinit(bitbangio_i2c_obj_t *self) { } } -//| def __enter__(self, ) -> I2C: +//| def __enter__(self) -> I2C: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -120,7 +120,7 @@ static void check_lock(bitbangio_i2c_obj_t *self) { } } -//| def scan(self, ) -> list: +//| def scan(self) -> list: //| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of //| those that respond. A device responds if it pulls the SDA line low after //| its address (including a read bit) is sent on the bus.""" @@ -142,7 +142,7 @@ STATIC mp_obj_t bitbangio_i2c_scan(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_scan_obj, bitbangio_i2c_scan); -//| def try_lock(self, ) -> bool: +//| def try_lock(self) -> bool: //| """Attempts to grab the I2C lock. Returns True on success.""" //| ... //| @@ -153,7 +153,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_try_lock_obj, bitbangio_i2c_obj_try_lock); -//| def unlock(self, ) -> None: +//| def unlock(self) -> None: //| """Releases the I2C lock.""" //| ... //| diff --git a/shared-bindings/bitbangio/OneWire.c b/shared-bindings/bitbangio/OneWire.c index 898eb3ba6f..b9fce5e056 100644 --- a/shared-bindings/bitbangio/OneWire.c +++ b/shared-bindings/bitbangio/OneWire.c @@ -78,7 +78,7 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialize the OneWire bus and release any hardware resources for reuse.""" //| ... //| @@ -95,13 +95,13 @@ STATIC void check_for_deinit(bitbangio_onewire_obj_t *self) { } } -//| def __enter__(self, ) -> OneWire: +//| def __enter__(self) -> OneWire: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -113,7 +113,7 @@ STATIC mp_obj_t bitbangio_onewire_obj___exit__(size_t n_args, const mp_obj_t *ar } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_onewire___exit___obj, 4, 4, bitbangio_onewire_obj___exit__); -//| def reset(self, ) -> bool: +//| def reset(self) -> bool: //| """Reset the OneWire bus""" //| ... //| @@ -125,7 +125,7 @@ STATIC mp_obj_t bitbangio_onewire_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_onewire_reset_obj, bitbangio_onewire_obj_reset); -//| def read_bit(self, ) -> bool: +//| def read_bit(self) -> bool: //| """Read in a bit //| //| :returns: bit state read diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 8b69c04f23..597d8602be 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -90,7 +90,7 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args, return (mp_obj_t)self; } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Turn off the SPI bus.""" //| ... //| @@ -107,13 +107,13 @@ STATIC void check_for_deinit(bitbangio_spi_obj_t *self) { } } -//| def __enter__(self, ) -> SPI: +//| def __enter__(self) -> SPI: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -174,7 +174,7 @@ STATIC mp_obj_t bitbangio_spi_configure(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configure); -//| def try_lock(self, ) -> bool: +//| def try_lock(self) -> bool: //| """Attempts to grab the SPI lock. Returns True on success. //| //| :return: True when lock has been grabbed @@ -188,7 +188,7 @@ STATIC mp_obj_t bitbangio_spi_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_try_lock_obj, bitbangio_spi_obj_try_lock); -//| def unlock(self, ) -> None: +//| def unlock(self) -> None: //| """Releases the SPI lock.""" //| ... //| diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 0b4079d4f3..2b3497c422 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -83,7 +83,7 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con return (mp_obj_t)self; } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... //| @@ -100,13 +100,13 @@ STATIC void check_for_deinit(busio_i2c_obj_t *self) { } } -//| def __enter__(self, ) -> I2C: +//| def __enter__(self) -> I2C: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -125,7 +125,7 @@ static void check_lock(busio_i2c_obj_t *self) { } } -//| def scan(self, ) -> list: +//| def scan(self) -> list: //| //| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a //| list of those that respond. @@ -150,7 +150,7 @@ STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_scan_obj, busio_i2c_scan); -//| def try_lock(self, ) -> bool: +//| def try_lock(self) -> bool: //| """Attempts to grab the I2C lock. Returns True on success. //| //| :return: True when lock has been grabbed @@ -164,7 +164,7 @@ STATIC mp_obj_t busio_i2c_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_try_lock_obj, busio_i2c_obj_try_lock); -//| def unlock(self, ) -> None: +//| def unlock(self) -> None: //| """Releases the I2C lock.""" //| ... //| diff --git a/shared-bindings/busio/OneWire.c b/shared-bindings/busio/OneWire.c index 08a79daa9b..66f0fba3da 100644 --- a/shared-bindings/busio/OneWire.c +++ b/shared-bindings/busio/OneWire.c @@ -77,7 +77,7 @@ STATIC mp_obj_t busio_onewire_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialize the OneWire bus and release any hardware resources for reuse.""" //| ... //| @@ -94,13 +94,13 @@ STATIC void check_for_deinit(busio_onewire_obj_t *self) { } } -//| def __enter__(self, ) -> OneWire: +//| def __enter__(self) -> OneWire: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -112,7 +112,7 @@ STATIC mp_obj_t busio_onewire_obj___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_onewire___exit___obj, 4, 4, busio_onewire_obj___exit__); -//| def reset(self, ) -> bool: +//| def reset(self) -> bool: //| """Reset the OneWire bus and read presence //| //| :returns: False when at least one device is present @@ -127,7 +127,7 @@ STATIC mp_obj_t busio_onewire_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_onewire_reset_obj, busio_onewire_obj_reset); -//| def read_bit(self, ) -> bool: +//| def read_bit(self) -> bool: //| """Read in a bit //| //| :returns: bit state read diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 12eccab95e..e5b0da4a65 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -100,7 +100,7 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Turn off the SPI bus.""" //| ... //| @@ -111,13 +111,13 @@ STATIC mp_obj_t busio_spi_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit); -//| def __enter__(self, ) -> SPI: +//| def __enter__(self) -> SPI: //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... //| -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -201,7 +201,7 @@ STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_ } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure); -//| def try_lock(self, ) -> bool: +//| def try_lock(self) -> bool: //| """Attempts to grab the SPI lock. Returns True on success. //| //| :return: True when lock has been grabbed @@ -215,7 +215,7 @@ STATIC mp_obj_t busio_spi_obj_try_lock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock); -//| def unlock(self, ) -> None: +//| def unlock(self) -> None: //| """Releases the SPI lock.""" //| ... //| diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index af0d4dbcd4..2ce1467bbb 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -142,7 +142,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co return (mp_obj_t)self; } -//| def deinit(self, ) -> None: +//| def deinit(self) -> None: //| """Deinitialises the UART and releases any hardware resources for reuse.""" //| ... //| @@ -159,13 +159,13 @@ STATIC void check_for_deinit(busio_uart_obj_t *self) { } } -//| def __enter__(self, ) -> UART: +//| def __enter__(self) -> UART: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -200,7 +200,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def readline(self, ) -> bytes: +//| def readline(self) -> bytes: //| """Read a line, ending in a newline character. //| //| :return: the line read @@ -332,7 +332,7 @@ const mp_obj_property_t busio_uart_timeout_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def reset_input_buffer(self, ) -> None: +//| def reset_input_buffer(self) -> None: //| """Discard any unread characters in the input buffer.""" //| ... //| diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index eaf2c18101..21dc4dfed6 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -82,13 +82,13 @@ STATIC mp_obj_t digitalio_digitalinout_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(digitalio_digitalinout_deinit_obj, digitalio_digitalinout_obj_deinit); -//| def __enter__(self, ) -> DigitalInOut: +//| def __enter__(self) -> DigitalInOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> None: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/digitalio/Direction.c b/shared-bindings/digitalio/Direction.c index dbd0e93e47..56e2a281c4 100644 --- a/shared-bindings/digitalio/Direction.c +++ b/shared-bindings/digitalio/Direction.c @@ -41,7 +41,7 @@ //| class Direction: //| """Defines the direction of a digital pin""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define which direction the digital values are //| going.""" //| ... diff --git a/shared-bindings/digitalio/DriveMode.c b/shared-bindings/digitalio/DriveMode.c index 31b682d388..d1d962d341 100644 --- a/shared-bindings/digitalio/DriveMode.c +++ b/shared-bindings/digitalio/DriveMode.c @@ -29,7 +29,7 @@ //| class DriveMode: //| """Defines the drive mode of a digital pin""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define the drive mode used when outputting //| digital values.""" //| ... diff --git a/shared-bindings/digitalio/Pull.c b/shared-bindings/digitalio/Pull.c index 9aeec1f331..46d12bf882 100644 --- a/shared-bindings/digitalio/Pull.c +++ b/shared-bindings/digitalio/Pull.c @@ -29,7 +29,7 @@ //| class Pull: //| """Defines the pull of a digital input pin""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define the pull value, if any, used while reading //| digital values in.""" //| ... diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8b77e4df37..1bae0532a1 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -190,7 +190,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou } MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); -//| def refresh(self, ) -> Any: +//| def refresh(self) -> Any: //| """Refreshes the display immediately or raises an exception if too soon. Use //| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur.""" //| ... diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 5ee4ec5a9a..ad8656c0ee 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -96,7 +96,7 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ return self; } -//| def reset(self, ) -> Any: +//| def reset(self) -> Any: //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index b6f96883b9..9eb641f639 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -264,7 +264,7 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove); -//| def __len__(self, ) -> Any: +//| def __len__(self) -> Any: //| """Returns the number of layers in a Group""" //| ... //| diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 0cfac66720..a97c295212 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -76,7 +76,7 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t return self; } -//| def reset(self, ) -> Any: +//| def reset(self) -> Any: //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 37cfbd82e9..4823fdae2d 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -70,7 +70,7 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def __len__(self, ) -> Any: +//| def __len__(self) -> Any: //| """Returns the number of colors in a Palette""" //| ... //| diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index eb75ecc038..0fff2e5276 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -86,7 +86,7 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t return self; } -//| def reset(self, ) -> Any: +//| def reset(self) -> Any: //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index bf9a658739..169937553a 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -39,7 +39,7 @@ //| class BuiltinFont: //| """A font built into CircuitPython""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Creation not supported. Available fonts are defined when CircuitPython is built. See the //| `Adafruit_CircuitPython_Bitmap_Font `_ //| library for dynamically loaded fonts.""" @@ -64,7 +64,7 @@ const mp_obj_property_t fontio_builtinfont_bitmap_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def get_bounding_box(self, ) -> Any: +//| def get_bounding_box(self) -> Any: //| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height.""" //| ... //| diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 2d628088b7..cadcf7a26e 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -94,7 +94,7 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitialises the FrequencyIn and releases any hardware resources for reuse.""" //| ... //| @@ -111,13 +111,13 @@ STATIC void check_for_deinit(frequencyio_frequencyin_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -129,7 +129,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj___exit__(size_t n_args, const mp_obj } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(frequencyio_frequencyin___exit___obj, 4, 4, frequencyio_frequencyin_obj___exit__); -//| def pause(self, ) -> Any: +//| def pause(self) -> Any: //| """Pause frequency capture.""" //| ... //| @@ -142,7 +142,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_pause_obj, frequencyio_frequencyin_obj_pause); -//| def resume(self, ) -> Any: +//| def resume(self) -> Any: //| """Resumes frequency capture.""" //| ... //| @@ -155,7 +155,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_resume_obj, frequencyio_frequencyin_obj_resume); -//| def clear(self, ) -> Any: +//| def clear(self) -> Any: //| """Clears the last detected frequency capture value.""" //| ... //| diff --git a/shared-bindings/gamepad/GamePad.c b/shared-bindings/gamepad/GamePad.c index 9a23344b3c..5e035762e8 100644 --- a/shared-bindings/gamepad/GamePad.c +++ b/shared-bindings/gamepad/GamePad.c @@ -114,7 +114,7 @@ STATIC mp_obj_t gamepad_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(gamepad_singleton); } -//| def get_pressed(self, ) -> Any: +//| def get_pressed(self) -> Any: //| """Get the status of buttons pressed since the last call and clear it. //| //| Returns an 8-bit number, with bits that correspond to buttons, @@ -133,7 +133,7 @@ STATIC mp_obj_t gamepad_get_pressed(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(gamepad_get_pressed_obj, gamepad_get_pressed); -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Disable button scanning.""" //| ... //| diff --git a/shared-bindings/gamepadshift/GamePadShift.c b/shared-bindings/gamepadshift/GamePadShift.c index 854f092ada..782d9724dc 100644 --- a/shared-bindings/gamepadshift/GamePadShift.c +++ b/shared-bindings/gamepadshift/GamePadShift.c @@ -82,7 +82,7 @@ STATIC mp_obj_t gamepadshift_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(gamepad_singleton); } -//| def get_pressed(self, ) -> Any: +//| def get_pressed(self) -> Any: //| """Get the status of buttons pressed since the last call and clear it. //| //| Returns an 8-bit number, with bits that correspond to buttons, @@ -100,7 +100,7 @@ STATIC mp_obj_t gamepadshift_get_pressed(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(gamepadshift_get_pressed_obj, gamepadshift_get_pressed); -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Disable button scanning.""" //| ... //| diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 929e02ab81..59ec038dd1 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -53,7 +53,7 @@ //| print("Longitude: {0:.6f} degrees".format(nav.longitude))""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Turn on the GNSS. //| //| :param gnss.SatelliteSystem system: satellite system to use""" @@ -90,7 +90,7 @@ STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, const mp return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Turn off the GNSS.""" //| ... //| @@ -107,7 +107,7 @@ STATIC void check_for_deinit(gnss_obj_t *self) { } } -//| def update(self, ) -> Any: +//| def update(self) -> Any: //| """Update GNSS positioning information.""" //| ... //| diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 106a28c347..016603f049 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -29,7 +29,7 @@ //| class PositionFix: //| """Position fix mode""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define the position fix mode.""" //| //| INVALID: Any = ... diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index badc02b964..6d3fb4782d 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -29,7 +29,7 @@ //| class SatelliteSystem: //| """Satellite system type""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define the satellite system type.""" //| //| GPS: Any = ... diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c index 4a3900174a..696c3b3883 100644 --- a/shared-bindings/i2cperipheral/I2CPeripheral.c +++ b/shared-bindings/i2cperipheral/I2CPeripheral.c @@ -102,7 +102,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_make_new(const mp_obj_type_t *type, return (mp_obj_t)self; } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... //| @@ -114,13 +114,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit); -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -241,13 +241,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_make_new(const mp_obj_type_ return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3])); } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Close the request.""" //| ... //| diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index d5b971ae5e..f53949d85b 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -36,7 +36,7 @@ //| class Pin: //| """Identifies an IO pin on the microcontroller.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Identifies an IO pin on the microcontroller. They are fixed by the //| hardware so they cannot be constructed on demand. Instead, use //| `board` or `microcontroller.pin` to reference the desired pin.""" diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index c4b2491247..c3c60d5cc6 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -44,7 +44,7 @@ //| print(microcontroller.cpu.temperature)""" //| -//| def __init__(self, ): +//| def __init__(self): //| """You cannot create an instance of `microcontroller.Processor`. //| Use `microcontroller.cpu` to access the sole instance available.""" //| ... diff --git a/shared-bindings/microcontroller/RunMode.c b/shared-bindings/microcontroller/RunMode.c index 6db315d8d9..d4c10109a5 100644 --- a/shared-bindings/microcontroller/RunMode.c +++ b/shared-bindings/microcontroller/RunMode.c @@ -29,7 +29,7 @@ //| class RunMode: //| """run state of the microcontroller""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define the run mode of the microcontroller and //| CircuitPython.""" //| diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index 06d7d4c95b..3b316a33bc 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -44,12 +44,12 @@ //| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\"""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" //| ... //| -//| def __len__(self, ) -> Any: +//| def __len__(self) -> Any: //| """Return the length. This is used by (`len`)""" //| ... //| diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index a87b14ddd7..fd82591d5e 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -87,7 +87,7 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, con return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitialises the Ps2 and releases any hardware resources for reuse.""" //| ... //| @@ -104,13 +104,13 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -122,7 +122,7 @@ STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__); -//| def popleft(self, ) -> Any: +//| def popleft(self) -> Any: //| """Removes and returns the oldest received byte. When buffer //| is empty, raises an IndexError exception.""" //| ... @@ -164,7 +164,7 @@ STATIC mp_obj_t ps2io_ps2_obj_sendcmd(mp_obj_t self_in, mp_obj_t ob) { } MP_DEFINE_CONST_FUN_OBJ_2(ps2io_ps2_sendcmd_obj, ps2io_ps2_obj_sendcmd); -//| def clear_errors(self, ) -> Any: +//| def clear_errors(self) -> Any: //| """Returns and clears a bitmap with latest recorded communication errors. //| //| Reception errors (arise asynchronously, as data is received): @@ -202,7 +202,7 @@ STATIC mp_obj_t ps2io_ps2_obj_clear_errors(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_clear_errors_obj, ps2io_ps2_obj_clear_errors); -//| def __len__(self, ) -> Any: +//| def __len__(self) -> Any: //| """Returns the number of received bytes in buffer, available //| to :py:func:`popleft()`.""" //| ... diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index 7970c02f34..863365987f 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -115,7 +115,7 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitialises the PWMOut and releases any hardware resources for reuse.""" //| ... //| @@ -132,13 +132,13 @@ STATIC void check_for_deinit(pulseio_pwmout_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 5c52b25822..e187697077 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -96,7 +96,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitialises the PulseIn and releases any hardware resources for reuse.""" //| ... //| @@ -113,13 +113,13 @@ STATIC void check_for_deinit(pulseio_pulsein_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -131,7 +131,7 @@ STATIC mp_obj_t pulseio_pulsein_obj___exit__(size_t n_args, const mp_obj_t *args } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulsein___exit___obj, 4, 4, pulseio_pulsein_obj___exit__); -//| def pause(self, ) -> Any: +//| def pause(self) -> Any: //| """Pause pulse capture""" //| ... //| @@ -171,7 +171,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_resume(size_t n_args, const mp_obj_t *pos_ar } MP_DEFINE_CONST_FUN_OBJ_KW(pulseio_pulsein_resume_obj, 1, pulseio_pulsein_obj_resume); -//| def clear(self, ) -> Any: +//| def clear(self) -> Any: //| """Clears all captured pulses""" //| ... //| @@ -184,7 +184,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_clear(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear); -//| def popleft(self, ) -> Any: +//| def popleft(self) -> Any: //| """Removes and returns the oldest read pulse.""" //| ... //| @@ -234,7 +234,7 @@ const mp_obj_property_t pulseio_pulsein_paused_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __len__(self, ) -> Any: +//| def __len__(self) -> Any: //| """Returns the current pulse length //| //| This allows you to:: diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index 16b0a6f0cc..bfb3576a8d 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -81,7 +81,7 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitialises the PulseOut and releases any hardware resources for reuse.""" //| ... //| @@ -92,13 +92,13 @@ STATIC mp_obj_t pulseio_pulseout_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulseout_deinit_obj, pulseio_pulseout_deinit); -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index c833faa6e9..1bbd169654 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -237,7 +237,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Free the resources (pins, timers, etc.) associated with this //| rgbmatrix instance. After deinitialization, no further operations //| may be performed.""" diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 8b27238668..418de664ee 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -80,7 +80,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitializes the IncrementalEncoder and releases any hardware resources for reuse.""" //| ... //| @@ -97,13 +97,13 @@ STATIC void check_for_deinit(rotaryio_incrementalencoder_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index 58fe308f53..009256176b 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -41,7 +41,7 @@ const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}}; //| class RTC: //| """Real Time Clock""" //| -//| def __init__(self, ): +//| def __init__(self): //| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance.""" //| ... //| diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 77b41ce127..2feb7d8030 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -255,13 +255,13 @@ STATIC mp_obj_t sdioio_sdcard_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_deinit_obj, sdioio_sdcard_obj_deinit); -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... //| -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 19c4850cde..643a57b1bb 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -145,7 +145,7 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen); -//| def accept(self, ) -> Any: +//| def accept(self) -> Any: //| """Accept a connection on a listening socket of type SOCK_STREAM, //| creating a new socket of type SOCK_STREAM. //| Returns a tuple of (new_socket, remote_address)""" diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index a420d5b805..e0bd07600d 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -39,7 +39,7 @@ //| print("Hello World!")""" //| -//| def __init__(self, ): +//| def __init__(self): //| """You cannot create an instance of `supervisor.Runtime`. //| Use `supervisor.runtime` to access the sole instance available.""" //| ... diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 4c1d534eaa..0a9851cc59 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -73,7 +73,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type, return (mp_obj_t) self; } -//| def deinit(self, ) -> Any: +//| def deinit(self) -> Any: //| """Deinitialises the TouchIn and releases any hardware resources for reuse.""" //| ... //| @@ -90,13 +90,13 @@ STATIC void check_for_deinit(touchio_touchin_obj_t *self) { } } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> Any: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> Any: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index 8c0c364ff3..99b7b9db96 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -39,7 +39,7 @@ //| mouse.send_report()""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Not currently dynamically supported.""" //| ... //| diff --git a/shared-bindings/usb_midi/PortOut.c b/shared-bindings/usb_midi/PortOut.c index 14ed0e767e..b4afbc0362 100644 --- a/shared-bindings/usb_midi/PortOut.c +++ b/shared-bindings/usb_midi/PortOut.c @@ -38,7 +38,7 @@ //| class PortOut: //| """Sends midi messages to a computer over USB""" //| -//| def __init__(self, ): +//| def __init__(self): //| """You cannot create an instance of `usb_midi.PortOut`. //| //| PortOut objects are constructed for every corresponding entry in the USB diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index 369454c11b..293ee043d9 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -29,7 +29,7 @@ //| class WatchDogMode: //| """run state of the watchdog timer""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Enum-like class to define the run mode of the watchdog timer.""" //| //| RAISE: Any = ... diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index 52bda4c779..4a2aa00cdf 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -49,7 +49,7 @@ //| """ //| -//| def __init__(self, ): +//| def __init__(self): //| """Not currently dynamically supported. Access the sole instance through `microcontroller.watchdog`.""" //| ... //| From 26f1fd00719ef0c5dc904e9b6f03ad2a90e2abdc Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 14:11:25 -0400 Subject: [PATCH 078/277] Added type hints to _bleio --- shared-bindings/_bleio/Adapter.c | 26 ++++++++--------- shared-bindings/_bleio/Address.c | 20 ++++++------- shared-bindings/_bleio/Attribute.c | 16 +++++------ shared-bindings/_bleio/Characteristic.c | 28 +++++++++---------- shared-bindings/_bleio/CharacteristicBuffer.c | 12 ++++---- shared-bindings/_bleio/Connection.c | 16 +++++------ shared-bindings/_bleio/Descriptor.c | 8 +++--- shared-bindings/_bleio/PacketBuffer.c | 8 +++--- shared-bindings/_bleio/ScanEntry.c | 14 +++++----- shared-bindings/_bleio/ScanResults.c | 6 ++-- shared-bindings/_bleio/Service.c | 8 +++--- shared-bindings/_bleio/UUID.c | 12 ++++---- shared-bindings/_bleio/__init__.c | 8 +++--- 13 files changed, 91 insertions(+), 91 deletions(-) diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 13acb9d3cf..5aab9eca5b 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -65,13 +65,13 @@ //| connections and also initiate connections.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """You cannot create an instance of `_bleio.Adapter`. //| Use `_bleio.adapter` to access the sole instance available.""" //| ... //| -//| enabled: Any = ... +//| enabled: bool = ... //| """State of the BLE adapter.""" //| STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) { @@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| address: Any = ... +//| address: str = ... //| """MAC address of the BLE adapter. (read-only)""" //| STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) { @@ -111,7 +111,7 @@ const mp_obj_property_t bleio_adapter_address_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| name: Any = ... +//| name: str = ... //| """name of the BLE adapter used once connected. //| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``, //| to make it easy to distinguish multiple CircuitPython boards.""" @@ -135,7 +135,7 @@ const mp_obj_property_t bleio_adapter_name_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> Any: +//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None: //| """Starts advertising until `stop_advertising` is called or if connectable, another device //| connects to us. //| @@ -202,7 +202,7 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_advertising_obj, 2, bleio_adapter_start_advertising); -//| def stop_advertising(self, ) -> Any: +//| def stop_advertising(self) -> None: //| """Stop sending advertising packets.""" //| ... //| @@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising); -//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Any: +//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> iterable: //| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are //| filtered and returned separately. //| @@ -288,7 +288,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_scan_obj, 1, bleio_adapter_start_scan); -//| def stop_scan(self, ) -> Any: +//| def stop_scan(self) -> None: //| """Stop the current scan.""" //| ... //| @@ -301,7 +301,7 @@ STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan); -//| advertising: Any = ... +//| advertising: bool = ... //| """True when the adapter is currently advertising. (read-only)""" //| STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) { @@ -317,7 +317,7 @@ const mp_obj_property_t bleio_adapter_advertising_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| connected: Any = ... +//| connected: bool = ... //| """True when the adapter is connected to another device regardless of who initiated the //| connection. (read-only)""" //| @@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| connections: Any = ... +//| connections: tuple = ... //| """Tuple of active connections including those initiated through //| :py:meth:`_bleio.Adapter.connect`. (read-only)""" //| @@ -350,7 +350,7 @@ const mp_obj_property_t bleio_adapter_connections_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def connect(self, address: Address, *, timeout: float/int) -> Any: +//| def connect(self, address: Address, *, timeout: float/int) -> Adapter.connect: //| """Attempts a connection to the device with the given address. //| //| :param Address address: The address of the peripheral to connect to @@ -380,7 +380,7 @@ STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_connect_obj, 2, bleio_adapter_connect); -//| def erase_bonding(self, ) -> Any: +//| def erase_bonding(self) -> None: //| """Erase all bonding information stored in flash memory.""" //| ... //| diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 9beaff2ab2..87bae19cee 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -38,7 +38,7 @@ //| """Encapsulates the address of a BLE device.""" //| -//| def __init__(self, address: buf, address_type: Any): +//| def __init__(self, address: Union[bytes, bytearray, memoryview], address_type: int): //| """Create a new Address object encapsulating the address value. //| The value itself can be one of: //| @@ -77,8 +77,8 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| address_bytes: Any = ... -//| r"""The bytes that make up the device address (read-only). +//| address_bytes: bytes = ... +//| """The bytes that make up the device address (read-only). //| //| Note that the ``bytes`` object returned is in little-endian order: //| The least significant byte is ``address_bytes[0]``. So the address will @@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| type: Any = ... +//| type: int = ... //| """The address type (read-only). //| //| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`, @@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __eq__(self, other: Any) -> Any: +//| def __eq__(self, other: bytes) -> Optional[bool]: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... //| @@ -154,7 +154,7 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o } } -//| def __hash__(self, ) -> Any: +//| def __hash__(self) -> Optional[int]: //| """Returns a hash for the Address data.""" //| ... //| @@ -187,17 +187,17 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); } -//| PUBLIC: Any = ... +//| PUBLIC: bytes = ... //| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits).""" //| -//| RANDOM_STATIC: Any = ... +//| RANDOM_STATIC: int = ... //| """A randomly generated address that does not change often. It may never change or may change after //| a power cycle.""" //| -//| RANDOM_PRIVATE_RESOLVABLE: Any = ... +//| RANDOM_PRIVATE_RESOLVABLE: int = ... //| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK).""" //| -//| RANDOM_PRIVATE_NON_RESOLVABLE: Any = ... +//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ... //| """A randomly generated address that changes on every connection.""" //| STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = { diff --git a/shared-bindings/_bleio/Attribute.c b/shared-bindings/_bleio/Attribute.c index 6c47c87ba8..79f45da94d 100644 --- a/shared-bindings/_bleio/Attribute.c +++ b/shared-bindings/_bleio/Attribute.c @@ -36,32 +36,32 @@ //| :py:class:`~Characteristic` and :py:class:`~Descriptor`, //| but is not defined as a Python superclass of those classes.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """You cannot create an instance of :py:class:`~_bleio.Attribute`.""" //| ... //| STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = { -//| NO_ACCESS: Any = ... +//| NO_ACCESS: int = ... //| """security mode: access not allowed""" //| -//| OPEN: Any = ... +//| OPEN: int = ... //| """security_mode: no security (link is not encrypted)""" //| -//| ENCRYPT_NO_MITM: Any = ... +//| ENCRYPT_NO_MITM: int = ... //| """security_mode: unauthenticated encryption, without man-in-the-middle protection""" //| -//| ENCRYPT_WITH_MITM: Any = ... +//| ENCRYPT_WITH_MITM: int = ... //| """security_mode: authenticated encryption, with man-in-the-middle protection""" //| -//| LESC_ENCRYPT_WITH_MITM: Any = ... +//| LESC_ENCRYPT_WITH_MITM: int = ... //| """security_mode: LESC encryption, with man-in-the-middle protection""" //| -//| SIGNED_NO_MITM: Any = ... +//| SIGNED_NO_MITM: int = ... //| """security_mode: unauthenticated data signing, without man-in-the-middle protection""" //| -//| SIGNED_WITH_MITM: Any = ... +//| SIGNED_WITH_MITM: int = ... //| """security_mode: authenticated data signing, without man-in-the-middle protection""" //| { MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) }, diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 785b677d67..e4c81d8c27 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -37,7 +37,7 @@ //| """Stores information about a BLE service characteristic and allows reading //| and writing of the characteristic's value.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """There is no regular constructor for a Characteristic. A new local Characteristic can be created //| and attached to a Service by calling `add_to_service()`. //| Remote Characteristic objects are created by `Connection.discover_remote_services()` @@ -45,7 +45,7 @@ //| ... //| -//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Any: +//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Characteristic: //| """Create a new Characteristic object, and add it to this Service. //| //| :param Service service: The service that will provide this characteristic @@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj, -//| properties: Any = ... +//| properties: int = ... //| """An int bitmask representing which properties are set, specified as bitwise or'ing of //| of these possible values. //| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`.""" @@ -160,7 +160,7 @@ const mp_obj_property_t bleio_characteristic_properties_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| uuid: Any = ... +//| uuid: Optional[UUID] = ... //| """The UUID of this characteristic. (read-only) //| //| Will be ``None`` if the 128-bit UUID for this characteristic is not known.""" @@ -180,7 +180,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| value: Any = ... +//| value: bytearray = ... //| """The value of this characteristic.""" //| STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) { @@ -211,7 +211,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| descriptors: Any = ... +//| descriptors: Descriptor = ... //| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)""" //| STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) { @@ -241,7 +241,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| service: Any = ... +//| service: Service = ... //| """The Service this Characteristic is a part of.""" //| STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) { @@ -258,7 +258,7 @@ const mp_obj_property_t bleio_characteristic_service_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> Any: +//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None: //| """Set the remote characteristic's CCCD to enable or disable notification and indication. //| //| :param bool notify: True if Characteristic should receive notifications of remote writes @@ -291,22 +291,22 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) }, // Bitmask constants to represent properties -//| BROADCAST: Any = ... +//| BROADCAST: int = ... //| """property: allowed in advertising packets""" //| -//| INDICATE: Any = ... +//| INDICATE: int = ... //| """property: server will indicate to the client when the value is set and wait for a response""" //| -//| NOTIFY: Any = ... +//| NOTIFY: int = ... //| """property: server will notify the client when the value is set""" //| -//| READ: Any = ... +//| READ: int = ... //| """property: clients may read this characteristic""" //| -//| WRITE: Any = ... +//| WRITE: int = ... //| """property: clients may write this characteristic; a response will be sent back""" //| -//| WRITE_NO_RESPONSE: Any = ... +//| WRITE_NO_RESPONSE: int = ... //| """property: clients may write this characteristic; no response will be sent back""" //| { MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) }, diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 6cbd587c64..ee5a8ea332 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -100,7 +100,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) { // These are standard stream methods. Code is in py/stream.c. // -//| def read(self, nbytes: Any = None) -> Any: +//| def read(self, nbytes: int = None) -> Optional[bytes]: //| """Read characters. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended @@ -110,14 +110,14 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) { //| :rtype: bytes or None""" //| ... //| -//| def readinto(self, buf: Any) -> Any: +//| def readinto(self, buf: Union[bytearray, memoryview]) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` //| :rtype: int or None (on a non-blocking error)""" //| ... //| -//| def readline(self, ) -> Any: +//| def readline(self) -> bytes: //| """Read a line, ending in a newline character. //| //| :return: the line read @@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r return ret; } -//| in_waiting: Any = ... +//| in_waiting: int = ... //| """The number of bytes in the input buffer, available to be read""" //| STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) { @@ -184,7 +184,7 @@ const mp_obj_property_t bleio_characteristic_buffer_in_waiting_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def reset_input_buffer(self, ) -> Any: +//| def reset_input_buffer(self) -> None: //| """Discard any unread characters in the input buffer.""" //| ... //| @@ -196,7 +196,7 @@ STATIC mp_obj_t bleio_characteristic_buffer_obj_reset_input_buffer(mp_obj_t self } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_buffer_reset_input_buffer_obj, bleio_characteristic_buffer_obj_reset_input_buffer); -//| def deinit(self, ) -> Any: +//| def deinit(self) -> None: //| """Disable permanently.""" //| ... //| diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 0a96d8a111..64e2baefa3 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -68,13 +68,13 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) { } } -//| def __init__(self, ): +//| def __init__(self): //| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`. //| Connections may also be made when another device initiates a connection. To use a Connection //| created by a peer, read the `Adapter.connections` property. //| ... //| -//| def disconnect(self, ) -> Any: +//| def disconnect(self) -> Any: //| ""Disconnects from the remote peripheral. Does nothing if already disconnected.""" //| ... //| @@ -87,7 +87,7 @@ STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_disconnect_obj, bleio_connection_disconnect); -//| def pair(self, *, bond: Any = True) -> Any: +//| def pair(self, *, bond: bool = True) -> None: //| """Pair to the peer to improve security.""" //| ... //| @@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair); -//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Any: +//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Tuple(_bleio.Service, ...): //| """Do BLE discovery for all services or for the given service UUIDS, //| to find their handles and characteristics, and return the discovered services. //| `Connection.connected` must be True. @@ -152,7 +152,7 @@ STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, cons } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services); -//| connected: Any = ... +//| connected: bool = ... //| """True if connected to the remote peer.""" //| STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) { @@ -170,7 +170,7 @@ const mp_obj_property_t bleio_connection_connected_obj = { }; -//| paired: Any = ... +//| paired: bool = ... //| """True if paired to the remote peer.""" //| STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) { @@ -188,7 +188,7 @@ const mp_obj_property_t bleio_connection_paired_obj = { }; -//| connection_interval: Any = ... +//| connection_interval: float = ... //| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers //| increase speed and decrease latency but increase power consumption. //| @@ -206,7 +206,7 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval); -//| attribute: Any = ... +//| attribute: int = ... //| """The maximum number of data bytes that can be sent in a single transmission, //| not including overhead bytes. //| diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index 9d70208494..b478e85e12 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -39,7 +39,7 @@ //| Descriptors are attached to BLE characteristics and provide contextual //| information about the characteristic.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """There is no regular constructor for a Descriptor. A new local Descriptor can be created //| and attached to a Characteristic by calling `add_to_characteristic()`. //| Remote Descriptor objects are created by `Connection.discover_remote_services()` @@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic); STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj)); -//| uuid: Any = ... +//| uuid: UUID = ... //| """The descriptor uuid. (read-only)""" //| STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) { @@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| characteristic: Any = ... +//| characteristic: Characteristic = ... //| """The Characteristic this Descriptor is a part of.""" //| STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) { @@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| value: Any = ... +//| value: Union[bytearray, memoryview] = ... //| """The value of this descriptor.""" //| STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index 907bfabd27..a5b017312c 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -93,7 +93,7 @@ STATIC void check_for_deinit(bleio_packet_buffer_obj_t *self) { } } -//| def readinto(self, buf: Any) -> Any: +//| def readinto(self, buf: Union[bytearray, memoryview]) -> int: //| """Reads a single BLE packet into the ``buf``. Raises an exception if the next packet is longer //| than the given buffer. Use `packet_size` to read the maximum length of a single packet. //| @@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto); -//| def write(self, data: Any, *, header: Any = None) -> Any: +//| def write(self, data: bytes, *, header: bytes = None) -> int: //| """Writes all bytes from data into the same outgoing packet. The bytes from header are included //| before data when the pending packet is currently empty. //| @@ -169,7 +169,7 @@ STATIC mp_obj_t bleio_packet_buffer_write(mp_uint_t n_args, const mp_obj_t *pos_ } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_packet_buffer_write_obj, 1, bleio_packet_buffer_write); -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Disable permanently.""" //| ... STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) { @@ -184,7 +184,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_bu //| The name `packet_size` is deprecated and //| will be removed in CircuitPython 6.0.0.""" //| -//| incoming_packet_length: Any = ... +//| incoming_packet_length: int = ... //| """Maximum length in bytes of a packet we are reading.""" //| STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index 905bea81d2..f8d769cabe 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -41,11 +41,11 @@ //| it has no user-visible constructor.""" //| -//| def __init__(self, ): +//| def __init__(self): //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... //| -//| def matches(self, prefixes: Any, *, all: Any = True) -> Any: +//| def matches(self, prefixes: ScanEntry, *, all: bool = True) -> bool: //| """Returns True if the ScanEntry matches all prefixes when ``all`` is True. This is stricter //| than the scan filtering which accepts any advertisements that match any of the prefixes //| where all is False.""" @@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches); -//| address: Any = ... +//| address: _bleio.Address = ... //| """The address of the device (read-only), of type `_bleio.Address`.""" //| STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) { @@ -86,7 +86,7 @@ const mp_obj_property_t bleio_scanentry_address_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| advertisement_bytes: Any = ... +//| advertisement_bytes: bytes = ... //| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)""" //| STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) { @@ -102,7 +102,7 @@ const mp_obj_property_t bleio_scanentry_advertisement_bytes_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| rssi: Any = ... +//| rssi: int = ... //| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)""" //| STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) { @@ -118,7 +118,7 @@ const mp_obj_property_t bleio_scanentry_rssi_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| connectable: Any = ... +//| connectable: bool = ... //| """True if the device can be connected to. (read-only)""" //| STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) { @@ -134,7 +134,7 @@ const mp_obj_property_t bleio_scanentry_connectable_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| scan_response: Any = ... +//| scan_response: bool = ... //| """True if the entry was a scan response. (read-only)""" //| STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index 6077dcbdae..bc9d55c80f 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -46,15 +46,15 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { return MP_OBJ_STOP_ITERATION; } -//| def __init__(self, ): +//| def __init__(self): //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... //| -//| def __iter__(self, ) -> Any: +//| def __iter__(self) -> __iter__: //| """Returns itself since it is the iterator.""" //| ... //| -//| def __next__(self, ) -> Any: +//| def __next__(self) -> _bleio.ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still //| active. Raises `StopIteration` if scanning is finished and no other results are available.""" //| ... diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index 5ca7504f27..5cda11de4e 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(service); } -//| characteristics: Any = ... +//| characteristics: Tuple(Characteristic, ...) = ... //| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by //| this service. (read-only)""" //| @@ -92,7 +92,7 @@ const mp_obj_property_t bleio_service_characteristics_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| remote: Any = ... +//| remote: bool = ... //| """True if this is a service provided by a remote device. (read-only)""" //| STATIC mp_obj_t bleio_service_get_remote(mp_obj_t self_in) { @@ -109,7 +109,7 @@ const mp_obj_property_t bleio_service_remote_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| secondary: Any = ... +//| secondary: bool = ... //| """True if this is a secondary service. (read-only)""" //| STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) { @@ -126,7 +126,7 @@ const mp_obj_property_t bleio_service_secondary_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| uuid: Any = ... +//| uuid: Optional[UUID] = ... //| """The UUID of this service. (read-only) //| //| Will be ``None`` if the 128-bit UUID for this service is not known.""" diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index 78161b9566..a36cade6a0 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -36,7 +36,7 @@ //| class UUID: //| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more.""" //| -//| def __init__(self, value: Any): +//| def __init__(self, value: Union[int, typing.ByteString]): //| """Create a new UUID or UUID object encapsulating the uuid value. //| The value can be one of: //| @@ -120,7 +120,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, co return MP_OBJ_FROM_PTR(self); } -//| uuid16: Any = ... +//| uuid16: int = ... //| """The 16-bit part of the UUID. (read-only) //| //| :type: int""" @@ -139,7 +139,7 @@ const mp_obj_property_t bleio_uuid_uuid16_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| uuid128: Any = ... +//| uuid128: bytes = ... //| """The 128-bit value of the UUID //| Raises AttributeError if this is a 16-bit UUID. (read-only) //| @@ -165,7 +165,7 @@ const mp_obj_property_t bleio_uuid_uuid128_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| size: Any = ... +//| size: int = ... //| """128 if this UUID represents a 128-bit vendor-specific UUID. 16 if this UUID represents a //| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported. //| @@ -186,7 +186,7 @@ const mp_obj_property_t bleio_uuid_size_obj = { }; -//| def pack_into(self, buffer: Any, offset: Any = 0) -> Any: +//| def pack_into(self, buffer: Union[bytearray, memoryview], offset: int = 0) -> None: //| """Packs the UUID into the given buffer at the given offset.""" //| ... //| @@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __eq__(self, other: Any) -> Any: +//| def __eq__(self, other: UUID) -> Optional[bool]: //| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit.""" //| ... //| diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 90b185f79a..8778e94eda 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -60,7 +60,7 @@ //| class BluetoothError: -//| def __init__(self, Exception: Any): +//| def __init__(self, Exception: Exception): //| """Catch all exception for Bluetooth related errors.""" //| ... MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception) @@ -73,7 +73,7 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) nlr_raise(exception); } //| class ConnectionError: -//| def __init__(self, BluetoothError: Any): +//| def __init__(self, BluetoothError: _bleio.BluetoothError): //| """Raised when a connection is unavailable.""" //| ... //| @@ -87,7 +87,7 @@ NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ... } //| class RoleError: -//| def __init__(self, BluetoothError: Any): +//| def __init__(self, BluetoothError: _bleio.BluetoothError): //| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is //| attempted to be set but they can only be set when remote.""" //| ... @@ -97,7 +97,7 @@ NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) { mp_raise_msg(&mp_type_bleio_RoleError, msg); } //| class SecurityError: -//| def __init__(self, BluetoothError: Any): +//| def __init__(self, BluetoothError: _bleio.BluetoothError): //| """Raised when a security related error occurs.""" //| ... //| From 51fd286cbfc26ee36bef96445172c01744573279 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 14:14:05 -0400 Subject: [PATCH 079/277] Added type hints to board --- shared-bindings/board/__init__.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index 010a9fb92a..6837fc41c2 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -37,7 +37,7 @@ //| .. warning:: The board module varies by board. The APIs documented here may or may not be //| available on a specific board.""" -//| def I2C() -> Any: +//| def I2C() -> busio.I2C: //| """Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton.""" //| ... //| @@ -61,7 +61,7 @@ mp_obj_t board_i2c(void) { MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c); -//| def SPI() -> Any: +//| def SPI() -> busio.SPI: //| """Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a //| singleton.""" //| ... @@ -85,7 +85,7 @@ mp_obj_t board_spi(void) { #endif MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi); -//| def UART() -> Any: +//| def UART() -> busio.UART: //| """Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton. //| //| The object created uses the default parameter values for `busio.UART`. If you need to set From dd27fdfbe34a6d67e5019d211e96bc8cda3ee77d Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 14:15:43 -0400 Subject: [PATCH 080/277] Added type hints to countio --- shared-bindings/countio/Counter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index 8db795015d..64e8701b75 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -13,7 +13,7 @@ //| """Counter will keep track of the number of falling edge transistions (pulses) on a //| given pin""" //| -//| def __init__(self, pin_a): +//| def __init__(self, pin_a: microcontroller.Pin): //| """Create a Counter object associated with the given pin. It tracks the number of //| falling pulses relative when the object is constructed. //| From 4b66483757048be03c7d34fd07d2028693a629a3 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 2 Jul 2020 15:38:37 -0400 Subject: [PATCH 081/277] Update submodule, revert direction change --- ports/stm/common-hal/busio/SPI.c | 7 ++----- ports/stm/st_driver | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 380302da65..65eeb8ebcf 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -238,11 +238,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, self->handle.Instance = SPIx; self->handle.Init.Mode = SPI_MODE_MASTER; - // Implementing one-directional recieve-only SPI as per [RefMan RM0090:884] - // results in BSY bit related hangs. Using MOSI as an IO works fine without it, - // so it's unclear why this mode is present in the first place. - //self->handle.Init.Direction = (self->mosi == NULL) ? SPI_DIRECTION_2LINES_RXONLY : SPI_DIRECTION_2LINES; - self->handle.Init.Direction = SPI_DIRECTION_2LINES; + // Direction change only required for RX-only, see RefMan RM0090:884 + self->handle.Init.Direction = (self->mosi == NULL) ? SPI_DIRECTION_2LINES_RXONLY : SPI_DIRECTION_2LINES; self->handle.Init.DataSize = SPI_DATASIZE_8BIT; self->handle.Init.CLKPolarity = SPI_POLARITY_LOW; self->handle.Init.CLKPhase = SPI_PHASE_1EDGE; diff --git a/ports/stm/st_driver b/ports/stm/st_driver index 3fc2e0f3db..1900834751 160000 --- a/ports/stm/st_driver +++ b/ports/stm/st_driver @@ -1 +1 @@ -Subproject commit 3fc2e0f3db155b33177bb0705e0dd65cadb58412 +Subproject commit 1900834751fd6754457874b8c971690bab33e0a7 From 185a149da4cb13be12b905a25dcc4984fb636efe Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 2 Jul 2020 08:37:40 +0000 Subject: [PATCH 082/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (777 of 777 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 92cf0172d0..9c357e198a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-01 10:33-0500\n" -"PO-Revision-Date: 2020-07-02 02:02+0000\n" +"PO-Revision-Date: 2020-07-02 13:32+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -3405,7 +3405,7 @@ msgstr "tipo da saída incorreta" #: shared-module/displayio/Shape.c msgid "x value out of bounds" -msgstr "a valor x está fora dos limites" +msgstr "o valor x está fora dos limites" #: shared-bindings/displayio/Shape.c msgid "y should be an int" From 8f921cf138cc3059c7715f7cda03c99fd5a4db71 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 2 Jul 2020 20:28:32 +0200 Subject: [PATCH 083/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 12 +++++++++--- locale/cs.po | 12 +++++++++--- locale/de_DE.po | 12 +++++++++--- locale/es.po | 12 +++++++++--- locale/fil.po | 12 +++++++++--- locale/fr.po | 12 +++++++++--- locale/it_IT.po | 12 +++++++++--- locale/ko.po | 12 +++++++++--- locale/nl.po | 12 +++++++++--- locale/pl.po | 12 +++++++++--- locale/pt_BR.po | 12 +++++++++--- locale/sv.po | 12 +++++++++--- locale/zh_Latn_pinyin.po | 12 +++++++++--- 13 files changed, 117 insertions(+), 39 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index da4f7b904b..44d3bfde29 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -429,7 +429,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -599,6 +600,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Tidak dapat menginisialisasi UART" @@ -993,7 +998,8 @@ msgstr "Pin untuk channel kanan tidak valid" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/cs.po b/locale/cs.po index 9029985397..dfe1cfa384 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -433,7 +433,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -597,6 +598,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "" @@ -990,7 +995,8 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/de_DE.po b/locale/de_DE.po index 3b7c49b396..f2d9258566 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -436,7 +436,8 @@ msgstr "Der Puffer ist zu klein" msgid "Buffer length %d too big. It must be less than %d" msgstr "Die Pufferlänge %d ist zu groß. Sie muss kleiner als %d sein" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -607,6 +608,10 @@ msgstr "Beschädigter raw code" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Konnte UART nicht initialisieren" @@ -1007,7 +1012,8 @@ msgstr "Ungültiger Pin für rechten Kanal" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/es.po b/locale/es.po index 9034024068..423d673617 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-06-29 13:13+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -438,7 +438,8 @@ msgstr "El buffer es muy pequeño" msgid "Buffer length %d too big. It must be less than %d" msgstr "La longitud del buffer %d es muy grande. Debe ser menor a %d" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -606,6 +607,10 @@ msgstr "Código crudo corrupto" msgid "Could not initialize GNSS" msgstr "No se pudo inicializar el GNSS" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "No se puede inicializar la UART" @@ -1002,7 +1007,8 @@ msgstr "Pin inválido para canal derecho" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/fil.po b/locale/fil.po index ff5cc6426d..3489316130 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -431,7 +431,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -598,6 +599,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Hindi ma-initialize ang UART" @@ -998,7 +1003,8 @@ msgstr "Mali ang pin para sa kanang channel" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/fr.po b/locale/fr.po index 7facdef043..2db7f47222 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" @@ -441,7 +441,8 @@ msgstr "Le tampon est trop petit" msgid "Buffer length %d too big. It must be less than %d" msgstr "La longueur du tampon %d est trop grande. Il doit être inférieur à %d" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -614,6 +615,10 @@ msgstr "Code brut corrompu" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "L'UART n'a pu être initialisé" @@ -1011,7 +1016,8 @@ msgstr "Broche invalide pour le canal droit" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/it_IT.po b/locale/it_IT.po index 983b47b824..bd49e2388b 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -431,7 +431,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -599,6 +600,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Impossibile inizializzare l'UART" @@ -1000,7 +1005,8 @@ msgstr "Pin non valido per il canale destro" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/ko.po b/locale/ko.po index ea3f564700..4bd56cde1e 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -429,7 +429,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -593,6 +594,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "" @@ -986,7 +991,8 @@ msgstr "오른쪽 채널 핀이 잘못되었습니다" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/nl.po b/locale/nl.po index 12a767b183..8306aa7797 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-06-02 19:50+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -435,7 +435,8 @@ msgstr "Buffer is te klein" msgid "Buffer length %d too big. It must be less than %d" msgstr "Buffer lengte %d te groot. Het moet kleiner zijn dan %d" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -605,6 +606,10 @@ msgstr "Corrupt raw code" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Kan UART niet initialiseren" @@ -1002,7 +1007,8 @@ msgstr "Ongeldige pin voor rechter kanaal" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/pl.po b/locale/pl.po index d626e8ebcf..7724481314 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -428,7 +428,8 @@ msgstr "" msgid "Buffer length %d too big. It must be less than %d" msgstr "" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -592,6 +593,10 @@ msgstr "" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Ustawienie UART nie powiodło się" @@ -987,7 +992,8 @@ msgstr "Zła nóżka dla prawego kanału" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 9c357e198a..99e59304c8 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-07-02 13:32+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -441,7 +441,8 @@ msgstr "O buffer é muito pequeno" msgid "Buffer length %d too big. It must be less than %d" msgstr "O tamanho do buffer %d é muito grande. Deve ser menor que %d" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "O comprimento do Buffer deve ser um múltiplo de 512" @@ -612,6 +613,10 @@ msgstr "Código bruto corrompido" msgid "Could not initialize GNSS" msgstr "Não foi possível inicializar o GNSS" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Não foi possível inicializar o UART" @@ -1009,7 +1014,8 @@ msgstr "Pino inválido para canal direito" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/sv.po b/locale/sv.po index f359eba275..3ec91c19ee 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2020-06-03 18:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -435,7 +435,8 @@ msgstr "Bufferten är för liten" msgid "Buffer length %d too big. It must be less than %d" msgstr "Buffertlängd %d för stor. Den måste vara mindre än %d" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -605,6 +606,10 @@ msgstr "Korrupt rå kod" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Det gick inte att initiera UART" @@ -1000,7 +1005,8 @@ msgstr "Ogiltig pinne för höger kanal" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index bc9a7253b9..db41adb536 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-01 10:33-0500\n" +"POT-Creation-Date: 2020-07-02 15:29+0200\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -434,7 +434,8 @@ msgstr "Huǎnchōng qū tài xiǎo" msgid "Buffer length %d too big. It must be less than %d" msgstr "Huǎnchōng qū chángdù%d tài dà. Tā bìxū xiǎoyú%d" -#: ports/atmel-samd/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c +#: 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 "" @@ -600,6 +601,10 @@ msgstr "Sǔnhuài de yuánshǐ dàimǎ" msgid "Could not initialize GNSS" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "Could not initialize SDCard" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" msgstr "Wúfǎ chūshǐhuà UART" @@ -995,7 +1000,8 @@ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/mimxrt10xx/common-hal/busio/I2C.c +#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c +#: ports/mimxrt10xx/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c msgid "Invalid pins" From 35e35e61d3016d83f1e528bf3e7947fa24f995f0 Mon Sep 17 00:00:00 2001 From: _fonzlate Date: Thu, 2 Jul 2020 20:06:04 +0000 Subject: [PATCH 084/277] Translated using Weblate (Dutch) Currently translated at 100.0% (778 of 778 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index 8306aa7797..34e9c835a2 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-02 15:29+0200\n" -"PO-Revision-Date: 2020-06-02 19:50+0000\n" +"PO-Revision-Date: 2020-07-02 20:42+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" "Language: nl\n" @@ -16,7 +16,7 @@ msgstr "" "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.1-dev\n" +"X-Generator: Weblate 4.2-dev\n" #: main.c msgid "" @@ -68,7 +68,7 @@ msgstr "%d adres pins en %d RGB pins geven een hoogte van %d aan, niet %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q fout: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -99,7 +99,7 @@ msgstr "%q moet een tuple van lengte 2 zijn" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q pin invalid" -msgstr "" +msgstr "%q pin onjuist" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -438,7 +438,7 @@ msgstr "Buffer lengte %d te groot. Het moet kleiner zijn dan %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 "Buffer lengte moet een veelvoud van 512 zijn" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" @@ -604,11 +604,11 @@ msgstr "Corrupt raw code" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" -msgstr "" +msgstr "Kan GNSS niet initialiseren" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" -msgstr "" +msgstr "Kan SDCard niet initialiseren" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" @@ -898,7 +898,7 @@ msgstr "Interne fout #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "Ongeldige %q" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1417,7 +1417,7 @@ msgstr "Draaiende in veilige modus! Opgeslagen code wordt niet uitgevoerd.\n" #: shared-module/sdcardio/SDCard.c msgid "SD card CSD format not supported" -msgstr "" +msgstr "SD kaart CSD formaat niet ondersteund" #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c @@ -1489,7 +1489,7 @@ msgstr "Geef op zijn minst 1 UART pin op" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" -msgstr "" +msgstr "Systeem invoer moet gnss.SatelliteSystem zijn" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" @@ -2062,7 +2062,7 @@ msgstr "kan geen niet-'None' waarde naar een net gestartte generator sturen" #: shared-module/sdcardio/SDCard.c msgid "can't set 512 block size" -msgstr "" +msgstr "kan geen 512 blokgrootte instellen" #: py/objnamedtuple.c msgid "can't set attribute" @@ -2193,7 +2193,7 @@ msgstr "kon de Vandermonde matrix niet omkeren" #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" -msgstr "" +msgstr "kon SD kaart versie niet bepalen" #: extmod/ulab/code/approx.c msgid "data must be iterable" @@ -2760,7 +2760,7 @@ msgstr "negatieve verschuivingstelling (shift count)" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "" +msgstr "geen SD kaart" #: py/vm.c msgid "no active exception to reraise" @@ -2785,7 +2785,7 @@ msgstr "geen reset pin beschikbaar" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "" +msgstr "geen antwoord van SD kaart" #: py/runtime.c msgid "no such attribute" @@ -3081,7 +3081,7 @@ msgstr "de slaapduur mag niet negatief zijn" #: extmod/ulab/code/ndarray.c msgid "slice step can't be zero" -msgstr "" +msgstr "segmentstap mag niet nul zijn" #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" @@ -3101,15 +3101,15 @@ msgstr "sorteerargument moet een ndarray zijn" #: extmod/ulab/code/filter.c msgid "sos array must be of shape (n_section, 6)" -msgstr "" +msgstr "sos array moet vorm (n_section, 6) hebben" #: extmod/ulab/code/filter.c msgid "sos[:, 3] should be all ones" -msgstr "" +msgstr "sos[:, 3] moeten allemaal 1 zijn" #: extmod/ulab/code/filter.c msgid "sosfilt requires iterable arguments" -msgstr "" +msgstr "sosfilt vereist itereerbare argumenten" #: py/objstr.c msgid "start/end indices" @@ -3198,11 +3198,11 @@ msgstr "timeout moet groter dan 0.0 zijn" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "" +msgstr "timeout bij wachten op v1 kaart" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "" +msgstr "timeout bij wachten op v2 kaart" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" @@ -3403,15 +3403,15 @@ msgstr "nul-stap" #: extmod/ulab/code/filter.c msgid "zi must be an ndarray" -msgstr "" +msgstr "zi moet een ndarray zijn" #: extmod/ulab/code/filter.c msgid "zi must be of float type" -msgstr "" +msgstr "zi moet van type float zijn" #: extmod/ulab/code/filter.c msgid "zi must be of shape (n_section, 2)" -msgstr "" +msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "I2C operation not supported" #~ msgstr "I2C actie niet ondersteund" From fce35c34819845521ed18b9a3cebbc08f8cb00cc Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 2 Jul 2020 22:57:58 +0200 Subject: [PATCH 085/277] Fluff M0: additional pins on version 1.3 of the board --- ports/atmel-samd/boards/fluff_m0/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/fluff_m0/pins.c b/ports/atmel-samd/boards/fluff_m0/pins.c index d80d46b895..ac7811328b 100644 --- a/ports/atmel-samd/boards/fluff_m0/pins.c +++ b/ports/atmel-samd/boards/fluff_m0/pins.c @@ -30,6 +30,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA28) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 9b4ffc05710873e69bfeed209d0f7ebd8fb2f259 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 17:47:52 -0400 Subject: [PATCH 086/277] Changed unions to ReadableBuffer and WriteableBuffer --- shared-bindings/_bleio/Address.c | 2 +- shared-bindings/_bleio/CharacteristicBuffer.c | 2 +- shared-bindings/_bleio/Descriptor.c | 2 +- shared-bindings/_bleio/PacketBuffer.c | 2 +- shared-bindings/_bleio/UUID.c | 2 +- shared-bindings/aesio/aes.c | 6 +++--- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/audiocore/WaveFile.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 2 +- shared-bindings/bitbangio/I2C.c | 6 +++--- shared-bindings/bitbangio/SPI.c | 6 +++--- shared-bindings/busio/I2C.c | 6 +++--- shared-bindings/busio/SPI.c | 4 ++-- shared-bindings/busio/UART.c | 4 ++-- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 87bae19cee..06fb58d76a 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -38,7 +38,7 @@ //| """Encapsulates the address of a BLE device.""" //| -//| def __init__(self, address: Union[bytes, bytearray, memoryview], address_type: int): +//| def __init__(self, address: ReadableBuffer, address_type: int): //| """Create a new Address object encapsulating the address value. //| The value itself can be one of: //| diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index ee5a8ea332..efe27e5d2a 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -110,7 +110,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) { //| :rtype: bytes or None""" //| ... //| -//| def readinto(self, buf: Union[bytearray, memoryview]) -> Optional[int]: +//| def readinto(self, buf: WriteableBuffer) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index b478e85e12..6382221a16 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| value: Union[bytearray, memoryview] = ... +//| value: WriteableBuffer = ... //| """The value of this descriptor.""" //| STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index a5b017312c..7645a25aaa 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -93,7 +93,7 @@ STATIC void check_for_deinit(bleio_packet_buffer_obj_t *self) { } } -//| def readinto(self, buf: Union[bytearray, memoryview]) -> int: +//| def readinto(self, buf: WriteableBuffer) -> int: //| """Reads a single BLE packet into the ``buf``. Raises an exception if the next packet is longer //| than the given buffer. Use `packet_size` to read the maximum length of a single packet. //| diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index a36cade6a0..823275f900 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -186,7 +186,7 @@ const mp_obj_property_t bleio_uuid_size_obj = { }; -//| def pack_into(self, buffer: Union[bytearray, memoryview], offset: int = 0) -> None: +//| def pack_into(self, buffer: WriteableBuffer, offset: int = 0) -> None: //| """Packs the UUID into the given buffer at the given offset.""" //| ... //| diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index c8d4ee82ca..df6d0c5676 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -12,7 +12,7 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key: Union[bytes, bytearray, memoryview], mode: int=0, iv: Union[bytes, bytearray, memoryview]=None, segment_size: int=8) -> AES: +//| def __init__(self, key: ReadableBuffer, mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> AES: //| """Create a new AES state with the given key. //| //| :param bytearray key: A 16-, 24-, or 32-byte key @@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, } } -//| def encrypt_into(src: Union[bytearray, memoryview], dest: Union[bytearray, memoryview]) -> None: +//| def encrypt_into(src: WriteableBuffer, dest: WriteableBuffer) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the @@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); -//| def decrypt_into(src: Union[bytearray, memoryview], dest: Union[bytearray, memoryview]) -> None: +//| def decrypt_into(src: WriteableBuffer, dest: WriteableBuffer) -> None: //| //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index cfb19d7ce3..329c7bde53 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__); -//| def record(self, destination: Union[bytearray, memoryview], destination_length: int) -> None: +//| def record(self, destination: WriteableBuffer, destination_length: int) -> None: //| """Records destination_length bytes of samples to destination. This is //| blocking. //| diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 4eed5eaca5..838447f2e1 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -40,7 +40,7 @@ //| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating //| an internal buffer.""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytes, bytearray, memoryview]): +//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer): //| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param typing.BinaryIO file: Already opened wave file diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index a4fd6e61f6..68c27169ff 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -37,7 +37,7 @@ //| class MP3: //| """Load a mp3 file for audio playback""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytearray, memoryview]): +//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer): //| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index b10110430e..710275b2f6 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: Union[bytearray, memoryview], *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None, stop: bool = True) -> None: +//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a //| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start //| before a read. @@ -277,7 +277,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 597d8602be..90483e3ebf 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -200,7 +200,7 @@ STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock); -//| def write(self, buf: Union[bytes, bytearray, memoryview]) -> None: +//| def write(self, buf: ReadableBuffer) -> None: //| """Write the data contained in ``buf``. Requires the SPI being locked. //| If the buffer is empty, nothing happens.""" //| ... @@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) { MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write); -//| def readinto(self, buf: Union[bytearray, memoryview]) -> None: +//| def readinto(self, buf: WriteableBuffer) -> None: //| """Read into the buffer specified by ``buf`` while writing zeroes. //| Requires the SPI being locked. //| If the number of bytes to read is 0, nothing happens.""" @@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto); -//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` //| must be equal. diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 2b3497c422..cf38fdce60 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -176,7 +176,7 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: Union[bytearray, memoryview], *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None, stop: bool = True) -> None: +//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address``. //| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be //| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and @@ -287,7 +287,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index e5b0da4a65..38c1bcc0e7 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock); -//| def write(self, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None: +//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: int = None) -> None: //| """Write the data contained in ``buffer``. The SPI object must be locked. //| If the buffer is empty, nothing happens. //| @@ -314,7 +314,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto); -//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The SPI object must be locked. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 2ce1467bbb..fd51d5d3b6 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -190,7 +190,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def readinto(self, buf: Union[bytearray, memoryview]) -> Optional[int]: +//| def readinto(self, buf: WriteableBuffer) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` @@ -208,7 +208,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| ... //| -//| def write(self, buf: Union[bytearray, memoryview]) -> Optional[int]: +//| def write(self, buf: WriteableBuffer) -> Optional[int]: //| """Write the buffer of bytes to the bus. //| //| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string. From 70fdde4aaaa6c1c8fd54c0463d405dfbf8794b10 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 2 Jul 2020 15:11:40 -0700 Subject: [PATCH 087/277] Remove trailing space --- shared-bindings/busio/UART.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 25cf5f480a..a9619a8e0b 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -202,7 +202,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| def readline(self, ) -> Any: //| """Read a line, ending in a newline character, or //| return None if a timeout occurs sooner, or -//| return everything readable if no newline is found and timeout=0 +//| return everything readable if no newline is found and timeout=0 //| //| :return: the line read //| :rtype: bytes or None""" From 783cc4de398aba060eb69971c4aaf3453ee43500 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:05:14 -0400 Subject: [PATCH 088/277] Added type hints to displayio --- shared-bindings/displayio/Bitmap.c | 10 ++++----- shared-bindings/displayio/ColorConverter.c | 4 ++-- shared-bindings/displayio/Display.c | 22 +++++++++--------- shared-bindings/displayio/EPaperDisplay.c | 14 ++++++------ shared-bindings/displayio/FourWire.c | 4 ++-- shared-bindings/displayio/Group.c | 26 +++++++++++----------- shared-bindings/displayio/I2CDisplay.c | 4 ++-- shared-bindings/displayio/OnDiskBitmap.c | 4 ++-- shared-bindings/displayio/Palette.c | 8 +++---- shared-bindings/displayio/ParallelBus.c | 4 ++-- shared-bindings/displayio/Shape.c | 2 +- shared-bindings/displayio/TileGrid.c | 18 +++++++-------- 12 files changed, 60 insertions(+), 60 deletions(-) diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index a52840f2e0..9677b51f62 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -73,7 +73,7 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| width: Any = ... +//| width: int = ... //| """Width of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_bitmap_obj_get_width(mp_obj_t self_in) { @@ -91,7 +91,7 @@ const mp_obj_property_t displayio_bitmap_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: Any = ... +//| height: int = ... //| """Height of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) { @@ -109,7 +109,7 @@ const mp_obj_property_t displayio_bitmap_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: Union[Tuple[int, int], int]) -> int: //| """Returns the value at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. //| @@ -118,7 +118,7 @@ const mp_obj_property_t displayio_bitmap_height_obj = { //| print(bitmap[0,1])""" //| ... //| -//| def __setitem__(self, index: Any, value: Any) -> Any: +//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None: //| """Sets the value at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. //| @@ -172,7 +172,7 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val return mp_const_none; } -//| def fill(self, value: Any) -> Any: +//| def fill(self, value: int) -> None: //| """Fills the bitmap with the supplied palette index value.""" //| ... //| diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 33d0bdd3cb..6126c4194d 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -65,7 +65,7 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz return MP_OBJ_FROM_PTR(self); } -//| def convert(self, color: Any) -> Any: +//| def convert(self, color: int) -> int: //| """Converts the given RGB888 color to RGB565""" //| ... //| @@ -84,7 +84,7 @@ STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t } MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert); -//| dither: Any = ... +//| dither: bool = ... //| """When true the color converter dithers the output by adding random noise when //| truncating to display bitdepth""" //| diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 6e454f34bd..c3ddc6c140 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum.""" //| -//| def __init__(self, display_bus: Any, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: microcontroller.Pin = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60): +//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: microcontroller.Pin = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60): //| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a @@ -188,7 +188,7 @@ static displayio_display_obj_t* native_display(mp_obj_t display_obj) { return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: Group) -> Any: +//| def show(self, group: Group) -> None: //| """Switches to displaying the given group of layers. When group is None, the default //| CircuitPython terminal will be shown. //| @@ -210,7 +210,7 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) } MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); -//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> Any: +//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> bool: //| """When auto refresh is off, waits for the target frame rate and then refreshes the display, //| returning True. If the call has taken too long since the last refresh call for the given //| target frame rate, then the refresh returns False immediately without updating the screen to @@ -245,7 +245,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos } MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh); -//| auto_refresh: Any = ... +//| auto_refresh: None = ... //| """True when the display is refreshed automatically.""" //| STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) { @@ -270,7 +270,7 @@ const mp_obj_property_t displayio_display_auto_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| brightness: Any = ... +//| brightness: float = ... //| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When //| `auto_brightness` is True, the value of `brightness` will change automatically. //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" @@ -307,7 +307,7 @@ const mp_obj_property_t displayio_display_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_brightness: Any = ... +//| auto_brightness: Optional[bool] = ... //| """True when the display brightness is adjusted automatically, based on an ambient //| light sensor or other method. Note that some displays may have this set to True by default, //| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False @@ -338,7 +338,7 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = { -//| width: Any = ... +//| width: int = ... //| Gets the width of the board //| //| @@ -355,7 +355,7 @@ const mp_obj_property_t displayio_display_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: Any = ... +//| height: int = ... //| """Gets the height of the board""" //| //| @@ -372,7 +372,7 @@ const mp_obj_property_t displayio_display_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rotation: Any = ... +//| rotation: Optional[int] = ... //| """The rotation of the display as an int in degrees.""" //| STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) { @@ -395,7 +395,7 @@ const mp_obj_property_t displayio_display_rotation_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bus: Any = ... +//| bus: displayio = ... //| """The bus being used by the display""" //| //| @@ -413,7 +413,7 @@ const mp_obj_property_t displayio_display_bus_obj = { }; -//| def fill_row(self, y: int, buffer: bytearray) -> Any: +//| def fill_row(self, y: int, buffer: WriteableBuffer) -> bytearray: //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 1bae0532a1..e5768572ea 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: Any, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: int = None, set_row_window_command: int = None, single_byte_bounds: Any = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: int = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: microcontroller.Pin = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False): +//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: int = None, set_row_window_command: int = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: int = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: microcontroller.Pin = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False): //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every @@ -168,7 +168,7 @@ static displayio_epaperdisplay_obj_t* native_display(mp_obj_t display_obj) { return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: Group) -> Any: +//| def show(self, group: Group) -> None: //| """Switches to displaying the given group of layers. When group is None, the default //| CircuitPython terminal will be shown. //| @@ -190,7 +190,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou } MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); -//| def refresh(self) -> Any: +//| def refresh(self) -> None: //| """Refreshes the display immediately or raises an exception if too soon. Use //| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur.""" //| ... @@ -205,7 +205,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh); -//| time_to_refresh: Any = ... +//| time_to_refresh: float = ... //| """Time, in fractional seconds, until the ePaper display can be refreshed.""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) { @@ -221,7 +221,7 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| width: Any = ... +//| width: int = ... //| """Gets the width of the display in pixels""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) { @@ -237,7 +237,7 @@ const mp_obj_property_t displayio_epaperdisplay_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: Any = ... +//| height: int = ... //| """Gets the height of the display in pixels""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) { @@ -253,7 +253,7 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bus: Any = ... +//| bus: displayio = ... //| """The bus being used by the display""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index ad8656c0ee..7e53249244 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -96,7 +96,7 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ return self; } -//| def reset(self) -> Any: +//| def reset(self) -> None: //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... @@ -111,7 +111,7 @@ STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset); -//| def send(self, command: Any, data: Any, *, toggle_every_byte: Any = False) -> Any: +//| def send(self, command: int, data: FourWire, *, toggle_every_byte: bool = False) -> None: //| """Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done.""" //| ... diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 9eb641f639..d81bf5fdb0 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -86,7 +86,7 @@ displayio_group_t* native_group(mp_obj_t group_obj) { return MP_OBJ_TO_PTR(native_group); } -//| hidden: Any = ... +//| hidden: Optional[bool] = ... //| """True when the Group and all of it's layers are not visible. When False, the Group's layers //| are visible if they haven't been hidden.""" //| @@ -111,7 +111,7 @@ const mp_obj_property_t displayio_group_hidden_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| scale: Any = ... +//| scale: Optional[int] = ... //| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel //| will be represented by 2x2 pixels.""" //| @@ -140,7 +140,7 @@ const mp_obj_property_t displayio_group_scale_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| x: Any = ... +//| x: Optional[int] = ... //| """X position of the Group in the parent.""" //| STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) { @@ -165,7 +165,7 @@ const mp_obj_property_t displayio_group_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| y: Any = ... +//| y: Optional[int] = ... //| """Y position of the Group in the parent.""" //| STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t displayio_group_y_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def append(self, layer: Any) -> Any: +//| def append(self, layer: layer) -> None: //| """Append a layer to the group. It will be drawn above other layers.""" //| ... //| @@ -201,7 +201,7 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append); -//| def insert(self, index: Any, layer: Any) -> Any: +//| def insert(self, index: int, layer: layer) -> None: //| """Insert a layer into the group.""" //| ... //| @@ -214,7 +214,7 @@ STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert); -//| def index(self, layer: Any) -> Any: +//| def index(self, layer: layer) -> int: //| """Returns the index of the first copy of layer. Raises ValueError if not found.""" //| ... //| @@ -228,7 +228,7 @@ STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index); -//| def pop(self, i: Any = -1) -> Any: +//| def pop(self, i: int = -1) -> group: //| """Remove the ith item and return it.""" //| ... //| @@ -251,7 +251,7 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop); -//| def remove(self, layer: Any) -> Any: +//| def remove(self, layer: layer) -> None: //| """Remove the first copy of layer. Raises ValueError if it is not present.""" //| ... //| @@ -264,7 +264,7 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove); -//| def __len__(self) -> Any: +//| def __len__(self) -> Union[bool, int, None]: //| """Returns the number of layers in a Group""" //| ... //| @@ -278,7 +278,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: int) -> group: //| """Returns the value at the given index. //| //| This allows you to:: @@ -286,7 +286,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| print(group[0])""" //| ... //| -//| def __setitem__(self, index: Any, value: Any) -> Any: +//| def __setitem__(self, index: int, value: group) -> None: //| """Sets the value at the given index. //| //| This allows you to:: @@ -294,7 +294,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| group[0] = sprite""" //| ... //| -//| def __delitem__(self, index: Any) -> Any: +//| def __delitem__(self, index: int) -> group: //| """Deletes the value at the given index. //| //| This allows you to:: diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index a97c295212..7bca2c36b2 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -76,7 +76,7 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t return self; } -//| def reset(self) -> Any: +//| def reset(self) -> None: //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... @@ -91,7 +91,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_obj_reset); -//| def send(self, command: Any, data: Any) -> Any: +//| def send(self, command: int, data: displayio) -> None: //| """Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done.""" //| ... diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index 170873653a..0c6ca761c9 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -89,7 +89,7 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_ return MP_OBJ_FROM_PTR(self); } -//| width: Any = ... +//| width: int = ... //| """Width of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_ondiskbitmap_obj_get_width(mp_obj_t self_in) { @@ -108,7 +108,7 @@ const mp_obj_property_t displayio_ondiskbitmap_width_obj = { }; -//| height: Any = ... +//| height: int = ... //| """Height of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 4823fdae2d..4b7756a11c 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -70,7 +70,7 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def __len__(self) -> Any: +//| def __len__(self) -> Union[bool, int, None]: //| """Returns the number of colors in a Palette""" //| ... //| @@ -84,7 +84,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __setitem__(self, index: Any, value: Any) -> Any: +//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer]) -> Optional[int]: //| r"""Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1. //| //| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value). @@ -147,7 +147,7 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val return mp_const_none; } -//| def make_transparent(self, palette_index: Any) -> Any: ... +//| def make_transparent(self, palette_index: int) -> None: ... //| STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); @@ -161,7 +161,7 @@ STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_ } MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_transparent_obj, displayio_palette_obj_make_transparent); -//| def make_opaque(self, palette_index: Any) -> Any: ... +//| def make_opaque(self, palette_index: int) -> None: ... //| STATIC mp_obj_t displayio_palette_obj_make_opaque(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index 0fff2e5276..e3897a420e 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -86,7 +86,7 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t return self; } -//| def reset(self) -> Any: +//| def reset(self) -> None: //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... @@ -102,7 +102,7 @@ STATIC mp_obj_t displayio_parallelbus_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset); -//| def send(self, command: Any, data: Any) -> Any: +//| def send(self, command: int, data: displayio) -> None: //| """Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done.""" //| ... diff --git a/shared-bindings/displayio/Shape.c b/shared-bindings/displayio/Shape.c index fce89c7716..258ac49021 100644 --- a/shared-bindings/displayio/Shape.c +++ b/shared-bindings/displayio/Shape.c @@ -79,7 +79,7 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg } -//| def set_boundary(self, y: Any, start_x: Any, end_x: Any) -> Any: +//| def set_boundary(self, y: int, start_x: int, end_x: int) -> None: //| """Loads pre-packed data into the given row.""" //| ... //| diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index 01fba46a58..9f17f4116b 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -141,7 +141,7 @@ static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) { mp_obj_assert_native_inited(native_tilegrid); return MP_OBJ_TO_PTR(native_tilegrid); } -//| hidden: Any = ... +//| hidden: Optional[bool] = ... //| """True when the TileGrid is hidden. This may be False even when a part of a hidden Group.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_hidden(mp_obj_t self_in) { @@ -165,7 +165,7 @@ const mp_obj_property_t displayio_tilegrid_hidden_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| x: Any = ... +//| x: Optional[int] = ... //| """X position of the left edge in the parent.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t displayio_tilegrid_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| y: Any = ... +//| y: Optional[int] = ... //| """Y position of the top edge in the parent.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) { @@ -215,7 +215,7 @@ const mp_obj_property_t displayio_tilegrid_y_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| flip_x: Any = ... +//| flip_x: Optional[bool] = ... //| """If true, the left edge rendered will be the right edge of the right-most tile.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_x(mp_obj_t self_in) { @@ -239,7 +239,7 @@ const mp_obj_property_t displayio_tilegrid_flip_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| flip_y: Any = ... +//| flip_y: Optional[bool] = ... //| """If true, the top edge rendered will be the bottom edge of the bottom-most tile.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_y(mp_obj_t self_in) { @@ -264,7 +264,7 @@ const mp_obj_property_t displayio_tilegrid_flip_y_obj = { }; -//| transpose_xy: Any = ... +//| transpose_xy: Optional[bool] = ... //| """If true, the TileGrid's axis will be swapped. When combined with mirroring, any 90 degree //| rotation can be achieved along with the corresponding mirrored version.""" //| @@ -289,7 +289,7 @@ const mp_obj_property_t displayio_tilegrid_transpose_xy_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| pixel_shader: Any = ... +//| pixel_shader: pixel_shader = ... //| """The pixel shader of the tilegrid.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) { @@ -317,7 +317,7 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: Union[Tuple[int, int], int]) -> int: //| """Returns the tile index at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. //| @@ -326,7 +326,7 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = { //| print(grid[0])""" //| ... //| -//| def __setitem__(self, index: Any, tile_index: Any) -> Any: +//| def __setitem__(self, index: Union[Tuple[int, int], int], tile_index: int) -> None: //| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. //| From 48ea2271b78e6bce8b59b5280ccfb81212070e79 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:08:25 -0400 Subject: [PATCH 089/277] Added type hints to fontio --- shared-bindings/fontio/BuiltinFont.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 169937553a..cc4d50fe24 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -46,7 +46,7 @@ //| ... //| -//| bitmap: Any = ... +//| bitmap: bitmap = ... //| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use //| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and //| `terminalio.Terminal`.""" @@ -64,7 +64,7 @@ const mp_obj_property_t fontio_builtinfont_bitmap_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def get_bounding_box(self) -> Any: +//| def get_bounding_box(self) -> Tuple[int, int]: //| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height.""" //| ... //| @@ -76,7 +76,7 @@ STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builtinfont_obj_get_bounding_box); -//| def get_glyph(self, codepoint: Any) -> Any: +//| def get_glyph(self, codepoint: int) -> fontio.Glyph: //| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available.""" //| ... //| From ca0e8ea1ebedd631756c02b8bff4c2e0de227576 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:12:04 -0400 Subject: [PATCH 090/277] Added type hints to framebufferio --- .../framebufferio/FramebufferDisplay.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 51ef090599..4bbdf888d9 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -47,7 +47,7 @@ //| objects in CircuitPython, Display objects live until `displayio.release_displays()` //| is called. This is done so that CircuitPython can use the display itself.""" //| -//| def __init__(self, framebuffer: Any, *, rotation: int = 0, auto_refresh: bool = True): +//| def __init__(self, framebuffer: framebuffer, *, rotation: int = 0, auto_refresh: bool = True): //| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc) //| //| :param framebuffer: The framebuffer that the display is connected to @@ -94,7 +94,7 @@ static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_o return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: Group) -> Any: +//| def show(self, group: Group) -> None: //| """Switches to displaying the given group of layers. When group is None, the default //| CircuitPython terminal will be shown. //| @@ -116,7 +116,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_o } MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show); -//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> Any: +//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> bool: //| """When auto refresh is off, waits for the target frame rate and then refreshes the display, //| returning True. If the call has taken too long since the last refresh call for the given //| target frame rate, then the refresh returns False immediately without updating the screen to @@ -151,7 +151,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, cons } MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh); -//| auto_refresh: Any = ... +//| auto_refresh: Optional[bool] = ... //| """True when the display is refreshed automatically.""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) { @@ -176,7 +176,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| brightness: Any = ... +//| brightness: Optional[float] = ... //| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When //| `auto_brightness` is True, the value of `brightness` will change automatically. //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" @@ -213,7 +213,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_brightness: Any = ... +//| auto_brightness: Optional[bool] = ... //| """True when the display brightness is adjusted automatically, based on an ambient //| light sensor or other method. Note that some displays may have this set to True by default, //| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False @@ -244,7 +244,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| width: Any = ... +//| width: int = ... //| """Gets the width of the framebuffer""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) { @@ -260,7 +260,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: Any = ... +//| height: int = ... //| """Gets the height of the framebuffer""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) { @@ -276,7 +276,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rotation: Any = ... +//| rotation: Optional[int] = ... //| """The rotation of the display as an int in degrees.""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) { @@ -299,7 +299,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| framebuffer: Any = ... +//| framebuffer: framebuffer = ... //| """The framebuffer being used by the display""" //| //| @@ -317,7 +317,7 @@ const mp_obj_property_t framebufferio_framebufferframebuffer_obj = { }; -//| def fill_row(self, y: int, buffer: bytearray) -> Any: +//| def fill_row(self, y: int, buffer: ReadableBuffer) -> displayio: //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area From 51841447be983480357bfadd9a41d0c5efc33917 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:14:40 -0400 Subject: [PATCH 091/277] Added type hints to frequencyio --- shared-bindings/frequencyio/FrequencyIn.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index cadcf7a26e..b8b8a0f2db 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -94,7 +94,7 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitialises the FrequencyIn and releases any hardware resources for reuse.""" //| ... //| @@ -111,13 +111,13 @@ STATIC void check_for_deinit(frequencyio_frequencyin_obj_t *self) { } } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> FrequencyIn: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -129,7 +129,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj___exit__(size_t n_args, const mp_obj } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(frequencyio_frequencyin___exit___obj, 4, 4, frequencyio_frequencyin_obj___exit__); -//| def pause(self) -> Any: +//| def pause(self) -> None: //| """Pause frequency capture.""" //| ... //| @@ -142,7 +142,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_pause_obj, frequencyio_frequencyin_obj_pause); -//| def resume(self) -> Any: +//| def resume(self) -> None: //| """Resumes frequency capture.""" //| ... //| @@ -155,7 +155,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_resume_obj, frequencyio_frequencyin_obj_resume); -//| def clear(self) -> Any: +//| def clear(self) -> None: //| """Clears the last detected frequency capture value.""" //| ... //| @@ -169,7 +169,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequencyin_obj_clear); -//| capture_period: Any = ... +//| capture_period: Optional[int] = ... //| """The capture measurement period. Lower incoming frequencies will be measured //| more accurately with longer capture periods. Higher frequencies are more //| accurate with shorter capture periods. @@ -201,7 +201,7 @@ const mp_obj_property_t frequencyio_frequencyin_capture_period_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __get__(self, index: Any) -> Any: +//| def __get__(self, index: int) -> int: //| """Returns the value of the last frequency captured.""" //| ... //| From ff8604bb825dd003625c8e139d66fc90d93a8340 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:17:35 -0400 Subject: [PATCH 092/277] Added type hints to gamepad --- shared-bindings/gamepad/GamePad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/gamepad/GamePad.c b/shared-bindings/gamepad/GamePad.c index 5e035762e8..a5da83e3eb 100644 --- a/shared-bindings/gamepad/GamePad.c +++ b/shared-bindings/gamepad/GamePad.c @@ -70,7 +70,7 @@ //| time.sleep(0.1)""" //| -//| def __init__(self, b1: Any, b2: Any, b3: Any, b4: Any, b5: Any, b6: Any, b7: Any, b8: Any): +//| def __init__(self, b1: DigialInOut, b2: DigialInOut, b3: DigialInOut, b4: DigialInOut, b5: DigialInOut, b6: DigialInOut, b7: DigialInOut, b8: DigialInOut): //| """Initializes button scanning routines. //| //| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which @@ -114,7 +114,7 @@ STATIC mp_obj_t gamepad_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(gamepad_singleton); } -//| def get_pressed(self) -> Any: +//| def get_pressed(self) -> int: //| """Get the status of buttons pressed since the last call and clear it. //| //| Returns an 8-bit number, with bits that correspond to buttons, @@ -133,7 +133,7 @@ STATIC mp_obj_t gamepad_get_pressed(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(gamepad_get_pressed_obj, gamepad_get_pressed); -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Disable button scanning.""" //| ... //| From d73348f673538f74e896999d395b8fe8c0914a67 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:19:34 -0400 Subject: [PATCH 093/277] Added type hints to gamepadshift --- shared-bindings/gamepadshift/GamePadShift.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/gamepadshift/GamePadShift.c b/shared-bindings/gamepadshift/GamePadShift.c index 782d9724dc..f01c957046 100644 --- a/shared-bindings/gamepadshift/GamePadShift.c +++ b/shared-bindings/gamepadshift/GamePadShift.c @@ -36,7 +36,7 @@ //| class GamePadShift: //| """Scan buttons for presses through a shift register""" //| -//| def __init__(self, clock: Any, data: Any, latch: Any): +//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut): //| """Initializes button scanning routines. //| //| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut`` @@ -82,7 +82,7 @@ STATIC mp_obj_t gamepadshift_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(gamepad_singleton); } -//| def get_pressed(self) -> Any: +//| def get_pressed(self) -> int: //| """Get the status of buttons pressed since the last call and clear it. //| //| Returns an 8-bit number, with bits that correspond to buttons, @@ -100,7 +100,7 @@ STATIC mp_obj_t gamepadshift_get_pressed(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(gamepadshift_get_pressed_obj, gamepadshift_get_pressed); -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Disable button scanning.""" //| ... //| From 6a3968d8050cc1f21ba1451dfb3b2e8658b050e2 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:26:31 -0400 Subject: [PATCH 094/277] Added type hints to gnss --- shared-bindings/gnss/GNSS.c | 14 +++++++------- shared-bindings/gnss/PositionFix.c | 6 +++--- shared-bindings/gnss/SatelliteSystem.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 59ec038dd1..99f2ba5c84 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -90,7 +90,7 @@ STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, const mp return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Turn off the GNSS.""" //| ... //| @@ -107,7 +107,7 @@ STATIC void check_for_deinit(gnss_obj_t *self) { } } -//| def update(self) -> Any: +//| def update(self) -> None: //| """Update GNSS positioning information.""" //| ... //| @@ -120,7 +120,7 @@ STATIC mp_obj_t gnss_obj_update(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(gnss_update_obj, gnss_obj_update); -//| latitude: Any = ... +//| latitude: float = ... //| """Latitude of current position in degrees (float).""" //| STATIC mp_obj_t gnss_obj_get_latitude(mp_obj_t self_in) { @@ -137,7 +137,7 @@ const mp_obj_property_t gnss_latitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| longitude: Any = ... +//| longitude: float = ... //| """Longitude of current position in degrees (float).""" //| STATIC mp_obj_t gnss_obj_get_longitude(mp_obj_t self_in) { @@ -154,7 +154,7 @@ const mp_obj_property_t gnss_longitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| altitude: Any = ... +//| altitude: float = ... //| """Altitude of current position in meters (float).""" //| STATIC mp_obj_t gnss_obj_get_altitude(mp_obj_t self_in) { @@ -171,7 +171,7 @@ const mp_obj_property_t gnss_altitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| timestamp: Any = ... +//| timestamp: string = ... //| """Time when the position data was updated.""" //| STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t gnss_timestamp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| fix: Any = ... +//| fix: string = ... //| """Fix mode.""" //| STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) { diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 016603f049..52c0dd482b 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -32,17 +32,17 @@ //| def __init__(self): //| """Enum-like class to define the position fix mode.""" //| -//| INVALID: Any = ... +//| INVALID: gnss.PositionFix = ... //| """No measurement. //| //| :type gnss.PositionFix:""" //| -//| FIX_2D: Any = ... +//| FIX_2D: gnss.PositionFix = ... //| """2D fix. //| //| :type gnss.PositionFix:""" //| -//| FIX_3D: Any = ... +//| FIX_3D: gnss.PositionFix = ... //| """3D fix. //| //| :type gnss.PositionFix:""" diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index 6d3fb4782d..5ee7f0ffbf 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -32,27 +32,27 @@ //| def __init__(self): //| """Enum-like class to define the satellite system type.""" //| -//| GPS: Any = ... +//| GPS: gnss.SatelliteSystem = ... //| """Global Positioning System. //| //| :type gnss.SatelliteSystem:""" //| -//| GLONASS: Any = ... +//| GLONASS: gnss.SatelliteSystem = ... //| """GLObal NAvigation Satellite System. //| //| :type gnss.SatelliteSystem:""" //| -//| SBAS: Any = ... +//| SBAS: gnss.SatelliteSystem = ... //| """Satellite Based Augmentation System. //| //| :type gnss.SatelliteSystem:""" //| -//| QZSS_L1CA: Any = ... +//| QZSS_L1CA: gnss.SatelliteSystem = ... //| """Quasi-Zenith Satellite System L1C/A. //| //| :type gnss.SatelliteSystem:""" //| -//| QZSS_L1S: Any = ... +//| QZSS_L1S: gnss.SatelliteSystem = ... //| """Quasi-Zenith Satellite System L1S. //| //| :type gnss.SatelliteSystem:""" From 2e8b8c7b954f176988ed6c244db18efa0a696968 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:29:39 -0400 Subject: [PATCH 095/277] Added type hints to i2cperipheral --- shared-bindings/i2cperipheral/I2CPeripheral.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c index 696c3b3883..55094f75ca 100644 --- a/shared-bindings/i2cperipheral/I2CPeripheral.c +++ b/shared-bindings/i2cperipheral/I2CPeripheral.c @@ -102,7 +102,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_make_new(const mp_obj_type_t *type, return (mp_obj_t)self; } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... //| @@ -114,13 +114,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit); -//| def __enter__(self) -> Any: +//| def __enter__(self) -> I2CPeripheral: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -133,7 +133,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj___exit__(size_t n_args, const m } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__); -//| def request(self, timeout: float = -1) -> Any: +//| def request(self, timeout: float = -1) -> i2cperipheral.I2CPeripheralRequest: //| """Wait for an I2C request. //| //| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once @@ -241,13 +241,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_make_new(const mp_obj_type_ return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3])); } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> I2CPeripheralRequest: //| """No-op used in Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Close the request.""" //| ... //| @@ -383,7 +383,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_write(mp_obj_t self_in, mp_ } STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cperipheral_i2c_peripheral_request_write_obj, i2cperipheral_i2c_peripheral_request_write); -//| def ack(self, ack: bool = True) -> Any: +//| def ack(self, ack: bool = True) -> None: //| """Acknowledge or Not Acknowledge last byte received. //| Use together with :py:meth:`I2CPeripheralRequest.read` ack=False. //| From 0a8d9eed45422936bfa6df58d79ac2b4a855ca90 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:33:28 -0400 Subject: [PATCH 096/277] Added type hints to microcontroller --- shared-bindings/microcontroller/Processor.c | 6 +++--- shared-bindings/microcontroller/RunMode.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index c3c60d5cc6..32ec4f2e79 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -67,7 +67,7 @@ const mp_obj_property_t mcu_processor_frequency_obj = { }, }; -//| temperature: Any = ... +//| temperature: Optional[float] = ... //| """The on-chip temperature, in Celsius, as a float. (read-only) //| //| Is `None` if the temperature is not available.""" @@ -87,7 +87,7 @@ const mp_obj_property_t mcu_processor_temperature_obj = { }, }; -//| uid: Any = ... +//| uid: bytearray = ... //| """The unique id (aka serial number) of the chip as a `bytearray`. (read-only)""" //| STATIC mp_obj_t mcu_processor_get_uid(mp_obj_t self) { @@ -106,7 +106,7 @@ const mp_obj_property_t mcu_processor_uid_obj = { }, }; -//| voltage: Any = ... +//| voltage: Optional[float] = ... //| """The input voltage to the microcontroller, as a float. (read-only) //| //| Is `None` if the voltage is not available.""" diff --git a/shared-bindings/microcontroller/RunMode.c b/shared-bindings/microcontroller/RunMode.c index d4c10109a5..dce7a52301 100644 --- a/shared-bindings/microcontroller/RunMode.c +++ b/shared-bindings/microcontroller/RunMode.c @@ -33,18 +33,18 @@ //| """Enum-like class to define the run mode of the microcontroller and //| CircuitPython.""" //| -//| NORMAL: Any = ... +//| NORMAL: microcontroller.RunMode = ... //| """Run CircuitPython as normal. //| //| :type microcontroller.RunMode:""" //| -//| SAFE_MODE: Any = ... +//| SAFE_MODE: microcontroller.RunMode = ... //| """Run CircuitPython in safe mode. User code will not be run and the //| file system will be writeable over USB. //| //| :type microcontroller.RunMode:""" //| -//| BOOTLOADER: Any = ... +//| BOOTLOADER: microcontroller.RunMode = ... //| """Run the bootloader. //| //| :type microcontroller.RunMode:""" From 0abf45a4463df9d2e30e1c309d6aee902e56b7ff Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:37:55 -0400 Subject: [PATCH 097/277] Added type hints to nvm --- shared-bindings/nvm/ByteArray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index 3b316a33bc..b30582f662 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -49,7 +49,7 @@ //| ... //| -//| def __len__(self) -> Any: +//| def __len__(self) -> Union[bool, int, None]: //| """Return the length. This is used by (`len`)""" //| ... //| From e273b9a11faa1c9aba72fc58a87af075da76036d Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:42:57 -0400 Subject: [PATCH 098/277] Added type hints to _pew --- shared-bindings/_pew/PewPew.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index 352ef38f27..313389ad8a 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -46,7 +46,7 @@ //| that library.""" //| -//| def __init__(self, buffer: Any, rows: Any, cols: Any, buttons: Any): +//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput], cols: List[DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput], buttons: DigitalInputOutput): //| """Initializes matrix scanning routines. //| //| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should From 41f12a7a6c8424257adcd49a549d4258cd9814e4 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:47:44 -0400 Subject: [PATCH 099/277] Added type hints to pixelbuf --- shared-bindings/_pixelbuf/PixelBuf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 4c24776c3f..f66b73fdf3 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t } } -//| bpp: Any = ... +//| bpp: int = ... //| """The number of bytes per pixel in the buffer (read-only)""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) { @@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = { }; -//| brightness: Any = ... +//| brightness: float = ... //| """Float value between 0 and 1. Output brightness. //| //| When brightness is less than 1.0, a second buffer will be used to store the color values @@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_write: Any = ... +//| auto_write: bool = ... //| """Whether to automatically write the pixels after each update.""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) { @@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| byteorder: Any = ... +//| byteorder: string = ... //| """byteorder string for the buffer (read-only)""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) { @@ -245,7 +245,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def show(self) -> Any: +//| def show(self) -> None: //| """Transmits the color data to the pixels so that they are shown. This is done automatically //| when `auto_write` is True.""" //| ... @@ -257,9 +257,9 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show); -//| def fill(color: Any) -> Any: -//| """Fills the given pixelbuf with the given color.""" -//| ... +//| def fill(color: tuple[int, int, int]) -> None: +//| """Fills the given pixelbuf with the given color.""" +//| ... //| STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) { @@ -269,13 +269,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill); -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]: //| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values //| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel //| intensity from 0-1.0.""" //| ... //| -//| def __setitem__(self, index: Any, value: Any) -> Any: +//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf: //| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are //| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the //| red, green and blue values are packed into the lower three bytes (0xRRGGBB). From a2c7e2795b4d9ba5d8592d1fe3e6d8c7422c65af Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 10:51:39 -0400 Subject: [PATCH 100/277] Added type hints to ps2io --- shared-bindings/ps2io/Ps2.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index fd82591d5e..b4a741030e 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -87,7 +87,7 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, con return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitialises the Ps2 and releases any hardware resources for reuse.""" //| ... //| @@ -104,13 +104,13 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) { } } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> Ps2: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -122,7 +122,7 @@ STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__); -//| def popleft(self) -> Any: +//| def popleft(self) -> byte: //| """Removes and returns the oldest received byte. When buffer //| is empty, raises an IndexError exception.""" //| ... @@ -139,7 +139,7 @@ STATIC mp_obj_t ps2io_ps2_obj_popleft(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_popleft_obj, ps2io_ps2_obj_popleft); -//| def sendcmd(self, byte: int) -> Any: +//| def sendcmd(self, byte: int) -> int: //| """Sends a command byte to PS/2. Returns the response byte, typically //| the general ack value (0xFA). Some commands return additional data //| which is available through :py:func:`popleft()`. @@ -164,7 +164,7 @@ STATIC mp_obj_t ps2io_ps2_obj_sendcmd(mp_obj_t self_in, mp_obj_t ob) { } MP_DEFINE_CONST_FUN_OBJ_2(ps2io_ps2_sendcmd_obj, ps2io_ps2_obj_sendcmd); -//| def clear_errors(self) -> Any: +//| def clear_errors(self) -> int: //| """Returns and clears a bitmap with latest recorded communication errors. //| //| Reception errors (arise asynchronously, as data is received): @@ -202,7 +202,7 @@ STATIC mp_obj_t ps2io_ps2_obj_clear_errors(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_clear_errors_obj, ps2io_ps2_obj_clear_errors); -//| def __len__(self) -> Any: +//| def __len__(self) -> Union[bool, int, None]: //| """Returns the number of received bytes in buffer, available //| to :py:func:`popleft()`.""" //| ... From 93d20077cc56079bbe49a21f4dae13e1abe7632c Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:04:03 -0400 Subject: [PATCH 101/277] Added type hints to pulseio --- shared-bindings/pulseio/PWMOut.c | 10 +++++----- shared-bindings/pulseio/PulseIn.c | 22 +++++++++++----------- shared-bindings/pulseio/PulseOut.c | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index 863365987f..4197a5251f 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -115,7 +115,7 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitialises the PWMOut and releases any hardware resources for reuse.""" //| ... //| @@ -132,13 +132,13 @@ STATIC void check_for_deinit(pulseio_pwmout_obj_t *self) { } } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> PWMOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -150,7 +150,7 @@ STATIC mp_obj_t pulseio_pwmout_obj___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pulseio_pwmout_obj___exit__); -//| duty_cycle: Any = ... +//| duty_cycle: Optional[int] = ... //| """16 bit value that dictates how much of one cycle is high (1) versus low //| (0). 0xffff will always be high, 0 will always be low and 0x7fff will //| be half high and then half low. @@ -186,7 +186,7 @@ const mp_obj_property_t pulseio_pwmout_duty_cycle_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| frequency: Any = ... +//| frequency: Optional[int] = ... //| """32 bit value that dictates the PWM frequency in Hertz (cycles per //| second). Only writeable when constructed with ``variable_frequency=True``. //| diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index e187697077..d83306eab0 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -96,7 +96,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitialises the PulseIn and releases any hardware resources for reuse.""" //| ... //| @@ -113,13 +113,13 @@ STATIC void check_for_deinit(pulseio_pulsein_obj_t *self) { } } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> PulseIn: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -131,7 +131,7 @@ STATIC mp_obj_t pulseio_pulsein_obj___exit__(size_t n_args, const mp_obj_t *args } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulsein___exit___obj, 4, 4, pulseio_pulsein_obj___exit__); -//| def pause(self) -> Any: +//| def pause(self) -> None: //| """Pause pulse capture""" //| ... //| @@ -144,7 +144,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_pause(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_pause_obj, pulseio_pulsein_obj_pause); -//| def resume(self, trigger_duration: int = 0) -> Any: +//| def resume(self, trigger_duration: int = 0) -> None: //| """Resumes pulse capture after an optional trigger pulse. //| //| .. warning:: Using trigger pulse with a device that drives both high and @@ -171,7 +171,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_resume(size_t n_args, const mp_obj_t *pos_ar } MP_DEFINE_CONST_FUN_OBJ_KW(pulseio_pulsein_resume_obj, 1, pulseio_pulsein_obj_resume); -//| def clear(self) -> Any: +//| def clear(self) -> None: //| """Clears all captured pulses""" //| ... //| @@ -184,7 +184,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_clear(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear); -//| def popleft(self) -> Any: +//| def popleft(self) -> int: //| """Removes and returns the oldest read pulse.""" //| ... //| @@ -196,7 +196,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_popleft(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_popleft_obj, pulseio_pulsein_obj_popleft); -//| maxlen: Any = ... +//| maxlen: int = ... //| """The maximum length of the PulseIn. When len() is equal to maxlen, //| it is unclear which pulses are active and which are idle.""" //| @@ -215,7 +215,7 @@ const mp_obj_property_t pulseio_pulsein_maxlen_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| paused: Any = ... +//| paused: bool = ... //| """True when pulse capture is paused as a result of :py:func:`pause` or an error during capture //| such as a signal that is too fast.""" //| @@ -234,7 +234,7 @@ const mp_obj_property_t pulseio_pulsein_paused_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __len__(self) -> Any: +//| def __len__(self) -> Union[bool, int, None]: //| """Returns the current pulse length //| //| This allows you to:: @@ -254,7 +254,7 @@ STATIC mp_obj_t pulsein_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: int) -> Optional[int]: //| """Returns the value at the given index or values in slice. //| //| This allows you to:: diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index bfb3576a8d..dfed6d3049 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -81,7 +81,7 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitialises the PulseOut and releases any hardware resources for reuse.""" //| ... //| @@ -92,13 +92,13 @@ STATIC mp_obj_t pulseio_pulseout_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulseout_deinit_obj, pulseio_pulseout_deinit); -//| def __enter__(self) -> Any: +//| def __enter__(self) -> PulseOut: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -110,7 +110,7 @@ STATIC mp_obj_t pulseio_pulseout_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulseout___exit___obj, 4, 4, pulseio_pulseout_obj___exit__); -//| def send(self, pulses: array.array) -> Any: +//| def send(self, pulses: array.array) -> None: //| """Pulse alternating on and off durations in microseconds starting with on. //| ``pulses`` must be an `array.array` with data type 'H' for unsigned //| halfword (two bytes). From c8437e6595bf23c74ba779c32c7177538e21a52b Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:10:13 -0400 Subject: [PATCH 102/277] Added type hints to rgbmatrix --- shared-bindings/rgbmatrix/RGBMatrix.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 1bbd169654..decf94f679 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: Any, bit_depth: Any, rgb_pins: Any, addr_pins: Any, clock_pin: Any, latch_pin: Any, output_enable_pin: Any, doublebuffer: Any = True, framebuffer: Any = None, height: Any = 0): +//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: WriteableBuffer = None, height: int = 0): //| """Create a RGBMatrix object with the given attributes. The height of //| the display is determined by the number of rgb and address pins: //| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4 @@ -237,7 +237,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Free the resources (pins, timers, etc.) associated with this //| rgbmatrix instance. After deinitialization, no further operations //| may be performed.""" @@ -257,7 +257,7 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) { } } -//| brightness: Any = ... +//| brightness: Optional[float] = ... //| """In the current implementation, 0.0 turns the display off entirely //| and any other value up to 1.0 turns the display on fully.""" //| @@ -288,9 +288,10 @@ const mp_obj_property_t rgbmatrix_rgbmatrix_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def refresh(self) -> Any: ... -//| """Transmits the color data in the buffer to the pixels so that -//| they are shown.""" +//| def refresh(self) -> None: +//| """Transmits the color data in the buffer to the pixels so that +//| they are shown.""" +//| ... //| STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) { rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t*)self_in; From d9a98bd05c90ebe4746e8a646e28d26030864c94 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:13:16 -0400 Subject: [PATCH 103/277] Added type hints to rotaryio --- shared-bindings/rotaryio/IncrementalEncoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 418de664ee..26a50dde9f 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -80,7 +80,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitializes the IncrementalEncoder and releases any hardware resources for reuse.""" //| ... //| @@ -97,13 +97,13 @@ STATIC void check_for_deinit(rotaryio_incrementalencoder_obj_t *self) { } } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> IncrementalEncoder: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -116,7 +116,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_obj___exit__(size_t n_args, const mp STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rotaryio_incrementalencoder___exit___obj, 4, 4, rotaryio_incrementalencoder_obj___exit__); -//| position: Any = ... +//| position: Optional[int] = ... //| """The current position in terms of pulses. The number of pulses per rotation is defined by the //| specific hardware.""" //| From 48443ce02bfb6aff91b5d5da203976822bfb2556 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:15:22 -0400 Subject: [PATCH 104/277] Added type hints to sdcardio --- shared-bindings/sdcardio/SDCard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 1d8c4bafbe..6b32bb1c11 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -44,7 +44,7 @@ //| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used //| with ``storage.VfsFat`` to allow file I/O to an SD card.""" //| -//| def __init__(bus:busio.SPI, cs=digitalio.DigitalInOut, baudrate=8000000): +//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000): //| """Construct an SPI SD Card object with the given properties //| //| :param busio.SPI spi: The SPI bus From 71ec419da6a0ee36545bb1911b9c8c9435a77108 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:16:41 -0400 Subject: [PATCH 105/277] Added type hints to sdioio --- shared-bindings/sdioio/SDCard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 2feb7d8030..8890c1f3cc 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -109,7 +109,7 @@ STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) { } } -//| def configure(*, frequency=0, width=0) -> None: +//| def configure(*, frequency: int=0, width: int=0) -> None: //| """Configures the SDIO bus. //| //| :param int frequency: the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the `frequency` attribute for the actual clock rate. @@ -255,13 +255,13 @@ STATIC mp_obj_t sdioio_sdcard_obj_deinit(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_deinit_obj, sdioio_sdcard_obj_deinit); -//| def __enter__(self) -> Any: +//| def __enter__(self) -> SDCard: //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... //| -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... From 9116470fd7f51e133af95fb7c759dbd89e420229 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:24:53 -0400 Subject: [PATCH 106/277] Added type hints to socket --- shared-bindings/socket/__init__.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 643a57b1bb..10a56ef407 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -93,7 +93,7 @@ STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) { } } -//| def bind(self, address: tuple) -> Any: +//| def bind(self, address: tuple) -> None: //| """Bind a socket to an address //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" @@ -120,7 +120,7 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind); -//| def listen(self, backlog: int) -> Any: +//| def listen(self, backlog: int) -> None: //| """Set socket to listen for incoming connections //| //| :param ~int backlog: length of backlog queue for waiting connetions""" @@ -145,7 +145,7 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen); -//| def accept(self) -> Any: +//| def accept(self) -> tuple: //| """Accept a connection on a listening socket of type SOCK_STREAM, //| creating a new socket of type SOCK_STREAM. //| Returns a tuple of (new_socket, remote_address)""" @@ -182,7 +182,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept); -//| def connect(self, address: tuple) -> Any: +//| def connect(self, address: tuple) -> None: //| """Connect a socket to a remote address //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" @@ -209,7 +209,7 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect); -//| def send(self, bytes: bytes) -> Any: +//| def send(self, bytes: bytes) -> int: //| """Send some bytes to the connected remote address. //| Suits sockets of type SOCK_STREAM //| @@ -246,7 +246,7 @@ STATIC mp_int_t _socket_recv_into(mod_network_socket_obj_t *sock, byte *buf, mp_ } -//| def recv_into(self, buffer: bytearray, bufsize: int) -> Any: +//| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int: //| """Reads some bytes from the connected remote address, writing //| into the provided buffer. If bufsize <= len(buffer) is given, //| a maximum of bufsize bytes will be read into the buffer. If no @@ -282,7 +282,7 @@ STATIC mp_obj_t socket_recv_into(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_into_obj, 2, 3, socket_recv_into); -//| def recv(self, bufsize: int) -> Any: +//| def recv(self, bufsize: int) -> bytes: //| """Reads some bytes from the connected remote address. //| Suits sockets of type SOCK_STREAM //| Returns a bytes() of length <= bufsize @@ -309,7 +309,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv); -//| def sendto(self, bytes: bytes, address: tuple) -> Any: +//| def sendto(self, bytes: bytes, address: tuple) -> int: //| """Send some bytes to a specific address. //| Suits sockets of type SOCK_DGRAM //| @@ -343,7 +343,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_ } STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto); -//| def recvfrom(self, bufsize: int) -> Any: +//| def recvfrom(self, bufsize: int) -> Tuple[bytes, tuple]: //| """Reads some bytes from the connected remote address. //| Suits sockets of type SOCK_STREAM //| @@ -382,7 +382,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom); -//| def setsockopt(self, level: Any, optname: Any, value: Any) -> Any: +//| def setsockopt(self, level: int, optname: int, value: int) -> None: //| """Sets socket options""" //| ... //| @@ -416,7 +416,7 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt); -//| def settimeout(self, value: int) -> Any: +//| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| //| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" @@ -447,7 +447,7 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout); -//| def setblocking(self, flag: bool) -> Any: +//| def setblocking(self, flag: bool) -> Optional[int]: //| """Set the blocking behaviour of this socket. //| //| :param ~bool flag: False means non-blocking, True means block indefinitely.""" From 6e4c76a926b726d974598c0298b8580cd92c2f66 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:26:48 -0400 Subject: [PATCH 107/277] Added type hints to _stage --- shared-bindings/_stage/Layer.c | 4 ++-- shared-bindings/_stage/Text.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/_stage/Layer.c b/shared-bindings/_stage/Layer.c index 0f8260e53f..99a1560b59 100644 --- a/shared-bindings/_stage/Layer.c +++ b/shared-bindings/_stage/Layer.c @@ -88,7 +88,7 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| def move(self, x: Any, y: Any) -> Any: +//| def move(self, x: int, y: int) -> None: //| """Set the offset of the layer to the specified values.""" //| ... //| @@ -100,7 +100,7 @@ STATIC mp_obj_t layer_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_move_obj, layer_move); -//| def frame(self, frame: Any, rotation: Any) -> Any: +//| def frame(self, frame: int, rotation: int) -> None: //| """Set the animation frame of the sprite, and optionally rotation its //| graphic.""" //| ... diff --git a/shared-bindings/_stage/Text.c b/shared-bindings/_stage/Text.c index b0ff1525c3..4468de7718 100644 --- a/shared-bindings/_stage/Text.c +++ b/shared-bindings/_stage/Text.c @@ -82,7 +82,7 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| def move(self, x: Any, y: Any) -> Any: +//| def move(self, x: int, y: int) -> None: //| """Set the offset of the text to the specified values.""" //| ... //| From f8229372bd06eea08e97be5241352d521fa8972f Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:31:57 -0400 Subject: [PATCH 108/277] Added type hints to terminalio --- shared-bindings/terminalio/Terminal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c index 5c045fdee2..43310dd2a5 100644 --- a/shared-bindings/terminalio/Terminal.c +++ b/shared-bindings/terminalio/Terminal.c @@ -40,7 +40,7 @@ //| class Terminal: //| """Display a character stream with a TileGrid""" //| -//| def __init__(self, tilegrid: Any, font: Any): +//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont): //| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be //| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap.""" //| ... @@ -72,7 +72,7 @@ STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n // These are standard stream methods. Code is in py/stream.c. // -//| def write(self, buf: Any) -> Any: +//| def write(self, buf: ReadableBuffer) -> Optional[int]: //| """Write the buffer of bytes to the bus. //| //| :return: the number of bytes written From 0a657091c60e4c996f485508401370e7ae0f13b3 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:34:45 -0400 Subject: [PATCH 109/277] Added type hints to touchio --- shared-bindings/touchio/TouchIn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 0a9851cc59..50ca952ce8 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -73,7 +73,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type, return (mp_obj_t) self; } -//| def deinit(self) -> Any: +//| def deinit(self) -> None: //| """Deinitialises the TouchIn and releases any hardware resources for reuse.""" //| ... //| @@ -90,13 +90,13 @@ STATIC void check_for_deinit(touchio_touchin_obj_t *self) { } } -//| def __enter__(self) -> Any: +//| def __enter__(self) -> TouchIn: //| """No-op used by Context Managers.""" //| ... //| // Provided by context manager helper. -//| def __exit__(self) -> Any: +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -108,7 +108,7 @@ STATIC mp_obj_t touchio_touchin_obj___exit__(size_t n_args, const mp_obj_t *args } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(touchio_touchin___exit___obj, 4, 4, touchio_touchin_obj___exit__); -//| value: Any = ... +//| value: bool = ... //| """Whether the touch pad is being touched or not. (read-only) //| //| True when `raw_value` > `threshold`.""" @@ -128,7 +128,7 @@ const mp_obj_property_t touchio_touchin_value_obj = { }; -//| raw_value: Any = ... +//| raw_value: int = ... //| """The raw touch measurement as an `int`. (read-only)""" //| STATIC mp_obj_t touchio_touchin_obj_get_raw_value(mp_obj_t self_in) { @@ -147,7 +147,7 @@ const mp_obj_property_t touchio_touchin_raw_value_obj = { }; -//| threshold: Any = ... +//| threshold: Optional[int] = ... //| """Minimum `raw_value` needed to detect a touch (and for `value` to be `True`). //| //| When the **TouchIn** object is created, an initial `raw_value` is read from the pin, From e089862a6c7bcd8274ff45512f92b1330a01b3ae Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:38:02 -0400 Subject: [PATCH 110/277] Added type hints to usb_hid --- shared-bindings/usb_hid/Device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index 99b7b9db96..14b441e445 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -43,7 +43,7 @@ //| """Not currently dynamically supported.""" //| ... //| -//| def send_report(self, buf: Any) -> Any: +//| def send_report(self, buf: ReadableBuffer) -> None: //| """Send a HID report.""" //| ... //| @@ -58,7 +58,7 @@ STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) { } MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report); -//| usage_page: Any = ... +//| usage_page: int = ... //| """The usage page of the device as an `int`. Can be thought of a category. (read-only)""" //| STATIC mp_obj_t usb_hid_device_obj_get_usage_page(mp_obj_t self_in) { @@ -74,7 +74,7 @@ const mp_obj_property_t usb_hid_device_usage_page_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| usage: Any = ... +//| usage: int = ... //| """The functionality of the device as an int. (read-only) //| //| For example, Keyboard is 0x06 within the generic desktop usage page 0x01. From 9c842c5a670117751785edae8f6355cae8f27ced Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:40:20 -0400 Subject: [PATCH 111/277] Added type hints to usb_midi --- shared-bindings/usb_midi/PortIn.c | 4 ++-- shared-bindings/usb_midi/PortOut.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index 9d9310b47a..176283cd50 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -48,7 +48,7 @@ // These are standard stream methods. Code is in py/stream.c. // -//| def read(self, nbytes: Any = None) -> Any: +//| def read(self, nbytes: int = None) -> Optional[bytes]: //| """Read characters. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended @@ -58,7 +58,7 @@ //| :rtype: bytes or None""" //| ... //| -//| def readinto(self, buf: Any, nbytes: Any = None) -> Any: +//| def readinto(self, buf: WriteableBuffer, nbytes: int = None) -> Optional[bytes]: //| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most //| that many bytes. Otherwise, read at most ``len(buf)`` bytes. //| diff --git a/shared-bindings/usb_midi/PortOut.c b/shared-bindings/usb_midi/PortOut.c index b4afbc0362..92ed451e97 100644 --- a/shared-bindings/usb_midi/PortOut.c +++ b/shared-bindings/usb_midi/PortOut.c @@ -47,7 +47,7 @@ // These are standard stream methods. Code is in py/stream.c. // -//| def write(self, buf: Any) -> Any: +//| def write(self, buf: ReadableBuffer) -> Optional[int]: //| """Write the buffer of bytes to the bus. //| //| :return: the number of bytes written From 5163618d23f52c7f351b2a7d416e5dd4f434d9dc Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:42:07 -0400 Subject: [PATCH 112/277] Added type hints to watchdog --- shared-bindings/watchdog/WatchDogMode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index 293ee043d9..d867ba5248 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -32,12 +32,12 @@ //| def __init__(self): //| """Enum-like class to define the run mode of the watchdog timer.""" //| -//| RAISE: Any = ... +//| RAISE: watchdog.WatchDogMode = ... //| """Raise an exception when the WatchDogTimer expires. //| //| :type watchdog.WatchDogMode:""" //| -//| RESET: Any = ... +//| RESET: watchdog.WatchDogMode = ... //| """Reset the system if the WatchDogTimer expires. //| //| :type watchdog.WatchDogMode:""" From 843ff5d30271709186a117877ff0521b769ae8d1 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 11:44:16 -0400 Subject: [PATCH 113/277] Added type hints to wiznet --- shared-bindings/wiznet/wiznet5k.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index 2f49dffea9..90bd9ac2c7 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -84,7 +84,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, cons return ret; } -//| connected: Any = ... +//| connected: bool = ... //| """(boolean, readonly) is this device physically connected?""" //| @@ -101,7 +101,7 @@ const mp_obj_property_t wiznet5k_connected_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| dhcp: Any = ... +//| dhcp: bool = ... //| """(boolean, readwrite) is DHCP active on this device? //| //| * set to True to activate DHCP, False to turn it off""" @@ -134,7 +134,7 @@ const mp_obj_property_t wiznet5k_dhcp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def ifconfig(self, params: Any = None) -> Any: +//| def ifconfig(self, params: tuple = None) -> Optional[tuple]: //| """Called without parameters, returns a tuple of //| (ip_address, subnet_mask, gateway_address, dns_server) //| From 3df03a565069d6e8874eb678d4f010eee97305b0 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 13:49:00 -0400 Subject: [PATCH 114/277] Made most of the requested changes --- shared-bindings/_bleio/Adapter.c | 4 +-- shared-bindings/_bleio/Address.c | 6 ++-- shared-bindings/_bleio/Connection.c | 2 +- shared-bindings/_bleio/PacketBuffer.c | 2 +- shared-bindings/_bleio/ScanEntry.c | 2 +- shared-bindings/_bleio/ScanResults.c | 4 +-- shared-bindings/_bleio/Service.c | 2 +- shared-bindings/_bleio/UUID.c | 4 +-- shared-bindings/_bleio/__init__.c | 30 ++++++++----------- shared-bindings/_eve/__init__.c | 18 +++++------ shared-bindings/_pew/PewPew.c | 2 +- shared-bindings/_pixelbuf/PixelBuf.c | 2 +- shared-bindings/aesio/aes.c | 6 ++-- shared-bindings/audiobusio/I2SOut.c | 2 +- shared-bindings/audiocore/WaveFile.c | 2 +- shared-bindings/audiomixer/Mixer.c | 2 +- shared-bindings/audiomixer/MixerVoice.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 4 +-- shared-bindings/busio/SPI.c | 6 ++-- shared-bindings/busio/UART.c | 2 +- shared-bindings/displayio/Display.c | 4 +-- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/displayio/Group.c | 12 ++++---- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/displayio/Palette.c | 4 ++- shared-bindings/displayio/ParallelBus.c | 2 +- shared-bindings/displayio/TileGrid.c | 12 ++++---- shared-bindings/fontio/BuiltinFont.c | 2 +- .../framebufferio/FramebufferDisplay.c | 10 +++---- shared-bindings/frequencyio/FrequencyIn.c | 2 +- shared-bindings/gamepad/GamePad.c | 2 +- shared-bindings/gnss/GNSS.c | 2 +- shared-bindings/gnss/PositionFix.c | 10 +++---- shared-bindings/gnss/SatelliteSystem.c | 10 +++---- shared-bindings/i2cperipheral/I2CPeripheral.c | 2 +- shared-bindings/microcontroller/RunMode.c | 6 ++-- shared-bindings/nvm/ByteArray.c | 4 ++- shared-bindings/ps2io/Ps2.c | 8 +++-- shared-bindings/pulseio/PWMOut.c | 4 +-- shared-bindings/pulseio/PulseIn.c | 4 ++- shared-bindings/rgbmatrix/RGBMatrix.c | 4 +-- shared-bindings/rotaryio/IncrementalEncoder.c | 2 +- shared-bindings/supervisor/Runtime.c | 2 +- shared-bindings/usb_hid/Device.c | 2 +- shared-bindings/usb_midi/PortIn.c | 2 +- shared-bindings/usb_midi/PortOut.c | 2 +- shared-bindings/watchdog/WatchDogMode.c | 2 +- shared-bindings/watchdog/WatchDogTimer.c | 2 +- 48 files changed, 116 insertions(+), 110 deletions(-) diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 5aab9eca5b..4067a2a2a3 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| address: str = ... +//| address: Address = ... //| """MAC address of the BLE adapter. (read-only)""" //| STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) { @@ -350,7 +350,7 @@ const mp_obj_property_t bleio_adapter_connections_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def connect(self, address: Address, *, timeout: float/int) -> Adapter.connect: +//| def connect(self, address: Address, *, timeout: float/int) -> Connection: //| """Attempts a connection to the device with the given address. //| //| :param Address address: The address of the peripheral to connect to diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 06fb58d76a..144b4c167c 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __eq__(self, other: bytes) -> Optional[bool]: +//| def __eq__(self, other: Any) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... //| @@ -154,7 +154,7 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o } } -//| def __hash__(self) -> Optional[int]: +//| def __hash__(self) -> int: //| """Returns a hash for the Address data.""" //| ... //| @@ -187,7 +187,7 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); } -//| PUBLIC: bytes = ... +//| PUBLIC: int = ... //| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits).""" //| //| RANDOM_STATIC: int = ... diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 64e2baefa3..ad63a3c150 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair); -//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Tuple(_bleio.Service, ...): +//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service: //| """Do BLE discovery for all services or for the given service UUIDS, //| to find their handles and characteristics, and return the discovered services. //| `Connection.connected` must be True. diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index 7645a25aaa..7de79ab637 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto); -//| def write(self, data: bytes, *, header: bytes = None) -> int: +//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int: //| """Writes all bytes from data into the same outgoing packet. The bytes from header are included //| before data when the pending packet is currently empty. //| diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index f8d769cabe..561472f5cb 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches); -//| address: _bleio.Address = ... +//| address: Address = ... //| """The address of the device (read-only), of type `_bleio.Address`.""" //| STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index bc9d55c80f..d9620e3fc5 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -50,11 +50,11 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... //| -//| def __iter__(self) -> __iter__: +//| def __iter__(self) -> Iterator[ScanEntry]: //| """Returns itself since it is the iterator.""" //| ... //| -//| def __next__(self) -> _bleio.ScanEntry: +//| def __next__(self) -> ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still //| active. Raises `StopIteration` if scanning is finished and no other results are available.""" //| ... diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index 5cda11de4e..d2033c60c0 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(service); } -//| characteristics: Tuple(Characteristic, ...) = ... +//| characteristics: Tuple[Characteristic, ...] = ... //| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by //| this service. (read-only)""" //| diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index 823275f900..90a39e5e58 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -36,7 +36,7 @@ //| class UUID: //| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more.""" //| -//| def __init__(self, value: Union[int, typing.ByteString]): +//| def __init__(self, value: Union[int, ReadableBuffer, str]): //| """Create a new UUID or UUID object encapsulating the uuid value. //| The value can be one of: //| @@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __eq__(self, other: UUID) -> Optional[bool]: +//| def __eq__(self, other: Any) -> bool: //| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit.""" //| ... //| diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 8778e94eda..4aeb7b4602 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -59,10 +59,9 @@ //| -//| class BluetoothError: -//| def __init__(self, Exception: Exception): -//| """Catch all exception for Bluetooth related errors.""" -//| ... +//| class BluetoothError(Exception): +//| """Catch all exception for Bluetooth related errors.""" +//| ... MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception) NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) { @@ -72,10 +71,9 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) va_end(argptr); nlr_raise(exception); } -//| class ConnectionError: -//| def __init__(self, BluetoothError: _bleio.BluetoothError): -//| """Raised when a connection is unavailable.""" -//| ... +//| class ConnectionError(BluetoothError): +//| """Raised when a connection is unavailable.""" +//| ... //| MP_DEFINE_BLEIO_EXCEPTION(ConnectionError, bleio_BluetoothError) NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...) { @@ -86,20 +84,18 @@ NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ... nlr_raise(exception); } -//| class RoleError: -//| def __init__(self, BluetoothError: _bleio.BluetoothError): -//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is -//| attempted to be set but they can only be set when remote.""" -//| ... +//| class RoleError(BluetoothError): +//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is +//| attempted to be set but they can only be set when remote.""" +//| ... //| MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError) NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) { mp_raise_msg(&mp_type_bleio_RoleError, msg); } -//| class SecurityError: -//| def __init__(self, BluetoothError: _bleio.BluetoothError): -//| """Raised when a security related error occurs.""" -//| ... +//| class SecurityError(BluetoothError): +//| """Raised when a security related error occurs.""" +//| ... //| MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError) NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t* fmt, ...) { diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index 8a329147b5..e4ba77ed43 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -58,7 +58,7 @@ STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register); -//| def flush(self) -> Any: +//| def flush(self) -> None: //| """Send any queued drawing commands directly to the hardware. //| //| :param int width: The width of the grid in tiles, or 1 for sprites.""" @@ -559,9 +559,9 @@ STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb); -//| def Display(self) -> Any: ... -//| """End the display list""" -//| +//| def Display(self) -> None: +//| """End the display list""" +//| ... STATIC mp_obj_t _display(mp_obj_t self) { @@ -570,7 +570,7 @@ STATIC mp_obj_t _display(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); -//| def End(self) -> Any: +//| def End(self) -> None: //| """End drawing a graphics primitive //| //| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.""" @@ -628,7 +628,7 @@ STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro); -//| def Nop(self) -> Any: +//| def Nop(self) -> None: //| """No operation""" //| ... //| @@ -672,7 +672,7 @@ STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); -//| def RestoreContext(self) -> Any: +//| def RestoreContext(self) -> None: //| """Restore the current graphics context from the context stack""" //| ... //| @@ -684,7 +684,7 @@ STATIC mp_obj_t _restorecontext(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext); -//| def Return(self) -> Any: +//| def Return(self) -> None: //| """Return from a previous call command""" //| ... //| @@ -696,7 +696,7 @@ STATIC mp_obj_t _return(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return); -//| def SaveContext(self) -> Any: +//| def SaveContext(self) -> None: //| """Push the current graphics context on the context stack""" //| ... //| diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index 313389ad8a..c29f7f322d 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -46,7 +46,7 @@ //| that library.""" //| -//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput], cols: List[DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput, DigitalInputOutput], buttons: DigitalInputOutput): +//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut): //| """Initializes matrix scanning routines. //| //| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index f66b73fdf3..81bbc08021 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -257,7 +257,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show); -//| def fill(color: tuple[int, int, int]) -> None: +//| def fill(color: Union[int, Tuple[int, int, int]]) -> None: //| """Fills the given pixelbuf with the given color.""" //| ... //| diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index df6d0c5676..e580be38be 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -12,7 +12,7 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key: ReadableBuffer, mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> AES: +//| def __init__(self, key: Optional[ReadableBuffer], mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> None: //| """Create a new AES state with the given key. //| //| :param bytearray key: A 16-, 24-, or 32-byte key @@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, } } -//| def encrypt_into(src: WriteableBuffer, dest: WriteableBuffer) -> None: +//| def encrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the @@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); -//| def decrypt_into(src: WriteableBuffer, dest: WriteableBuffer) -> None: +//| def decrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None: //| //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 5d1c4f5957..bf08d14ce5 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__); -//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixe.Mixer], *, loop: bool = False) -> None: +//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 838447f2e1..b31a110c64 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__); -//| sample_rate: Optional[int] = ... +//| sample_rate: int = ... //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index dc08a11264..a31953e03c 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| voice: Tuple[audiomixer.MixerVoice, ...] = ... +//| voice: Tuple[MixerVoice, ...] = ... //| """A tuple of the mixer's `audiomixer.MixerVoice` object(s). //| //| .. code-block:: python diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index cb313e0fb1..f94d8f1761 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(self); } -//| def play(self, sample: Union[audiocore.WaveFile, audiomixer.Mixer, audiocore.RawSample], *, loop: bool = False) -> None: +//| def play(self, sample: Union[audiocore.WaveFile, Mixer, audiocore.RawSample], *, loop: bool = False) -> None: //| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``. //| Does not block. Use `playing` to block. //| diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 68c27169ff..46e6c81f07 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__); -//| file: Optional[file] = ... +//| file: file = ... //| """File to play back.""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) { @@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = { -//| sample_rate: Optional[int] = ... +//| sample_rate: int = ... //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 38c1bcc0e7..a40c41e6a7 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -228,7 +228,7 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock); -//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: int = None) -> None: +//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: //| """Write the data contained in ``buffer``. The SPI object must be locked. //| If the buffer is empty, nothing happens. //| @@ -270,7 +270,7 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write); -//| def readinto(self, buffer: bytearray, *, start: int = 0, end: int = None, write_value: int = 0) -> None: +//| def readinto(self, buffer: bytearray, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None: //| """Read into ``buffer`` while writing ``write_value`` for each byte read. //| The SPI object must be locked. //| If the number of bytes to read is 0, nothing happens. @@ -314,7 +314,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto); -//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: ReadableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The SPI object must be locked. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index fd51d5d3b6..f4f8746fe8 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -179,7 +179,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ // These are standard stream methods. Code is in py/stream.c. // -//| def read(self, nbytes: int = None) -> Optional[bytes]: +//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]: //| """Read characters. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index c3ddc6c140..e2e6488766 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum.""" //| -//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: microcontroller.Pin = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60): +//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60): //| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a @@ -372,7 +372,7 @@ const mp_obj_property_t displayio_display_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rotation: Optional[int] = ... +//| rotation: int = ... //| """The rotation of the display as an int in degrees.""" //| STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index e5768572ea..b9f7dd9a1c 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: int = None, set_row_window_command: int = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: int = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: microcontroller.Pin = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False): +//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False): //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index d81bf5fdb0..9d12ca1615 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -86,7 +86,7 @@ displayio_group_t* native_group(mp_obj_t group_obj) { return MP_OBJ_TO_PTR(native_group); } -//| hidden: Optional[bool] = ... +//| hidden: bool = ... //| """True when the Group and all of it's layers are not visible. When False, the Group's layers //| are visible if they haven't been hidden.""" //| @@ -111,7 +111,7 @@ const mp_obj_property_t displayio_group_hidden_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| scale: Optional[int] = ... +//| scale: int = ... //| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel //| will be represented by 2x2 pixels.""" //| @@ -140,7 +140,7 @@ const mp_obj_property_t displayio_group_scale_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| x: Optional[int] = ... +//| x: int = ... //| """X position of the Group in the parent.""" //| STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) { @@ -165,7 +165,7 @@ const mp_obj_property_t displayio_group_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| y: Optional[int] = ... +//| y: int = ... //| """Y position of the Group in the parent.""" //| STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) { @@ -264,7 +264,9 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove); -//| def __len__(self) -> Union[bool, int, None]: +//| def __bool__(self) -> bool: ... +//| +//| def __len__(self) -> int: //| """Returns the number of layers in a Group""" //| ... //| diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 7bca2c36b2..7c1827db31 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -91,7 +91,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_obj_reset); -//| def send(self, command: int, data: displayio) -> None: +//| def send(self, command: int, data: ReadableBuffer) -> None: //| """Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done.""" //| ... diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 4b7756a11c..a06dd38ff0 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -70,7 +70,9 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def __len__(self) -> Union[bool, int, None]: +//| def __bool__(self) -> bool: ... +//| +//| def __len__(self) -> int: //| """Returns the number of colors in a Palette""" //| ... //| diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index e3897a420e..247ac5dd50 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -102,7 +102,7 @@ STATIC mp_obj_t displayio_parallelbus_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset); -//| def send(self, command: int, data: displayio) -> None: +//| def send(self, command: int, data: ReadableBuffer) -> None: //| """Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done.""" //| ... diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index 9f17f4116b..d3ad0f0fc9 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -141,7 +141,7 @@ static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) { mp_obj_assert_native_inited(native_tilegrid); return MP_OBJ_TO_PTR(native_tilegrid); } -//| hidden: Optional[bool] = ... +//| hidden: bool = ... //| """True when the TileGrid is hidden. This may be False even when a part of a hidden Group.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_hidden(mp_obj_t self_in) { @@ -165,7 +165,7 @@ const mp_obj_property_t displayio_tilegrid_hidden_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| x: Optional[int] = ... +//| x: int = ... //| """X position of the left edge in the parent.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t displayio_tilegrid_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| y: Optional[int] = ... +//| y: int = ... //| """Y position of the top edge in the parent.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) { @@ -215,7 +215,7 @@ const mp_obj_property_t displayio_tilegrid_y_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| flip_x: Optional[bool] = ... +//| flip_x: bool = ... //| """If true, the left edge rendered will be the right edge of the right-most tile.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_x(mp_obj_t self_in) { @@ -239,7 +239,7 @@ const mp_obj_property_t displayio_tilegrid_flip_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| flip_y: Optional[bool] = ... +//| flip_y: bool = ... //| """If true, the top edge rendered will be the bottom edge of the bottom-most tile.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_y(mp_obj_t self_in) { @@ -264,7 +264,7 @@ const mp_obj_property_t displayio_tilegrid_flip_y_obj = { }; -//| transpose_xy: Optional[bool] = ... +//| transpose_xy: bool = ... //| """If true, the TileGrid's axis will be swapped. When combined with mirroring, any 90 degree //| rotation can be achieved along with the corresponding mirrored version.""" //| diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index cc4d50fe24..6d6a39818f 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -76,7 +76,7 @@ STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builtinfont_obj_get_bounding_box); -//| def get_glyph(self, codepoint: int) -> fontio.Glyph: +//| def get_glyph(self, codepoint: int) -> Glyph: //| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available.""" //| ... //| diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 4bbdf888d9..29e11638a0 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -151,7 +151,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, cons } MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh); -//| auto_refresh: Optional[bool] = ... +//| auto_refresh: bool = ... //| """True when the display is refreshed automatically.""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) { @@ -176,7 +176,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| brightness: Optional[float] = ... +//| brightness: float = ... //| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When //| `auto_brightness` is True, the value of `brightness` will change automatically. //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" @@ -213,7 +213,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_brightness: Optional[bool] = ... +//| auto_brightness: bool = ... //| """True when the display brightness is adjusted automatically, based on an ambient //| light sensor or other method. Note that some displays may have this set to True by default, //| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False @@ -276,7 +276,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rotation: Optional[int] = ... +//| rotation: int = ... //| """The rotation of the display as an int in degrees.""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) { @@ -317,7 +317,7 @@ const mp_obj_property_t framebufferio_framebufferframebuffer_obj = { }; -//| def fill_row(self, y: int, buffer: ReadableBuffer) -> displayio: +//| def fill_row(self, y: int, buffer: WriteableBuffer) -> displayio: //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index b8b8a0f2db..1aed71f25c 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -169,7 +169,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequencyin_obj_clear); -//| capture_period: Optional[int] = ... +//| capture_period: int = ... //| """The capture measurement period. Lower incoming frequencies will be measured //| more accurately with longer capture periods. Higher frequencies are more //| accurate with shorter capture periods. diff --git a/shared-bindings/gamepad/GamePad.c b/shared-bindings/gamepad/GamePad.c index a5da83e3eb..8c0f58d0e8 100644 --- a/shared-bindings/gamepad/GamePad.c +++ b/shared-bindings/gamepad/GamePad.c @@ -70,7 +70,7 @@ //| time.sleep(0.1)""" //| -//| def __init__(self, b1: DigialInOut, b2: DigialInOut, b3: DigialInOut, b4: DigialInOut, b5: DigialInOut, b6: DigialInOut, b7: DigialInOut, b8: DigialInOut): +//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut): //| """Initializes button scanning routines. //| //| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 99f2ba5c84..86bf3ca42c 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -171,7 +171,7 @@ const mp_obj_property_t gnss_altitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| timestamp: string = ... +//| timestamp: time.struct_time = ... //| """Time when the position data was updated.""" //| STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) { diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 52c0dd482b..9d4c96fe0b 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -32,17 +32,17 @@ //| def __init__(self): //| """Enum-like class to define the position fix mode.""" //| -//| INVALID: gnss.PositionFix = ... +//| INVALID: PositionFix = ... //| """No measurement. //| -//| :type gnss.PositionFix:""" +//| :type PositionFix:""" //| -//| FIX_2D: gnss.PositionFix = ... +//| FIX_2D: PositionFix = ... //| """2D fix. //| -//| :type gnss.PositionFix:""" +//| :type PositionFix:""" //| -//| FIX_3D: gnss.PositionFix = ... +//| FIX_3D: PositionFix = ... //| """3D fix. //| //| :type gnss.PositionFix:""" diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index 5ee7f0ffbf..3405021d47 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -32,27 +32,27 @@ //| def __init__(self): //| """Enum-like class to define the satellite system type.""" //| -//| GPS: gnss.SatelliteSystem = ... +//| GPS: SatelliteSystem = ... //| """Global Positioning System. //| //| :type gnss.SatelliteSystem:""" //| -//| GLONASS: gnss.SatelliteSystem = ... +//| GLONASS: SatelliteSystem = ... //| """GLObal NAvigation Satellite System. //| //| :type gnss.SatelliteSystem:""" //| -//| SBAS: gnss.SatelliteSystem = ... +//| SBAS: SatelliteSystem = ... //| """Satellite Based Augmentation System. //| //| :type gnss.SatelliteSystem:""" //| -//| QZSS_L1CA: gnss.SatelliteSystem = ... +//| QZSS_L1CA: SatelliteSystem = ... //| """Quasi-Zenith Satellite System L1C/A. //| //| :type gnss.SatelliteSystem:""" //| -//| QZSS_L1S: gnss.SatelliteSystem = ... +//| QZSS_L1S: SatelliteSystem = ... //| """Quasi-Zenith Satellite System L1S. //| //| :type gnss.SatelliteSystem:""" diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c index 55094f75ca..0a1c798abb 100644 --- a/shared-bindings/i2cperipheral/I2CPeripheral.c +++ b/shared-bindings/i2cperipheral/I2CPeripheral.c @@ -133,7 +133,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj___exit__(size_t n_args, const m } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__); -//| def request(self, timeout: float = -1) -> i2cperipheral.I2CPeripheralRequest: +//| def request(self, timeout: float = -1) -> I2CPeripheralRequest: //| """Wait for an I2C request. //| //| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once diff --git a/shared-bindings/microcontroller/RunMode.c b/shared-bindings/microcontroller/RunMode.c index dce7a52301..f133c34b14 100644 --- a/shared-bindings/microcontroller/RunMode.c +++ b/shared-bindings/microcontroller/RunMode.c @@ -33,18 +33,18 @@ //| """Enum-like class to define the run mode of the microcontroller and //| CircuitPython.""" //| -//| NORMAL: microcontroller.RunMode = ... +//| NORMAL: RunMode = ... //| """Run CircuitPython as normal. //| //| :type microcontroller.RunMode:""" //| -//| SAFE_MODE: microcontroller.RunMode = ... +//| SAFE_MODE: RunMode = ... //| """Run CircuitPython in safe mode. User code will not be run and the //| file system will be writeable over USB. //| //| :type microcontroller.RunMode:""" //| -//| BOOTLOADER: microcontroller.RunMode = ... +//| BOOTLOADER: RunMode = ... //| """Run the bootloader. //| //| :type microcontroller.RunMode:""" diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index b30582f662..6f282d6973 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -49,7 +49,9 @@ //| ... //| -//| def __len__(self) -> Union[bool, int, None]: +//| def __bool__(self) -> bool: ... +//| +//| def __len__(self) -> int: //| """Return the length. This is used by (`len`)""" //| ... //| diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index b4a741030e..a7f1d9da5f 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -122,7 +122,7 @@ STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__); -//| def popleft(self) -> byte: +//| def popleft(self) -> int: //| """Removes and returns the oldest received byte. When buffer //| is empty, raises an IndexError exception.""" //| ... @@ -164,7 +164,7 @@ STATIC mp_obj_t ps2io_ps2_obj_sendcmd(mp_obj_t self_in, mp_obj_t ob) { } MP_DEFINE_CONST_FUN_OBJ_2(ps2io_ps2_sendcmd_obj, ps2io_ps2_obj_sendcmd); -//| def clear_errors(self) -> int: +//| def clear_errors(self) -> None: //| """Returns and clears a bitmap with latest recorded communication errors. //| //| Reception errors (arise asynchronously, as data is received): @@ -202,7 +202,9 @@ STATIC mp_obj_t ps2io_ps2_obj_clear_errors(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_clear_errors_obj, ps2io_ps2_obj_clear_errors); -//| def __len__(self) -> Union[bool, int, None]: +//| def __bool__(self) -> bool: ... +//| +//| def __len__(self) -> int: //| """Returns the number of received bytes in buffer, available //| to :py:func:`popleft()`.""" //| ... diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index 4197a5251f..862a500bf6 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -150,7 +150,7 @@ STATIC mp_obj_t pulseio_pwmout_obj___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pulseio_pwmout_obj___exit__); -//| duty_cycle: Optional[int] = ... +//| duty_cycle: int = ... //| """16 bit value that dictates how much of one cycle is high (1) versus low //| (0). 0xffff will always be high, 0 will always be low and 0x7fff will //| be half high and then half low. @@ -186,7 +186,7 @@ const mp_obj_property_t pulseio_pwmout_duty_cycle_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| frequency: Optional[int] = ... +//| frequency: int = ... //| """32 bit value that dictates the PWM frequency in Hertz (cycles per //| second). Only writeable when constructed with ``variable_frequency=True``. //| diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index d83306eab0..75ea1a80e3 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -234,7 +234,9 @@ const mp_obj_property_t pulseio_pulsein_paused_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __len__(self) -> Union[bool, int, None]: +//| def __bool__(self) -> bool: ... +//| +//| def __len__(self) -> int: //| """Returns the current pulse length //| //| This allows you to:: diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index decf94f679..0099d9f0c5 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: WriteableBuffer = None, height: int = 0): +//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0): //| """Create a RGBMatrix object with the given attributes. The height of //| the display is determined by the number of rgb and address pins: //| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4 @@ -257,7 +257,7 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) { } } -//| brightness: Optional[float] = ... +//| brightness: float = ... //| """In the current implementation, 0.0 turns the display off entirely //| and any other value up to 1.0 turns the display on fully.""" //| diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 26a50dde9f..201336266a 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -116,7 +116,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_obj___exit__(size_t n_args, const mp STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rotaryio_incrementalencoder___exit___obj, 4, 4, rotaryio_incrementalencoder_obj___exit__); -//| position: Optional[int] = ... +//| position: int = ... //| """The current position in terms of pulses. The number of pulses per rotation is defined by the //| specific hardware.""" //| diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index e0bd07600d..ba72bcd038 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -39,7 +39,7 @@ //| print("Hello World!")""" //| -//| def __init__(self): +//| def __init__(self): -> None //| """You cannot create an instance of `supervisor.Runtime`. //| Use `supervisor.runtime` to access the sole instance available.""" //| ... diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index 14b441e445..f7323accf8 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -39,7 +39,7 @@ //| mouse.send_report()""" //| -//| def __init__(self): +//| def __init__(self): -> None //| """Not currently dynamically supported.""" //| ... //| diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index 176283cd50..62c4f98e8d 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -58,7 +58,7 @@ //| :rtype: bytes or None""" //| ... //| -//| def readinto(self, buf: WriteableBuffer, nbytes: int = None) -> Optional[bytes]: +//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[bytes]: //| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most //| that many bytes. Otherwise, read at most ``len(buf)`` bytes. //| diff --git a/shared-bindings/usb_midi/PortOut.c b/shared-bindings/usb_midi/PortOut.c index 92ed451e97..e820c0a36f 100644 --- a/shared-bindings/usb_midi/PortOut.c +++ b/shared-bindings/usb_midi/PortOut.c @@ -38,7 +38,7 @@ //| class PortOut: //| """Sends midi messages to a computer over USB""" //| -//| def __init__(self): +//| def __init__(self): -> None //| """You cannot create an instance of `usb_midi.PortOut`. //| //| PortOut objects are constructed for every corresponding entry in the USB diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index d867ba5248..6c3a70c1e1 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -29,7 +29,7 @@ //| class WatchDogMode: //| """run state of the watchdog timer""" //| -//| def __init__(self): +//| def __init__(self): -> None //| """Enum-like class to define the run mode of the watchdog timer.""" //| //| RAISE: watchdog.WatchDogMode = ... diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index 4a2aa00cdf..ba1e43b358 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -49,7 +49,7 @@ //| """ //| -//| def __init__(self): +//| def __init__(self): -> None //| """Not currently dynamically supported. Access the sole instance through `microcontroller.watchdog`.""" //| ... //| From d358c915c3d27469fc17bdc302dad393d7e28a09 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 14:00:06 -0400 Subject: [PATCH 115/277] Fixed init formatting --- shared-bindings/supervisor/Runtime.c | 2 +- shared-bindings/usb_hid/Device.c | 2 +- shared-bindings/usb_midi/PortOut.c | 2 +- shared-bindings/watchdog/WatchDogMode.c | 2 +- shared-bindings/watchdog/WatchDogTimer.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index ba72bcd038..689c299ef8 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -39,7 +39,7 @@ //| print("Hello World!")""" //| -//| def __init__(self): -> None +//| def __init__(self) -> None: //| """You cannot create an instance of `supervisor.Runtime`. //| Use `supervisor.runtime` to access the sole instance available.""" //| ... diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index f7323accf8..d071716efa 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -39,7 +39,7 @@ //| mouse.send_report()""" //| -//| def __init__(self): -> None +//| def __init__(self) -> None: //| """Not currently dynamically supported.""" //| ... //| diff --git a/shared-bindings/usb_midi/PortOut.c b/shared-bindings/usb_midi/PortOut.c index e820c0a36f..ce7062ed3c 100644 --- a/shared-bindings/usb_midi/PortOut.c +++ b/shared-bindings/usb_midi/PortOut.c @@ -38,7 +38,7 @@ //| class PortOut: //| """Sends midi messages to a computer over USB""" //| -//| def __init__(self): -> None +//| def __init__(self) -> None: //| """You cannot create an instance of `usb_midi.PortOut`. //| //| PortOut objects are constructed for every corresponding entry in the USB diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index 6c3a70c1e1..9b9999d8bf 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -29,7 +29,7 @@ //| class WatchDogMode: //| """run state of the watchdog timer""" //| -//| def __init__(self): -> None +//| def __init__(self) -> None: //| """Enum-like class to define the run mode of the watchdog timer.""" //| //| RAISE: watchdog.WatchDogMode = ... diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index ba1e43b358..20bead106c 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -49,7 +49,7 @@ //| """ //| -//| def __init__(self): -> None +//| def __init__(self) -> None: //| """Not currently dynamically supported. Access the sole instance through `microcontroller.watchdog`.""" //| ... //| From d0d949cd24dbff5fb382f8c7abf3bae7ba46541a Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 14:23:34 -0400 Subject: [PATCH 116/277] Made every init return None --- shared-bindings/_bleio/Adapter.c | 2 +- shared-bindings/_bleio/Address.c | 2 +- shared-bindings/_bleio/Attribute.c | 2 +- shared-bindings/_bleio/Characteristic.c | 2 +- shared-bindings/_bleio/CharacteristicBuffer.c | 2 +- shared-bindings/_bleio/Connection.c | 2 +- shared-bindings/_bleio/Descriptor.c | 2 +- shared-bindings/_bleio/PacketBuffer.c | 2 +- shared-bindings/_bleio/ScanEntry.c | 2 +- shared-bindings/_bleio/ScanResults.c | 2 +- shared-bindings/_bleio/Service.c | 2 +- shared-bindings/_bleio/UUID.c | 2 +- shared-bindings/_pew/PewPew.c | 2 +- shared-bindings/_pixelbuf/PixelBuf.c | 2 +- shared-bindings/_stage/Layer.c | 2 +- shared-bindings/_stage/Text.c | 2 +- shared-bindings/analogio/AnalogIn.c | 2 +- shared-bindings/analogio/AnalogOut.c | 2 +- shared-bindings/audiobusio/I2SOut.c | 2 +- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/audiocore/RawSample.c | 2 +- shared-bindings/audiocore/WaveFile.c | 2 +- shared-bindings/audioio/AudioOut.c | 2 +- shared-bindings/audiomixer/Mixer.c | 2 +- shared-bindings/audiomixer/MixerVoice.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 2 +- shared-bindings/audiopwmio/PWMAudioOut.c | 2 +- shared-bindings/bitbangio/I2C.c | 2 +- shared-bindings/bitbangio/OneWire.c | 2 +- shared-bindings/bitbangio/SPI.c | 2 +- shared-bindings/busio/I2C.c | 2 +- shared-bindings/busio/OneWire.c | 2 +- shared-bindings/busio/SPI.c | 2 +- shared-bindings/busio/UART.c | 2 +- shared-bindings/countio/Counter.c | 2 +- shared-bindings/digitalio/DigitalInOut.c | 2 +- shared-bindings/digitalio/Direction.c | 2 +- shared-bindings/digitalio/DriveMode.c | 2 +- shared-bindings/digitalio/Pull.c | 2 +- shared-bindings/displayio/Bitmap.c | 2 +- shared-bindings/displayio/ColorConverter.c | 2 +- shared-bindings/displayio/Display.c | 2 +- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/displayio/FourWire.c | 2 +- shared-bindings/displayio/Group.c | 2 +- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/displayio/OnDiskBitmap.c | 2 +- shared-bindings/displayio/Palette.c | 2 +- shared-bindings/displayio/ParallelBus.c | 2 +- shared-bindings/displayio/Shape.c | 2 +- shared-bindings/displayio/TileGrid.c | 2 +- shared-bindings/fontio/BuiltinFont.c | 2 +- shared-bindings/framebufferio/FramebufferDisplay.c | 2 +- shared-bindings/frequencyio/FrequencyIn.c | 2 +- shared-bindings/gamepad/GamePad.c | 2 +- shared-bindings/gamepadshift/GamePadShift.c | 2 +- shared-bindings/gnss/GNSS.c | 2 +- shared-bindings/gnss/PositionFix.c | 2 +- shared-bindings/gnss/SatelliteSystem.c | 2 +- shared-bindings/i2cperipheral/I2CPeripheral.c | 4 ++-- shared-bindings/microcontroller/Pin.c | 2 +- shared-bindings/microcontroller/Processor.c | 2 +- shared-bindings/microcontroller/RunMode.c | 2 +- shared-bindings/nvm/ByteArray.c | 2 +- shared-bindings/ps2io/Ps2.c | 2 +- shared-bindings/pulseio/PWMOut.c | 2 +- shared-bindings/pulseio/PulseIn.c | 2 +- shared-bindings/pulseio/PulseOut.c | 2 +- shared-bindings/rgbmatrix/RGBMatrix.c | 2 +- shared-bindings/rotaryio/IncrementalEncoder.c | 2 +- shared-bindings/rtc/RTC.c | 2 +- shared-bindings/sdcardio/SDCard.c | 2 +- shared-bindings/sdioio/SDCard.c | 2 +- shared-bindings/socket/__init__.c | 2 +- shared-bindings/storage/__init__.c | 2 +- shared-bindings/terminalio/Terminal.c | 2 +- shared-bindings/time/__init__.c | 2 +- shared-bindings/touchio/TouchIn.c | 2 +- shared-bindings/ulab/__init__.pyi | 2 +- shared-bindings/usb_midi/PortIn.c | 2 +- shared-bindings/vectorio/Circle.c | 2 +- shared-bindings/vectorio/Polygon.c | 2 +- shared-bindings/vectorio/Rectangle.c | 2 +- shared-bindings/vectorio/VectorShape.c | 2 +- shared-bindings/wiznet/wiznet5k.c | 2 +- 85 files changed, 86 insertions(+), 86 deletions(-) diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 4067a2a2a3..75212fa91f 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -65,7 +65,7 @@ //| connections and also initiate connections.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """You cannot create an instance of `_bleio.Adapter`. //| Use `_bleio.adapter` to access the sole instance available.""" //| ... diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 144b4c167c..2481a9199c 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -38,7 +38,7 @@ //| """Encapsulates the address of a BLE device.""" //| -//| def __init__(self, address: ReadableBuffer, address_type: int): +//| def __init__(self, address: ReadableBuffer, address_type: int) -> None: //| """Create a new Address object encapsulating the address value. //| The value itself can be one of: //| diff --git a/shared-bindings/_bleio/Attribute.c b/shared-bindings/_bleio/Attribute.c index 79f45da94d..7d91c93780 100644 --- a/shared-bindings/_bleio/Attribute.c +++ b/shared-bindings/_bleio/Attribute.c @@ -36,7 +36,7 @@ //| :py:class:`~Characteristic` and :py:class:`~Descriptor`, //| but is not defined as a Python superclass of those classes.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """You cannot create an instance of :py:class:`~_bleio.Attribute`.""" //| ... //| diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index e4c81d8c27..593d8edcb4 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -37,7 +37,7 @@ //| """Stores information about a BLE service characteristic and allows reading //| and writing of the characteristic's value.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """There is no regular constructor for a Characteristic. A new local Characteristic can be created //| and attached to a Service by calling `add_to_service()`. //| Remote Characteristic objects are created by `Connection.discover_remote_services()` diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index efe27e5d2a..24d7a26b64 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -44,7 +44,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self //| class CharacteristicBuffer: //| """Accumulates a Characteristic's incoming values in a FIFO buffer.""" //| -//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64): +//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64) -> None: //| //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| add the newly-written bytes to a FIFO buffer. diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index ad63a3c150..5dfbc5a36c 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -68,7 +68,7 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) { } } -//| def __init__(self): +//| def __init__(self) -> None: //| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`. //| Connections may also be made when another device initiates a connection. To use a Connection //| created by a peer, read the `Adapter.connections` property. diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index 6382221a16..b709fea6dd 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -39,7 +39,7 @@ //| Descriptors are attached to BLE characteristics and provide contextual //| information about the characteristic.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """There is no regular constructor for a Descriptor. A new local Descriptor can be created //| and attached to a Characteristic by calling `add_to_characteristic()`. //| Remote Descriptor objects are created by `Connection.discover_remote_services()` diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index 7de79ab637..bbdde37d5b 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -44,7 +44,7 @@ //| When we're the server, we ignore all connections besides the first to subscribe to //| notifications.""" //| -//| def __init__(self, characteristic: Characteristic, *, buffer_size: int): +//| def __init__(self, characteristic: Characteristic, *, buffer_size: int) -> None: //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| add the newly-written bytes to a FIFO buffer. //| diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index 561472f5cb..d2f0e77fd1 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -41,7 +41,7 @@ //| it has no user-visible constructor.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... //| diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index d9620e3fc5..9dca90c38a 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -46,7 +46,7 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { return MP_OBJ_STOP_ITERATION; } -//| def __init__(self): +//| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... //| diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index d2033c60c0..65f920c583 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -35,7 +35,7 @@ //| class Service: //| """Stores information about a BLE service and its characteristics.""" //| -//| def __init__(self, uuid: UUID, *, secondary: bool = False): +//| def __init__(self, uuid: UUID, *, secondary: bool = False) -> None: //| """Create a new Service identified by the specified UUID. It can be accessed by all //| connections. This is known as a Service server. Client Service objects are created via //| `Connection.discover_remote_services`. diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index 90a39e5e58..c6706e46a7 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -36,7 +36,7 @@ //| class UUID: //| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more.""" //| -//| def __init__(self, value: Union[int, ReadableBuffer, str]): +//| def __init__(self, value: Union[int, ReadableBuffer, str]) -> None: //| """Create a new UUID or UUID object encapsulating the uuid value. //| The value can be one of: //| diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index c29f7f322d..32a956c93c 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -46,7 +46,7 @@ //| that library.""" //| -//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut): +//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None: //| """Initializes matrix scanning routines. //| //| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 81bbc08021..951395acba 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t //| class PixelBuf: //| """A fast RGB[W] pixel buffer for LED and similar devices.""" //| -//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b""): +//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b"") -> None: //| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel. //| //| When brightness is less than 1.0, a second buffer will be used to store the color values diff --git a/shared-bindings/_stage/Layer.c b/shared-bindings/_stage/Layer.c index 99a1560b59..5828669a78 100644 --- a/shared-bindings/_stage/Layer.c +++ b/shared-bindings/_stage/Layer.c @@ -33,7 +33,7 @@ //| class Layer: //| """Keep information about a single layer of graphics""" //| -//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray): +//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None: //| """Keep internal information about a layer of graphics (either a //| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering //| with the ``render()`` function. diff --git a/shared-bindings/_stage/Text.c b/shared-bindings/_stage/Text.c index 4468de7718..555eb58310 100644 --- a/shared-bindings/_stage/Text.c +++ b/shared-bindings/_stage/Text.c @@ -33,7 +33,7 @@ //| class Text: //| """Keep information about a single grid of text""" //| -//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray): +//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None: //| """Keep internal information about a grid of text //| in a format suitable for fast rendering //| with the ``render()`` function. diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index e52d9b16be..a91ffd9467 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -48,7 +48,7 @@ //| val = adc.value""" //| -//| def __init__(self, pin: microcontroller.Pin): +//| def __init__(self, pin: microcontroller.Pin) -> None: //| """Use the AnalogIn on the given pin. The reference voltage varies by //| platform so use ``reference_voltage`` to read the configured setting. //| diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index 9523b91a99..3b8d9354ad 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -47,7 +47,7 @@ //| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02 //| dac.value = 32768 # makes PA02 1.65V""" //| -//| def __init__(self, pin: microcontroller.Pin): +//| def __init__(self, pin: microcontroller.Pin) -> None: //| """Use the AnalogOut on the given pin. //| //| :param ~microcontroller.Pin pin: the pin to output to""" diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index bf08d14ce5..304c737f62 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -38,7 +38,7 @@ //| class I2SOut: //| """Output an I2S audio signal""" //| -//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool): +//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool) -> None: //| """Create a I2SOut object associated with the given pins. //| //| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 329c7bde53..9a963bcfa9 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -39,7 +39,7 @@ //| class PDMIn: //| """Record an input PDM audio stream""" //| -//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11): +//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11) -> None: //| """Create a PDMIn object associated with the given pins. This allows you to //| record audio signals from the given pins. Individual ports may put further //| restrictions on the recording parameters. The overall sample rate is diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index dc5cfd8200..20ebae0015 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -38,7 +38,7 @@ //| class RawSample: //| """A raw audio sample buffer in memory""" //| -//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000): +//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None: //| """Create a RawSample based on the given buffer of signed values. If channel_count is more than //| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the //| first sample will be for channel 1, the second sample will be for channel two, the third for diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index b31a110c64..d986d6db5c 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -40,7 +40,7 @@ //| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating //| an internal buffer.""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer): +//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer) -> None: //| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param typing.BinaryIO file: Already opened wave file diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index a500eb7c79..e1a78c44c4 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -39,7 +39,7 @@ //| class AudioOut: //| """Output an analog audio signal""" //| -//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000): +//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None: //| """Create a AudioOut object associated with the given pin(s). This allows you to //| play audio signals out on the given pin(s). //| diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index a31953e03c..0d7712b036 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -41,7 +41,7 @@ //| class Mixer: //| """Mixes one or more audio samples together into one sample.""" //| -//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000): +//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000) -> None: //| """Create a Mixer object that can mix multiple channels with the same sample rate. //| Samples are accessed and controlled with the mixer's `audiomixer.MixerVoice` objects. //| diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index f94d8f1761..26a044d464 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -42,7 +42,7 @@ //| //| Used to access and control samples with `audiomixer.Mixer`.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """MixerVoice instance object(s) created by `audiomixer.Mixer`.""" //| ... //| diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 46e6c81f07..b7bb449572 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -37,7 +37,7 @@ //| class MP3: //| """Load a mp3 file for audio playback""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer): +//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None: //| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index b16538f174..1d740823a9 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -39,7 +39,7 @@ //| class PWMAudioOut: //| """Output an analog audio signal by varying the PWM duty cycle.""" //| -//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000): +//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None: //| """Create a PWMAudioOut object associated with the given pin(s). This allows you to //| play audio signals out on the given pin(s). In contrast to mod:`audioio`, //| the pin(s) specified are digital pins, and are driven with a device-dependent PWM diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 710275b2f6..a9ab475bdb 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -40,7 +40,7 @@ //| class I2C: //| """Two wire serial protocol""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int): +//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None: //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. diff --git a/shared-bindings/bitbangio/OneWire.c b/shared-bindings/bitbangio/OneWire.c index b9fce5e056..da94a393e3 100644 --- a/shared-bindings/bitbangio/OneWire.c +++ b/shared-bindings/bitbangio/OneWire.c @@ -42,7 +42,7 @@ //| //| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126""" //| -//| def __init__(self, pin: microcontroller.Pin): +//| def __init__(self, pin: microcontroller.Pin) -> None: //| //| """Create a OneWire object associated with the given pin. The object //| implements the lowest level timing-sensitive bits of the protocol. diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 90483e3ebf..0a4d62361a 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -51,7 +51,7 @@ //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines //| and therefore the hardware.)""" //| -//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None): +//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None: //| """Construct an SPI object on the given pins. //| //| .. seealso:: Using this class directly requires careful lock management. diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index cf38fdce60..d34386a685 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -39,7 +39,7 @@ //| class I2C: //| """Two wire serial protocol""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255): +//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None: //| //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data diff --git a/shared-bindings/busio/OneWire.c b/shared-bindings/busio/OneWire.c index 66f0fba3da..1fae391819 100644 --- a/shared-bindings/busio/OneWire.c +++ b/shared-bindings/busio/OneWire.c @@ -37,7 +37,7 @@ //| class OneWire: //| """Lowest-level of the Maxim OneWire protocol""" //| -//| def __init__(self, pin: microcontroller.Pin): +//| def __init__(self, pin: microcontroller.Pin) -> None: //| """(formerly Dallas Semi) OneWire protocol. //| //| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126 diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index a40c41e6a7..173f8aa6df 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -53,7 +53,7 @@ //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines //| and therefore the hardware.)""" //| -//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None): +//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None: //| //| """Construct an SPI object on the given pins. //| diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index f4f8746fe8..31a36a809d 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -44,7 +44,7 @@ //| class UART: //| """A bidirectional serial protocol""" -//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64): +//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None: //| """A common bidirectional serial protocol that uses an an agreed upon speed //| rather than a shared clock line. //| diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index 64e8701b75..e40ec3b64f 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -13,7 +13,7 @@ //| """Counter will keep track of the number of falling edge transistions (pulses) on a //| given pin""" //| -//| def __init__(self, pin_a: microcontroller.Pin): +//| def __init__(self, pin_a: microcontroller.Pin) -> None: //| """Create a Counter object associated with the given pin. It tracks the number of //| falling pulses relative when the object is constructed. //| diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index 21dc4dfed6..ffc65620e4 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -50,7 +50,7 @@ //| a pin, see the :py:class:`analogio.AnalogIn` and //| :py:class:`analogio.AnalogOut` classes.""" //| -//| def __init__(self, pin: microcontroller.Pin): +//| def __init__(self, pin: microcontroller.Pin) -> None: //| """Create a new DigitalInOut object associated with the pin. Defaults to input //| with no pull. Use :py:meth:`switch_to_input` and //| :py:meth:`switch_to_output` to change the direction. diff --git a/shared-bindings/digitalio/Direction.c b/shared-bindings/digitalio/Direction.c index 56e2a281c4..3798b3fa74 100644 --- a/shared-bindings/digitalio/Direction.c +++ b/shared-bindings/digitalio/Direction.c @@ -41,7 +41,7 @@ //| class Direction: //| """Defines the direction of a digital pin""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Enum-like class to define which direction the digital values are //| going.""" //| ... diff --git a/shared-bindings/digitalio/DriveMode.c b/shared-bindings/digitalio/DriveMode.c index d1d962d341..208143a2fa 100644 --- a/shared-bindings/digitalio/DriveMode.c +++ b/shared-bindings/digitalio/DriveMode.c @@ -29,7 +29,7 @@ //| class DriveMode: //| """Defines the drive mode of a digital pin""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Enum-like class to define the drive mode used when outputting //| digital values.""" //| ... diff --git a/shared-bindings/digitalio/Pull.c b/shared-bindings/digitalio/Pull.c index 46d12bf882..9656811c89 100644 --- a/shared-bindings/digitalio/Pull.c +++ b/shared-bindings/digitalio/Pull.c @@ -29,7 +29,7 @@ //| class Pull: //| """Defines the pull of a digital input pin""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Enum-like class to define the pull value, if any, used while reading //| digital values in.""" //| ... diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 9677b51f62..b2cda21536 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -39,7 +39,7 @@ //| class Bitmap: //| """Stores values of a certain size in a 2D array""" //| -//| def __init__(self, width: int, height: int, value_count: int): +//| def __init__(self, width: int, height: int, value_count: int) -> None: //| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to //| index into a corresponding palette. This enables differently colored sprites to share the //| underlying Bitmap. value_count is used to minimize the memory used to store the Bitmap. diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 6126c4194d..17eed1a9b1 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -39,7 +39,7 @@ //| class ColorConverter: //| """Converts one color format to another.""" //| -//| def __init__(self, *, dither: bool = False): +//| def __init__(self, *, dither: bool = False) -> None: //| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565 //| currently. //| :param bool dither: Adds random noise to dither the output image""" diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index e2e6488766..8d5fa87184 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum.""" //| -//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60): +//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None: //| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index b9f7dd9a1c..21eaf14daa 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False): +//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None: //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 7e53249244..83d260c0f6 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -42,7 +42,7 @@ //| """Manage updating a display over SPI four wire protocol in the background while Python code runs. //| It doesn't handle display initialization.""" //| -//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0): +//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None: //| """Create a FourWire object associated with the given pins. //| //| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 9d12ca1615..02915da644 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -38,7 +38,7 @@ //| class Group: //| """Manage a group of sprites and groups and how they are inter-related.""" //| -//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0): +//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0) -> None: //| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2 //| leads to a layer's pixel being 2x2 pixels when in the group. //| diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 7c1827db31..c8b6702a15 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -42,7 +42,7 @@ //| """Manage updating a display over I2C in the background while Python code runs. //| It doesn't handle display initialization.""" //| -//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None): +//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None) -> None: //| """Create a I2CDisplay object associated with the given I2C bus and reset pin. //| //| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index 0c6ca761c9..7e94a0401a 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -69,7 +69,7 @@ //| while True: //| pass""" //| -//| def __init__(self, file: file): +//| def __init__(self, file: file) -> None: //| """Create an OnDiskBitmap object with the given file. //| //| :param file file: The open bitmap file""" diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index a06dd38ff0..5418133e1e 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -46,7 +46,7 @@ //| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to //| save memory.""" //| -//| def __init__(self, color_count: int): +//| def __init__(self, color_count: int) -> None: //| """Create a Palette object to store a set number of colors. //| //| :param int color_count: The number of colors in the Palette""" diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index 247ac5dd50..30c9d373c8 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -42,7 +42,7 @@ //| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle //| display initialization.""" //| -//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin): +//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin) -> None: //| """Create a ParallelBus object associated with the given pins. The bus is inferred from data0 //| by implying the next 7 additional pins on a given GPIO port. //| diff --git a/shared-bindings/displayio/Shape.c b/shared-bindings/displayio/Shape.c index 258ac49021..4d737ecae2 100644 --- a/shared-bindings/displayio/Shape.c +++ b/shared-bindings/displayio/Shape.c @@ -37,7 +37,7 @@ //| class Shape: //| """Represents a shape made by defining boundaries that may be mirrored.""" //| -//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False): +//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False) -> None: //| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the //| column boundaries of the shape on each row. Each row's boundary defaults to the full row. //| diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index d3ad0f0fc9..348fcb4484 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -48,7 +48,7 @@ //| //| A single tile grid is also known as a Sprite.""" //| -//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0): +//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None: //| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to //| convert the value and its location to a display native pixel color. This may be a simple color //| palette lookup, a gradient, a pattern or a color transformer. diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 6d6a39818f..9e2f81c475 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -39,7 +39,7 @@ //| class BuiltinFont: //| """A font built into CircuitPython""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Creation not supported. Available fonts are defined when CircuitPython is built. See the //| `Adafruit_CircuitPython_Bitmap_Font `_ //| library for dynamically loaded fonts.""" diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 29e11638a0..737e0696f8 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -47,7 +47,7 @@ //| objects in CircuitPython, Display objects live until `displayio.release_displays()` //| is called. This is done so that CircuitPython can use the display itself.""" //| -//| def __init__(self, framebuffer: framebuffer, *, rotation: int = 0, auto_refresh: bool = True): +//| def __init__(self, framebuffer: framebuffer, *, rotation: int = 0, auto_refresh: bool = True) -> None: //| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc) //| //| :param framebuffer: The framebuffer that the display is connected to diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 1aed71f25c..5f99b166c7 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -46,7 +46,7 @@ //| //| FrequencyIn will not determine pulse width (use ``PulseIn``).""" //| -//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10): +//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10) -> None: //| """Create a FrequencyIn object associated with the given pin. //| //| :param ~microcontroller.Pin pin: Pin to read frequency from. diff --git a/shared-bindings/gamepad/GamePad.c b/shared-bindings/gamepad/GamePad.c index 8c0f58d0e8..f03a6cd33e 100644 --- a/shared-bindings/gamepad/GamePad.c +++ b/shared-bindings/gamepad/GamePad.c @@ -70,7 +70,7 @@ //| time.sleep(0.1)""" //| -//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut): +//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut) -> None: //| """Initializes button scanning routines. //| //| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which diff --git a/shared-bindings/gamepadshift/GamePadShift.c b/shared-bindings/gamepadshift/GamePadShift.c index f01c957046..e05a95865c 100644 --- a/shared-bindings/gamepadshift/GamePadShift.c +++ b/shared-bindings/gamepadshift/GamePadShift.c @@ -36,7 +36,7 @@ //| class GamePadShift: //| """Scan buttons for presses through a shift register""" //| -//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut): +//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut) -> None: //| """Initializes button scanning routines. //| //| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut`` diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 86bf3ca42c..0ecc1ac6a1 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -53,7 +53,7 @@ //| print("Longitude: {0:.6f} degrees".format(nav.longitude))""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Turn on the GNSS. //| //| :param gnss.SatelliteSystem system: satellite system to use""" diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 9d4c96fe0b..f2cd2b9fe3 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -29,7 +29,7 @@ //| class PositionFix: //| """Position fix mode""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Enum-like class to define the position fix mode.""" //| //| INVALID: PositionFix = ... diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index 3405021d47..2fd785f0a9 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -29,7 +29,7 @@ //| class SatelliteSystem: //| """Satellite system type""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Enum-like class to define the satellite system type.""" //| //| GPS: SatelliteSystem = ... diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c index 0a1c798abb..b528ca9c39 100644 --- a/shared-bindings/i2cperipheral/I2CPeripheral.c +++ b/shared-bindings/i2cperipheral/I2CPeripheral.c @@ -52,7 +52,7 @@ STATIC mp_obj_t mp_obj_new_i2cperipheral_i2c_peripheral_request(i2cperipheral_i2 //| class I2CPeripheral: //| """Two wire serial protocol peripheral""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False): +//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False) -> None: //| """I2C is a two-wire protocol for communicating between devices. //| This implements the peripheral (sensor, secondary) side. //| @@ -227,7 +227,7 @@ const mp_obj_type_t i2cperipheral_i2c_peripheral_type = { //| class I2CPeripheralRequest: //| -//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool): +//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool) -> None: //| """Information about an I2C transfer request //| This cannot be instantiated directly, but is returned by :py:meth:`I2CPeripheral.request`. //| diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index f53949d85b..931c0b4c45 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -36,7 +36,7 @@ //| class Pin: //| """Identifies an IO pin on the microcontroller.""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Identifies an IO pin on the microcontroller. They are fixed by the //| hardware so they cannot be constructed on demand. Instead, use //| `board` or `microcontroller.pin` to reference the desired pin.""" diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 32ec4f2e79..d9f780f846 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -44,7 +44,7 @@ //| print(microcontroller.cpu.temperature)""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """You cannot create an instance of `microcontroller.Processor`. //| Use `microcontroller.cpu` to access the sole instance available.""" //| ... diff --git a/shared-bindings/microcontroller/RunMode.c b/shared-bindings/microcontroller/RunMode.c index f133c34b14..38bbb612b0 100644 --- a/shared-bindings/microcontroller/RunMode.c +++ b/shared-bindings/microcontroller/RunMode.c @@ -29,7 +29,7 @@ //| class RunMode: //| """run state of the microcontroller""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Enum-like class to define the run mode of the microcontroller and //| CircuitPython.""" //| diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index 6f282d6973..278ac4d739 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -44,7 +44,7 @@ //| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\"""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" //| ... //| diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index a7f1d9da5f..15731ea404 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -45,7 +45,7 @@ //| level converters must be used to connect the I/O lines to pins //| of 3.3V boards.""" //| -//| def __init__(self, data_pin: microcontroller.Pin, clock_pin: microcontroller.Pin): +//| def __init__(self, data_pin: microcontroller.Pin, clock_pin: microcontroller.Pin) -> None: //| """Create a Ps2 object associated with the given pins. //| //| :param ~microcontroller.Pin data_pin: Pin tied to data wire. diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index 862a500bf6..e3aa43a31a 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -38,7 +38,7 @@ //| class PWMOut: //| """Output a Pulse Width Modulated signal on a given pin.""" //| -//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False): +//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False) -> None: //| """Create a PWM object associated with the given pin. This allows you to //| write PWM signals out on the given pin. Frequency is fixed after init //| unless ``variable_frequency`` is True. diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 75ea1a80e3..4bcff06ee2 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -40,7 +40,7 @@ //| and low cost temperature sensors (DHT). The pulsed signal consists of timed active and //| idle periods. Unlike PWM, there is no set duration for active and idle pairs.""" //| -//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False): +//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False) -> None: //| """Create a PulseIn object associated with the given pin. The object acts as //| a read-only sequence of pulse lengths with a given max length. When it is //| active, new pulse lengths are added to the end of the list. When there is diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index dfed6d3049..9e2d687449 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -41,7 +41,7 @@ //| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration //| for on and off pairs.""" //| -//| def __init__(self, carrier: pulseio.PWMOut): +//| def __init__(self, carrier: pulseio.PWMOut) -> None: //| """Create a PulseOut object associated with the given PWMout object. //| //| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin. diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 0099d9f0c5..e04336351d 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0): +//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None: //| """Create a RGBMatrix object with the given attributes. The height of //| the display is determined by the number of rgb and address pins: //| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4 diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 201336266a..37c4ee324e 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -37,7 +37,7 @@ //| class IncrementalEncoder: //| """IncrementalEncoder determines the relative rotational position based on two series of pulses.""" //| -//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin): +//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin) -> None: //| """Create an IncrementalEncoder object associated with the given pins. It tracks the positional //| state of an incremental rotary encoder (also known as a quadrature encoder.) Position is //| relative to the position when the object is contructed. diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index 009256176b..f6d1e06c4c 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -41,7 +41,7 @@ const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}}; //| class RTC: //| """Real Time Clock""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance.""" //| ... //| diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 6b32bb1c11..7f53f741dd 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -44,7 +44,7 @@ //| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used //| with ``storage.VfsFat`` to allow file I/O to an SD card.""" //| -//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000): +//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000) -> None: //| """Construct an SPI SD Card object with the given properties //| //| :param busio.SPI spi: The SPI bus diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 8890c1f3cc..94ba1c3871 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -49,7 +49,7 @@ //| 25MHz. Usually an SDCard object is used with ``storage.VfsFat`` //| to allow file I/O to an SD card.""" //| -//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int): +//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int) -> None: //| """Construct an SDIO SD Card object with the given properties //| //| :param ~microcontroller.Pin clock: the pin to use for the clock. diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 10a56ef407..985104d553 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -46,7 +46,7 @@ STATIC const mp_obj_type_t socket_type; //| class socket: //| -//| def __init__(self, family: int, type: int, proto: int): +//| def __init__(self, family: int, type: int, proto: int) -> None: //| """Create a new socket //| //| :param ~int family: AF_INET or AF_INET6 diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 3abc5512c9..0a34ef74e9 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -168,7 +168,7 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) }, //| class VfsFat: -//| def __init__(self, block_device: Any): +//| def __init__(self, block_device: Any) -> None: //| """Create a new VfsFat filesystem around the given block device. //| //| :param block_device: Block device the the filesystem lives on""" diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c index 43310dd2a5..623b99e096 100644 --- a/shared-bindings/terminalio/Terminal.c +++ b/shared-bindings/terminalio/Terminal.c @@ -40,7 +40,7 @@ //| class Terminal: //| """Display a character stream with a TileGrid""" //| -//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont): +//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont) -> None: //| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be //| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap.""" //| ... diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 531980effc..9b68bdd8d0 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -93,7 +93,7 @@ mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp } //| class struct_time: -//| def __init__(self, time_tuple: Any): +//| def __init__(self, time_tuple: Any) -> None: //| """Structure used to capture a date and time. Note that it takes a tuple! //| //| :param tuple time_tuple: Tuple of time info: ``(tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)`` diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 50ca952ce8..d63db4ba13 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -52,7 +52,7 @@ //| print("touched!")""" //| -//| def __init__(self, pin: microcontroller.Pin): +//| def __init__(self, pin: microcontroller.Pin) -> None: //| """Use the TouchIn on the given pin. //| //| :param ~microcontroller.Pin pin: the pin to read from""" diff --git a/shared-bindings/ulab/__init__.pyi b/shared-bindings/ulab/__init__.pyi index e5de1391b6..03bfe36108 100644 --- a/shared-bindings/ulab/__init__.pyi +++ b/shared-bindings/ulab/__init__.pyi @@ -17,7 +17,7 @@ https://docs.scipy.org/doc/numpy/index.html""" class array: """1- and 2- dimensional array""" - def __init__(self, values, *, dtype=float): + def __init__(self, values, *, dtype=float) -> None: """:param sequence values: Sequence giving the initial content of the array. :param dtype: The type of array values, ``int8``, ``uint8``, ``int16``, ``uint16``, or ``float`` diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index 62c4f98e8d..5b26a94c43 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -38,7 +38,7 @@ //| class PortIn: //| """Receives midi commands over USB""" //| -//| def __init__(self): +//| def __init__(self) -> None: //| """You cannot create an instance of `usb_midi.PortIn`. //| //| PortIn objects are constructed for every corresponding entry in the USB diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 65923fd96a..7b010591d2 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -11,7 +11,7 @@ //| class Circle: //| -//| def __init__(self, radius: int): +//| def __init__(self, radius: int) -> None: //| """Circle is positioned on screen by its center point. //| //| :param radius: The radius of the circle in pixels""" diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 3443d9e426..486619eaeb 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -18,7 +18,7 @@ //| from typing import List, Tuple //| //| class Polygon: -//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ): +//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ) -> None: //| """Represents a closed shape by ordered vertices //| //| :param points: Vertices for the polygon""" diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index f04a25c35a..9a637f317c 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -8,7 +8,7 @@ #include "supervisor/shared/translate.h" //| class Rectangle: -//| def __init__(self, width: int, height: int): +//| def __init__(self, width: int, height: int) -> None: //| """Represents a rectangle by defining its bounds //| //| :param width: The number of pixels wide diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index c512bcd546..d1042b1c63 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -20,7 +20,7 @@ //| class VectorShape: -//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0): +//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None: //| """Binds a vector shape to a location and pixel color //| //| :param shape: The shape to draw. diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index 90bd9ac2c7..a58ac5b502 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -49,7 +49,7 @@ //| class WIZNET5K: //| """Wrapper for Wiznet 5500 Ethernet interface""" //| -//| def __init__(self, spi: busio.SPI, cs: microcontroller.Pin, rst: microcontroller.Pin, dhcp: bool = True): +//| def __init__(self, spi: busio.SPI, cs: microcontroller.Pin, rst: microcontroller.Pin, dhcp: bool = True) -> None: //| """Create a new WIZNET5500 interface using the specified pins //| //| :param ~busio.SPI spi: spi bus to use From f56deb60c6b14af0e8639ba0e9a3ea742236f83a Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 14:48:16 -0400 Subject: [PATCH 117/277] Added type hints to _eve --- shared-bindings/_eve/__init__.c | 94 ++++++++++++++++----------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index e4ba77ed43..dd7f6f8bd1 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -70,7 +70,7 @@ STATIC mp_obj_t _flush(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush); -//| def cc(self, b: bytes) -> Any: +//| def cc(self, b: bytes) -> None: //| """Append bytes to the command FIFO. //| //| :param bytes b: The bytes to add""" @@ -86,7 +86,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc); //{ -//| def AlphaFunc(self, func: int, ref: int) -> Any: +//| def AlphaFunc(self, func: int, ref: int) -> None: //| """Set the alpha test function //| //| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7) @@ -104,7 +104,7 @@ STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc); -//| def Begin(self, prim: int) -> Any: +//| def Begin(self, prim: int) -> None: //| """Begin drawing a graphics primitive //| //| :param int prim: graphics primitive. @@ -120,7 +120,7 @@ STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin); -//| def BitmapExtFormat(self, format: int) -> Any: +//| def BitmapExtFormat(self, format: int) -> None: //| """Set the bitmap format //| //| :param int format: bitmap pixel format.""" @@ -134,7 +134,7 @@ STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat); -//| def BitmapHandle(self, handle: int) -> Any: +//| def BitmapHandle(self, handle: int) -> None: //| """Set the bitmap handle //| //| :param int handle: bitmap handle. Range 0-31. The initial value is 0 @@ -150,7 +150,7 @@ STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle); -//| def BitmapLayoutH(self, linestride: int, height: int) -> Any: +//| def BitmapLayoutH(self, linestride: int, height: int) -> None: //| """Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps //| //| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7 @@ -166,7 +166,7 @@ STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth); -//| def BitmapLayout(self, format: int, linestride: int, height: int) -> Any: +//| def BitmapLayout(self, format: int, linestride: int, height: int) -> None: //| """Set the source bitmap memory format and layout for the current handle //| //| :param int format: bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31 @@ -184,7 +184,7 @@ STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout); -//| def BitmapSizeH(self, width: int, height: int) -> Any: +//| def BitmapSizeH(self, width: int, height: int) -> None: //| """Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps //| //| :param int width: high part of drawn bitmap width, in pixels. Range 0-3 @@ -200,7 +200,7 @@ STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh); -//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> Any: +//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> None: //| """Set the screen drawing of bitmaps for the current handle //| //| :param int filter: bitmap filtering mode, one of ``NEAREST`` or ``BILINEAR``. Range 0-1 @@ -222,7 +222,7 @@ STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize); -//| def BitmapSource(self, addr: int) -> Any: +//| def BitmapSource(self, addr: int) -> None: //| """Set the source address for bitmap graphics //| //| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215""" @@ -236,7 +236,7 @@ STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource); -//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> Any: +//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> None: //| """Set the source for the r,g,b and a channels of a bitmap //| //| :param int r: red component source channel. Range 0-7 @@ -256,7 +256,7 @@ STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizzle); -//| def BitmapTransformA(self, p: Any, v: int) -> Any: +//| def BitmapTransformA(self, p: int, v: int) -> None: //| """Set the :math:`a` component of the bitmap transform matrix //| //| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0 @@ -276,7 +276,7 @@ STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma); -//| def BitmapTransformB(self, p: Any, v: int) -> Any: +//| def BitmapTransformB(self, p: int, v: int) -> None: //| """Set the :math:`b` component of the bitmap transform matrix //| //| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0 @@ -296,7 +296,7 @@ STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb); -//| def BitmapTransformC(self, v: int) -> Any: +//| def BitmapTransformC(self, v: int) -> None: //| """Set the :math:`c` component of the bitmap transform matrix //| //| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 @@ -312,7 +312,7 @@ STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc); -//| def BitmapTransformD(self, p: Any, v: int) -> Any: +//| def BitmapTransformD(self, p: int, v: int) -> None: //| """Set the :math:`d` component of the bitmap transform matrix //| //| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0 @@ -332,7 +332,7 @@ STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd); -//| def BitmapTransformE(self, p: Any, v: int) -> Any: +//| def BitmapTransformE(self, p: int, v: int) -> None: //| """Set the :math:`e` component of the bitmap transform matrix //| //| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0 @@ -352,7 +352,7 @@ STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme); -//| def BitmapTransformF(self, v: int) -> Any: +//| def BitmapTransformF(self, v: int) -> None: //| """Set the :math:`f` component of the bitmap transform matrix //| //| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 @@ -368,7 +368,7 @@ STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf); -//| def BlendFunc(self, src: int, dst: int) -> Any: +//| def BlendFunc(self, src: int, dst: int) -> None: //| """Set pixel arithmetic //| //| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2) @@ -386,7 +386,7 @@ STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc); -//| def Call(self, dest: int) -> Any: +//| def Call(self, dest: int) -> None: //| """Execute a sequence of commands at another location in the display list //| //| :param int dest: display list address. Range 0-65535""" @@ -400,7 +400,7 @@ STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call); -//| def Cell(self, cell: int) -> Any: +//| def Cell(self, cell: int) -> None: //| """Set the bitmap cell number for the vertex2f command //| //| :param int cell: bitmap cell number. Range 0-127. The initial value is 0 @@ -416,7 +416,7 @@ STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell); -//| def ClearColorA(self, alpha: int) -> Any: +//| def ClearColorA(self, alpha: int) -> None: //| """Set clear value for the alpha channel //| //| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0 @@ -432,7 +432,7 @@ STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora); -//| def ClearColorRGB(self, red: int, green: int, blue: int) -> Any: +//| def ClearColorRGB(self, red: int, green: int, blue: int) -> None: //| """Set clear values for red, green and blue channels //| //| :param int red: red value used when the color buffer is cleared. Range 0-255. The initial value is 0 @@ -452,7 +452,7 @@ STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorrgb); -//| def Clear(self, c: int, s: int, t: int) -> Any: +//| def Clear(self, c: int, s: int, t: int) -> None: //| """Clear buffers to preset values //| //| :param int c: clear color buffer. Range 0-1 @@ -470,7 +470,7 @@ STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear); -//| def ClearStencil(self, s: int) -> Any: +//| def ClearStencil(self, s: int) -> None: //| """Set clear value for the stencil buffer //| //| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0 @@ -486,7 +486,7 @@ STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil); -//| def ClearTag(self, s: int) -> Any: +//| def ClearTag(self, s: int) -> None: //| """Set clear value for the tag buffer //| //| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0 @@ -501,7 +501,7 @@ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag); -//| def ColorA(self, alpha: int) -> Any: +//| def ColorA(self, alpha: int) -> None: //| """Set the current color alpha //| //| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255 @@ -517,7 +517,7 @@ STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora); -//| def ColorMask(self, r: int, g: int, b: int, a: int) -> Any: +//| def ColorMask(self, r: int, g: int, b: int, a: int) -> None: //| """Enable and disable writing of frame buffer color components //| //| :param int r: allow updates to the frame buffer red component. Range 0-1. The initial value is 1 @@ -539,7 +539,7 @@ STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask); -//| def ColorRGB(self, red: int, green: int, blue: int) -> Any: +//| def ColorRGB(self, red: int, green: int, blue: int) -> None: //| """Set the drawing color //| //| :param int red: red value for the current color. Range 0-255. The initial value is 255 @@ -584,7 +584,7 @@ STATIC mp_obj_t _end(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end); -//| def Jump(self, dest: int) -> Any: +//| def Jump(self, dest: int) -> None: //| """Execute commands at another location in the display list //| //| :param int dest: display list address. Range 0-65535""" @@ -598,7 +598,7 @@ STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump); -//| def LineWidth(self, width: int) -> Any: +//| def LineWidth(self, width: int) -> None: //| """Set the width of rasterized lines //| //| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16 @@ -614,7 +614,7 @@ STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); -//| def Macro(self, m: int) -> Any: +//| def Macro(self, m: int) -> None: //| """Execute a single command from a macro register //| //| :param int m: macro register to read. Range 0-1""" @@ -640,7 +640,7 @@ STATIC mp_obj_t _nop(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop); -//| def PaletteSource(self, addr: int) -> Any: +//| def PaletteSource(self, addr: int) -> None: //| """Set the base address of the palette //| //| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0 @@ -656,7 +656,7 @@ STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource); -//| def PointSize(self, size: int) -> Any: +//| def PointSize(self, size: int) -> None: //| """Set the radius of rasterized points //| //| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16 @@ -708,7 +708,7 @@ STATIC mp_obj_t _savecontext(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext); -//| def ScissorSize(self, width: int, height: int) -> Any: +//| def ScissorSize(self, width: int, height: int) -> None: //| """Set the size of the scissor clip rectangle //| //| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize @@ -726,7 +726,7 @@ STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize); -//| def ScissorXY(self, x: int, y: int) -> Any: +//| def ScissorXY(self, x: int, y: int) -> None: //| """Set the top left corner of the scissor clip rectangle //| //| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 @@ -744,7 +744,7 @@ STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy); -//| def StencilFunc(self, func: int, ref: int, mask: int) -> Any: +//| def StencilFunc(self, func: int, ref: int, mask: int) -> None: //| """Set function and reference value for stencil testing //| //| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7) @@ -764,7 +764,7 @@ STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc); -//| def StencilMask(self, mask: int) -> Any: +//| def StencilMask(self, mask: int) -> None: //| """Control the writing of individual bits in the stencil planes //| //| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255 @@ -780,7 +780,7 @@ STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask); -//| def StencilOp(self, sfail: int, spass: int) -> Any: +//| def StencilOp(self, sfail: int, spass: int) -> None: //| """Set stencil test actions //| //| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1) @@ -798,7 +798,7 @@ STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { } STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop); -//| def TagMask(self, mask: int) -> Any: +//| def TagMask(self, mask: int) -> None: //| """Control the writing of the tag buffer //| //| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1 @@ -814,7 +814,7 @@ STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask); -//| def Tag(self, s: int) -> Any: +//| def Tag(self, s: int) -> None: //| """Set the current tag value //| //| :param int s: tag value. Range 0-255. The initial value is 255 @@ -830,7 +830,7 @@ STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag); -//| def VertexTranslateX(self, x: int) -> Any: +//| def VertexTranslateX(self, x: int) -> None: //| """Set the vertex transformation's x translation component //| //| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0 @@ -846,7 +846,7 @@ STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); -//| def VertexTranslateY(self, y: int) -> Any: +//| def VertexTranslateY(self, y: int) -> None: //| """Set the vertex transformation's y translation component //| //| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0 @@ -863,7 +863,7 @@ STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); -//| def VertexFormat(self, frac: int) -> Any: +//| def VertexFormat(self, frac: int) -> None: //| """Set the precision of vertex2f coordinates //| //| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 @@ -879,7 +879,7 @@ STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat); -//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> Any: +//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> None: //| """:param int x: x-coordinate in pixels. Range 0-511 //| :param int y: y-coordinate in pixels. Range 0-511 //| :param int handle: bitmap handle. Range 0-31 @@ -954,7 +954,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii); // Hand-written functions { -//| def Vertex2f(self, b: Any) -> Any: +//| def Vertex2f(self, b: float) -> None: //| """Draw a point. //| //| :param float x: pixel x-coordinate @@ -973,7 +973,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); #define ADD_X(self, x) \ common_hal__eve_add(EVEHAL(self), sizeof(x), &(x)); -//| def cmd0(self, n: int) -> Any: +//| def cmd0(self, n: int) -> None: //| """Append the command word n to the FIFO //| //| :param int n: The command code @@ -990,7 +990,7 @@ STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0); -//| def cmd(self, n: int, fmt: str, args: tuple) -> Any: +//| def cmd(self, n: int, fmt: str, args: tuple) -> None: //| """Append a command packet to the FIFO. //| //| :param int n: The command code From 591cc1a24350e52a9a46204219f8aa647ec7f9d8 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:04:43 -0400 Subject: [PATCH 118/277] Added type hints to math --- shared-bindings/math/__init__.c | 78 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 8226a08ecb..c76fe7e01e 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -79,108 +79,108 @@ STATIC NORETURN void math_error(void) { #define log2(x) (log(x) * 1.442695040888963407354163704) #endif -//| e: Any = ... +//| e: float = ... //| """base of the natural logarithm""" //| -//| pi: Any = ... +//| pi: float = ... //| """the ratio of a circle's circumference to its diameter""" //| -//| def acos(x: Any) -> Any: +//| def acos(x: float) -> float: //| """Return the inverse cosine of ``x``.""" //| ... //| -//| def asin(x: Any) -> Any: +//| def asin(x: float) -> float: //| """Return the inverse sine of ``x``.""" //| ... //| -//| def atan(x: Any) -> Any: +//| def atan(x: float) -> float: //| """Return the inverse tangent of ``x``.""" //| ... //| -//| def atan2(y: Any, x: Any) -> Any: +//| def atan2(y: float, x: float) -> float: //| """Return the principal value of the inverse tangent of ``y/x``.""" //| ... //| -//| def ceil(x: Any) -> Any: +//| def ceil(x: float) -> int: //| """Return an integer, being ``x`` rounded towards positive infinity.""" //| ... //| -//| def copysign(x: Any, y: Any) -> Any: +//| def copysign(x: float, y: float) -> float: //| """Return ``x`` with the sign of ``y``.""" //| ... //| -//| def cos(x: Any) -> Any: +//| def cos(x: float) -> float: //| """Return the cosine of ``x``.""" //| ... //| -//| def degrees(x: Any) -> Any: +//| def degrees(x: float) -> float: //| """Return radians ``x`` converted to degrees.""" //| ... //| -//| def exp(x: Any) -> Any: +//| def exp(x: float) -> float: //| """Return the exponential of ``x``.""" //| ... //| -//| def fabs(x: Any) -> Any: +//| def fabs(x: float) -> float: //| """Return the absolute value of ``x``.""" //| ... //| -//| def floor(x: Any) -> Any: +//| def floor(x: float) -> float: //| """Return an integer, being ``x`` rounded towards negative infinity.""" //| ... //| -//| def fmod(x: Any, y: Any) -> Any: +//| def fmod(x: float, y: float) -> int: //| """Return the remainder of ``x/y``.""" //| ... //| -//| def frexp(x: Any) -> Any: +//| def frexp(x: float) -> Tuple[int, int]: //| """Decomposes a floating-point number into its mantissa and exponent. //| The returned value is the tuple ``(m, e)`` such that ``x == m * 2**e`` //| exactly. If ``x == 0`` then the function returns ``(0.0, 0)``, otherwise //| the relation ``0.5 <= abs(m) < 1`` holds.""" //| ... //| -//| def isfinite(x: Any) -> Any: +//| def isfinite(x: float) -> bool: //| """Return ``True`` if ``x`` is finite.""" //| ... //| -//| def isinf(x: Any) -> Any: +//| def isinf(x: float) -> bool: //| """Return ``True`` if ``x`` is infinite.""" //| ... //| -//| def isnan(x: Any) -> Any: +//| def isnan(x: float) -> bool: //| """Return ``True`` if ``x`` is not-a-number""" //| ... //| -//| def ldexp(x: Any, exp: Any) -> Any: +//| def ldexp(x: float, exp: float) -> float: //| """Return ``x * (2**exp)``.""" //| ... //| -//| def modf(x: Any) -> Any: +//| def modf(x: float) -> Tuple[float, float]: //| """Return a tuple of two floats, being the fractional and integral parts of //| ``x``. Both return values have the same sign as ``x``.""" //| ... //| -//| def pow(x: Any, y: Any) -> Any: +//| def pow(x: float, y: float) -> float: //| """Returns ``x`` to the power of ``y``.""" //| -//| def radians(x: Any) -> Any: +//| def radians(x: float) -> float: //| """Return degrees ``x`` converted to radians.""" //| -//| def sin(x: Any) -> Any: +//| def sin(x: float) -> float: //| """Return the sine of ``x``.""" //| ... //| -//| def sqrt(x: Any) -> Any: +//| def sqrt(x: float) -> float: //| """Returns the square root of ``x``.""" //| ... //| -//| def tan(x: Any) -> Any: +//| def tan(x: float) -> float: //| """Return the tangent of ``x``.""" //| ... //| -//| def trunc(x: Any) -> Any: +//| def trunc(x: float) -> int: //| """Return an integer, being ``x`` rounded towards 0.""" //| ... //| @@ -190,55 +190,55 @@ MATH_FUN_2(pow, pow) MATH_FUN_1(exp, exp) #if MICROPY_PY_MATH_SPECIAL_FUNCTIONS -//| def expm1(x): +//| def expm1(x: float) -> float: //| """Return ``exp(x) - 1``.""" //| ... //| MATH_FUN_1(expm1, expm1) -//| def log2(x): +//| def log2(x: float) -> float: //| """Return the base-2 logarithm of ``x``.""" //| ... //| MATH_FUN_1_ERRCOND(log2, log2, (x <= (mp_float_t)0.0)) -//| def log10(x): +//| def log10(x: float) -> float: //| """Return the base-10 logarithm of ``x``.""" //| ... //| MATH_FUN_1_ERRCOND(log10, log10, (x <= (mp_float_t)0.0)) -//| def cosh(x): +//| def cosh(x: float) -> float: //| """Return the hyperbolic cosine of ``x``.""" //| ... //| MATH_FUN_1(cosh, cosh) -//| def sinh(x): +//| def sinh(x: float) -> float: //| """Return the hyperbolic sine of ``x``.""" //| ... //| MATH_FUN_1(sinh, sinh) -//| def tanh(x): +//| def tanh(x: float) -> float: //| """Return the hyperbolic tangent of ``x``.""" //| ... //| MATH_FUN_1(tanh, tanh) -//| def acosh(x): +//| def acosh(x: float) -> float: //| """Return the inverse hyperbolic cosine of ``x``.""" //| ... //| MATH_FUN_1(acosh, acosh) -//| def asinh(x): +//| def asinh(x: float) -> float: //| """Return the inverse hyperbolic sine of ``x``.""" //| ... //| MATH_FUN_1(asinh, asinh) -//| def atanh(x): +//| def atanh(x: float) -> float: //| """Return the inverse hyperbolic tangent of ``x``.""" //| ... //| @@ -280,25 +280,25 @@ MATH_FUN_1_TO_INT(trunc, trunc) MATH_FUN_2(ldexp, ldexp) #if MICROPY_PY_MATH_SPECIAL_FUNCTIONS -//| def erf(x): +//| def erf(x: float) -> float: //| """Return the error function of ``x``.""" //| ... //| MATH_FUN_1(erf, erf) -//| def erfc(x): +//| def erfc(x: float) -> float: //| """Return the complementary error function of ``x``.""" //| ... //| MATH_FUN_1(erfc, erfc) -//| def gamma(x): +//| def gamma(x: float) -> float: //| """Return the gamma function of ``x``.""" //| ... //| MATH_FUN_1(gamma, tgamma) -//| def lgamma(x): +//| def lgamma(x: float) -> float: //| """Return the natural logarithm of the gamma function of ``x``.""" //| ... //| From 9122d0b9f41181ac726781fc4238ca5212415a75 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:08:16 -0400 Subject: [PATCH 119/277] Added type hints to multiterminal --- shared-bindings/multiterminal/__init__.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/multiterminal/__init__.c b/shared-bindings/multiterminal/__init__.c index baf2fb6749..e4d6768ada 100644 --- a/shared-bindings/multiterminal/__init__.c +++ b/shared-bindings/multiterminal/__init__.c @@ -37,7 +37,7 @@ //| serial connection and the optional secondary connection.""" //| -//| def get_secondary_terminal() -> Any: +//| def get_secondary_terminal() -> secondary_terminal: //| """Returns the current secondary terminal.""" //| ... //| @@ -46,7 +46,7 @@ STATIC mp_obj_t multiterminal_obj_get_secondary_terminal() { } MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal); -//| def set_secondary_terminal(stream: stream) -> Any: +//| def set_secondary_terminal(stream: stream) -> None: //| """Read additional input from the given stream and write out back to it. //| This doesn't replace the core stream (usually UART or native USB) but is //| mixed in instead. @@ -68,7 +68,7 @@ STATIC mp_obj_t multiterminal_obj_set_secondary_terminal(mp_obj_t secondary_term } MP_DEFINE_CONST_FUN_OBJ_1(multiterminal_set_secondary_terminal_obj, multiterminal_obj_set_secondary_terminal); -//| def clear_secondary_terminal() -> Any: +//| def clear_secondary_terminal() -> None: //| """Clears the secondary terminal.""" //| ... //| @@ -78,7 +78,7 @@ STATIC mp_obj_t multiterminal_obj_clear_secondary_terminal() { } MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_clear_secondary_terminal_obj, multiterminal_obj_clear_secondary_terminal); -//| def schedule_secondary_terminal_read(socket: Any) -> Any: +//| def schedule_secondary_terminal_read(socket: secondary_terminal) -> None: //| """In cases where the underlying OS is doing task scheduling, this notifies //| the OS when more data is available on the socket to read. This is useful //| as a callback for lwip sockets.""" From aaa550b33e7f9e7068deb60d1864f5bab00fb06f Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:10:56 -0400 Subject: [PATCH 120/277] Added type hints to network --- shared-bindings/network/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/network/__init__.c b/shared-bindings/network/__init__.c index 6af86688eb..10255ee86e 100644 --- a/shared-bindings/network/__init__.c +++ b/shared-bindings/network/__init__.c @@ -44,7 +44,7 @@ //| It is used by the 'socket' module to look up a suitable //| NIC when a socket is created.""" //| -//| def route() -> Any: +//| def route() -> list: //| """Returns a list of all configured NICs.""" //| ... //| From e237dfe3c5dc455c2236e530e4d64438c7c52a18 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:18:44 -0400 Subject: [PATCH 121/277] Added type hints to os --- shared-bindings/os/__init__.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 4e991d089d..268bf345e2 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -44,7 +44,7 @@ //| other way around.""" //| -//| def uname() -> Any: +//| def uname() -> tuple: //| """Returns a named tuple of operating specific and CircuitPython port //| specific information.""" //| ... @@ -54,7 +54,7 @@ STATIC mp_obj_t os_uname(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); -//| def chdir(path: Any) -> Any: +//| def chdir(path: string) -> None: //| """Change current directory.""" //| ... //| @@ -65,7 +65,7 @@ mp_obj_t os_chdir(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir); -//| def getcwd() -> Any: +//| def getcwd() -> string: //| """Get the current directory.""" //| ... //| @@ -74,7 +74,7 @@ mp_obj_t os_getcwd(void) { } MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); -//| def listdir(dir: Any) -> Any: +//| def listdir(dir: string) -> string: //| """With no argument, list the current directory. Otherwise list the given directory.""" //| ... //| @@ -89,7 +89,7 @@ mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir); -//| def mkdir(path: Any) -> Any: +//| def mkdir(path: string) -> None: //| """Create a new directory.""" //| ... //| @@ -100,7 +100,7 @@ mp_obj_t os_mkdir(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir); -//| def remove(path: Any) -> Any: +//| def remove(path: string) -> None: //| """Remove a file.""" //| ... //| @@ -111,7 +111,7 @@ mp_obj_t os_remove(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove); -//| def rmdir(path: Any) -> Any: +//| def rmdir(path: string) -> None: //| """Remove a directory.""" //| ... //| @@ -123,7 +123,7 @@ mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { } MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename); -//| def rename(old_path: Any, new_path: Any) -> Any: +//| def rename(old_path: string, new_path: string) -> string: //| """Rename a file.""" //| ... //| @@ -134,7 +134,7 @@ mp_obj_t os_rmdir(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir); -//| def stat(path: Any) -> Any: +//| def stat(path: string) -> string: //| """Get the status of a file or directory. //| //| .. note:: On builds without long integers, the number of seconds @@ -149,7 +149,7 @@ mp_obj_t os_stat(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); -//| def statvfs(path: Any) -> Any: +//| def statvfs(path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]: //| """Get the status of a fileystem. //| //| Returns a tuple with the filesystem information in the following order: @@ -176,7 +176,7 @@ mp_obj_t os_statvfs(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_statvfs_obj, os_statvfs); -//| def sync() -> Any: +//| def sync() -> None: //| """Sync all filesystems.""" //| ... //| @@ -189,7 +189,7 @@ STATIC mp_obj_t os_sync(void) { } MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync); -//| def urandom(size: Any) -> Any: +//| def urandom(size: int) -> string: //| """Returns a string of *size* random bytes based on a hardware True Random //| Number Generator. When not available, it will raise a NotImplementedError.""" //| ... From 97d405e1094ac4d9e34ca155ecebf45ff1ad0f40 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:25:58 -0400 Subject: [PATCH 122/277] Added type hints to random --- shared-bindings/random/__init__.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index c0124df417..10ddca4991 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -47,7 +47,7 @@ //| bytes from `os.urandom` directly for true randomness.""" //| -//| def seed(seed: Any) -> Any: +//| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to //| `random` will return deterministic results afterwards.""" //| ... @@ -59,7 +59,7 @@ STATIC mp_obj_t random_seed(mp_obj_t seed_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_seed_obj, random_seed); -//| def getrandbits(k: Any) -> Any: +//| def getrandbits(k: int) -> int: //| """Returns an integer with *k* random bits.""" //| ... //| @@ -72,7 +72,7 @@ STATIC mp_obj_t random_getrandbits(mp_obj_t num_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_getrandbits_obj, random_getrandbits); -//| def randrange(stop: Any) -> Any: +//| def randrange(stop: Tuple[int, int, int]) -> int: //| """Returns a randomly selected integer from ``range(start, stop, step)``.""" //| ... //| @@ -114,7 +114,7 @@ STATIC mp_obj_t random_randrange(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(random_randrange_obj, 1, 3, random_randrange); -//| def randint(a: Any, b: Any) -> Any: +//| def randint(a: int, b: int) -> int: //| """Returns a randomly selected integer between a and b inclusive. Equivalent //| to ``randrange(a, b + 1, 1)``""" //| ... @@ -129,7 +129,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(random_randint_obj, random_randint); -//| def choice(seq: Any) -> Any: +//| def choice(seq: list) -> Any: //| """Returns a randomly selected element from the given sequence. Raises //| IndexError when the sequence is empty.""" //| ... @@ -143,7 +143,7 @@ STATIC mp_obj_t random_choice(mp_obj_t seq) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_choice_obj, random_choice); -//| def random() -> Any: +//| def random() -> float: //| """Returns a random float between 0 and 1.0.""" //| ... //| @@ -152,7 +152,7 @@ STATIC mp_obj_t random_random(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(random_random_obj, random_random); -//| def uniform(a: Any, b: Any) -> Any: +//| def uniform(a: float, b: float) -> float: //| """Returns a random float between a and b. It may or may not be inclusive //| depending on float rounding.""" //| ... From a88004e509985da055a5837a42e42a37e5cfd371 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:27:11 -0400 Subject: [PATCH 123/277] Added type hints to rtc --- shared-bindings/rtc/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index b204d511c9..02b9beba66 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -50,7 +50,7 @@ mp_obj_t rtc_get_time_source_time(void) { return struct_time_from_tm(&tm); } -//| def set_time_source(rtc: Any) -> Any: +//| def set_time_source(rtc: RTC) -> None: //| """Sets the RTC time source used by :func:`time.localtime`. //| The default is :class:`rtc.RTC`, but it's useful to use this to override the //| time source for testing purposes. For example:: From 45b6e0174e386ad8bd6c0180a3e406f6c21f87d7 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:38:40 -0400 Subject: [PATCH 124/277] Added type hints to storage --- shared-bindings/storage/__init__.c | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 0a34ef74e9..5ca124892a 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -43,7 +43,7 @@ //| directly.""" //| -//| def mount(filesystem: Any, mount_path: Any, *, readonly: bool = False) -> Any: +//| def mount(filesystem: VfsFat, mount_path: string, *, readonly: bool = False) -> None: //| """Mounts the given filesystem object at the given path. //| //| This is the CircuitPython analog to the UNIX ``mount`` command. @@ -80,7 +80,7 @@ mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg } MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount); -//| def umount(mount: Any) -> Any: +//| def umount(mount: Union[string, VfsFat]) -> None: //| """Unmounts the given filesystem object or if *mount* is a path, then unmount //| the filesystem mounted at that location. //| @@ -98,7 +98,7 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount); -//| def remount(mount_path: Any, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> Any: +//| def remount(mount_path: string, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None: //| """Remounts the given path with new parameters. //| //| :param bool readonly: True when the filesystem should be readonly to CircuitPython. @@ -128,7 +128,7 @@ mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a } MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount); -//| def getmount(mount_path: Any) -> Any: +//| def getmount(mount_path: string) -> VfsFat: //| """Retrieves the mount object associated with the mount path""" //| ... //| @@ -137,7 +137,7 @@ mp_obj_t storage_getmount(const mp_obj_t mnt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); -//| def erase_filesystem() -> Any: +//| def erase_filesystem() -> None: //| """Erase and re-create the ``CIRCUITPY`` filesystem. //| //| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51), @@ -168,51 +168,51 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) }, //| class VfsFat: -//| def __init__(self, block_device: Any) -> None: +//| def __init__(self, block_device: string) -> None: //| """Create a new VfsFat filesystem around the given block device. //| //| :param block_device: Block device the the filesystem lives on""" //| -//| label: Any = ... +//| label: string = ... //| """The filesystem label, up to 11 case-insensitive bytes. Note that //| this property can only be set when the device is writable by the //| microcontroller.""" //| ... //| -//| def mkfs(self) -> Any: +//| def mkfs(self) -> None: //| """Format the block device, deleting any data that may have been there""" //| ... //| -//| def open(self, path: Any, mode: Any) -> Any: +//| def open(self, path: string, mode: string) -> None: //| """Like builtin ``open()``""" //| ... //| -//| def ilistdir(self, path: Any) -> Any: +//| def ilistdir(self, path: string) -> iterator: //| """Return an iterator whose values describe files and folders within //| ``path``""" //| ... //| -//| def mkdir(self, path: Any) -> Any: +//| def mkdir(self, path: string) -> None: //| """Like `os.mkdir`""" //| ... //| -//| def rmdir(self, path: Any) -> Any: +//| def rmdir(self, path: string) -> None: //| """Like `os.rmdir`""" //| ... //| -//| def stat(self, path: Any) -> Any: +//| def stat(self, path: string) -> string: //| """Like `os.stat`""" //| ... //| -//| def statvfs(self, path: Any) -> Any: +//| def statvfs(self, path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]: //| """Like `os.statvfs`""" //| ... //| -//| def mount(self, readonly: Any, mkfs: Any) -> Any: +//| def mount(self, readonly: bool, mkfs: VfsFat) -> None: //| """Don't call this directly, call `storage.mount`.""" //| ... //| -//| def umount(self) -> Any: +//| def umount(self) -> None: //| """Don't call this directly, call `storage.umount`.""" //| ... //| From 4758081e10b1289ccc2b1224e711f2eef4bed829 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:45:29 -0400 Subject: [PATCH 125/277] Added type hints to struct --- shared-bindings/struct/__init__.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 256b385c8e..607ddf0d5c 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -62,7 +62,7 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(struct_calcsize_obj, struct_calcsize); -//| def pack(fmt: Any, *values: Any) -> Any: +//| def pack(fmt: string, *values: ReadableBuffer) -> bytes: //| """Pack the values according to the format string fmt. //| The return value is a bytes object encoding the values.""" //| ... @@ -80,7 +80,7 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack); -//| def pack_into(fmt: Any, buffer: Any, offset: Any, *values: Any) -> Any: +//| def pack_into(fmt: string, buffer: WriteableBuffer, offset: int, *values: readableBuffer) -> None: //| """Pack the values according to the format string fmt into a buffer //| starting at offset. offset may be negative to count from the end of buffer.""" //| ... @@ -106,7 +106,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_into_obj, 3, MP_OBJ_FUN_ARGS_MAX, struct_pack_into); -//| def unpack(fmt: Any, data: Any) -> Any: +//| def unpack(fmt: string, data: ReadableBuffer) -> tuple: //| """Unpack from the data according to the format string fmt. The return value //| is a tuple of the unpacked values. The buffer size must match the size //| required by the format.""" @@ -124,7 +124,7 @@ STATIC mp_obj_t struct_unpack(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_obj, 2, 3, struct_unpack); -//| def unpack_from(fmt: Any, data: Any, offset: Any = 0) -> Any: +//| def unpack_from(fmt: string, data: ReadableBuffer, offset: int = 0) -> tuple: //| """Unpack from the data starting at offset according to the format string fmt. //| offset may be negative to count from the end of buffer. The return value is //| a tuple of the unpacked values. The buffer size must be at least as big From 4c5a9d1e3aa9412693a6a6e4221bf3a85b8a5e62 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:49:51 -0400 Subject: [PATCH 126/277] Added type hints to time --- shared-bindings/time/__init__.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 9b68bdd8d0..54f51b0b9a 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -42,7 +42,7 @@ //| written in MicroPython will work in CPython but not necessarily the other //| way around.""" //| -//| def monotonic() -> Any: +//| def monotonic() -> float: //| """Returns an always increasing value of time with an unknown reference //| point. Only use it to compare against other values from `monotonic`. //| @@ -57,7 +57,7 @@ STATIC mp_obj_t time_monotonic(void) { } MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); -//| def sleep(seconds: float) -> Any: +//| def sleep(seconds: float) -> None: //| """Sleep for a given number of seconds. //| //| :param float seconds: the time to sleep in fractional seconds""" @@ -93,7 +93,7 @@ mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp } //| class struct_time: -//| def __init__(self, time_tuple: Any) -> None: +//| def __init__(self, time_tuple: tuple) -> None: //| """Structure used to capture a date and time. Note that it takes a tuple! //| //| :param tuple time_tuple: Tuple of time info: ``(tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)`` @@ -198,7 +198,7 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { mp_raise_RuntimeError(translate("RTC is not supported on this board")); } -//| def time() -> Any: +//| def time() -> int: //| """Return the current time in seconds since since Jan 1, 1970. //| //| :return: the current time @@ -214,7 +214,7 @@ STATIC mp_obj_t time_time(void) { } MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time); -//| def monotonic_ns() -> Any: +//| def monotonic_ns() -> int: //| """Return the time of the specified clock clk_id in nanoseconds. //| //| :return: the current time @@ -227,7 +227,7 @@ STATIC mp_obj_t time_monotonic_ns(void) { } MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_ns_obj, time_monotonic_ns); -//| def localtime(secs: Any) -> Any: +//| def localtime(secs: int) -> struct_time: //| """Convert a time expressed in seconds since Jan 1, 1970 to a struct_time in //| local time. If secs is not provided or None, the current time as returned //| by time() is used. @@ -260,7 +260,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_localtime_obj, 0, 1, time_localtime); -//| def mktime(t: Any) -> Any: +//| def mktime(t: struct_time) -> int: //| """This is the inverse function of localtime(). Its argument is the //| struct_time or full 9-tuple (since the dst flag is needed; use -1 as the //| dst flag if it is unknown) which expresses the time in local time, not UTC. From 657c651e0efae2c9c4590e7c5cad5bb201fab3b4 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:51:39 -0400 Subject: [PATCH 127/277] Added type hints to uheap --- shared-bindings/uheap/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index f089f29221..0559d974ab 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -34,7 +34,7 @@ //| """Heap size analysis""" //| -//| def info(object: Any) -> Any: +//| def info(object: Any) -> int: //| """Prints memory debugging info for the given object and returns the //| estimated size.""" //| ... From 9911b64fa13442f552a9968cdf40d926b98de6f8 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 15:52:53 -0400 Subject: [PATCH 128/277] Added type hints to ustack --- shared-bindings/ustack/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index e5fac69417..de48c838a2 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -60,7 +60,7 @@ STATIC mp_obj_t stack_size(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(stack_size_obj, stack_size); -//| def stack_usage() -> Any: +//| def stack_usage() -> int: //| """Return how much stack is currently in use. //| Same as micropython.stack_use(); duplicated here for convenience.""" //| ... From 50a6342f6d4a8f7fb776bd8a95fc6b2c7b5ed514 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 3 Jul 2020 12:54:48 -0700 Subject: [PATCH 129/277] Shrink files.json by using one space instead of four. Also: - Remove download count update because the files are no longer on GitHub. - Add "extensions" and "languages" to each board dictionary so we can stop using "files" entirely. --- tools/build_board_info.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 20a5866b7f..bbafe19f6a 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -153,7 +153,7 @@ def create_pr(changes, updated, git_info, user): info["id"] = id updated_list.append(info) - updated = json.dumps(updated_list, sort_keys=True, indent=4).encode("utf-8") + b"\n" + updated = json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n" #print(updated.decode("utf-8")) pr_title = "Automated website update for release {}".format(changes["new_release"]) boards = "" @@ -205,19 +205,6 @@ def create_pr(changes, updated, git_info, user): print(changes) print(pr_info) -def update_downloads(boards, release): - response = github.get("/repos/adafruit/circuitpython/releases/tags/{}".format(release)) - if not response.ok: - print(response.text) - raise RuntimeError("cannot get previous release info") - - assets = response.json()["assets"] - for asset in assets: - board_name = asset["name"].split("-")[2] - if board_name not in boards: - continue - boards[board_name]["download_count"] += asset["download_count"] - def print_active_user(): response = github.get("/user") @@ -269,9 +256,6 @@ def generate_download_info(): board_mapping = get_board_mapping() - for release in previous_releases: - update_downloads(board_mapping, release) - for port in SUPPORTED_PORTS: board_path = os.path.join("../ports", port, "boards") for board_path in os.scandir(board_path): @@ -291,7 +275,9 @@ def generate_download_info(): "stable": new_stable, "version": new_tag, "modules": support_matrix.get(alias, "[]"), - "files": {} + "files": {}, + "languages": languages, + "extensions": board_info["extensions"] } for language in languages: files = [] From bce77adecdbfd36006dbc97a50b67d05720c8135 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 3 Jul 2020 16:03:19 -0400 Subject: [PATCH 130/277] Added type hints previously missed --- shared-bindings/_pixelbuf/__init__.c | 2 +- shared-bindings/digitalio/Direction.c | 4 ++-- shared-bindings/digitalio/DriveMode.c | 4 ++-- shared-bindings/digitalio/Pull.c | 4 ++-- shared-bindings/displayio/__init__.c | 2 +- shared-bindings/microcontroller/__init__.c | 10 +++++----- shared-bindings/socket/__init__.c | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/shared-bindings/_pixelbuf/__init__.c b/shared-bindings/_pixelbuf/__init__.c index bfd479fde0..6038fdfdcc 100644 --- a/shared-bindings/_pixelbuf/__init__.c +++ b/shared-bindings/_pixelbuf/__init__.c @@ -41,7 +41,7 @@ //| Byteorders are configured with strings, such as "RGB" or "RGBD".""" // TODO: Pull in docs from pypixelbuf. -//| def colorwheel(n: int) -> Any: +//| def colorwheel(n: int) -> int: //| """C implementation of the common wheel() function found in many examples. //| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar).""" //| ... diff --git a/shared-bindings/digitalio/Direction.c b/shared-bindings/digitalio/Direction.c index 3798b3fa74..173ebfb2b4 100644 --- a/shared-bindings/digitalio/Direction.c +++ b/shared-bindings/digitalio/Direction.c @@ -46,10 +46,10 @@ //| going.""" //| ... //| -//| INPUT: Any = ... +//| INPUT: Direction = ... //| """Read digital data in""" //| -//| OUTPUT: Any = ... +//| OUTPUT: Direction = ... //| """Write digital data out""" //| const mp_obj_type_t digitalio_direction_type; diff --git a/shared-bindings/digitalio/DriveMode.c b/shared-bindings/digitalio/DriveMode.c index 208143a2fa..2f22029b0b 100644 --- a/shared-bindings/digitalio/DriveMode.c +++ b/shared-bindings/digitalio/DriveMode.c @@ -34,10 +34,10 @@ //| digital values.""" //| ... //| -//| PUSH_PULL: Any = ... +//| PUSH_PULL: DriveMode = ... //| """Output both high and low digital values""" //| -//| OPEN_DRAIN: Any = ... +//| OPEN_DRAIN: DriveMode = ... //| """Output low digital values but go into high z for digital high. This is //| useful for i2c and other protocols that share a digital line.""" //| diff --git a/shared-bindings/digitalio/Pull.c b/shared-bindings/digitalio/Pull.c index 9656811c89..87e2a8f1ee 100644 --- a/shared-bindings/digitalio/Pull.c +++ b/shared-bindings/digitalio/Pull.c @@ -34,11 +34,11 @@ //| digital values in.""" //| ... //| -//| UP: Any = ... +//| UP: Pull = ... //| """When the input line isn't being driven the pull up can pull the state //| of the line high so it reads as true.""" //| -//| DOWN: Any = ... +//| DOWN: Pull = ... //| """When the input line isn't being driven the pull down can pull the //| state of the line low so it reads as false.""" //| diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index b791336b56..16d068e2e5 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -50,7 +50,7 @@ //| -//| def release_displays() -> Any: +//| def release_displays() -> None: //| """Releases any actively used displays so their busses and pins can be used again. This will also //| release the builtin display on boards that have one. You will need to reinitialize it yourself //| afterwards. This may take seconds to complete if an active EPaperDisplay is refreshing. diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 88fe9c2245..6d556cdd75 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -54,7 +54,7 @@ //| This object is the sole instance of `microcontroller.Processor`.""" //| -//| def delay_us(delay: Any) -> Any: +//| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays //| because this stops all other functions from completing. Think of this as an empty //| ``while`` loop that runs for the specified ``(delay)`` time. If you have other @@ -72,7 +72,7 @@ STATIC mp_obj_t mcu_delay_us(mp_obj_t delay_obj) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_delay_us_obj, mcu_delay_us); -//| def disable_interrupts() -> Any: +//| def disable_interrupts() -> None: //| """Disable all interrupts. Be very careful, this can stall everything.""" //| ... //| @@ -82,7 +82,7 @@ STATIC mp_obj_t mcu_disable_interrupts(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_disable_interrupts_obj, mcu_disable_interrupts); -//| def enable_interrupts() -> Any: +//| def enable_interrupts() -> None: //| """Enable the interrupts that were enabled at the last disable.""" //| ... //| @@ -92,7 +92,7 @@ STATIC mp_obj_t mcu_enable_interrupts(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_enable_interrupts_obj, mcu_enable_interrupts); -//| def on_next_reset(run_mode: microcontroller.RunMode) -> Any: +//| def on_next_reset(run_mode: microcontroller.RunMode) -> None: //| """Configure the run mode used the next time the microcontroller is reset but //| not powered down. //| @@ -117,7 +117,7 @@ STATIC mp_obj_t mcu_on_next_reset(mp_obj_t run_mode_obj) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_on_next_reset_obj, mcu_on_next_reset); -//| def reset() -> Any: +//| def reset() -> None: //| """Reset the microcontroller. After reset, the microcontroller will enter the //| run mode last set by `on_next_reset`. //| diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 985104d553..64b1a538d8 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -509,7 +509,7 @@ STATIC const mp_obj_type_t socket_type = { .locals_dict = (mp_obj_dict_t*)&socket_locals_dict, }; -//| def getaddrinfo(host: Any, port: Any) -> Any: +//| def getaddrinfo(host: string, port: string) -> tuple: //| """Gets the address information for a hostname and port //| //| Returns the appropriate family, socket type, socket protocol and From 5375e546037ffa2d1c0b7b9cffbd56bc3472ab7e Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 3 Jul 2020 13:08:18 +0000 Subject: [PATCH 131/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (778 of 778 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 99e59304c8..f25d2d86e6 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-02 15:29+0200\n" -"PO-Revision-Date: 2020-07-02 13:32+0000\n" +"PO-Revision-Date: 2020-07-03 22:53+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -615,7 +615,7 @@ msgstr "Não foi possível inicializar o GNSS" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" -msgstr "" +msgstr "Não foi possível inicializar o SDCard" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" From 2345b57373eb3ad95ba72d65c076a735f28b605a Mon Sep 17 00:00:00 2001 From: oon arfiandwi Date: Sat, 4 Jul 2020 00:58:33 +0000 Subject: [PATCH 132/277] Translated using Weblate (Indonesian) Currently translated at 29.1% (227 of 778 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 150 ++++++++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 73 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 44d3bfde29..390bfcd944 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3,25 +3,28 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-02 15:29+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2020-07-04 02:34+0000\n" +"Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" -"Language: \n" +"Language: ID\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.2-dev\n" #: main.c msgid "" "\n" "Code done running. Waiting for reload.\n" msgstr "" +"\n" +"Kode selesai berjalan. Menunggu memuat ulang.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -29,20 +32,25 @@ msgid "" "Please file an issue with the contents of your CIRCUITPY drive at \n" "https://github.com/adafruit/circuitpython/issues\n" msgstr "" +"\n" +"Harap ajukan masalah dengan konten drive CIRCUITPY Anda di\n" +"https://github.com/adafruit/circuitpython/issues\n" #: supervisor/shared/safe_mode.c msgid "" "\n" "To exit, please reset the board without " msgstr "" +"\n" +"Untuk keluar, harap setel ulang papan tanpa" #: py/obj.c msgid " File \"%q\"" -msgstr "" +msgstr "  File \"% q\"" #: py/obj.c msgid " File \"%q\", line %d" -msgstr "" +msgstr "  File \"% q\", baris% d" #: main.c msgid " output:\n" @@ -51,12 +59,12 @@ msgstr "output:\n" #: py/objstr.c #, c-format msgid "%%c requires int or char" -msgstr "" +msgstr "%%c harus int atau char" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "%d address pins and %d rgb pins indicate a height of %d, not %d" -msgstr "" +msgstr "pin alamat %d dan pin rgb %d menunjukkan tinggi %d, bukan %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -64,39 +72,38 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" -msgstr "" +msgstr "%q sedang digunakan" #: py/obj.c msgid "%q index out of range" -msgstr "" +msgstr "%q indeks di luar batas" #: py/obj.c msgid "%q indices must be integers, not %s" -msgstr "" +msgstr "indeks %q harus bilangan bulat, bukan %s" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" -msgstr "" +msgstr "daftar %q harus berupa daftar" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c #: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c #: shared-bindings/vectorio/Rectangle.c -#, fuzzy msgid "%q must be >= 1" -msgstr "buffers harus mempunyai panjang yang sama" +msgstr "%q harus >= 1" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" -msgstr "" +msgstr "%q harus berupa tuple dengan panjang 2" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q pin invalid" -msgstr "" +msgstr "pin %q tidak valid" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" -msgstr "" +msgstr "%q harus berupa int" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -109,7 +116,7 @@ msgstr "'%q' argumen dibutuhkan" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" -msgstr "" +msgstr "'%s' mengharapkan sebuah label" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format @@ -149,7 +156,7 @@ msgstr "'%s' mengharapkan {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format msgid "'%s' integer %d is not within range %d..%d" -msgstr "" +msgstr "'%s' integer %d tidak dalam kisaran %d..%d" #: py/emitinlinethumb.c #, c-format @@ -158,40 +165,40 @@ msgstr "'%s' integer 0x%x tidak cukup didalam mask 0x%x" #: py/runtime.c msgid "'%s' object cannot assign attribute '%q'" -msgstr "" +msgstr "Objek '%s' tidak dapat menetapkan atribut '%q'" #: py/proto.c msgid "'%s' object does not support '%q'" -msgstr "" +msgstr "Objek '%s' tidak mendukung '%q'" #: py/obj.c #, c-format msgid "'%s' object does not support item assignment" -msgstr "" +msgstr "Objek '%s' tidak mendukung penetapan item" #: py/obj.c #, c-format msgid "'%s' object does not support item deletion" -msgstr "" +msgstr "Objek '%s' tidak mendukung penghapusan item" #: py/runtime.c msgid "'%s' object has no attribute '%q'" -msgstr "" +msgstr "Objek '%s' tidak memiliki atribut '%q'" #: py/runtime.c #, c-format msgid "'%s' object is not an iterator" -msgstr "" +msgstr "Objek '%s' bukan iterator" #: py/objtype.c py/runtime.c #, c-format msgid "'%s' object is not callable" -msgstr "" +msgstr "Objek '%s' tidak dapat dipanggil" #: py/runtime.c #, c-format msgid "'%s' object is not iterable" -msgstr "" +msgstr "'%s' objek tidak dapat diulang" #: py/obj.c #, c-format @@ -200,11 +207,11 @@ msgstr "" #: py/objstr.c msgid "'=' alignment not allowed in string format specifier" -msgstr "" +msgstr "'=' perataan tidak diizinkan dalam penentu format string" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" -msgstr "" +msgstr "'S' dan 'O' bukan tipe format yang didukung" #: py/compile.c msgid "'align' requires 1 argument" @@ -212,7 +219,7 @@ msgstr "'align' membutuhkan 1 argumen" #: py/compile.c msgid "'async for' or 'async with' outside async function" -msgstr "" +msgstr "'async for' atau 'async with' di luar fungsi async" #: py/compile.c msgid "'await' outside function" @@ -252,7 +259,7 @@ msgstr "*x harus menjadi target assignment" #: py/obj.c msgid ", in %q\n" -msgstr "" +msgstr ", dalam %q\n" #: py/objcomplex.c msgid "0.0 to a complex power" @@ -260,7 +267,7 @@ msgstr "" #: py/modbuiltins.c msgid "3-arg pow() not supported" -msgstr "" +msgstr "pow() 3-arg tidak didukung" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -268,13 +275,13 @@ msgid "A hardware interrupt channel is already in use" msgstr "Sebuah channel hardware interrupt sedang digunakan" #: shared-bindings/_bleio/Address.c -#, fuzzy, c-format +#, c-format msgid "Address must be %d bytes long" -msgstr "buffers harus mempunyai panjang yang sama" +msgstr "Alamat harus sepanjang %d byte" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" -msgstr "" +msgstr "Jenis alamat di luar batas" #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -285,9 +292,8 @@ msgid "All SPI peripherals are in use" msgstr "Semua perangkat SPI sedang digunakan" #: ports/nrf/common-hal/busio/UART.c -#, fuzzy msgid "All UART peripherals are in use" -msgstr "Semua perangkat I2C sedang digunakan" +msgstr "Semua perangkat UART sedang digunakan" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" @@ -319,7 +325,7 @@ msgstr "" #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" -msgstr "" +msgstr "AnalogIn tidak didukung pada pin yang diberikan" #: ports/cxd56/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c @@ -329,7 +335,7 @@ msgstr "fungsionalitas AnalogOut tidak didukung" #: shared-bindings/analogio/AnalogOut.c msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" +msgstr "AnalogOut hanya 16 bit. Nilai harus kurang dari 65536." #: ports/atmel-samd/common-hal/analogio/AnalogOut.c msgid "AnalogOut not supported on given pin" @@ -342,19 +348,19 @@ msgstr "Send yang lain sudah aktif" #: shared-bindings/pulseio/PulseOut.c msgid "Array must contain halfwords (type 'H')" -msgstr "" +msgstr "Array harus mengandung halfwords (ketik 'H')" #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "" +msgstr "Nilai array harus berupa byte tunggal." #: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" -msgstr "" +msgstr "Paling banyak %d %q dapat ditentukan (bukan %d)" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." -msgstr "" +msgstr "Mencoba alokasi heap ketika MicroPython VM tidak berjalan." #: main.c msgid "Auto-reload is off.\n" @@ -371,7 +377,7 @@ msgstr "" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "" +msgstr "Di bawah frame rate minimum" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" @@ -379,7 +385,7 @@ msgstr "Bit clock dan word harus memiliki kesamaan pada clock unit" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." -msgstr "" +msgstr "Kedalaman bit harus kelipatan 8." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" @@ -393,90 +399,89 @@ msgstr "Kedua pin harus mendukung hardware interrut" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" -msgstr "" +msgstr "Brightness harus di antara 0-1.0" #: shared-bindings/supervisor/__init__.c msgid "Brightness must be between 0 and 255" -msgstr "" +msgstr "Brightness harus di antara 0 dan 255" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" -msgstr "" +msgstr "Brightness tidak bisa disesuaikan" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "Buffer + offset terlalu kecil %d %d %d" #: shared-module/usb_hid/Device.c #, c-format msgid "Buffer incorrect size. Should be %d bytes." -msgstr "" +msgstr "Ukuran buffer salah. Seharusnya %d byte." #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "" +msgstr "Buffer bukan bytearray." #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" -msgstr "" +msgstr "Buffer terlalu kecil" #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "" +msgstr "Panjang buffer %d terlalu besar. Itu harus kurang dari %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 "Panjang buffer harus kelipatan 512" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" -msgstr "" +msgstr "Buffer harus memiliki panjang setidaknya 1" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Buffer too large and unable to allocate" -msgstr "" +msgstr "Buffer terlalu besar dan tidak dapat dialokasikan" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "Buffer terlalu pendek untuk %d byte" #: ports/atmel-samd/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 sudah digunakan" +msgstr "Pin bus %d sudah digunakan" #: shared-bindings/_bleio/UUID.c -#, fuzzy msgid "Byte buffer must be 16 bytes." -msgstr "buffers harus mempunyai panjang yang sama" +msgstr "Byte buffer harus 16 byte." #: shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." -msgstr "" +msgstr "Bytes harus di antara 0 dan 255." #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" -msgstr "" +msgstr "Blok CBC harus merupakan kelipatan 16 byte" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "" +msgstr "Panggil super().__init__() sebelum mengakses objek asli." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "" +msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal" #: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" -msgstr "" +msgstr "Tidak dapat menghapus nilai" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -485,9 +490,8 @@ msgid "Cannot get pull while in output mode" msgstr "Tidak bisa mendapatkan pull pada saat mode output" #: ports/nrf/common-hal/microcontroller/Processor.c -#, fuzzy msgid "Cannot get temperature" -msgstr "Tidak bisa mendapatkan temperatur. status: 0x%02x" +msgstr "Tidak bisa mendapatkan suhu" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." @@ -501,15 +505,15 @@ msgstr "" #: shared-module/bitbangio/SPI.c msgid "Cannot read without MISO pin." -msgstr "" +msgstr "Tidak dapat membaca tanpa pin MISO." #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" -msgstr "" +msgstr "Tidak dapat merekam ke file" #: shared-module/storage/__init__.c msgid "Cannot remount '/' when USB is active." -msgstr "" +msgstr "Tidak dapat memasang kembali '/' ketika USB aktif." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c @@ -521,11 +525,11 @@ msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "" +msgstr "Tidak dapat menetapkan nilai saat arah input." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Cannot specify RTS or CTS in RS485 mode" -msgstr "" +msgstr "Tidak dapat menentukan RTS atau CTS dalam mode RS485" #: py/objslice.c msgid "Cannot subclass slice" From 01b2682842f47afbe27bbfcd0f00db96f764fea2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 4 Jul 2020 02:42:15 +0000 Subject: [PATCH 133/277] Translated using Weblate (Indonesian) Currently translated at 29.1% (227 of 778 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 390bfcd944..a0c255b233 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-02 15:29+0200\n" -"PO-Revision-Date: 2020-07-04 02:34+0000\n" -"Last-Translator: oon arfiandwi \n" +"PO-Revision-Date: 2020-07-04 02:45+0000\n" +"Last-Translator: Jeff Epler \n" "Language-Team: LANGUAGE \n" "Language: ID\n" "MIME-Version: 1.0\n" @@ -46,11 +46,11 @@ msgstr "" #: py/obj.c msgid " File \"%q\"" -msgstr "  File \"% q\"" +msgstr " File \"%q\"" #: py/obj.c msgid " File \"%q\", line %d" -msgstr "  File \"% q\", baris% d" +msgstr " File \"%q\", baris %d" #: main.c msgid " output:\n" From e514782cc68a0f5e01631f8471b1af9a450e8995 Mon Sep 17 00:00:00 2001 From: ndgarage Date: Sat, 4 Jul 2020 10:39:21 -0600 Subject: [PATCH 134/277] update-with-new-usb-PID --- ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk index 09804bc4e7..90c000418a 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk @@ -1,7 +1,7 @@ LD_FILE = boards/samd21x18-bootloader.ld USB_VID = 0x239A -USB_PID = 0x8066 -USB_PRODUCT = "Bit6" +USB_PID = 0x80B9 +USB_PRODUCT = "Bit7" USB_MANUFACTURER = "ndGarage" CHIP_VARIANT = SAMD21E18A From 94d90742dd02a7d4350a5f712baa81a3ee105fa9 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Sat, 4 Jul 2020 21:15:38 -0500 Subject: [PATCH 135/277] Implementation of RTC continuous synchronization during pulsein Flags and code to implement RTC continuous synchronization during pulsein --- ports/atmel-samd/common-hal/pulseio/PulseIn.c | 10 ++++++++++ ports/atmel-samd/common-hal/pulseio/PulseIn.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c index 7ea20321b2..b825579dbe 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c @@ -125,6 +125,9 @@ void pulsein_interrupt_handler(uint8_t channel) { } void pulsein_reset() { +#ifdef SAMD21 + rtc_end_pulsein(); +#endif refcount = 0; pulsein_tc_index = 0xff; overflow_count = 0; @@ -221,6 +224,10 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, // Set config will enable the EIC. pulsein_set_config(self, true); +#ifdef SAMD21 + rtc_start_pulsein(); +#endif + } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) { @@ -231,6 +238,9 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) { if (common_hal_pulseio_pulsein_deinited(self)) { return; } +#ifdef SAMD21 + rtc_end_pulsein(); +#endif set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT); turn_off_eic_channel(self->channel); reset_pin_number(self->pin); diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.h b/ports/atmel-samd/common-hal/pulseio/PulseIn.h index 89b61a83ac..99358178f2 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseIn.h +++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.h @@ -50,5 +50,11 @@ void pulsein_reset(void); void pulsein_interrupt_handler(uint8_t channel); void pulsein_timer_interrupt_handler(uint8_t index); +#ifdef SAMD21 +void rtc_set_continuous(void); +void rtc_start_pulsein(void); +void rtc_end_pulsein(void); +#endif + #endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PULSEIN_H From ac33c3fe2c8f8bd866b205ecb844b2f1b9fffcdd Mon Sep 17 00:00:00 2001 From: DavePutz Date: Sat, 4 Jul 2020 21:17:19 -0500 Subject: [PATCH 136/277] Implementation of continuous synchronization of RTC during pulsein Flags and code to implement continuous synchronization of RTC during pulsein --- ports/atmel-samd/supervisor/port.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 48bd3211b5..05ce0eb09b 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -91,6 +91,23 @@ #if CIRCUITPY_PEW #include "common-hal/_pew/PewPew.h" #endif +#ifdef SAMD21 +volatile bool hold_interrupt = false; + +void rtc_start_pulsein(void) { + rtc_set_continuous(); + hold_interrupt = true; +} +void rtc_end_pulsein(void) { + hold_interrupt = false; +} + +void rtc_set_continuous(void) { + while (RTC->MODE0.STATUS.bit.SYNCBUSY); + RTC->MODE0.READREQ.reg = RTC_READREQ_RREQ | RTC_READREQ_RCONT | 0x0010; + while (RTC->MODE0.STATUS.bit.SYNCBUSY); +} +#endif extern volatile bool mp_msc_enabled; @@ -489,6 +506,11 @@ void port_interrupt_after_ticks(uint32_t ticks) { // We'll interrupt sooner with an overflow. return; } +#ifdef SAMD21 + if (hold_interrupt == true) { + return; + } +#endif RTC->MODE0.COMP[0].reg = current_ticks + (ticks << 4); RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0; RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0; From d1c9bb30e2983f6e2728b4eb17579bd956680626 Mon Sep 17 00:00:00 2001 From: Tyler Crumpton Date: Mon, 6 Jul 2020 09:56:52 -0500 Subject: [PATCH 137/277] Fix minor typo in MicroPython libraries page --- docs/library/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/library/index.rst b/docs/library/index.rst index 6c2e576e7d..f847ead0af 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -70,7 +70,7 @@ CircuitPython/MicroPython-specific libraries Functionality specific to the CircuitPython/MicroPython implementation is available in the following libraries. These libraries may change signficantly or be removed in future -versions of CircuitPtyon. +versions of CircuitPython. .. toctree:: :maxdepth: 1 From 97355f8fb78c277df3940bf1e4385311d32f2662 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Tue, 30 Jun 2020 14:50:09 +0200 Subject: [PATCH 138/277] spresense: update SDK to 2.0.1 --- ports/cxd56/Makefile | 20 +- ports/cxd56/README.md | 4 +- ports/cxd56/common-hal/pulseio/PWMOut.h | 2 +- ports/cxd56/configs/circuitpython/defconfig | 171 ++++++ ports/cxd56/spresense-exported-sdk | 2 +- ports/cxd56/tools/flash_writer.py | 580 +++++++++++++++++++ ports/cxd56/tools/xmodem.py | 590 ++++++++++++++++++++ 7 files changed, 1358 insertions(+), 11 deletions(-) create mode 100644 ports/cxd56/configs/circuitpython/defconfig create mode 100755 ports/cxd56/tools/flash_writer.py create mode 100644 ports/cxd56/tools/xmodem.py diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 507d763312..3766d42228 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -62,6 +62,13 @@ SPRESENSE_SDK = spresense-exported-sdk FIRMWARE = $(SPRESENSE_SDK)/firmware +BOOTLOADER_FILES += \ + $(FIRMWARE)/AESM.espk \ + $(FIRMWARE)/dnnrt-mp.espk \ + $(FIRMWARE)/gnssfw.espk \ + $(FIRMWARE)/loader.espk \ + $(FIRMWARE)/sysutil.spk \ + # Platforms are: Linux, Darwin, MSYS, CYGWIN PLATFORM := $(firstword $(subst _, ,$(shell uname -s 2>/dev/null))) @@ -91,8 +98,7 @@ INC += \ -I$(SPRESENSE_SDK)/nuttx/arch \ -I$(SPRESENSE_SDK)/nuttx/arch/chip \ -I$(SPRESENSE_SDK)/nuttx/arch/os \ - -I$(SPRESENSE_SDK)/sdk/bsp/include \ - -I$(SPRESENSE_SDK)/sdk/bsp/include/sdk \ + -I$(SPRESENSE_SDK)/sdk/include \ CFLAGS += \ $(INC) \ @@ -125,7 +131,7 @@ LDFLAGS = \ --entry=__start \ -nostartfiles \ -nodefaultlibs \ - -T$(SPRESENSE_SDK)/nuttx/build/ramconfig.ld \ + -T$(SPRESENSE_SDK)/nuttx/scripts/ramconfig.ld \ --gc-sections \ -Map=$(BUILD)/output.map \ -o $(BUILD)/firmware.elf \ @@ -133,8 +139,8 @@ LDFLAGS = \ -u spresense_main \ -u board_timerhook \ $(BUILD)/libmpy.a \ - $(SPRESENSE_SDK)/sdk/libs/libapps.a \ - $(SPRESENSE_SDK)/sdk/libs/libsdk.a \ + $(SPRESENSE_SDK)/nuttx/libs/libapps.a \ + $(SPRESENSE_SDK)/nuttx/libs/libnuttx.a \ $(LIBM) \ $(LIBGCC) \ --end-group \ @@ -213,11 +219,11 @@ $(BUILD)/firmware.spk: $(BUILD)/firmware.elf $(MKSPK) flash: $(BUILD)/firmware.spk $(ECHO) "Writing $< to the board" - $(SPRESENSE_SDK)/sdk/tools/flash.sh -c $(SERIAL) $(BUILD)/firmware.spk + tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $(BUILD)/firmware.spk flash-bootloader: $(SPRESENSE_SDK) $(FIRMWARE) $(ECHO) "Writing loader to the board" - $(SPRESENSE_SDK)/sdk/tools/flash.sh -l $(FIRMWARE) -c $(SERIAL) + tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $(BOOTLOADER_FILES) include $(TOP)/py/mkrules.mk diff --git a/ports/cxd56/README.md b/ports/cxd56/README.md index ec284e7421..7fa439aacb 100644 --- a/ports/cxd56/README.md +++ b/ports/cxd56/README.md @@ -16,7 +16,7 @@ Board features: * Spresense is powered by Sony's CXD5602 microcontroller (ARM® Cortex®-M4F × 6 cores), with a clock speed of 156 MHz. -Currently, Spresense port does not support GNSS, Audio and Multicore. +Currently, Spresense port does not support Audio and Multicore. Refer to [developer.sony.com/develop/spresense/](https://developer.sony.com/develop/spresense/) for further information about this board. @@ -75,7 +75,7 @@ Bootloader information: * You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary. -Download the spresense binaries zip archive from: [Spresense firmware v1-4-000](https://developer.sony.com/file/download/download-spresense-firmware-v1-4-000) +Download the spresense binaries zip archive from: [Spresense firmware v2-0-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-0-000) Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/ diff --git a/ports/cxd56/common-hal/pulseio/PWMOut.h b/ports/cxd56/common-hal/pulseio/PWMOut.h index 57fc4181f0..694acc4e0c 100644 --- a/ports/cxd56/common-hal/pulseio/PWMOut.h +++ b/ports/cxd56/common-hal/pulseio/PWMOut.h @@ -27,7 +27,7 @@ #ifndef MICROPY_INCLUDED_CXD56_COMMON_HAL_PULSEIO_PWMOUT_H #define MICROPY_INCLUDED_CXD56_COMMON_HAL_PULSEIO_PWMOUT_H -#include +#include #include "common-hal/microcontroller/Pin.h" diff --git a/ports/cxd56/configs/circuitpython/defconfig b/ports/cxd56/configs/circuitpython/defconfig new file mode 100644 index 0000000000..268f7a68e9 --- /dev/null +++ b/ports/cxd56/configs/circuitpython/defconfig @@ -0,0 +1,171 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_LEDS is not set +# CONFIG_CXD56_I2C0_SCUSEQ is not set +# CONFIG_CXD56_SFC is not set +# CONFIG_CXD56_SPI3_SCUSEQ is not set +# CONFIG_MMCSD_MMCSUPPORT is not set +# CONFIG_MMCSD_SPI is not set +# CONFIG_MTD_SMART_WEAR_LEVEL is not set +# CONFIG_NET_IPv4 is not set +# CONFIG_NXFONTS_PACKEDMSFIRST is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="spresense" +CONFIG_ARCH_BOARD_SPRESENSE=y +CONFIG_ARCH_CHIP="cxd56xx" +CONFIG_ARCH_CHIP_CXD56XX=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_MATH_H=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_USEBASEPRI=y +CONFIG_ASMP=y +CONFIG_AUDIO=y +CONFIG_AUDIOUTILS_DSP_MOUNTPT="/mnt/sd0/BIN" +CONFIG_AUDIOUTILS_MANAGER=y +CONFIG_AUDIOUTILS_PLAYER=y +CONFIG_AUDIOUTILS_PLAYLIST=y +CONFIG_AUDIOUTILS_RECORDER=y +CONFIG_BOARDCTL_IOCTL=y +CONFIG_BOARDCTL_POWEROFF=y +CONFIG_BOARDCTL_RESET=y +CONFIG_BOARDCTL_UNIQUEID=y +CONFIG_BOARDCTL_UNIQUEID_SIZE=5 +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_BOARD_CRASHDUMP=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=5434 +CONFIG_BOOT_RUNFROMISRAM=y +CONFIG_BUILTIN=y +CONFIG_CLOCK_MONOTONIC=y +CONFIG_CXD56_ADC=y +CONFIG_CXD56_AUDIO=y +CONFIG_CXD56_BINARY=y +CONFIG_CXD56_CHARGER=y +CONFIG_CXD56_CISIF=y +CONFIG_CXD56_GAUGE=y +CONFIG_CXD56_GNSS=y +CONFIG_CXD56_HPADC0=y +CONFIG_CXD56_HPADC1=y +CONFIG_CXD56_I2C0=y +CONFIG_CXD56_I2C2=y +CONFIG_CXD56_I2C=y +CONFIG_CXD56_I2C_DRIVER=y +CONFIG_CXD56_IMAGEPROC=y +CONFIG_CXD56_LPADC=y +CONFIG_CXD56_PWM0=y +CONFIG_CXD56_PWM1=y +CONFIG_CXD56_PWM2=y +CONFIG_CXD56_PWM3=y +CONFIG_CXD56_PWM=y +CONFIG_CXD56_SDIO=y +CONFIG_CXD56_SPI3=y +CONFIG_CXD56_SPI5=y +CONFIG_CXD56_SPI=y +CONFIG_CXD56_UART2=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DNN_RT=y +CONFIG_DNN_RT_MP=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXTERNALS_CMSIS=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=64 +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_FS_ROMFS=y +CONFIG_FS_SMARTFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_LCD=y +CONFIG_LCD_NOGETRUN=y +CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_LIBC_IPv4_ADDRCONV=y +CONFIG_LIBC_IPv6_ADDRCONV=y +CONFIG_LIB_KBDCODEC=y +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MEMUTILS=y +CONFIG_MMCSD=y +CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y +CONFIG_MTD_BYTE_WRITE=y +CONFIG_MTD_SMART=y +CONFIG_MTD_SMART_ENABLE_CRC=y +CONFIG_MTD_SMART_FSCK=y +CONFIG_MTD_SMART_SECTOR_SIZE=4096 +CONFIG_NAME_MAX=64 +CONFIG_NET=y +CONFIG_NETDEVICES=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_TCP_NO_STACK=y +CONFIG_NET_UDP_NO_STACK=y +CONFIG_NET_USRSOCK=y +CONFIG_NET_USRSOCK_TCP=y +CONFIG_NET_USRSOCK_UDP=y +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_LOSMART=y +CONFIG_NSH_LINELEN=160 +CONFIG_NSH_MAXARGUMENTS=14 +CONFIG_NSH_READLINE=y +CONFIG_PIPES=y +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=16 +CONFIG_PWM=y +CONFIG_RAM_SIZE=1572864 +CONFIG_RAM_START=0x0d000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_READLINE_CMD_HISTORY_LINELEN=160 +CONFIG_READLINE_TABCOMPLETION=y +CONFIG_RR_INTERVAL=200 +CONFIG_RTC=y +CONFIG_RTC_ALARM=y +CONFIG_RTC_DRIVER=y +CONFIG_RTC_FREQUENCY=32768 +CONFIG_RTC_HIRES=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_LPNTHREADS=3 +CONFIG_SCHED_LPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_SDIO_MUXBUS=y +CONFIG_SDK_AUDIO=y +CONFIG_SERIAL_TERMIOS=y +CONFIG_SMARTFS_ALIGNED_ACCESS=y +CONFIG_SMARTFS_MAXNAMLEN=30 +CONFIG_SMARTFS_MULTI_ROOT_DIRS=y +CONFIG_SPECIFIC_DRIVERS=y +CONFIG_SPI=y +CONFIG_SPRESENSE_EXTENSION=y +CONFIG_START_DAY=6 +CONFIG_START_MONTH=12 +CONFIG_START_YEAR=2011 +CONFIG_SYSTEMTICK_HOOK=y +CONFIG_SYSTEM_CLE=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NSH_CXXINITIALIZE=y +CONFIG_UART1_RXBUFSIZE=1024 +CONFIG_UART1_SERIAL_CONSOLE=y +CONFIG_UART1_TXBUFSIZE=1024 +CONFIG_UART2_IFLOWCONTROL=y +CONFIG_UART2_OFLOWCONTROL=y +CONFIG_USBDEV=y +CONFIG_USBDEV_DMA=y +CONFIG_USBDEV_DUALSPEED=y +CONFIG_USEC_PER_TICK=1000 +CONFIG_USERMAIN_STACKSIZE=1064960 +CONFIG_USER_ENTRYPOINT="spresense_main" +CONFIG_VIDEO_ISX012=y +CONFIG_VIDEO_STREAM=y diff --git a/ports/cxd56/spresense-exported-sdk b/ports/cxd56/spresense-exported-sdk index 7f6568c7f4..c991d439fa 160000 --- a/ports/cxd56/spresense-exported-sdk +++ b/ports/cxd56/spresense-exported-sdk @@ -1 +1 @@ -Subproject commit 7f6568c7f4898cdb24a2f06040784a836050686e +Subproject commit c991d439fac9c23cfcac0da16fe8055f818d40a4 diff --git a/ports/cxd56/tools/flash_writer.py b/ports/cxd56/tools/flash_writer.py new file mode 100755 index 0000000000..840f10c32f --- /dev/null +++ b/ports/cxd56/tools/flash_writer.py @@ -0,0 +1,580 @@ +#! /usr/bin/env python3 + +# Copyright (C) 2018 Sony Semiconductor Solutions Corp. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +import time +import sys +import os +import struct +import glob +import fnmatch +import errno +import telnetlib +import argparse +import shutil +import subprocess +import re +import xmodem + +import_serial_module = True + +# When SDK release, plase set SDK_RELEASE as True. +SDK_RELEASE = False + +if SDK_RELEASE : + PRINT_RAW_COMMAND = False + REBOOT_AT_END = True +else : + PRINT_RAW_COMMAND = True + REBOOT_AT_END = True + +try: + import serial +except: + import_serial_module = False + +# supported environment various +# CXD56_PORT +# CXD56_TELNETSRV_PORT +# CXD56_TELNETSRV_IP + +PROTOCOL_SERIAL = 0 +PROTOCOL_TELNET = 1 + +MAX_DOT_COUNT = 70 + +# configure parameters and default value +class ConfigArgs: + PROTOCOL_TYPE = None + SERIAL_PORT = "COM1" + SERVER_PORT = 4569 + SERVER_IP = "localhost" + EOL = bytes([10]) + WAIT_RESET = True + AUTO_RESET = False + DTR_RESET = False + XMODEM_BAUD = 0 + NO_SET_BOOTABLE = False + PACKAGE_NAME = [] + FILE_NAME = [] + ERASE_NAME = [] + PKGSYS_NAME = [] + PKGAPP_NAME = [] + PKGUPD_NAME = [] + +ROM_MSG = [b"Welcome to nash"] +XMDM_MSG = "Waiting for XMODEM (CRC or 1K) transfer. Ctrl-X to cancel." + +class ConfigArgsLoader(): + def __init__(self): + self.parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) + self.parser.add_argument("package_name", help="the name of the package to install", nargs='*') + self.parser.add_argument("-f", "--file", dest="file_name", help="save file", action='append') + self.parser.add_argument("-e", "--erase", dest="erase_name", help="erase file", action='append') + + self.parser.add_argument("-S", "--sys", dest="pkgsys_name", help="the name of the system package to install", action='append') + self.parser.add_argument("-A", "--app", dest="pkgapp_name", help="the name of the application package to install", action='append') + self.parser.add_argument("-U", "--upd", dest="pkgupd_name", help="the name of the updater package to install", action='append') + + self.parser.add_argument("-a", "--auto-reset", dest="auto_reset", + action="store_true", default=None, + help="try to auto reset develop board if possible") + self.parser.add_argument("-d", "--dtr-reset", dest="dtr_reset", + action="store_true", default=None, + help="try to auto reset develop board if possible") + self.parser.add_argument("-n", "--no-set-bootable", dest="no_set_bootable", + action="store_true", default=None, + help="not to set bootable") + + group = self.parser.add_argument_group() + group.add_argument("-i", "--server-ip", dest="server_ip", + help="the ip address connected to the telnet server") + group.add_argument("-p", "--server-port", dest="server_port", type=int, + help="the port connected to the telnet server") + + group = self.parser.add_argument_group() + group.add_argument("-c", "--serial-port", dest="serial_port", help="the serial port") + group.add_argument("-b", "--xmodem-baudrate", dest="xmodem_baud", help="Use the faster baudrate in xmodem") + + mutually_group = self.parser.add_mutually_exclusive_group() + mutually_group.add_argument("-t", "--telnet-protocol", dest="telnet_protocol", + action="store_true", default=None, + help="use the telnet protocol for binary transmission") + mutually_group.add_argument("-s", "--serial-protocol", dest="serial_protocol", + action="store_true", default=None, + help="use the serial port for binary transmission, default options") + + mutually_group2 = self.parser.add_mutually_exclusive_group() + mutually_group2.add_argument("-F", "--force-wait-reset", dest="wait_reset", + action="store_true", default=None, + help="force wait for pressing RESET button") + mutually_group2.add_argument("-N", "--no-wait-reset", dest="wait_reset", + action="store_false", default=None, + help="if possible, skip to wait for pressing RESET button") + + def update_config(self): + args = self.parser.parse_args() + + ConfigArgs.PACKAGE_NAME = args.package_name + ConfigArgs.FILE_NAME = args.file_name + ConfigArgs.ERASE_NAME = args.erase_name + ConfigArgs.PKGSYS_NAME = args.pkgsys_name + ConfigArgs.PKGAPP_NAME = args.pkgapp_name + ConfigArgs.PKGUPD_NAME = args.pkgupd_name + + # Get serial port or telnet server ip etc + if args.serial_protocol == True: + ConfigArgs.PROTOCOL_TYPE = PROTOCOL_SERIAL + elif args.telnet_protocol == True: + ConfigArgs.PROTOCOL_TYPE = PROTOCOL_TELNET + + if ConfigArgs.PROTOCOL_TYPE == None: + proto = os.environ.get("CXD56_PROTOCOL") + if proto is not None: + if 's' in proto: + ConfigArgs.PROTOCOL_TYPE = PROTOCOL_SERIAL + elif 't' in proto: + ConfigArgs.PROTOCOL_TYPE = PROTOCOL_TELNET + + if ConfigArgs.PROTOCOL_TYPE == None: + ConfigArgs.PROTOCOL_TYPE = PROTOCOL_SERIAL + + if ConfigArgs.PROTOCOL_TYPE == PROTOCOL_SERIAL: + if args.serial_port is not None: + ConfigArgs.SERIAL_PORT = args.serial_port + else: + # Get serial port from the environment + port = os.environ.get("CXD56_PORT") + if port is not None: + ConfigArgs.SERIAL_PORT = port + else: + print("CXD56_PORT is not set, Use " + ConfigArgs.SERIAL_PORT + ".") + else: + ConfigArgs.PROTOCOL_TYPE = PROTOCOL_TELNET + if args.server_port is not None: + ConfigArgs.SERVER_PORT = args.server_port + else: + port = os.environ.get("CXD56_TELNETSRV_PORT") + if port is not None: + ConfigArgs.SERVER_PORT = port + else: + print("CXD56_TELNETSRV_PORT is not set, Use " + str(ConfigArgs.SERVER_PORT) + ".") + if args.server_ip is not None: + ConfigArgs.SERVER_IP = args.server_ip + else: + ip = os.environ.get("CXD56_TELNETSRV_IP") + if ip is not None: + ConfigArgs.SERVER_IP = ip + else: + print("CXD56_TELNETSRV_IP is not set, Use " + ConfigArgs.SERVER_IP + ".") + + if args.xmodem_baud is not None: + ConfigArgs.XMODEM_BAUD = args.xmodem_baud + + if args.auto_reset is not None: + ConfigArgs.AUTO_RESET = args.auto_reset + + if args.dtr_reset is not None: + ConfigArgs.DTR_RESET = args.dtr_reset + + if args.no_set_bootable is not None: + ConfigArgs.NO_SET_BOOTABLE = args.no_set_bootable + + if args.wait_reset is not None: + ConfigArgs.WAIT_RESET = args.wait_reset + +class TelnetDev: + def __init__(self): + srv_ipaddr = ConfigArgs.SERVER_IP + srv_port = ConfigArgs.SERVER_PORT + self.recvbuf = b''; + try: + self.telnet = telnetlib.Telnet(host=srv_ipaddr, port=srv_port, timeout=10) + # There is a ack to be sent after connecting to the telnet server. + self.telnet.write(b"\xff") + except Exception as e: + print("Cannot connect to the server %s:%d" % (srv_ipaddr, srv_port)) + sys.exit(e.args[0]) + + def readline(self, size=None): + res = b'' + ch = b'' + while ch != ConfigArgs.EOL: + ch = self.getc_raw(1, timeout=0.1) + if ch == b'': + return res + res += ch + return res + + def getc_raw(self, size, timeout=1): + res = b'' + tm = time.monotonic() + while size > 0: + while self.recvbuf == b'': + self.recvbuf = self.telnet.read_eager() + if self.recvbuf == b'': + if (time.monotonic() - tm) > timeout: + return res + time.sleep(0.1) + res += self.recvbuf[0:1] + self.recvbuf = self.recvbuf[1:] + size -= 1 + return res + + def write(self, buffer): + self.telnet.write(buffer) + + def discard_inputs(self, timeout=1.0): + while True: + ch = self.getc_raw(1, timeout=timeout) + if ch == b'': + break + + def getc(self, size, timeout=1): + c = self.getc_raw(size, timeout) + return c + + def putc(self, buffer, timeout=1): + self.telnet.write(buffer) + self.show_progress(len(buffer)) + + def reboot(self): + # no-op + pass + + def set_file_size(self, filesize): + self.bytes_transfered = 0 + self.filesize = filesize + self.count = 0 + + def show_progress(self, sendsize): + if PRINT_RAW_COMMAND: + if self.count < MAX_DOT_COUNT: + self.bytes_transfered = self.bytes_transfered + sendsize + cur_count = int(self.bytes_transfered * MAX_DOT_COUNT / self.filesize) + if MAX_DOT_COUNT < cur_count: + cur_count = MAX_DOT_COUNT + for idx in range(cur_count - self.count): + print('#',end='') + sys.stdout.flush() + self.count = cur_count + if self.count == MAX_DOT_COUNT: + print("\n") + +class SerialDev: + def __init__(self): + if import_serial_module is False: + print("Cannot import serial module, maybe it's not install yet.") + print("\n", end="") + print("Please install python-setuptool by Cygwin installer.") + print("After that use easy_intall command to install serial module") + print(" $ cd tool/") + print(" $ python3 -m easy_install pyserial-2.7.tar.gz") + quit() + else: + port = ConfigArgs.SERIAL_PORT + try: + self.serial = serial.Serial(port, baudrate=115200, + parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, + bytesize=serial.EIGHTBITS, timeout=0.1) + except Exception as e: + print("Cannot open port : " + port) + sys.exit(e.args[0]) + + def readline(self, size=None): + return self.serial.readline(size) + + def write(self, buffer): + self.serial.write(buffer) + self.serial.flush() + + def discard_inputs(self, timeout=1.0): + time.sleep(timeout) + self.serial.flushInput() + + def getc(self, size, timeout=1): + self.serial.timeout = timeout + c = self.serial.read(size) + self.serial.timeout = 0.1 + return c + + def putc(self, buffer, timeout=1): + self.serial.timeout = timeout + self.serial.write(buffer) + self.serial.flush() + self.serial.timeout = 0.1 + self.show_progress(len(buffer)) + + # Note: windows platform dependent code + def putc_win(self, buffer, timeout=1): + self.serial.write(buffer) + self.show_progress(len(buffer)) + while True: + if self.serial.out_waiting == 0: + break + + def setBaudrate(self, baudrate): +# self.serial.setBaudrate(baudrate) + self.serial.baudrate = baudrate + + def reboot(self): + # Target Reset by DTR + self.serial.setDTR(False) + self.serial.setDTR(True) + self.serial.setDTR(False) + + def set_file_size(self, filesize): + self.bytes_transfered = 0 + self.filesize = filesize + self.count = 0 + + def show_progress(self, sendsize): + if PRINT_RAW_COMMAND: + if self.count < MAX_DOT_COUNT: + self.bytes_transfered = self.bytes_transfered + sendsize + cur_count = int(self.bytes_transfered * MAX_DOT_COUNT / self.filesize) + if MAX_DOT_COUNT < cur_count: + cur_count = MAX_DOT_COUNT + for idx in range(cur_count - self.count): + print('#',end='') + sys.stdout.flush() + self.count = cur_count + if self.count == MAX_DOT_COUNT: + print("\n") + +class FlashWriter: + def __init__(self, protocol_sel=PROTOCOL_SERIAL): + if protocol_sel == PROTOCOL_TELNET: + self.serial = TelnetDev() + else: + self.serial = SerialDev() + + def cancel_autoboot(self) : + boot_msg = '' + self.serial.reboot() # Target reboot before send 'r' + while boot_msg == '' : + rx = self.serial.readline().strip() + self.serial.write(b"r") # Send "r" key to avoid auto boot + for msg in ROM_MSG : + if msg in rx : + boot_msg = msg + break + while True : + rx = self.serial.readline().decode(errors="replace").strip() + if "updater" in rx : + # Workaround : Sometime first character is dropped. + # Send line feed as air shot before actual command. + self.serial.write(b"\n") # Send line feed + self.serial.discard_inputs()# Clear input buffer to sync + return boot_msg.decode(errors="ignore") + + def recv(self): + rx = self.serial.readline() + if PRINT_RAW_COMMAND : + serial_line = rx.decode(errors="replace") + if serial_line.strip() != "" and not serial_line.startswith(XMDM_MSG): + print(serial_line, end="") + return rx + + def wait(self, string): + while True: + rx = self.recv() + if string.encode() in rx: + time.sleep(0.1) + break + + def wait_for_prompt(self): + prompt_pat = re.compile(b"updater") + while True: + rx = self.recv() + if prompt_pat.search(rx): + time.sleep(0.1) + break + + def send(self, string): + self.serial.write(str(string).encode() + b"\n") + rx = self.serial.readline() + if PRINT_RAW_COMMAND : + print(rx.decode(errors="replace"), end="") + + def read_output(self, prompt_text) : + output = [] + while True : + rx = self.serial.readline() + if prompt_text.encode() in rx : + time.sleep(0.1) + break + if rx != "" : + output.append(rx.decode(errors="ignore").rstrip()) + return output + + def install_files(self, files, command) : + if ConfigArgs.XMODEM_BAUD: + command += " -b " + ConfigArgs.XMODEM_BAUD + if os.name == 'nt': + modem = xmodem.XMODEM(self.serial.getc, self.serial.putc_win, 'xmodem1k') + else: + modem = xmodem.XMODEM(self.serial.getc, self.serial.putc, 'xmodem1k') + for file in files: + with open(file, "rb") as bin : + self.send(command) + print("Install " + file) + self.wait(XMDM_MSG) + print("|0%" + + "-" * (int(MAX_DOT_COUNT / 2) - 6) + + "50%" + + "-" * (MAX_DOT_COUNT - int(MAX_DOT_COUNT / 2) - 5) + + "100%|") + if ConfigArgs.XMODEM_BAUD: + self.serial.setBaudrate(ConfigArgs.XMODEM_BAUD) + self.serial.discard_inputs() # Clear input buffer to sync + self.serial.set_file_size(os.path.getsize(file)) + modem.send(bin) + if ConfigArgs.XMODEM_BAUD: + self.serial.setBaudrate(115200) + self.wait_for_prompt() + + def save_files(self, files) : + if ConfigArgs.XMODEM_BAUD: + command = "save_file -b " + ConfigArgs.XMODEM_BAUD + " -x " + else: + command = "save_file -x " + if os.name == 'nt': + modem = xmodem.XMODEM(self.serial.getc, self.serial.putc_win, 'xmodem1k') + else: + modem = xmodem.XMODEM(self.serial.getc, self.serial.putc, 'xmodem1k') + for file in files: + with open(file, "rb") as bin : + self.send(command + os.path.basename(file)) + print("Save " + file) + self.wait(XMDM_MSG) + if ConfigArgs.XMODEM_BAUD: + self.serial.setBaudrate(ConfigArgs.XMODEM_BAUD) + self.serial.discard_inputs() # Clear input buffer to sync + self.serial.set_file_size(os.path.getsize(file)) + modem.send(bin) + if ConfigArgs.XMODEM_BAUD: + self.serial.setBaudrate(115200) + self.wait_for_prompt() + self.send("chmod d+rw " + os.path.basename(file)) + self.wait_for_prompt() + + def delete_files(self, files) : + for file in files : + self.delete_binary(file) + + def delete_binary(self, bin_name) : + self.send("rm " + bin_name) + self.wait_for_prompt() + +def main(): + try: + config_loader = ConfigArgsLoader() + config_loader.update_config() + except: + return errno.EINVAL + + # Wait to reset the board + writer = FlashWriter(ConfigArgs.PROTOCOL_TYPE) + + do_wait_reset = True + if ConfigArgs.AUTO_RESET: + if subprocess.call("cd " + sys.path[0] + "; ./reset_board.sh", shell=True) == 0: + print("auto reset board sucess!!") + do_wait_reset = False + bootrom_msg = writer.cancel_autoboot() + + if ConfigArgs.DTR_RESET: + do_wait_reset = False + bootrom_msg = writer.cancel_autoboot() + + if ConfigArgs.WAIT_RESET == False and do_wait_reset == True: + rx = writer.recv() + time.sleep(1) + for i in range(3): + writer.send("") + rx = writer.recv() + if "updater".encode() in rx: + # No need to wait for reset + do_wait_reset = False + break + time.sleep(1) + + if do_wait_reset: + # Wait to reset the board + print('Please press RESET button on target board') + sys.stdout.flush() + bootrom_msg = writer.cancel_autoboot() + + # Remove files + if ConfigArgs.ERASE_NAME : + print(">>> Remove exisiting files ...") + writer.delete_files(ConfigArgs.ERASE_NAME) + + # Install files + if ConfigArgs.PACKAGE_NAME or ConfigArgs.PKGSYS_NAME or ConfigArgs.PKGAPP_NAME or ConfigArgs.PKGUPD_NAME: + print(">>> Install files ...") + if ConfigArgs.PACKAGE_NAME : + writer.install_files(ConfigArgs.PACKAGE_NAME, "install") + if ConfigArgs.PKGSYS_NAME : + writer.install_files(ConfigArgs.PKGSYS_NAME, "install") + if ConfigArgs.PKGAPP_NAME : + writer.install_files(ConfigArgs.PKGAPP_NAME, "install") + if ConfigArgs.PKGUPD_NAME : + writer.install_files(ConfigArgs.PKGUPD_NAME, "install -k updater.key") + + # Save files + if ConfigArgs.FILE_NAME : + print(">>> Save files ...") + writer.save_files(ConfigArgs.FILE_NAME) + + # Set auto boot + if not ConfigArgs.NO_SET_BOOTABLE: + print(">>> Save Configuration to FlashROM ...") + writer.send("set bootable M0P") + writer.wait_for_prompt() + + # Sync all cached data to flash + writer.send("sync") + writer.wait_for_prompt() + + if REBOOT_AT_END : + print("Restarting the board ...") + writer.send("reboot") + + return 0 + +if __name__ == "__main__": + try: + sys.exit(main()) + except KeyboardInterrupt: + print("Canceled by keyboard interrupt.") + pass diff --git a/ports/cxd56/tools/xmodem.py b/ports/cxd56/tools/xmodem.py new file mode 100644 index 0000000000..c934300560 --- /dev/null +++ b/ports/cxd56/tools/xmodem.py @@ -0,0 +1,590 @@ +''' +=============================== + XMODEM file transfer protocol +=============================== + +.. $Id$ + +This is a literal implementation of XMODEM.TXT_, XMODEM1K.TXT_ and +XMODMCRC.TXT_, support for YMODEM and ZMODEM is pending. YMODEM should +be fairly easy to implement as it is a hack on top of the XMODEM +protocol using sequence bytes ``0x00`` for sending file names (and some +meta data). + +.. _XMODEM.TXT: doc/XMODEM.TXT +.. _XMODEM1K.TXT: doc/XMODEM1K.TXT +.. _XMODMCRC.TXT: doc/XMODMCRC.TXT + +Data flow example including error recovery +========================================== + +Here is a sample of the data flow, sending a 3-block message. +It includes the two most common line hits - a garbaged block, +and an ``ACK`` reply getting garbaged. ``CRC`` or ``CSUM`` represents +the checksum bytes. + +XMODEM 128 byte blocks +---------------------- + +:: + + SENDER RECEIVER + + <-- NAK + SOH 01 FE Data[128] CSUM --> + <-- ACK + SOH 02 FD Data[128] CSUM --> + <-- ACK + SOH 03 FC Data[128] CSUM --> + <-- ACK + SOH 04 FB Data[128] CSUM --> + <-- ACK + SOH 05 FA Data[100] CPMEOF[28] CSUM --> + <-- ACK + EOT --> + <-- ACK + +XMODEM-1k blocks, CRC mode +-------------------------- + +:: + + SENDER RECEIVER + + <-- C + STX 01 FE Data[1024] CRC CRC --> + <-- ACK + STX 02 FD Data[1024] CRC CRC --> + <-- ACK + STX 03 FC Data[1000] CPMEOF[24] CRC CRC --> + <-- ACK + EOT --> + <-- ACK + +Mixed 1024 and 128 byte Blocks +------------------------------ + +:: + + SENDER RECEIVER + + <-- C + STX 01 FE Data[1024] CRC CRC --> + <-- ACK + STX 02 FD Data[1024] CRC CRC --> + <-- ACK + SOH 03 FC Data[128] CRC CRC --> + <-- ACK + SOH 04 FB Data[100] CPMEOF[28] CRC CRC --> + <-- ACK + EOT --> + <-- ACK + +YMODEM Batch Transmission Session (1 file) +------------------------------------------ + +:: + + SENDER RECEIVER + <-- C (command:rb) + SOH 00 FF foo.c NUL[123] CRC CRC --> + <-- ACK + <-- C + SOH 01 FE Data[128] CRC CRC --> + <-- ACK + SOH 02 FC Data[128] CRC CRC --> + <-- ACK + SOH 03 FB Data[100] CPMEOF[28] CRC CRC --> + <-- ACK + EOT --> + <-- NAK + EOT --> + <-- ACK + <-- C + SOH 00 FF NUL[128] CRC CRC --> + <-- ACK + + +''' + +__author__ = 'Wijnand Modderman ' +__copyright__ = ['Copyright (c) 2010 Wijnand Modderman', + 'Copyright (c) 1981 Chuck Forsberg'] +__license__ = 'MIT' +__version__ = '0.3.2' + +import logging +import time +import sys +from functools import partial +import collections + +# Loggerr +log = logging.getLogger('xmodem') + +# Protocol bytes +SOH = bytes([0x01]) +STX = bytes([0x02]) +EOT = bytes([0x04]) +ACK = bytes([0x06]) +DLE = bytes([0x10]) +NAK = bytes([0x15]) +CAN = bytes([0x18]) +CRC = bytes([0x43]) # C + + +class XMODEM(object): + ''' + XMODEM Protocol handler, expects an object to read from and an object to + write to. + + >>> def getc(size, timeout=1): + ... return data or None + ... + >>> def putc(data, timeout=1): + ... return size or None + ... + >>> modem = XMODEM(getc, putc) + + + :param getc: Function to retreive bytes from a stream + :type getc: callable + :param putc: Function to transmit bytes to a stream + :type putc: callable + :param mode: XMODEM protocol mode + :type mode: string + :param pad: Padding character to make the packets match the packet size + :type pad: char + + ''' + + # crctab calculated by Mark G. Mendel, Network Systems Corporation + crctable = [ + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0, + ] + + def __init__(self, getc, putc, mode='xmodem', pad=b'\x1a'): + self.getc = getc + self.putc = putc + self.mode = mode + self.pad = pad + + def abort(self, count=2, timeout=60): + ''' + Send an abort sequence using CAN bytes. + ''' + for counter in range(0, count): + self.putc(CAN, timeout) + + def send(self, stream, retry=32, timeout=360, quiet=0, callback=None): + ''' + Send a stream via the XMODEM protocol. + + >>> stream = file('/etc/issue', 'rb') + >>> print modem.send(stream) + True + + Returns ``True`` upon succesful transmission or ``False`` in case of + failure. + + :param stream: The stream object to send data from. + :type stream: stream (file, etc.) + :param retry: The maximum number of times to try to resend a failed + packet before failing. + :type retry: int + :param timeout: The number of seconds to wait for a response before + timing out. + :type timeout: int + :param quiet: If 0, it prints info to stderr. If 1, it does not print any info. + :type quiet: int + :param callback: Reference to a callback function that has the + following signature. This is useful for + getting status updates while a xmodem + transfer is underway. + Expected callback signature: + def callback(total_packets, success_count, error_count) + :type callback: callable + ''' + + # initialize protocol + try: + packet_size = dict( + xmodem = 128, + xmodem1k = 1024, + )[self.mode] + except AttributeError: + raise ValueError("An invalid mode was supplied") + + error_count = 0 + crc_mode = 0 + cancel = 0 + while True: + char = self.getc(1) + if char: + if char == NAK: + crc_mode = 0 + break + elif char == CRC: + crc_mode = 1 + break + elif char == CAN: + if not quiet: + print('received CAN', file=sys.stderr) + if cancel: + return False + else: + cancel = 1 + else: + log.error('send ERROR expected NAK/CRC, got %s' % \ + (ord(char),)) + + error_count += 1 + if error_count >= retry: + self.abort(timeout=timeout) + return False + + # send data + error_count = 0 + success_count = 0 + total_packets = 0 + sequence = 1 + while True: + data = stream.read(packet_size) + if not data: + log.info('sending EOT') + # end of stream + break + total_packets += 1 + data = data.ljust(packet_size, self.pad) + if crc_mode: + crc = self.calc_crc(data) + else: + crc = self.calc_checksum(data) + + # emit packet + while True: + if packet_size == 128: + self.putc(SOH) + else: # packet_size == 1024 + self.putc(STX) + self.putc(bytes([sequence])) + self.putc(bytes([0xff - sequence])) + self.putc(data) + if crc_mode: + self.putc(bytes([crc >> 8])) + self.putc(bytes([crc & 0xff])) + else: + self.putc(bytes([crc])) + + char = self.getc(1, timeout) + if char == ACK: + success_count += 1 + if isinstance(callback, collections.Callable): + callback(total_packets, success_count, error_count) + break + if char == NAK: + error_count += 1 + if isinstance(callback, collections.Callable): + callback(total_packets, success_count, error_count) + if error_count >= retry: + # excessive amounts of retransmissions requested, + # abort transfer + self.abort(timeout=timeout) + log.warning('excessive NAKs, transfer aborted') + return False + + # return to loop and resend + continue + else: + log.error('Not ACK, Not NAK') + error_count += 1 + if isinstance(callback, collections.Callable): + callback(total_packets, success_count, error_count) + if error_count >= retry: + # excessive amounts of retransmissions requested, + # abort transfer + self.abort(timeout=timeout) + log.warning('excessive protocol errors, transfer aborted') + return False + + # return to loop and resend + continue + + # protocol error + self.abort(timeout=timeout) + log.error('protocol error') + return False + + # keep track of sequence + sequence = (sequence + 1) % 0x100 + + while True: + # end of transmission + self.putc(EOT) + + #An ACK should be returned + char = self.getc(1, timeout) + if char == ACK: + break + else: + error_count += 1 + if error_count >= retry: + self.abort(timeout=timeout) + log.warning('EOT was not ACKd, transfer aborted') + return False + + return True + + def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0): + ''' + Receive a stream via the XMODEM protocol. + + >>> stream = file('/etc/issue', 'wb') + >>> print modem.recv(stream) + 2342 + + Returns the number of bytes received on success or ``None`` in case of + failure. + ''' + + # initiate protocol + error_count = 0 + char = 0 + cancel = 0 + while True: + # first try CRC mode, if this fails, + # fall back to checksum mode + if error_count >= retry: + self.abort(timeout=timeout) + return None + elif crc_mode and error_count < (retry / 2): + if not self.putc(CRC): + time.sleep(delay) + error_count += 1 + else: + crc_mode = 0 + if not self.putc(NAK): + time.sleep(delay) + error_count += 1 + + char = self.getc(1, timeout) + if not char: + error_count += 1 + continue + elif char == SOH: + #crc_mode = 0 + break + elif char == STX: + break + elif char == CAN: + if cancel: + return None + else: + cancel = 1 + else: + error_count += 1 + + # read data + error_count = 0 + income_size = 0 + packet_size = 128 + sequence = 1 + cancel = 0 + while True: + while True: + if char == SOH: + packet_size = 128 + break + elif char == STX: + packet_size = 1024 + break + elif char == EOT: + # We received an EOT, so send an ACK and return the received + # data length + self.putc(ACK) + return income_size + elif char == CAN: + # cancel at two consecutive cancels + if cancel: + return None + else: + cancel = 1 + else: + if not quiet: + print('recv ERROR expected SOH/EOT, got', ord(char), file=sys.stderr) + error_count += 1 + if error_count >= retry: + self.abort() + return None + # read sequence + error_count = 0 + cancel = 0 + seq1 = ord(self.getc(1)) + seq2 = 0xff - ord(self.getc(1)) + if seq1 == sequence and seq2 == sequence: + # sequence is ok, read packet + # packet_size + checksum + data = self.getc(packet_size + 1 + crc_mode, timeout) + if crc_mode: + csum = (ord(data[-2]) << 8) + ord(data[-1]) + data = data[:-2] + log.debug('CRC (%04x <> %04x)' % \ + (csum, self.calc_crc(data))) + valid = csum == self.calc_crc(data) + else: + csum = data[-1] + data = data[:-1] + log.debug('checksum (checksum(%02x <> %02x)' % \ + (ord(csum), self.calc_checksum(data))) + valid = ord(csum) == self.calc_checksum(data) + + # valid data, append chunk + if valid: + income_size += len(data) + stream.write(data) + self.putc(ACK) + sequence = (sequence + 1) % 0x100 + char = self.getc(1, timeout) + continue + else: + # consume data + self.getc(packet_size + 1 + crc_mode) + self.debug('expecting sequence %d, got %d/%d' % \ + (sequence, seq1, seq2)) + + # something went wrong, request retransmission + self.putc(NAK) + + def calc_checksum(self, data, checksum=0): + ''' + Calculate the checksum for a given block of data, can also be used to + update a checksum. + + >>> csum = modem.calc_checksum('hello') + >>> csum = modem.calc_checksum('world', csum) + >>> hex(csum) + '0x3c' + + ''' + return (sum(map(ord, data)) + checksum) % 256 + + def calc_crc(self, data, crc=0): + ''' + Calculate the Cyclic Redundancy Check for a given block of data, can + also be used to update a CRC. + + >>> crc = modem.calc_crc('hello') + >>> crc = modem.calc_crc('world', crc) + >>> hex(crc) + '0xd5e3' + + ''' + for char in data: + crc = (crc << 8) ^ self.crctable[((crc >> 8) ^ int(char)) & 0xff] + return crc & 0xffff + + +XMODEM1k = partial(XMODEM, mode='xmodem1k') + + +def run(): + import optparse + import subprocess + + parser = optparse.OptionParser(usage='%prog [] filename filename') + parser.add_option('-m', '--mode', default='xmodem', + help='XMODEM mode (xmodem, xmodem1k)') + + options, args = parser.parse_args() + if len(args) != 3: + parser.error('invalid arguments') + return 1 + + elif args[0] not in ('send', 'recv'): + parser.error('invalid mode') + return 1 + + def _func(so, si): + import select + import subprocess + + print('si', si) + print('so', so) + + def getc(size, timeout=3): + w,t,f = select.select([so], [], [], timeout) + if w: + data = so.read(size) + else: + data = None + + print('getc(', repr(data), ')') + return data + + def putc(data, timeout=3): + w,t,f = select.select([], [si], [], timeout) + if t: + si.write(data) + si.flush() + size = len(data) + else: + size = None + + print('putc(', repr(data), repr(size), ')') + return size + + return getc, putc + + def _pipe(*command): + pipe = subprocess.Popen(command, + stdout=subprocess.PIPE, stdin=subprocess.PIPE) + return pipe.stdout, pipe.stdin + + if args[0] == 'recv': + import io + getc, putc = _func(*_pipe('sz', '--xmodem', args[2])) + stream = open(args[1], 'wb') + xmodem = XMODEM(getc, putc, mode=options.mode) + status = xmodem.recv(stream, retry=8) + stream.close() + + elif args[0] == 'send': + getc, putc = _func(*_pipe('rz', '--xmodem', args[2])) + stream = open(args[1], 'rb') + xmodem = XMODEM(getc, putc, mode=options.mode) + status = xmodem.send(stream, retry=8) + stream.close() + +if __name__ == '__main__': + sys.exit(run()) From 2f80460a2f81dd036dd4aa158f935884a3b71cd0 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 2 Jul 2020 22:57:58 +0200 Subject: [PATCH 139/277] Fluff M0: additional pins on version 1.3 of the board --- ports/atmel-samd/boards/fluff_m0/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/fluff_m0/pins.c b/ports/atmel-samd/boards/fluff_m0/pins.c index d80d46b895..ac7811328b 100644 --- a/ports/atmel-samd/boards/fluff_m0/pins.c +++ b/ports/atmel-samd/boards/fluff_m0/pins.c @@ -30,6 +30,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA28) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 9dbb6fdb38c2089ad80666bc75986201d15b46a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Wed, 3 Jun 2020 23:25:19 +0100 Subject: [PATCH 140/277] Add a `.mailmap` file to collate together multiple author entries. This reduces the 484 separate authors into 405, removing some obviously invalid addresses on the way. --- .mailmap | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000..f9d7f47a16 --- /dev/null +++ b/.mailmap @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò +# +# SPDX-License-Identifier: Unlicense + +Alexander Steffen +Alexander Steffen +Alexander Steffen +Benjamin Vernoux +Brent Rubell +Brent Rubell +Brent Rubell +Carlos +Chris Packham +Chris Packham +Damiano Mazzella +Damien George +Dan Halbert +Dan Halbert +Daniel Pollard +Daniel Pollard +Daniel Tralamazza +Daniel Tralamazza +David Glaude +David Glaude +George Waters +George Waters +Ha Thach +Henrik Sölver +Ilya Dmitrichenko +Ilya Dmitrichenko +Jason Pecor <14111408+jpecor@users.noreply.github.com> +Jeff Epler +Jeff Epler +Jeff Epler +Jeff Epler +Jerry Needell +Joe Bakalor +Josh Klar +Josh Klar +Juan Biondi +Juan Biondi +KalbeAbbas +KalbeAbbas +Kamil Tomaszewski +Kamil Tomaszewski <46525824+kamtom480@users.noreply.github.com> +Kattni +Kattni Rembor +Kenny +Kenny <3454741+WarriorOfWire@users.noreply.github.com> +Kevin Townsend +Kevin Townsend +Krzysztof Blazewicz +Krzysztof Blazewicz +Li Weiwei +Li Weiwei +Limor "Ladyada" Fried +Limor "Ladyada" Fried +Lucian Copeland +Lucian Copeland +Mark Olsson +Mark Olsson +Matt Land +Matt Land +Matt Wozniski +Matt Wozniski +Melissa LeBlanc-Williams +Melissa LeBlanc-Williams +Metallicow +Metallicow +Peter Hinch +Peter Hinch +Radomir Dopieralski +Radomir Dopieralski +Rafa Gould +Rafa Gould <50337143+rafa-gould@users.noreply.github.com> +Ryan Shaw +Ryan Shaw +Sabas +Sabas +Sabas +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Scott Shawcroft +Sebastian Plamauer +Sebastian Plamauer +Senuros +Senuros +Stewart Colborne +Stewart Colborne +TG-Techie +TG-Techie <39284876+TG-Techie@users.noreply.github.com> +Thea Flowers +Thea Flowers +Tobias Badertscher +Tobias Badertscher +danicampora +danicampora +dherrada +dherrada <33632497+dherrada@users.noreply.github.com> +dherrada <=> +glennrub +retoc +retoc +siddacious +siddacious +siddacious +sommersoft +sommersoft +stijn +stijn From f4a1cfb11667e6ded52249f6a59895cddea9b7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Wed, 3 Jun 2020 23:27:48 +0100 Subject: [PATCH 141/277] Add LICENSES as identified by REUSE tooling. --- LICENSES/BSD-3-Clause.txt | 26 +++ LICENSES/CC-BY-4.0.txt | 324 ++++++++++++++++++++++++++++++++++++++ LICENSES/MIT.txt | 19 +++ LICENSES/Unlicense.txt | 20 +++ 4 files changed, 389 insertions(+) create mode 100644 LICENSES/BSD-3-Clause.txt create mode 100644 LICENSES/CC-BY-4.0.txt create mode 100644 LICENSES/MIT.txt create mode 100644 LICENSES/Unlicense.txt diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt new file mode 100644 index 0000000000..0741db789e --- /dev/null +++ b/LICENSES/BSD-3-Clause.txt @@ -0,0 +1,26 @@ +Copyright (c) . All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/CC-BY-4.0.txt b/LICENSES/CC-BY-4.0.txt new file mode 100644 index 0000000000..3f92dfc5fd --- /dev/null +++ b/LICENSES/CC-BY-4.0.txt @@ -0,0 +1,324 @@ +Creative Commons Attribution 4.0 International Creative Commons Corporation +("Creative Commons") is not a law firm and does not provide legal services +or legal advice. Distribution of Creative Commons public licenses does not +create a lawyer-client or other relationship. Creative Commons makes its licenses +and related information available on an "as-is" basis. Creative Commons gives +no warranties regarding its licenses, any material licensed under their terms +and conditions, or any related information. Creative Commons disclaims all +liability for damages resulting from their use to the fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and conditions +that creators and other rights holders may use to share original works of +authorship and other material subject to copyright and certain other rights +specified in the public license below. The following considerations are for +informational purposes only, are not exhaustive, and do not form part of our +licenses. + +Considerations for licensors: Our public licenses are intended for use by +those authorized to give the public permission to use material in ways otherwise +restricted by copyright and certain other rights. Our licenses are irrevocable. +Licensors should read and understand the terms and conditions of the license +they choose before applying it. Licensors should also secure all rights necessary +before applying our licenses so that the public can reuse the material as +expected. Licensors should clearly mark any material not subject to the license. +This includes other CC-licensed material, or material used under an exception +or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors + +Considerations for the public: By using one of our public licenses, a licensor +grants the public permission to use the licensed material under specified +terms and conditions. If the licensor's permission is not necessary for any +reason–for example, because of any applicable exception or limitation to copyright–then +that use is not regulated by the license. Our licenses grant only permissions +under copyright and certain other rights that a licensor has authority to +grant. Use of the licensed material may still be restricted for other reasons, +including because others have copyright or other rights in the material. A +licensor may make special requests, such as asking that all changes be marked +or described. Although not required by our licenses, you are encouraged to +respect those requests where reasonable. More considerations for the public +: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution +4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to +be bound by the terms and conditions of this Creative Commons Attribution +4.0 International Public License ("Public License"). To the extent this Public +License may be interpreted as a contract, You are granted the Licensed Rights +in consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the Licensor +receives from making the Licensed Material available under these terms and +conditions. + +Section 1 – Definitions. + +a. Adapted Material means material subject to Copyright and Similar Rights +that is derived from or based upon the Licensed Material and in which the +Licensed Material is translated, altered, arranged, transformed, or otherwise +modified in a manner requiring permission under the Copyright and Similar +Rights held by the Licensor. For purposes of this Public License, where the +Licensed Material is a musical work, performance, or sound recording, Adapted +Material is always produced where the Licensed Material is synched in timed +relation with a moving image. + +b. Adapter's License means the license You apply to Your Copyright and Similar +Rights in Your contributions to Adapted Material in accordance with the terms +and conditions of this Public License. + +c. Copyright and Similar Rights means copyright and/or similar rights closely +related to copyright including, without limitation, performance, broadcast, +sound recording, and Sui Generis Database Rights, without regard to how the +rights are labeled or categorized. For purposes of this Public License, the +rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + +d. Effective Technological Measures means those measures that, in the absence +of proper authority, may not be circumvented under laws fulfilling obligations +under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, +and/or similar international agreements. + +e. Exceptions and Limitations means fair use, fair dealing, and/or any other +exception or limitation to Copyright and Similar Rights that applies to Your +use of the Licensed Material. + +f. Licensed Material means the artistic or literary work, database, or other +material to which the Licensor applied this Public License. + +g. Licensed Rights means the rights granted to You subject to the terms and +conditions of this Public License, which are limited to all Copyright and +Similar Rights that apply to Your use of the Licensed Material and that the +Licensor has authority to license. + +h. Licensor means the individual(s) or entity(ies) granting rights under this +Public License. + +i. Share means to provide material to the public by any means or process that +requires permission under the Licensed Rights, such as reproduction, public +display, public performance, distribution, dissemination, communication, or +importation, and to make material available to the public including in ways +that members of the public may access the material from a place and at a time +individually chosen by them. + +j. Sui Generis Database Rights means rights other than copyright resulting +from Directive 96/9/EC of the European Parliament and of the Council of 11 +March 1996 on the legal protection of databases, as amended and/or succeeded, +as well as other essentially equivalent rights anywhere in the world. + +k. You means the individual or entity exercising the Licensed Rights under +this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + a. License grant. + +1. Subject to the terms and conditions of this Public License, the Licensor +hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, +irrevocable license to exercise the Licensed Rights in the Licensed Material +to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + +2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions +and Limitations apply to Your use, this Public License does not apply, and +You do not need to comply with its terms and conditions. + + 3. Term. The term of this Public License is specified in Section 6(a). + +4. Media and formats; technical modifications allowed. The Licensor authorizes +You to exercise the Licensed Rights in all media and formats whether now known +or hereafter created, and to make technical modifications necessary to do +so. The Licensor waives and/or agrees not to assert any right or authority +to forbid You from making technical modifications necessary to exercise the +Licensed Rights, including technical modifications necessary to circumvent +Effective Technological Measures. For purposes of this Public License, simply +making modifications authorized by this Section 2(a)(4) never produces Adapted +Material. + + 5. Downstream recipients. + +A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed +Material automatically receives an offer from the Licensor to exercise the +Licensed Rights under the terms and conditions of this Public License. + +B. No downstream restrictions. You may not offer or impose any additional +or different terms or conditions on, or apply any Effective Technological +Measures to, the Licensed Material if doing so restricts exercise of the Licensed +Rights by any recipient of the Licensed Material. + +6. No endorsement. Nothing in this Public License constitutes or may be construed +as permission to assert or imply that You are, or that Your use of the Licensed +Material is, connected with, or sponsored, endorsed, or granted official status +by, the Licensor or others designated to receive attribution as provided in +Section 3(a)(1)(A)(i). + + b. Other rights. + +1. Moral rights, such as the right of integrity, are not licensed under this +Public License, nor are publicity, privacy, and/or other similar personality +rights; however, to the extent possible, the Licensor waives and/or agrees +not to assert any such rights held by the Licensor to the limited extent necessary +to allow You to exercise the Licensed Rights, but not otherwise. + +2. Patent and trademark rights are not licensed under this Public License. + +3. To the extent possible, the Licensor waives any right to collect royalties +from You for the exercise of the Licensed Rights, whether directly or through +a collecting society under any voluntary or waivable statutory or compulsory +licensing scheme. In all other cases the Licensor expressly reserves any right +to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following +conditions. + + a. Attribution. + +1. If You Share the Licensed Material (including in modified form), You must: + +A. retain the following if it is supplied by the Licensor with the Licensed +Material: + +i. identification of the creator(s) of the Licensed Material and any others +designated to receive attribution, in any reasonable manner requested by the +Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + +v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + +B. indicate if You modified the Licensed Material and retain an indication +of any previous modifications; and + +C. indicate the Licensed Material is licensed under this Public License, and +include the text of, or the URI or hyperlink to, this Public License. + +2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner +based on the medium, means, and context in which You Share the Licensed Material. +For example, it may be reasonable to satisfy the conditions by providing a +URI or hyperlink to a resource that includes the required information. + +3. If requested by the Licensor, You must remove any of the information required +by Section 3(a)(1)(A) to the extent reasonably practicable. + +4. If You Share Adapted Material You produce, the Adapter's License You apply +must not prevent recipients of the Adapted Material from complying with this +Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to +Your use of the Licensed Material: + +a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, +reuse, reproduce, and Share all or a substantial portion of the contents of +the database; + +b. if You include all or a substantial portion of the database contents in +a database in which You have Sui Generis Database Rights, then the database +in which You have Sui Generis Database Rights (but not its individual contents) +is Adapted Material; and + +c. You must comply with the conditions in Section 3(a) if You Share all or +a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace +Your obligations under this Public License where the Licensed Rights include +other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + +a. Unless otherwise separately undertaken by the Licensor, to the extent possible, +the Licensor offers the Licensed Material as-is and as-available, and makes +no representations or warranties of any kind concerning the Licensed Material, +whether express, implied, statutory, or other. This includes, without limitation, +warranties of title, merchantability, fitness for a particular purpose, non-infringement, +absence of latent or other defects, accuracy, or the presence or absence of +errors, whether or not known or discoverable. Where disclaimers of warranties +are not allowed in full or in part, this disclaimer may not apply to You. + +b. To the extent possible, in no event will the Licensor be liable to You +on any legal theory (including, without limitation, negligence) or otherwise +for any direct, special, indirect, incidental, consequential, punitive, exemplary, +or other losses, costs, expenses, or damages arising out of this Public License +or use of the Licensed Material, even if the Licensor has been advised of +the possibility of such losses, costs, expenses, or damages. Where a limitation +of liability is not allowed in full or in part, this limitation may not apply +to You. + +c. The disclaimer of warranties and limitation of liability provided above +shall be interpreted in a manner that, to the extent possible, most closely +approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + +a. This Public License applies for the term of the Copyright and Similar Rights +licensed here. However, if You fail to comply with this Public License, then +Your rights under this Public License terminate automatically. + +b. Where Your right to use the Licensed Material has terminated under Section +6(a), it reinstates: + +1. automatically as of the date the violation is cured, provided it is cured +within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + +c. For the avoidance of doubt, this Section 6(b) does not affect any right +the Licensor may have to seek remedies for Your violations of this Public +License. + +d. For the avoidance of doubt, the Licensor may also offer the Licensed Material +under separate terms or conditions or stop distributing the Licensed Material +at any time; however, doing so will not terminate this Public License. + + e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + +a. The Licensor shall not be bound by any additional or different terms or +conditions communicated by You unless expressly agreed. + +b. Any arrangements, understandings, or agreements regarding the Licensed +Material not stated herein are separate from and independent of the terms +and conditions of this Public License. + +Section 8 – Interpretation. + +a. For the avoidance of doubt, this Public License does not, and shall not +be interpreted to, reduce, limit, restrict, or impose conditions on any use +of the Licensed Material that could lawfully be made without permission under +this Public License. + +b. To the extent possible, if any provision of this Public License is deemed +unenforceable, it shall be automatically reformed to the minimum extent necessary +to make it enforceable. If the provision cannot be reformed, it shall be severed +from this Public License without affecting the enforceability of the remaining +terms and conditions. + +c. No term or condition of this Public License will be waived and no failure +to comply consented to unless expressly agreed to by the Licensor. + +d. Nothing in this Public License constitutes or may be interpreted as a limitation +upon, or waiver of, any privileges and immunities that apply to the Licensor +or You, including from the legal processes of any jurisdiction or authority. + +Creative Commons is not a party to its public licenses. Notwithstanding, Creative +Commons may elect to apply one of its public licenses to material it publishes +and in those instances will be considered the "Licensor." The text of the +Creative Commons public licenses is dedicated to the public domain under the +CC0 Public Domain Dedication. Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as otherwise +permitted by the Creative Commons policies published at creativecommons.org/policies, +Creative Commons does not authorize the use of the trademark "Creative Commons" +or any other trademark or logo of Creative Commons without its prior written +consent including, without limitation, in connection with any unauthorized +modifications to any of its public licenses or any other arrangements, understandings, +or agreements concerning use of licensed material. For the avoidance of doubt, +this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000000..204b93da48 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,19 @@ +MIT License Copyright (c) + +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 (including the next +paragraph) 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. diff --git a/LICENSES/Unlicense.txt b/LICENSES/Unlicense.txt new file mode 100644 index 0000000000..24a8f90199 --- /dev/null +++ b/LICENSES/Unlicense.txt @@ -0,0 +1,20 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or distribute +this software, either in source code form or as a compiled binary, for any +purpose, commercial or non-commercial, and by any means. + +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and +to the detriment of our heirs and successors. We intend this dedication to +be an overt act of relinquishment in perpetuity of all present and future +rights to this software under copyright law. + +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 +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. For more information, +please refer to From eed7e84d94efe038f8af13bbfcb889bb9cc2f363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 4 Jun 2020 08:49:24 +0100 Subject: [PATCH 142/277] Add an explicit SPDX license file for ter-u12n. While the .bdf file already includes copyright information, this makes it visible as part of REUSE SPDX identification. --- LICENSES/OFL-1.1.txt | 90 ++++++++++++++++++++++++++++++++ tools/fonts/ter-u12n.bdf.license | 3 ++ 2 files changed, 93 insertions(+) create mode 100644 LICENSES/OFL-1.1.txt create mode 100644 tools/fonts/ter-u12n.bdf.license diff --git a/LICENSES/OFL-1.1.txt b/LICENSES/OFL-1.1.txt new file mode 100644 index 0000000000..084c9628a6 --- /dev/null +++ b/LICENSES/OFL-1.1.txt @@ -0,0 +1,90 @@ +Copyright (c) , (), + +with Reserved Font Name . This Font Software is licensed +under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL +SIL OPEN FONT LICENSE + +Version 1.1 - 26 February 2007 + +PREAMBLE + +The goals of the Open Font License (OFL) are to stimulate worldwide development +of collaborative font projects, to support the font creation efforts of academic +and linguistic communities, and to provide a free and open framework in which +fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed +freely as long as they are not sold by themselves. The fonts, including any +derivative works, can be bundled, embedded, redistributed and/or sold with +any software provided that any reserved names are not used by derivative works. +The fonts and derivatives, however, cannot be released under any other type +of license. The requirement for fonts to remain under this license does not +apply to any document created using the fonts or their derivatives. + +DEFINITIONS + +"Font Software" refers to the set of files released by the Copyright Holder(s) +under this license and clearly marked as such. This may include source files, +build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the copyright +statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, or +substituting — in part or in whole — any of the components of the Original +Version, by changing formats or by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer or +other person who contributed to the Font Software. + +PERMISSION & CONDITIONS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the Font Software, to use, study, copy, merge, embed, modify, redistribute, +and sell modified and unmodified copies of the Font Software, subject to the +following conditions: + +1) Neither the Font Software nor any of its individual components, in Original +or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed +and/or sold with any software, provided that each copy contains the above +copyright notice and this license. These can be included either as stand-alone +text files, human-readable headers or in the appropriate machine-readable +metadata fields within text or binary files as long as those fields can be +easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) +unless explicit written permission is granted by the corresponding Copyright +Holder. This restriction only applies to the primary font name as presented +to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software +shall not be used to promote, endorse or advertise any Modified Version, except +to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) +or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be +distributed entirely under this license, and must not be distributed under +any other license. The requirement for fonts to remain under this license +does not apply to any document created using the Font Software. + +TERMINATION + +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, +INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT +SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/tools/fonts/ter-u12n.bdf.license b/tools/fonts/ter-u12n.bdf.license new file mode 100644 index 0000000000..a40e8711de --- /dev/null +++ b/tools/fonts/ter-u12n.bdf.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Dimitar Toshkov Zhekov + +SPDX-License-Identifier: OFL-1.1 From d7e57259f9d6c73dfba46a4710625bde4e50979a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 4 Jun 2020 08:59:49 +0100 Subject: [PATCH 143/277] Add copyright and license information to translations. Since these have multiple copyright lines already, preserve those in addition to the generic 'contributors' line, but make them appear as SPDX lines. --- locale/ID.po | 7 +++---- locale/circuitpython.pot | 8 +++----- locale/cs.po | 7 +++---- locale/de_DE.po | 7 +++---- locale/en_US.po | 7 +++---- locale/en_x_pirate.po | 7 +++---- locale/es.po | 12 +++++++----- locale/fil.po | 7 +++---- locale/fr.po | 10 +++++----- locale/it_IT.po | 9 ++++----- locale/ko.po | 9 ++++----- locale/nl.po | 7 +++---- locale/pl.po | 8 ++++---- locale/pt_BR.po | 7 +++---- locale/sv.po | 7 +++---- locale/zh_Latn_pinyin.po | 8 ++++---- 16 files changed, 58 insertions(+), 69 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index a0c255b233..11834ec133 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 6e32ebab98..5abccd4bef 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1,9 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -#, fuzzy +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/cs.po b/locale/cs.po index dfe1cfa384..bc4e3df05b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/de_DE.po b/locale/de_DE.po index f2d9258566..13afa135d5 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/en_US.po b/locale/en_US.po index c89772779e..de9fa6347d 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 16f2b3669a..40b0b314c4 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -1,8 +1,7 @@ -# Pirate (English) Translation -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/es.po b/locale/es.po index 423d673617..b3963e98b4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1,8 +1,10 @@ -# Spanish translation. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Carlos Diaz , 2018. -# Juan Biondi , 2018. +# SPDX-FileCopyrightText: 2018 Carlos Diaz +# SPDX-FileCopyrightText: 2018 Juan Biondi +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT +#, fuzzy + msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/fil.po b/locale/fil.po index 3489316130..b5058c8722 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/fr.po b/locale/fr.po index 2db7f47222..d292fad249 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1,9 +1,9 @@ -# French translation. -# Copyright (C) 2018 -# This file is distributed under the same license as the PACKAGE package. -# Pierrick Couturier , 2018. -# Olivier Deveault +# SPDX-FileCopyrightText: 2018 Pierrick Couturier +# SPDX-FileCopyrightText: 2018 Olivier Deveault +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: 0.1\n" diff --git a/locale/it_IT.po b/locale/it_IT.po index bd49e2388b..6bc322a537 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1,9 +1,8 @@ -# Italian translation. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Enrico Paganin , 2018 +# SPDX-FileCopyrightText: 2018 Enrico Paganin +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -#, fuzzy +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/ko.po b/locale/ko.po index 4bd56cde1e..c0dffe1d5d 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1,9 +1,8 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# 글라파, 2019. +# SPDX-FileCopyrightText: 2019 글라파 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -#, fuzzy +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/nl.po b/locale/nl.po index 34e9c835a2..69d739a22f 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/pl.po b/locale/pl.po index 7724481314..b100ffae08 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1,8 +1,8 @@ -# Adafruit CircuitPython Polish Translation -# Copyright (C) 2019 -# This file is distributed under the same license as the CircuitPython package. -# Radomir Dopieralski , 2019. +# SPDX-FileCopyrightText: 2019 Radomir Dopieralski +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f25d2d86e6..d6e2e83f5d 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/sv.po b/locale/sv.po index 3ec91c19ee..a8579794a4 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1,8 +1,7 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index db41adb536..e8898d79e1 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1,8 +1,8 @@ -# Adafruit CircuitPython Chinese Hanyu Pinyin Translation -# Copyright (C) 2019 -# This file is distributed under the same license as the CircuitPython package. -# @hexthat#2155, 2019. +# SPDX-FileCopyrightText: 2019 @hexthat#2155 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # +# SPDX-License-Identifier: MIT + msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" From 34b4993d63a6b576f29d624385c681f679b4124c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Wed, 3 Jun 2020 23:40:05 +0100 Subject: [PATCH 144/277] Add license to some obvious files. --- .gitattributes | 4 +++ .github/workflows/build.yml | 4 +++ .github/workflows/create_website_pr.yml | 4 +++ .gitignore | 4 +++ .gitmodules | 4 +++ .readthedocs.yml | 4 +++ .rosie.yml | 4 +++ ACKNOWLEDGEMENTS.license | 3 ++ BUILDING.md | 5 +++ CONTRIBUTING.md | 6 ++++ Makefile | 4 +++ conf.py | 4 +++ docs/shared_bindings_matrix.py | 2 +- docs/static/favicon.ico.license | 3 ++ drivers/bus/qspi.h | 2 +- drivers/bus/softqspi.c | 2 +- drivers/bus/softspi.c | 2 +- drivers/bus/spi.h | 2 +- extmod/font_petme128_8x8.h | 30 +++------------- extmod/machine_mem.c | 29 +++------------ extmod/machine_mem.h | 30 +++------------- extmod/machine_pinbase.c | 29 +++------------ extmod/machine_pinbase.h | 30 +++------------- extmod/machine_pulse.c | 29 +++------------ extmod/machine_pulse.h | 30 +++------------- extmod/machine_signal.c | 29 +++------------ extmod/machine_signal.h | 30 +++------------- extmod/misc.h | 32 ++++------------- extmod/modbtree.c | 29 +++------------ extmod/modframebuf.c | 29 +++------------ extmod/modlwip.c | 33 ++++------------- extmod/modonewire.c | 29 +++------------ extmod/modubinascii.c | 29 +++------------ extmod/modubinascii.h | 30 +++------------- extmod/moductypes.c | 29 +++------------ extmod/moduhashlib.c | 29 +++------------ extmod/moduheapq.c | 29 +++------------ extmod/modujson.c | 29 +++------------ extmod/modurandom.c | 29 +++------------ extmod/modure.c | 29 +++------------ extmod/moduselect.c | 29 +++------------ extmod/modussl_axtls.c | 29 +++------------ extmod/modussl_mbedtls.c | 29 +++------------ extmod/modutimeq.c | 31 +++------------- extmod/moduzlib.c | 29 +++------------ extmod/modwebrepl.c | 29 +++------------ extmod/modwebsocket.c | 29 +++------------ extmod/modwebsocket.h | 4 +++ extmod/uos_dupterm.c | 31 +++------------- extmod/utime_mphal.c | 31 +++------------- extmod/utime_mphal.h | 32 ++++------------- extmod/vfs.c | 29 +++------------ extmod/vfs.h | 30 +++------------- extmod/vfs_fat.c | 31 +++------------- extmod/vfs_fat.h | 30 +++------------- extmod/vfs_fat_diskio.c | 32 +++-------------- extmod/vfs_fat_file.c | 29 +++------------ extmod/vfs_posix.c | 29 +++------------ extmod/vfs_posix.h | 30 +++------------- extmod/vfs_posix_file.c | 29 +++------------ extmod/vfs_reader.c | 29 +++------------ extmod/virtpin.c | 29 +++------------ extmod/virtpin.h | 30 +++------------- lib/libc/string0.c | 2 +- lib/libm/math.c | 2 +- lib/mp-readline/readline.c | 2 +- lib/mp-readline/readline.h | 2 +- lib/netutils/netutils.c | 2 +- lib/netutils/netutils.h | 2 +- lib/oofatfs/ffconf.h | 2 +- lib/timeutils/timeutils.c | 2 +- lib/timeutils/timeutils.h | 2 +- lib/utils/interrupt_char.c | 2 +- lib/utils/interrupt_char.h | 2 +- lib/utils/printf.c | 2 +- lib/utils/pyexec.c | 2 +- lib/utils/pyexec.h | 2 +- lib/utils/sys_stdio_mphal.c | 2 +- ...CircuitPython_Repo_header_logo.png.license | 3 ++ logo/adafruit_blinka_angles-back.svg.license | 3 ++ logo/adafruit_blinka_angles-front.svg.license | 3 ++ logo/adafruit_blinka_angles-left.svg.license | 3 ++ logo/adafruit_blinka_angles-right.svg.license | 3 ++ logo/adafruit_blinka_computer.svg.license | 3 ++ ..._circuit_python_ourboros_color.svg.license | 3 ++ ...it_python_ouroboros_logo_final.svg.license | 3 ++ ...t_circuit_python_sitting_color.svg.license | 3 ++ ...thon_stacked_lockup_logo_final.svg.license | 3 ++ logo/awesome_circuitpython.svg.license | 3 ++ logo/blinka_colorform-cooking.png.license | 3 ++ logo/blinka_colorform-cooking.svg.license | 3 ++ ...linka_colorform-first-birthday.svg.license | 3 ++ logo/blinka_colorform-painting.svg.license | 3 ++ logo/blinka_colorform-reading.svg.license | 3 ++ logo/blinka_colorform-singing.svg.license | 3 ++ logo/blinka_colorform-telescope.svg.license | 3 ++ logo/blinka_colorform-test_tubes.svg.license | 3 ++ mpy-cross/.gitignore | 4 +++ mpy-cross/Makefile | 4 +++ mpy-cross/Makefile.fuzz | 3 ++ mpy-cross/Makefile.static | 4 +++ mpy-cross/Makefile.static-mingw | 4 +++ mpy-cross/Makefile.static-raspbian | 4 +++ mpy-cross/README.md | 6 ++++ mpy-cross/fmode.c | 29 +++------------ mpy-cross/fmode.h | 30 +++------------- mpy-cross/gccollect.c | 29 +++------------ mpy-cross/main.c | 29 +++------------ mpy-cross/mpconfigport.h | 29 +++------------ mpy-cross/mphalport.h | 4 +++ mpy-cross/mpy-cross.mk | 4 +++ mpy-cross/qstrdefsport.h | 4 +++ ports/atmel-samd/Makefile | 2 +- .../common-hal/analogio/AnalogOut.c | 2 +- ports/atmel-samd/common-hal/board/__init__.c | 2 +- ports/atmel-samd/common-hal/busio/UART.c | 2 +- ports/atmel-samd/common-hal/pulseio/PWMOut.c | 2 +- .../atmel-samd/common-hal/pulseio/PulseOut.c | 2 +- ports/atmel-samd/fatfs_port.c | 2 +- ports/atmel-samd/supervisor/internal_flash.c | 2 +- ports/atmel-samd/supervisor/internal_flash.h | 2 +- ports/atmel-samd/tools/gen_pin_name_table.py | 2 +- ports/esp32s2/Makefile | 2 +- ports/esp32s2/fatfs_port.c | 2 +- ports/esp32s2/supervisor/internal_flash.c | 2 +- ports/esp32s2/supervisor/internal_flash.h | 2 +- ports/litex/Makefile | 2 +- ports/litex/fatfs_port.c | 2 +- ports/litex/supervisor/internal_flash.c | 2 +- ports/litex/supervisor/internal_flash.h | 2 +- ports/mimxrt10xx/Makefile | 4 +-- .../common-hal/analogio/AnalogOut.c | 2 +- ports/mimxrt10xx/common-hal/board/__init__.c | 2 +- ports/mimxrt10xx/common-hal/busio/UART.c | 2 +- ports/mimxrt10xx/common-hal/pulseio/PWMOut.c | 2 +- .../mimxrt10xx/common-hal/pulseio/PulseOut.c | 2 +- ports/mimxrt10xx/fatfs_port.c | 2 +- ports/mimxrt10xx/supervisor/internal_flash.c | 2 +- ports/mimxrt10xx/supervisor/internal_flash.h | 2 +- ports/nrf/Makefile | 2 +- ports/nrf/examples/ubluepy_temp.py | 2 +- ports/nrf/fatfs_port.c | 2 +- ports/nrf/peripherals/nrf/nvm.c | 2 +- ports/nrf/peripherals/nrf/nvm.h | 2 +- ports/nrf/supervisor/internal_flash.c | 2 +- ports/nrf/supervisor/internal_flash.h | 2 +- ports/stm/Makefile | 4 +-- ports/stm/common-hal/analogio/AnalogOut.c | 2 +- ports/stm/fatfs_port.c | 2 +- ports/stm/supervisor/internal_flash.c | 2 +- ports/stm/supervisor/internal_flash.h | 2 +- ports/stm/tools/parse_af_csv.py | 2 +- ports/stm/tools/parse_pins_csv.py | 2 +- ports/unix/fdfile.h | 2 +- ports/unix/file.c | 2 +- ports/unix/gccollect.c | 2 +- ports/unix/input.c | 2 +- ports/unix/main.c | 2 +- ports/unix/modffi.c | 2 +- ports/unix/modmachine.c | 2 +- ports/unix/modos.c | 2 +- ports/unix/modtime.c | 2 +- ports/unix/moduos_vfs.c | 2 +- ports/unix/moduselect.c | 2 +- ports/unix/modusocket.c | 2 +- ports/unix/mpconfigport.h | 2 +- ports/unix/mpconfigport_coverage.h | 2 +- ports/unix/mpconfigport_fast.h | 2 +- ports/unix/mpconfigport_freedos.h | 2 +- ports/unix/mpconfigport_minimal.h | 2 +- ports/unix/mpconfigport_nanbox.h | 2 +- ports/unix/mphalport.h | 2 +- ports/unix/mpthreadport.c | 2 +- ports/unix/mpthreadport.h | 2 +- ports/unix/qstrdefsport.h | 2 +- ports/unix/unix_mphal.c | 2 +- py/argcheck.c | 2 +- py/asmarm.c | 2 +- py/asmarm.h | 2 +- py/asmbase.c | 2 +- py/asmbase.h | 2 +- py/asmthumb.c | 2 +- py/asmthumb.h | 2 +- py/asmx64.c | 2 +- py/asmx64.h | 2 +- py/asmx86.c | 2 +- py/asmx86.h | 2 +- py/asmxtensa.c | 2 +- py/asmxtensa.h | 2 +- py/bc.c | 2 +- py/bc.h | 2 +- py/bc0.h | 2 +- py/binary.c | 2 +- py/binary.h | 2 +- py/builtin.h | 2 +- py/builtinevex.c | 2 +- py/builtinhelp.c | 2 +- py/builtinimport.c | 2 +- py/circuitpy_defns.mk | 2 +- py/circuitpy_mpconfig.mk | 2 +- py/compile.c | 2 +- py/compile.h | 2 +- py/emit.h | 2 +- py/emitbc.c | 2 +- py/emitcommon.c | 2 +- py/emitglue.c | 2 +- py/emitglue.h | 2 +- py/emitinlinethumb.c | 2 +- py/emitinlinextensa.c | 2 +- py/emitnative.c | 2 +- py/formatfloat.c | 2 +- py/formatfloat.h | 2 +- py/frozenmod.c | 2 +- py/frozenmod.h | 2 +- py/gc.c | 2 +- py/gc.h | 2 +- py/grammar.h | 2 +- py/ioctl.h | 2 +- py/lexer.c | 2 +- py/lexer.h | 2 +- py/malloc.c | 2 +- py/map.c | 2 +- py/misc.h | 2 +- py/modarray.c | 2 +- py/modbuiltins.c | 2 +- py/modcmath.c | 2 +- py/modcollections.c | 2 +- py/modgc.c | 2 +- py/modio.c | 2 +- py/modmath.c | 2 +- py/modmicropython.c | 2 +- py/modstruct.c | 2 +- py/modsys.c | 2 +- py/modthread.c | 2 +- py/moduerrno.c | 2 +- py/mpconfig.h | 2 +- py/mperrno.h | 2 +- py/mphal.h | 2 +- py/mpprint.c | 2 +- py/mpprint.h | 2 +- py/mpstate.c | 2 +- py/mpstate.h | 2 +- py/mpthread.h | 2 +- py/mpz.c | 2 +- py/mpz.h | 2 +- py/nativeglue.c | 2 +- py/nlr.c | 2 +- py/nlr.h | 2 +- py/nlrsetjmp.c | 2 +- py/nlrthumb.c | 2 +- py/nlrx64.c | 2 +- py/nlrx86.c | 2 +- py/nlrxtensa.c | 2 +- py/obj.c | 2 +- py/obj.h | 2 +- py/objarray.c | 2 +- py/objarray.h | 2 +- py/objattrtuple.c | 2 +- py/objbool.c | 2 +- py/objboundmeth.c | 2 +- py/objcell.c | 2 +- py/objclosure.c | 2 +- py/objcomplex.c | 2 +- py/objdict.c | 2 +- py/objenumerate.c | 2 +- py/objexcept.c | 2 +- py/objexcept.h | 2 +- py/objfilter.c | 2 +- py/objfloat.c | 2 +- py/objfun.c | 2 +- py/objfun.h | 2 +- py/objgenerator.c | 2 +- py/objgenerator.h | 2 +- py/objgetitemiter.c | 2 +- py/objint.c | 2 +- py/objint.h | 2 +- py/objint_longlong.c | 2 +- py/objint_mpz.c | 2 +- py/objlist.c | 2 +- py/objlist.h | 2 +- py/objmap.c | 2 +- py/objmodule.c | 2 +- py/objmodule.h | 2 +- py/objnamedtuple.c | 2 +- py/objnamedtuple.h | 2 +- py/objnone.c | 2 +- py/objobject.c | 2 +- py/objproperty.c | 2 +- py/objproperty.h | 2 +- py/objrange.c | 2 +- py/objreversed.c | 2 +- py/objset.c | 2 +- py/objsingleton.c | 2 +- py/objslice.c | 2 +- py/objstr.c | 2 +- py/objstr.h | 2 +- py/objstringio.c | 2 +- py/objstringio.h | 2 +- py/objstrunicode.c | 2 +- py/objtuple.c | 2 +- py/objtuple.h | 2 +- py/objtype.c | 2 +- py/objtype.h | 2 +- py/objzip.c | 2 +- py/opmethods.c | 2 +- py/parse.c | 2 +- py/parse.h | 2 +- py/parsenum.c | 2 +- py/parsenum.h | 2 +- py/parsenumbase.c | 2 +- py/parsenumbase.h | 2 +- py/persistentcode.c | 2 +- py/persistentcode.h | 2 +- py/pystack.c | 2 +- py/pystack.h | 2 +- py/qstr.c | 2 +- py/qstr.h | 2 +- py/qstrdefs.h | 2 +- py/reader.c | 2 +- py/reader.h | 2 +- py/repl.c | 2 +- py/repl.h | 2 +- py/runtime.c | 2 +- py/runtime.h | 2 +- py/runtime0.h | 2 +- py/scheduler.c | 2 +- py/scope.c | 2 +- py/scope.h | 2 +- py/sequence.c | 2 +- py/showbc.c | 2 +- py/smallint.c | 2 +- py/smallint.h | 2 +- py/stream.c | 2 +- py/stream.h | 2 +- py/unicode.c | 2 +- py/unicode.h | 2 +- py/vm.c | 2 +- py/vmentrytable.h | 2 +- py/vstr.c | 2 +- py/warning.c | 2 +- setup.py | 4 +++ shared-bindings/analogio/AnalogIn.c | 2 +- shared-bindings/analogio/AnalogIn.h | 2 +- shared-bindings/analogio/AnalogOut.c | 2 +- shared-bindings/analogio/AnalogOut.h | 2 +- shared-bindings/digitalio/DigitalInOut.c | 2 +- shared-bindings/digitalio/DigitalInOut.h | 2 +- shared-bindings/gnss/GNSS.c | 28 ++------------- shared-bindings/gnss/GNSS.h | 28 ++------------- shared-bindings/gnss/PositionFix.c | 28 ++------------- shared-bindings/gnss/PositionFix.h | 28 ++------------- shared-bindings/gnss/SatelliteSystem.c | 28 ++------------- shared-bindings/gnss/SatelliteSystem.h | 28 ++------------- shared-bindings/gnss/__init__.c | 28 ++------------- shared-bindings/math/__init__.c | 2 +- shared-bindings/network/__init__.c | 2 +- shared-bindings/network/__init__.h | 2 +- shared-bindings/os/__init__.c | 2 +- shared-bindings/pulseio/PWMOut.c | 2 +- shared-bindings/pulseio/PWMOut.h | 2 +- shared-bindings/pulseio/PulseOut.h | 2 +- shared-bindings/rtc/RTC.c | 2 +- shared-bindings/rtc/__init__.c | 2 +- shared-bindings/socket/__init__.c | 2 +- shared-bindings/storage/__init__.c | 2 +- shared-bindings/struct/__init__.c | 2 +- shared-bindings/time/__init__.c | 2 +- shared-bindings/touchio/TouchIn.c | 2 +- shared-bindings/touchio/TouchIn.h | 2 +- shared-bindings/wiznet/__init__.c | 2 +- shared-bindings/wiznet/wiznet5k.c | 2 +- shared-module/bitbangio/I2C.c | 2 +- shared-module/bitbangio/SPI.c | 2 +- shared-module/network/__init__.h | 2 +- shared-module/os/__init__.c | 2 +- shared-module/storage/__init__.c | 2 +- shared-module/wiznet/wiznet5k.c | 2 +- shared-module/wiznet/wiznet5k.h | 2 +- supervisor/flash.h | 2 +- .../shared/external_flash/common_commands.h | 2 +- supervisor/stub/internal_flash.c | 2 +- tests/skip_if.py | 23 ++---------- tests/thread/mutate_bytearray.py | 4 ++- tests/thread/mutate_dict.py | 4 ++- tests/thread/mutate_instance.py | 4 ++- tests/thread/mutate_list.py | 4 ++- tests/thread/mutate_set.py | 4 ++- tests/thread/stress_aes.py | 4 ++- tests/thread/stress_heap.py | 4 ++- tests/thread/stress_recurse.py | 4 ++- tests/thread/thread_exc1.py | 4 ++- tests/thread/thread_exit1.py | 4 ++- tests/thread/thread_exit2.py | 4 ++- tests/thread/thread_gc1.py | 4 ++- tests/thread/thread_ident1.py | 4 ++- tests/thread/thread_lock1.py | 4 ++- tests/thread/thread_lock2.py | 4 ++- tests/thread/thread_lock3.py | 4 ++- tests/thread/thread_lock4.py | 4 ++- tests/thread/thread_qstr1.py | 4 ++- tests/thread/thread_shared1.py | 4 ++- tests/thread/thread_shared2.py | 4 ++- tests/thread/thread_sleep1.py | 4 ++- tests/thread/thread_stacksize1.py | 4 ++- tests/thread/thread_start1.py | 4 ++- tests/thread/thread_start2.py | 4 ++- tools/analyze_heap_dump.py | 4 +++ tools/analyze_mpy.py | 4 +++ tools/bootstrap_upip.sh | 4 +++ tools/build-stm-latest.sh | 4 +++ tools/build_board_info.py | 4 +++ tools/build_memory_info.py | 27 +++----------- tools/build_release_files.py | 4 +++ tools/chart_code_size.py | 4 +++ tools/check_code_size.sh | 5 +++ tools/check_translations.py | 4 +++ tools/ci_new_boards_check.py | 4 +++ tools/codestats.sh | 5 +++ tools/convert_release_notes.py | 4 +++ tools/cpboard.py | 35 ++++--------------- tools/dfu.py | 4 +++ tools/extract_pyi.py | 4 +++ tools/file2h.py | 4 +++ tools/fixup_translations.py | 4 +++ tools/gc_activity.py | 4 +++ tools/gc_activity_between_collects.py | 4 +++ tools/gen-changelog.sh | 4 +++ tools/gen_display_resources.py | 4 +++ tools/gen_ld_files.py | 5 +++ tools/gen_usb_descriptor.py | 4 +++ tools/gendoc.py | 4 +++ tools/git-checkout-latest-tag.sh | 5 +++ tools/hid_report_descriptors.py | 23 ++---------- tools/insert-usb-ids.py | 4 +++ tools/join_bins.py | 4 +++ tools/make-frozen.py | 5 +++ tools/mpy-tool.py | 27 +++----------- tools/mpy_bin2res.py | 5 +++ tools/mpy_cross_all.py | 5 +++ tools/preprocess_frozen_modules.py | 5 +++ tools/print_status.py | 4 +++ tools/pyboard.py | 29 +++------------ tools/pydfu.py | 9 ++--- tools/tinytest-codegen.py | 4 +++ tools/upip.py | 10 +++--- tools/upip_utarfile.py | 4 +++ 446 files changed, 928 insertions(+), 1865 deletions(-) create mode 100644 ACKNOWLEDGEMENTS.license create mode 100644 docs/static/favicon.ico.license create mode 100644 logo/CircuitPython_Repo_header_logo.png.license create mode 100644 logo/adafruit_blinka_angles-back.svg.license create mode 100644 logo/adafruit_blinka_angles-front.svg.license create mode 100644 logo/adafruit_blinka_angles-left.svg.license create mode 100644 logo/adafruit_blinka_angles-right.svg.license create mode 100644 logo/adafruit_blinka_computer.svg.license create mode 100644 logo/adafruit_circuit_python_ourboros_color.svg.license create mode 100644 logo/adafruit_circuit_python_ouroboros_logo_final.svg.license create mode 100644 logo/adafruit_circuit_python_sitting_color.svg.license create mode 100644 logo/adafruit_circuit_python_stacked_lockup_logo_final.svg.license create mode 100644 logo/awesome_circuitpython.svg.license create mode 100644 logo/blinka_colorform-cooking.png.license create mode 100644 logo/blinka_colorform-cooking.svg.license create mode 100644 logo/blinka_colorform-first-birthday.svg.license create mode 100644 logo/blinka_colorform-painting.svg.license create mode 100644 logo/blinka_colorform-reading.svg.license create mode 100644 logo/blinka_colorform-singing.svg.license create mode 100644 logo/blinka_colorform-telescope.svg.license create mode 100644 logo/blinka_colorform-test_tubes.svg.license diff --git a/.gitattributes b/.gitattributes index 7d1fdfe33e..5ebde95f07 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Per default everything gets normalized and gets LF line endings on checkout. * text eol=lf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa7dd9dd25..b022dc2474 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + name: Build CI on: diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 9907c08ae6..71959ffdcd 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + name: Update CircuitPython.org on: diff --git a/.gitignore b/.gitignore index 8a773970d3..475a1183ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Compiled Sources ################### *.o diff --git a/.gitmodules b/.gitmodules index a990aed2ab..f09a1e4c68 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + [submodule "lib/axtls"] path = lib/axtls url = https://github.com/pfalcon/axtls diff --git a/.readthedocs.yml b/.readthedocs.yml index 6ff5f2422d..4030bc3178 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # .readthedocs.yml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details diff --git a/.rosie.yml b/.rosie.yml index 3f7f9bb1d7..52a8802de2 100644 --- a/.rosie.yml +++ b/.rosie.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # This configuration file tells Rosie where to find prebuilt .bin files (Travis # builds them) and where to find the tests. diff --git a/ACKNOWLEDGEMENTS.license b/ACKNOWLEDGEMENTS.license new file mode 100644 index 0000000000..d25be17638 --- /dev/null +++ b/ACKNOWLEDGEMENTS.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) + +SPDX-License-Identifier: MIT diff --git a/BUILDING.md b/BUILDING.md index bc60026785..10d7d8f4af 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,3 +1,8 @@ + # Building CircuitPython diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d85926310..29db397932 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,9 @@ + + # Contributing Please note that this project is released with a [Contributor Code of Conduct](https://github.com/adafruit/circuitpython/blob/main/CODE_OF_CONDUCT.md). diff --git a/Makefile b/Makefile index d45dae8b90..74d3d88c77 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Top-level Makefile for documentation builds and miscellaneous tasks. # diff --git a/conf.py b/conf.py index 43f689648d..37e611dbb8 100644 --- a/conf.py +++ b/conf.py @@ -13,6 +13,10 @@ # All configuration values have a default; values that are commented out # serve to show the default. +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import json import logging import os diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 4abf5b8859..7b96c14f29 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -1,6 +1,6 @@ # The MIT License (MIT) # -# Copyright (c) 2019 Michael Schroeder +# SPDX-FileCopyrightText: Copyright (c) 2019 Michael Schroeder # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/docs/static/favicon.ico.license b/docs/static/favicon.ico.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/docs/static/favicon.ico.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/drivers/bus/qspi.h b/drivers/bus/qspi.h index 31c9d14fca..81587b08b3 100644 --- a/drivers/bus/qspi.h +++ b/drivers/bus/qspi.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017-2018 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2017-2018 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/drivers/bus/softqspi.c b/drivers/bus/softqspi.c index 10c5992466..87f7c8ae8c 100644 --- a/drivers/bus/softqspi.c +++ b/drivers/bus/softqspi.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017-2018 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2017-2018 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/drivers/bus/softspi.c b/drivers/bus/softspi.c index bc12d89d3b..feb8e00d38 100644 --- a/drivers/bus/softspi.c +++ b/drivers/bus/softspi.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016-2018 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016-2018 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/drivers/bus/spi.h b/drivers/bus/spi.h index 6d1b9c2f83..5d150cd38f 100644 --- a/drivers/bus/spi.h +++ b/drivers/bus/spi.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016-2018 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016-2018 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/extmod/font_petme128_8x8.h b/extmod/font_petme128_8x8.h index 9963698b17..632397dfe3 100644 --- a/extmod/font_petme128_8x8.h +++ b/extmod/font_petme128_8x8.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_STM32_FONT_PETME128_8X8_H #define MICROPY_INCLUDED_STM32_FONT_PETME128_8X8_H diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c index e0649290ef..6c6e110631 100644 --- a/extmod/machine_mem.c +++ b/extmod/machine_mem.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/runtime.h" #include "extmod/machine_mem.h" diff --git a/extmod/machine_mem.h b/extmod/machine_mem.h index a48a52c820..735887c60e 100644 --- a/extmod/machine_mem.h +++ b/extmod/machine_mem.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2015 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H #define MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H diff --git a/extmod/machine_pinbase.c b/extmod/machine_pinbase.c index 6cd14c187e..a5e33c5602 100644 --- a/extmod/machine_pinbase.c +++ b/extmod/machine_pinbase.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_PY_MACHINE diff --git a/extmod/machine_pinbase.h b/extmod/machine_pinbase.h index c96abbc46c..b747563a1e 100644 --- a/extmod/machine_pinbase.h +++ b/extmod/machine_pinbase.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H #define MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H diff --git a/extmod/machine_pulse.c b/extmod/machine_pulse.c index 5f837479dd..eaee12b367 100644 --- a/extmod/machine_pulse.c +++ b/extmod/machine_pulse.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/runtime.h" #include "py/mperrno.h" diff --git a/extmod/machine_pulse.h b/extmod/machine_pulse.h index e303dca02e..a9b0ebc1b4 100644 --- a/extmod/machine_pulse.h +++ b/extmod/machine_pulse.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H #define MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H diff --git a/extmod/machine_signal.c b/extmod/machine_signal.c index 50501e34fe..a215fc3889 100644 --- a/extmod/machine_signal.c +++ b/extmod/machine_signal.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2017 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_PY_MACHINE diff --git a/extmod/machine_signal.h b/extmod/machine_signal.h index df1c3e2e90..17ffe5563f 100644 --- a/extmod/machine_signal.h +++ b/extmod/machine_signal.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2017 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H #define MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H diff --git a/extmod/misc.h b/extmod/misc.h index d6f6d859c6..3e12e56719 100644 --- a/extmod/misc.h +++ b/extmod/misc.h @@ -1,29 +1,9 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Damien P. George - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2014-2016 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MISC_H #define MICROPY_INCLUDED_EXTMOD_MISC_H diff --git a/extmod/modbtree.c b/extmod/modbtree.c index 7cfa9c6afb..9f5261b1b7 100644 --- a/extmod/modbtree.c +++ b/extmod/modbtree.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index c59d1592ba..07a50a2f4c 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 776b81ee51..20cc3a6594 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -1,30 +1,9 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * Copyright (c) 2015 Galen Hazelwood - * Copyright (c) 2015-2017 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2015 Galen Hazelwood +// Copyright (c) 2015-2017 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modonewire.c b/extmod/modonewire.c index 53c9456c20..1b085a0555 100644 --- a/extmod/modonewire.c +++ b/extmod/modonewire.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2015-2017 Damien P. George +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index 0f64b27151..32c36eea6d 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2014 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modubinascii.h b/extmod/modubinascii.h index fb31692678..eb47e286bf 100644 --- a/extmod/modubinascii.h +++ b/extmod/modubinascii.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2014 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H #define MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H diff --git a/extmod/moductypes.c b/extmod/moductypes.c index 451dc29ed9..a384f1e2c2 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2014 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index 970c63da82..95485de138 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2014 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index db17e8ca21..bc4b97ff5b 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/objlist.h" #include "py/runtime.h" diff --git a/extmod/modujson.c b/extmod/modujson.c index 0f93ccb110..5e90839582 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2014-2016 Damien P. George +// +// SPDX-License-Identifier: MIT #include diff --git a/extmod/modurandom.c b/extmod/modurandom.c index 1512a3fd4a..a60250efc8 100644 --- a/extmod/modurandom.c +++ b/extmod/modurandom.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modure.c b/extmod/modure.c index 125afef4d3..a20f3ee429 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2014 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/moduselect.c b/extmod/moduselect.c index 6c9d18e50b..97b14a5f25 100644 --- a/extmod/moduselect.c +++ b/extmod/moduselect.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_PY_USELECT diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c index 032dea09fd..7cc2bb3e25 100644 --- a/extmod/modussl_axtls.c +++ b/extmod/modussl_axtls.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2015-2017 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2015-2017 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c index 9abdeb966e..990523173d 100644 --- a/extmod/modussl_mbedtls.c +++ b/extmod/modussl_mbedtls.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Linaro Ltd. - * - * 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. - */ +// Copyright (c) 2016 Linaro Ltd. +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_PY_USSL && MICROPY_SSL_MBEDTLS diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c index 99b51016d8..bb2b6b335d 100644 --- a/extmod/modutimeq.c +++ b/extmod/modutimeq.c @@ -1,29 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Damien P. George - * Copyright (c) 2016-2017 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016-2017 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index 3a081bc452..8422e75983 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2014-2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c index fb4d97358d..5b3c6150a7 100644 --- a/extmod/modwebrepl.c +++ b/extmod/modwebrepl.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c index 496e4b5bb3..581af6b588 100644 --- a/extmod/modwebsocket.c +++ b/extmod/modwebsocket.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/modwebsocket.h b/extmod/modwebsocket.h index 2720147dfd..46aa0408b6 100644 --- a/extmod/modwebsocket.h +++ b/extmod/modwebsocket.h @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H #define MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H diff --git a/extmod/uos_dupterm.c b/extmod/uos_dupterm.c index 781ec0d46b..bd2dc639c8 100644 --- a/extmod/uos_dupterm.c +++ b/extmod/uos_dupterm.c @@ -1,29 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * Copyright (c) 2017 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George +// +// SPDX-License-Identifier: MIT #include #include "py/mpconfig.h" diff --git a/extmod/utime_mphal.c b/extmod/utime_mphal.c index 0fe3a3ba1d..ebbc9ac263 100644 --- a/extmod/utime_mphal.c +++ b/extmod/utime_mphal.c @@ -1,29 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2016 Damien P. George - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_PY_UTIME_MP_HAL diff --git a/extmod/utime_mphal.h b/extmod/utime_mphal.h index 88a9ed4d37..20b4093d31 100644 --- a/extmod/utime_mphal.h +++ b/extmod/utime_mphal.h @@ -1,29 +1,9 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2016 Damien P. George - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H #define MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H diff --git a/extmod/vfs.c b/extmod/vfs.c index 2bb4057e7e..c9c1fe3c31 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/vfs.h b/extmod/vfs.h index 6c0692365f..85958d80d9 100644 --- a/extmod/vfs.h +++ b/extmod/vfs.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_VFS_H #define MICROPY_INCLUDED_EXTMOD_VFS_H diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 9cb4d98426..b8f43ee295 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -1,29 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Damien P. George - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_VFS_FAT diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h index 08b03d0d18..41f8365ec5 100644 --- a/extmod/vfs_fat.h +++ b/extmod/vfs_fat.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_VFS_FAT_H #define MICROPY_INCLUDED_EXTMOD_VFS_FAT_H diff --git a/extmod/vfs_fat_diskio.c b/extmod/vfs_fat_diskio.c index 0e442d8fa9..ac8924394a 100644 --- a/extmod/vfs_fat_diskio.c +++ b/extmod/vfs_fat_diskio.c @@ -1,31 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * Original template for this file comes from: - * Low level disk I/O module skeleton for FatFs, (C)ChaN, 2013 - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_VFS && MICROPY_VFS_FAT diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index 422f057a85..0642f4a9ce 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/mpconfig.h" #if MICROPY_VFS && MICROPY_VFS_FAT diff --git a/extmod/vfs_posix.c b/extmod/vfs_posix.c index 56a5de303d..8d81d51751 100644 --- a/extmod/vfs_posix.c +++ b/extmod/vfs_posix.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017-2018 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2017-2018 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/runtime.h" #include "py/mperrno.h" diff --git a/extmod/vfs_posix.h b/extmod/vfs_posix.h index 32299b8269..4540baedf0 100644 --- a/extmod/vfs_posix.h +++ b/extmod/vfs_posix.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2018 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2018 Damien P. George +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_VFS_POSIX_H #define MICROPY_INCLUDED_EXTMOD_VFS_POSIX_H diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c index be455fa281..eefc1d905a 100644 --- a/extmod/vfs_posix_file.c +++ b/extmod/vfs_posix_file.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013-2018 Damien P. George +// +// SPDX-License-Identifier: MIT #include "py/runtime.h" #include "py/stream.h" diff --git a/extmod/vfs_reader.c b/extmod/vfs_reader.c index e1ee45a3c7..a700611860 100644 --- a/extmod/vfs_reader.c +++ b/extmod/vfs_reader.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2017 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George +// +// SPDX-License-Identifier: MIT #include #include diff --git a/extmod/virtpin.c b/extmod/virtpin.c index 559f992650..fb993946a2 100644 --- a/extmod/virtpin.c +++ b/extmod/virtpin.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include "extmod/virtpin.h" #include "py/proto.h" diff --git a/extmod/virtpin.h b/extmod/virtpin.h index 591249e48d..9b43406bd1 100644 --- a/extmod/virtpin.h +++ b/extmod/virtpin.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ +// Copyright (c) 2016 Paul Sokolovsky +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_EXTMOD_VIRTPIN_H #define MICROPY_INCLUDED_EXTMOD_VIRTPIN_H diff --git a/lib/libc/string0.c b/lib/libc/string0.c index a2f936237d..18bd993618 100644 --- a/lib/libc/string0.c +++ b/lib/libc/string0.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/libm/math.c b/lib/libm/math.c index 0e53563bcb..670d95ed2d 100644 --- a/lib/libm/math.c +++ b/lib/libm/math.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c index 0edaebbfae..432413d501 100644 --- a/lib/mp-readline/readline.c +++ b/lib/mp-readline/readline.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/mp-readline/readline.h b/lib/mp-readline/readline.h index 17d4ec60ed..9168edafa0 100644 --- a/lib/mp-readline/readline.h +++ b/lib/mp-readline/readline.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/netutils/netutils.c b/lib/netutils/netutils.c index 03418d7e66..4385f5a5e5 100644 --- a/lib/netutils/netutils.c +++ b/lib/netutils/netutils.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/lib/netutils/netutils.h b/lib/netutils/netutils.h index 4befc90db0..98e1d24932 100644 --- a/lib/netutils/netutils.h +++ b/lib/netutils/netutils.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h index 214311b4c2..d8485a293a 100644 --- a/lib/oofatfs/ffconf.h +++ b/lib/oofatfs/ffconf.h @@ -6,7 +6,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/timeutils/timeutils.c b/lib/timeutils/timeutils.c index b93a85dee9..fdd3426ad4 100644 --- a/lib/timeutils/timeutils.c +++ b/lib/timeutils/timeutils.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/lib/timeutils/timeutils.h b/lib/timeutils/timeutils.h index 0ca6bb1679..4ba8c7fdac 100644 --- a/lib/timeutils/timeutils.h +++ b/lib/timeutils/timeutils.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c index da7f702544..7410ac1e5d 100644 --- a/lib/utils/interrupt_char.c +++ b/lib/utils/interrupt_char.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/utils/interrupt_char.h b/lib/utils/interrupt_char.h index e0b1db5298..0e5e2fc0c6 100644 --- a/lib/utils/interrupt_char.h +++ b/lib/utils/interrupt_char.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/utils/printf.c b/lib/utils/printf.c index 3a4cc25494..e95d778fd2 100644 --- a/lib/utils/printf.c +++ b/lib/utils/printf.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index c8e369e791..8e99bc2099 100755 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h index bde516c593..cef72a76c7 100644 --- a/lib/utils/pyexec.h +++ b/lib/utils/pyexec.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/utils/sys_stdio_mphal.c b/lib/utils/sys_stdio_mphal.c index c1607dfe8c..3a11fa66c9 100644 --- a/lib/utils/sys_stdio_mphal.c +++ b/lib/utils/sys_stdio_mphal.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/logo/CircuitPython_Repo_header_logo.png.license b/logo/CircuitPython_Repo_header_logo.png.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/CircuitPython_Repo_header_logo.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_blinka_angles-back.svg.license b/logo/adafruit_blinka_angles-back.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_blinka_angles-back.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_blinka_angles-front.svg.license b/logo/adafruit_blinka_angles-front.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_blinka_angles-front.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_blinka_angles-left.svg.license b/logo/adafruit_blinka_angles-left.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_blinka_angles-left.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_blinka_angles-right.svg.license b/logo/adafruit_blinka_angles-right.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_blinka_angles-right.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_blinka_computer.svg.license b/logo/adafruit_blinka_computer.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_blinka_computer.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_circuit_python_ourboros_color.svg.license b/logo/adafruit_circuit_python_ourboros_color.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_circuit_python_ourboros_color.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_circuit_python_ouroboros_logo_final.svg.license b/logo/adafruit_circuit_python_ouroboros_logo_final.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_circuit_python_ouroboros_logo_final.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_circuit_python_sitting_color.svg.license b/logo/adafruit_circuit_python_sitting_color.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_circuit_python_sitting_color.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/adafruit_circuit_python_stacked_lockup_logo_final.svg.license b/logo/adafruit_circuit_python_stacked_lockup_logo_final.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/adafruit_circuit_python_stacked_lockup_logo_final.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/awesome_circuitpython.svg.license b/logo/awesome_circuitpython.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/awesome_circuitpython.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-cooking.png.license b/logo/blinka_colorform-cooking.png.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-cooking.png.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-cooking.svg.license b/logo/blinka_colorform-cooking.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-cooking.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-first-birthday.svg.license b/logo/blinka_colorform-first-birthday.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-first-birthday.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-painting.svg.license b/logo/blinka_colorform-painting.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-painting.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-reading.svg.license b/logo/blinka_colorform-reading.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-reading.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-singing.svg.license b/logo/blinka_colorform-singing.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-singing.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-telescope.svg.license b/logo/blinka_colorform-telescope.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-telescope.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/logo/blinka_colorform-test_tubes.svg.license b/logo/blinka_colorform-test_tubes.svg.license new file mode 100644 index 0000000000..86a3fbfe83 --- /dev/null +++ b/logo/blinka_colorform-test_tubes.svg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/mpy-cross/.gitignore b/mpy-cross/.gitignore index 80d7acd423..6daeea5040 100644 --- a/mpy-cross/.gitignore +++ b/mpy-cross/.gitignore @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + /build-* /mpy-cross /mpy-cross.static diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index 072304faa0..3ff379ed36 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # The following is a temporary hack to forefully undefine vars that might have # be defined by a calling Makefile (from recursive make). # TODO: Find a better way to be able to call this Makefile recursively. diff --git a/mpy-cross/Makefile.fuzz b/mpy-cross/Makefile.fuzz index ca59788f4c..0fbbe9b647 100644 --- a/mpy-cross/Makefile.fuzz +++ b/mpy-cross/Makefile.fuzz @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT PROG=mpy-cross.fuzz BUILD=build-static diff --git a/mpy-cross/Makefile.static b/mpy-cross/Makefile.static index ca0925f758..ac2a8079bb 100644 --- a/mpy-cross/Makefile.static +++ b/mpy-cross/Makefile.static @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + PROG=mpy-cross.static BUILD=build-static STATIC_BUILD=1 diff --git a/mpy-cross/Makefile.static-mingw b/mpy-cross/Makefile.static-mingw index a176e80e6e..f5bc861779 100644 --- a/mpy-cross/Makefile.static-mingw +++ b/mpy-cross/Makefile.static-mingw @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + PROG=mpy-cross.static.exe CROSS_COMPILE = x86_64-w64-mingw32- BUILD=build-static-mingw diff --git a/mpy-cross/Makefile.static-raspbian b/mpy-cross/Makefile.static-raspbian index 9129f555e7..f895f998b5 100644 --- a/mpy-cross/Makefile.static-raspbian +++ b/mpy-cross/Makefile.static-raspbian @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + PROG=mpy-cross.static-raspbian BUILD=build-static-raspbian STATIC_BUILD=1 diff --git a/mpy-cross/README.md b/mpy-cross/README.md index e35b28b696..3d1ace394c 100644 --- a/mpy-cross/README.md +++ b/mpy-cross/README.md @@ -1,3 +1,9 @@ + + MicroPython cross compiler ========================== diff --git a/mpy-cross/fmode.c b/mpy-cross/fmode.c index 33ba24ed1f..b1fa3fc857 100644 --- a/mpy-cross/fmode.c +++ b/mpy-cross/fmode.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include "fmode.h" #include "py/mpconfig.h" diff --git a/mpy-cross/fmode.h b/mpy-cross/fmode.h index c661c84d0c..05b4a46b21 100644 --- a/mpy-cross/fmode.h +++ b/mpy-cross/fmode.h @@ -1,28 +1,8 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + #ifndef MICROPY_INCLUDED_WINDOWS_FMODE_H #define MICROPY_INCLUDED_WINDOWS_FMODE_H diff --git a/mpy-cross/gccollect.c b/mpy-cross/gccollect.c index 75891a2fb5..2216fad311 100644 --- a/mpy-cross/gccollect.c +++ b/mpy-cross/gccollect.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: Copyright (c) 2013-2014 Damien P. George +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include diff --git a/mpy-cross/main.c b/mpy-cross/main.c index 7c232385b8..7a1012b8fc 100644 --- a/mpy-cross/main.c +++ b/mpy-cross/main.c @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2016 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT #include #include diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index 1a8b4880da..0b07a5b442 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -1,28 +1,7 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2015 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ +// SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT // options to control how MicroPython is built diff --git a/mpy-cross/mphalport.h b/mpy-cross/mphalport.h index 4bd8276f34..245b99c4c3 100644 --- a/mpy-cross/mphalport.h +++ b/mpy-cross/mphalport.h @@ -1 +1,5 @@ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + // empty file diff --git a/mpy-cross/mpy-cross.mk b/mpy-cross/mpy-cross.mk index de96305cbf..c813dae9eb 100644 --- a/mpy-cross/mpy-cross.mk +++ b/mpy-cross/mpy-cross.mk @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + include ../py/mkenv.mk # define main target diff --git a/mpy-cross/qstrdefsport.h b/mpy-cross/qstrdefsport.h index 3ba897069b..36d4b9ccf4 100644 --- a/mpy-cross/qstrdefsport.h +++ b/mpy-cross/qstrdefsport.h @@ -1 +1,5 @@ +// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +// +// SPDX-License-Identifier: MIT + // qstrs specific to this port diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index c308105a32..eedcc94a92 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 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 diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index e69a240717..fac4c6bfcb 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/common-hal/board/__init__.c b/ports/atmel-samd/common-hal/board/__init__.c index 634760335e..92a1721383 100644 --- a/ports/atmel-samd/common-hal/board/__init__.c +++ b/ports/atmel-samd/common-hal/board/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 8aebd49523..9557c3b5f1 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/common-hal/pulseio/PWMOut.c b/ports/atmel-samd/common-hal/pulseio/PWMOut.c index 752f6c214b..e33437dada 100644 --- a/ports/atmel-samd/common-hal/pulseio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PWMOut.c @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/common-hal/pulseio/PulseOut.c b/ports/atmel-samd/common-hal/pulseio/PulseOut.c index 5c829f84db..e9b2137cb0 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/fatfs_port.c b/ports/atmel-samd/fatfs_port.c index c4ce18c2a7..c65a73a428 100644 --- a/ports/atmel-samd/fatfs_port.c +++ b/ports/atmel-samd/fatfs_port.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/supervisor/internal_flash.c b/ports/atmel-samd/supervisor/internal_flash.c index 091959c4e6..ecb59f836e 100644 --- a/ports/atmel-samd/supervisor/internal_flash.c +++ b/ports/atmel-samd/supervisor/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/supervisor/internal_flash.h b/ports/atmel-samd/supervisor/internal_flash.h index df8b495ccb..1199e3b9c4 100644 --- a/ports/atmel-samd/supervisor/internal_flash.h +++ b/ports/atmel-samd/supervisor/internal_flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/atmel-samd/tools/gen_pin_name_table.py b/ports/atmel-samd/tools/gen_pin_name_table.py index ded64e5f69..4e25c39fd9 100644 --- a/ports/atmel-samd/tools/gen_pin_name_table.py +++ b/ports/atmel-samd/tools/gen_pin_name_table.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 3e69e66393..b296976885 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2020 Scott Shawcroft for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/esp32s2/fatfs_port.c b/ports/esp32s2/fatfs_port.c index 13ac21fb1b..8bdc047c12 100644 --- a/ports/esp32s2/fatfs_port.c +++ b/ports/esp32s2/fatfs_port.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/esp32s2/supervisor/internal_flash.c b/ports/esp32s2/supervisor/internal_flash.c index 5cf77c8010..26774efac8 100644 --- a/ports/esp32s2/supervisor/internal_flash.c +++ b/ports/esp32s2/supervisor/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/esp32s2/supervisor/internal_flash.h b/ports/esp32s2/supervisor/internal_flash.h index e06ef2d160..02d5190030 100644 --- a/ports/esp32s2/supervisor/internal_flash.h +++ b/ports/esp32s2/supervisor/internal_flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/litex/Makefile b/ports/litex/Makefile index d75a4da288..29149942c9 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Scott Shawcroft for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 Scott Shawcroft for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/litex/fatfs_port.c b/ports/litex/fatfs_port.c index 13ac21fb1b..8bdc047c12 100644 --- a/ports/litex/fatfs_port.c +++ b/ports/litex/fatfs_port.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/litex/supervisor/internal_flash.c b/ports/litex/supervisor/internal_flash.c index cf777a8acc..9b1dea6852 100644 --- a/ports/litex/supervisor/internal_flash.c +++ b/ports/litex/supervisor/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/litex/supervisor/internal_flash.h b/ports/litex/supervisor/internal_flash.h index 41a69e2abe..1498207d3e 100644 --- a/ports/litex/supervisor/internal_flash.h +++ b/ports/litex/supervisor/internal_flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 78cab0188e..d82b625e74 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -2,8 +2,8 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Dan Halbert for Adafruit Industries -# Copyright (c) 2019 Artur Pacholec +# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 Artur Pacholec # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c b/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c index 3d072627a4..6bdbeff7c2 100644 --- a/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +++ b/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Artur Pacholec * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/common-hal/board/__init__.c b/ports/mimxrt10xx/common-hal/board/__init__.c index e86251480e..4967e1a76a 100644 --- a/ports/mimxrt10xx/common-hal/board/__init__.c +++ b/ports/mimxrt10xx/common-hal/board/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Artur Pacholec * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 4ca2f8e497..db5582d150 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * Copyright (c) 2019 Artur Pacholec * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/common-hal/pulseio/PWMOut.c b/ports/mimxrt10xx/common-hal/pulseio/PWMOut.c index c75b75316a..50dd477ea6 100644 --- a/ports/mimxrt10xx/common-hal/pulseio/PWMOut.c +++ b/ports/mimxrt10xx/common-hal/pulseio/PWMOut.c @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * Copyright (c) 2019 Artur Pacholec * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c b/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c index a49cfa7af7..ffa885688a 100644 --- a/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c +++ b/ports/mimxrt10xx/common-hal/pulseio/PulseOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * Copyright (c) 2019 Artur Pacholec * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/fatfs_port.c b/ports/mimxrt10xx/fatfs_port.c index c4ce18c2a7..c65a73a428 100644 --- a/ports/mimxrt10xx/fatfs_port.c +++ b/ports/mimxrt10xx/fatfs_port.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/mimxrt10xx/supervisor/internal_flash.c b/ports/mimxrt10xx/supervisor/internal_flash.c index 9abd15e60e..09f44ccedf 100644 --- a/ports/mimxrt10xx/supervisor/internal_flash.c +++ b/ports/mimxrt10xx/supervisor/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Artur Pacholec * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/mimxrt10xx/supervisor/internal_flash.h b/ports/mimxrt10xx/supervisor/internal_flash.h index dfbfe1d4b4..daee66620c 100644 --- a/ports/mimxrt10xx/supervisor/internal_flash.h +++ b/ports/mimxrt10xx/supervisor/internal_flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 5b81fa9a74..e1d86f7bc1 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 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 diff --git a/ports/nrf/examples/ubluepy_temp.py b/ports/nrf/examples/ubluepy_temp.py index 118407af5e..405f77c4b0 100644 --- a/ports/nrf/examples/ubluepy_temp.py +++ b/ports/nrf/examples/ubluepy_temp.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2017 Glenn Ruben Bakke +# SPDX-FileCopyrightText: Copyright (c) 2017 Glenn Ruben Bakke # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/nrf/fatfs_port.c b/ports/nrf/fatfs_port.c index cb1bfa8347..2b741f993a 100644 --- a/ports/nrf/fatfs_port.c +++ b/ports/nrf/fatfs_port.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/nrf/peripherals/nrf/nvm.c b/ports/nrf/peripherals/nrf/nvm.c index dc50e2eefa..ce47d73c77 100644 --- a/ports/nrf/peripherals/nrf/nvm.c +++ b/ports/nrf/peripherals/nrf/nvm.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Nick Moore for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/nrf/peripherals/nrf/nvm.h b/ports/nrf/peripherals/nrf/nvm.h index 8ba95773d6..9e144d802a 100644 --- a/ports/nrf/peripherals/nrf/nvm.h +++ b/ports/nrf/peripherals/nrf/nvm.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019 Nick Moore for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/nrf/supervisor/internal_flash.c b/ports/nrf/supervisor/internal_flash.c index 737bab2036..93de0b2c49 100644 --- a/ports/nrf/supervisor/internal_flash.c +++ b/ports/nrf/supervisor/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/nrf/supervisor/internal_flash.h b/ports/nrf/supervisor/internal_flash.h index 024a53ebba..81da690217 100644 --- a/ports/nrf/supervisor/internal_flash.h +++ b/ports/nrf/supervisor/internal_flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/stm/Makefile b/ports/stm/Makefile index a982de765b..e2dc2346e2 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -2,8 +2,8 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Dan Halbert for Adafruit Industries -# Copyright (c) 2019 Lucian Copeland for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 Lucian Copeland for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/stm/common-hal/analogio/AnalogOut.c b/ports/stm/common-hal/analogio/AnalogOut.c index 2ea969f503..a505b2bf0f 100644 --- a/ports/stm/common-hal/analogio/AnalogOut.c +++ b/ports/stm/common-hal/analogio/AnalogOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2019, Lucian Copeland for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/stm/fatfs_port.c b/ports/stm/fatfs_port.c index 6a17f627bd..631f7f0982 100644 --- a/ports/stm/fatfs_port.c +++ b/ports/stm/fatfs_port.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/stm/supervisor/internal_flash.c b/ports/stm/supervisor/internal_flash.c index d37a54f60f..864403c366 100644 --- a/ports/stm/supervisor/internal_flash.c +++ b/ports/stm/supervisor/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2020 Lucian Copeland for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/stm/supervisor/internal_flash.h b/ports/stm/supervisor/internal_flash.h index 13ade4e6e7..ad5cba62d8 100644 --- a/ports/stm/supervisor/internal_flash.h +++ b/ports/stm/supervisor/internal_flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2020 Lucian Copeland for Adafruit Industries * Copyright (c) 2020 Mark Olsson * diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py index 4e97252602..984696be0d 100644 --- a/ports/stm/tools/parse_af_csv.py +++ b/ports/stm/tools/parse_af_csv.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2020 Lucian Copeland for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2020 Lucian Copeland for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/stm/tools/parse_pins_csv.py b/ports/stm/tools/parse_pins_csv.py index 4ab3fc25c9..68f6db586e 100644 --- a/ports/stm/tools/parse_pins_csv.py +++ b/ports/stm/tools/parse_pins_csv.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2020 Lucian Copeland for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2020 Lucian Copeland for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/fdfile.h b/ports/unix/fdfile.h index 69a9b6be41..d7da673be9 100644 --- a/ports/unix/fdfile.h +++ b/ports/unix/fdfile.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2016 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/unix/file.c b/ports/unix/file.c index e5c73d26c2..e4f62e3d5a 100644 --- a/ports/unix/file.c +++ b/ports/unix/file.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/gccollect.c b/ports/unix/gccollect.c index 02f6fc91a8..7cd74ec134 100644 --- a/ports/unix/gccollect.c +++ b/ports/unix/gccollect.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/input.c b/ports/unix/input.c index 7d60b46cc7..b661ce3e24 100644 --- a/ports/unix/input.c +++ b/ports/unix/input.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/main.c b/ports/unix/main.c index d1187ae905..5a3cbaf477 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/modffi.c b/ports/unix/modffi.c index 03dc9e4ec6..c750f2eb77 100644 --- a/ports/unix/modffi.c +++ b/ports/unix/modffi.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/unix/modmachine.c b/ports/unix/modmachine.c index b2bca12063..61697cfb6f 100644 --- a/ports/unix/modmachine.c +++ b/ports/unix/modmachine.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/modos.c b/ports/unix/modos.c index d99d0d62c9..252b19a50c 100644 --- a/ports/unix/modos.c +++ b/ports/unix/modos.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/unix/modtime.c b/ports/unix/modtime.c index a8f6ed5c6e..cc9b4a3371 100644 --- a/ports/unix/modtime.c +++ b/ports/unix/modtime.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c index e9ac8e1f88..b45d4485b5 100644 --- a/ports/unix/moduos_vfs.c +++ b/ports/unix/moduos_vfs.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/moduselect.c b/ports/unix/moduselect.c index 1ea7dc19a5..dbda5e1107 100644 --- a/ports/unix/moduselect.c +++ b/ports/unix/moduselect.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * Copyright (c) 2015-2017 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/unix/modusocket.c b/ports/unix/modusocket.c index 95da276ed9..90651a19ea 100644 --- a/ports/unix/modusocket.c +++ b/ports/unix/modusocket.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index 3ac7ceaf21..3ae4ff7866 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpconfigport_coverage.h b/ports/unix/mpconfigport_coverage.h index 97c05cfee4..51015a5872 100644 --- a/ports/unix/mpconfigport_coverage.h +++ b/ports/unix/mpconfigport_coverage.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpconfigport_fast.h b/ports/unix/mpconfigport_fast.h index 442159eb4f..76e02c1b0a 100644 --- a/ports/unix/mpconfigport_fast.h +++ b/ports/unix/mpconfigport_fast.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpconfigport_freedos.h b/ports/unix/mpconfigport_freedos.h index 09c85ab1e3..19c73b7623 100644 --- a/ports/unix/mpconfigport_freedos.h +++ b/ports/unix/mpconfigport_freedos.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpconfigport_minimal.h b/ports/unix/mpconfigport_minimal.h index ef7a1a09a0..1a13d5725b 100644 --- a/ports/unix/mpconfigport_minimal.h +++ b/ports/unix/mpconfigport_minimal.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpconfigport_nanbox.h b/ports/unix/mpconfigport_nanbox.h index 7da2cf7b80..fa41407cfb 100644 --- a/ports/unix/mpconfigport_nanbox.h +++ b/ports/unix/mpconfigport_nanbox.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mphalport.h b/ports/unix/mphalport.h index ff7a51567c..6f2880d4ef 100644 --- a/ports/unix/mphalport.h +++ b/ports/unix/mphalport.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpthreadport.c b/ports/unix/mpthreadport.c index baca0a2b1e..3641745bc6 100644 --- a/ports/unix/mpthreadport.c +++ b/ports/unix/mpthreadport.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/mpthreadport.h b/ports/unix/mpthreadport.h index b158ed5bcc..bd712ebee0 100644 --- a/ports/unix/mpthreadport.h +++ b/ports/unix/mpthreadport.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/qstrdefsport.h b/ports/unix/qstrdefsport.h index ebfaa6ccab..873e832720 100644 --- a/ports/unix/qstrdefsport.h +++ b/ports/unix/qstrdefsport.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c index f27c62fd1d..e9494d7ff2 100644 --- a/ports/unix/unix_mphal.c +++ b/ports/unix/unix_mphal.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/argcheck.c b/py/argcheck.c index a8df206e28..9341c02a6c 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmarm.c b/py/asmarm.c index 1a8923bc23..11e498b2c7 100644 --- a/py/asmarm.c +++ b/py/asmarm.c @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2014 Fabian Vogt - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmarm.h b/py/asmarm.h index 5603030912..f63106a9b6 100644 --- a/py/asmarm.h +++ b/py/asmarm.h @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2014 Fabian Vogt - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmbase.c b/py/asmbase.c index 4c84c3b255..4d080f095e 100644 --- a/py/asmbase.c +++ b/py/asmbase.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmbase.h b/py/asmbase.h index d2b4038931..3b2f59d159 100644 --- a/py/asmbase.h +++ b/py/asmbase.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmthumb.c b/py/asmthumb.c index c5b45f2f51..3cf47c5b15 100644 --- a/py/asmthumb.c +++ b/py/asmthumb.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmthumb.h b/py/asmthumb.h index b7e2acc048..32219eb55a 100644 --- a/py/asmthumb.h +++ b/py/asmthumb.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmx64.c b/py/asmx64.c index c900a08d1f..8706b806e5 100644 --- a/py/asmx64.c +++ b/py/asmx64.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmx64.h b/py/asmx64.h index ed0b785fb2..113d925119 100644 --- a/py/asmx64.h +++ b/py/asmx64.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmx86.c b/py/asmx86.c index 3938baaacb..8a08c68a03 100644 --- a/py/asmx86.c +++ b/py/asmx86.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmx86.h b/py/asmx86.h index 0908b8c711..05902350fc 100644 --- a/py/asmx86.h +++ b/py/asmx86.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmxtensa.c b/py/asmxtensa.c index 00448dfc59..98b49ecb5e 100644 --- a/py/asmxtensa.c +++ b/py/asmxtensa.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/asmxtensa.h b/py/asmxtensa.h index ef80f700a3..d43824338d 100644 --- a/py/asmxtensa.h +++ b/py/asmxtensa.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/bc.c b/py/bc.c index 69b4cb238b..6406713385 100644 --- a/py/bc.c +++ b/py/bc.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/bc.h b/py/bc.h index ebfdeaac1d..b71325f92b 100644 --- a/py/bc.h +++ b/py/bc.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/bc0.h b/py/bc0.h index 70acfb0cac..a031bcc88b 100644 --- a/py/bc0.h +++ b/py/bc0.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/binary.c b/py/binary.c index 2ec12fa931..cd0f1aa4df 100644 --- a/py/binary.c +++ b/py/binary.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/binary.h b/py/binary.h index 0dae6a29e6..6c70d93339 100644 --- a/py/binary.h +++ b/py/binary.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/builtin.h b/py/builtin.h index 6e0d5d9bef..2275691fc8 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/builtinevex.c b/py/builtinevex.c index cb046b4076..ade12d39d0 100644 --- a/py/builtinevex.c +++ b/py/builtinevex.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/builtinhelp.c b/py/builtinhelp.c index 01c0bc84e0..d12e088d60 100644 --- a/py/builtinhelp.c +++ b/py/builtinhelp.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/builtinimport.c b/py/builtinimport.c index 2be779c6c0..597819f55c 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 32d3640069..815ee2e62b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 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 diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 302368f74a..075981e30f 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -3,7 +3,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2019 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2019 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 diff --git a/py/compile.c b/py/compile.c index d5fae02994..4708110056 100644 --- a/py/compile.c +++ b/py/compile.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/compile.h b/py/compile.h index 3297e83aeb..0f8d023a25 100644 --- a/py/compile.h +++ b/py/compile.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emit.h b/py/emit.h index aa98efa774..30543d2a3c 100644 --- a/py/emit.h +++ b/py/emit.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitbc.c b/py/emitbc.c index f3951e9cb5..f45dcb9167 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitcommon.c b/py/emitcommon.c index 89cc2c9597..88c9803a6e 100644 --- a/py/emitcommon.c +++ b/py/emitcommon.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitglue.c b/py/emitglue.c index 7708689dd4..3a3174b0f8 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitglue.h b/py/emitglue.h index 0830a0d5c8..2ddcc3e53e 100644 --- a/py/emitglue.h +++ b/py/emitglue.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c index 7f0ec66590..47ed14321e 100644 --- a/py/emitinlinethumb.c +++ b/py/emitinlinethumb.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitinlinextensa.c b/py/emitinlinextensa.c index 9cd65824be..ae84aae2e3 100644 --- a/py/emitinlinextensa.c +++ b/py/emitinlinextensa.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/emitnative.c b/py/emitnative.c index 60f31d15f5..51919e389b 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/formatfloat.c b/py/formatfloat.c index dc7fc1d1fd..166a98a2e6 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/formatfloat.h b/py/formatfloat.h index 9a1643b4dd..c433cb8057 100644 --- a/py/formatfloat.h +++ b/py/formatfloat.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/frozenmod.c b/py/frozenmod.c index a9143b582a..0e040a44fd 100644 --- a/py/frozenmod.c +++ b/py/frozenmod.c @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2015 Paul Sokolovsky - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/frozenmod.h b/py/frozenmod.h index 1e50f3807a..3ba1b590d7 100644 --- a/py/frozenmod.h +++ b/py/frozenmod.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/gc.c b/py/gc.c index 271bc94624..2f3f63522e 100755 --- a/py/gc.c +++ b/py/gc.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/gc.h b/py/gc.h index 2a0811f4ed..b7c2889d5c 100644 --- a/py/gc.h +++ b/py/gc.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/grammar.h b/py/grammar.h index 5a5b682acc..28f7850398 100644 --- a/py/grammar.h +++ b/py/grammar.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/ioctl.h b/py/ioctl.h index ced4275900..8c84835cc1 100644 --- a/py/ioctl.h +++ b/py/ioctl.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/lexer.c b/py/lexer.c index 00cd59bcae..de121f87a2 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/lexer.h b/py/lexer.h index a3eaa2a7e6..74195fe030 100644 --- a/py/lexer.h +++ b/py/lexer.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/malloc.c b/py/malloc.c index f190582ab2..8d5141ee04 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/map.c b/py/map.c index 57c11dbc97..69eed9d3b9 100644 --- a/py/map.c +++ b/py/map.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/misc.h b/py/misc.h index 673568f226..944c0a7164 100644 --- a/py/misc.h +++ b/py/misc.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modarray.c b/py/modarray.c index c0cdca9286..75bc5169f8 100644 --- a/py/modarray.c +++ b/py/modarray.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modbuiltins.c b/py/modbuiltins.c index e764f1987e..905c3471f1 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modcmath.c b/py/modcmath.c index 70fd542af9..d6b364733d 100644 --- a/py/modcmath.c +++ b/py/modcmath.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modcollections.c b/py/modcollections.c index 91e7355281..9634c5ce73 100644 --- a/py/modcollections.c +++ b/py/modcollections.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modgc.c b/py/modgc.c index 55e73defce..b01876422a 100644 --- a/py/modgc.c +++ b/py/modgc.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modio.c b/py/modio.c index 17840a6d87..4bcc3971eb 100644 --- a/py/modio.c +++ b/py/modio.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modmath.c b/py/modmath.c index 9d75ea2d52..ec520bb6f2 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modmicropython.c b/py/modmicropython.c index a45d44653a..7e29825ae4 100644 --- a/py/modmicropython.c +++ b/py/modmicropython.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/modstruct.c b/py/modstruct.c index a238d3935a..fe766a4deb 100644 --- a/py/modstruct.c +++ b/py/modstruct.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/modsys.c b/py/modsys.c index 68e048d91d..a1d2cf831c 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014-2017 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/modthread.c b/py/modthread.c index 1c00f6397e..250756ef27 100644 --- a/py/modthread.c +++ b/py/modthread.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/moduerrno.c b/py/moduerrno.c index 3be5adba1e..3928f8cd89 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpconfig.h b/py/mpconfig.h index 513f04f6ef..034d39d409 100755 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mperrno.h b/py/mperrno.h index 911a9b4131..e339fde852 100644 --- a/py/mperrno.h +++ b/py/mperrno.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mphal.h b/py/mphal.h index 92de01d08b..c242dd2452 100644 --- a/py/mphal.h +++ b/py/mphal.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpprint.c b/py/mpprint.c index c2e65301c9..e814d2ebe5 100644 --- a/py/mpprint.c +++ b/py/mpprint.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpprint.h b/py/mpprint.h index 07462bddcc..0d12b9a3d0 100644 --- a/py/mpprint.h +++ b/py/mpprint.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpstate.c b/py/mpstate.c index 32f1d60a59..b3957cc09a 100644 --- a/py/mpstate.c +++ b/py/mpstate.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpstate.h b/py/mpstate.h index a5815776a4..32f353528c 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpthread.h b/py/mpthread.h index 602df830c4..3a6983e9d0 100644 --- a/py/mpthread.h +++ b/py/mpthread.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpz.c b/py/mpz.c index 8687092d02..7800cdcc45 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/mpz.h b/py/mpz.h index 3c36cac66b..e412f5cce1 100644 --- a/py/mpz.h +++ b/py/mpz.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nativeglue.c b/py/nativeglue.c index b87da6931e..9ac8060097 100644 --- a/py/nativeglue.c +++ b/py/nativeglue.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlr.c b/py/nlr.c index 1bfd9c19b0..95d833177d 100644 --- a/py/nlr.c +++ b/py/nlr.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlr.h b/py/nlr.h index 1b95002d3b..aed24e277a 100644 --- a/py/nlr.h +++ b/py/nlr.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlrsetjmp.c b/py/nlrsetjmp.c index 960dd86f52..a93595dc83 100644 --- a/py/nlrsetjmp.c +++ b/py/nlrsetjmp.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlrthumb.c b/py/nlrthumb.c index 056aa358e7..464995fa88 100644 --- a/py/nlrthumb.c +++ b/py/nlrthumb.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlrx64.c b/py/nlrx64.c index 569ad84fb0..246d6a95b8 100644 --- a/py/nlrx64.c +++ b/py/nlrx64.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlrx86.c b/py/nlrx86.c index 6fbbe44327..18306253d7 100644 --- a/py/nlrx86.c +++ b/py/nlrx86.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/nlrxtensa.c b/py/nlrxtensa.c index 5640350043..e04535ff83 100644 --- a/py/nlrxtensa.c +++ b/py/nlrxtensa.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/obj.c b/py/obj.c index 4fa2032dc7..7644b5de8e 100644 --- a/py/obj.c +++ b/py/obj.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/obj.h b/py/obj.h index fa315d12f7..8536e33335 100644 --- a/py/obj.h +++ b/py/obj.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objarray.c b/py/objarray.c index fccb966a2b..7dfdc5b121 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objarray.h b/py/objarray.h index 0dad705711..7ad5328f0e 100644 --- a/py/objarray.h +++ b/py/objarray.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objattrtuple.c b/py/objattrtuple.c index 3cc298d4e9..ac9b808a20 100644 --- a/py/objattrtuple.c +++ b/py/objattrtuple.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objbool.c b/py/objbool.c index cd7d7100c9..5e8f630ff1 100644 --- a/py/objbool.c +++ b/py/objbool.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objboundmeth.c b/py/objboundmeth.c index a05680d410..5bf25567f0 100644 --- a/py/objboundmeth.c +++ b/py/objboundmeth.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objcell.c b/py/objcell.c index 111906412e..25fe5232a1 100644 --- a/py/objcell.c +++ b/py/objcell.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objclosure.c b/py/objclosure.c index 4eb9eb8b84..6f6772ff1c 100644 --- a/py/objclosure.c +++ b/py/objclosure.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objcomplex.c b/py/objcomplex.c index b38e2c5fa6..43e0690d38 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objdict.c b/py/objdict.c index 3ec3cbe80a..39169fe1ad 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objenumerate.c b/py/objenumerate.c index 818725d856..dee7fc760d 100644 --- a/py/objenumerate.c +++ b/py/objenumerate.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objexcept.c b/py/objexcept.c index 796be122fe..e3b953543e 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objexcept.h b/py/objexcept.h index 7c30762248..c19658427a 100644 --- a/py/objexcept.h +++ b/py/objexcept.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objfilter.c b/py/objfilter.c index af95326e60..0e02f4b5ef 100644 --- a/py/objfilter.c +++ b/py/objfilter.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objfloat.c b/py/objfloat.c index f544ade053..59f1eb2f69 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objfun.c b/py/objfun.c index c586a290ac..933044ef71 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objfun.h b/py/objfun.h index fbb3516261..457c3cf48c 100644 --- a/py/objfun.h +++ b/py/objfun.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objgenerator.c b/py/objgenerator.c index 01d42ba94f..6ffcfae46a 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014-2017 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objgenerator.h b/py/objgenerator.h index 80bf9cd860..4b7f8c1ac5 100644 --- a/py/objgenerator.h +++ b/py/objgenerator.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c index ec41c2c5b1..44e8fe8894 100644 --- a/py/objgetitemiter.c +++ b/py/objgetitemiter.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objint.c b/py/objint.c index b78c9f25b1..82f5aadd18 100644 --- a/py/objint.c +++ b/py/objint.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objint.h b/py/objint.h index e8c9bc3e06..bba9ff50a5 100644 --- a/py/objint.h +++ b/py/objint.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objint_longlong.c b/py/objint_longlong.c index ce02fa1755..1890496305 100644 --- a/py/objint_longlong.c +++ b/py/objint_longlong.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objint_mpz.c b/py/objint_mpz.c index 95e4d7e176..90060114ed 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objlist.c b/py/objlist.c index 608ea9f6ca..9242020d45 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objlist.h b/py/objlist.h index a43663db76..f02030557b 100644 --- a/py/objlist.h +++ b/py/objlist.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objmap.c b/py/objmap.c index cf71f99eeb..5cf975f492 100644 --- a/py/objmap.c +++ b/py/objmap.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objmodule.c b/py/objmodule.c index b6a8a084e9..757aece046 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objmodule.h b/py/objmodule.h index b7702ec50b..0b9b2d130d 100644 --- a/py/objmodule.h +++ b/py/objmodule.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c index 84dcf79097..6c36909e75 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objnamedtuple.h b/py/objnamedtuple.h index 0ea0d28622..9f290c3ec4 100644 --- a/py/objnamedtuple.h +++ b/py/objnamedtuple.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objnone.c b/py/objnone.c index da1031835c..b1fbd48f75 100644 --- a/py/objnone.c +++ b/py/objnone.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objobject.c b/py/objobject.c index a42edde3c6..8983cd9ad3 100644 --- a/py/objobject.c +++ b/py/objobject.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objproperty.c b/py/objproperty.c index ddf484af2b..e909533c45 100644 --- a/py/objproperty.c +++ b/py/objproperty.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objproperty.h b/py/objproperty.h index f95c1083c0..f3ade89d92 100644 --- a/py/objproperty.h +++ b/py/objproperty.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objrange.c b/py/objrange.c index 30d55c56cd..7af9f37a11 100644 --- a/py/objrange.c +++ b/py/objrange.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objreversed.c b/py/objreversed.c index 4937d08189..63d122b5db 100644 --- a/py/objreversed.c +++ b/py/objreversed.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objset.c b/py/objset.c index 5d1608c7ea..d986c6ddaf 100644 --- a/py/objset.c +++ b/py/objset.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objsingleton.c b/py/objsingleton.c index 67535391ea..1c27573343 100644 --- a/py/objsingleton.c +++ b/py/objsingleton.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objslice.c b/py/objslice.c index cbbee326e9..40d4d3c760 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objstr.c b/py/objstr.c index a60f507e99..5e0c6fdfaa 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objstr.h b/py/objstr.h index 61a11d0bd6..4b5e2054e0 100644 --- a/py/objstr.h +++ b/py/objstr.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objstringio.c b/py/objstringio.c index 178e6446cc..eb40e51543 100644 --- a/py/objstringio.c +++ b/py/objstringio.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objstringio.h b/py/objstringio.h index 56738f4e45..38778f03ae 100644 --- a/py/objstringio.h +++ b/py/objstringio.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objstrunicode.c b/py/objstrunicode.c index 30000a51e7..351a67e913 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objtuple.c b/py/objtuple.c index 0a2ed6f4c3..d34a7f7624 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objtuple.h b/py/objtuple.h index 7f20ab7b6f..d2e87e9949 100644 --- a/py/objtuple.h +++ b/py/objtuple.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objtype.c b/py/objtype.c index ad68b85d2a..fd51ce36b8 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2018 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2018 Damien P. George * Copyright (c) 2014-2016 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/objtype.h b/py/objtype.h index a32c874967..a44622ffeb 100644 --- a/py/objtype.h +++ b/py/objtype.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/objzip.c b/py/objzip.c index ce9afd55de..885e464418 100644 --- a/py/objzip.c +++ b/py/objzip.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/opmethods.c b/py/opmethods.c index 247fa5bbc8..07d1e340de 100644 --- a/py/opmethods.c +++ b/py/opmethods.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/parse.c b/py/parse.c index b8cfda2cb5..28621cf898 100644 --- a/py/parse.c +++ b/py/parse.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/parse.h b/py/parse.h index 9a1a2b4dd4..946b41eac3 100644 --- a/py/parse.h +++ b/py/parse.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/parsenum.c b/py/parsenum.c index 6ef309b475..da63825e4b 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/parsenum.h b/py/parsenum.h index a5bed731d2..a91ca532da 100644 --- a/py/parsenum.h +++ b/py/parsenum.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/parsenumbase.c b/py/parsenumbase.c index ba10591226..e4ac6d00ed 100644 --- a/py/parsenumbase.c +++ b/py/parsenumbase.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/parsenumbase.h b/py/parsenumbase.h index 3a525f993c..43dcc2353a 100644 --- a/py/parsenumbase.h +++ b/py/parsenumbase.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/persistentcode.c b/py/persistentcode.c index eb69bd4079..9b438453ad 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/persistentcode.h b/py/persistentcode.h index d04e0b6330..cbb300e4b3 100644 --- a/py/persistentcode.h +++ b/py/persistentcode.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/pystack.c b/py/pystack.c index 552e59d537..f79ea92101 100644 --- a/py/pystack.c +++ b/py/pystack.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/pystack.h b/py/pystack.h index 82ac3743d1..3fbcdeeb8a 100644 --- a/py/pystack.h +++ b/py/pystack.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/qstr.c b/py/qstr.c index bb80244355..17d8517c93 100755 --- a/py/qstr.c +++ b/py/qstr.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/qstr.h b/py/qstr.h index 39b904fb18..070a3cd4f8 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/qstrdefs.h b/py/qstrdefs.h index a609058120..b682671970 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/reader.c b/py/reader.c index 80364104bb..1b0bbf094a 100644 --- a/py/reader.c +++ b/py/reader.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/reader.h b/py/reader.h index 8511c72ce5..6d8565d7b7 100644 --- a/py/reader.h +++ b/py/reader.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/repl.c b/py/repl.c index aa91c3f12e..785c0fb538 100644 --- a/py/repl.c +++ b/py/repl.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013-2015 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/repl.h b/py/repl.h index a7a4136cad..89b64c45f0 100644 --- a/py/repl.h +++ b/py/repl.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/runtime.c b/py/runtime.c index 59dcbc7a1c..91ead1fba9 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/runtime.h b/py/runtime.h index f811035571..d3a82333e7 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/runtime0.h b/py/runtime0.h index 16434b315a..a8089ea646 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/scheduler.c b/py/scheduler.c index 30851a4d2b..fea7e0153d 100644 --- a/py/scheduler.c +++ b/py/scheduler.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/scope.c b/py/scope.c index 1a6ae7b8ad..98f39d4c6d 100644 --- a/py/scope.c +++ b/py/scope.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/scope.h b/py/scope.h index e3b6a57c79..c92a39e5e6 100644 --- a/py/scope.h +++ b/py/scope.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/sequence.c b/py/sequence.c index 0e668ea2a1..e6421fde5e 100644 --- a/py/sequence.c +++ b/py/sequence.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/showbc.c b/py/showbc.c index e71d8a2536..5a8e660fc4 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/smallint.c b/py/smallint.c index aa542ca7bf..9124b76c13 100644 --- a/py/smallint.c +++ b/py/smallint.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/smallint.h b/py/smallint.h index 6a3c75236c..c58584413f 100644 --- a/py/smallint.h +++ b/py/smallint.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/stream.c b/py/stream.c index 2ff2b76a61..ae702bb1b6 100644 --- a/py/stream.c +++ b/py/stream.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/stream.h b/py/stream.h index dc9fc84c96..be6b23d40d 100644 --- a/py/stream.h +++ b/py/stream.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/unicode.c b/py/unicode.c index 935dc9012e..a17dbf969b 100644 --- a/py/unicode.c +++ b/py/unicode.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/unicode.h b/py/unicode.h index c1fb517894..78e7a7ab7e 100644 --- a/py/unicode.h +++ b/py/unicode.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/vm.c b/py/vm.c index 4f0340681e..9b3354b096 100644 --- a/py/vm.c +++ b/py/vm.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/py/vmentrytable.h b/py/vmentrytable.h index 31a96dbec4..e01199eee2 100644 --- a/py/vmentrytable.h +++ b/py/vmentrytable.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/vstr.c b/py/vstr.c index 91cd7f584f..ccc567d100 100644 --- a/py/vstr.c +++ b/py/vstr.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/warning.c b/py/warning.c index 12d0f9c99b..d516eabddf 100644 --- a/py/warning.c +++ b/py/warning.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/setup.py b/setup.py index 769bc66e1d..d2989d068d 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + from datetime import datetime from setuptools import setup from pathlib import Path diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 400784b390..2aadf1c764 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/analogio/AnalogIn.h b/shared-bindings/analogio/AnalogIn.h index 4aa7fca233..32f11e08f5 100644 --- a/shared-bindings/analogio/AnalogIn.h +++ b/shared-bindings/analogio/AnalogIn.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index a8edcc0ae1..62b73c5b13 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/analogio/AnalogOut.h b/shared-bindings/analogio/AnalogOut.h index 6fe5d9b193..e4e94548b8 100644 --- a/shared-bindings/analogio/AnalogOut.h +++ b/shared-bindings/analogio/AnalogOut.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index eaf2c18101..0ef527f768 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/digitalio/DigitalInOut.h b/shared-bindings/digitalio/DigitalInOut.h index dd6f088ab4..3d1f9c7cb3 100644 --- a/shared-bindings/digitalio/DigitalInOut.h +++ b/shared-bindings/digitalio/DigitalInOut.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 929e02ab81..1867665911 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #include "shared-bindings/gnss/GNSS.h" #include "shared-bindings/time/__init__.h" diff --git a/shared-bindings/gnss/GNSS.h b/shared-bindings/gnss/GNSS.h index 61ae35b12a..60069a90a9 100644 --- a/shared-bindings/gnss/GNSS.h +++ b/shared-bindings/gnss/GNSS.h @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_GNSS_H #define MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_GNSS_H diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 106a28c347..262ebf3190 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #include "shared-bindings/gnss/PositionFix.h" diff --git a/shared-bindings/gnss/PositionFix.h b/shared-bindings/gnss/PositionFix.h index 64497cb59b..34090872cc 100644 --- a/shared-bindings/gnss/PositionFix.h +++ b/shared-bindings/gnss/PositionFix.h @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_POSITIONFIX_H #define MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_POSITIONFIX_H diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index badc02b964..8739fbc029 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #include "shared-bindings/gnss/SatelliteSystem.h" diff --git a/shared-bindings/gnss/SatelliteSystem.h b/shared-bindings/gnss/SatelliteSystem.h index 484e861abd..17f1550028 100644 --- a/shared-bindings/gnss/SatelliteSystem.h +++ b/shared-bindings/gnss/SatelliteSystem.h @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_SATELLITESYSTEM_H #define MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_SATELLITESYSTEM_H diff --git a/shared-bindings/gnss/__init__.c b/shared-bindings/gnss/__init__.c index b3cf722f11..4b0d312ae6 100644 --- a/shared-bindings/gnss/__init__.c +++ b/shared-bindings/gnss/__init__.c @@ -1,28 +1,6 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2020 Sony Semiconductor Solutions Corporation - * - * 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. - */ +// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation +// +// SPDX-License-Identifier: MIT #include "py/obj.h" #include "py/runtime.h" diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 8226a08ecb..ad2e1877d7 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2017 Michael McWethy * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/shared-bindings/network/__init__.c b/shared-bindings/network/__init__.c index 6af86688eb..58aa13473e 100644 --- a/shared-bindings/network/__init__.c +++ b/shared-bindings/network/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/network/__init__.h b/shared-bindings/network/__init__.h index 4fe5e75a37..b579aa57a3 100644 --- a/shared-bindings/network/__init__.h +++ b/shared-bindings/network/__init__.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 4e991d089d..a247d6d845 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Josef Gajdusek * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries * diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index 7970c02f34..a51789053f 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/pulseio/PWMOut.h b/shared-bindings/pulseio/PWMOut.h index c01e0c9261..c72278e0e0 100644 --- a/shared-bindings/pulseio/PWMOut.h +++ b/shared-bindings/pulseio/PWMOut.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/pulseio/PulseOut.h b/shared-bindings/pulseio/PulseOut.h index 2cf78d3f29..390910ff62 100644 --- a/shared-bindings/pulseio/PulseOut.h +++ b/shared-bindings/pulseio/PulseOut.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index 58fe308f53..7debb70c18 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2018 Noralf Trønnes - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index b204d511c9..9f8d37fdd1 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -4,7 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2018 Noralf Trønnes - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 19c4850cde..0ded0218bb 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * 2018 Nick Moore for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 3abc5512c9..725329ad5b 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Josef Gajdusek * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries * diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 256b385c8e..26c0ff3aff 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014 Paul Sokolovsky * Copyright (c) 2017 Michael McWethy * diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 531980effc..2f8a1c3e2c 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Josef Gajdusek * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries * diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 4c1d534eaa..54e5ac4a5e 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/touchio/TouchIn.h b/shared-bindings/touchio/TouchIn.h index e04e79c0b6..42f9da46d5 100644 --- a/shared-bindings/touchio/TouchIn.h +++ b/shared-bindings/touchio/TouchIn.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/wiznet/__init__.c b/shared-bindings/wiznet/__init__.c index 0d3f1e4cd6..bc7ff150fe 100644 --- a/shared-bindings/wiznet/__init__.c +++ b/shared-bindings/wiznet/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index 2f49dffea9..b3f372f41a 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-module/bitbangio/I2C.c b/shared-module/bitbangio/I2C.c index 5a9ac9a991..d44aec0e75 100644 --- a/shared-module/bitbangio/I2C.c +++ b/shared-module/bitbangio/I2C.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Damien P. George, Scott Shawcroft + * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George, Scott Shawcroft * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-module/bitbangio/SPI.c b/shared-module/bitbangio/SPI.c index e0ff1184fe..f3fe16029a 100644 --- a/shared-module/bitbangio/SPI.c +++ b/shared-module/bitbangio/SPI.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-module/network/__init__.h b/shared-module/network/__init__.h index f4eb05bb51..280cfe6c81 100644 --- a/shared-module/network/__init__.h +++ b/shared-module/network/__init__.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2018 Nick Moore * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/shared-module/os/__init__.c b/shared-module/os/__init__.c index 8060eec4f3..39cf40fda3 100644 --- a/shared-module/os/__init__.c +++ b/shared-module/os/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Josef Gajdusek * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries * diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c index c3d4b50c8e..aa3bcc6867 100644 --- a/shared-module/storage/__init__.c +++ b/shared-module/storage/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Josef Gajdusek * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries * diff --git a/shared-module/wiznet/wiznet5k.c b/shared-module/wiznet/wiznet5k.c index a603a55937..8ccb4ff8d2 100644 --- a/shared-module/wiznet/wiznet5k.c +++ b/shared-module/wiznet/wiznet5k.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/shared-module/wiznet/wiznet5k.h b/shared-module/wiznet/wiznet5k.h index 19823ae550..4597a30160 100644 --- a/shared-module/wiznet/wiznet5k.h +++ b/shared-module/wiznet/wiznet5k.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/supervisor/flash.h b/supervisor/flash.h index a8a77bf040..cd69cbfa9b 100644 --- a/supervisor/flash.h +++ b/supervisor/flash.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/supervisor/shared/external_flash/common_commands.h b/supervisor/shared/external_flash/common_commands.h index 2eaa848331..37efd8ceb1 100644 --- a/supervisor/shared/external_flash/common_commands.h +++ b/supervisor/shared/external_flash/common_commands.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/supervisor/stub/internal_flash.c b/supervisor/stub/internal_flash.c index 5a82f81f77..3a4ba935de 100644 --- a/supervisor/stub/internal_flash.c +++ b/supervisor/stub/internal_flash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2013, 2014 Damien P. George + * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/tests/skip_if.py b/tests/skip_if.py index 7d6c5b2075..a8f50c4656 100644 --- a/tests/skip_if.py +++ b/tests/skip_if.py @@ -1,24 +1,7 @@ -# The MIT License (MIT) +# SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# SPDX-License-Identifier: MIT # This must be on one line so its skipped when built into tests. """This file provides helpers to detect particular running conditions and skip the test when appropriate.""" diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py index f91b2d5807..5015c3f9cf 100644 --- a/tests/thread/mutate_bytearray.py +++ b/tests/thread/mutate_bytearray.py @@ -1,6 +1,8 @@ # test concurrent mutating access to a shared bytearray object # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/mutate_dict.py b/tests/thread/mutate_dict.py index c57d332d51..563fce39de 100644 --- a/tests/thread/mutate_dict.py +++ b/tests/thread/mutate_dict.py @@ -1,6 +1,8 @@ # test concurrent mutating access to a shared dict object # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py index a1ae428b54..2ecfbe1092 100644 --- a/tests/thread/mutate_instance.py +++ b/tests/thread/mutate_instance.py @@ -1,6 +1,8 @@ # test concurrent mutating access to a shared user instance # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/mutate_list.py b/tests/thread/mutate_list.py index 764a9bd99e..d70e8a8a38 100644 --- a/tests/thread/mutate_list.py +++ b/tests/thread/mutate_list.py @@ -1,6 +1,8 @@ # test concurrent mutating access to a shared list object # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/mutate_set.py b/tests/thread/mutate_set.py index 5492d86313..c4529f3562 100644 --- a/tests/thread/mutate_set.py +++ b/tests/thread/mutate_set.py @@ -1,6 +1,8 @@ # test concurrent mutating access to a shared set object # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index df75e616c6..ebf7af371b 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -11,7 +11,9 @@ # aggressive by changing the amount of data to encrypt, the number of loops and # the number of threads. # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT ################################################################## # discrete arithmetic routines, mostly from a precomputed table diff --git a/tests/thread/stress_heap.py b/tests/thread/stress_heap.py index 5482a9ac6f..206cf1a860 100644 --- a/tests/thread/stress_heap.py +++ b/tests/thread/stress_heap.py @@ -1,7 +1,9 @@ # stress test for the heap by allocating lots of objects within threads # allocates about 5mb on the heap # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/stress_recurse.py b/tests/thread/stress_recurse.py index 68367c4dd7..8edee246ad 100644 --- a/tests/thread/stress_recurse.py +++ b/tests/thread/stress_recurse.py @@ -1,6 +1,8 @@ # test hitting the function recursion limit within a thread # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_exc1.py b/tests/thread/thread_exc1.py index 10fb94b4fb..e00a16bd26 100644 --- a/tests/thread/thread_exc1.py +++ b/tests/thread/thread_exc1.py @@ -1,6 +1,8 @@ # test raising and catching an exception within a thread # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_exit1.py b/tests/thread/thread_exit1.py index 88cdd165c7..ad7b01d89b 100644 --- a/tests/thread/thread_exit1.py +++ b/tests/thread/thread_exit1.py @@ -1,6 +1,8 @@ # test _thread.exit() function # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/thread_exit2.py b/tests/thread/thread_exit2.py index 368a11bba4..6bff8a1736 100644 --- a/tests/thread/thread_exit2.py +++ b/tests/thread/thread_exit2.py @@ -1,6 +1,8 @@ # test raising SystemExit to finish a thread # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/thread_gc1.py b/tests/thread/thread_gc1.py index 8dcbf7e07a..2ea1891615 100644 --- a/tests/thread/thread_gc1.py +++ b/tests/thread/thread_gc1.py @@ -1,6 +1,8 @@ # test that we can run the garbage collector within threads # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import gc import _thread diff --git a/tests/thread/thread_ident1.py b/tests/thread/thread_ident1.py index 217fce73b1..9a6f89ff5f 100644 --- a/tests/thread/thread_ident1.py +++ b/tests/thread/thread_ident1.py @@ -1,6 +1,8 @@ # test _thread.get_ident() function # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_lock1.py b/tests/thread/thread_lock1.py index ba5c7dff06..c2d7c9d1ed 100644 --- a/tests/thread/thread_lock1.py +++ b/tests/thread/thread_lock1.py @@ -1,6 +1,8 @@ # test _thread lock object using a single thread # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_lock2.py b/tests/thread/thread_lock2.py index 405f10b0b6..4ef912dff5 100644 --- a/tests/thread/thread_lock2.py +++ b/tests/thread/thread_lock2.py @@ -1,6 +1,8 @@ # test _thread lock objects with multiple threads # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/thread_lock3.py b/tests/thread/thread_lock3.py index 607898dad8..35808d99cb 100644 --- a/tests/thread/thread_lock3.py +++ b/tests/thread/thread_lock3.py @@ -1,6 +1,8 @@ # test thread coordination using a lock object # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_lock4.py b/tests/thread/thread_lock4.py index 2f9d42d6b5..440f3e90c6 100644 --- a/tests/thread/thread_lock4.py +++ b/tests/thread/thread_lock4.py @@ -1,6 +1,8 @@ # test using lock to coordinate access to global mutable objects # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index f4136d9646..dccfb7f517 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -1,6 +1,8 @@ # test concurrent interning of strings # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/thread_shared1.py b/tests/thread/thread_shared1.py index 13c6651cc4..de339ad7f8 100644 --- a/tests/thread/thread_shared1.py +++ b/tests/thread/thread_shared1.py @@ -1,6 +1,8 @@ # test capability for threads to access a shared immutable data structure # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_shared2.py b/tests/thread/thread_shared2.py index e4bfe78022..2c749e6883 100644 --- a/tests/thread/thread_shared2.py +++ b/tests/thread/thread_shared2.py @@ -1,7 +1,9 @@ # test capability for threads to access a shared mutable data structure # (without contention because they access different parts of the structure) # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import _thread diff --git a/tests/thread/thread_sleep1.py b/tests/thread/thread_sleep1.py index 032ec17543..d5aa99f977 100644 --- a/tests/thread/thread_sleep1.py +++ b/tests/thread/thread_sleep1.py @@ -1,6 +1,8 @@ # test threads sleeping # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime diff --git a/tests/thread/thread_stacksize1.py b/tests/thread/thread_stacksize1.py index 62b6e5e40d..e7189fafbc 100644 --- a/tests/thread/thread_stacksize1.py +++ b/tests/thread/thread_stacksize1.py @@ -1,6 +1,8 @@ # test setting the thread stack size # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT import sys import _thread diff --git a/tests/thread/thread_start1.py b/tests/thread/thread_start1.py index d23a74aa21..94df6dc625 100644 --- a/tests/thread/thread_start1.py +++ b/tests/thread/thread_start1.py @@ -1,6 +1,8 @@ # test basic capability to start a new thread # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tests/thread/thread_start2.py b/tests/thread/thread_start2.py index d0913e37cd..9412bb6183 100644 --- a/tests/thread/thread_start2.py +++ b/tests/thread/thread_start2.py @@ -1,6 +1,8 @@ # test capability to start a thread with keyword args # -# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd +# +# SPDX-License-Identifier: MIT try: import utime as time diff --git a/tools/analyze_heap_dump.py b/tools/analyze_heap_dump.py index b8f2bd0112..887871db7a 100755 --- a/tools/analyze_heap_dump.py +++ b/tools/analyze_heap_dump.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # This script renders a graph of the MicroPython heap at the given point it was dumped. # It takes three files, the binary dump of ram, the binary for CircuitPython and the linker map file. diff --git a/tools/analyze_mpy.py b/tools/analyze_mpy.py index 376207a24e..a2f541d0f4 100644 --- a/tools/analyze_mpy.py +++ b/tools/analyze_mpy.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys import binascii import io diff --git a/tools/bootstrap_upip.sh b/tools/bootstrap_upip.sh index 2891775d7d..8b9d199fa9 100755 --- a/tools/bootstrap_upip.sh +++ b/tools/bootstrap_upip.sh @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # This script performs bootstrap installation of upip package manager from PyPI # All the other packages can be installed using it. diff --git a/tools/build-stm-latest.sh b/tools/build-stm-latest.sh index 07cb168daa..bfee1b1922 100755 --- a/tools/build-stm-latest.sh +++ b/tools/build-stm-latest.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # function for building firmware function do_build() { descr=$1 diff --git a/tools/build_board_info.py b/tools/build_board_info.py index bbafe19f6a..6ed8b8c167 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import json import os import subprocess diff --git a/tools/build_memory_info.py b/tools/build_memory_info.py index 808b70bd22..26697b9740 100644 --- a/tools/build_memory_info.py +++ b/tools/build_memory_info.py @@ -1,28 +1,9 @@ #!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# This file is part of the MicroPython project, http://micropython.org/ -# -# The MIT License (MIT) -# -# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# SPDX-License-Identifier: MIT import re import sys diff --git a/tools/build_release_files.py b/tools/build_release_files.py index 09133e51fa..3563dd99f1 100755 --- a/tools/build_release_files.py +++ b/tools/build_release_files.py @@ -1,5 +1,9 @@ #! /usr/bin/env python3 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import os import sys import subprocess diff --git a/tools/chart_code_size.py b/tools/chart_code_size.py index 0b55787fa4..f75269130f 100644 --- a/tools/chart_code_size.py +++ b/tools/chart_code_size.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # This script renders a graph of the CircuitPython rom image. # It takes the single elf file and uses objdump to get its contents. diff --git a/tools/check_code_size.sh b/tools/check_code_size.sh index 2925ff1689..bdf1b5ad9b 100755 --- a/tools/check_code_size.sh +++ b/tools/check_code_size.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # # This script check that changes don't lead to code size regressions. # (Size of the language core (== minimal port should not grow)). diff --git a/tools/check_translations.py b/tools/check_translations.py index 7c008d3da7..95776a5449 100644 --- a/tools/check_translations.py +++ b/tools/check_translations.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Validate that all entries in the .pot are in every .po. Only the .pot is updated so we can detect # if a translation was added to the source but isn't in a .po. This ensures translators can grab # complete files to work on. diff --git a/tools/ci_new_boards_check.py b/tools/ci_new_boards_check.py index 8bb8876fbc..86010bad3e 100644 --- a/tools/ci_new_boards_check.py +++ b/tools/ci_new_boards_check.py @@ -1,5 +1,9 @@ #! /usr/bin/env python3 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys import os import json diff --git a/tools/codestats.sh b/tools/codestats.sh index 5f7625c450..c0dd747dc6 100755 --- a/tools/codestats.sh +++ b/tools/codestats.sh @@ -1,4 +1,9 @@ #!/bin/sh + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # # This script generates statistics (build size, speed) for successive # revisions of the code. It checks out git commits one an a time, compiles diff --git a/tools/convert_release_notes.py b/tools/convert_release_notes.py index 6491841029..4b16f005ec 100644 --- a/tools/convert_release_notes.py +++ b/tools/convert_release_notes.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys import mistune diff --git a/tools/cpboard.py b/tools/cpboard.py index 7769cb4f46..464be4ba44 100644 --- a/tools/cpboard.py +++ b/tools/cpboard.py @@ -1,33 +1,12 @@ #!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright (c) 2014-2016 Damien P. George +# SPDX-FileCopyrightText: Copyright (c) 2017 Paul Sokolovsky +# SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2018 Noralf Trønnes +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# This file is part of the MicroPython project, http://micropython.org/ -# -# The MIT License (MIT) -# -# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries -# Copyright (c) 2018 Noralf Trønnes -# -# Parts taken from pyboard.py: -# Copyright (c) 2014-2016 Damien P. George -# Copyright (c) 2017 Paul Sokolovsky -# -# 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. +# SPDX-License-Identifier: MIT import os import re diff --git a/tools/dfu.py b/tools/dfu.py index dd6019235b..489465f0cf 100644 --- a/tools/dfu.py +++ b/tools/dfu.py @@ -1,5 +1,9 @@ #!/usr/bin/python +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Written by Antonio Galea - 2010/11/18 # Updated for DFU 1.1 by Sean Cross - 2020/03/31 # Distributed under Gnu LGPL 3.0 diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index d749d202b3..b9366f6bab 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import os import sys import astroid diff --git a/tools/file2h.py b/tools/file2h.py index 2a04ae22b9..706dd4dd23 100644 --- a/tools/file2h.py +++ b/tools/file2h.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Reads in a text file, and performs the necessary escapes so that it # can be #included as a static string like: # static const char string_from_textfile[] = diff --git a/tools/fixup_translations.py b/tools/fixup_translations.py index 6db7f1cc5c..0362923e88 100644 --- a/tools/fixup_translations.py +++ b/tools/fixup_translations.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Validate that all entries in the .pot are in every .po. Only the .pot is updated so we can detect # if a translation was added to the source but isn't in a .po. This ensures translators can grab # complete files to work on. diff --git a/tools/gc_activity.py b/tools/gc_activity.py index 8d172ea3ab..cc9a218361 100644 --- a/tools/gc_activity.py +++ b/tools/gc_activity.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys import json diff --git a/tools/gc_activity_between_collects.py b/tools/gc_activity_between_collects.py index c02c479f9a..f906cf5c7e 100644 --- a/tools/gc_activity_between_collects.py +++ b/tools/gc_activity_between_collects.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys import json diff --git a/tools/gen-changelog.sh b/tools/gen-changelog.sh index 6eca1b4b11..b29606b0c7 100755 --- a/tools/gen-changelog.sh +++ b/tools/gen-changelog.sh @@ -1,5 +1,9 @@ #!/bin/sh +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + echo "MicroPython change log" for t in $(git tag | grep -v v1.0-rc1 | sort -rV); do diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py index c08daf4776..478a2f22f9 100644 --- a/tools/gen_display_resources.py +++ b/tools/gen_display_resources.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import argparse import os diff --git a/tools/gen_ld_files.py b/tools/gen_ld_files.py index c2ac812bc9..1fea1a7efa 100755 --- a/tools/gen_ld_files.py +++ b/tools/gen_ld_files.py @@ -1,4 +1,9 @@ #! /usr/bin/env python3 + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import argparse import os diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py index 5e25528f90..9a8423c323 100644 --- a/tools/gen_usb_descriptor.py +++ b/tools/gen_usb_descriptor.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import argparse import os diff --git a/tools/gendoc.py b/tools/gendoc.py index 61844d203f..85411cb410 100644 --- a/tools/gendoc.py +++ b/tools/gendoc.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + """ Generate documentation for pyboard API from C files. """ diff --git a/tools/git-checkout-latest-tag.sh b/tools/git-checkout-latest-tag.sh index f6242a946d..69fa2ced4f 100755 --- a/tools/git-checkout-latest-tag.sh +++ b/tools/git-checkout-latest-tag.sh @@ -1,3 +1,8 @@ #!/bin/bash + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + git fetch --tags git checkout $(git describe --tags `git rev-list --tags --max-count=1`) diff --git a/tools/hid_report_descriptors.py b/tools/hid_report_descriptors.py index 07ed26744f..e13e0dbdd1 100644 --- a/tools/hid_report_descriptors.py +++ b/tools/hid_report_descriptors.py @@ -1,24 +1,7 @@ -# The MIT License (MIT) +# SPDX-FileCopyrightText: Copyright (c) 2018 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# Copyright (c) 2018 Dan Halbert for Adafruit Industries -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# SPDX-License-Identifier: MIT import struct diff --git a/tools/insert-usb-ids.py b/tools/insert-usb-ids.py index cdccd3be97..bf74ceeab5 100644 --- a/tools/insert-usb-ids.py +++ b/tools/insert-usb-ids.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # Reads the USB VID and PID from the file specified by sys.argv[1] and then # inserts those values into the template file specified by sys.argv[2], # printing the result to stdout diff --git a/tools/join_bins.py b/tools/join_bins.py index cb73aaabb8..a370f86e44 100644 --- a/tools/join_bins.py +++ b/tools/join_bins.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys output_filename = sys.argv[1] diff --git a/tools/make-frozen.py b/tools/make-frozen.py index 1051b520e4..ad23b9d595 100755 --- a/tools/make-frozen.py +++ b/tools/make-frozen.py @@ -1,4 +1,9 @@ #!/usr/bin/env python + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # # Create frozen modules structure for MicroPython. # diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 5ce24061bc..95090466c4 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -1,28 +1,9 @@ #!/usr/bin/env python3 + +# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# This file is part of the MicroPython project, http://micropython.org/ -# -# The MIT License (MIT) -# -# Copyright (c) 2016 Damien P. George -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# SPDX-License-Identifier: MIT # Python 2/3 compatibility code from __future__ import print_function diff --git a/tools/mpy_bin2res.py b/tools/mpy_bin2res.py index 0c89e7e92b..8d67b71baa 100755 --- a/tools/mpy_bin2res.py +++ b/tools/mpy_bin2res.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + # # This tool converts binary resource files passed on the command line # into a Python source file containing data from these files, which can diff --git a/tools/mpy_cross_all.py b/tools/mpy_cross_all.py index 2bda71e9bc..5d9f8bc0ba 100755 --- a/tools/mpy_cross_all.py +++ b/tools/mpy_cross_all.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import argparse import os import os.path diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index 7ae20c4d61..b75a2e7238 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import argparse import os import os.path diff --git a/tools/print_status.py b/tools/print_status.py index ed563fd68b..9a8b311dc2 100755 --- a/tools/print_status.py +++ b/tools/print_status.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import sys if len(sys.argv) != 2: print("""\ diff --git a/tools/pyboard.py b/tools/pyboard.py index bb5642bd78..ddf6bb6c40 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -1,29 +1,10 @@ #!/usr/bin/env python + +# SPDX-FileCopyrightText: Copyright (c) 2014-2016 Damien P. George +# SPDX-FileCopyrightText: Copyright (c) 2017 Paul Sokolovsky +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# This file is part of the MicroPython project, http://micropython.org/ -# -# The MIT License (MIT) -# -# Copyright (c) 2014-2016 Damien P. George -# Copyright (c) 2017 Paul Sokolovsky -# -# 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. +# SPDX-License-Identifier: MIT """ pyboard interface diff --git a/tools/pydfu.py b/tools/pydfu.py index a7adda37cc..a6210c603a 100755 --- a/tools/pydfu.py +++ b/tools/pydfu.py @@ -1,8 +1,9 @@ #!/usr/bin/env python -# This file is part of the OpenMV project. -# Copyright (c) 2013/2014 Ibrahim Abdelkader -# This work is licensed under the MIT license, see the file LICENSE for -# details. + +# SPDX-FileCopyrightText: Copyright (c) 2013/2014 Ibrahim Abdelkader +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT """This module implements enough functionality to program the STM32F4xx over DFU, without requiring dfu-util. diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py index 7a48f8a9a7..74b1878f95 100755 --- a/tools/tinytest-codegen.py +++ b/tools/tinytest-codegen.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import os, sys from glob import glob from re import sub diff --git a/tools/upip.py b/tools/upip.py index a400c31743..27fbae272f 100644 --- a/tools/upip.py +++ b/tools/upip.py @@ -1,10 +1,10 @@ -# # upip - Package manager for MicroPython + +# SPDX-FileCopyrightText: Copyright (c) 2015-2018 Paul Sokolovsky +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # -# Copyright (c) 2015-2018 Paul Sokolovsky -# -# Licensed under the MIT license. -# +# SPDX-License-Identifier: MIT + import sys import gc import uos as os diff --git a/tools/upip_utarfile.py b/tools/upip_utarfile.py index 460ca2cd44..44d6364524 100644 --- a/tools/upip_utarfile.py +++ b/tools/upip_utarfile.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + import uctypes # http://www.gnu.org/software/tar/manual/html_node/Standard.html From ab4a453006f3110fb4836708cb88521f126884df Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 6 Jul 2020 21:40:38 -0500 Subject: [PATCH 145/277] Made requested changes --- ports/atmel-samd/supervisor/port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 05ce0eb09b..9a09c7afad 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -507,7 +507,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { return; } #ifdef SAMD21 - if (hold_interrupt == true) { + if (hold_interrupt) { return; } #endif @@ -525,7 +525,7 @@ void port_sleep_until_interrupt(void) { } #endif common_hal_mcu_disable_interrupts(); - if (!tud_task_event_ready()) { + if (!tud_task_event_ready() && !hold_interrupt) { __DSB(); __WFI(); } From 1b3cb17abdc943af3ccbe2b6fd1182bbda3597b2 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 6 Jul 2020 21:47:11 -0500 Subject: [PATCH 146/277] Corrected file for SAMD51 build --- ports/atmel-samd/supervisor/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 9a09c7afad..af107de421 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -91,8 +91,8 @@ #if CIRCUITPY_PEW #include "common-hal/_pew/PewPew.h" #endif -#ifdef SAMD21 volatile bool hold_interrupt = false; +#ifdef SAMD21 void rtc_start_pulsein(void) { rtc_set_continuous(); From 0932b64ae7ea75d2ecc3c363ed6a9507fc4cc3a6 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 6 Jul 2020 23:25:33 -0500 Subject: [PATCH 147/277] Correct for SAMD51 build --- ports/atmel-samd/supervisor/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index af107de421..e892e6cde5 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -93,11 +93,11 @@ #endif volatile bool hold_interrupt = false; #ifdef SAMD21 - void rtc_start_pulsein(void) { rtc_set_continuous(); hold_interrupt = true; } + void rtc_end_pulsein(void) { hold_interrupt = false; } From d73d7488b7e001f8f6ba138648b49a6969a71f6a Mon Sep 17 00:00:00 2001 From: oon arfiandwi Date: Mon, 6 Jul 2020 04:06:24 +0000 Subject: [PATCH 148/277] Translated using Weblate (Indonesian) Currently translated at 43.0% (335 of 778 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 223 +++++++++++++++++++++++++++------------------------ 1 file changed, 116 insertions(+), 107 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index a0c255b233..aab5f82810 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-02 15:29+0200\n" -"PO-Revision-Date: 2020-07-04 02:45+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2020-07-06 18:10+0000\n" +"Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" "Language: ID\n" "MIME-Version: 1.0\n" @@ -203,7 +203,7 @@ msgstr "'%s' objek tidak dapat diulang" #: py/obj.c #, c-format msgid "'%s' object is not subscriptable" -msgstr "" +msgstr "Objek '%s' tidak dapat disubkripsikan" #: py/objstr.c msgid "'=' alignment not allowed in string format specifier" @@ -263,7 +263,7 @@ msgstr ", dalam %q\n" #: py/objcomplex.c msgid "0.0 to a complex power" -msgstr "" +msgstr "0.0 ke kompleks berpangkat" #: py/modbuiltins.c msgid "3-arg pow() not supported" @@ -321,7 +321,7 @@ msgstr "Semua timer sedang digunakan" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." -msgstr "" +msgstr "Sudah disebarkan." #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" @@ -399,7 +399,7 @@ msgstr "Kedua pin harus mendukung hardware interrut" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" -msgstr "Brightness harus di antara 0-1.0" +msgstr "Kecerahan harus di antara 0-1.0" #: shared-bindings/supervisor/__init__.c msgid "Brightness must be between 0 and 255" @@ -442,7 +442,7 @@ msgstr "Panjang buffer harus kelipatan 512" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" -msgstr "Buffer harus memiliki panjang setidaknya 1" +msgstr "Penyangga harus memiliki panjang setidaknya 1" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Buffer too large and unable to allocate" @@ -496,6 +496,8 @@ msgstr "Tidak bisa mendapatkan suhu" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" +"Tidak dapat memiliki respon pindaian untuk penyebaran yang terhubung dan " +"diperluas." #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Cannot output both channels on the same pin" @@ -533,11 +535,11 @@ msgstr "Tidak dapat menentukan RTS atau CTS dalam mode RS485" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "" +msgstr "Tidak dapat membuat subkelas dari irisan" #: shared-module/bitbangio/SPI.c msgid "Cannot transfer without MOSI and MISO pins." -msgstr "" +msgstr "Tidak dapat transfer tanpa pin MOSI dan MISO." #: extmod/moductypes.c msgid "Cannot unambiguously get sizeof scalar" @@ -546,32 +548,36 @@ msgstr "tidak dapat mendapatkan ukuran scalar secara tidak ambigu" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +"Tidak dapat membuat variasi frekuensi pada penghitung waktu yang sudah " +"digunakan" #: shared-module/bitbangio/SPI.c msgid "Cannot write without MOSI pin." -msgstr "" +msgstr "Tidak dapat menulis tanpa pin MOSI." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "" +msgstr "Menulis CharacteristicBuffer tidak tersedia" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "" +msgstr "Kode inti CircuitPython mengalami crash. Aduh!\n" #: supervisor/shared/safe_mode.c msgid "" "CircuitPython is in safe mode because you pressed the reset button during " "boot. Press again to exit safe mode.\n" msgstr "" +"CircuitPython dalam mode aman karena Anda menekan tombol reset saat boot. " +"Tekan lagi untuk keluar dari mode aman.\n" #: shared-module/bitbangio/SPI.c msgid "Clock pin init failed." -msgstr "" +msgstr "Init pin clock gagal." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" -msgstr "" +msgstr "Peregangan clock terlalu panjang" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" @@ -579,26 +585,27 @@ msgstr "Clock unit sedang digunakan" #: shared-bindings/_pew/PewPew.c msgid "Column entry must be digitalio.DigitalInOut" -msgstr "" +msgstr "Entri kolom harus digitalio.DigitalInOut" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" -msgstr "" +msgstr "Perintah harus berupa int di antara 0 dan 255" #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " "connection." msgstr "" +"Koneksi telah terputus dan tidak dapat lagi digunakan. Buat koneksi baru." #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "" +msgstr "File .mpy rusak" #: py/emitglue.c msgid "Corrupt raw code" -msgstr "" +msgstr "Kode raw rusak" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" @@ -614,61 +621,61 @@ msgstr "Tidak dapat menginisialisasi UART" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not initialize channel" -msgstr "" +msgstr "Tidak dapat menginisialisasi kanal" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not initialize timer" -msgstr "" +msgstr "Tidak dapat menginisialisasi timer" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not re-init channel" -msgstr "" +msgstr "Tidak dapat menginisialisasi ulang kanal" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not re-init timer" -msgstr "" +msgstr "Tidak dapat menginisialisasi ulang timer" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not restart PWM" -msgstr "" +msgstr "Tidak dapat memulai ulang PWM" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Could not start PWM" -msgstr "" +msgstr "Tidak dapat memulai PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" -msgstr "" +msgstr "Tidak dapat memulai interupsi, RX sibuk" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" +msgstr "Tidak dapat mengalokasikan dekoder" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate first buffer" -msgstr "" +msgstr "Tidak dapat mengalokasikan penyangga pertama" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate input buffer" -msgstr "" +msgstr "Tidak dapat mengalokasikan penyangga masukan" #: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate second buffer" -msgstr "" +msgstr "Tidak dapat mengalokasikan penyangga kedua" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "" +msgstr "Gagal ke HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "" +msgstr "Terjadi kesalahan saat menginisialisasi kanal DAC" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" -msgstr "" +msgstr "Terjadi kesalahan saat menginisialisasi perangkat DAC" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" @@ -677,11 +684,11 @@ msgstr "DAC sudah digunakan" #: ports/atmel-samd/common-hal/displayio/ParallelBus.c #: ports/nrf/common-hal/displayio/ParallelBus.c msgid "Data 0 pin must be byte aligned" -msgstr "" +msgstr "Data 0 pin harus byte disejajarkan" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" -msgstr "" +msgstr "Potongan data harus mengikuti fmt chunk" #: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy @@ -690,34 +697,34 @@ msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." -msgstr "" +msgstr "Kapasitas tujuan lebih kecil dari destination_length." #: ports/nrf/common-hal/audiobusio/I2SOut.c msgid "Device in use" -msgstr "" +msgstr "Perangkat sedang digunakan" #: ports/cxd56/common-hal/digitalio/DigitalInOut.c msgid "DigitalInOut not supported on given pin" -msgstr "" +msgstr "DigitalInOut tidak didukung pada pin yang diberikan" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." -msgstr "" +msgstr "Tampilan harus memiliki ruang warna 16 bit." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" -msgstr "" +msgstr "Rotasi tampilan harus dalam kelipatan 90 derajat" #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." -msgstr "" +msgstr "Mode kendara tidak digunakan saat arah input." #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" -msgstr "" +msgstr "ECB hanya beroperasi pada 16 byte di satu waktu" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -735,42 +742,42 @@ msgstr "Error pada regex" #: shared-bindings/neopixel_write/__init__.c shared-bindings/pulseio/PulseOut.c #: shared-bindings/terminalio/Terminal.c msgid "Expected a %q" -msgstr "" +msgstr "Diharapkan %q" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/Descriptor.c shared-bindings/_bleio/PacketBuffer.c msgid "Expected a Characteristic" -msgstr "" +msgstr "Diharapkan sebuah Karakteristik" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" -msgstr "" +msgstr "Diharapkan sebuah Layanan" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c msgid "Expected a UUID" -msgstr "" +msgstr "Diharapkan sebuah UUID" #: shared-bindings/_bleio/Adapter.c msgid "Expected an Address" -msgstr "" +msgstr "Diharapkan sebuah Alamat" #: shared-module/_pixelbuf/PixelBuf.c #, c-format msgid "Expected tuple of length %d, got %d" -msgstr "" +msgstr "Diharapkan tuple dengan panjang %d, didapatkan %d" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Extended advertisements with scan response not supported." -msgstr "" +msgstr "Penyebaran yang diperluas dengan respon pindai tidak didukung." #: extmod/ulab/code/fft.c msgid "FFT is defined for ndarrays only" -msgstr "" +msgstr "FFT didefinisikan hanya untuk ndarrays" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." -msgstr "" +msgstr "Gagal mengirim perintah." #: ports/nrf/sd_mutex.c #, fuzzy, c-format @@ -792,15 +799,15 @@ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: internal error" -msgstr "" +msgstr "Gagal terhubung: kesalahan internal" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: timeout" -msgstr "" +msgstr "Gagal terhubung: habis waktu" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" -msgstr "" +msgstr "Gagal mengurai file MP3" #: ports/nrf/sd_mutex.c #, fuzzy, c-format @@ -809,43 +816,43 @@ msgstr "Gagal untuk melepaskan mutex, status: 0x%08lX" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." -msgstr "" +msgstr "Gagal menulis flash internal." #: py/moduerrno.c msgid "File exists" -msgstr "" +msgstr "File sudah ada" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Frequency captured is above capability. Capture Paused." -msgstr "" +msgstr "Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" -msgstr "" +msgstr "Frekuensi harus cocok dengan PWMOut yang ada menggunakan timer ini" #: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c #: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c msgid "Function requires lock" -msgstr "" +msgstr "Fungsinya membutuhkan kunci" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" -msgstr "" +msgstr "Grup sudah digunakan" #: shared-module/displayio/Group.c msgid "Group full" -msgstr "" +msgstr "Grup penuh" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c msgid "Hardware busy, try alternative pins" -msgstr "" +msgstr "Perangkat keras sibuk, coba pin alternatif" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Hardware in use, try alternative pins" -msgstr "" +msgstr "Perangkat keras sedang digunakan, coba pin alternatif" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" @@ -853,43 +860,45 @@ msgstr "operasi I/O pada file tertutup" #: ports/stm/common-hal/busio/I2C.c msgid "I2C Init Error" -msgstr "" +msgstr "Gagal Inisialisasi I2C" #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" -msgstr "" +msgstr "Panjang IV harus %d byte" #: py/persistentcode.c msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" +"File .mpy tidak kompatibel. Perbarui semua file .mpy. Lihat http://adafru.it/" +"mpy-update untuk info lebih lanjut." #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" -msgstr "" +msgstr "Ukuran penyangga salah" #: py/moduerrno.c msgid "Input/output error" -msgstr "" +msgstr "Kesalahan input/output" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" -msgstr "" +msgstr "Otentikasi tidak cukup" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient encryption" -msgstr "" +msgstr "Enkripsi tidak cukup" #: ports/stm/common-hal/busio/UART.c msgid "Internal define error" -msgstr "" +msgstr "Kesalahan definisi internal" #: shared-module/rgbmatrix/RGBMatrix.c #, c-format msgid "Internal error #%d" -msgstr "" +msgstr "Kesalahan internal #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" @@ -902,19 +911,19 @@ msgstr "%q pada tidak valid" #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" -msgstr "" +msgstr "Nilai Unit ADC tidak valid" #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" -msgstr "" +msgstr "File BMP tidak valid" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "Invalid DAC pin supplied" -msgstr "" +msgstr "Pin DAC yang diberikan tidak valid" #: ports/stm/common-hal/busio/I2C.c msgid "Invalid I2C pin selection" -msgstr "" +msgstr "Pilihan pin I2C tidak valid" #: ports/atmel-samd/common-hal/pulseio/PWMOut.c #: ports/cxd56/common-hal/pulseio/PWMOut.c @@ -924,19 +933,19 @@ msgstr "Frekuensi PWM tidak valid" #: ports/stm/common-hal/busio/SPI.c msgid "Invalid SPI pin selection" -msgstr "" +msgstr "Pilihan pin SPI tidak valid" #: ports/stm/common-hal/busio/UART.c msgid "Invalid UART pin selection" -msgstr "" +msgstr "Pilihan pin UART tidak valid" #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" -msgstr "" +msgstr "Argumen tidak valid" #: shared-module/displayio/Bitmap.c msgid "Invalid bits per value" -msgstr "" +msgstr "Bit per nilai tidak valid" #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Invalid buffer size" @@ -944,44 +953,44 @@ msgstr "Ukuran buffer tidak valid" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "Invalid byteorder string" -msgstr "" +msgstr "String byteorder tidak valid" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" +msgstr "Periode penangkapan tidak valid. Kisaran yang valid: 1 - 500" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid channel count" -msgstr "" +msgstr "Jumlah kanal tidak valid" #: shared-bindings/digitalio/DigitalInOut.c msgid "Invalid direction." -msgstr "" +msgstr "Arah tidak valid." #: shared-module/audiocore/WaveFile.c msgid "Invalid file" -msgstr "" +msgstr "File tidak valid" #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" -msgstr "" +msgstr "Ukuran potongan format tidak valid" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Invalid frequency supplied" -msgstr "" +msgstr "Frekuensi yang diberikan tidak valid" #: supervisor/shared/safe_mode.c msgid "Invalid memory access." -msgstr "" +msgstr "Akses memori tidak valid." #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid number of bits" -msgstr "" +msgstr "Jumlah bit tidak valid" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c #: shared-bindings/displayio/FourWire.c msgid "Invalid phase" -msgstr "" +msgstr "Fase tidak valid" #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/touchio/TouchIn.c @@ -1011,44 +1020,44 @@ msgstr "Pin-pin tidak valid" #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Invalid pins for PWMOut" -msgstr "" +msgstr "Pin untuk PWMOut tidak valid" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c #: shared-bindings/displayio/FourWire.c msgid "Invalid polarity" -msgstr "" +msgstr "Polaritas tidak valid" #: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" -msgstr "" +msgstr "Properti tidak valid" #: shared-bindings/microcontroller/__init__.c msgid "Invalid run mode." -msgstr "" +msgstr "Mode operasi tidak valid." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "" +msgstr "security_mode tidak valid" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" -msgstr "" +msgstr "Suara tidak valid" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice count" -msgstr "" +msgstr "Hitungan suara tidak valid" #: shared-module/audiocore/WaveFile.c msgid "Invalid wave file" -msgstr "" +msgstr "File wave tidak valid" #: ports/stm/common-hal/busio/UART.c msgid "Invalid word/bit length" -msgstr "" +msgstr "Panjang kata/bit tidak valid" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" -msgstr "" +msgstr "Panjang kunci harus 16, 24, atau 32 byte" #: py/compile.c msgid "LHS of keyword arg must be an id" @@ -1056,40 +1065,40 @@ msgstr "LHS dari keyword arg harus menjadi sebuah id" #: shared-module/displayio/Group.c msgid "Layer already in a group." -msgstr "" +msgstr "Layer sudah ada dalam grup." #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass." -msgstr "" +msgstr "Layer harus sebuah Grup atau subklas dari TileGrid." #: py/objslice.c msgid "Length must be an int" -msgstr "" +msgstr "Panjang harus berupa int" #: py/objslice.c msgid "Length must be non-negative" -msgstr "" +msgstr "Panjangnya harus non-negatif" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." -msgstr "" +msgstr "Pin MISO gagal inisialisasi." #: shared-module/bitbangio/SPI.c msgid "MOSI pin init failed." -msgstr "" +msgstr "Pin MOSI gagal inisialisasi." #: shared-module/displayio/Shape.c #, c-format msgid "Maximum x value when mirrored is %d" -msgstr "" +msgstr "Nilai x maksimum ketika dicerminkan adalah %d" #: supervisor/shared/safe_mode.c msgid "MicroPython NLR jump failed. Likely memory corruption." -msgstr "" +msgstr "Lompatan NLR MicroPython gagal. Kemungkinan kerusakan memori." #: supervisor/shared/safe_mode.c msgid "MicroPython fatal error." -msgstr "" +msgstr "Kesalahan fatal MicroPython." #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" From cceab2af659b42c9762a50c4e1d8b843850eaf74 Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Tue, 7 Jul 2020 04:23:02 +0000 Subject: [PATCH 149/277] Translated using Weblate (Spanish) Currently translated at 100.0% (778 of 778 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 218 ++++++++++++++++++++++++++------------------------- 1 file changed, 113 insertions(+), 105 deletions(-) diff --git a/locale/es.po b/locale/es.po index 423d673617..2778c53315 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-02 15:29+0200\n" -"PO-Revision-Date: 2020-06-29 13:13+0000\n" +"PO-Revision-Date: 2020-07-07 15:59+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" @@ -69,7 +69,7 @@ msgstr "" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q fallo: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -100,7 +100,7 @@ msgstr "%q debe ser una tupla de longitud 2" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q pin invalid" -msgstr "" +msgstr "pin inválido %q" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -220,7 +220,7 @@ msgstr "'align' requiere 1 argumento" #: py/compile.c msgid "'async for' or 'async with' outside async function" -msgstr "" +msgstr "'async for' o 'async with' fuera de la función async" #: py/compile.c msgid "'await' outside function" @@ -364,6 +364,8 @@ msgstr "Como máximo %d %q se puede especificar (no %d)" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" +"Se intentó asignación del montículo, sin que la VM de MicroPython esté " +"ejecutando." #: main.c msgid "Auto-reload is off.\n" @@ -416,7 +418,7 @@ msgstr "El brillo no se puede ajustar" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "Búfer + compensado muy pequeños %d %d %d" #: shared-module/usb_hid/Device.c #, c-format @@ -441,7 +443,7 @@ msgstr "La longitud del buffer %d es muy grande. Debe ser menor a %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 "El tamaño del búfer debe ser múltiplo de 512" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" @@ -464,7 +466,7 @@ msgstr "Bus pin %d ya está siendo utilizado" #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." -msgstr "Byte buffer debe de ser 16 bytes" +msgstr "Búfer Byte debe de ser 16 bytes." #: shared-bindings/nvm/ByteArray.c msgid "Bytes must be between 0 and 255." @@ -480,7 +482,7 @@ msgstr "Llame a super().__ init __() antes de acceder al objeto nativo." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "" +msgstr "No se puede configurar CCCD en la característica local" #: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" @@ -494,11 +496,13 @@ msgstr "No puede ser pull mientras este en modo de salida" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" -msgstr "No se puede obtener la temperatura." +msgstr "No se puede obtener la temperatura" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" +"No se pueden obtener respuestas de exploración para anuncios extendidos y " +"conectables." #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Cannot output both channels on the same pin" @@ -568,7 +572,7 @@ msgstr "" #: shared-module/bitbangio/SPI.c msgid "Clock pin init failed." -msgstr "Clock pin init fallido" +msgstr "Iniciado de pin de reloj fallido." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" @@ -585,7 +589,7 @@ msgstr "Entrada de columna debe ser digitalio.DigitalInOut" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "Command must be an int between 0 and 255" -msgstr "Command debe estar entre 0 y 255." +msgstr "Command debe ser un int entre 0 y 255" #: shared-bindings/_bleio/Connection.c msgid "" @@ -609,7 +613,7 @@ msgstr "No se pudo inicializar el GNSS" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" -msgstr "" +msgstr "No se pudo inicializar SDCard" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" @@ -663,7 +667,7 @@ msgstr "No se pudo asignar el segundo buffer" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "" +msgstr "Choque contra el HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" @@ -768,16 +772,16 @@ msgstr "No se admiten anuncios extendidos con respuesta de escaneo." #: extmod/ulab/code/fft.c msgid "FFT is defined for ndarrays only" -msgstr "" +msgstr "FFT se define solo para ndarrays" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." msgstr "Fallo enviando comando" #: ports/nrf/sd_mutex.c -#, fuzzy, c-format +#, c-format msgid "Failed to acquire mutex, err 0x%04x" -msgstr "No se puede adquirir el mutex, status: 0x%08lX" +msgstr "No se puede adquirir el mutex, error 0x%04x" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c msgid "Failed to allocate RX buffer" @@ -889,7 +893,7 @@ msgstr "Cifrado insuficiente" #: ports/stm/common-hal/busio/UART.c msgid "Internal define error" -msgstr "" +msgstr "Error interno de definición" #: shared-module/rgbmatrix/RGBMatrix.c #, c-format @@ -898,7 +902,7 @@ msgstr "Error interno #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "%q inválido" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1033,7 +1037,7 @@ msgstr "Modo de ejecución inválido." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "" +msgstr "Modo de seguridad no válido" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1090,7 +1094,7 @@ msgstr "Valor máximo de x cuando se refleja es %d" #: supervisor/shared/safe_mode.c msgid "MicroPython NLR jump failed. Likely memory corruption." -msgstr "" +msgstr "MicroPython NLR jump falló. Probable corrupción de la memoria." #: supervisor/shared/safe_mode.c msgid "MicroPython fatal error." @@ -1115,7 +1119,7 @@ msgstr "Debe proporcionar un pin MISO o MOSI" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" -msgstr "" +msgstr "Debe usar un múltiplo de 6 pines rgb, no %d" #: py/parse.c msgid "Name too long" @@ -1123,7 +1127,7 @@ msgstr "Nombre muy largo" #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" -msgstr "" +msgstr "No hay CCCD para esta característica" #: ports/atmel-samd/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c @@ -1214,7 +1218,7 @@ msgstr "No hay temporizador disponible" #: supervisor/shared/safe_mode.c msgid "Nordic Soft Device failure assertion." -msgstr "" +msgstr "fallo de aserción de dispositivo Nordic Soft." #: ports/nrf/common-hal/_bleio/__init__.c #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -1255,6 +1259,8 @@ msgid "" "Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " "%d bpp given" msgstr "" +"Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " +"más: %d bpp proporcionados" #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." @@ -1325,7 +1331,7 @@ msgstr "Pop de un buffer Ps2 vacio" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" -msgstr "" +msgstr "El búfer de prefijo debe estar en el montículo" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload." @@ -1412,7 +1418,7 @@ msgstr "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n" #: shared-module/sdcardio/SDCard.c msgid "SD card CSD format not supported" -msgstr "" +msgstr "Sin capacidad para formato CSD para tarjeta SD" #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c @@ -1484,7 +1490,7 @@ msgstr "Suministre al menos un pin UART" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" -msgstr "" +msgstr "La entrada del sistema debe ser gnss.SatelliteSystem" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" @@ -1495,6 +1501,8 @@ msgid "" "The CircuitPython heap was corrupted because the stack was too small.\n" "Please increase the stack size if you know how, or if not:" msgstr "" +"El montículo de CircuitPython se dañó porque la pila era demasiado pequeña.\n" +"Aumente el tamaño de la pila si sabe cómo, o si no:" #: supervisor/shared/safe_mode.c msgid "" @@ -1654,7 +1662,7 @@ msgstr "Tipo de uuid nrfx inesperado" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown gatt error: 0x%04x" -msgstr "" +msgstr "Error de gatt desconocido: 0x%04x" #: supervisor/shared/safe_mode.c msgid "Unknown reason." @@ -1729,22 +1737,25 @@ msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" +"WatchDogTimer no se puede desinicializar luego de definirse en modo RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer is not currently running" -msgstr "" +msgstr "WatchDogTimer no se está ejecutando en este momento" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgstr "" +"WatchDogTimer.mode no se puede modificar luego de configurar WatchDogMode." +"RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.timeout must be greater than 0" -msgstr "" +msgstr "WatchDogTimer.timeout debe ser mayor a 0" #: supervisor/shared/safe_mode.c msgid "Watchdog timer expired." -msgstr "" +msgstr "Temporizador de perro guardián expirado." #: py/builtinhelp.c #, c-format @@ -1764,7 +1775,7 @@ msgstr "" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" -msgstr "" +msgstr "Escrituras no admitidas en la característica" #: supervisor/shared/safe_mode.c msgid "You are in safe mode: something unanticipated happened.\n" @@ -2056,7 +2067,7 @@ msgstr "" #: shared-module/sdcardio/SDCard.c msgid "can't set 512 block size" -msgstr "" +msgstr "no se puede definir un tamaño de bloque de 512" #: py/objnamedtuple.c msgid "can't set attribute" @@ -2110,7 +2121,7 @@ msgstr "no se puede reformar el arreglo (forma de entrada/salida incompatible)" #: py/emitnative.c msgid "casting" -msgstr "" +msgstr "convirtiendo tipo" #: shared-bindings/_stage/Text.c msgid "chars buffer too small" @@ -2170,27 +2181,27 @@ msgstr "conversión a objeto" #: extmod/ulab/code/filter.c msgid "convolve arguments must be linear arrays" -msgstr "" +msgstr "los argumentos para convolve deben ser arreglos lineares" #: extmod/ulab/code/filter.c msgid "convolve arguments must be ndarrays" -msgstr "" +msgstr "los argumentos para convolve deben ser ndarrays" #: extmod/ulab/code/filter.c msgid "convolve arguments must not be empty" -msgstr "" +msgstr "los argumentos para convolve no deben estar vacíos" #: extmod/ulab/code/ndarray.c msgid "could not broadast input array from shape" -msgstr "" +msgstr "no se pudo anunciar la matriz de entrada desde la forma" #: extmod/ulab/code/poly.c msgid "could not invert Vandermonde matrix" -msgstr "" +msgstr "no se pudo invertir la matriz de Vandermonde" #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" -msgstr "" +msgstr "no se pudo determinar la versión de la tarjeta SD" #: extmod/ulab/code/approx.c msgid "data must be iterable" @@ -2202,7 +2213,7 @@ msgstr "los datos deben ser de igual tamaño" #: extmod/ulab/code/numerical.c msgid "ddof must be smaller than length of data set" -msgstr "" +msgstr "ddof debe ser menor que la longitud del conjunto de datos" #: py/parsenum.c msgid "decimal numbers not supported" @@ -2233,7 +2244,7 @@ msgstr "la secuencia de actualizacion del dict tiene una longitud incorrecta" #: extmod/ulab/code/numerical.c msgid "diff argument must be an ndarray" -msgstr "" +msgstr "El argumento diff debe ser un ndarray" #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c @@ -2307,23 +2318,23 @@ msgstr "argumento posicional adicional dado" #: py/parse.c msgid "f-string expression part cannot include a '#'" -msgstr "" +msgstr "La parte de expresión f-string no puede incluir un '#'" #: py/parse.c msgid "f-string expression part cannot include a backslash" -msgstr "" +msgstr "La parte de expresión f-string no puede incluir una barra invertida" #: py/parse.c msgid "f-string: empty expression not allowed" -msgstr "" +msgstr "cadena-f: expresión vacía no permitida" #: py/parse.c msgid "f-string: expecting '}'" -msgstr "" +msgstr "f-string: esperando '}'" #: py/parse.c msgid "f-string: single '}' is not allowed" -msgstr "" +msgstr "cadena-f: solo '}' no está permitido" #: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c #: shared-bindings/displayio/OnDiskBitmap.c @@ -2356,11 +2367,11 @@ msgstr "primer argumento para super() debe ser de tipo" #: extmod/ulab/code/ndarray.c msgid "flattening order must be either 'C', or 'F'" -msgstr "" +msgstr "el orden de aplanamiento debe ser 'C' o 'F'" #: extmod/ulab/code/numerical.c msgid "flip argument must be an ndarray" -msgstr "" +msgstr "el argumento invertido debe ser un ndarray" #: py/objint.c msgid "float too big" @@ -2393,7 +2404,7 @@ msgstr "la función tiene múltiples valores para el argumento '%q'" #: extmod/ulab/code/approx.c msgid "function has the same sign at the ends of interval" -msgstr "" +msgstr "la función tiene el mismo signo a extremos del intervalo" #: extmod/ulab/code/compare.c msgid "function is implemented for scalars and ndarrays only" @@ -2531,7 +2542,7 @@ msgstr "Entero requerido" #: extmod/ulab/code/approx.c msgid "interp is defined for 1D arrays of equal length" -msgstr "" +msgstr "interp está definido para arreglos de 1D del mismo tamaño" #: shared-bindings/_bleio/Adapter.c #, c-format @@ -2656,7 +2667,7 @@ msgstr "long int no soportado en esta compilación" #: py/parse.c msgid "malformed f-string" -msgstr "" +msgstr "cadena-f mal formada" #: shared-bindings/_stage/Layer.c msgid "map buffer too small" @@ -2668,17 +2679,17 @@ msgstr "error de dominio matemático" #: extmod/ulab/code/linalg.c msgid "matrix dimensions do not match" -msgstr "" +msgstr "las dimensiones de la matriz no coinciden" #: extmod/ulab/code/linalg.c msgid "matrix is not positive definite" -msgstr "" +msgstr "matrix no es definida positiva" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" -msgstr "" +msgstr "max_length debe ser 0-%d cuando fixed_length es %s" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -2699,7 +2710,7 @@ msgstr "módulo no encontrado" #: extmod/ulab/code/poly.c msgid "more degrees of freedom than data points" -msgstr "" +msgstr "más grados de libertad que los puntos de datos" #: py/compile.c msgid "multiple *x in assignment" @@ -2723,7 +2734,7 @@ msgstr "debe utilizar argumento de palabra clave para la función clave" #: extmod/ulab/code/numerical.c msgid "n must be between 0, and 9" -msgstr "" +msgstr "n debe estar entre 0 y 9" #: py/runtime.c msgid "name '%q' is not defined" @@ -2756,7 +2767,7 @@ msgstr "cuenta de corrimientos negativo" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "" +msgstr "no hay tarjeta SD" #: py/vm.c msgid "no active exception to reraise" @@ -2777,11 +2788,11 @@ msgstr "ningún módulo se llama '%q'" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "no reset pin available" -msgstr "" +msgstr "no hay pin de reinicio disponible" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "" +msgstr "no hay respuesta de la tarjeta SD" #: py/runtime.c msgid "no such attribute" @@ -2789,7 +2800,7 @@ msgstr "no hay tal atributo" #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" -msgstr "" +msgstr "no UUID encontrado en service_uuids_whitelist" #: py/compile.c msgid "non-default argument follows default argument" @@ -2824,11 +2835,11 @@ msgstr "no suficientes argumentos para format string" #: extmod/ulab/code/poly.c msgid "number of arguments must be 2, or 3" -msgstr "" +msgstr "el número de argumentos debe ser 2 o 3" #: extmod/ulab/code/create.c msgid "number of points must be at least 2" -msgstr "" +msgstr "el número de puntos debe ser al menos 2" #: py/obj.c #, c-format @@ -2881,17 +2892,16 @@ msgid "odd-length string" msgstr "string de longitud impar" #: py/objstr.c py/objstrunicode.c -#, fuzzy msgid "offset out of bounds" -msgstr "address fuera de límites" +msgstr "offset fuera de límites" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only bit_depth=16 is supported" -msgstr "" +msgstr "solo se admite bit_depth=16" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only sample_rate=16000 is supported" -msgstr "" +msgstr "solo se admite sample_rate=16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c #: shared-bindings/nvm/ByteArray.c @@ -2901,15 +2911,15 @@ msgstr "solo se admiten segmentos con step=1 (alias None)" #: extmod/ulab/code/compare.c extmod/ulab/code/ndarray.c #: extmod/ulab/code/vectorise.c msgid "operands could not be broadcast together" -msgstr "" +msgstr "los operandos no se pueden transmitir juntos" #: extmod/ulab/code/numerical.c msgid "operation is not implemented on ndarrays" -msgstr "" +msgstr "la operación no está implementada para ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is not supported for given type" -msgstr "" +msgstr "la operación no es compatible para un tipo dado" #: py/modbuiltins.c msgid "ord expects a character" @@ -2958,7 +2968,7 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" #: shared-module/vectorio/Polygon.c msgid "polygon can only be registered in one parent" -msgstr "" +msgstr "el polígono solo se puede registrar en uno de los padres" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -2993,11 +3003,11 @@ msgstr "desbordamiento de cola(queue)" #: py/parse.c msgid "raw f-strings are not implemented" -msgstr "" +msgstr "no está implementado cadenas-f sin procesar" #: extmod/ulab/code/fft.c msgid "real and imaginary parts must be of equal length" -msgstr "" +msgstr "las partes reales e imaginarias deben ser de igual longitud" #: py/builtinimport.c msgid "relative import" @@ -3019,16 +3029,16 @@ msgstr "retorno esperado '%q' pero se obtuvo '%q'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "rgb_pins[%d] duplicates another pin assignment" -msgstr "" +msgstr "rgb_pins[%d] duplica otra asignación de pin" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "rgb_pins[%d] is not on the same port as clock" -msgstr "" +msgstr "rgb_pins[%d] no está en el mismo puerto que el reloj" #: extmod/ulab/code/ndarray.c msgid "right hand side must be an ndarray, or a scalar" -msgstr "" +msgstr "el lado derecho debe ser un ndarray o escalar" #: py/objstr.c msgid "rsplit(None,n)" @@ -3048,7 +3058,7 @@ msgstr "frecuencia de muestreo fuera de rango" #: py/modmicropython.c msgid "schedule stack full" -msgstr "" +msgstr "pila de horario llena" #: lib/utils/pyexec.c py/builtinimport.c msgid "script compilation not supported" @@ -3056,7 +3066,7 @@ msgstr "script de compilación no soportado" #: extmod/ulab/code/ndarray.c msgid "shape must be a 2-tuple" -msgstr "" +msgstr "la forma debe ser una tupla de 2" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -3072,7 +3082,7 @@ msgstr "un solo '}' encontrado en format string" #: extmod/ulab/code/linalg.c msgid "size is defined for ndarrays only" -msgstr "" +msgstr "el tamaño se define solo para ndarrays" #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" @@ -3080,7 +3090,7 @@ msgstr "la longitud de sleep no puede ser negativa" #: extmod/ulab/code/ndarray.c msgid "slice step can't be zero" -msgstr "" +msgstr "el tamaño de la división no puede ser cero" #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" @@ -3096,28 +3106,27 @@ msgstr "reinicio suave\n" #: extmod/ulab/code/numerical.c msgid "sort argument must be an ndarray" -msgstr "" +msgstr "argumento de ordenado debe ser un ndarray" #: extmod/ulab/code/filter.c msgid "sos array must be of shape (n_section, 6)" -msgstr "" +msgstr "el arreglo sos debe de forma (n_section, 6)" #: extmod/ulab/code/filter.c msgid "sos[:, 3] should be all ones" -msgstr "" +msgstr "sos[:, 3] deberían ser todos unos" #: extmod/ulab/code/filter.c msgid "sosfilt requires iterable arguments" -msgstr "" +msgstr "sosfilt requiere argumentos iterables" #: py/objstr.c msgid "start/end indices" msgstr "índices inicio/final" #: shared-bindings/displayio/Shape.c -#, fuzzy msgid "start_x should be an int" -msgstr "y deberia ser un int" +msgstr "start_x deberia ser un int" #: shared-bindings/random/__init__.c msgid "step must be non-zero" @@ -3187,10 +3196,11 @@ msgstr "time.struct_time() toma un sequencio 9" #: ports/nrf/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" +"la duración de tiempo de espera ha excedido la capacidad máxima del valor" #: shared-bindings/busio/UART.c msgid "timeout must be 0.0-100.0 seconds" -msgstr "" +msgstr "el tiempo de espera debe ser 0.0-100.0 segundos" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" @@ -3198,11 +3208,11 @@ msgstr "tiempo muerto debe ser >= 0.0" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "" +msgstr "tiempo de espera agotado esperando por tarjeta v1" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "" +msgstr "tiempo de espera agotado esperando a tarjeta v2" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" @@ -3214,7 +3224,7 @@ msgstr "demasiados argumentos provistos con el formato dado" #: extmod/ulab/code/ndarray.c msgid "too many indices" -msgstr "" +msgstr "demasiados índices" #: py/runtime.c #, c-format @@ -3343,31 +3353,31 @@ msgstr "tipos no soportados para %q: '%s', '%s'" #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" -msgstr "" +msgstr "el valor debe caber en %d byte(s)" #: shared-bindings/displayio/Bitmap.c msgid "value_count must be > 0" -msgstr "" +msgstr "value_count debe ser > 0" #: shared-bindings/watchdog/WatchDogTimer.c msgid "watchdog timeout must be greater than 0" -msgstr "" +msgstr "el tiempo de espera del perro guardián debe ser mayor a 0" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" -msgstr "" +msgstr "la ventana debe ser <= intervalo" #: extmod/ulab/code/linalg.c msgid "wrong argument type" -msgstr "" +msgstr "tipo de argumento incorrecto" #: extmod/ulab/code/ndarray.c msgid "wrong index type" -msgstr "" +msgstr "tipo de índice incorrecto" #: extmod/ulab/code/vectorise.c msgid "wrong input type" -msgstr "" +msgstr "tipo de entrada incorrecta" #: py/objstr.c msgid "wrong number of arguments" @@ -3379,25 +3389,23 @@ msgstr "numero erroneo de valores a descomprimir" #: extmod/ulab/code/ndarray.c msgid "wrong operand type" -msgstr "" +msgstr "tipo de operando incorrecto" #: extmod/ulab/code/vectorise.c msgid "wrong output type" -msgstr "" +msgstr "tipo de salida incorrecta" #: shared-module/displayio/Shape.c -#, fuzzy msgid "x value out of bounds" -msgstr "address fuera de límites" +msgstr "valor x fuera de límites" #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y deberia ser un int" #: shared-module/displayio/Shape.c -#, fuzzy msgid "y value out of bounds" -msgstr "address fuera de límites" +msgstr "valor y fuera de límites" #: py/objrange.c msgid "zero step" @@ -3405,15 +3413,15 @@ msgstr "paso cero" #: extmod/ulab/code/filter.c msgid "zi must be an ndarray" -msgstr "" +msgstr "zi debe ser un ndarray" #: extmod/ulab/code/filter.c msgid "zi must be of float type" -msgstr "" +msgstr "zi debe ser de tipo flotante" #: extmod/ulab/code/filter.c msgid "zi must be of shape (n_section, 2)" -msgstr "" +msgstr "zi debe ser una forma (n_section,2)" #~ msgid "AP required" #~ msgstr "AP requerido" From b5af05cd31988cb89435b724fa8d684ce95d0f34 Mon Sep 17 00:00:00 2001 From: Arudinne Date: Tue, 7 Jul 2020 12:27:23 -0500 Subject: [PATCH 150/277] new file: ports/nrf/boards/raytac_mdbt50q-db-40/board.c new file: ports/nrf/boards/raytac_mdbt50q-db-40/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip new file: ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.h new file: ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk new file: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c --- ports/nrf/boards/raytac_mdbt50q-db-40/board.c | 38 +++++++++ .../6.0.0/pca10056_bootloader_6.0.0_s140.zip | Bin 0 -> 174550 bytes .../raytac_mdbt50q-db-40/mpconfigboard.h | 30 +++++++ .../raytac_mdbt50q-db-40/mpconfigboard.mk | 8 ++ ports/nrf/boards/raytac_mdbt50q-db-40/pins.c | 80 ++++++++++++++++++ 5 files changed, 156 insertions(+) create mode 100644 ports/nrf/boards/raytac_mdbt50q-db-40/board.c create mode 100644 ports/nrf/boards/raytac_mdbt50q-db-40/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip create mode 100644 ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.h create mode 100644 ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk create mode 100644 ports/nrf/boards/raytac_mdbt50q-db-40/pins.c diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip b/ports/nrf/boards/raytac_mdbt50q-db-40/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip new file mode 100644 index 0000000000000000000000000000000000000000..691f4a1ab3cce19e13c954eb71a4d1feff592c27 GIT binary patch literal 174550 zcmb5X3w#vS**|_}c6N7mvq>fwAV4m&2}vdqWP>+UYBvEV31W%2s;%$q##*~*TNm)M z++>4@8!TW08Cqq7v~@zjOs@O?KC=m6e|_KI z=Z~MwoSAdZbDnd~bDs0u&avSdn~=-s-<8hKmOS}!z@LFM{apC1yz}-uzI)-FjrU#8 zUfGqzKaPzj-M?@6QlS`2gvo5f05nRJD+FT8)`$n{QTpKpKNzO+E7wy294 zUop1;ucDqpL&)^(`+Pu*d_LfcaEm3>z5hbSHY~H%H#IIbI3_J3cxSR0<6bR%m33ts zjY;lRZrdi6+skzn_Aq9=>R0R4>(y_nnXmG#oR8~r)UjH&kK4OR&Dsi9#8~rnZj!ePjSqn%fEMj?TNk&<~SK)t!E+)vx+n`@_j|^sFeeu9!{n< zMaJZO{C+2$x-yvJ_>dWyjP>hs#LO)KrdEpO63(_ERwLPYKZju-uLH(`>Hyais-1IU zaG{_+-mz8n2XlsmcOc9R8{-vDL+^AZ_kYc|qE5{*+(UUWNuJWt(`P(f zuW~YHA=|%k(o=EVV1D!?&G!b?_sslA ziE-`dvt~XMcgn!spD!B*lYCq7MGkK<3s__LS+kHe4%9F|XlD!3&zg+6+x-TQH%vnF zF4M<$ne#${X6Gxr%!^stQ-PrLi;Ncc6G61khMCe9?=fZOix3tyUvM&EKv1bo2aBN1 z6l5Mb1nXj!(}w!(R9_!rO4O6OpFMVuS#46$`jE( z#sIVORa3;QT-D>XW@PC&Q_Q#=-DL_afWHpbioYV$@z>2Bs^eb1Ta84S*J0d0)?+eB ztT?9GP`ikzS>{^^uE^dqJsQEzG9|zkIzVf6{LZH6(l3%Bhw(IK{WS0qQJX{UemnLVx<+N#jLrl?G zbQ$L08z}k5IL4+yj$WzqJ81;pAEhy9ulX%-8t+-#Wyc7z7Oq9aSTp8P6_tB3+t{7V z>z0AXR;yQQd#1$D6V?!$iQaJ&z3T_cG=gh;Jo4HeU)PU2Xg1PS){^Vx+DeQ)!}(qj z&sT>D)AvkK`!bag_8d#m7>BeB>Y`O5Gfv)Os*Klx56|S9F9giRB9_(0wGfRguxR8e zi$?qwjntqv&m3P`A3P(f@UUH`#4_9LEnK_U<}eyerr1CQc}xLS=5+Xoe|NDp_U8)K zTs2+g6s9GQdSqYZ3VD8n%@#FfwM}to%9>QpG&#^@^t3gPB<7qjYBzP{s#{G@OUBdb zYIi@EnWjlzw&udkQPr+EHHUH$U^$5MJj#1dCHk5@UUt&YIQ;S=7s(Rff3Ed42bx&< z44wTX7!~_@8@F@WGG=T{I!=mMY0i_i+@?<9WHk>8Wi3tV{SMBrX3Ud}`;zPP_jLxE z_tYFa^83WafY#ScIAm$r-nxYuzC1whwV>BoxG{~F<&~^Fyu{UAp9n=)0(J^UzLDeY4W5sLK$kb zqs8>}{>1b|F57&j*&|Ea`F@W8&g$OVZ_5<5z5PPwRru@7T!+yTJHC^!pM1o_PA`~LycXwKExv&k?Gr6trk~%^ zp7CeV293$Fh<8*FXv6|lRvhe!xIAO#CBi71vr+z+G2M(@EwDt3BW2b#YG+2Lz=VvDCy`&@!B`E3NBfxZU(Sqt#W!EQ>F$*)S2C}Pz2eE_;HvSSKJ!QNnysn`8N+6+hRY&8*{!pE z?WQ~Od4lqUiSJdi5}~o}kN@pU-{;AvtapB*+(q(dc%P=G-Y=G4M31rl=Dw@F1ekAI zc`2BeoXvY(^Q)Abty4`quyI(>B&^L#(Jq_YuIbI;rkBi&NVl26_B8FV+H_8|d70di zsMMDl*`TAP#(XvnE57Ayjh9R*LgV6A>{^=Q(mYB!s4oHtZmT|r9?NUeth68tNPDcb zU7o-4dx_-HdlDp_*;URc9hGA&T&xHOMLE>7@D$HNJ$A36W&sP9$qLcChjdD*u#oTMOjIY@gex8}b*(hRxyJ zrgS^o8z6JNiJk1mIE}kqb8h3-On<{(DgB{=JF3Vckb@w3Nnn^aY1!Pc-{F^p;Wxs6O*G-%r>V&o2>($ms+CuyfvS1ac;W;c)g4D)&|B`NO($aHt zvvcI!<4n#zo+V4iMLFa6!c#VucHAkuj;G7c<2KoTyaz3nsPCO%p-Qyn+|Gfr( z=7@3Uw%wi8Yy83G3pZPMC&#GQf6|=Wo4|Dsf#%1TZdGSQ^VQ92L>-RtFV_Rt{~EHh z>7bq$^UI@|#`ESp)mc`dUa7L5WEdTza@1<8VX=Ch>W6%Ebd zsUu(A852sjn9P?$a)|GGl0)Rp*n=}<7t$VymE5g*F&Cvt2jmP1^+H|gs@n{Gs?eX!NS=2aO?$997p4P8R^~K59~M+4EGc1Y9X@#F#Wz${Wmi>IiTG7jDXUmf zZzsvIk|M=(-$)+4L>Ib~N9|tlePeK(t)cx$P|`G~qF|n#WjE={s)$ub)*518B$QQt z>uow9Ow<0EpxQYW3}qFkWW=X=FVj=dv~j0}tFu2FeA{if&DpU^^vjQ)y)<5-=b%mA zXdjz(9tN+CgBPQJkT1|bmoc2gJMd_aPOIP!PAg`*TP0axLk<4{r}Da8pH}hqAsXo` zMm4M)A9Nh^VT-2u=`ntUGgtx1>k{;=oG!MlF2-gB(bMNf*=#;OxR`Cv3gq{2vzUC^ z+EF}^pk{exwb+P`+tIVOaA2hpJ!-!CGYcm7O1N455bb9eKOIeBN}R7O0G<!pgb~N7>;jv%%=)r<)GlWjzZnx$dcHR%&)^h3PGxIH>oK~J2mt*X z`$CYuh-N(FDVjmcoMP#KE@Kh3y>x2_uup@8-T~RTqc%!B=W*1Tj}hu0OZ9J7?4`&H zrlaEpQ|zb+yNc7~&XZY1>*AHGg?@>f56-+K@`gDStVVer&R(6KH8aWHW*JAf;W* zlr`=aqWjDiHv6R3h&Cm(S*oYnShmcz)BOxHhKAkS2#dN!1X=9&@Irg$Hp%$sa9#{} zbpWdla1)8s-`D@36D~c#c76Ui9R7IZcY1mo>NA8S%JvzC*ng`PgWK&U%m zH?=oq11AesXvuEE>IGB6+-G!b1W&w8mvvsR(l6I*P(HPPDVx!5DBJ4K#+ZN>sTQ?b zvDv#Jh?XzdO!#K=Bze{jUxAvb-R@jV3wGO4?*-FswL~qJ|I0YuHeC2GUtSxTqF=0E ziLpub{J!0w(iWo9jez6S!P9gJ>R`ocu3{R-oMgD2Sh?SYu5qy?%|RQ4GeP>UTyqn!CAPuv1O}wtT>vWx}TFAwD9ZEOz_$%SSLQLlm8e^t*-2g*%Mc) z)tL3WgDxX8`TD1mJbTGRiE}*LWo(CyCdJXe@^5ng8@Z{qd*MW`&@bA&(4L6n3&pWd zCi4p?@+q$*NV)dn=aK8MR(|H$+Qdt*AG3IvJxk{bSkzX$Fwbkz=ws01(zL*umpg+C zH*^Mqw1>Yk90*oNS;dKX2)JZ`FF1@hC-xprmRH=h;@c7VJbAJgP%wr8K6W!;)3OR?hPOVKy8XohODb zLys=O=xpk6s2uDA1cAn!Q)vWgv^NY3OpFshwj2L7%CKtf#-34Gbzlz6u6(TI4At>m zhOu*`L`@d#?W|HORrW->@nq73T%DzUe1fl85VKX-G*;rV^ zIXHKOR-oNjH=0_boY!t_+Pl=yiev2=z!7q!#P@mZ6X9 zIB#{JDezIfJIE?WUp@M=i`|s@Biz7FjuUSwAP7f~-XZUQ=P|5l9>T0C*QaQ^%E%r1Y4do!rRnH~lx2 z#qbxSAzWnBdrk48)Z3zqLOtM|)kKff^NWG!<+N}08BNWFtk`R;ua-c~e@Jq(XK76S z!Phn~L*aPpFtcFHdGiBi&Q?OC`RdaQ{ z?sOH2fr~?bNO1B83GM<=U@<4#b*^{>Zvx(U+6SwjN^r$PiF@i;kZ7G5@0j0#XW@O& z0xRPbSNwg9M6b<$n8xw|(x8&Y_dz9`;<54~HW7JjB5zS6Crd`f`1_!t$r666LrKi^-SG2*Rt8ynJwzo`wDSlpmes8BkIRn2=wR__%hlm2ct7uU;j6H3Y+bF9xWe)c)c<7t~)^_jhoDP_0rwyROel zmDO$8@p8K-_ZX5Oy#l;9o@nE59BhLG2YLF z)OfN0&oUQh2h-~}*LdQ2wH~D1*F0V0h;v<8Mz5J1+=6-K{LXq;&~=Mg>!@?q+ZQ{o zvDN{W!mnN*|7{0o9`q@bPn~|L9ouF6d3aKub{oBKNPt&3mK-b_%`*OLgvKz-XxPii zO->p=de-5Y4L;cGWEy!sGp&_3`R1t;edqGTItg!~T1UO7${jpta~yUBIm5;^)o^jk zYl`|F0edgJm0$jk33jO6vk@@x=TBqTQUBXnGWi4aC9>t4Y--KTTX)@l%ibS`=6)k{ zrU-@OUz4M8636;7JiwY5wQe zIu(y)Ard?e5B@RImz0OHUBbLWd7x*@n0Lm< zOXP>Ll|1Z6nR!lpduYs|(sRR@Z^q?$@Z8{C6CtV&_$SnjD@5Pf4j#rIjdi(YHA$S*%pzO*xW0 zT4ueK;JepK6>75}9h50Ev~u*SLYa!3T;!BOZb%-@v{D|VV86vTCsKB#l(VB&iV>E& zIB1l-rSnTY)C-$@LE`Z`!iV@H^V;PsV}~W{WXYE%$j^8;d|MnM9bScY%FC8d(YpcE zvJ3u0Xs&W9Eg&sQO*OXo($jU&heQ@sJ;vQbc0*2D9?359GC9;N<5xqsbf?FDUPC@V zti@TP{&jN}%YuYQe#B7Eo%x@1{-WmeA+jHn)L~bP)E3CWY!(Y<8GpA*U64?M@E1pU zZBGq}<{U(SjH^durUF+h$AJ`q^3WY@NwjdSsPt)~hF5id=DbC=G9& zNZaCOBC;ytqIRX8q%4Lg4xzYyt9hYZ6WeOeh1b=k+3-UPSj(I`v#!*~8ISkayiDi3 z9Lk4k=UX=XWw7FJ8e>X&9DYhk4mS?eBJ(Db%RB%nrY-scJg-ci-!s1}C)^R^m0T^U z%+$mezNgL#vL}|TvY&h+cUJh$fm&Nm$OfB^q%(GeW3r7;awWz%zVgbc_>oQ;LA$=t z7-v#Qf@Tg033AArXd@bZ9&OC;;l1gGV=rOl3KzqgDx%e0mRWU(k{RmuWKW(_6?@8Sj4bBTYYapLL}=9LJsaqDAH34#3$DS_z;(!CH~^}?*bH|6 zVJU2t;#26sEwQJ}x#)*8PI)U$@|0&--c+BHKit|JQND5{ILEr`X~ z?S%FogV+6C&_g~;g2M!Y4JKFgo|!2{pf~5RT>q_&YsvG{IvQrn5gM zh~jo8P#SiRoCbZ3zgu4G>kh1yyIa>v-TK;I2d6pY?Wo0CF%FnB9y&PJ(i-Gjg#Jv% z85fOiflnm8Kb<89pB!hg9Ne;WdC9#VxR6`(i*nIrY1lS$llf%jMlKY z+?~7a7*e*l6cgow4x^{2>>@R9=ZyC3w&dVmtdZ04i`1Drr?%(f{Z+jG9bveLP zTRxs>-CXSy-`}yWD)y`ykeZ!Vl#={mg5G}PbZLI4^L;s*7h80yp)m^1=ahd>qtIY0 z+hTG7t{ik8>M@r9Z=1}uWpDQyXNHJ>8t7dFHn1+t(=7DAG_b`iL&+OavRrnz<)WlM zN%WKY%H(a9{Q+7Zb}q@dHYtOa$hsiHb0dfMJKMoSlNJ0S zn_h%<=aP*?#M$_Ma&YPB{Fof>9oWxtu*lFpZP#<;V~J95npskHtk($**A9wx2-+4i zGhhQ%97LZo5d)JP{O>WEJF7lJ5Aow00%5Tm&p;qdF(4GTKzspTSRfp6+7G9`P#gq( z@t^%7SYHTM1S#8jaWZZuufC-_u)40B(~p4fw62!B_0>|hye36yn-j22f~v$3q9Eb~ zEyH%>2)Myx7*8p%#moYwX5*LJAhe|!zeDbCtXw^Mr{X?X7vr$=C1KCn8b|xUdI~(E zcX~TU`i)bG92s_?5hmXZ%WJZhmy=)H0y{1%5B-qhc=o7R4X!0R*OqQD_~jg0=!b2) zUo_`MkQ=#5xBawrJ?ETrSm>X{Sj+Q2B;UOkp0i7BobmNhJ7(+Jt1GpvISatIuFzZ8 z%ZAA5>uca=ef(|wrW3jG-z zXS5I7SvsIfaaOuMKiSDc7CLSE^Y_&J;)s1tmL^)Q2(0x%o1Qhtk_N!794xfSK1a|L zRp{vXl<;Tr5NOJQS)MfpORyn~q1TXZ?utOp!ODzSUS8QJha9lRK51UX0xK-*uW@QG z_H)FJq{_?T&TG$=51~BlyW#qxnH3j-6LZG+ym|9(8k?6fHdZr=WO#IR1dq|t;h|CX z>nK^zJ{h&ca^^JJO&!s2Z1p2(%L@;5a`4g-pE^GH`(dAIgT`J3>zia;I@X3!lvvw? zkfq^CrXD&vZupe2HrOP-cSQ(NV1?ayX7otn?I=O(7-jIc;XAyDR10{nc65+6&8T%6 z>fRJK&tleS9PGwJqk&+R%9@p?K+xYD#NSAB8>C9fI1Qg`+x>0pnH90OFPQr*kI7A;#{x|qkF_>!G>cnc^Nj2X zvKAA3_-@r^L78t-fA@gnOKcCUqS;K?X}5ANIGf{PCV7RKZKq)66k0hBFZo6}W9!iT z-Jw+xCp(-xx_p(sjwB2H{y&16S{p;ntq)T<56Z0@>We*TN!Nj}U7x2{>b3e;b+3Mj zPBj9d!)6&f0DchMlCA6OWJnN^e1ek=IL77=69LQ}eG7z)AeHlN)+6M@eQY=@;pm{K zQlpkLF6*%yuZ~PHeVHVk*>$_IYvN5{N@(=B0$sqRO;J9HPsN(vJLI6fw$^Su{YI|* zMWP)Ny9*ZR!*RQ@b%Y1^OpSd@H(SM&-)enfenRfyjMu@h*N@obzk??jw(OpHTW6~-UCT`C9m8EZ+4pIR+fVX+D#V7jUg%~au-$^T6u0+kT{q- zJgqXMNgn}LT5e^P=J?27`8~~5nW;&Y55$-^#b z8_mq#q%1#hz|8MBV9NN-!cXbgn#k63j$L`|l4FULZg@#Int2^9h~E7W6n5Z*%Xi>} zGkbla4IVrigGgd_*;1oGWU~h~yZW<8bWLS6vj7oCd?nH_s}59KsR&r&aebE_7}#LF zcjxya?=7VFtY%sM{J?;a%^T|x{}K-G%ty@b@cec5ei!fTpTd!Se*PNHxW-iO3*%X9 z2JbT;YP&DIy6?WH%qy94|DH9$`+sgu?f4K9NL%COt6v9?#om38Qzd=R>fV8BiO0;r z(x@p>*$AMO9UI-Mvp=6}TeeM4ee?SU5?SbrjJ|Bueui-u`rSOU#-6PStXLL&te|cc zc@(Z4P9Aroq!%SmX#YA#Pn$l;YY5z9dK$_Uqs*VQcddDxfVG+#$CH5-oPIq#puwOY z?|(_Qt~h)=ALYwXexKF4AM+gqe`{Sqvv6((?3e*tHgZ-ifPT18p@_8qK3=|}>$rsa zvrzxJb2v4DMpg&#mo>Lix>;}9VU;UExyL5T^+si@1eNojEtl#C&z0*wz%51jDDYYq zREq0^vax1t-SNfhgSxUhrKOT@^gau65lTLy1<~WSW*MI50Q|;id$Zn@g2-{3F+%@& zJVounD5AWRHy^h+^zEFnf3LFIsa$Kx_eXPlaS8WFmPr@rZeysvcoYN?xD$RIe zNI=|$!1#FZAqFc4Y3Gu0a7b1|(0vA=wdX)n6%k>Z(u0DCWLY*Y7~jF}b{bv{D*eV# zmOMUqJ)+g~VfEyo`P-G!iHNdL&z4Tw-~2<9JF-_ft=Wy4L%|pq_8OU7bH3LwIH`&Y z@m_Al)!<64_bd9Obt}3d!dS$zigw^00!Wd=SL( z{{sDw%G$8M+KnFb2}r-{Ldi_={uk9K+!^Wh8ks3N}HFod|}uQ=wA{l{+D zW?r_S#)qh5%z%c7?=0xEt@&xjLzvNR zPh(V$-VKTM$}z!Mj~YeL1^ZxuLCkezy55SIe~y!*X-4B%hAsy=V+^ubI_y38&fLab zLpGftq#3QFf^qw}k#Lrh#!SBX6u#aGYl}R`sd?w5YsGWYw9+{)cvwR{a&$+&+qfK7 zE_n0}|F0bQb~CI9p<1!)V((3LGNO4nP*vtQ(blZ-hWemdRwckI`L#M&5@g9NExKc% zmh)O;&b-wtmY!~0-fB7}-rKZdeDEeqvl|`!QIbRaoCvFwNA*Kuk&U4dl5}m5L1kGE z5w&eJOBn3+(4R-EofzlmtQhy6zR{+OzUJsJ<^BlifwjD5RzQju8h&D4;NN08{PQ9G zZ2{$d79SrhgoJfmW7}0=)fIVlxeog~Sq)pQNPMZsTPN2St7PLVtMZHEgHh{b$2ejj z1cn{gnXQS%KNc9`da+cDrImGRd{z5vo9eRq(IAoP1DgBk2qlW;i zfdMK>&zn1@AU;xHg<7U67FPg^>wy_$`m!87g%|9*kX_*&h}Xt$2Bz>vSr!DhWkE<` zd*To)`*}Yn&eR?KoZD?Aov=7r{o>Xx7J-?Rwzl)+4Vm`1qd3c#RV5ou!?(mz_?$e1 z@(%UtV}JgdItv<-O<#D*F8?9HWS7yFl)7C;w>1ue{C46tj6iz-G_e%8m1E2Zw`)gf z6zE+lZZNZ8UEnP1f}K&j>HSVb#y>Fpli1hsCKdZZ755I)m=vEkCVx6KKFBanPhdTB z#>&xu!Up>YqVO|~A0d7}5X>}=00&97BhEb#U3_X!R-$!8086SLkJP-}U+8&8?QuGbwFgXTY+0G6p{PHlYgN>oj zEvn2kZc5@rPjG%L)A+u10zvAbcKFfX*ZIuZMU9dD;l@xTOlv~|J(vq~K@AS{`|@OK zcO9O$B_lY$kZIhK40P|iwhf$;#TUe?!bw=%>p`7}P(u_V#cgufX9Rf=(jOCF*lmaI zAt;&JGMvR4AG`-N^;ukA2MrkV4UeAB~v+Y=M zsP%_OM+tpo6C`0KznECtwFREt47C;WgfiCtNGCI>H*0&Gvd7pqBz3ojDL!<3@YIMB zqqLy8^lY5Z$e}YD*o}V&J$@*DJd~QPNvnj6H3u8rI&clkLhx&F=yzZP_#{p+?Aq#?t(Q*09IsCI=2&ZUci^gl0nq)Q^0%{Fh2)O zy9JX6%n)GaTQHv+wgDz_xCnY_D-|(+VT|QnaX;o_IrM7*zJgSwbBLEUp_fLayxo=?e((Yme*9)C{DiaGTxx$)DWIy!h17OW5A z%Mg+2FxpYCFV2D2eu}afw|Euos6NZKb>Z#|y)4$c-tR1YpIP=}s?mWOnCJW1g}>LT z0D~E8hV5#W@^-v+eYNw=_p5@7%#5Pt!NvetLFM~c>7GPZ>1&9FDTa(gk(}d$jxpGT zwPHl3&@MAR$W26$lZV0?&${NBFn0k1&NRwWkIQ&%jJy?sG4wiD!VKwkRx(4Kj+WD2 zCtC#VX_>~>vAk{>Yk&6`SxiGc#8bbxw(_B@NN(rL7GmU~V1^tscrhbaD zp}qvgzxzee(nVl3Mmf91$^HQz!w0BMKIB(ZdyUQFwN8s$jSv29L`1~f2MGnMU@8mZ zFLWLJEoOcAtH45gVE{3d0g^0l9`5U=eqW23CR+bh!Xc*_e@;%=34vjXhYDDA9f>Dl zl~!WogBJ{A%^u8=UxF3<=LwREoj4!Y8h^x`-bzr5AfIGnWjU|_JX?vqNr_rZb-#ePuO(VW%l>A4w1jTXtuC{)M)*7qy+8zb8&^vPOB*R*Z4%hYstu+8I(BUkse9VE!#{>AwfeWrB z-$VnQdn8LG*(B-AoPf3NHf}$m2CW*aD8kuzu~3)g2w3I0?YB;RNCQ z$f(@CC`NSipoP!p*hS?)Yoy+4Jz}-~X~Nd-!_G4Zs%HBHBRup`0__KS%v{V5kBH-` zcv9rCgkQEq)<=poTNkT{x?*^fmRV0;YPX)Ebi#TH(npXd9q`$4ABZ#L2)ug|!A!kV z{HX|d+OrK_+Y#VD~;^=J$BI=01NA zYaEzovsLheootZc1M1rz);>|vaf%|c9jrm<|8IK2&c5spP& zcSE1pnk3i-BZ9HhO!+!J%%P@ZFZwZTuB4T`7*U|ND$rYl(1qKeF~9Pu)I~hZrf{3>`{C1d)W(%YfeH$KGql-b*_kMU-HVg};yW2>8KA>97knp0mz1XBxR! z$KVJ=rvtnsD9$5+uu~BZ?FdU1+!4&$K__zcaJAF%zIWAPr|o_0$nT4wFK8fEPbB#G zZWA9~f9JqEIS)UW6aK0A7Shc2)`L>`EmvLmTLaasE|e3_ccqcXFDDJ@Kf`;*@U60jUjE>Jy~iLdv!(3-B11g%o+_@tZV>?u_tyyj9 z^9kfd&V_Zj$moMM|66EMd*DB_Y2-z-#dG!fu<&PTw150~xc3dpbH?RhwoeJj!CYSu zf7=4yAk~`>f5j~L?J|v@4(Gi=^}UGW`Th_W{Iwa(YKp#Sem5(!YLoeWSl#)tp{1V( z?g-uy`w2{}j#JCB{Gv1uI?#|*e7PD378z{Jvh_Xcfc_`P`T_w!xsyAM-Esg@tz8wv z9>~BGXRe`(dm;M;LQg_3^2JDEBgxG{zFGKNIB)EvR3sdH61FPx3k2Zv_gdC%UZnHXn$p1#C zt<#O-VUl7wISZaL$%_7UZ>RP4RxB_09(d9%_)A>KElb6=wj$$)kc!>L++mwB9de&7 zzGHp0A;B6gb`bSZjpNu~&7}@CvKgm^IyZo8o-qa07d~pfuz|r|YIn8u%VMSyvTO|Z zp1Mq&zwQU`_8XrM+&(bCENKWHQy1hl#G^p(Y`_liG2|3moYOh^4D2i0%-i6L4=Z=c{D1Bpp!q6VFB0@p_o4===d z3)h#9(Om9#2#1}h{gsQq8~7mM$N6SCbU2}}XO>mnx3)71UEjuaG?0~hsS8oPW!eC z9fYIRPOe!9t2wou*zi(gqH(_~fH;9_#4y9^$~A_3tM$<4vpxFq_!OW|=f;Qk3jL2@ z#J7(L=#_Bh)le|-s`&_0Hu&nK`D-u!ZX-q~a%aM(&pP%^*x;s|9d+k<<1{dm2X7w- zc{zD>p49`4^3u;frJl=Sud?F<@_E?e`g+1ze=t=hIr!lic>~O)CEl^Y@?XtcwKHPJ zxdj(|7lOf$_XVWbBRJJldbTI$&rLTXD$n&p=)Z&GOQd44D9yNN*cqx?RUL9A=JQPU z*JPfh#PjQKA32{6pENgOZQ39&t%kfzQoO!if*+NK+%Ci~(w{V2A$wn-9X115-rY}{ z56j}(I|d$Q;(a^T|JFrc@4)zr_fhID@L%!1U&fH;tU2eRmlPR)8de@63RE6Y!ZMzA zGwNdc)EMAva{xaI_~n3q+rNc>+gbRxO~C&l;NNy0{FjCmD=G$dg|x{QT3!6yMVKc# z=WRdP3x`saMVzj~Pnv7lVe?L}U$pnHO09( zM46m%?J%uCyXLi`nMeb&eL$YAu|aiglAcNXnOsAIkR!i(dg(8dN2`x>bb0{VPbgR$ zy5e~9==|fbt}bDv8_nAqO7HR*KTJ~Ovkd=WV0@9M;#92mFbNokdb)@LD@OIVI3gDwG05 zr+pl+QU#p*YZ_0@(#p|En7*@onI!WP%+ou7{x&p-za#|tqXZ%l!M!Kf43$a3XMS$Y zm0GiY&1mX$&N4MM0|&-=0>RC~v!2-n_wf^YU18-O{Ttf1Y+i5WB= zCVjyUTvv~Ah=3~mATlvClVhTw_4}a>%{{xHRqC&r{|Vpz9S+|jE?k4#a>y>99Lyc< z=>E-dXauqg(hiUP{P7VR_H$VFv7a+o;RK6LOMwGt`J0KGVdnb(lcgEVd=>j6Q?&R? z$LU0{0GxalPBZ^6oMhm10dP7uPmV9Oa2i&Il$V`sRpbx#sH~iYTU5?<71|TiURU{w zb(#~=CGHAWT!rU~){Gr%#)ma?Ax3BKvE1_fGB*1jjr@{hgP)Dw{uyqhf=s>LoW{PP z`bAfN9yd0)YZTthW_iQ1;B}@0@oU+v4j$pDto0$;a4=5KBmN9t*!sYB+$iHWWbRsh zM!6f1<65r;xd+k$!M)WQ#hQ`z$2_sN$6DdFNrOMk@e!x2fiy0XG#y^TLC@l+tVwZsdG$=({{d6Pii$POh})>PQoliJ1MsRob_(96iZw1* z43k}f`9jDllrf;(F!~NcVJCCHxC2_t@C_kgBHBE zDNGT*T!nY_H5%FEy(=CLleArJrAUh3V5MfdzJ*&Hyen*w&K+6a6$|lvCkvhgy~8%sSEU}pp{Q{D{JHxOLb+<^zw|dU+g|$imfjI0xVykFuP^HA)8|IC_FkVocgjg zg2KTYS8YTvJB3jt z{rP`Mw84si6PLK7!V@FkD&6>UA*``(=oAfTo$@`g^0Uzh)IT=+Zx$VvjZ9MEIsQpw zSdu)S4oSAAaS#p1&_*+(^>AXEwO009Fa(U!B$P=$M=-cA!3aXz;tumNA`fL+A2g#e zjQhar+SkCAGnRVDofD{O<6E|Tdz`?GkFUE6NT5~7J+Shdmh65o(P))!L}}S7EuSsjc($~>auNIh<4bVLN+o$tW`%|^#>tRS zm}Lop#Pq?~7xgl7$sQ_K6&gAums8g|$XA8K8W~0g*#c(aG^*E!aj!C~^X-~)7unMu zF>hnIZ)Fzwj~OigEG!wBJlQ*7XQ=eV5x?s~tTFzcqeL6%foxvz{e_?e)WR27YgZ~Q zEzIW3oL0m{$e2l1sMGV@&0tf%^e+1{zVz<%IllDn_objyJJ=~;2d7i3tX#w?=7Hh1 zZa=8^AGFh0yZDs20G|`jMA|uV&p{tcht2o1#If}* z&`>(!`ctLs@zNMs{sKuS`*TVPKTrOk8zJ_MIUomQg67TuTB=sY#F}EoRO06-;nXJc z$lJidqa?_?6Q#IIqRR54+?ZSjiv%+=$5PS)+m865ex0ui?Kfvd7B?aux#{`!yv3>W zHBJ_nE9AlD#fR<~;F$P8CG1hSU&l%j7ktY~9Yjiy#0O?UDjFT^OVB+X}C&AMzvD&bE0VzfDRG^VJ2AwvtP4Se&kI?|52u{x@Q4K7UGT@jNWi!<~GQl@O<>e ztrD0MERg>29>pB^8)VSMH` zMsv!wL2pJ>eJHj*#fjQN{p*R#w1paxBS>u_Ic&4!lsecn{VpX0do$)S7@D~)67CBz zIk;R|ZqvaDTM(Dp(iYwZjj4B_m+c?u1 z5*#;HT=Q8qTKrpLp3c0&$tJF@k!=s<^A#LP%4ff|0Y2%ux5NQ`Lg&36_xJFbf>v3u ztbk_wld+0b+hAql{9DZVQV?m_eUV-n?k}>5m?FLthiNQtdq4AO|}SC-nco z1`DoDIP=RD{Nouff5TdH0_Z1UwIZUv7{{z|PQ5{;=cfr_+ZpnBqV5Y5bvsbE33-_l z^*@2s`VMUU5$DD4PmXZ}V;tecg%@ZQ7^sLz5Lufw3DX^bBi@ZODyleIwdHj z;Qgb6yT_#Vl&n7&Q4_o+A29if<2#mrkl3+29rhU7Um8bbX!8({LxTJs)qZ1kw z-NYo|RR8GUT-^u0`@T1dDp3)0+uCzkuOUrdXtc>l+j&9rBjJSlD8v*vSLgVh?89FzYEG0JV z0R#p2waKp`3LxEh-13)qBqa2U${rea;1(Yzyp;zag}{>FP4$vSrfiI2-*ZxOd5F$0 zFlbT*jBkO(vtgO~mM;y_EM$9^VCQ6d>4Qvu7}nTFu`3Cv|I&DCY*KQ`KC9bO-+zV^ z{TYasPB#|AGbYJSL?ER6J;Yrw(qwmsWtVQ;_zIJY?P?)(U77(2Gr&1B50exkhn(kW zQrwei#@B#NN?U_>67kpMSsESu7H(4G!sQiSSPrR`P|qY*lkybV4sHcbDXEt1pslN5 zCnaB&)1jq&W#faxqf#tWr>Ha1{xaZ!J7?v>8AOxL4P6bM5bDXokGyYWmlx5?KaIoZ zis#Tcc_2bPFP>TNPtMQKXq0ou=f|qU#p*R;Q+^)a|2*cLz>;h@3$RXy;*wV{NH=~o z^49_yk!j!(%|p}h>eb{Ev=FEvvFjD&q zsPdd_N^^7gOS&q}1%H^ElCz}W-f?2Y&O!z}h}tS&6Yh~6@^U9ry! z9Bs#f46#d6v7_A%tP2s}mKPJsahDw;JEY2Z zb*#Vr&ME(f7A2pJ=rOcR-3@xY7W(=mJ(hzW*Cos@x*x)cF}VF)i~x38)1o-DXHqsH zZXu@)Qr(AWeThk1Mvz(0qua4KxYjq*8Uay z6yyJjRI>={u(V^n*YLx7Z}#kfTs89kAHm%Zn3pn&?>=B&!Fz;&a!7?R_72<;_6Q)5)j+nS-*aal?usbT9?3Sx8xQP- zcWucNkl`s_3|yDn(J#T)^5QwkKGtG(%at)V{Jxhk_<0dkwa14$Q0gxB(J5aMzC!ln z9Mugf{@yTdf?;IO$csUl4As@@$t z(|dcVb}w%I74y7W>zPm>Ie%t6U*~Y1lvmvGX?n+*$ogDOgq?%#p~!?5ikkt!Dcs0u zS`SJ0OeAERZv!6(A3}SX__>ur$XYO60MpROAunoTa>2bstLJDad zfae|SB8aH&pW=J!1S5Ta8{gZ*`(cgXa4QPk9pgmor5DkxG6x@6xEfDysM;xL?P0RP zY?1v4?>^!`#mTV|;}jdomXwH7kDW=bPn~$>PI2Cf2mq32JDg*AOmjlQ zgvXRpDUT_oQXW%E&2rs2Ammu(kh&Tv7LK?A1DlYliizMLT%7b|4tg^DgYe?!z<*j3 zz5yOD-f-F+dN%b*dvoAT8#L*X#jx%0{Nj+`>N~IX4!p^5MiZqGp#d$C1B|zkZ|P%8 zpX^9y8`Nyvu&Ss9xakjP7uMK!aTSP5Qg3Mt^>9VQ*(;L7Gv6{m>>qlW^-j zW(DhOa?G}a@(Nko3iO33O^CNn*xMY&2iU_NgYS3E_#-4U)#l?y9#{BdQ*Hrg#)uJT zpj#&MVuxc{bfV)?e$J$f?C8&BIAt^jD+}XsOC#MkX*2ekzrnlM{X+hN0E51oBmXU7 zyqXKR!u4BXtRy$a&vuawxWu8Sul*-t=1L9D&XuI!=fzFyHluXkj0oMh{_k#xv>6n0 zIC(>)3wIo!yCKqLJU8;?8zPf~Zz00+{2L;vhnsK%`NtT;+EQ^2G zMY|-qJ)R84WJgC3n$`$3t|4e(gNbx#;WkK3bjO{r4Kv9tJlkFW zbY-12B72=VyGwiO>%aBzD^EVd+Hk{z40(z?=hdNIkdU#n47KY5q+FNroiVIhP@A(q zm-FMSm~HguZ{#2czOvD$Cd%A2QAS5>7sDv;X#zK8oKra5>);Q!M)x$?b-J0_?|2Ar zW)s~qNw)=3jP18Z`LdPzF{&w{jO21;9(F<=all&W)^Sg!g~cq$VuVF&)M(<%-b4Lq z6FJk);l~`t_Td)%pAq=DzKS{O4$oi9myv8f|2}Gw=~wBKttz9JPt+eA<<_z}h^KJu zAMkUH%el2)gXg&W5@_wy1YgFXecq6Vyc6Y*;%p#J?6uIn^UyAfDb|rUs)m%cGFnpZ zOV`<)-=OY0sLN1yWN@R&=JevruOK5+6v=4QRb3wD(m3@V+_nswG}6Xp-1PIv=vBC5 z?J8K%_mCsDn|S8<;L7oa?q?A-B~N@Mo;p4lgk)?(dCCb`Is09$md0<@mYOZg zKcxk!*#S$Z6=z8|>C;|E=R8}n_gsa&Cl?Y&x_aGbB(vNfBkB9Lp)kDRBrm0?Yv#BV zBbj5~CpRLJD&1Hz5#>+T2>Sjc;>$?39=+XzXc$h|{#Cn$Jb#)T7ih;}r~vFpp7WpC{TfKE*?jx5_Y-6nCoIq5b{Bd@ zJ&(bEKzL1JIuEUUKYkWVoWc5zF8q(UJ~Q0j{4#FmT&f47BZC`~PQW6ln?`Uy3FzN} zUvNz?cH-;GbIUmNE4ysTZfdUqvAxuavgTH-$VZ1Sga=_q!BAqnzOA{wxv9n;zp>m= z_EXE2FY7myr=bPHQpbsrR2w&rkk9g_auIW6#8dYFuVe1mY}1-C+zgMqSP+E*Ki9w7 z|3{y@*(&)rt7LF>>+*jltXmtID^|VGRY149(@nO2UW^#F<&*c>x{S+)=sw#&e(65j zl>SN)lDAnBMbQYwZ?uMk_dOr>;>;~))F2ACt*Ni6IBEw+qkHkz58(!W*fktR_Q-Vb zDI0>|rr>ZrWC(l0Fja$1zU7M|Y4@Yo1#LjXx z1wP>NLmqg5S}Y5rhmpTp0;k2!!*0a)U5KBRgDEZ84IEt9R6kLN>T@ zh*`Sn3HZmaL%g!s2Ht?(hC`f0iA+(U-@^WM@#qKGEB{1$;L=XqO#QIhY@HEl08hJN z+=-qv0P@YltPHpE{sikNyz5${&8ue;R?g)W*Id?*vZKK`1#)_;V=ueD%r_TAZ zBk=JFd$zTEBX$G(oeV6ho&pxPqV_#OyHN{UFK%_c5HY|P=4!%)(S|BYaErpbu#o;UtH7)I- z^+s`X!^>uhx}`d|6mg~~WX(gyYztyq4`2Z5{ZDp94LC&J(i9DDWf! zDr%dj0qd>P(veE+8KhoII6>XWuR=Lj2=U_vpIdtepANK+w^Qq~I!(LLk`QWevSRmV zrlJWQOf3Z3yG6SWwOkwfu;zMMEWZ_z_j~k3Y+MIqgtqr}GhTLR<*ga4hldHP%81Pe)80_dO2g3k|U)+3c$!Xss3f>XVg)>dvtrofj0??$Ui(rvOJ-im`SpT`^AD>Za@O$@2ZoJns ztg_v1(6*KM#+tV1cjB`b|KG)EylG^Xo#$7f&6*$OnxYxdU++!LKGj%ba*E|#<98#h zwM^;J>zEJkWh{*M?=UE`rF?j8aU~nWljTh8bV#z0x6LYW2Y@ds)tQWM7%$9G7P}Sr z=^n&<=gctg7CZByDfu}(=B?5-C+$+rNpmO0K)R_06v(L*@@=fxDVsWYtYkr(hjoxd zrl!kIUSA`YkBb}(E>MIwuZg+gQzkBs zLxsk7IFQwbxIDTW9wzt{G17uWnOnwfdls6p+->BILV1L)z?_uB1CDH`uzcXZMJ%H; z{of)+d0z-0rwpsu)|T6m-Imjl(S~S@IvzXbZdfQXV?E&AJprbQD&a?m0&a&IC_$?y zK(4qe@Is(RuVI87pIDYx8-nB_F3Nkt*0fXR5Dmk_!(Eh$!DJXZuDO z-(yzTPdUj6f8ZL1ed4G6ut&c}*`oi1_F|@G>lS^LdyoF(@E+agc64&;dhmS{wi2Zt zk2$_C#Y*POm&n;KS&POaOM;-?oAO6&uJ6aT?fu2xJ^Gz>d-NZAo`vrcR=j)4%be@Z z=shZp&h)*U>t^(;+vg+X^bjBL{u*EM)% zhTYj7sJtSUBRw9!0{qKmR1OP&F5Pa5Vue6CHaGS==qITZMDfSCS&&a>36bX_^jsm; zwtK8LiE1NxE?w6zQmmVYKk5x~CPvzWQvo(+L|pcEYzRNX4@mM8Qv5Z zI`cY;3T&Di@f;@UdQebM=VDgyMi+W36}1}_(mk!if?YN+YVYQYHtJ@?x7?Dv9G3q~ z*Z8J`0Y8!`^Ips7Bn*_u=%IbqSKb*LvwY)4z zUe(&Z)H1WYAza>sh_Z`kqZMnzyxY`C_iYEy@&%~Wg|p6v^CjCjtAwb8vu?f-Q*bga zwFL&-Em@g5}88W75 z@a>0?hn{oVqHc<=;gGqD)`r2~I)@TD6dAGXsW3P#TNZ1GOmkuj3jetcZ z9)2-=n3)0#at58G#F^39)AyORB;|`$;Dzn56J!y(SB|tgE@2GaY+|ROP1?Fdwie}d zuE4JQKGytJ?6f*o*G*$&jd>s1+vNkgeTT6YY_K`pWZ)~M9I5x-9Pva zLh^R5RK)x zWLndbQYQZ;z9_QoT3hhx)*X;rfG_|#yWkXg=eAvEF2-IhyQ6hUWLN8E#CdJ46pqmy z7MuYVL%Ouv8S?dUIGe9a$QHHBp35@29EYff{)z zv5@>BMO&0S9*SJ0*!eZs`Iin`jh#<(2rbzLL+1#JHwxWl+1Re9=z1;Q0c$p|PSPC6 z4;OA)SkMcds~Ri^jmaF#|MyR5cRz?<>X(9SrfYBLGj4*_nL8){5aGX?w9Jg`%!17E z1@_F$0{msdK0iA*CdzNdx!J?;(VlH(>RAh${rTT5YUuOcRnuql$JSoK&;Io2+g*s% zPS!=*;hheS&ob0n42^RQR^{1|U67War}b11bH5;V3~;dK{nGG1I3C|qxVy_~td3_# z%5~lmth_C@r>mrPKdjBcRyUk)IBEKjqU%;J`e-Xtm&pQF6VbC5hsd%)6zS!?k}Rt3 zpxt%V(Qg)%RXqZPiA9G(Q}|$I^|`+90IT6yct7*jWk=TUHTPS@Zx-xFq~ohy_Bk_; z?wGQ>viRtJok?3Or^k9N(h-b6C!M9X-8-k$!1iHfxN2ubD-eB1bYiZWsS3avBx*W& zNQt8?@JTN4NqjU@^2gz6fnTT<7PS{qNkqr|*xfn-z>m-q8-_dwguTRjToH6uxu#?kY^*Hn>(L7(N$2O_cjFU%>P}0a_7JYw@jEO4 z^!$&8h%bB&mJICeDps(*%YqTwHzRBeQaT5ZKNDnEWo8alqIbP zf7u*QYsLlbr^B4=n!+it6G2Y;nSmaWseRMvyS*n^17CRjPJAHcJAuCj>>&>A9?1S_ zOUMPS6sSjC8TR^BqczYJ6uHJ@my_S<)!;Aae5YMbmI^})#-L5oGIXMtA6)55JlZ!>VN`b#Q=$EHDlp ziw+H^HMH~dA{?x3sgHhk!h$*kXrmiXAevVZ{SzQ}0UguemXtC?g!?8IO##O!GKaQS zXWFwPm)Dp*M$`gg{*SiR7Fc8_eCYEK!Eg-g+p3)f_e?wh){l6Z=LK*F&ao>Wj$OIm z_;npJWKrg=%xL<#zl=rZ{MPdpo*|3i+t6+e5k0ENlWPl53qR$0baW=Yh>BTkY&C+n1L%N%ooThuD7+An^O&j4vT1+7{)@JI{} z5Qshd)BFMHjRfS+;GLa3j&m%QN3Lo`JVnAF%n2XIfK~$)Fr|hvc#>d9*elyNhCHcn+EYE@Qw1J%x#T z*FodUwtD4U)LW1|e*x2PLFvm^?T zw{`p0bgi*hy#eGF(O0%v=`urWn!azr-C`AkPo@`=Ms|v|8_zJ-ws*~EYZ}*>BTTZA zEqD8ucU_TUv#yl8}V2*Lqc(L|d`ytvq{d?ty2KMPVqhL?2E}7;dkD zjSKm@^u&8cZ0`43F}Vl7S@u?}%i$=k2uxYA^G605}SYg}7^EhN<>j zK>@M15N8#sG)L12=%2^PR+rdkH6p<6dsB&cN|1j&AXy~XfrR-}z$00-oH=tQO@-FC zZ8SU5;D=7b>7KgNuXKr3DVKOO1Vn{Ukax{E1aG!ro=XA_K(a?#qekkHwNUTdiTBU@ zb~drn&!Wfi{-3DZWj^+=_>4<3W73)$+_mhBVIT0(j_!nP!5xF9qUWw|$(2^^+Ur%l!D_ z33gzAh5Q}947{KAS%4J9=X4+n{<=cmE=Ac)o3=n&uwd4#;*xm_ z7L-!r$V+lq8FYiD4+>pQXs>)ruPD!OIgEQJP0N`^e^%5;K1F75&UB)seT}m58~Gi< zuWTv&8kbJMi~NtsHwowrerP3NtNs|7VeRhM;^X#le)4|a0^X@&>>H4~;A`Z@Z#;fW ze>35?R&fhtmI~ujum_+ewb&2h-D)TODC`}e$sZ1-5|5?EVa4mqKGO9TM5oT2u5uF7 zu7=kFvUw#1prS36kK%r-)-~+)knPUv6||qgYr=&ydj&E&F>U^+)a@>6@b1SM@!s$g zgJ(Fi>mPsTLD7U!E4+7KROxEEl-~`1M%;E$y5xj%U!)}{uu`V&Y-^gFLzIhelw?XO+`lYaVuX{_{# zqvWMtgOwtK*ZK!E>2`1(DOWAzai+aF0u*In6E%Z-wgS2EJ?J&5&wt0KRcjf79Mi`6 zP=~!v-i>!ovnA0ge18+y4aFbG$l3rFzQYCtK^t)lxtK6j8qg z-YL1LhiN^AP4tPuvm9ct{y{z9uoIctEdb3Y)*~ zeDNz3S#ClPR=#H6x9K|7BYLI!S3Wyt=e5dFLL=FL94S@hoNs*%=X_NAr{p;?C&ngFlS_CM(gy@bXserz6!6?qj(XU+xyDXAqwzd~U{PR+O%D9=ckAcfhdVeY5?bhga=R z8?tpC*4to%q355#Cq3VePkR0td}c(yqqpU_urs|LXo);3cBl{dIiww+=lAqnU&ESG zCw%*^y-xL)?KSAX-MxmvvLjWs4HErlACRXcE5XSyc7>a=6(@tcFo1V>+JR4yd^jOu zCB6{;3;Ar?iII~&ANWsS&s7*RlhdjV3?n}o=43iB4~@A02C{Oc@D%i6yD2`GA#U4) zHGx>BA|94Krr}h>|D>HKj(}EkMIr6ve;<+>xb3772FF-WUKWBJf)8_+oGLfUn@b!d z>QA(dGlOx-t6&&o({twUmNWuN9TwXyXdiVk8 z;yVxrr239vsCg#J(JF3@uiFP)-7)V{9va(Jq7<=yq`O6?Kp>j4I*Oc!-UEE>9;{l* zCQRSVhEEfrnOU?SLYkseZXKPg;ABT0C!Y_Bp(C7o;yx*^c$yJmk%$9;9vJPZ#E(Zp zYwFjCRU}2*quczBH+X z4ZaMeUUwDQSzrBJxq4Ec%R^5;f*9NEs4y^rp#(^cCX@pFeYDVHVEWweq4+7BVJPD? zvIW0rTr>BJ9BQ$bdLYF$cGAvwQaon4{H!tBX8GNkJm@YE&zA00K*TQDXvpJ<_?y?e zj9zggp29*P<8X6}VrBlMYx+?aypH4XT>}!E?h=lwU01+^kjB31#I6Ci@f$^P(Jwfg zf46HOgx}0ZnG~99ite0ifgJiye1UNiG(7NTe1SKkNH693HbJhp%Ln53JY<5F3K`2{ z_iXyxH=gO*TzT$j>B?8A#bcTloA!fL4N&`Ru#366FL1)O)p%Yii*Ks||7WWz3-}x0 z^`*$Hzha`e@bciLG6NOBhyz>59G#`U2rZ=`R731Mf!2QB zkk~I+FO{Fd9;=nzjt#WeWb5bWA7EMmklV^J_T}JLn8pvyi)2A&qB33bzfXDmt8PFk zAVkH`rDXvJ@f(;ciUgt)9Ue{Bnr+nj7bCLZk8uv8$j{|s7U>}TIA0&zXM;z-EPwxN7Ht!`0LpoNUpdnhJlf*Nm)J(HeVMFZd^-TVw||6Q87#UkwADGo#;Z9uMp$ zSDEA~2XFo+@=ke?v63N=5^$>fk=Gfc)KkMs=E}0)3T``<_*cs9ztiEW`a{==uHROE zj^5pCP!l7QDdLr_a+%klaQvm7i3fgD^DX2^oq-JTUs7Gl4plqFs$NHU_%p4y zi@bJ6Znwyf)6N$+!MmkOZqvE8BBQ-ejPclBe}i0J^+yA_S<;(j&hT8hOgBMaY-Tsg ztRT=uQadY9x**l+ccYgiBcABGuKMq>u|Baf4@H%+D3dCo8MVR_cY#-|D)T_2`^)=k zs}_ijIFsQ0?Zfx?{D@5ObN!XM;sQtkQ4ahu@zW%$A?vGu5@<{gfFA9Nr!Yqr4Ee6U zW;UU{VvWJmS2r&xaVj-W zJSu7;fM#vLVlJDi6hcGv_wmxxr>?7UBBg?}iMtQ@ucv4qh^YSu$TY7lWwSog?K`iM zuavvx#fIdKY*?7~N@_0U;l#Ofg7$zL^qQh2$!dli_lP#| zcvnPhK(~#;MgUA_UUGe$bop zp0CPXJr#^if0?oG!!GpF435>e>ZRF7C3r*GfER}{cv}rO+Yb~*oBAjY3pWAu7x4f3(*mpe=F=GLC_vfb0EK(*dJt$q9(||y(~N5yLm;V0+B_W zHhGkj{a)sWrL0)Md7Gu4-rO;EEyuVf7Q1m(K*W$m`~7Hn#Nu?W`e7gne=)*H&rn_d z42+6E*3N*}t9lSM>`R}`oOa|jtMNN|I}mO-@m_8(huL%#@%;z6s(cA;7#(p(n9~=$ z3;qnAbJHuV5^VRw8It6?6g0csIOn$+B~VNin*oKCe=>5vuQ#niS#O#S-F7#;g|>_# z`u$W%TjWxSKcqO~qyjYCp~_R>4-ztB{}B!4#cQu@wwN8O;wF6cp~ z;uP@#N8c5o$b8>E6F4nL$p?P;D8J7770WGNq5o~mrB##tlOy9dZiI$__~iAKno)v= zwS)U-p7f7P-*3IcYw7=^^;=cb{f`3K{8s`5!!?^)MjYa@hHZ8KRx+CoAoj z{~`O?#s6qLEtp@se*n82oEkJYbN!B4cRDmb^_Dv-O?|5i{o{OID@Ixb5{(n{8eA$y z=KAi7yFi0a$K05!dod;x<;);g^t^jQr8PETNv6UT+lsgXc#(}z9$eD(2g0Hs(FG6g zKz^)ovfDcMFxL*B`7tiqI$#zhdHPUrz@j~*r!@`|=I(BsOK%Uc_K(U&i$(kK zFz0VLXW{Na3>$})l74EJk)?!dH)&^57U-+Eb+r!e0l~0flN>%yrkbsgGH4ZIT(^9r z|Mp>4k`GG~V`2D-l%wp=lU769kuhNA%H`HBi*^}WV~>`PwM9W&m=oR#O2B8<*6XBm z18yL5B8Hkufe+KbOzT2@;dGp0LzcnZvl*bokc@&{vHNTWY<{+)MFmt-;fTd&Q7?sN zdLg0*XR=h{wv^2o1n*0yw*F{x3?GqyDXWNbPCpB-V`h}!?)8r^viTH8jZZAPMnPnG zFsOKf?q2@A&$u`je@J816bI&e1}q?b$fjMY+v zc(<2waqr!zWqg!>dV&Nm6<>#cg^!n3D9i#dvZdh#7Mlt>dW0=`q=yyxaTt zT9KH0`-K zW=qko|I+P>#fZ^0W87$*ZZcX#^&W)(tXWy>Lry)6R(hH@~d_<~d-ISTu9le?70%8T}$ThJ|mGpJ)AVu&n$F ztSAmB5gZV^-vpW>QFe+2wP>FXS!E@7e3N^s(#1*wdw0vuP0+(0713uNtIO&%wWktS zB%vyZ{to;J&cYr0gM5iy*(86wX_2?HADIw_lp$M{37%9It!(tu0=DC3`P(wvW&zf$ zx~Z;8=~7#|gTYEfNtK9dDy}%-w_#Jd-i1Xm zsPU3_1pR7{5lu{=KA?%n(FQzztfx|WePcQjbK?f&K0APafOfW~oL&mZ>HVu^_YtX~qLeL+e3BqYrm`bU0!l7==7 z6M1z<0%S{S1yz|O*9D1M$A?;E(%rdT*@xUxmRiP`^oL(E)`!<|yax9(b`mdlIiZVk zur+hqKY?=h^Qf(VBY2j7K)*m-OP0Ya#Bt?;7_8*%_{L!6;-foTV|#0=e*$~+a^uP0 z=+4bK`JPQR-GpecvTr{)Z%<1-?wxs*pV`@Op;bD#KluD6Wh!$`{IFIIRI|T}a!Z#t z*x=>2F7n!{Fgur8pnd!h{>)z#u&3FR0uT>&ZsKq*DP5tK`c1(~>oIT86uwcunYfc> zoOW#gbl_QJFxM*Tt2gjB(Az(pF>{_x9RZ4(sMFK!`+?5M=n=Rr;3fs#C*i>5rV^{M>L*7@ZbU>6sGxo9dog~ujeY+!G+k!nJ4pn) zPo^zNbnXYJW`40$j2*+Q_3k6b3Vj68>cApb}PNGF^BXlWhKrl<3tk0BB%PI zpZe&ARf*2uxkY|s48$V&7CPst#QRa=yC~6$vxUl|(?xVXth}vY_2vu3HY1KRm2eJk zKn?#q^`f6I0nX_B325Q$f~}zF>6R@=IWM3b&dJYDmsG7hqEJprOUYSa?Bmo7asiYH z`XwSNw@yBMam@^2ZLtB7Pp^;rFfJOR*EnGLY-@T9efuu*&_2vfH#mLRkTb=83zs`A z41gM~;?Ew;fL@K8G;GNoT!yPt-OwLg8Jhup)k*(WQ1u)9AH{EmY$5=43|2W%+nX_u zQ?P^*q-BQq3?|la^u@Qa2D~Oj1ykNc83vSTkeI(%PdB@Knm%|ncujRCTf;sO3Z-7%% zYacN|PO%_QEp)wD|KvrON;H5no1@YN>=H;b;NguN7CBkTggz`VYxJiIWy-Q>c|?t3 zi0uxiC9Mh0!NlP2Qy<-aR%AkS|9};!K9tQV6_EV1;hjNIluRPMb{d_9&KA;b6S_V0 zAF#21Iuwt;eGV%V{F$TJ<0T$Vxs7o1L{Np)M@Qq}uG^NKcP~MCSm);Cf5**X`c4|% zRN@S23~pz$!n&=k4SpR0Y|Y&R?i>#12d8$D1{j=%YfW#V=(@+SCT5$bNGra%cIYss!na3m4)BG7bPUYT6Hy^duH#2 zr$E`Ag0?Bu0lC8isl>PSZ>aarvd#QggrXkjsXv2F`?Uy41|=6w)^`YB zt4MtSrQI3%dTDop3VES34UCRg9qN6E^ZPSw;Z)D}aE1AMEtVs6eY0-w_6GIDv?STm z=SF5JyL3z24;6|RWYR0A=vVSdp~z%-UxA8J8JB@l*yh>{y_aD8Wn^Sn&BZ3wQjA<* zAF*QW;Gd;El#rWpa5nTBX=_TVyevxVM;=>066~LU0!^3%FY&uEBZ77cD5)lASQp&n zEzVGr08OlWu5idb!>qD33i#>r9{1v1@U4TUaMTTyT;j2=GWNau7Gzh6a=3%eeatI- z-&@1(phe3blM^kwUD%tj_KjGcWzz#)(3f3uPjDk*Ce3qzcQ~gYYMC?1$VZY&#DoNCYlQ`oEDx?Z~HbPq4J$4)0LnosoDvPxct2yemnR8n$1>0eA_eaOOR%2&Obge=T%Estq*S)cq zk7r$SH>?!U$pF3gE}##Jz!Ud2g?;3|WoE8cptUnE-fgS{?^*0L-p8>iYS`aa`Aa;> zS)Vy#xnxI-c2b$o1FurjdC*?&8loLVJ4tM#a%`}{7l9)iOjHdv$HhyO*d?v|uqWJ? zq<6xvu@jUo1!pmx7F8qS-bOF!dFEo|ds)UUwbh@*k~P-d(KEdL{WDfzcu~}rsHKE0 zdSRU>xBx49`v{HPBK1{uqPiFv3Qws6HFP?r??+6ZkDfu^kv0!J#pwxUWHH+EYRrqa zh>DvsvP0wRF5l2a90$`F&ih|SadPvGUK^wiv5MbVS^ZoL@yw-9$K3vgreNh$vB9n) z+?`CEOHPW90}j{wh#Y($5rpYBz7ua~{ZH#Ac^~4@=&s7tO9O7s4I55|bdB0QkOv+o z52KJNEm7U@Jb^CeVr}pRC^e1M(}^6=mqH?<3|~0MU2~$KNzfYE`rl-HKSP#xNbJ(x zO`zM7&pW%--MSy1R^{@%ji%z_RnIra0~FJo)pl1iX)^u8oh~#4&5Fm z`n7U+?_f)o@YMmZ3c`=-Oy)JKf6KeBM_sjz9~>-iF*5LR$@bI6UMD zSlitZ_%1w6HP#w4?Ha!P)PBrGA?Cu-XNIPawR#(kV{LEM{$eSXD2^N?WOi*C0C9?fT`{R*`}yPD8GJB6e@< ze(WfhAuS1go*-EVnU+7Son-SKj$&po()3#@!3~ON74d^R(1RBOvv69IMuBMN)3D&u z8A%=q@G%+7a&!TAYdW%(xx5}6!=ZXQN7JVs=>RW0|KOL;e+B>O!t;nc?|z|~EYcUA zB-%Gl-WpC*?Au15R|Y+OhCD$epj)(26j>RwwefAHHgg+Ug5VjPk#_(br3!@WPF7^r z4yK+(^cmCE3ATA8CwitpPgcl1VEk&yIx<_%>a=#iS2)S357qH(iY~yvAOr6|EBvDC zAHWV<$cCFarN65pydb1|=NqgbsnC(j%~wpWa-1QPS=lE5i?I=z^R{))LCB`qwc@ zduXh^-5Bq!)ZV4pGG)C97;F2x7g`MN_63~jk8~}LTpuY%s~4r}U@HPwydgan9`8F5 zk``yE%fc%2v%<`ozE6~rM(wp^;t6DYs%XuHt>;6`9{JD{ov`maxVhOM>3<`~eC(ic z^)Fw$3W?OPW(eBtIs=9USJdp@y2Po#1OK;tf3x72c^#}We-Nz2cieQX*U{vjYl=-Z z>JxehugSjeKj-WUI9v0oR}-*%*E%YEZnB2P5{ZmqHkZX#zG}z0puxAQrkg7{=}RR} zrV+KM6C5AXwX-_;0-|J!7P8Y@v)_39_rc?`{i$MCZ8z#k@&_;`rTqf&i6 z|ENLlV7GxEVB zdhhdphu-krB^5xe<&e#k{v&iG%F)DB>Gi|98H(f~(DMYm3g{c5F$yud&pCGATe`TH zYTT|{*>$onQs(zyY*yfu61B|XpK7dPa)d09oQijDQe;*m$?g~n`n(-z-234%W}G<~ z`^sfns_YG2L;{mHbe8*uZpJGMFMDqDb@jeP;?g1bFTm5;<4bFKR$!MVm;JnkdDmX^ z^I8$T+-&9B4(lR^l{}NFZ02Eo1_#eWDFE+2hw-fi-z4K3hdUW(k3hdIawZq`|jvF*Vn(pejm&StQ(vzd%6P^@HT1S7JX!-~3O zkUWaaQRHx6o`L^o4U)$I{qI_Bk2i6p{4wVm z(7aVYi8vdw)Wr2KV_<2;N6%DZebR4ANN*FMXr{==R&7E?t^g=2{o&pRAOK> zk;oY=j|jEYo-6BL05;y*`kr_RG$hih?l?WWOjDg$0l*bkIK24sYn7rFoy|Cio`LG^ z;}IjWu-2q<{k^7XO>-h{Al>PQkaZl{*`@=b zewjOC(sgDdclTuAF~Vxh_$F?)7^`e*Y1#oxb!Ag?Lc#* zpoCZXb^1*tSVT)c?U3xt-htr5B33R@iAo3 zQ(8p@GST;ZS7_wyr0=90Kt4FLf2Anf zZ98f*v-bPwlfx&&_2vg}L`fMDH|okWN(M$a-+W)%H)tH%%K4v^$!^RIT>nMtM(!-1 zvC@l{KA0Q4xtfn<;2aH#H4olRY=Lq>l{PL2_7+TsHLaq$ zsE?$wuig>Deb5*>rH#-cad$LarHXUx;Eun3*8=74f(F>b5x1=U0`cFsBLe-?cv%ph zFLwAZDM6Lwhjh7@D%EP%#s4m}<6FS_a<+aW2!Bd``cSjJr25Lf{R2YI6@BA?SC|Q8 zbJTDD#On#pmK!lwe@!y=dh)VVZc)jT!PAOfIMTh4`dt1-Xe+N~$P;+6H+Y_>r$6zg z691K?Cy_79@~y)(mO|*bVX{Bi2EuK7sxEa5m8F(&#XZ7Py6VRr*fJ9oRS9Ueaa+OAHAA|;Ymf^a?(Akb(Iceq8l?5v$ zHr_QOYW`rHYZ}ly{t=s|PIgU?=DYqHo32WP0gZRJ6^Jf>{|~+~>tGzXI+ic+t{`I{ zuEE5J-z}fUrC_gc7VmB$j&~-UpkK_#=}v3u5!1X`)WYzqXj3!jTdj5a5zD-SzCf36 zEH*k1DAn(&yad`WnTv3*w2FEoDGtJmMUSM%x+<4!tTe?;Pmzx9*XkOhMGqWl?`jrt ze`pWx4)-_b{3OQX4vYOs)bp<8M@RU1ccGqi4kq~Bx_;2dUZ*nC+P(|remh2`K1jW` zT#pQcChECm9cB$>Gr}k{wCob@vU{m!OXHCY{72a!88k!|JO9-8RcG*B;V#s82Wqq# zSA58WeOuq##>lKV!p-|`Eb}WRR;f;PraBq+cp9^sBf>nnFY7DUUj>c0cRK2%6lImgvWr{Pq|G48|coM&~r&|bQe zdh}@_%0<~?*z^?ghqZs6=z=f07@e$+GoCmbx0cvdv1FWjp{$H(feZO~Bw;(a8y&4i zi4y8`BLfhvf7>W%cr5gw1R4%pLV5kE>HC0079$NUW5KQl`EzJ7r}r@S)icSg{dMH) zXVNG7muJ$@5S>Z11Gj{q#yK|admri#g%F=QM~JEooW>85q;^Pk1v8v(#9X_Sji7t{ z%slmY11AL=KW+dn((;Gh1;{?HSuH$S%K|Sft+JH zmO#`;P8;mVFfRhC0w}-Snpc95E*(fr=2i=CL>NgyPbozpxoz+^mesiPAKEC)N+MtgDr03 zl;d$8c}T$z0B3G43rykQiOJ8)jv@|7s;ssE8A3viV=H+76u4LXs!Ufm;{9E4-JD-Q zZak_b06n5;SnUOTKHT-;nJn}-2iTJ1hF#s%_KIm0)vtfi_zFL70`fW7bFyOT(Ft_% z5>e|fN5_i33g8XkZv#0V8m1-B$l`Mo5P8vc&yKyd(>HewJi7Dqb=9dWh3HNBdxE7^ ztp!`Uz@3+rPI*;dtcVLLs->f|t6qb5eUZ*jdkq9bwN`?Xu)@BIAmGA%2sLcT^W zmft5Du5C_zz9DiClS-?06*#Lz1)QFm0Xd*$7TMeM7GMhn*FXA9W!ACv_o(^iU{z#& zaK?FtyNjzb6}yKdJ7jAm>2B%9Fe{YO zinsF~ZfgT!UyLvbTvcP}j^i6b8!X{8M@ycitr%s?bHFDm&5d$%a)7Bq-lIVDMJ-~C zAui-ge^OuqzMhs8Mk)xyS$t?5-ffd^EOSJ9`R`bx~kw44JI0y2;e}H2`+_B8Fi&}hvyCfcuHZQ*Z7tqZj&K$ zRhK2=c-=wbc+bTx$g7$D?b9P6y~=(zp5}UO;9QXtSc8Hm>ehJnp1>U;4tJyRDY9#f zPdm#HV)$KRe~B~j#wZE-NC|_C_54b&v=e{)x0GGG3LNa?xJD(k;B$g5=MbNqk6p!j zsD9#m?*QJ0aIgWjJX3oM7&y@OI&&~io=l{;h97}~O z5upVB1v~_ob+{0bF3w=?`E@_F#jXfeMzB{aQ&*UyoH`zOG7NDkW@&o(4<`p}3);a= z+r-8#dVUBfL7|-8HqRd25ds!ksMNn5>-1{gH~m%zC~Vd;%`$G8X3l(HU(q{#_Rqnc z@Y>q7_O&zDzP$GQ+H-3^TRVVH{IvEzYyXY+wQE0RPw29JA5O4VAX%8^^HJ0jF8Ty} zt{yemJ+Q5#Ry!dL9sO9C|DPD$E482nY#(SweTx_&Z6YVFI}YEURZ;*e+9$1_40;Mb zSqU*zu&(oMEwb&Uf*q5$Ps8s|>21KSoDV;Apv2)04hTY^CB`?Lg>4K751Ac;79Bl} z`?8p@Jy3ZiMoDoz-=B$?>dXJZBgYld!|Z|CrfZ;?o`&<{=OcW3<^Z2bXGtFL$2c|g zu}kIKsHB%h`R!B^J(Ks+g(vPB!EbikOPT!~QRQL2yXUjfjPSaNF{M7j$z4EmYkyf@)hS&#QX{)^Yi`DSk3$5CxLx2om zbne4Bsogm0@BV+Cq}p_8ePO$2rB(7^Bw@8mS&fn8Br~ike|7wd<7d^$ zAOA*uM6Fff`+^+ZYJ&pV*#sKtVq~v1x0_xk|3SHfN`=TJ^;I=?z>=2b57%N-A>F5Gl5@lieKiBgr#`C~&D^}Db#IGLy4MxfC zq;-SUW};Clz54u#-)zMw9sdpI+_?&?JaZR#C*<%83-hhf-mZp%j~fK-H?YF4J74um zdR=jymfaIOa2|yNryn-C{A8)W+ElQER=~F5W?9-qD^oenNv8R4#@tR?!(Y~H+f8~S z79}qN-ei8Pp#6Q_tgyE7AS-egwsc|EwRci9zikIHjS;6&yd2yHmnF=9I;LRc>#**r zC+G!})>D7NKzTJGwuGL0__+K0LzPAAvpT-4$y5ejV>8Zo)N`ShZALAwNQXrVFh3L;hWnTWBx7OS3GdsF!!QM8+u=JEZy!@xh)!c)E!CpP4O`Ga+St1Tg~a5);^TD zTyMr`Q@<4t{r)@97fW;m++uH&3s2>q?c{vP9;_+HuXfW%2yW{^4|C(+ubX4Xdj>EPC3}8qW1CSPn9P=KNE5EJ%>(3(Cq6@sF5h1=sB+i7z$B7Qlvd zH8*X+0w0}^8P=PR2rrS2136Ef{O;z{naoNjP)3iw5J*>MdoQR5E1HBA-2so$Sd3E# z9A|-pU}i7kd?O^LUWfTOGSAu3B6~Z2=isf4b-#v(ua3#JKlbC}&ftFdN8}nOFM1u# zb2<8ctGgjt8{O(Mb-R8y;Ml%Geo1IMMH zI3QZt`6Skv1XMvS2f7KZ7hdn>!JJ0diK zSD%+(Vc1>2OOGSby045Q)zCOZt(<@wIEhMsTut-7i-Hm&6b{AGrA|hvpi@zGFP(VI zc{?N|G0e5iQoWIG|GU=T$BsXm{gPPKTwr=~%jqmWP02D;YQt;M-+8lNO8<3Znyj9Vksa%_|do0c$-oPJ2niW|yGiy;qC-@}u0iS-bA1|{ahkG2XtWhxL=b!PNzc?PrZ_j>-5jA1O$O>aJ<1Ak!-NV{G zxjSzM^?rnW$c=T9F1Z%CQG&cnUl^wS=(gGnO-^W#qz!XyA|wpb=19JL?52fw4qn?& zpJb4kOwjA3{ZL7-GngnD6~YV_((>yv{Y74G4v?wm%#P)%6a1MGVGb8F7fC9oDC%6q8>^jtP0of!`3Zf?73Y3G8aN}vF{ zv;zLJPne%zTU&yaIAhDfp`F*ux(Q#HJfi*u88#lZ0Z9YiLO^{>?*U+%_*){pe+RrJ zGlREAcy&`#M!~g_P55On7S_44tl+N@=Sn&RYOU2ZGde!P&7KAPxLQ9&>GSwJc5@t0SV8yl*h}AsExWvwkp7f2I$-_u@63_u%?;tBKr#UjgWc*c=dKQ zTQZ?%wjN2=C~GQ~^dj>_6dsDe@sZPa`u0r-W-6I}2N2yqzi!u>^_AwMOQ06R7LOk>PWnn}#RlKIT190GuyG1|Nnj z-RAZ6T#kr4!XwSaYBbwzmck)LoQGV7HWf8- zsF6oBl7E}KW69(0{3W7K!s%v5bFLzd3!-G+ag2i&S%IB>IPB|@WMM}ZdMlb*eceGiF2RjF7^z*Q^Vso+vVU1#;qGcQtn`TY4c*5~V9*>dXK=xeh1fGckHLf==WCw@=Pe~!lH^xz!% zi-LXdKdnTx8L#z?UKou(Cb1S+5$2CFkC>rz;OwcyS$N^p8)N>FUbnRwUew*X#eR&q zoc;=mIX7eOq^@CY;NdVE&i&c-@`w6$$^zMf@!gUvg`emqxqfQa0ZM?7*Ct@8 ztcPW#JZ{-C!`VBxD~5v$BO6# zEuS)#>(68%Pm!FIEXc~!o{aluHcI|QHX4&lZ95HbIpmAxcKRgW4xIn12xY9zD&8(8MuE$7}PEk2p_ZuW!dux#QAM{gR?25B|QP=R`xs2fn zPKNc(l7vIbsiz^f-|5)ZbtdS6z5T=ogu!|mo}|h&%Fb5qI|lvUM0r7^w$Q2Y+Hz@lJ9H5c;~mXi;Dxz86|3ah(WBj^t+mzpu`^!NR(R6({uSIv-IzwWP5%&U;1)S+z-p|FYh}}R%uX*4 zZ2CIHpzrFUkG++3+Fc5r0A)K6kpT+MlHBsS>V?$?nHm!*YHlRL;kFxBr?Vg zh+Hah{b+eTlm5%F7H$Yr&b7y|em&t2_3tPm_^D5zSILUj;2AYp>d&xT#dtrSDc-jhu|;WA#`m+=rRc@8gdc zG~;)1W!l4CKHYBj@NB_P8Yr{a=JS2zaRV%J+$~^#-RO|2 z4gpo--+eylp=~peS9JLNIWyX{CBLjp0CxI~h57QKE;jqKSQ+kM#n@H%+f}oz3g_JV zu6J(pxO>l;CVJe$S+=mst#;k&Sbx@Sf4b}O%768hfmgBbYYsO+=lT#%q5Rj=C|_(w zO@wR5UchOE9-vrQ@%f|CG6U0t&C2f= zEcvg4)@2k#Y5yx-k`k_Ty$6Gn(Nz#@v$I2ir01li_dC&`z0{OnL*F|jz4z& zzVi4{;+7?4yz!e4EwyUj8_Cwz4gc*rT=^L*`C-e8Ek|~i_+pT{Nb95qz@pc8%cMHDG7- zoe$&i-PdzHp<{VHr9LY#^Qj$sK+~Dii=7rog}N~rQ++n6IsDa^IvB(I9O)vJvrL^K?4aFn9qn7!wmAy zM{lqo$}N?cH#VoQf^(pGdJ6bDG*6F@xQuxcLH~il0*?Zg`CprsR+k`lI7fR2UVm=w zFA8kBE{4zbIu`~)GrY^pVVsP3W#MJVYa(9xcsatn^cM7KQX^?AGQ-B1^yso`3FTR} zGSH>9QDC4$^L#VB`tw}hjY&<+^=;sqTb-DHvMHn8uAmjs4C&uq#xt}UH>zf!A9LC~ zoQStVp0u-?h*euTvcK{>QHs*e)XYQ5-Urki(9rt0&5{BurDZY6C`(*mWG za?)#x6a(s3otsJ8h7_t4#{A;uW{SE6+$G>GAlQ_fDdH@Oek;1IIJOmcu_>Tbttsj@ z^*i@Xs7~-Q4v0kPgi~%gz0myL&q+ad`Tbu1e_yXAC!h1VU!KqNc|Once)hTV*TV9Y z--5RN2)AQwaEZQ6jj{Zm&mM#>pGGB&ZBM9Q#VM&U`UFl-qQYkv#;AoHS_tl@D-n7E zUS*_}{zqX^@@PlPM)j**b8!QIDL3c`LKEV%2buj~?7ak0tnfv?4Yyd-^X<3`fL<`= zmu<5J5+SLDO1(msR+K@Y$%Fy zb}M4#Doc^40eOCp@{DCDZw%WbnaWMz84IJ7ANXPWq$u!=B}n)OC+m(*YbqqW{CM`tBW;4vtYUwZ1U!gykwoxV--h`O7l*b67RT%%r$JB&~HTmwva|si05{Od& zMq3+v=>XOP_+rrK|8la@W8mF#AxX_rDxu|{)9l~UmUrRi($s05Flz_mgC)u>I{*K`P2nd`a=>}9d6k0#k`HI1ek`m<@D zmp*JZ+YI29On~N75pbKZd^=3z= zM^r4?*bfY*C@ZnGc7(GO|Io7KE!ey1eC;f77P?Fw;h!j3M#3ZM2o<;fM9H))EO@xP zq~!^9vA8sxgB)n^P>7%u8xWxAE@lNL|KbFHMU!e z3og0;mxGPm+mpG0$C@kyJ90L6x1n6oBZsJLzOo={(WDl}fj0I*{9qy-($8(~HV!<_ zeHK5SAUO`*)eE~gjUp6ANg_k^Rih5Y@Lcv(M4jgtxxyYDDT$~JeXk6TWZS{1j9API zfDB=X`hl1GB~ zJ-j3Q%fYFpeS=4`FU5}_enm9wsjExpnj=vg9*cILulz|mWaNs+qLItLq_6?Ku>};3 zcGPP?HS*CLmMB*YtRLzPHeyF_Na&66emSgO{T%fD`+ycb@nLoVx2hgI_st#uw!p$Z9fi} z($@74{cBn_p7zK8mi9>mS+C$91-m*t5%Adh~{rhfsbQSGh zUmxGScu-KRz?$`4z&_LF%RZd&3!^%kFYCL)G-mMgg!`SMs8vdbp72D1tkM!SmSuVr z?6Y_(1vaN5WKW8+N?^^|^3u=R?#tnh$!vlLc~Dm`=3@s+u8!%toWvunZ;1fAz((QQ z5PmjJDJw6>-8_`PyG9O?Uve$ZI>b2=r;;XLjuRXTN6O%@M#vT*1ulv8A$Gc?yAZoD zTBZp4QbiD$4Pz>Cpm5yw!q__XR~)zfG4+h?rQJ6GwK83YMM!ZnMkx{rX8#mrq|5an z{O>W!<-^1}HCs!0we7kd$|1{Epnb2EGB5)yGPix5n#IwsC@!SW92d8}EBvf#)xxrK z3c$-zx}E9xFYu{Gv`$Y*pXti-Oz?09w zNa0&I1GF7-RdjxgI6hfejuK!=(9hIIrh93d?O50 zg}!tOAui0cM_(BfviSp!S12$26~@@Q2iOeYqs};g(D4d5$9?>&F09P;t?4u;;}qW> z6|VTS|AaO(Q7?&`ksYJ=kiE=+gjv}*0*)Y-qZHs)&xBCg!<#UlP|r#O@MkuF}>!(#e1IzW%=EpV0_+Pe&CL}(*8eh?otc; z>b3}vbg8pKUFy|szZo=SY_FqO^qqU)2X*byz2}EPb9WAA7+-W}9QaY8e#A2R%D{$f z;e$8vmb4>uhp;}f0aZQMiZen5?ARNGJ?f;kUp>4>Ee=&YvPYfOvGb?91`QLwQ@0`d zEA9K!L%WcApO*J;1~bf&x{nUvjAb&7=+EyRcqse551z$)k~+o?TCrk^DOdje&E2T+ zx3=Ux(v2EF_EXf?JRfpebI8wp%!zaA z+b`uQ|NRoiVZl~-#Nj>9U&wc*&)QjBj)rG48TPjrJEB*QS{2w!+AWx6i-z@fQ*3lW zb$~e>IpB6EX3{&ME$Ox3KeG*fgl%Fcr~DY+`}nANTrX8;%f!j{AKsSD zJJosOYxr!CUSGo=U%v*3e@Y$BgS4ArZ&T!vim))4rJZ8wmQ?_)5`c!`1)qNycI=!o z^d)CMv%k4MZqTREu*e)`<}$ znU?Wml6QR=Gs=|n%fn|9^qbCoB%jVy-Wh&rkjuc`qrErwS_eF$8=))Prn7OKg3<=L zHn%I|*6S9Nb&k$H)Zh8AFXZ3S5wbrbhy1HW%!d4^sbWp+u=>in>)_92AL^B(tN_ku z$5P3Yqdb3cGWaTUj4LVd5Raaz{A#pmIWDB4=5nkN^9J>MZ5!0v+B&~<^77sH9&~!% zPz#{pV}x33)-KY3oTy9&;s%$oL1jDWPGJxH^$O?L-Jj+H_Q5w?3wSh>XB#-Q1?TQr zL;M`}v4IfyvAf{qzyj2<>S%^%55{Gr5}bn#Hvf)?5jF*B7I#e@kKdB}boX}b87p}I$_Cz_Y4^G_nGbBHXPD@40@lL$^@V? zW-I@rvRU`Ui)9gW8?>&X`P{tc>GYo$epY6~J)NppJ40?&KGVIi^A2nQZQKpo`HkqagBg~w8z&A}^yUNKDZHg70=o_2gAMMV<9r{0-7lyz zK0%e{Ql5e*o$K7zO_Zw{xq2P2u-#vGU33S2@2>;JdFWE^U)OR!tUj|of52j*H|p9`Q#YK@!_=Hgoq7{S-h+A*T^Df&~!+EK(?LOs%z9gVxA(+An?a z<`onpvjv~hj_^Y5`$%}J_HAp8)3=z>Iv<`1e;(bu$~0rUyA*pU?@oI`Pze!dJ=65kMsC`@N+&qn?T)!#*8=* zK8U#}^jn%&Ie~TJ=2@qmRy1jhHcRB;|9e}l5k1-}_NH43P7BX%>XQ=f%xU?;yDBfe zs~Q~hd=LAmeM?(6YwbMh->+s##mn}qR%t0dCrQuZvp}N0(b;kW)LL8E6(V_px_1(A z+XUc7JfrcB7I?jtg4UALkO1U+)LtKMh9I$4MB)nc7U=zO*$j3QQ)7{csF*;DiH;V< z3b4ve*`GqzC1DMTiZ1&wo@w3Fia!+3#Cst-BW{o@zm$$ge%aY?$M;}P6;f{TcX204 zG)St9_IC}2nqN5}J;3Zez#n??pbt;Pn_t>P{}3-kp1OE?N5!q_`1@zIa8um3_MhWF z8JE`oFfXMY&6#cXrj_aFz}nYZig>*5^`X4`ML(EPj%nIo0hd~VhA zg^Ck2IS2jo^}w(0y}2ia`yK|2FKF2-cV0|?H(Vq+pz1Uz_q@W28|lUc68pYjw#Ql~ zMhrN$G)8$BAeUW-r<|ONa@x=uAZU zdm*{$)pB%ezh&T>!&ijNSnJtTis%S(tE5&^Y#T6-RZtmvX14artqFUq71Wvx;9uVv z6sm;S@gTKjWEKy!Ac{?O;A7Kg*$!PmO}7k5k?FILbCn@>Dxs@FJ>k27&H4 zc?eZsuI2K7tL4Ae?8(bD>!zC30GlD`E?eKlY5t^uW`|NSlgmg$yd$FP(t3Ek0p5Eg z_?m(&CKj@vJ!nu~8}(yM(7%wAbC3lZ;cG#FMf4U>aA+^I=+gWXQtlnD?lCCOAUsVK z(9-p0g`oxiz(~c_G$lWd=jd=p*nLJ^0iBEs9jkCxuACk*D0hvjIQv1f1)NR_!D6ulskQR{piF2NDL>!-jQBaz06)OL4hPl$Aa7LRp>zs${a zg&dc;8Ar<|m4zx~{t9DsJ@^Zt{a!^ic{%Zl#&awnj&^>hWPa5~p zgOc8c47nj9h4spvV-oI9fD=F7S8Tkmn5`FnZh?|(17Ztg5CY_sM6K`6F>4auHuX+1 zuhJTwSlOob<*>?gahtzSy(gy$pTV3R_*|271fQWC&K5!{qRir6%I$yuues$Tw`82Z z9AAOQ?fDl%bF8-YT~E3vAABJKnxxFbxRGo_lS~dSF>WXPIw%h8xJQ%g%Xk6imNgOF-+ZR$)3zI{PWD73jaW98O0=yC zsk6i#c%CWZJ;~FN8_7u-{8Ugq(s`j@#yKb{K=M@bQnz07*i118(YI7%2TDbG&~Yt7 zd6$0s#L7UMiYxs9?WGRQE`E~M@9>1E^?RUqeV9&@uZ3M<%Rr6g&boqrti?6_h~hCaCrl@Yi zRoE*7Xia*A^_Ryaq#ky%nMG0D+lq*(OaV^2~#4S-8HN>JCZ;51Rrw%o|2XZkD5b4KfKH zH-tOJ?|OWN6O?thX8^JbsLr?5^i!6S8o#x{jjP0zVw?dl$=7Ii&w(Crtt8d!95P}vGvb2pnzkI5Nkc}A7Trt0I8}s?-23iUPdg(@*DK{hJ z(nxX$Pxrjw*@FA9Two(E^}t7(WKj-ZZ1UHGf|(B)WQO1GkN+k+A}W(+-zLoE9OaKV zA-mA#{Wu|iJw`U!CPtr(`S1xnN_^^A#{-W*7er3;5ZK!dh(m3xh{@O&a0@KyaL$Ab zS0X(b*!6-lg5(t^1dA3^$S#i&;>5qk*$frF)twmj_Vx!0z4(`>$wSCb(TX-&7A`V<}5H( zZ*))j2==wO`PYYB&?oeTo0>yY=N6c5$b5I|mFxrHue!O9Dm_f@>Gl`!g4F^vjynG1 z4eI2M0|`pWh1|G9pWO8qSR-oX^L^n@)}nOh6%nzP57&fqYad2`(cEHXo85dr7pe=H z(0FrWB2s_#^C1k*}w` zwi7-qfS0l^(A(a64d|+&-#PW(a8-d+`}^*`BE3Ab;8)$ZHcPdRTIV!N_;=9e$qYTy zS{h-cc>!~H3es_@PErwDWb>3KyEUvm)OIOq`_z=yZqh28 z3mr45)d!@uza(11edNM!p(;LFL7u0SrfpMgVoTs? zs}YvvJbc+5X>owV;=B0v+dPet+nXJi=M$}jmo6q+Y;w8{jkUztt_qT3T21tXsA+B4WmV zHrCi9w%X^=+81l5tYWwW=de!2-hA*Ul-}8Fa!~(^K2zA#^I=ggzU#wjN=YjPaSYDp zLXXMO=Bddyg>MWSwtraE5$S`5Rhv8SP^bXfk{?Q*hq~MIuY($KQH`!_l2U*5+Y_BH)WUGaL`dpScn*HSDs>jiS*BwKtoY0OK>(9jhDsBOyLDu zX>H@BSy5USN^^KNc0ZLr1E_y_%GJYxshhexwUSbW(e7hKC$*AVru3jBTmBp^mTkCm z%0~F&D*gXmPCLq>R2j1$ozv3X4Em3IElnkBrqs4U?)z+OaZmAP zYtOTrq1md91@-uBjdI=K=F z(9RRir1k3T)OJi;7(2EzTw{k_330BlO7@szCU}xh9iA51(QWqww^)^?1$r}43VEW$ z?qmbUC_f&y`lr;kLg#QO&XhU8a%1I$2W5h1Hmq~Msi#O5Jd(d9ybF5yoS)%j&=NLy zc2OJruvY*s{o}ALdkPwW_S*WXyssr>^PAzbmGenHXmXZ2;L(YdOz>?E@%{{iq8CeQ zeEc-7g~zk9H`~L7o#BZdOMa0DdsqJ*Qytjxh$rZnlK!rqqTR#0!a$V06nFY~-0JbT z@_5`pxVkm~Pb>l>&Xi_8ywHUS!F$8hu;&%ze|_ytXc#+c34xf(NPkm^UrTqC&ipPz zcp7>kFa_4y9#F;*d`k9%@`QZYf2n5zjyR&_bqQEOjr10-RCC{4-V{(wXl8K2c78a;O)*5 z+qc{_%c+(&5(;gP*A2d^Q7v~!p7yz#)B!D2Yl=Kurfh|*4X6g1Keb35wd`0od*a63 zaHZt=tdQ&~P;boEde33C{V_kV3K{Gixj?JRJ6ly9{ssK&@o(?}%`o6XO-$gd-N<*o z=L`St)<~Aj!IDA;{K&4QM1%gO+WQ)SUrl!*9qwd5Yp*XPuXk^Cvo=%Z5%4N$^bL3d zfKDm-fFzBwjq{qqq(%D}e0Hs0{!P{9sEN!gTpHRD3ZYMI(9kDJNHD<@trztkIulpOlx74?49{R{bVG1jhX2|0C zhDu$`SXmhV*(%KQGFSmXixvH1%vHI*4Egpc@2htC>F)2TCGx9~T9H@to!vX@&K$hT zqYLGOD<%jU0>(p`3lbY1mxR?pJVnhc%r4V2)01da&eBj!7j|bPg^@n)e*tRZT z2z#?MEuwmm-tJCVtPyf)>ROzfW@7e-g~6`GvXZnb98 zO<~M5R%%cChGcd~nczzxHT%2X8j{XI{#MN78GcBM9-9+k739w$mE3!Adc**$3EeWsc3_YWLrtPyfT1@{gCNF1i&-i#^0bJWffOgX4ZwG0%D z+T4aV3(zTH1~JAeWNm(9RbhUA9KpdE7&I%aWg8?XJ@ua`_j+-d>7O zPwTZi(uMFh#FTaFrtT%4tf!c=N!{2Tn8Kz#)GhgUpfAZ@<7V81PLKT{R2BlV?zF6* z89m>|shT|j&lE!vu;Hs~xe|W+JGc`|C2vE>{wai|vU!N^AzgkZxm3IJ&j~^LBRKdg z8}y*X={j+%ce%3;x&4dOGI3#qmAKV1$Gk9==)Gt|x{TE(4Tm?-JKz6JRdQU_Lo0Nh zJ9*HAI1Gp?bk>-96OARja-y9MKjkR^Q5JIpR7seY_Qq%Zw>XA$95E*{TNNgdcR`Y2 zWI%QRPm^k&HXd|JPKSJcIV8YPD%Rm^@TO>=lB?*(Cc+=NDOO+fR(DA9EhZUvz?rMu z_bO?~>*enhec1h%Ti?6&ht4+^vn!Hu2l8a4W_dzzQBm#58XZ%)ujSzXK=(&xHsfqu z)bwv!yNY1pC9c9O0boyYj0epas=t{0)`$ojE$ZEmQaFvn6U5nh*LuVfagGULe@=<; zyW+*uJ1JFr`;U3`m*4J7i8#OJDwSinZ}`Rw-Q;6MEGhO7y?8EFjN9{No{P!S5pmY( zgZZ&D-7f7-Yf3Dchc`lJD*4}dE`}}}rPz8o#e}q{h4o?yad;;&#?PSkdQYxLYPY}& z--L^|DW1$hGs{(ecu_+AGY2d2{QZlQcjb1Hmb|Nkhra+ja&1W!LW7a)aemR2_lJ*9 zR4o>tf4LrU?vqNS*#)RWAVo9*xrT5yHb0`8+ZL-__B)U^bU@~i#qwZ-AQtzXb+SjW z?!TqI%VC{(H<3-myO~d=-%VzQ&UNUGl8YIg>pfy|@l(0Vw2K|yYf4Pj{Buq}EcQcG zZdO~tuIaGTxf*y9rVy1U`TuXF+41H-m(_@pPK_=ZFXzPQrZ1P%cBvc*<*-zVwl0;u zPivZkAD<`|Y488|gfu4xs{9T#Y~W#|50aHW7EHG#i^U;xc}LA=5lCr%ujVpSaEd4W zZXy%W_DQS_a-4jYIXH!h#kor7D2;>C$2Sv+5h=WFr&%;=ZLB<&&Q#j&Z7kScqB z2|PjKtBTMHzSEBW+BjLiTWlVg+GC0~h_ODm*K z@D6Fr^jsShf4={$lY^{DoE_ZeNk4Pq6!ao5K80Ev#HUuF*F_E?X0Zh!nPLbb*-R{1 z?rGBIe?usO-ncXa=PCRnNhRp zdkg(++jsojcSy$ycC#+Z(d@HyayktuN zr#|4vW~?}$aKS#A#Vok@)p&&kk3(0OO|UG>#EO=>%t5Z)B2D%zP%=#mlpM&ZOy;ST zg#VbMOl7b023?WvySjkxS>1~|RX0Uw5*`;igntM#^jGT_>A$N#rJrrM+Hkv}*)U|7 zW;|{fFy!GrYMOmU>^-b9!U%z%EJzY1=3mYiX96FjR3a3OGS;~)qpcG+RHtIFP8YXE zvMa>{gu}!sYjf-WK6Y_*WO%6B^o*KhyuB)3id-$wY-Z)BKS6HN{~QsdWy^JnRqYHL z?WbT5!j#WbgjPXMpQUtm;~{$bBxSVo2RKOz2r`?wPrLnkKTfC;`=@7A@~}8;lHWMe z5jcoC99c^E6t+$6kcw_l=P(YIUpl0$m5ugZV2M42)S1AaXa}0pHuXwr|JgqF+Sxu{ z#Cga7YYd~*YBb`lUgUsLfL!qX*Z4MdwnSmlNuJMf{|Ue6;I~0+tKr|3>d zSO%SWJ}v|0K+t|SrLyfC;+zpXjx^*aL{~d*{dom37QXSP^#ONRIs# zt;~wcb(o@!$n=!KuGi|66Yp5d+q1OLyp&0PTW*nma^$8Xwj#y^eTy0MA& zN8(I=qrBn2~YPMd@lp$>C=cQv6F*{H>>I<%diJDY0Ur`6bj9{2(LHk>~? z0kKycB`*2BiycAR@{IhxL6H;jo*ypxjQ!vKahqR}OV;1|l z7$KRKvUG|v_PwJy_ED_0Va=W^8E*>umh-^&gZ44(wDZdi@CzswJD1S7f&&^NDu7}x zmInquszWrbv_cP0R*s$?``%cBWSI)%}RAm8Va?-cv*#%pDzd^xID+PCNz_4-&%*XzG8 z7DzA1R4)_OCY$*v(ihmb00{-{mAK&2vvWBv(6sy@_86DSUAYgd9gwP8n^s-?=~1I( zJzkBuzb&3$EDYwcRX8P_Q{`3rO`t!FI|&dx_?cr&4%pVR%6sCrpsvy!>obid`VyaGp|A3LBCisL9vb^7SSX~#47oi?A6ISSw;BYVjZ^|B=IF7qQs4w`+idePW6f|{mm6LGu@XMFh7~uwq2$gQEyWGw}ww7uGL2LT6iUm$13lA^ysBgTk>f& z#_|Gmz05YMlZpC(;e^2RTjA%9azS3Vvh#^_4I0>LzrkZ$4xhTXSLW=t_?PLkRhg5b z5%t}LouB(Mou7>zhsobMno7PsbZK|8DuFRmWP{@i~Y zXK3?#ArvMl74-c?lJZxkbH74wObf$;Ao~jPIuktgGaR8Ss$AyxsFo}o2DI0 zQ2$=)wRhCguFN*NiMF%99;=48`@Xoms?Qj}I<^Ol()Tg%1p8g_Ja}0r8fR73k2Niq zw(L;NtZ8{i@J-OFrOOFpBxhyQ@};XY?ndb97SNtal8@SlbwO*a(UZBgO-}RO)IxWB zpTDyyy??<6gpd9sy0tMBA2P2O)Vk($hY{(H;UX z2_@nZewTU9SaLA6bos^kS)JxNJCNd&p>&SGC$;Hh_mPL?-tltNd)Ko;=aQ^lR^=}j z|8vRCB|Czq+WnY&R^{5UFK7U9%a>LoG;iVe96KAV892zdfFnQP<_++;=`3trA{JYf zpIuCkO?1dA{SlVbU+e|M)|OO(&x7Ugs7rF^4-; zPE5at4Bp1cS02&&RR>S;T8s?86Z>bq-{reSo`Ml3?%%=gKTfFnM8VQETREgFpL`?_ zVO`qZGUK1>a;c@5k8RY_n>_#A*1{6RgO4o%d`kbFc>&`#g=$3rr;bnU<9 z-e#s&E;9$~O)h*d#NOM7J-8LVZ>3-%kS2E|h^q7O&tR~SHy5MDhutCrzrjgF*?_=t zgJw>T-y9S0o@3_{^lm~>s?9xV(M<@5s`*O(qy_l50#G8ST0oWi4(#5Blm9C~L1eL~ zd*FeiPxjn)@-J)P2a2+MydJeOOLF#VRebrpR^0{+8jxbXhu61s9fs`q@jaz#!x>&!r@!4Z=<>hOnQ(sU~ZRf@B~waU8*XktF*_2%940wEng`CGca>Hv_1PX zzOIAxdRpb=xUH41%<;IVr={{N=Ah8_al&*puL}RO4Y-Jeji{3niHSjd)iJzfeRnR`Kk(rqCmD!fvmlEjLnAB1AZDfdQk zBN+_Lg+=pR?M5+(wFYA+TfpWyliW47%xeoeze{(Sz%c6thFR|!oLm__!<&sBw*VP| z`9VU4Bl${TZpOWvoA_0a0|kX&vA+>%aQF967u{NMrFM9*4zWg6_+cRED&i|M4lJs_ z&SSb3h(rv?>Z)+P9XDQr#}eUY=EUu*oJFF7OPUp2Ojjy{52E%3Fdsk_pCq}^Z&JFM z@5YQ>l1D-NCVDa;d8>pTE6|vrk8}^@8e{eeacPZ%ZbJi=nl}}ADuHg?SkjiF8%t_4 z`I=c{vnmTm_%d!5bi<+X3@kR>CiwzPzB53vGg800m)dNP@M{Vp8PKJ$aDT++#jIhiQ~GW2P$@t&kl`%1rWbb``hkRF4}7qBbn_&S;}zX}%XMSPn_p#Y1J(rf-OH!2jF> zpub|v16$pu`2Gh@;#-JYAhWar-NXSbB}aIJd*H(~-c9<}0BADI5UYY0xeqW@x(}U& zd9sLnXE&Ixm%>ZKu0q^lEmf7~0I%?2JSv<%e3cJm=# zf_A=Tz{5F%^Ml?%zDKfU$d9RI4rg#3DE|du(pv^xOpgVt0lpu#D^0{~JBx1-E; zxJSl&K`OaDuuiQI72LRFdj2}Ub_y%bFIYLib9B%BKi-XQ_HpX)TVAIdPtcJ2qt{uu z!EO8i{@J0M;^^Iv-%`G#H|p)H8HVl*{4@ETt6!bB2ol4b+D7=?G}TH=w5ted~8E`AthMu@uHV*3!6JG84A9;w;SaGUdHgs=EkJ#Lbnx~Gm#$*Hv|%`R^1h6r!V1}AYkd5u=%IjPgQ zQ{j}`)lKS^jUBR3aSXaLxC;?A{@gCbb?w(q;cCt8rUGD-iZsp~^0;bti+jQW+WRLm zUHcn@b2w)Ky_-|2YqQ8tg73)hQIh4*W@?DdnW;OF7vYpLm6JJTmO6W$7|h@OxMxvN z_q25?gQa=CvmMg>0>}ySv686;Y=-c0dx5TvcD8)9rx3T5yiM0$HjhftwdsCqZs(Ld zRg8#e&8NUZoQ4vg2KCk1tuf%i0)NpGLRu$z=q3z>B@taaSF)exzUOq(oHED^C~cS- zk5X^^VeF|Pi-cQSiF@jFa(IlB&>w8GYHx%wlqW}S$2DE5c|#GCb{MyT*0$pw`=_7} z>)jliU&*ml>IOFC%~4{Q0sS=Z;Xm@=dU(eh*n}Bh)+kj?hh=Jr&BQF-G`ZtETZQ$o zTQ5J0Sw4@|2Bn!9vD4UV%mYF$ZjWtKr@@mhXx^#V@1T`)l?Og%H&LW2ckn@c-t;9A)-U zw^#4e`!tVw&}`c0A&-8i;VpBUS{0xh-0!0G!?B&-P&Fu`DB_Neb_Zw}NPkIO2Xr|| zC6bPd8`P4JFz^sj71UISJ?#w@IkB21t5P%eB=l)ytnB_f@ArJldA7m_Xq#Fku~N!& z9rDa`T!EeKShqA&?U$f`@>BT!1K;aQQxy&tS#-xuau6MQVa4v2d5@`8j^+kd9J(IX zCAln`t6H5F_=pvI7Zo1pmS$Y&e_)@Vh2SMt+$-604%}Y96{YSN3;~sHeIDjK z^g<~FzpPeO1ZDtkaF7;Z66Yb^h@GRPc}7&`$i+0xX?&GNJ!GnsN1$xL2?1 znKO?;$H69&o|*^^kk&#|!56b~j-7)}D{kKKPy0!WXS%oaCSZ%QcKB5(b7I^AhVv{i z5i6@@@&uVh4H(0E56QRQ0I~<|A~OTD!p;Cc5nk%W+;p6YmD9YKXWc1(4?>;09suqq z^wYV6OgesyQc;?d;H?h>rEnB|2OgkQe`CI!Z$=+uz0)7j0Ct`^i5}2zq77v0tS9>H zC+y+BUF1sd@^HApr&;}TZB5f1>! ziFBdBZ8(D*=zAGM4{=@%?MT86mQmw#D6S6a?f{_-^pU&@8lhh#F^I1mD22?ZU^?tEH6^D2U{H5`4ug*uTm}9D)7IJfW#X`6VC4 zwAaErpolgD(-c$qz>wtD=A!}n#N&eZS8x2jBW~a}$27NSEV}X95 zIp|x}wo+Qv4v*-KD_xOapnu!2=S!6tF}BP(ZG!yn3BJU(YTW9t=GO`E7Qw(YjmMd5 zTSYiCzx1czF&o%_=+EP$h(E`+icTe4p=$(-nrCotJ$8ks7@R-p`|XFVn=Vco9I(k6 zg~s)I@`&4lUmHeoKB;&L^9AQ|O&6Q1NG4X__y9bvvW(C*(D279>(}PN6KYjxqgv9z z$|-cgxu>r?4mj*sU;6x|Z5T!wzaDtisI z-wN8Vd(V&hghsjX+<&g+^MqQ$806>a94=@%oKC(ta+l|u@SO?|z^ z8EVQS)DNEzzonX3I+eMRW+~}nLvQ7_&G6I>y~9ygL+EO8_ja_L!5%d2YxV0lmTB#6 z9#7HfVQskUHV855g@?3I*tP>f0((Rwacm{*2azcyTw`F?`V4L6SI zJ?Yi7RZG83Yf*nZ9rm;qb~<^}$amiC6){>q5dL;Z0OUVG~yftL#(j#$J3;AgT{mo#3Iljx9W9hfU+S?(oGpHtS8%>9$ zv@jtpQTjzH@kOa|?G190>OoIZ$wfnb2{!A7b6L;R=zgTVHDZpa3qHNE1xN{13~Rvj z3049(VXij2oo6z&S-Au==^BCsMf^)C?=F91L zg<8D7Y8=I;oE&uuc*UFJS9$aU>oewgh{GnGaxN{CZp#>ih8(orZXd;-+RnLkkP3qz zl%Bu;$nJE0HZ8w7SY>nuIjL?}?H%biGqpEZPs8iSYd(9tjwP%bHT!REMqi_aZB3A8 z6l3fOZ4`B|je$3`VL6h{sa}giROFk(=m}FgbdeTH{qXJKbjZzGh!gvY`Y4+@sO4X) zg&j{2|24UXc(J^mM}YsJX{@-mG^FRvbm&f0`2^@H|F_1c61TUpJ_O0kCXo%)f!-U{ zvTROL1GL^MJ>UTw=XiLj_-bgIsSJmeYz@VC^-cFTaAmNsv)i!itOCch7OPN6V3rN1 zl7C7;eg?jhct)zv1$BqtTL^hRBvG^jxQ6o7S=lz6_PCr3KWAGkr;@(|FAWYxCD~YG zg!oEh?8~tXHkT|tcv!uog;kgac~jcDzX+x7P5kEm)5$$U(1F1ibMZUxFT3Bjb`hP1 z7-VkZ!X9q~x2q-Qf^_Np5Dw<|ZBJC(*PbBG7Ib>3qq#9c_vc@ZcSy|c!9oq9R_cIG@@Ycug_f=!&eW^WmE zK(}eLfnrg+=}b%^wtDV4+DVsr+J=DrUVA#ZV(4c>K(@DYACJ%5r%bg?er>OE?eJ+* zMew407gs`ZzjSLK-nRyl0CC=gg2jcq2exGw_16{b#dksfY4<49hlPbY8PN1uj$r<1?j2fk!(8?mi#Nb{sH4Qc~-ITtt#)WWdLnTD)*4qaDwAVFj>FR%bvCF^NSdAto>*Am#oHPcTxih%`;GjRo%ynr>a-l`by%B5wRuwd`EnVg&EtIGx zwB3jQnFcy9Y+=(i8o1z`S)&QCOkixVg1ZX30p$*OUmr^6vQ5hc2%7K@MO2h%)$2q{ zE^OD{^d>ffR&Wx^WmJQyDx0b89T$F+eh)dzHT5m11t+y24#`NbxpZnhD~3o4zVZb+ znZPnNe&zU^r3k6=!uOQEFH?+()y{5aH+%rxcGOXZ+$S$nC#Rp7;55Srh9-NRij`Cf z?nHydoX`=2SD`?UOHjK zPOv!#3Lq<~NlQ%nPO#a~#Ah1MKYfSs5}!}&fc^ydx2Ka8?0}3IB|S#VAiQ@g&b9_$ zslwwj8uRL_`uCQ2J-$BGba&~w&|)9cz4tA|C{;qWvOfF0Z+iPwwus&?s?YS9r)ByY z=Lt5;oE)E_3Gwgg5X|p2XzA0j=26;nZ1EdsLykAj_Q7tO=tJH)=YqUg?RYsg-c2Yk z9p8mqGp0@QQHbg8Oy4A=cGgPzjQ6fb>~v_K>b?8gbiQ|p%JoBE^$J?9pk_FyNM)=T z`pU!n;9JHiv4!27GTp$H?s48^et{VVHTiHxNRcm(c*^ccCjWOVTPeQC6j&}RWB7NeYSN?<#mZLR(8iSF z&eu{vPh0tinoQme`IY1&kFGR6qtls_^)aXLDd%J%d~d|>7{1@bw~T)U|2U_yF6K1t zWzMlw_Qf{Pw7}l-`V4=@ZuoJ+EyaBQcM9kGELX7p8+}=;gki(kEPs(ZJ9hf4xDMDk z{K^;L@4ndLf2PLb<9n9AP!A0q?#Hc^``}eF0c3UfgK-Tt3)^*;<@BtO672O}7g;OQL=>x5&>8G+ryMVMA9%Bs6=UD`I)Rw=qp?%Tx5j91V#=O#lPf*fd!Z4C^Yn!n zoq!eBwF_98!E?j3|01aXsFO<-cmJsH^KM<$`Tp5j9jk#4Q5Ktp7F>lVDK=B9TNR!Q zVyBW1j8&rLqZeVZejBYQ+Q~~1Vt#cSddg)hU!149vYmxpKzV?_7BsLwu@K0Y|1Vl4 zs;=p-Vj3OIH$je*tc<{8VtlE8@Ky`yHx=-5-=GUV2gm|R+-pF&FT#Ew{w>k>r;_=v z0`*&FvKM>sGnf}dcX01@Bm74czR~RuZh-veRPw#CnZQDzzQ_XKESIzBDeNIq)ESkc zKL|=eU*K<`37;nmhc?#e<9|~H9*E7seeMCI{S9a(t#-zKH$LyUGP{oEGb@K|jw@<- zLuE}CjKxf~(98LG|64V#vn(>E{Wkug3iX@)>IE+t_dLB^v@=Q-O}r_&tLXg^R*tmrAMYZ2`={gFA*wz;VW zgC}JJCoo{J<^*iPRHX=cqseRr9|a5k$*v`Rx4`EUP(zF#@9^Vhe!!4p3Y0_ot~>;+ zp-`PC6WZeD0ewz7=3&G%eAMB`d2_%d>Vv7O({U|#$Ye}nX21|Q0;J-j^RWgcu57#C zQvP(%g7pU(&*b;N`y1So8R+SjN8Liq2@9O{?!kj8APWcfrjlz$-fb|I6$f|t_25fd zm%u;Y5VV#)wgo#7!sR%Z5S4>n(95ah>|uINCVR9I{8K|&FqOP@BvtieYMtp>ziB`} zX)9Xx&=7C$@N*xBZuzdv&^=W zxMJOaK9?WRTcL~D_t34c;M^g`UV%>z@z7t+n)pT)K6VD&*Uwa%8=QE4eaZHMMHyxp zSn7*2sq&v6}uNxzSSuU#(_$9Esl8?Z=q}9YNrC!;>ow8}+~`f&SaIJ8e(oOwh80}E9at9- zftoJJ`~b^!79LsL*WKw>`>C&2V^-V=ze%{mLV6kcGG#s=R);T;mXM`xo920#@-Iy# zBg2Q)eOnElr@-ICIuy2=I4Rzm!WcuErJPT?1Mo<)VQyp&+4nv*dgSm!Qws(hDV z%y z7UWZ((Xx1gtncB<3sgdrEe>g@mrA{}8QFvvn+Or2%M`@qf zSA#c9+pRnaq^cC?-pm_Km^(sFr{A^20jjw~W#>bUbSDsZI&*p3a~NMCXW^~p2pe!o z%+5ZdJ5^9Gnx()wXhC^_G4!i_YHZ4lvx1%e*`BLCdifPtYnNk18LWB16ePb&Q%ckYO33AiOhRfw z-r^PxaFR~WLn`$Ej9tLzYSMe$jsG3H+$HW3@_d9m|D_O<*Idv1q+@YuPXJR1`pbMg zKA2>}e;58=eQE4%z1J|0^OG$(@eD#eCz*WI-b?SD;C;SH{6xSN5aIuTG#vCmYq8*5 zb}G41ZJ-o^hI*yQvd+R}Z@Qpcrs(^n}PE9>#C^PxQ-miPP z;9C*rJpATzeAm~tK(l$nnGTjwvNZc~3Jcd&=Iukk%tarkAEkdZpgz;KjDw)?x zCi`W08N|5KPP_+wFM@A05$^~dQaI1y89XNLtQL*;HTAOr)C;!Z(&yl4Z}b{`Y?^?7 zy>C8vt^H~vH?LlY(VAah?=^wLpNCK4h28VHGWc(DPYZbFyOq$&0$<&{9A8}nE60A? zR5!1-KF3Fhao9B%l_3S84yF#{*U~bdv;G@eF0;|16_M-aU5mJ1#i$52+I>w?SAdUI z&$Ig70pi6zPi~Bse`y3}qV3dUrf6U;_#v&W>0ge$g^*&3sqGHIl08N%Oqu5^Xt(bj|J@3`?en_ldpV#E} zZ*F3%P4{Q4eRn<(u?0?=7s+^#4fAITe2=VURhDS64?QK#TZ_B!r~?S9^B!z-=KJ1) zO@bvV(K|+=4%o{=!wR<-Jn+UqmG03)?`~4mRJlO;b8YHy?YRvB=eZC}?M=SAb54hO znp0r`lg|Me(EqoTfB2V_zom79xkGai^THh3>Gr?KP@5)$g#n;|jS0)5uK`PdqUVH zu4*Z?F$<##TK%{>5gM?N@N2(VbYa7y1q;rtUc*)WSM2X=zxyBq!Y5bGVTM%NEWo$7 zMCUgU(!GGE>pk@i!kHtk$jInm{d7~U2W5CPy43(vkWC85!B=IYQ_#A7B z74yT~AkM-HC;&=I*FI0H{V(J6>*s5yU9RtUQCA^a(SWwBScpEx3_tf~Qv>R4K)sz8 z+BsW;TV|{jJORrBEttrhd3m50de&&ce;$70=Fv&=f#783tj6zJ3S$<5=!g@tf}Qvl zL2sOsFjMia5dS9pFUJ3~r96v`KpXihJnMUxV+|x%KpN&_&W4use&EMDM?c4a|9s(? z%T~*sA6`Lyxg^1B^tEvAv+kZ z9|Cpv!k19auoIs{L&*hPIizjTS69yR8Drc`eVoFfxhU;h`D35r{nH%^sE!-A5#T@P zey(BlWP6U+>yhguXjd@)(}rVS$ybe3i6I9*|5y8TjL6=J(CjtGa|?|qT-B~w3Lt{*w)Joj*gQeXo~YVDIf+AOiP7= z3a$u%{t$Sv<#$KDDAmkN;}(0?ny* zN%WmyR=*qxAK$ks-)f}h`ENkpd9(Zt;+T(EFG6~K5UbP;6|$I&Rq4ybZ`tfu?dbDZ z%2PJ@ z%BuEabeI=!H~bMb;LXe6mC|HKJ+yx_Jau@x3;r14O$O(`wHbO^MN}jM!hG6eGtgE9 z2uewUuMDin#pJdNEbDT+-Q`QruV2j+M(JRPlWkE*Ky^P(bRm}O* za@unzIt9KUX+SeQkR@p)Puc_x=rt4YTy6lhy+fgAmc6%Om!N5$3IRcq7BK1N^1|xF zyiAyek#k_oJk0Und%`5-w?J~b4*5%_W7lSZ=!7K!_^uW-Q^+425EU-0BZ`_2pVP`e zJ=P}bQvzf~@M7d6J^n^M4(HE?z!OZmys~#hxl~QkTA5&~X_{v!GgI3R6qw4K=ojb;(U&*yAC|vXJD%;JF}v`eXjK+y6w$4lL6=$~FX?bE zL!JSe2T9Euft_!OiVFey_f9P5ZjMuDPA(nuIZVeyqrvUDM7$-qgrXYVIs0ssAv~ z6+Tz6UQpgz6t7hzS7t&dn(G(FK`w`!BS;$Qzsm))eg3ie|6Q)bdV*=JvW{Wj%A6Sg zXJ9025EZjv-N`FXbLm-HUlYu3#Mg8%!TS@ zi+$Udf4STM{$s#gfPYJe>B-eh==PKdJ#8h2F&B2*aemG5(1WI>Ov?6s3K$Boz-Fc$ zOJ1KTjHv}TT7)zBB2rWRA|!3Zr%rqg@}W_VfwFzfGvoQmij-tPH8o2h3kTYZn802H zL>eFk;M_CxA&5eQ)M5sjU;Qqq#=D>z?}BQ)3#x%LM%5b>_^kwuC{rlNX)f+yi1Ngk zWA<-g8^D}Rv!A{spJE0`g98KdDR~o3jsMdZ6$J+5Q)LE7ra%K9$C{R$<`;cr_e%Z% zMg(zMK8O?TXfH+QGf0h{m;Y&`1sGppOeSO!mJdoYWpU@PF3%1~x*vBs+?Br1Am1ms z4OWx8_#D=be(b1v1k@%uu7N-I!~n)koIM=~34cW)bJ@y^nO^a9B{ zjmDR}sE&aTW%?2ljOlOf*TC01qR^Pmw*S2oH8JL<*`EkJz}~VW^Ejm?E$XfP-!oHqf+aCz;3y0dR;TEOOAlP;W8fKsklU3I$W8!vWz#Y6baM{-rfCX$u&)b zdlv3GbB5nwuDG}he2G?UX3`npUCH-5kwUpj&No^ppUyw^`q;~%;BifxIi0N55(9&Rm2QXcIMNM{K%*`wy3IbX)8O!~ZuAV)U0P0gaTX+K zcZ;psputTVLAC9cy}wrc7^RtXyVB*f-XKo&j$jhJ_~bDMeup!7cJw-(f_Ilw<2~!t zdY$mUKMLoKUgQ&SVlEZl7+wUgX@n=qCOnPDlLj;{4L;BjbqK%Ux;SC->*fla_0@H2 zS%xnf8WR?R(U2|dSe#~(g@bV<1X@Q5cszkg^RNnUC zD-RD>0^TSo6KSj)s@i<`X_NQH1e0mL#p&UJ%Fpc0{DjoR`=t5KyOw%*)Pk=>u`v>Q zpf?=SN5AMi4!S|@V?~*Mksq#9NzIj6eRXUSQjcyfmy$wL(vSJtM> zBRKZ3fss$b>;4VmU{gth8BfPV0l)i14?k2H3*8WjBI13kJyCwGmwtEROo+?+dpy0= z+5&BA5_S(&FXFCgzg60k&#)E%{edpN;&qbT+P1+CqV0kQk(R88v_uvcDOm>z;|r0~ zc+>8|=HY>)QzEpAJM0$t!ooV^nGASRN(c_YY5L)yXfN6+jaDLbe*rY0m=6{au~(%3 zo3HxMMsDN#rEUCxxZ#e|e8vu3Efm8A>-5JfF8bY|r;DFZV!vDiPlq~MwL>Z)?OB;k zlpy0Fl9RqWOQ)0c@WX7tIdJQsL9lU>%B~4g{>e7$NHxFJCXT$6pXo*-KQoNfbsg2| zaN>!*DZ-7=|;aic5 z7vJg94o&DBAh_=)KZHl!Z z1${vzn*z0E6>?UR4*NOgBtyYFUGHdF&=S;kP0=Rd$|P)CJ(O^1^GxOvJ1yf$Ik_fX?6&4A@wLffdo;&v)Jo7`P5bWEn8PxwEyY43`0r%ap8GKk3Gl4L~B1 zS_Me3RLFmZd@-VNi4kp^+K)IC;=NFyfE_hJ;ZiS>&|trDReWVh3-LGk{9kizl^weES44vN$C@82JAm_YeQiY04@V|B+&)y}%v z)yq8mdU5+w293I=2oi-!cht|i)=jp$Xnbi^DD(tIUsfV6{a>U36+0okI>(!%qh2OXZSfdu=WrJf(P zKuQ30p?}GNXXgRy$5AZF?6UGaU*tkJ(naKA@MvwD1gjds+0NgCbd-ZtbDN@36-Md< zTj5t$7#YYp%->@YPBa1UL^hJ_l5+i4Cu^*brwE82EeY~9y?^h_S7sCTW8(2Dh{ugE zPx9+*BSy0PoS6j4Rw>`+wqOl{ktY82ycKC8?In)DI&6e=q(z*;3MAy*2R{0HX*2Rh zBPJ)|{ywmgBxSZ8Lc3xA1g;A1Bn#Aw_&6gtBh`jqFTW1F&;lvwN#xkrORc=Fk~p`Q9~FCj$cgyJ z!#Z@5MqU$^l-AKIG&SIGPEq3NHE;)@77kV6Y?aFz4t2KD9q$0aMf(C6lk9jYnv-6B zBkO=iGmSjws-ktM{2stp!9^|GW{ z&mU*d3?Pr7dl)rjDeq@PYTqv!ihkDq6Xa8$tJ?1hUT%S)t8BN*qHdCC0x{+{J@xhYK>MWQEL!QQ$kcu2HH#Q z$-MNPF^Ck&0NsWam?+`;Tc-j3mPVo<+F%)e>6G^n#Bn1&y9*vv$hJHY(zC>HdW;br zKHgUafBA^!6*VdMPokvfN)1??2?Y%Fm*vyjT~Uj(WGOv``!YcXhT;7IXi#y69W*lm zRyy=PNA@{6z!Bdk(Zr&ru*4G#RAGUSpZOwzCMfB?&^QSjdE;l-|1E)TyE z=Q^VyZGSZM4Q8FU_YjMQT;U{pH1v4bfZs3sXtu$M7f?$J6iU(1g0L9W2Z;`(LMBMU zMX~7k3RT`2B|VHaMzu1p_KTE%u`-*-x!}12WigYN#uRlfj-;FPc%O#6v6;dsI`74b z1jJsNfcpTia|QZBb0Z!bT5t0>`$PZ1d&<3$?p`61%}PqGw!Y9Wa4H?1@*O44^0E?# zUOoU%?vk?y45aV>T6g$1XeM9F&+oKEUogG|tST9Nz@eidxAHK}FhXzV)lp4bs ziUDe+OE1KE5^BeW-d~(!hCI}+m)l}ioR-qdzVJl)LV(>j|E5!NPK@(zk`K;el|p#< zd+_UR5y7+<_uUadWa%JFG*qS3uuojP+Y74h;g3tKd$TYL)ctO?Zn6t7e%GqtpD7^; z*ynJT8y`386>BVq!C(AEE z1g2Q%yfSMZ2Oh(=W-ZMfJ)&nqH;3q%67WtyKEj_b`ee5#-v*vY7mtzMJ}>vS!qlZGd(dk`+l|SgjC$7R$17+8~)Bf?zNq$h_JD9nQv6DYq(Z zP}ic(zA<;`(8?P)iQh#U> z?8Jrqii^+HBE`Zm@Bgcp=*#<{CbaIbmZmdWd))Q)?ni0uVa7!?hSnkpLCI-ztpv3y zb`YiM#dmK~n+rjifJNh&=^S)&fHKw^g@d3C*3jHm;H@d7=xB&4ivJ`z>k8Ru!h!n( z!uVY5)EoSxq+GWfLbqta^2B;OOSH>J=WRT zkGKb4cj6n1+B@pmt-bAb*b*q?%HrdC47j?cw*ce%EFUQyx!{36U2CeN3_b}ptV@&n zEFU+Js?AbTHDzyfX&8;|n7)B=J%Cc~1jeJ!V$l?e%LfQZ6VC~PFta_|DZCpnj3wgrG{?;EPUmwtNHYW66Hii{$ryAc{om{ zGWn=y4R{hf@8px736eLwuW5^1nB9mp=GGMYfIYO%(WXBfsKZF_19cJdp99}GU?J!~ z!%dJ@4nWE{CQ=McNXgK>M?-$(BYE*Uc$Mf6J)mI!0hE&piyx~r6*;B>XS{q8=sPT| z4v`!e4c))LWGx_(vDGJHH-^5J@bztdR^*=$u15XtI29!<8WAW862t+2%hpmOw3d%6 zrIFmOSMbi@H)4iY1*mj_q4QfsUNi~PgWqNcr{e4DvA3Ry)v7qkCPV%}J-1wHSC&5- z8jM&})SsU!{UMkLyGzzm4WPTjW{A}nC znQ(%5(z&Ggx)+foW>D)KKAk)?YHv4`%Ctr+C_94n1 zqRD6Zh=ZSwkmi^LnRFBIGG8P-5dyL=C-|q@J>UdeLh@>Zg(qeV5{E`OogP9)Nie{|dM-M>Q?0j-0@HjqF6p0giCRj1uV2$F$ z>p@WM$Kh{_s2r1<>-K?WAf^mv-f!yqLwBOT@M2PDv9;V0Go9vv9e^rqthFfw`2@2^ z-dA_}ER&v-1hekV)8MBQ5d0KGcb^y*2Q%y&o}Ks0BhZ zlb5!>i2XuneAf$z94Z)NV-YRnyf&jMFAF^#uD~05Ou$%UEJ5UH5AJEfV)tQ;4?X`H z_L8eiZQwsX{P74}59}|ka&jGFpSF^Rf6eRUjbSsqJ);ac)+zp%;9;94`WUE9nOLt9W2<=1C9>kplX_J?%1s&S@K zfCOa#9akkQ%>B`{pRx`(qf$tc9Qs2Odq>b-7cj&b0k(k>W+Q?uyv>mf(KA-~hNV@T z`j5U;OJneo@JXj@?;4z&z==G}FXCmZ!zQN|V+O7#6+xE_Ixa8V-yd3bDSiK?bm#sj zrVoZEvL4G0{ynS54viqy^Yd&2G*U!|Ht;s2a`0p~tms{KR=}QRsGru^WGVdKd}~1( zG|cqupRZ`pp{3V$XK8c=TEt{C6qFAaB3i804l3SBW?#??uwK!FQd9!x!P`bb&o?$; zQ2IAMP$+vC-m#-NuaFSY$pT_2!6%IFE?DK0mB^j;ricz<>v8%Z$#EeSYhwZb$dXGV z!otz&K7=Q%{evh)1E2B(|0IhpIPh$>(7X4^Vz1=Ku-F@9BZvl+{$kBAnnv=t%LIR} zC&X&}o)fp@_pjm^{Qh0s$bSjCBV$HQ07WfbN?HNzQnZ&Z7UVX;T6BE?_Mu|Qc+-KnhR08)v4@0m84VbHdw(6l3uP4>ut~Rd%(?U#Y|76kG*Jz z-6HN6?65n9cJaLZg56L?mYwYU87ofJ$+eBpaOPJ{Y3nLsY*@Ne2aK(X>mPf zl2=)WLqnb_Xw75WlQ!FT@8RnN>(s*b6FgHm3ac~+>i@FDJ_WXH!XExJ;~xGkPUOMT z4zye&zuv!xZ-869jod3Z9^1n=3J%X6{+!T+-_1hMqX8926;ALuLaG;EHtpfF@XrAo z!Mlxy^;EkSb|aFp-1jVeR0jq9`h~^G>vcU%k0lLH4C;Ee*6PY9&vcuc;gPS!Z zojeokBpn&y@kV}+SZ(*hTc2KzgcH5NHMAF0G9_^{>nhQRo0$ox`2sAW>HfLhhkY&9 zEnsX#qdK-MBAgeuKn`IEfqU!%a>et2du9qNTTIZc3hV?oH|gaOy>#0D9@Y=fWrFfV zSUe?;#iem9F0q#Yi-ExruuOPDc;+(U?t{1*+mcR(~*5N)(Xn{dY~1o zYr2rQ89pnLsZ<-av3s`AZ!f7<`?f6l1IWp<$|mPD_uTU2WQ_Am-+rl#ENotZpI49V z->w+jYMQrJA;K<=?Kl6^*f#6sVm>gogMKi!C*xz=5g*&X*#C0n*veGX0EHSD+h>)1 zu)JFjC}TTI8QTLG+Xs}fC7b67?YWzsy9v$&g^&AH*dB_*_Fx>g2kZy0stqG&{A!I* zMs*S#eg-&{vS~R~N>hL87DJ9Yn#sYdU#n1a`L>)pSMwEOoqzdnRqrj-(-YK9gsGS`?f}LNC zO-Q>L?J-uCSF&)y7)|SDgR0RT=SCJ&0B<{bn|eSpiyO z{2AtCsnV8>d=3H}(thb&+*8_#6A-N>N~Zg4BVP~tljR3T+w9s+BRIA_6_hR0PgF>u zLCR`BlV*&iAHK(Eu9VZ<#NAGF6LV!+xxM@f${^pCqhkG$zRP1rP{{;TK$*f<&%!qN z9-@-3i}!tEyzj;K;(zMQl#KBzhkGnwg)xc=MaY@fe~vRKBTV??nTulgdJnZ3E4H|>F zelfQ9 z86%+taG+tQ_V7F-x1eOy_ak|A$gqOc1V}wV7Xsu93I@m zbCvIsC_i?-b1&r@hg_7i5>#dq?m>Jx8TY%9|7IgfG79orv2bWZ6u9412j15ox;wHT z-q#KOKb9vcr$G$5%IT}^2+SF}HZtebk`ex{G zexF3%I(4$W-(L0`%;2W;**EP_`~vIbTl+tS)^?kvuC&pgmh%Um>YX`tvj274AGiT) zT&Z>?*LY5StAXDU0c**RIHjHVHXND_m{pnt_!EzW=0)tjt0@S{s-PTVT2Xoc(3A*j zgR{1j{?>2Lg`c6aojgx~Cso1Sst4rq5ZQxL49YV>y|EO!dL<1~rf`~%+(7?+2AR{t z_VDGRHHTzBYo4KOMA#D<8N4g#z`2a)AiM4BPE98~xrt|au$tJu|I+^)#tLBG+oGZ9 zf|aNhEAm*V7IXHti;w(PwWb}7*5(QS6{mBbd};v2UWnPe0G`eTc~S)Qy9%?ts^a_D z|92b;LVcWmZ4sIw%i>xbCP|3D zN7UxliWSX>-!zi6Nmkzz^T|_EtdC-#WcepANei6jr@R#LxW<+!@zBR{>VZBjv<4@m z+&^*py(TglrQZ=ReHCE)Wv7OuSL_OsR6QoZ8k-H(5yabfn@$kKs)*&$7mNToIAg8{%?JPDWSWMMMByA34r{Kkve4ru8Ta!`$T&g zWaIPjP$OD%SMoj<4z2F{v^*(mvfq0C`$~5H7I9?@qDe-A)%~ILe$o(D?uNa)SEbi~ zgm=%Y=rv0y3x|H)S8NL-YED!2=*J!g^;fBE7(Q!MDqGkTGjzq|g z#zjHl&4nBJP|Ss2)(udt8{vl= z)aeCF8I@btA`}pf8o>!NYHI~^I&?Z2_*VUod~gg-QrW?Hj{okYv;mrvEBuXgF;j3N zrEo=aLeVnC=W^oh+U)Eqf=Q|gD{I>=*dwFS#B7DdWjM4v3~F0NJtew~{!}Totw?aI z?Y^mk=oq!0@DNcip||*|eV`}F9~pws2~RwrXB8_*#)|Weahy?|OBx7r2M@!BZmcBAw+POxS>X24Mr%(Z=$O ztFWQwiq%L~aC}g}37!;O*|>;K5WSf2q`;EHvDnpe7ts@1oeJ_qRmXDcYtXSs(6KZ_ zUpC36IsO{%H`{(WTWxcEOjhu{t7m9ztKe;^+Uc05A7cm1HL`ZXq#JL=c_KE-0Xjf3 zRw(>Wb2b6{DUrJDrkdVRYpkidaG_RmJmy$3xpiRP{tZ$J(bvL;Fm`PxFUJ0$^+L!3 zA2Hm@OiccdeTTV2;D_4rOKAeq9^8jHTuD@5Ab-~W*lCVA_P~toh!m6HKhwyH5JSG^ zUFc?1C=0QV`5dDmXS-7<+wM5yG?WD$G%NMCD$q?0Z09uT34T_?dYTvBF@yHj3-KOO z$s(aB4f}|6h6?s>un9?w4XoJBITG?@AuZ#ov|AL93c1jPkaa3?r5CsdaJjx)%qJ z25@g7@Q-*I;TkOSW|(S{8@Ka5c!vukM#kOH;bKRu(4g9D7V4lEgy#aYwvf*IzzV+# zI=%lf4_P0^syv(<$>MUSQ3A%efHBw5-e1L+GgdS=VOLzhxp#p#~OuQ&N*x-z8wR7{i4{k@1sj# zJB&4xIVE)hlYd;7bjl$um1_}zHB z!K9Nz5vp~gKs8)co}q2UbC2@8Sx7_6q2-m|KTyXPHrMe54ko{I;L0}igSJUEsevZG z2D=7pVFl{J?=NH#dhod-lmF`g^_Q@Mu;E+e&V|>GCYM$I&lOCbj?(a6G!h*)S>>ks zuR5M$N|Al7{Z>!G49GELgi_aq# zJ(F)eptk**A}h4RO5gL!Td4P}Xdmd;FpQWAzak~)L)cH&z&aAx40sq6cszi9kVckD z@ShBf8rtWN;rMp>EUxKJ-o4!`c@R9ylag*^y^qX`cp-zc}nUW z^vxP0bf#CI=Vi_sOCBTH|uc}dPiy-7G7@dSU zF-Ms{p8$)k@{K6}7PWk358f)@P#QOMs`jm^9%BO@KW$qD^Xqnl$Xh$W8Me_DVHeHHGPtgDHIhRnw58# zX-$$sU*^{-(1A{`D?sg8iS;j&f3KuIho0-u^XJ6vHPaVs=v)$`UJ$#wN7$6AY1X?vg?;=`OiE;iO_bOog?Kru2 zK6J8Qsxg^pCSDD-#}qm+N0eX-h4Uh#iL&H_vas&C2KWz}fb~ZA9K(NLJTJGEdNDOD z?}j|!wPRgzU6{r1bvCVB+7G`Y3P#*5ttlOhFLxFf_`Lkp;=$*V(r-tZ)SoH~{S(^P zl$LfNhp^B0Iri=C_&&eit?;aSr25k2z%724z9`@-+1-I8oHCj2l z|Ex03;og764^H_9=9E?pPRyGV8HA+njqO3|P1N8g~nkL9k_tF>3D&G#~ z*K9x?E?*0{%m#k9*ur-Snw~$-*UG#4JJ9PwiFh$l-nkh6WtELn$zE+P%B7UXsp-Ig ztIK~jNbyy+MyUQXph}IEYm~lRIbN%KhnkniFJGymMU1U(z8dD zujfdE#vp!iP152F*qrB%$!Sjy3I$0D1%5FMyB+lC35EXAOsNXK>Z-taBrVRwoFAZ! zw_W_jZ>4xCLyIy4qb@xU3Q*o_6#6h%${#a0@MTSoF9y8x@RikLf&(Q08<`2RXpSVo zFP}Lw9B<}U{xb|z_^RUvjFplCot?oN8cTY!vKqeZ&H`BD?NtJ(G zdn0$~;gQaQvHOrkm6g%N8YZ!E_58!iT>lQfhPe*y;0=sy2^#Ti+51$p9?=Z@LZ8Gn zr}-wfIYquFqQzY+Z;in_Kdg8~0g*F-(QUCWXQYkS`4jNg5=c4qO1Flkn6nk>PRe>P zJ9|`?D=T{(8!~=rz;MbqetaNfe3pMO{NH4bw*>UTq2q0VYsNnkh>f2IJHbBKps6bo zJx;d*Gq%7gh8b$lcbX7EgX{u@+P`*w>13OYZlQL4V@YjNa$Rjz<6+!|`KPhwW1DsI zlbl*Z_fH@_H1jf%{^ZF$4EmF(wVU@KH zEBRKL0=&^kr5Iulz`}&iAH&y8tz=7)w}lHmu0x^Fngfu}OVZ$vGtm?ZEeXfZl|h&G zhQLPc^F8WH!Y(!abNfa$H1Id7Pw?LgPR9w}BJ6VP;cp4M)V$_@v|n3W7Tn19ftuVH zpnDqptPfH!YjV5P7z!dAOFgck%Ur&Gz9 ziKt?V9fd=3n>w_uP4FU}qH#-& zyF4fOQS8aRXMC3@z^_6wbSKAzvvm!S*}jF&^v_BeImnA0bzv9U_2=qOk$z6_pp0Qk z8_uDBfj|R42T1%Ckf68lecb*BSLlK7}=IPy2}FRFDtaxLXK8GZ@x&I^-$dCHsfsOuutg;bDntktlF0aPgJ zu$r<8XK5NZN4_xf?cq_ujJ{Le3+;+IwK&^Yi!*KDj&nrfkRI*? zZT|vxei~CWl;hXp_ZmN~gwM~Yv#o5FYSL^BBlBiBQPI0Lxy@6sCR+@hm!9m~rJ7uS z6JHM6_;sbOy&1am@?88EAveHoXr6cz;sKL%p8#5_kwY>2?qH*Mk^L$$Ko~s_(qb0A zUsOq}xMscxU$1V#f3can!B5Be@5*5Xd$^%3wOgP1;MC2am`^y?mnM8f-@uZmn)v;h zUTTjfS(F{=Mx|UQ`lE$?XEG?L(;=WwZ$@?W+(gf>L7wuW->^t-KhtQu=y@^=7k=nO8 z;)o(+U^MjD6HxQ7{|z0VTX_~1<#U-vzBA?lpBZHm3TSKyYAFiLC=Q!WS*?!X$w5<% zq;O3=%6zJNfOAlP9>#ep9dH3ghWx{(Sm-uRax0zV!k8&?&%^N20vmY9b(8z(ortwY zlN-7pd_7l8!PlvZ)D*-y1%m=fT1`<)Xza2P%Zp?O;xYTGu%?g%c}ye-zH?sy@ens@ zHfcBMHc?skKm%PswiLCjC+xyrO?V(R0rm%PVg>>`8sCJyX)|_N5T#cv!9NZ9yi%}0 z4mq5wU9XjA^&ze=a(ekw0#VR2HBMXOG=;-eq3>1NExkT3Z!n$#hRqR27i9%rM0{cG z*6qH*?%3FbK;l>pPK;K;&Q}9G7*=HH@bHFe?UpvsM#|}d^%hp@{epZ5GOAQVW8I;Q zb%!$69ijkf+NwxrU&DTC8+MH9_}5I=L2aUxgp(wfcT_gIkwe(te2D3{8Oo!&lBoPCqN74$+6~oT4=uxac;q3~E$!{y~ZLh*==V6OstSLZr0j-tT=%;hx zL*%2XoYi^hy4zB7{fqOSY4P$W#43y>t$Io3(#T(7)eEV7bWxm2tZp>~QHDi3cH~FY zYhzh??g*5AnX-JK$k8z92i@?2eo#Hyk1BIKd0Bq)UOd^qs)aO0?z~kk)SDCHO=V5+ zCh>A-GyfKC`vkqix=W-na2bheJ&e|5+o(0$`bh$8=Jl8I)hqcLE!P2h4VO|IL~rj} zoc>MtyqT||)V6ArxkjvzZ%HM(LR4m9TY0<5tpR1AQSkEl#@j$mOuIeMofzdzT^?SY?e-bO{UD#NgO?n^s!3l#0jM z7=64oD{-pUa2&nBXnWu*+wc*3Y8vCq#|SUPY*^sPLVZr@NBDj@Xs?;t;5mOhi6Dn;@-C0uxw;OD%X1Z@R>?{pfV*~EY0L>lgW1G2M)U1QQ<&J15=>X|&U3TY)e=6*_1N?u>I-F01Cx<|F&HHYB{9B`%OByl;p0o20e>Vnx2j;N^1p;$L zQJG8gq#?2=o%B{g#s5FA@XsKfqG0&O^NQ;mSD{O)c3wzKO2m%H7arF5eMld}xxi%N z9gra5<)pAry-&lP=6J0S+yyh9)<7=fYW%y5k9YSq0`4mJ(J3?JLlz5-RjBM~g`*bM z4Z{kCs8c=0q}E7&PMAr9l~b&jM(p!S4Pv%>`5VTfR$*;DJohyEO?5&?U8AWEc#AdN zI-(7T{iEox{sF8ifTKlOXR>z9Agl?3o@MSu~QqK$+{}duzF$ zLAo|U!v^gQ&C0tmAMO^te0}`?J@|i*NIQ$Pn|U9`h*oB_W-Y*+nIn!wI|_@2UsdW5 zl=^=t5v5I1N}E$@su8+p;UwlKl13hdQNmnA?ZlNntweMl@A%utPrnH#37Nb*YMMvm z;c#OQ7d`tSm!>^w`8v^`uFYbo@ zfB-88LFPCk)&MC+i(e;pRaCii#TJ2m^^(AbH3`bz1IZj@b>cciI(_(eI#gZ5?W6NQ zbPs|Cp4Fs{bz{Bwa<@jCGIj*ki&|OA^F001guHw67PPY=V{tmJF6ESQ?A$;Go-cX^ z<2UBX#P6WG#NbfeC)Qnq-`nb9W3N}vnEi0pw1Uf1od$(cK8%$uM$VG7IC(6cL;k?> zH1tcVPJmhnJ)LDRC{kLWKsE@ZySs87z6*K&I~a@aL*Yva(nXc>oucuinN2ijE%s@w zEp@mvGwFP3TptomvLFzRe+WJsOu(SIOhnsYRiwy~zZQ+4v~%%}-eg|!W{9a_j)(9)me&X~@;q-rx zukPu+SJ8hbLURCkV#bkPa&1-n75N8r5Y(eN4h7zTCTSJ_)dHJHhacjAO#$KWo1iYt7 zjj(hml?~8=J|wLMzwz+*L8D1tQ0i26NoamrX6S(x(a;QNB~*Pg8^C2ar+FlF|vi?oio*EW2e7 zqjD|Hd}78W&PYe7?YuBl5diR+X>s~~8V{HR3@uH!XZ>w^mPQkagu=+?1 z!2T6}x@gu_2Qtlb14GP91H;VA18)au&eEO;?UYa%f+-1Q%z2wA7j~CSsrdJEW&P-d zHd_GRdCBhz)>#Aj2P4M}Y%SuOG?C>+wew&|H}3J1x3?Kn6jXKad17~ zDm40he4DTx8|^;+pSYLe-h_J@?mKX|u{yrBDi$h?#X=Vl6N*|l1Z56+TYXN!bNbu8 z*!NF0PX=UgCagxb^oB0r^uJW2GabeA-(ciVr?=@_9rA|`ZQ~1IACnd!Pg!)T(}k3E z@R^bztwqZPz;JkQTby#Z4yATCYgv9O_RUgz_PYdm4ScwfXNQlVbB7EG3b+kgFV%~J zQA(3&z5VW`cY}gz%?bEoKm6bX$dO);MDwmlukhV@qn6Y z!duCewZ4M&_A-T@ZACN<+S&OIzdON;=LfJuVf=3QAyDiOK%b6@YOOS`cO8QNRNO1j zSE6K>aif`UGd5vXHS_<(y%hH*+{o}Nj;vWJjrfIx zlUJgE7))6A6W35{&P0tviA#W{ZfP%-5jb zqp{Ik9{*_bRXFlz>~IsuA*eSf8ZwlCh@gn+1lTklRN*uf&-Di_dm~sqNQ&$cJ3V*4 zTT=HV_V7BZ6LzGPUMQp%0d zKegPNfig!@nMY9O2Bpk~me)WXZ?=)$J9PTP8(M-by`i(w%{&8A#JvFnyk2}@Uw?Lx z$a*vj8*uM{-k^<}GCKG#aWBkZJ$0^d$QW+3GxS#VSO|L;;cdIHsN=iLjJEG|8BIMa z=AVRhZg0rZPc}JZ3BvLRDfl4dCj%c0er-N{qhZ&_5X=EauzXE^H>{<4L$mvHgBqN2 zOz8?RPs^`xwq5A*vL`Pt{@tR^f%FDS*JzObeEX(O)C7ye_uxkV;eNKc5H28kXN4(^3f8@b0!fsh3h%BY7@@CUOxFB4jt(|L-uCyKRvR3MRN(FAI)@b z@6Ke*yNUmt>APno2&1=mPtv&%bJ>l)JPr?Jgv|>B(mX=}?Nb=APtmeid+vzFIE5q! z!F7Hy&O4r~SN@Cm{~Xsh2j}&Kn#1*I$BzC3uti!NH~_EtkKeG)K1`vfHi2c6gZ&ZOQkLGqyOrzWa{V&3dR(ztHbyjY;QuV^$NFRZ-DGz zy*|^t*Ict}DlU2)-f3EC9A;3qU+DTwg)n1XFR(N1rx9yi^E$O|Tdy=*^gRdfXxJ4% z2}1wlwQD;E2Zv&>5RupwTL;nwYMMa9)SO!!cqa85vSr!DBoRr zPB03t+9zm*QoC3vni5C=zUB?!>ykCVSKp(At=;$?z|{k=U}C^-;Hrt4GJ&U`e3vnR zr?vU>dP8Y_o8tCL;6HIJHN>%02P_@H(1?ivLyhp;lqoRDj_bWtXubzADI99#y`j;4 zq>D*tM``fm@tl(TzSzUH(mbK@Or6IqEgbDq_sU2Mo(qp(bvU0Jz2kE(c`VSRk`{@L zQ%>B&x7QzduICTm=@xHdDeYo3b7&ecb9KmIOBOp@pK?V9JDE##Nm zDF5hQI`2bYpZE@^9&$^%nQ#MS=$rx}y#(J31m|6DVU!(b z(O-AH3QD4b4|l?vEdRB@ZtR3A{@``~vq;mo|J`MpN4Ye}g*hiNIX|2QISP?Q|_uCPVnH*{DgD*si*#xDGSXMYxedr;dq}~z1+C-Ogi5xoG=bX2dCm&;b9*pQWZ~Vn7RudUi2I zX2=Mft-U39cHYI%yNdh+X$|ELU{;1mefvq@_D(_mD(3aQ=6ZegWLwEaR{eTi%{*!o zT8lPl5hILnFDuwtJ2Xfoi|lx()y;jcuU2!vKCj9bF?V;Emr##dZQ6iGQhOvwYzwS4 zdz*bkO+ihdTPy%2Af40ceN_61_5fnDX8C(V$9iextQfhkI@R3dDfff9(Fi6)iDQ8&czK7#IJ-9RFf;KniAHrJCh8+5Xm^ zLE3PoH)<<}AlJ}9`lTFO|0xH2lR=)h9E3bD&2rG7{F2^%0wNX9aQ23_z&FNBT+8}; zL!aVW!6J3BLRLg;0F-?vqX42IZ-fAL2o9nBhluCXoF%@WkGr_ndj1__$etue zdSm$pQxBg0-V3kAh>=)vvAVXzqnv9h83a2CSouc&Izt5HbX{%2dOlqsT>$wl21TrM zxDDo;@mz=W+~W=z6-onQ2gRgtno?l>3oprrKwHnD*^T&Zw_sJH-lXbDK!Pyl zl#*k(j`L}zW4IdJG)GuI8<%u)W!7^j=b@>|C@0siDXZsNDl4*1^?&6dC}H#0Hwpp)~mHgIk6%ZSw~f>LErA79c2DOPJ^soY^O zPdYA+%MJY2E#|v&ce(Uk3E4^ThhKuSeiBRSUctotoA6v2+m%f^AZ>|<|JZ22e3xI^ z1-K76KF)ymq(K<&i57Qf-|MOP7oeP5MIrvY+uc%`;K)cDz&@zEVkFhVSLa} zy@5qfDy4kTQtzq^ujpQn-fou8gSA0Zs5}~+XdLD{?jN|{rdlUl%L8%d#dJ6P5Gx$_J9A_?=Fw?xsD5+*D9y5 z#@i`U=w#pY^ZSgArP_|7a=VA91MS0&vRfNTH_7DR^@@lUB25<%n|TAUlW;Tj1+UsB2G>i{&oI|3aYd&a%P_8{{_L zX*3{ygt(W7wqjqIWN6hx84v9{bU~?Et;L|!A}F;?7nm$CRTe#0!A3RPNRnEK^R9;E z)4b_fVCAaBuJ`o%o*lKD;6e|36M%%lf45Bxw7MD2uBDv(Q8wm-sh-9T(c-kh*|{fL zwwGS$FpS*iZbJVP5lxqRyD2{3hXyKrhH<*%H)XE}=EHvwyoSPmSAV51i6>YswgtJU z$wW1N(ZWNI#0=d6ZzU_$ls_S{tMRXcAm|Xb9c6T{!h^M+3*ZiV9 zFWj#3g~_&Je3Q$Gqr6OXa%{%Q*+eIS7fGO#S%?#w6mVpL)>Wxr5WRf5^sgN%kD%J8 z&rAS>%GiRKnxaUV{9w5|jLVE(y%$^-CgZw3|6bKq-^!INaqQYU6XasdXDi`-m zM-=up?VWkkT`YeED9!r#TunRqG|knL21wvU|3#vaabD8hk*x5NWLG`TOVb-FLjX?! zKRNskF5)Ne;9Bd(c~*s=Y*X?nWfng;H9;xUSXPJGOW&)!j5di zg?2M(t(%QYJDEaoJG^l!;D(hay@^w~((VoeB4)R>7+hY!jozRXz^#o1;&2P_X#(IT ztaYcjvGN+XEuM>|qHTw_5!_Iwp$uHmMBgja6YwriqZxe_dD}iBHi6W1I;Z~h^L6es5z@{4QX0 z?yj(bc9`$R^F7QA?)VdNn8~!NdR4{6owa9HZC{0dE2~#3|5k2aIn1;Zy7isVr&G#K z=+k#X$4;r!@iYUMU34s{xM+7cJUe-yawk8I>jbV(aCPANw6X#A5Dok^p1;NYYuq`m zFrK$oHSia3?Zov8E+;M*t_8T(Vy}Y*OM>cGUsO68qvZmfvF_f<-Qw-vdy04RCE{1u zKVM$Chu61##!@4!Z+Aq#uq`6@-3NaI^=&V-Xpsge2|KyRa<~k7C5JTF0pAaSg(ij_V@Q z7)H_2=>1=e9E}={o;q6fZ7i4{yf0TB!T+1lyXM;yoLdG)?cUX&t^WUd5QB<(Bwh^P?^LQrdc}Rj=fK{k~UFs3>9L=Ea$xl49bUjb^ zF0ocTvFcn>V(GcW{Q7gLscdwr980P=mpg7t`1Rgx;Wzp!&Slr&|1ZnWrH)JOO3i&T zcVk(sWkh&wpLW98kJg^kq+Vaa^8Xsq&sThe>opPmk>f2w*YU(sc*7r<+ zpOyMW%iDpy=QBW|j<;ZageXHg(8$4U8>imv-_ez-Io^`-QCc?IojM+0rG{>S#|T>g zFvN;X?G`}i{vXcX1U{>oe(&YCcgo3I!{Aa@cHW&&uyEiNsSNgNVn)w;CWc7muA zYjqL?2V9s0(13_R(W2Eh!KGleCP;jVfJqcBsBLEe`vaG9p=wxaorEO!CX;0T-{;&J z7Oj2X&mTUSd+t5kbGGL^=Q+<3v+aVNmdF94{$?~y`TPKJ5vb)c+~tpLvpqc1V~mRL zrjWN6+p(x=HlWXh^>U*vYRu-4898LOiB!kHsFSvoEWqZ9mjZ7OEcTg+kv(g|q1&PZ z-L~kc?EfRo+US$y-;khQ-gG|94EAfz!u{!i%^kK=dxYwxg=gT`-xH7w%o2QQzEoEf zej>@cCeHQS`^tK+Ww6yD*szDkzM14{}u^f>0fS~vk;^6}+WCde$zWa_C<5`7P}ow^?0p7w7uIluT!$X|yOJE&09 z16hac2FwGRnAio$Zz@~=FCfwTUx>YP@ z@ET2}Q16U{Bs@V!^u)o8OilRsmI+KVwvCL$4BcU>C(`_Q;~0;Wo9VgB^O^@ILc`0a zY!=jW^?@5+>l6$~X*(Sr?UANS@+!};^w&-?9_yNL;0E|CWj$dBtgfDpJ<=q>E0-(^ zo{{MdrV)c?$~52evd9E>how7JR?AQ)NrU_`3mgl zg}XObF>H)O~1P6*3!8w|CZ3riUr=?lFSb+^c>X-PH6+Q=zB9*Q<`k$!OFU zjuO{|#%NEkIcn-G^z=Z|vmRFG=w#Cie|)a4iz|E7=uo})NSq5)hudSKr@%`Yx5!c0 zx=7AVf81?4)C+60#A|kVaJ!Aaw)MLAGRVdDIPWcl%~mJYcPVr`X5()m=v~nhJd@^0 z+@prqkHl?|G1QbuUw%E=>6=X+jILWhulv3SZKrB7*Wrx4K@fWGtNdw3L(emnwSdR! zIkygLNqWhq0!Dsk!Hu()V193>H*2<#%_ieHQJ9#9njTyK;rd)iw%jm(BfQ;E&ASpc z-#v$F_S{oEhw8oGa%%MjccR{TCs$|MdhUDhl~Xp`Ydz0AcpGk~Zu7jE$aUK&Udpz_ z`@*dLmAHq*O3Yz78?+l4#pBjmww)5;+YB%Q8Xd+6Rw3@`7?##Q;>#&~`R%s9!vCDkqXbq07Z_YT%u~qVFsw0s#?Cb29&-)Z z*0e(2Iuaf*aY@qf0ObTfJ1-Y-lKeEnIk3FcdgDn0d{PlTAi*0EV9O(~M0nDC5^!))p-4U?Kx#7_YL4iAqyiec>gZ!yj^H|>BI=F0gtC$nwK7{ZU zqxfM5NwhvS!0m0pt^w>ZUxH&ZI`q6qq6K9_|Jn!~V|Bn9%2Zo; zBcz8)o3=xiL~u|Vl2;HyR=Lp6_ryoZ7M4*~!#y2jiC=V3zu3?(M)XVJ_K&u;pSDbC z-_~~8GEtZeuVs^yLPp?>U9f~UHDm^dUq~^89e9fH*C9Zo2;LI8zd_@a@g(UoMGTKs z#3>hqgp)R*{Io?hqTk9-r(}mAIl}uOM+&`r+G2kkcGBZt?Bl|aDR&u8+6-e|l;`UX zor@skoPaz(?=SSsKNDZ=2Kp*sEK!OeSs|~=Y_Mn~qfE9Ne}$OqwD*#~BqO*9sS2$4 zgmL@l2QRm6WRS3yfcq-zd0z-ekI9$9`PqciheL8_UL?ns1xc`JO;&!Nh+D$Y82lx$ zd4@mQu@aP^)&boG^aS}FgvVZ|tM?VJf2Kttt_fC*3+L6|J@67no^&g8xaTVZ)huVv=H;Xi>5!niOH8K^ZYoP}s!S zk-Pl`yCKnneEylqKG=bGIb^~OQdkHe!S05XR49_#ha%TBECLr z)wZlDwXInbvnicW;ITw<1_}57P&uRiYdKV7qMXwx9JdvytM#jj`jcS>jF=?tgbhO^&{{M$%)>ZIJ1O6Ffg za39W3DaF6LMe^%OsTt(UT`AB@lcf@(k4Ev^BWp?9HW~>rP{ha4nm-4#O^g_=!)DK( zoieI6E6b65xLC1aWxEu5GaSB}Kd(51m9u-+go*i=99rdR3$WapBtt&5b0Ra0-b~zC zAM(O_R!ywlEgYs@8oV0@3~MGYKNDIrJB>`gs~QnMEj@xTq$K;26L)!?>q&B1?gdtsQ{XF?PBK9Mtia$UV{ev93%X zq!7rWIi)WNv=PrWGQ-SZ6AtThoNGd2gD*8ZtusS4BTh#E`smz|8qL@mjV4%6j;;L79g$a6bJ4F@Eq$94@8~D z!zQJ5mUJujOmLi0KmH1u;dRo}?jP&Cx^+is$*tmn7^rw1d-|J410xwd<2XjT-JcJf zq+}8o$rAbIZNi_Vca?rbBc=^r z!2!z;)F;4RKoMk*s_|^cQ$XvBAQ@VXXFHxj+;_F%kFCM(hCgA=IOoLHqBTuDFRic~ zsIDF7w70g^HsUQY3je890<_#Lz*H`*PYcIXDCs|aBOPr(N)Wm5Oh82tcsAEG?mxlO zV8<^_Smq+@DPo0Zyat~j`IbX0Vqw->1;_7jS`{0q@99_gPI541~wwdlK_^nCzcP(go8&0l|mVc$C^oatTvG1HfNnrv7eCabS)kKK?GH zVWDh=M2@X!Q=@=Evb-_PYW> zpD<~JC#^}yp8$%EG%y%WdiVMnWESrVynD)>MmMxiYL0@j#S=q!`0KR8Ozg~u-I9EG zDYrxx_8Dc_KdEv!@;Z3ld;CYkM?0?OvDf#Rc&sn5)z@~)CDC0%P;+?4BlSxXNsb@p zbSq@DAXE1;yrGA*tx^MiUzd*J7jA{h>$GOczT^)7NV^^Nz>1nzzX>9bWP&rBb_(35 z>-Rx-a3AW`nKG|^R9{}zR^JH!yQMX?HLF6}9{D9~V?WG}jl{IO?y|I)F&6g>l33yfGTY_s|aOKS6o=7tq%k1**k8VknM(kLiQY3m$& z#A|$AV=k*>9(GR_F?(vs*rJk{+Ofq~ zrzy+?ycIiA63O7Hx59@~2c%-o`uzN-o=!42lX22lpmq9ldNSRj?IQS6CXai5oB^qv z0dwVHnZ&%|YD8jAeR#nXS{f&T$5ZQjv}MWF zC~xQkU&pbGuj~ca-xvr4etPSNvthj{zFH#HHQFoQC$%r&6%IVF0l@*yeB@gQ|EpWz zapw>4ce4dPT4L%|ee`=<{QIBq{SE&8M}1o$ui0!&%sNLv_Fv?uyf1l)HZ;iwSQP73 zza2o^I=6^_m^P>m#$_9+$NnJco^$>n{k5Z^DoJ^z%3fttASbQBinCl_Mc#ppox|WM zH>UoiPp+aFtcBW3pnL3|tu~!l8Mld`K$-~EIv+R1*w@;GbapoX6 zaMMC6+EeeVEvwUxu;I5l!1e1Gst4pp=TkZ>=sKe_Mb4Fb)xN=c?)7#b&LF+&!Pv4= z6&@t(f%%!BsQE#_bWq4^SOWlm>fDo!aLL{B*XML}i_j7Q+8<5Kn{M zfj-LWgPx}kGYWpwhl%hyggv9fPtcK{M#8xU;1KGW3 zDPs;{j9Wr-faU!;Nr0|$Ox>)_XmTxs{Z8gW3yC8pfb+quG|Tn^esj1^YmcwbkC}kC zf4~FH%Yzm+8nP%u>K9Rx{Z9e)K&3sPnUq7ROeWkD039OWM4+k%2h3O(ln!2W{pqbU zBceq)584q}KSS!@Vl^JUoSU=-m{%3tYNfz$QwoZ2fz4|DENMqiN-1O^VMfTv>z$!d z4TS5(2zhKHY`LYszUfNPJOo$&kOqA88N5Hy8v9zBh7ZekBogp*^AJ793ZG z&xK3?l}CMM4D03eMDvx$HRdNja544Y(H!vhXl!+eGQr=YHyQyUWi-#(0osVl{tz>W z_;tx)>IX~cvX+CT6&~hebyU*6DA6<86QQy-@F1EDSs;J&U*=FgMIsF%dI~r<**ux8 zHk^ptPZe=G&ETog94@-05S`rzjDFBEuBWgr3Yt{)CaqV!yPw+og=>qCw3k131u>RE zZ7-fjTn>C0hBc5}gucL+uUr;JB#3{fts~HSt>-X z>^CR|dmTcT@>PBaGmmr=KLh414t1+vzz=1;Z<;3rFQ7f@m;H~BM{G@qro$t4fu~#j zd%uAAHrO)>!J0`?NgI9#)r;V_gs@HsHa}!|#=hhky+o2@9aKx8wNEg94r-RDl|y(A z2ZSvJtn+PAm~0GR2kVS&q6@p&+XX5t_*3c@>Ft7ERT@aKTY%dfXeGX_G*w+4{R+DljU?H}gQFtZOzZa1AnxEvcUh6B#CBE-k9RK*80>T4Rq_iC zGsX@YY^-ulX|MVm{1H;FLG9b0U=_0= z{$!E$rBkbn*^pg2BIoprU34BYgz2?^de^8i2AnwX_B{jdhv_J7I_84kMG)Wkw!gV;jt$aq`c2SQV378LYS=S`bS6gkV+KntQ_$N} z621Lu|5l&XK{5OuZ?`xFqcSB;*23VoVU4F^^bC$a&U(^kZGBhUBh_HF(ufk5Q;e*P znV`!mMpnc~|8+CQC8!;Ckz6DB%lKVsHF}nIbKDeijE5Tn=yQL>sc`*_x&hcw_XG^O zAWY@XKKWf(_uL_i%NRJ>Vm{rW z>HYSh?1tUvHaUpjPkFm*zLVdY{f~}CXg69DxgOTxpyiS4#oBpi@E4GoSdmOOKdWGQ ztQTIfZh;@=sRQ-!%u6%-7^DIW@HtD~e1%~`z63}i*_IzW!Xh`-Pzs%A!M=g=1{2;4Eczrh#7xc&qC?(op@%t2M) zvzd16w0?6jmH!VGb6gM}R2%vqMff+^52~B2juBx;-~{*e3!fK#q%pzrjEaa^c^LB* zb&#Y#r-x^>7_YkOstX1$170C4u8*-H)T?$zukpOl(W`zFW%lvdZHxPRJI1`JrxJnZ z1;^-62DBo_AdaxRH5XSWb#2-y{C$hR)A&>CKs({Dqb>k%^fsiFVSUww7QY)cs3 zw=OHjGbMat*-AWzg`Laa!_yLW28tghU%qq$2+R>;_9wNEz=sk-%bIKo?9g{+2>%cB zp&E5E^NguZ#`H?SF1?e0N;mPHM+$E}qnfF5ZXL)Q7p~!(8+Tdd7^N`52yx&TS>v zI#s4CrZAoQjDW_g!7DA-y`9_i8;)}fA-Uy-lS#mIzZ*Q2ZUG;M1QpjCroK3h(>6|?MZ5QE z$2+KeU=DaXdht)a>g{|D9>xfM7XINGuhq{-&1<9cp{actXrlMAQyXB(Lq8YMPI%c# z#%6SX^SWnly4=an6f?TNetp`q+Ts=6$6hz$d_AP@?6>goB09Jm)NUd8^%Dn=?+ky% zE_|N1JF#M)4qpOjkM#w2)^)H8*N3LfNtgALN^QuAGFOL%K9UeNOu|0 zflWJ?bXc4#x-b6I54A|h!%3)qT&bX}P%@Mub$qlC+?{l^Y!1fhv%YIQkABsw{y%;O zOu)3F``R~B0M&0`MP^3#HE$Smmwc72^s0OMlFmRkqx*_C2)-5Fm%gDxSab$L13!BZ z4IoCA#9@6I+_4$mS#RL(h@Yu?G!^}<(}~|b2^e#K^pzpES6vr}icX|wd%ocH6X*22 zGv4#L@tz-ocg{pVT^{fGJ9*usUT4`N=YIT;b_jKE;xsDNeFZ;-wD41iF*gS7(nwJl zJ0FAeKT+B&7rWi0)zI(QBPG|?1ZUN{SFWwCS-G#aeI@+s%>Oga;GfA2JfdK}&A3E+d({v7dekG)UUic;Sy_Tq$IhhM8&Aa?--b?h+=IA- zeFZI({6^(h2>%u7G|b-SzFu{?He7+#{h?&VHZ>TTTyx~ODKdK?YVPmr>r2+=euTc6 zIi&sqHY5Z)?jj>{!os=T3f%n!I3cvJDU41Hd~Tv&huL+xDVB{jErDYc zIf3yZn_-vCNtRb5HEv2G*g4_V!CHt~zK-dzQg{!-v^)KGSl=Bob66?I zpJUU2l?GwWWV7#rGTLR^*6v*b+kZj5EPIO$Ha!{!Ug zCs=18hNT6HxM%fLSJ7fh`Ls3++`k)nOB4JDIs*{@^FO!TgqGipmOmI8nlp^ITSU7@ zpK14?`WV`Vc0)I?MREb+yW;Jpa4Et@Wu|iB(U+AMlufwZ_}}`#HDuv^K)J7pUE!f; zE=o~m(W=|GHoPP$Idv(mtyGWR3q9%%cm>+SJd1e?;?@~@)OAA#peafHA^7Wk)Ow66 zZ~Y3s^AI=f{82Wdt-a8Pd7sa{LHMS4cP_?I840*){*g!F#QYmnKSh|@L$@`=0W!i~ zEX`)}fAD=?&;V>5C1&EFdT2FDlf zmNf=kh!JwJ9zc1Exd!Yqz}&f3;7{7QgvdREe>er5{ebmUl7;-06NL^dbwCbuH{GqxnKS2t9OKO7v4CcHte_m0c2I`uUEN>+ew&ZWoM2f;*D&{oiN4AH+D=6vhZY5S|EvW|-kl;XDN5A0&3h zW|aM*)}yYBm%kMDBa5SYUH)ApiKM|3;c(axhV5vYYX$g&B%sc}-rL%vI`}!{m~4R5 zN8&qlZ=21Y6Qz(5@zBWXyD(Bn==QTKw3k-s1UqEp`1)jatl&!jxXpp< zXnjt?`ot+*oP_lWd095eI;pYe(G?fA{>iQ1=3bL7ljVuT>Rf8ztCQtT&-;BTR;J6w zwVGcj{To#~8Stnh|?Uujh>!4m91*^?wGiU{0 z(&`?YpK%4o2(EU}u8N&xVF4a0VSCgtbymm(YY6_`Ch(01)q;T_xUih!=^P=@m#+pA z?`iz~sQxaMJ=B03J;LNifywQJ$)&Q|@})`14LrQ2_9(*k`+1t$^84|f!Z>+Yc{!iO z%M~7`T6WZ|T4-3+<&uNSa_B~1S(H9E_E;;9hLYRm%;Y7Xs zAG)6yzzrVGxWiI##vM@CalW;XSAvrvmFEO!^=8bDHJZsoErP4q*YbxK$$wFZCN`g_!r=sfTyV(KlBQ4t~+MJqU@*dP0!0kq$8Tfq8^KN#JBGRpg_ zJx}2Iw`dD)%?aN5fLGw~Ud!Pv1-y?SMM@lABYa2Kx76Uv-GGChO902EVSPRtQ?Gcl z5kBt0VNZqh(P5@Ilh=SleD{ZVQ1?+4ZV=v8yCnnUM_tE*vA2N;4y?yr6u(#i(= zCFreR^%JM&S0OIz0?ybSVK;Q8PZXpjZ96qG>z83%foR8J18Ep*KRpch6*q<_Ay*9i z>J8f0a-Dl_n0U)N&yh}sGedt;Kx6csDI*}0*zSVtfy$8#tQ6fG+B!^q3z>?`daDVhMEZIU9lk?<~-3K{^&ZeYcUCjmL zw|%cYW%&Azro&RoB}H^-o6o?#?L4@P&Vl>oLz_DoXs*|wCw@7~xulO~+t1^(?PojB zoom;9Z?2Vv^O0vCAkybr(K&PNs`KPf;EOdrd&VQjsevgN^>GM&JunG=(R)CD(C$r~ zyR6V?eEhSRIwsqkaIL?2c)myp}aZ`#QTom5qRH9*Sv!jYtZK zz*YY)MT)B7m=DI*e<8egA=zBDw4N+=^==YR;P*?nRAMcmvZx%k$px9UVZuL3T@?lR zZXPelqm@rfw{{9b&}S_s$i670dCDNaHq2}e9YD>jE4!c(vXQ`=(0&fFUqf>SJ{f;E z(aC#6o|vEOoEIi-o9$XehR2Xh@-6N83|@!8uXTrp1K!gJrMK3429{-?E{zlur&jIVJfLyXv;^;B^CuO zJ?G118PqBXe&io~@-X&fxur!DAc_QSMN9UStaY5;l;V6(|4D(#4=8=!G;!amEumP<1*(r7Qu0-oFtA44?wRj%$L>^n> zb7e+W76j;)P458<*52NyjE)OKy2LItcEP6|0wqrUgY$Vsm-=kq4)3Fo5r$T9hn-b+WO<5t5@zkL?tc{Wmqi&&OzUMS#4w=L9sT01AHbi?maUwS6dyGmQ z506H8BgcMBDe>fbUhH7`4WZ@=2HG6A3ll%lzLZfH%kh*?xVdR%#Z%DOeAd0Hbu3Q9 z22UHXe0SK`lIeM0Q(U1-*%TuzP}+j~wDkF=kmCEwd)!OsMN|1FnpF2b{DbRM0+m?W z^ocgAe*QIusE6L`PbIT0<;WQ%-H{JqJ2r`=(D?i+uV6~D;)T!if`zW$9hc7Uh&-0; zC~P&z?0^WI6nP93#ovs*>=2e7Cxn@V>a1@V+~>gwhCnzv}AT>|2-K15bV;aKb*^Us|EBIEl{! z(av(RK^fax)9nuX*b?2xcuG!g&Mo69olB-Y#o8*#L_gc0n`xCtMwt}MkTV9=A}$jL z=}rza*^v@D9R@4-okqvJ?k$yn4~09*0}Gnu2dH;(dXC+(n5Ql3QfIwgzj#nRc3ug3 zT(|oC?oGfSMc=_64EB@=E8II&0sIZgdCoOR)Gi0~^&qd%M>6mJJiq)i@R_?e^HA;p_(qjiD=B>$9ohOTpIQIn&S0Iiq8{)C1>V%Ka_G_tp;A}zOa#} zxF0FL4I!N$coP<#ImZoW$bGYkmjmfp=%~hyn8C#?>V@fNU;^UE)_Z$9q~;?UdvDil zma`76&GFyn&$&Nm@okG=TrA5kmdi_C>da)tes_Un2jo@mpsX1$B8y)iYu19#L7$v0 z4=3{&>PZ#ka&Nc#>`!m&SURZoxIwW3bY~7Stp9nvbSf3YKS~v3bNx!r{t+YZD`)#BUv}Ja| z`|w@&a{1Gsg5u*R*OZl(o1lB*^~?7wD<3I^hwnaliHy}0JJLmV#>?#w3E8wNz8sJr zqMhim;~0KWhq~xZ?fSN}jHGt>j(Ui3y*$e9FffMpyw&*A~Xz^~YMe zOi!eSw<*Y_m5Y!YOmBUx{Kazr?sRUK(GP2;$BJ3h&?Dh2)UDn#C}N))m6#6*rzPgY z6ichb=L7wIe?HJ`fXSy;M+Qc2H)9E0aX0V<;g0XpJy{l!5gsA@q1)&stB+Cj+L+Pv z3}z>|o`V8HIz$0`JGK{?y`p1N?j$Lcabxb;-SsUj?BcGv)GT{%v?pEaBVjo^<;+9mbw%_bpaJ+(!g>X)^iWWIb<}yW|nj ze7gXrN?WU~^Hu>qQv{*Jf^fRQC|~8V$_%#P$O4@Kf7TMYgmpe|oU5>|_4bQBlKd@7 zZoJQ<04nT_Hk4(Aoe2rMB&-j_OR>=&D7T$c&M?@(C`q6EJ$Nn!JdnDBe@y71LNbM5 z+78bfjg{Yp$psD_lhQFJIz%Qw^zUg@bEG47WF1bI^_VT7E^s0zZrmfYy#Ytl!4n2y zvoEUtc2Myigy-X0=nK;-1Lsc`WNEiCo5tq;xdCwSm1_KLSlx&*Uv6>+Bl|(02$AH; zhG|cN^BMv+LCNzv)qCDCdhX>|B^`2wA=wy8#FW1S&P$FRdo+C4z?X(jxj)I}8Dd9p zu4OJ*R=b&f4bRUgQR4ZYSm|-m$pRdMTgt57&oqtw)Wg>NQ5(Z399;I8HkyZA_$KP# z5Hj*m8$xEVh(FUD^P}n~gGSG9`CQ)?{VliwBF2bjFiyxAr60r3^4@Y#GZ-h22lHH* zi{CGcrlC*uQ%`^APSilNd_H)ht{uhrc=R z$8d)qRd)>?(e8T+UN|bi6@Z+iSVChl;C~2b{A1wp44W3e>&>BeE9VIv!(9Sl1Qz)K z93c9d0ZtMB+6|k;JSV4AWrw_~L{CAha2Su#snoNnh*HHGG@GIM>7~?dWNVB#Efj(+ zgS>}fOC|B0*TlaAqdaJ(67eSD=6_x!-8L`cu-$Q{47&Gs*`#v_&knAJQUH2^FByk7)Y2NH7V)eWV3OGs|uiBi2KbW(e~ zbbTq(oSDxfsAeuPsLyD6GXkH{oTeEKoEyj7`fk0of_9~Xj9ImzX=2o%;tT{IqN0+i zG%7y_Wy$g;hn#nHk^Y=x!lzec%$o3IRP7R@7V{OJao`~md?bY{0ynyFN9eF!)PZlj zKS^Fwq;}eX^~^VQ)bX4bAm@61)}ynN@5)DZ zioG?|f-M!~*O5Zx&(UNrTGF=m-tNrGQlxh=SMQ}o`@kt_JXMrJ)F7YzE2(#cNo!m8TPi>m$Ehs}e+rVE z(oZk#RPP(uT4DCckYWCmrPNZb7naJ}7?iK4}xSQ_xjNhW^)&?bX`Vu!jEM zd|8nkifh3ce^&od=T(=WFIo`Pu1uvHq7kV|fNq&js(W^ZW(m$GeXx|CBRW&S1I`W= zKpyoXE`#Tv3GV@HBA z52f4&errwbnhfH#ZfT`__=2xuDmb6pnB(ZDx{Zq0aaJ@;ItYK~LN0kjYYVJ{=70$j z;qaNxHD9T{i~RN4Dlhp*q*FZ0Aun5FJ>+96s(P>!8e4A%c}>>piNdFlT+tq&oTPhr zJ94i@?sYu3zqxMqszzOZ%Lu*zdD3DzCj0wHPks|`E{Lj`C^Nm)JQW;_&qerAFitg1 zHH5s7!>~fvmukT`o)dOUCXB(3U|C7{K6Pl#A3m8fG&rePQgPpsYt%P_b-Bp=vO^*HdpD{|{fxgrYxb`6+8y^LgQ?!@j(9yDo|u*mG4^}Zx< z6cW(=MN3Cdv1Mtn3{~$-J}0Iv9y7`z!=D>lHU_0nT{#i*laRCK`IGEa?`wR&xgCDd zC#D#=I;OE^H5mwU7;$ADI44FmLcwCBe z5^jEiT7{HmzZ^9KYH1`q#fG3Y$!g1Lt6}95mPH_Ofum+;oy2l}O(BIwuJ5+f~rdWfPgb?Svy0a!05!okIkFv2RnUu^|Im z_IeG42Zvw}W`IRrK@3}_VH^mq3}-mZa>-LD&8`0cp)}l2me-R5bT)|{c{mI&qLAc& z5c~U8$NuMN&C$H0T}sl?Da!AaSC1}lBJZMN?T10iGrSVN_7V0}D#0$)E(l7>`Ei0h zwTj|~pOc2weyjeX|KDowkP;Fu4L&OymabNttY(G-w+k8&(G$dJ$t=$EZKZ8>xU? zR2S7rrT-?5a|M#zRqj{FODk5A#O&m^Q}0E=Y2hQT&jo^e1LRV}7_FpQckNm?EQ<$> zm@&tzS+2=X@zq=g7q>K^C8_6GvD16zV<54{{b$d-y}G{9@x^P!}-NP0^)-M35Y)#NI?AY!0|^}WGv(g3G3BjJ_7%= zvdGb)zk)~iQ-$!Z0KEI>@2rKgp#axCTEuc3X{{3-ln#vGkPkfbEG`E~R*2Xpacf)P zam*WF!9R|HO!Ok`8d0sDYfT#EF=+e0JAG?w>*J|cSi*26QT*Z&xNGDg+s2I`x# zDS5IK$b9N8iS3hI&B0!L)i*>`gvmD9^BR6(8fA{Vpw;L&^k7- z!A+$7oRY=<&_IxOE(|%V)wZ6D;F+Pp8-gxrX+U+|Amm`8fzLVmJPJza|O&I8SzMYu~ok zZE2;uZx?y>y)Y4luBJ3Ze5`5^LRlr!+l$OINsUxXA&=tO>6 z8Tok<+Yq8X5oe~EL!iKL=CJqz)?%NZbm-+22jnWqxA((-W0-uXlSlN2CGw#zdyynesfDL_Wye=+)~9|z!Q{nsXq%gI2yI3$h&46-law@0GfMB>w*l( zPSjpEel2*KLG3{=rJ=YDZu0@k7t}J!kE2Jgi4iPbXz0`Jy-%{Y1T~*mfaQQ(4JQjL zn{s2A&S(q5l+FlW*pzM&w+uk`Y_M-ba?IFzAxgZ{4~hRiN@s;#A75Zc3+z2$6v;FF zoG7LJhz)^GiX9oUlZN(3XzQJ@onQ!yb|=pt!)^H%=(}4}#-JXeL8up~2R*iO_(jYs_{D_mfe@JnQyTjQxA+=73?8%Uv~E_=a_j-3E@b#{+&LgM zc^`LWdRPC*PIorx(Eg*-&=_!P=sup{>&4xgFL1m`ij0Cr`vh6OUksTP`F;a5-mUQ1 zYrp^Nr9}uEQVie~$#}aGZ!)LKa`^jn+_e|L7j6CHMVSq&k3L@O9=U&`b_u?C*B51$ zKSE!U_m@8|KMsD@0kY50EvK~{dwc`lvUv%x3;E!*rlaesF>@Xbo zF^?A%<>C6KNsI4XJn23W{Wzq;TMqRt@R<=bMS}jM(Y{0SHDyQc|FE<-21Ny>u zNoM`4l*V_xyW}yDfrn3sI5HIhe34maa0&Ro-SwcEXfs~+;o%6}?% zG}nIr-%Gj%B`xy4tR3>wNY%olXrs0YIO7rEjESu#+(3{|a{9XVyswQ~johdO;Q>66 z$|pbhCh!^XP~yu+{-KLNSy$6O)EvLn$+lx3ia`1pagg9Re!cSz9hxB`5g-)mzp z3P%13-k>GokVkor9zB*(dGy$^MMv@P;IU&5Y<&IbTa2)#*{Rp^5uGHSt%Jo7YvrF6 z?3|lO4oj$PM^DnKD9WUI-qBik9B485$z>w6zBD;)jk_`}xrT?YTk|f$Vik{HUdFDk)9f~Z-v4ms9n^R{o^`hI@ax(`%EAh^DK#KeZm2DS zg}Lg=1-0#X3RQk(s4RSf34a0SRNP8A8?`%7QzJZD(A%3R7yjFM7~a4UcJc5VJnZJ- z*R?r3haN-p2>DZ|-1R)Hm$aUT^^(?UmmmlAm}F0`tkY73(#pyBf?0-ndl%$|DR&#> z<2PtsjJRl-t>oE})|D6{i4pRqdSg7@7HEc1-fwuF`%q7v_Aeg(vqtipr{MuG&e7Y{ z4qIl1P#IQU3T$sT_+Vw3uea(d8{Vk5^%YmW*vMleQdA9U@GM&Q*0pcVg5&{gnqN#- zcFx%!sB|NrrJU>H($tYVU*odzwUYCknVhkoW-)z9%;MDjXJ_y*#QHFsA7`Z>uAh}-vPD-za@fy_rKM{ zB()Ch0So*F{af9~d6#q+KZrdH_w#|9n`YJ8aUQUQlVDGMgkwBxs!xaY;@RN5WeCi1 zQ|KPQ1gl)Duv@7RcUlI?l-V zgMe1}=5}oR5ZNtukv)Y!I!C{R`0el?Qw=&UIfG@tSbNKOl2Ta( zIURBc6q>!U=Uz|3=WVa?^J3B&gn1sCONIU(4Uu;=P;0aVOw_9a#>?B^u?Z z;VEj6ViEMLM9e-pbf-c$C`Fm@Mj}+Zz2So#ce*g!pY9hyN%g4%1N4ny&mvk*un)nr z`p<_}fhV;}+vJ@Y&kv6#EC}Al43tnJkd;BA6tcti+V&vD6|Ldlt0`Q~!$myY&coFR zmk5?h`VDHVo}T2tRd4gjKBDRR)c?Wm!EGq@lT0AT#h~e^9+5+p#-Y-0geoS`ozUak zTDzTZ&=~g3diR8x+Z-}_XvJ>?^-H^LTc>C;gtlWxvu2pGHi84>YSPCriT7O}9S$FZ!{@T~xA*HaGyUvAk3pJR5Z`BP{i4XO8W9eFy3 zimi0soh#u!8fPCm2~Dtz>+3byUW4CkoItS`6g-DHkl{(Lsll6v)xdwa-`iqwL;QKTP+&j0RQJdbjXFcr|?kB{_xuLa44~p-RcahtT-J0I2AK@j(--;gL zCCA^|A1PX2eobxbI!`@HYG2;~KD*7c=aB+f8aJ%hVR`?FmFr(XNs~Q^(y8pn0Ov5z z%10P)(_cFL&A;PXS0713PIGHHW&&A!(P!h$1$|sYjc731GrA=^{15wGBIeW=yYw>< z@m>1V&xTyw`o@Ep+ms>=DL&qXT>v^Xi{vzTb})W!$e$5PMaZC}=U)mh4#nW<8gYW^ z!#xpEVE*02R|T(>jfFSYt3DU-D>{~g)BE#Kp+cn&L#YkBI@O!{Y>q+>lhsc1YC=J$ zx}Xnqz0YWGL-^W02DwwpVL*=BT@*4Sv=T6X26 zM`_6JxI6SYN*3~HZQK`f)$YQ5TCMxuFmZDi#kskC>MsHL?ciz>FAhFh;BU#`d=R&b z55STt3Pj4)HdycjilE!7u%&-@pR*vjAsd+HatCS9V|J;)DMPY(6$_n zvP@^nx(a1I#BOd{hZFQVoRg{by`Yi7Aw%o^fH&n#O(PH@O8@f{qsDyB&)}D8KXeAi zxGLk7A1M=+|8yEp$DK6kL$>csMSbs}zFtmygL?-*<}VG_@3eyZP$3mH;f&3B_^=;} zlv|^dluq>*n$3}Opx$?Oynm{l9q;Qk8gGN#0h?CDOEkdxCH3uNuxA2p@O*G-ygK(# z0MA0_9@2cLId|?X4scmAeXg_A6K^(DBn84dbqKE?+_IDCwwtA7=d{D5BWKE1DujrN zJeYSl$1`}U(ocBhO+}e{>~X~EtA}D(pa2}RqZJf(WeSm<;F#z+$}$DN0EnlfU-Xh< zoabvyO+|m0Qjfj~UJZC)G#23AAf&@ieP=#X2l-L{VauYlf^X2{^WYr-<0|GEA?*XJ z`3^%~>_$qKw8lgQ@4_pPU9X#E5CgWLxrwvb!1f8A* z)Jx-GVTne06k76^x1mit7*lT?q}lfYuqk+km|ub;Ei5P^{2x3Cs#dtr91<_IgbeWM zZp6KlQGpg;*o=6+q%p|51!umS3vgDHwrOcXWO^SwT*^%izFcsg7BT;Bsu4a#)i+^v z$_UOgxN*5Q_&gLlXY)M~J8G&6HsdLezN>c_r1pS!#|N#Wp{(lg<}ZcU?gx{oin8GoEd$za}GjxxlupEoVRZ-<+YNg?_aphutoBi{M6Qw`5VCNXZZ^Q zu*wg)DVFcw4a-vKi)!2#Ul-W1Q17j2RPnF(*b%M!wA#h!1d+IT>Qny+=`G4_1z#V$Eb#Ne zJ;%IThh3RcCOFsF|D)-c8~S}zB8IqBebAmHTt-r5bRw^1XLIWD%i&}t?c*pr!N89)13-ok}H3pRDCgZ=Qg0qYB$>Yjlvbu)Z@)mL?@8@b+or)qqMaM-u% zdpi$;)9|gjt55dUFL%L`VSSauk$C_+(sGvTn()Ck#aB?$3EK@)%TeD7x%P(o<&zu^ z*qLxZ=2PmcU+!=u?N8)$0FzOx9g7r~2-o0FPk{OBvQ|Dy$w* z{VR9syFHyZfm0**?jRWisrjbal-~$hR~mDMV|VbK1w|?u0i20{mN_h6DA{j9WVDBpFg8)c40N-)6!)B z?ki_2koU)|MOcTQ?2KMs`mOqE)LSJZCJXQ1s+j|_m*LLZQ6hT<`F5{d#n8@F4Sdnv z&aw}evwTSXfk&E^EyB01+y9ZT*!y7>@lomgzpByV`Bv?ZPM8z)6nT8UDbUplGKft= zhIvqHbeli(`Krgckfswl{0=YtgDthgR!T(uH)4&SPDA)x^`D4i+{UG=tHW!kBi}zJ z#x8<~6WM^Uk@-C0#&6Z927SvbkUp8;_avmyUxQ4>^Eg{JpSqfjy;Nibm(7z_Hr$sw zE49ozJ=I&^DGSq_!T~|HDMjE$xIVVc+jx8gvjEnKS@X5vg9V-)Gi9%-l#MreiHjk7 zzEH;v_H>xhPRS&?1gNjq<2)-hUsuW^Y5lAT)=ElUnJi+%YGNVXifZS)Yv=wQn%2Uk zQlzrMxnia-nUVB*P{_3;gjhyqc zvZ{lTw?+E~mn$gj9)PqQc4fi*DC`ag8JuWI5GRti+;AD-)jq&z4{0XdoMEr)-5#L%i51z(S= zEacH?Miz@~8=MyjUYA-y(q*fJq^u^luwSraH0_y9X%*W~J((gNChgWp^%b+8c8@sl zhTC>vwcE7+QAj&qbJEO$79k|b|L%AOW0lmDBA@6eC@m;sK3KI4Wy5ca1GB1cNK#_z zE8skQ8n%}*`)Y673B#gl|Ge(4mBy$LNiT@0%VSLb2)hTMxdAw)Vtg6tU9JK&DHsYC z`NbeS7#)%jPA^U8W)y8%K|NQ0(kuk5x8X1${d3)%?2Y&&KVTW}q_$&gq zna^vi=4t_F)T+1OLnj~ixm?Fu$T9c@tm98MaV$ZTc(b1K2HWvT@m4s5 z!xp6S%(@PD;-W9PSkzk=|L%%^U;CZ!SMu)+{%@!bkzHPfK4S*hrV&C^Ub2_IUi=@v zTAR_|RSQfK^+%3XLCbTf{c!kLnpu$O0c&$GJN&&gnZmfzQRk$Y*Bz|d@V!*BkXD+0 zCe`q=!fA=I!)z_m`l{q=~t#0&^|8UWB?M za|Q9Yua*h3vY+Go&&!g=KL<_yHV|)m&)isc6TaV6W}SBa z_k!m6*Uq1l>2r5k4X?Sy&?twv-=L&AgahfGg5B@2YfIBh+B9i&n>H$!$pyPh%C12< z?ye-^Ii$udC{i1dn&!G|mSA^l1rm+Km1S4`V7kkYPK0!S5g#*u^F^}?=1!YEno2bo zPX)zhSUWH~jQii!Sh|Imo(|t(Xd}ZHD@q5x&YqPscjAA@vmYtW=ApMUeX#q2GO5`* zExpw0O_fK_Vg!TXJ+$pTZPaL2<|s!mb`>+~Gae961rbBFQ|N%kO81FI`h5v`~By){PAmFpYxoY z^PFd2KKsMt33h$8{oCWv{I6D5X{Tv1y2#~uPkON~$N(~&{C8i0#D#ZNwqIEA_F)D!nf8(E zq^1C8+j7UO{iNpujWs$4nw#oR=qYMUPnTtTB6l3umAa#Lm)er-V;kT}fZBcNBd)@g z_7lhd5&zY2b#*mblHz*z_xoG|<~uZDVj(>zQD>-OyQ99RjB!H{(-a zkR{mhGKas5&!@V5{dVAJEx;UUu7%-b{3l6R&j7<#R&D6R%t(+hBhWp}&}JQ3DQVjY zzzio;3-h(pGW`blw#ddgzd6v~HQKYW=NY>w6_JeBBxj0(KLh)NBT0${zqU(|lJR3n zt}ClrP}Um3pQ+%Bfi_K*M%h<>IHT+c_6R+28lLp4M)!ofFn6gx(&}D!YzP3FfWaB9h{rW)x z9@rzfT^-}q_H4!aCsUuMRdHJ23>vx~x2c7Jm`do2;jGXYC-ee?AULD#jcUs8;$VYA z`B~8R2R}=TvsQS>>F8;0DuJ}oufx@plF%xDUbCtZc?bVk)ydwiAoNC)QQ!8zR zk5VgbhaNr;9vwML`1U%0=ETBG?h2qDFCuhJwSuUGoY%}Og?%A&pyF522Zyt7$Im@oT!+IGaY;44}qGP%f8e7 zUQS2%J1RON_V!IN3!--N4`obB)7nucnq27`YPHE?m58q3fc@ z<&ud@0MPNN&jWn{SU85b{#CDk)ZWiEmbj*z9j?%eAxPj~OKQYj2?i@0v;R)<8(2oF z2zvX9l=qh5jgXHYV0M2KpORpAH9=CD*2P|t8|A0w96y3zZJ?c*aocfzCK(rM-k-n0 z&C>H)$mtk+47x+)(-`bM$S1LMFKfy6r&p&-#4#Ar`U=LG{91*c!TKpz9TLvB!#ik6DY$Lw zeP8rl<$dq5khINxzLRniPGMJOtZ4yu-QF;c%-|X*@a%a5n z_xrz#zc=ugY5_D&E%0#8dN#&cyD<-VQHPbD(ns&lBha_AtYeU)eT{#e6y}9@=1Xgy zmt^TX*uXaWyQD?VGk#8J0_Oyj5A{}zvoP6--^HIx0^FLxg}!+y`CN5Z@Vod+kUg9R_4!#W34c3351gWCDy?xOGp{-Bt0SB7;?W1X9UOoQf-#m29ir3Kc1fxlu-tG+2 zQ<9scE8G@2*?+fEiwe}D1GRV?yNkVx7ru`l?td}x`oE-E`zB3sEK>XeRBtN9@8aEPqpy?{ zKUY$`NlDR+6n~2ppNhG5F<%&v&tl9>vI05k68{vj?6J)R4unbB>Deeuhu2M(n+1n-X;lwD|N*12O<5~hoR<#&m zVUE)pFcx*u8-P(IJ5it+d{3dF3mV@cwhTL&V*;&FoAs|{|#tlo@7w-1#;49Xfub8YdD;FtLdWnn<2r>&Q37C zf&xwShkGWvV|-84Bw{Tnb)9#HAiIR+V_pa`XH(0=<(^&bxc`XYH*^AU-P^;nyV~*l zqjGwkosF|>F&jeKSsk)AbbW%Kt(}GIM|;j_4ZX3PaksY9XD-027f9%srbtPJrddVr z97RehG`%W%=b#<}1f-Q73ZF486lU$gmEO^?{bKK{x1VDlENUNp;%PU1VCtYPd;7VE z@q9Ed$SEt2Y3%LO671|$KK6D&xliT6%1N%`9JpEMST~W`BiIdCzNACW8EJun(4TsE zJ#7JKvY}Ls^lQiS-O%NeGmhMT?kMu2&nb+So2EfpjN(r5X;HY!+P>$E9;MbV41;&t zelh;44&|Z0tJ?J)wy?1rc|I1H>ii8F)fZbZ(|Yvrw*swklLfA^BMs<_ZOZWN4l=|6Cn$ z?G_nw^E{M8sU;iv{(^1;)AjuY?S|S_Y&i)U?8Z}qJ?qqDd-|y~Z;q7at4FE)cK(#k zYp7%eikE0`mx3H=^7I_Z@FP0XVkBhQl`MH^PO7dMzRYTEWu{M$Ylbgfx$1D$`?Shc zjcdA3rCd2&(|jzhgj|okJ>v>O?w$;fpbkQQTS`dQ6hf{+`it#^l)O#I2id5dh4Cw= z=px(@0=9v0jvxA)m1&YsV*M5VFtkhHS+avZVg2drxHX7HTAw1M;eskbOA~H(d);rpl;Wo9|W{F(p(0?XX+1;>EB2&nwW6|>JUOa zgmX|&4qyXZ*@(6VtUf@<%{Sw0F}$aLVT4cO{g40V?N9ys7V+rcwzL$Sx{(kHH+TqH zcM#{-{u1?{fU!7{B@2EF-#kAd3j7N1PvQMXcz+h}-^2SAcprdrhl`YxTfrWwVra=Z z^0T|{Tb|10hwI}%+$wi(Z}cxcm42na{Keh_+c(zU#o*~QC{6ZR=^bHMHOH%PqoKd> zrv{+NWI6y%M$q)+gG~&n%wx&2dl+&e%#iMjsW2X3$kxLQIsIKKY`>c!7W`)Lo`$y} z{#nF-HkJy%y$|nxkKetikVD$c4L98IUvFcd(>Uguxd{#JjH z=_gNta1?MBV8psx3HZrumb{LEcL?j#7hb%>?><2B z)hwyFjv+q4ZGgr2eK%kZzz0|dcopy$z_)+_fbJTW3IJkY$u{s^(5N7m-~$G0 z-TV062|PxN`#k{0WPCrDT_~6t*81QiVPHnX?V+3yYc?3S=n8}?-u!2t5z-gFkoF4W z)a87%Vm*^C{mHNgCFF&9^;zV8z^?%70KW!21o+p#HQp?;VdVKngpUFq|Gxq5Uh_jb zCHJQ8vys>TF745>{qN#zee|Ex`0+RNo__oP_di36s>T*9Yvp~$FkeOSL&jzUU3w-& z1ll$o&u0;B3+F2cbJd*kUJGo5kZ^h$a}b|eH+LWpeZS7i3>gpPEKOPUY;qh%?7J5?U~ zTic@X@uD$IEVR5TU_u-3q&#W?{8HGM;d??{&t*~nNAojkUMP6MK#E^<>!RuN^))KF zerWUwyalw~m?(Dcs$^z<7aP4hAL~MXqwpo}Sq~@Hxe5FPa0#ZMFE$K+zLfi|s#g0x zl-P@1%Z(KuDg1B(EDiaO@J#1@7O0#LSOBO1%mMfS27nP@0{8)|0LuUz^o$uFV>N?& zaq(fyZQAbADGfP6-i97$QbxM#TW$&y+s9|QGF2Vh$lBOCoFJRjhB^66--3(x!Q$wc z^6PZpHNI=AAz9ugfr|Q1<=Nl*W_foc#+2QHV?cB#!Rw1$>Dw)llG`I@$$b%vg@1;R zsnc5_QD{uYA4xK{tqGlzsfXW%{Vr%Qq&c@H(jlvSSxK#_Z#3pTN!U0eUWLqX?EXE7 zsYR@vN~~uu$GTNXkH(85J)3X{=_TVElvtZD$EqHQMRQ~7)rct|rXDfxQexiU$DnL0 zm3#QU5HwA|;|G8lb4LGvpzS^A_h&0GuTPUM(_xGm^xp*gW3bJgKzQ#08B$amhjI2! zLaPGq*N$y?A?fY97jG&!OGUzJNXBCrLBP|gAC2~2^uq-E=61D@#-OPjPZ(y>k=lV@ zlzW^?gM*jik$gB6q;z}cFjlsoyKpq2pGooiw)Rv!Lra0zC^2P5zuB7;Olv)*as1Wf zD-8ajhvC0$E)0+vI6=9{B4(f`Pb7`Lf?!!V2iJmDizU zf(K{;dVm3t3oro+CxZTNH*F+BAz(a!)@2+*)Xp_iT=Wan5hIPX)Ays}j=pDnL>Yth zp3?4f{COg=WsA1Jlyp`meJiauR6ynkE1Q0B+rA!9G2oKk3u_;_5T5o~`E*h(+JY6W z$@pW#oP1}3l{=H6f=2hnlYurmuGhEZ&d-H*L>YVl??Fl-H{Xcz7aM%8g#H>*R3gIC z%EQVpC+x_h%e~;@-LQ9kBUu629%3)bmndhTIhiTU2qfc%B(>qCb?~FFx1#S8REl2l zOwI8`;m-iY;Zm3UnzF9Z=fsM(DQ1eF@;!wXbRjH|4)@*%z9_-@=5rH>v$$Z@;oi{g zsV7(C$)1WQ5O?yVcN5M@TYOup&C*I6`tzUuH@mNZt;+wi|IF-nqjY4vG)%|BzTrE) z<1Jc&m8W7puy6pz%3Fu;@ZNzlZCLrpFp7hSKC;))o}^O>Pp@VWKz zoNJKhFNZ&fF~Z+sw0E&y$zMW8@~;t^SH-ZsmF9IFe7VD~;qWxX-lx=j%rI>QYGf$a&o_x1)bf*^#J;w+O{oDL(Z_{*0RaIxg z?$ju)icy2^Y0J;1o86Q7nLdnM}*Bs?)92(94;lX75(jc8*WDjvM zK*Mtl#GuFG@(RWzDY{7b4MbQoH;YtZeM-=HSf8{lL_Uzvw$boqC1m9a>R<8RJp-&Q zlI}WJ;nG5TV;H{J`qyUkung09D8XVaJTu6PhE}E#-$7pZ?@fj_V+&muBY5s_Wp*+0 z_F<+W&7q6v0O<}k%3y3?kGL%23SuILvz24o7JPwoa|gg#{S09|ioM;!dbOCtpsCx3 zskiG{N-)e*m`1_w!Ro+i^oWNXgv|`ky%ddeQqur{V}&;PYksc;Ay7-I-CV$oE{$EK2a{a{-&(eNm=t-{bUz=S*QRmM-*<)sCA$TR<6wO#s~qHQQoGn&MC5r zCe*K@&k^LXPilSj!Fw)nY(2CG&1;vg6~yisSMvEuzKE?p8>9Pj5dA#)Kj_+%Cw_WX z{mVjeby#W=KC>J}tfU#URK(NE>ore;cP8G^pz^dys4Ww@88SJ0(wf$N;R z8v{C!)S6&CgaPJ9T&z3oU_rLjx)lSUjCKa{$?}0#jY(%>e2kNEwcTn4lDL`J6O-JOZ=x?jS~4!_BHzVc>Y2+jr5T+jAJ@$qKgHgr z0!EB8eBehDwVI=n$r1JWe2b0^_fEND^RXPVg^TM~mPti&7QfG}0`;&>OphevuO{`t zdN$HAy~rY_Rn748@`Fij)q5AxRc`Sr(e9yb!^`(ld(RE2eCU{>W2?MnI&^mG-Foqs zC~YaPG}>16?nTjPV$k9MCv#r3be_WZ!$MKQ&7_F%JJtN&7g~;*#MAq^n71 zGurQRe~rwSY|sgmb{NIiB+P9!a8;aZ6Q$lQSxbH(Cv3o~+4UyH?e4?-@)qqpZ4E2G zIKay#L*N0+dlHTyJDYW|CvB)tPo%t!#-nNRXmw6bG6k)ivJVs^l~s7&x`5Jwg%)iU zBPRza_RxgYqtL3V=JDifSX|I~jy&Gfw%vvJL4c-(!wBP|z^fE2ovul(eN2NHa@mW~ zn`)im-4b2Dh}9&qGCcP;+)`U$zR7*loUdb#G)*~sVUG5dN3a$>n-E-W32P|*S*G#R zv$|gr`RTqTtyh6kN?P_M*wC|nb0B}szxm7o*ceP68=dZZBfr#B?|%`aG-)-j(bv;h z@1Es;dE2u3Ws`k{z#4Za*(PNKHG%G$oE2s2i+$O_{J{0KJEVF)jeEd)bI82rwq*kH ziN@H;V-Tkhab7G*hlh-%p?W{kR?-JXd6u&-U3NB>`u=9TJ0DX`&O~3H>T}^t*tZm% zYV1IUkHa@dV?!KRq+V%dWA(|FbpR>-qrYWYL+!SSfJS4-Uowg(Gn+aGa z>Fm^iLc_V4{mxc3u$=WarqPEPm@}YKT9~xIhkl~%Pvyy(*gw99OwrX^gEIUX=h9ML zRDCP7ilBECX!~I?Hc-c8<6&aE4?f(I6 zvZwE4jE;%yg*es(;S+m+*B~qhKJhAWHCEo+p9TFSSnm|^{oMId%#Woy4z!anod@MK zCt)Q_nbRRh(fd5rNTR3pu=3;mg4A}V+(qP9j!^ta1Du9ntkMzlVyPx#TDPa?07u8i z$aunz4;iHVOYD&gBa?lTftOGA{VN9k{}x`($cJ&xH!BzQGx8K@BD3-Y-1X2?|8Sq* z54$#*?}LqieScJdw2!op;)Z)5$0RMAnz(~>XEwnWCb#KV8fk|BqUA#&1Ykh*Nnc!O) zdEn(WB(TJNP- z7h@%cgg3Wq2IO}SLnm@-?bB|qhvBqX8FXEiO~jTqW5K22K*f2zYByHQbVzx1!02{j zOaV8xvhq89JiOuxpQy(9Kf7-_+q%p2>_YmKnSQK!Bf>V|)0y4|Ei;>+QQ?2YPjTOaXxFl^J#51L zDP`u)>SIA;GEN>E+%n|p-$8o*O>7VH-*iJ3$qv)6?5z~%G_>e#>E4QpznY>qZ3ypx z7AbsqUG+ip!&INt5?%O*vrIN$&dRSU>1Kk1VQ8c2Bw8#!%Y3@8&J^{No=!NOTx+5Y zRs#e4g>yGO9A;*nG4ZA9&d<(ZEUB`nXalrRS96ND!^&q9%nW{V4E`D&o_cAiANU*W zOTLS+^4}BPSZ{!n%YRg6*%kTu^0Dn!0=;9xB~qtNq8C_%OBp#jE$L-C(U z&O)&^MlOfGD3yq_^0*`Pw1CQalY{@!L?*lBM?zx`nyePl(8$(-i|0}89FG5G$ZpH2 zyAC@qGihtW71)}%A&~Yv;&mrGHNNyI zUw)kAKm#ms^0=yc|)8RvfZ8X@D@t-CQ2iW~NRmpgPl1D=_%g0zuL8`w)OIwGu9Dxb& zSfsYSi#@LDQOp9sUomd{2u~sOAj}19!`|`?@JG&WXi0~*odE65;^->y#7wmmSKs9x zA2FiszZs4wEzZa*;dOzPRalD|`KL)rgFS;YEg36k(Ew9f-FGgAvS26t9+tMOcrj*Z zdk*QZ9LZ0nYpWP;+K#xJ`fRmkhc7a|GuuJr4Iy8cgba?mBhyfNBYy1;_W6>IUya%ojD&_tYli2Zmqkx*qX92utbO(5EP=%gy3Ay#D9pG03@5OGw_kRxEi0hM~MUJ-UUA{uv z2KU2GNPazZC&mxB?D8w%bZMN6y;8r3XSHWBtV`uNL`?78AxRS?_q2I^o7^dTzj`2Mh zXLPL5v91N&0{8~+Zbay85xrs+u^9uR_o*ghfXFw&GH5wCZ_qH0x~t%g1X^ZyL|uw} zAorDQ8=t7T=330cyuPceAIAA*$#?*J3L}3xqy-kiW6jt%a3wh2@2}+>KR(OTd8xer zEBZ=rrCwR;2DG+A3Enx?$JSZIslKUITpf|^O1~W)nv9dXT~?aT`T+rJ-syyDr@iJ- z!T`HSUj8JZ*;$NVCgs=hL^e`#5+3}i8fV5%MppGr@Hw%YX{<{F25UVq?gxhofYas& z=}s_q$S&qJIotTgWSmne+Q??Z$<)#t)mIxz1G*la-?X>?U(5?t+ThjKU z>w=b;$h6zCNY+oX2yN%z;@LsKn*iFTblottVC_LUpf5ABUTBo{;;-1T7hfi-n7qX|Izg1mh|AJCKWV{bq*W$7o+STWyB4+wh2hn z5K%L8Njfx?Rt)f1mD&cOqY4`^B43g8Bh@iOx~^orMOg(6Lqxt0loY`^wmPgP$@qTs za2$2!hAzhLRZ8uX%)vFFYrc#9!pBY=AMi=oBOI|PJdNV)&}4k;APXC_KgWI!x}qCg z)ZuvE;7Z^4AUm}b{uJg%n5oeyf6#yxg;<8;4gEj$+8)S(XHf$%OKykW0V_`SPc+7Z0wDEt8mfr^LzYla!}_?nT4~~d0|)OH!@{ zk#<$8eKP~pzO+k;VHcY!PsM;kw%><5?gH!rkQS|PQxlyLDuwq)`F-5MtdEj$F_EG! zNc;UtJkTRbj5M?WiO;-oawD=BW~aC~wf_If2Z zt&f(G6l)sr-NF<`QR9gL=P%P|R;-vpq zNCt0q)vv)hcoCE;BY)VRsslKC^6!)(&tHu%Sk{;36qv;;g ze9jZ@buK9L+d5G?MkgKZz1yCZ;aB6w?=7jA@HtXWCB3Bkeaj_J{mgHLIx|%efC1?)ns*>^QgrQZ1why!w2L|yqm2J>(X&SU2XuVzmBwCCR4<{cREDMhF%nVRD zgbw3%w2U+lntpjp2J}Nzj@+o;r=Mq*9N?>FM%CCGsVvads`Zsf1rm4(@zR90RfFf{ z&>kPWoX%)nVX=sI)i}~{UNs|kDA@UveJUTNk{Y1ns>MD`^QL2o_7&xasQ+n&8jkl4 zrDndN<%uR0@RDCAwe_TQb|n27wl}nRpS$#AVf72RW6mw+QX^@zTibaPfi6mK=z77E zj9)#h2X~t54J~AVGcpEHV34Un8y%QqPZYf7g_wVYX=JwZ+mrBNiFp?N2c%bsJ7b3y z?-w(TTphmy-j|0?#th=$Ktn@Uv1O}Lp0cEFmp`m+fE5X5S%DPNVwc74iLZfu>4!2D z?oE2V(bE$f{U#sZ1o6$rk#D%Vke0JRlf%lVzRUroGWf%n-^H9GxeX3$ckKzMKZClV z?%5|(dG2zXI%yl&WJcvKxJ3);$Mybv$X}4VvkhrutqLt3N!!NlOvXC~A)~{2RwdYl z>;ULXg3{89OQqa|zTi`d?BKn(tXh;PUPx)%#!60EL-iQH0mGDvi{AY6_aeD&MMc^FT5`wp$$V~1r}Xt~0KtPSRLg4HU+mFw77r2VoLH9B45+A%!C8K}c}=~)e%UAf6`;$GNA}?w!F*ha)%#DN zv_6bjf+ia`z|7&Nsk+ir?U>C^%Ye6mgbQQ!a@{j1R^iX^@`5o`7hrp2#<-@=U$^YI z|DCfuXPUm*eJQGjuDIGugm=!8vUk8Irt2_mH`;y%gtWgj&^+NC6WY`LHy396Ro-#! zjO0$(fY8G(8SzKs8C(8j(pS8o0e`N}D5imSq&WMv;F!aP0XCQ#@Z{1(vV##RCue#x z#f@#m*f{_=1o$0*@@19-2=!%BnI-N7)=bZRn7RSVUb16@598+ScDZSi-;7TmY=t*OoqAgK11*ZXH?Wc6DYD4L`e5GthN1hCZo`v4f!8MFn zXw7IGid#Wd%y4GztdMzbEAE)z9Ryb+(`gasoS(j!vpTU$8ayAL&G8%pwlWk?Lww%3 z@&d=Lyr40{XN&XMgvtpG|Fk>t>`vvG3eVKeJ1@8q=Uo7AJk?xrE{(H@xmIl><)UQt z=(R&QhjD?Nt5fx8IqiXr{f)J0JM}w1KC6A~P-5~nYFCx2!@kgHS^qRRT2_-%)*nhb z?Y}8$3u6DTCH*1f_iX-_q7g#y`e>R^Iw+>EQA= zVVT~&T%};)f|yI?Ige)+^~L_WCySVrHA5vn))Y9*DwJQn+YtdaAFMb$20S%w+UbC> z#?sHqx=f9Yndo2h{2I2ASXKnU(R5njJA5e44LUX-f-W0DOX;2LesI4yJ9rjpe$dl1 zlJO^o)xg0rF(b6FN`|f#^2`S~p}+8WlmBwQB@v2KlpW5i$;SSep0+HoFOaU+WquK` ztWnvB#b9MYH>)xJJ{(BpNU`U%f5|tM=b~W^*5CgwPab)eA0{JIZc&8lj-?;YnP;%A z3UC&rZ#V#LEwjirI#9Q#25d^*{@0v@TI2*d^|*h^X|!(iOv&0NUUY@83O{^jX*j($ z+i^2=D-4c`h!(A}(BY0;@92weS;smqMbkEMo9o@@qg#H>L)!S=$!8N|oK#D2E5dZ- zZ*ux@H9OgfOiwOH`4&v0rVjL}e<cS~_C~9$NiS#W@yZP3uetCKZdRZC}N7wl82G`ax`Tb;Vj* zu|a&YDNo!5`CfLb7MN%EU|uVwS!07(^}3-+V;PFS*#B&z5SktQHd0gpof~G7MdWZo z*;YK&VjW7us;Bp0wZd3vl}xs=B7q6Hd$ zjIh*;RT$ibosdovdv(-WOG<j z>qwn$B%e~ep{Mn{5&1A?R=71Z^=yIWlq1yR-l*K?3a4NJ;AUx+l$ z4j+io_Adu41lR!rU@5=}SPrNHxBxou;^21RN~fB4yK!=dEjzf|JprenEmUw6;9%{% z6IfW~U5KkKp)wDu9ZBRv1MoEAq*%PEaxK<9tf57alFXyB=R*TnF-a0c$hNRLkmkd_ zDa`dR4Lpm}oS=a_P}B;o+KZta=&@ohQ3)GgBx4<=c@W5d1)l{H-7Ee-)3l^G(Ws18 z53Lu-#-|%v-i2NvQ-pGtbtI|)+A@!y^6u2WNBqE~aKA6fL$lVWb~!%J69xR2~;SjE)2MXg0bYcB*hg2-R>zulVUGkEhMErtC$xN)bNsV@e~ zm&ysI`=H^xFzs@yD>@Jx%EZ6KXgQxi8EIJ`0XzzL5J2lNGmr%wF23Le?~B#Opf31A z&2IPX$d6NgzB(uPye~^y49Wg%lTBU^3^?6ylk&tdu*EdCy2CcVx+@m0svpO z5Isev1OL=w)LG2b+g^xDbsk5!f9~Y=Dvv8)kk`BZkZ`Gx*35xuac^u3*0NKH!Y0P{CeGf8M~UN^2y$!M9V0d~ zq-4j6IotovvV}2fn~Q$yFpF;?jkL%L5%uhN zV($6luXHnd+N;lqMv?J%AWr8pK4uiZgH&eG@ar+xTzwR|J8k}o*34?g`awb~r28|# z`A)_Mhu&GmN$)2Lg`DsRKUZp)OSPG+u~v+Z)zPs_$83;}Ta0Hq=jiyQ>&b9(J!H|4 zNDdo(L`b)qLiJQ8;0MqUKv$wJ3vK6(iCm-EpVA$^$4V^)HYT!-8sD)5Uu^b6zX|El z{6_PpdC+;I@ihc};pxyE;3U(7LhH@b+|K^1oIZDPaW zZHM`isV6H|tvy`vAYD5Zd**ri_D$mRnA7^c)C%exiiD|;HG^-i|2TTI<1D|c<1G7c zloI*%$a-q-D{9qUp4oz^^zKH!==+$aC=PB|Z;a+o+l7`_?cEWa6?TT*tE})=!Q!N% zWPAcRH>2fbU}eBl3kk%}fql85B^&%HtG}l3OY%aq)uX{Z=*d6|3?YrzBxZ*Uu;3qz z?Lu4Z1Z)HB0XzeE4uJKq(lO6byTz>re_^cXJI*#Pkck%i#a8HaC5n9$y{2Gx@T2D9 zY8_&gw=-oOIMLzu{*4LO+^IMph=hzmxaBEnwHv2o=H$_Zr9wR$Y%-v9{8Vh zE;#qTj_cO36^Zh|OW|k2**<%10r+&<0pgqn`S6VcG?ouk`!gYB6?_~i1i{Y{wuLUm zbizgO2`K-NmYvpt)`ixA){E9J(UMb>GjF134LXALunkJI*@9VB2Ct?zN6M-?)tukV zb|2LfX;EUD@K%C1a042$tuoDP3+B|GYOcRrgR;P)Wa0Kg#`Lzid_uGz@Rz_?FHyIOH0EGTan(w_x@g0T`1}Ow@NksU49l{U>9p2 zjb9oz)-oPgnZsKFteVi`@z^bIz>|Tap?Rt6oeP|Cv1{WwuB@PWDZ^e&E?VqrXpY68 z4DZu`Ghqs-eP%xo&IltwUyi(cRz+~0Eb93JAa@7GCPtsLr4O?GTP1i<@qZa^>K(Jb zptDmNCoxXu>Q29D)veGs9(x}@K$htJj0MJ}7k95>oX~Y9mI~9d-OCIjrH%&Cd;KwR zYGX8Axn&&cxcBhQtHw)P%_^BwO@>bK*k3`n<}UwS_##I-yu5qW9M|q;M6ifIm5wJ& z9awcU*LX|1U9x(%)?cKypEUhbj?`-J^w?Yr^6R8;~e&VmEb)624 zz*VVwvP*bBGySjlLhENCty_u`{!qhI9@o7Fi+X8WINet$Js3{+=1CYe3scley5H#M z4;s&Eh)v|1oNt*b=`~PUj=Zl1Q~~}D-3ndgQ}~GKu#W+U>TgM^7ijhy+A_VFkct?k zn+gs74(o?Y&c}4#w98LUS>apOr}EMmw-)C5-(T{1?1d0~gggKp{*kmh?9`@>MQVY{ z(RYkUwSpLV0jxIk?XdHM){wU4lmH2S($LB(v8n8(5ot~Nbr$Kc8(z~zPQg2v&ZqlP zZt5=Be)(XZ(yl@&%zpZdu3xlHG=G|(3S}|0sJ-f%9LXj{ZUw&+c~H$~8|nx1dBk%8 zv@IRTzd31dr8aj)l!8Nw+BW)*mg6fW9lcktq;ve%4hI)G<A?1>CU;)md|Ln4`{l3|bFV}y!#=7xMxPz-&+>IN7eK1< zZ7c&NSsi9~XyIciN8)yXnl$hSa?qDNcJ2T$Zbb%kxxO<{R$6D;uT&O8#~8imAR$O= zr7}PI1p460dpaXA-*69_a>1ib#J(U>vS2pkD;oF*L%$Sj;Zs_r;0Q%EMc(51#q&N( z?AZfo%JxG#?q_YY0~Vjt@9=L2HENaMUk7KPkuN4z?BY0?U2{} z1X=^h_{5=!ij4Mrq}WS)$PhGDGNs+oX_D2ao@RoSq#CmSWIShxg$5L{cE;FJc%mxJ zjF8gKsM$BB%Iu$W=`{A@Zp@9pL}(h2HNBOm*bH*AhBMNZheR$5PgD+gmV+gs1~W2E zNk0{TEUXo2Z&Ur@XHfQSfF*z@06PIM0CoW$1Ss;ugB->b_=z|*GN|axY1x+#FoM$e z$bUmS_uP#&+*H^3$3pD0tAj>4i(M7TEd6(Q3%fZ|8eFKp@kF+I$qBRPV9@O82IR;| zwkG=ecda6r<>CpJru$|2hyB(lWXwB07$@r|~wJ5n$ zqMJ& z#W8EBc5xqM`M`e%N9&_$7bNlR%NGbngFchX`r1hRKs7Dz;im5DVRqw;s z(uc8BzWYYPw_{Wy3w=rS1084g0YZRU0PP#vS5#y2DEymfe3a(Kh{jmUR_Y@U5P1B{ z6sQIZX{X;X{|>&VHy>I=h8CkAb{(S-z&&KbCipAO_nR;$0I0#spcpxPos3UK+xAD3 z@pIsPU5aMc&=$9#2IYAEEp!NJEh&wkj4y^=7#%-fg2zh76&**k+;p7LIy}EVi;R|? z)=TfjS`X<(I!cp_XDYL#Zh*?8XrKIMfYztAA1wx5VA#eC(7k|;Q(B)TfGfdokWJ#T=2EE?4^C_*II*-md^t3W-ojYGxX?P7c2ML} zQ-4Ty>EPW5tDuu1h8X}#6MUO=!D=IA8L9^bU;vaCC*!BVgAp;JLW_P%asS+R6GGmx zgce~DLOnt|LIc9d2y+oS5t`>XMGo(=1P%|q7=WE*t&`eA zQoG0nvcZO!R#M8H0!=WTIIj4_idhQF<6@cuDIGu?8LT-L*h}X8=!q?d#<7m|nJFEZ zOG*YJ1TD*>E@TFA3`A%Snbn5>#)clUW@Yz<&Uy!NJ#iy(Rc(N`5t+EY%p@*gPX^c1 ztc%*&lP<e^v(q>YYxLJUlozRd7HjLX`u_c5qD{@ z*iTt~(tV+b+KMB+=)=_hFlSzl?_BLGwIvU{V1A+5HQCP`N+YnjQosT z$N-7$H064X{k9oj{zL;yun?g(Dqlzr&lmm`o5y*6_HcO{K^inYJ3_;2*}ggBDaV4D z_TiQ-Tb@|eVBVe(gob8%5}gsUD0c;=VAF5^`R<8eM^K4nh`zV%_N`Dpfy=i*1 zY*dS}j&MC8*p(HQG1IlBH~V)l?~QUkzUt=XN36S763amRf%efdP;F`YuWj*#wN)EK z#P)88g|8*bV`VUhdAbArY_yGfFSi5i5QDmPL|)G=9d9aHQqiH)qYlJl@LE0D_bWE@ z7c;8^t@^Th7xiZyP2|qBRUE~2G%W@z7JKa<#WUVC@s5fQ zbcT8QB6wL}IoV@-nAkq|uXuQS>rBt;hhXKz7GMpUf%0M>@7)RdqyjBCnh!kG!+$R2 zM~t$3` zTF;!#WHUWG5GyuXQLD&aX&#g}u+{gQ`Is%>uoQ|+@dQ!T4@(KyPt@n{pmxa}l(V9W z=qtuv9=%MN;OLIVG^!I+a>rOOj^)<|AM)8;i^C5ovw`xy{xkGztc3qid`T3uMJLvR zz7G|F=P!UxM93hlMaUw20wITR8$ur8PJ}9iyAY}oJ~Lx$LgQQ|(wyEL^s6){R`|>~ zW5Xr?Hnbe;`8C6*dCiHR`aY>`sI7Cm&hHK-<2MZdWd6+yGH`ALqt*7S&cE2BhwHbK z&66Uz0vX^|yx5b$9#3dBR3gs88w1h9W^?VsiM)<|y*us&<=^#A^V4(p_14|H4>Rcg zXfvLeY9E^$IHv0T%~~;G>lp1fW@he`kE5S66(?rl9E-c|`%l2-cg3G2y0$fnD8Yr< z?laAX2%UYZ62NTldrZKUBt_>ltDg9GF1pSfciobe*79lv+nl6yE7z)tE&xqI_8aG%96IaA;wD z23kj!;eD9_9)WR7p}h-cLSF*D0sPp9$wEl;-2m##!~@6yXj;IvvVnthO%i9bE8G|- zcymHZCqRSU^*ih~RLACP=x~xBy-V#tdLDiR410PQBem=5i7|F#3yU^*K6K-8*1jm} zSG-;1s0L18_gYSOsnNc?1)ALXmuJCEUIVN=e`Dj$=T;E=gVE~q_fO0AoBY|>?;gVb z4$X2OvETcn=RTk7{1?~{`7#&u+(uK~cZughmP&YgD1<+C-Zt0Uh4bepVMlx<`+C0_ ztNK&G3I-yK?ZflNukS;boyLjljQVr7VVoTo0FEzgp)s}dOIwU z)*qe}DLX4E9xYEYejD=pGjKC6YC$vBP@-|vF|0e8hPDY;4x8h$) zwgM&F?aphrZCbI3DQjpR)2@_u1J$)0wT;%GzPaL}@HUYY&z<{9vnn!8EJyBbNoJ;@ zRk04=Fi<<*gFVW|ZK&9=aYLZ;Xb;0sj{OJC$@nzjztC5$p{+h?kXi_IC$+vp=(}PU z3u(R36b%{uunU7t=JR+@>4+w*G)=&tUjxX>o+K~W?=#mv+Eg!+(z(%>7hF~AI~g4-CYg9lkoW2Wt(7{#kqY*&0ekSd%M2GrQ#64fKoI zq20dU&d;x%5e)b4T|X0?gP%pzojtHXZv_8<*k*$b?>avZDc>9k_a0e)KKdKqliq@0 zA+RM5HY}&4C#rYBy6bC5S`Od~g?f8(`nnwKwJ!N+Xze<+qb7Qx)||$csug`SrZhX6 zV+&QYT_I4)zS>`GdJa84Ui>|*y>m}Kh&Aw}vM&-vqOTupjh$*<;fQzs(z^rvTj)oX z^hDBwU&N-1YoWV%Rf0@C8!1^A@Ro@m=xD1xgnC=xw`1>GT7%U-vt+DoXeN%|MZhnG zUb!(;vMv?VncNc7I`X2-#2nl5>f5V~1N@47&vaVHEgRr&$&7Hn;3|{3%iuHLFyHxEI1yzh`d7;nT1yPL~{V%9U5b6*0CkfBrUlZ z#Xi$TY|TNhXB+$}e-qsv;15i$wkFt&Lb_`kr-=;`)psEFe?;4$SEY6QSLewXEMGas zkrgeO=X@Xs*d4!!#rNa9tUWt$J?xBbi?HC_SH@WT`itVLYvEmc{YCey(;lF0dE3CW zby5ucr|3Ru`8vxw>RaYe{}1=w1K)nlIj+0d{X5=K1bt#^!SmJc_JC7#`s+rF*#m&L z0CWt$0yqLV16s8M;bZVuCIIOCk}%GXyp|f{f5$ja`7c=C+x|Q9_FG@4i`wc!l$6VjD4 z0lAZDwaoM#&1s>c)@+P|l)o|R#Q_%QNdFMkM4Ak5@6g&&(fu2GEIOwK`V2gB(i$+= zcQE_GD;xR;Z5Nb{whhf|%GpGP_E`;NJ=?_HB0F&f^oaTB=^*8&&zY-@P>&*?C^N56 zFm*8#zl&Lv_3hg}CnQ;;B@u+QuIGav>2ljk0-F-VU_NT?9zURE2wnZ5R1DG{!S{id9G@C=1(~4|UkcJWsHO6EP!cYyzB;1{yU5`3b;mTE zc=3d`m4Pft<4v6g)dXwxOHs;~IHma-^X;qH`zTwY6}}yjF0Bu2h->s!YK) z!J8&m^hRvVWFY{Al6qX(RrV4-J4@UuiH#5;uOigjs@ zanaN}b+^bmLW{`pLQ9aH?)H!!6&}`V!ATC32Ui}>y*v^WS=u(d=O0cx@`1|tiFY<6mw0DREzLsEKm46Hb#I&vp~lnZ3o(pM<8XOHXZ~sk^F+;S4(0e93O%AOC0Y<##aBK`wv{cM-ZuJ!;YA>G(VbG4gIkJlC!Gz`ZXoN zAHGh;=P3Ra4@Fkh3gXcVE|x)>^t%^gbi6hu_Qb{udt!RwIkd^2QAavP==>!3qjjbs zcpYA492cp?&x4!Yz+d1GrM@|%Iuot*)_@Dv?5Bg2o4F+6Y=te*sq#VVd{)z=c6(+j0+iiW?|g>%?4|Jiw0MnV4!w|74%EcXfk# z-*Q-#!H>{nC-n3alq<_)@1tYw=R@&WU9(dxMJb<-MBfFIM%( zW8jg}=cB(r8~L4@oBvmB*B{ixmB-)i2J)jpsMU(#z?#s?4-HHB(SV%BB&-G$IHfn< zcs&eBEU7>+M8#64N%2}+?`nT&PkSBfh}Wz2Y7gz*$kk3e*1NX%qeEzCD(%s+=hQvm z+JfQ`5*zOGHi%;FpSPK}Z}Z;wz5V`rZ{NQCzVA!SQ$o9*5e;aYwRw4=dDZIn#8CrB zo@aH5qxoD8Y~LHcqZXF5H;(s@)H({b8o}f3kB65C^W>3|QOwl80Ir&V+2g?Mzf+h| zPA<&)N=nV5GNE`-Ubg;Gk5z7ovR;qyJDH8)qh?T1l+JvW$S;$ZDJIsSg^Qz7dGb?9pF5XYBEg1wjzBG7lLf7=p-S;Q#s>_m|M@Cd zDB{U}H^vE}h?f6Mnw`5mw4s{%nBfWodZBSkI-47&C+0_f-|j{N^Y2!pbW)Zi~fRCM$C^k@8F+ zc}bsN?8wc_=9>S9rTZ7w=WjXN;2(YlM68ld$PsM+fu5Tj)ztYR*Kj zjF4Y*(UkXC8@;1`g2}j7?nQ9l0PRU$lW3c}f1Slj^&9az3IAzd8%9j^{Q$dgA>>F?kruAj+A#!XezI#oxYT*S3(o>Qz$=M@r`Hs*qIZJmncs3p!iXo>ARx7 zy{!j!so_SX1U*Et0&d&{ObC_+bCZ$YYl)yU)_+bA-LZN0j6H z%`1mE)jo60(A;Xh_H;Bho*DVYwOP@5yRAbit1_w`J!nz)52q?eCxyUBdhj4-D^r8) z@;uuH%=@2;#ztmEQwnWEoQ*`a*N#@G`xnnA@O2m%Q3j7zm@g}WtZA{$Jft)q9mY)7 zqKxiO%tZg!L1HbXzT2MIgW8D!7TN)_2&oKYDW{)`bdHn!m7zTr_G5SryBrDZN^`)j zj^Pi8bp0-1R}DyP&*T@BCOWgaH(*bvQ~>`lv#2{7yQbI9iY~Yl9&xNHnGPlB(1H%O z?;vXYXJD83)3mOWfTT3cu?{J0uzd<2u24?V!1f)6t>m8qsp8RLmBKuvHNPyqKgw(0 zGV3DRSoIJ$i-{=5_=xuE!ie@t%}~awd#tCT;fcjsRdjw~X5{Gz_+nK@HDfPX*og8n zi6}?!=+6KZYMGl)1YQC+cLk1(vg$Tldiv|&XLv*fepbl*)I^R{r~t1}P>ycyJ5u54 zXH9-^Q*DO-%O{TxYZR+1&WcrH-N!%fB?eD#_pm0xHOwg#5$(0_%-77ThY}LNsXDS~ zr39&Se1wCTHQ@A`BBR$A5!jqO?3nWemq9b2mKPEs>2?Y6-C)iBE`&s#DM zS~R^hheb|U>a<+#52p5|eJq!NpQtqq0(Q+4ah*rMfu*J~COW6al){p`r}b^Uh|=|_ zcf(IImh{ZAb>YtRUqo6U8pW?MZ${n;pHZDTgqgUTuW6fR@Ohg0G*xhFMK+k`A`Y?% zE*rOELmof6K09ea+E(mG;76*5xN&taXCX~UbI*WmA!~_9im_LK37-fBqTvc~U5IPl zZQ<9UJgw1zy0U%%!cV+_agYZAd;40fQ@D9aGg%G)thEU32!{|}Mfe-SHwgFwNruax zflEG~2Et;hjWv^HneboE;CJK5vA`un^;)smXsM~G<9TsKT|o)Y^W_U&UZ;OYtDA51 zH#aTQl*>_hgV(iVS$Uh&=V|pX(=>UV4!_6SV(__Jn;cGewyx3dZ*42f&)>d%yTRdd zZ1QdO_zg~PbAGGO>)Pt{=Lh2zy?^c6it0K_m`nyG(Bk#_o4gK}+sETEB_wIqcwO$MGJeGr3cRIh zt6N5fZ=tj%X)Ioc&$YyEE8}J2mrMgJ*@ogb>MP^d6%+}4i9s+3i{nv}M)o0xx^3e9 zWcn8N7T4A`zt7`tBh_A?%j4v0tt$!yp}2&6uL_DdT|cZ3of)cc*U$ap+u5^e8nq)} z5$}ICnS>DTd_I{l`{*;6kT0L3enbdavp<~jzZV0tioMMg)v{X5?T9>%ZIS1mUAqlC?juy`*cbnhv zP@A`b=T8$WqdqEPIYbCTEEThYeQQ@hF~aOEJMqAZQf0OmwTJX>8@{>ZU!@o z%U}(jmikSeCO2|)ZLa!;CIeD*H|mK4HPyFy9;PtHVq=NvmRy&^e@hiexwQ&Ui^pHz z>Tqs$`|FYI_#P(mjU275O`dq?aT8%h#?qqFlKYIMH_=DI>7kpV(Fane_)t_-R8lw- z$D1K(?}fXYjJE;V1&%FhJ8>TrgqcwFZDK0K7 z`d-chGg5ZWte#3?irEE4rXu5w;ydMHJ2g9Ns~C0;cSC{p4{S73rKUkGt5y8;W{}2l zseSn+f*D8sGAZdKR#y|7VF@H{HIuBfu|)>b7X(rmo>kz Date: Tue, 7 Jul 2020 13:01:21 -0500 Subject: [PATCH 151/277] modified: .github/workflows/build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa7dd9dd25..68dbb04c76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -236,6 +236,7 @@ jobs: - "pyportal" - "pyportal_titano" - "pyruler" + - "raytac_mdbt50q-db-40" - "robohatmm1_m4" - "sam32" - "same54_xplained" From dc2f729d193e18238306d810e822ae47befe6c2d Mon Sep 17 00:00:00 2001 From: Arudinne Date: Tue, 7 Jul 2020 14:37:08 -0500 Subject: [PATCH 152/277] modified: ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c --- ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk | 2 +- ports/nrf/boards/raytac_mdbt50q-db-40/pins.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk b/ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk index ec39f6fd81..f49618e776 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x802A +USB_PID = 0x80BC USB_PRODUCT = "MDBT50Q-DB-40" USB_MANUFACTURER = "Raytac Corporation" diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c b/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c index 33693697a1..f6a6ed5ed4 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c @@ -30,8 +30,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) }, { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) }, { MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) }, - { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) }, { MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) }, { MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) }, { MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) }, From 57ab4f1329f61844409735189a482359d7d4b7a7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 24 Jun 2020 11:28:28 -0500 Subject: [PATCH 153/277] stm: SPI: revamp pin search code I discussed with Hierophect on Discord about how to "de-nest" the code for configuring SPI objects on STM, because the problems with one nesting level per pin becomes unmanageable with the up to 10 pins of SDIO. This code (which is only compile-tested so far) demonstrates the concept we discussed. The SCK pin is always required. Loop over all possibilities of the SCK pin. When we are considering a particular item in the mcu_spi_sck_list we have now become committed to using a particular periph_index. If all the other pins can be satisfied by that periph_index, then we have a working combination. Once we have a working combination that is not reserved, we can return that combination. On reaching the end, we have checked all the possible possibilities and can give the same errors as before: One if there was a possibility that worked but was reserved; and another if no possibility worked. --- ports/stm/common-hal/busio/SPI.c | 148 +++++++++++++------------------ 1 file changed, 61 insertions(+), 87 deletions(-) diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index c76705cd85..d4dd6cb3fc 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -107,105 +107,79 @@ void spi_reset(void) { spi_clock_disable(ALL_CLOCKS & ~(never_reset_mask)); } -void common_hal_busio_spi_construct(busio_spi_obj_t *self, +STATIC const mcu_periph_obj_t *find_pin_function(const mcu_periph_obj_t *table, size_t sz, const mcu_pin_obj_t *pin, int periph_index) { + for(size_t i = 0; iperiph_index && pin == table->pin ) { + return table; + } + } + return NULL; +} + +//match pins to SPI objects +STATIC int check_pins(busio_spi_obj_t *self, const mcu_pin_obj_t * sck, const mcu_pin_obj_t * mosi, const mcu_pin_obj_t * miso) { - - //match pins to SPI objects - SPI_TypeDef * SPIx; + bool spi_taken = false; uint8_t sck_len = MP_ARRAY_SIZE(mcu_spi_sck_list); uint8_t mosi_len = MP_ARRAY_SIZE(mcu_spi_mosi_list); uint8_t miso_len = MP_ARRAY_SIZE(mcu_spi_miso_list); - bool spi_taken = false; //SCK is not optional. MOSI and MISO are - for (uint i = 0; i < sck_len; i++) { - if (mcu_spi_sck_list[i].pin == sck) { - //if both MOSI and MISO exist, loop search normally - if ((mosi != NULL) && (miso != NULL)) { - //MOSI - for (uint j = 0; j < mosi_len; j++) { - if (mcu_spi_mosi_list[j].pin == mosi) { - //MISO - for (uint k = 0; k < miso_len; k++) { - if ((mcu_spi_miso_list[k].pin == miso) //everything needs the same index - && (mcu_spi_sck_list[i].periph_index == mcu_spi_mosi_list[j].periph_index) - && (mcu_spi_sck_list[i].periph_index == mcu_spi_miso_list[k].periph_index)) { - //keep looking if the SPI is taken, edge case - if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) { - spi_taken = true; - continue; - } - //store pins if not - self->sck = &mcu_spi_sck_list[i]; - self->mosi = &mcu_spi_mosi_list[j]; - self->miso = &mcu_spi_miso_list[k]; - break; - } - } - if (self->sck != NULL) { - break; // Multi-level break to pick lowest peripheral - } - } - } - if (self->sck != NULL) { - break; - } - // if just MISO, reduce search - } else if (miso != NULL) { - for (uint j = 0; j < miso_len; j++) { - if ((mcu_spi_miso_list[j].pin == miso) //only SCK and MISO need the same index - && (mcu_spi_sck_list[i].periph_index == mcu_spi_miso_list[j].periph_index)) { - if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) { - spi_taken = true; - continue; - } - self->sck = &mcu_spi_sck_list[i]; - self->mosi = NULL; - self->miso = &mcu_spi_miso_list[j]; - break; - } - } - if (self->sck != NULL) { - break; - } - // if just MOSI, reduce search - } else if (mosi != NULL) { - for (uint j = 0; j < mosi_len; j++) { - if ((mcu_spi_mosi_list[j].pin == mosi) //only SCK and MOSI need the same index - && (mcu_spi_sck_list[i].periph_index == mcu_spi_mosi_list[j].periph_index)) { - if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) { - spi_taken = true; - continue; - } - self->sck = &mcu_spi_sck_list[i]; - self->mosi = &mcu_spi_mosi_list[j]; - self->miso = NULL; - break; - } - } - if (self->sck != NULL) { - break; - } - } else { - //throw an error immediately - mp_raise_ValueError(translate("Must provide MISO or MOSI pin")); - } - } + if (!sck) { + mp_raise_ValueError(translate("Must provide SCK pin")); } - //handle typedef selection, errors - if (self->sck != NULL && (self->mosi != NULL || self->miso != NULL)) { - SPIx = mcu_spi_banks[self->sck->periph_index - 1]; - } else { - if (spi_taken) { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); - } else { - mp_raise_ValueError(translate("Invalid SPI pin selection")); - } + if (!miso && !mosi) { + mp_raise_ValueError(translate("Must provide MISO or MOSI pin")); } + // Loop over each possibility for SCK. Check whether MISO and/or MOSI can be used on the same peripheral + for (uint i = 0; i < sck_len; i++) { + const mcu_periph_obj_t *mcu_spi_sck = &mcu_spi_sck_list[i]; + if (mcu_spi_sck->pin != sck) { + continue; + } + + int periph_index = mcu_spi_sck->periph_index; + + const mcu_periph_obj_t *mcu_spi_miso = NULL; + if (miso && !(mcu_spi_miso = find_pin_function(mcu_spi_miso_list, miso_len, miso, periph_index))) { + continue; + } + + const mcu_periph_obj_t *mcu_spi_mosi = NULL; + if (mosi && !(mcu_spi_mosi = find_pin_function(mcu_spi_mosi_list, mosi_len, mosi, periph_index))) { + continue; + } + + if (reserved_spi[periph_index-1]) { + spi_taken = true; + continue; + } + + self->sck = mcu_spi_sck; + self->mosi = mcu_spi_mosi; + self->miso = mcu_spi_miso; + + return periph_index; + } + + if (spi_taken) { + mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + } else { + mp_raise_ValueError(translate("Invalid SPI pin selection")); + } +} + +void common_hal_busio_spi_construct(busio_spi_obj_t *self, + const mcu_pin_obj_t * sck, const mcu_pin_obj_t * mosi, + const mcu_pin_obj_t * miso) { + + int periph_index = check_pins(self, sck, mosi, miso); + SPI_TypeDef * SPIx = mcu_spi_banks[periph_index - 1]; + //Start GPIO for each pin GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitStruct.Pin = pin_mask(sck->number); From 5a9aac472a42b39a34e906a4260dd842f388d9f2 Mon Sep 17 00:00:00 2001 From: Arudinne Date: Tue, 7 Jul 2020 14:37:59 -0500 Subject: [PATCH 154/277] modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c --- ports/nrf/boards/raytac_mdbt50q-db-40/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c b/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c index f6a6ed5ed4..33693697a1 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c @@ -30,8 +30,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) }, { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) }, { MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) }, - { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) }, { MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) }, { MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) }, From 959b4da9bbaf48e10707b1a5859f7cc4c5ee0b84 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 7 Jul 2020 14:38:34 -0500 Subject: [PATCH 155/277] make translate --- locale/circuitpython.pot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 6e32ebab98..f3c9d04113 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1092,6 +1092,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" From 768149fb014b81e42c17102335ed539f00f51a7c Mon Sep 17 00:00:00 2001 From: Arudinne Date: Wed, 8 Jul 2020 10:36:41 -0500 Subject: [PATCH 156/277] modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c --- ports/nrf/boards/raytac_mdbt50q-db-40/pins.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c b/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c index 33693697a1..426498cc20 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/pins.c @@ -48,7 +48,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) }, { MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) }, { MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) }, - + { MP_ROM_QSTR(MP_QSTR_AIN_0), MP_ROM_PTR(&pin_P0_02) }, { MP_ROM_QSTR(MP_QSTR_AIN_1), MP_ROM_PTR(&pin_P0_03) }, { MP_ROM_QSTR(MP_QSTR_AIN_2), MP_ROM_PTR(&pin_P0_04) }, @@ -60,17 +60,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_NFC_1), MP_ROM_PTR(&pin_P0_09) }, { MP_ROM_QSTR(MP_QSTR_NFC_2), MP_ROM_PTR(&pin_P0_10) }, - + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_06) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_08) }, { MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_P0_07) }, { MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_P0_05) }, - + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_P0_14) }, { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_P0_13) }, { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_P0_15) }, { MP_ROM_QSTR(MP_QSTR_LED_4), MP_ROM_PTR(&pin_P0_16) }, - + { MP_ROM_QSTR(MP_QSTR_SW1), MP_ROM_PTR(&pin_P0_11) }, { MP_ROM_QSTR(MP_QSTR_SW2), MP_ROM_PTR(&pin_P0_12) }, { MP_ROM_QSTR(MP_QSTR_SW3), MP_ROM_PTR(&pin_P0_24) }, From 83a27edd20de293927e8070da8585b11cb2f8ef7 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Wed, 8 Jul 2020 19:59:53 +0200 Subject: [PATCH 157/277] SAMD: make the brownout detection level configurable per board Not all boards have external flash or other components that make them require 2.7V -- sometimes we can get considerably longer battery life by decreasing this requirement. In particular, pewpew10 and pewpew_m4 are powered directly from battery, with no LDO, and should work fine down to 1.6V. --- ports/atmel-samd/boards/pewpew10/mpconfigboard.h | 2 ++ ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h | 3 +++ ports/atmel-samd/mpconfigport.h | 10 ++++++++++ ports/atmel-samd/supervisor/port.c | 6 +++--- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.h b/ports/atmel-samd/boards/pewpew10/mpconfigboard.h index 6b3b4aa15c..940e250b46 100644 --- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.h +++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.h @@ -43,3 +43,5 @@ #define DEFAULT_UART_BUS_RX (&pin_PA01) #define DEFAULT_UART_BUS_TX (&pin_PA00) + +#define BOARD_BROWNOUT_LEVEL (6) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h index 60cd8d754f..7da5cf14c1 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h @@ -40,3 +40,6 @@ #define IGNORE_PIN_PB09 1 #define IGNORE_PIN_PB10 1 #define IGNORE_PIN_PB11 1 + +#define BOARD_BROWNOUT_LEVEL (6) +// 1.6V diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 354097ce41..3a5d4e1a2f 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -112,6 +112,11 @@ #define CIRCUITPY_DEFAULT_STACK_SIZE 4096 #endif +#ifndef BOARD_BROWNOUT_LEVEL ( +#define BOARD_BROWNLOUT_LEVEL (39) +// 2.77V with hysteresis off. Table 37.20 in datasheet. +#endif + // Smallest unit of flash that can be erased. #define FLASH_ERASE_SIZE NVMCTRL_ROW_SIZE @@ -129,6 +134,11 @@ #define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) #endif +#ifndef BOARD_BROWNOUT_LEVEL ( +#define BOARD_BROWNLOUT_LEVEL (200) +// 2.7V: 1.5V + LEVEL * 6mV. +#endif + // Smallest unit of flash that can be erased. #define FLASH_ERASE_SIZE NVMCTRL_BLOCK_SIZE diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index e892e6cde5..5b085dc81b 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -206,11 +206,11 @@ static void rtc_init(void) { safe_mode_t port_init(void) { #if defined(SAMD21) - // Set brownout detection to ~2.7V. Default from factory is 1.7V, + // Set brownout detection. Default from factory is 1.7V, // which is too low for proper operation of external SPI flash chips (they are 2.7-3.6V). // Disable while changing level. SYSCTRL->BOD33.bit.ENABLE = 0; - SYSCTRL->BOD33.bit.LEVEL = 39; // 2.77V with hysteresis off. Table 37.20 in datasheet. + SYSCTRL->BOD33.bit.LEVEL = BOARD_BROWNOUT_LEVEL; SYSCTRL->BOD33.bit.ENABLE = 1; #ifdef ENABLE_MICRO_TRACE_BUFFER @@ -229,7 +229,7 @@ safe_mode_t port_init(void) { // which is too low for proper operation of external SPI flash chips (they are 2.7-3.6V). // Disable while changing level. SUPC->BOD33.bit.ENABLE = 0; - SUPC->BOD33.bit.LEVEL = 200; // 2.7V: 1.5V + LEVEL * 6mV. + SUPC->BOD33.bit.LEVEL = BOARD_BROWNOUT_LEVEL; SUPC->BOD33.bit.ENABLE = 1; // MPU (Memory Protection Unit) setup. From 6d97f6fcccbf08a95242dfb5202a4e95825ee3f3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 8 Jul 2020 20:31:35 -0500 Subject: [PATCH 158/277] audioio: Remove compatibility code These items were aliased from audiocore to audioio for compatibility with 4.x, but according to our deprecation schedule can be removed in 6.0. --- py/circuitpy_mpconfig.mk | 3 --- shared-bindings/audioio/__init__.c | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 302368f74a..84fb926b5e 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -45,9 +45,6 @@ CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO) CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO) -CIRCUITPY_AUDIOIO_COMPAT ?= $(CIRCUITPY_AUDIOIO) -CFLAGS += -DCIRCUITPY_AUDIOIO_COMPAT=$(CIRCUITPY_AUDIOIO_COMPAT) - CIRCUITPY_AUDIOPWMIO ?= 0 CFLAGS += -DCIRCUITPY_AUDIOPWMIO=$(CIRCUITPY_AUDIOPWMIO) diff --git a/shared-bindings/audioio/__init__.c b/shared-bindings/audioio/__init__.c index 7ec927834f..a9c58e8645 100644 --- a/shared-bindings/audioio/__init__.c +++ b/shared-bindings/audioio/__init__.c @@ -33,15 +33,6 @@ #include "shared-bindings/audioio/__init__.h" #include "shared-bindings/audioio/AudioOut.h" -#if CIRCUITPY_AUDIOIO_COMPAT -#include "shared-bindings/audiomixer/Mixer.h" -#include "shared-bindings/audiocore/RawSample.h" -#include "shared-bindings/audiocore/WaveFile.h" -#endif -#if CIRCUITPY_AUDIOMIXER -#include "shared-bindings/audiomixer/Mixer.h" -#endif - //| """Support for audio output //| //| The `audioio` module contains classes to provide access to audio IO. @@ -62,13 +53,6 @@ STATIC const mp_rom_map_elem_t audioio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audioio) }, { MP_ROM_QSTR(MP_QSTR_AudioOut), MP_ROM_PTR(&audioio_audioout_type) }, -#if CIRCUITPY_AUDIOIO_COMPAT - #if CIRCUITPY_AUDIOMIXER - { MP_ROM_QSTR(MP_QSTR_Mixer), MP_ROM_PTR(&audiomixer_mixer_type) }, - #endif - { MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) }, - { MP_ROM_QSTR(MP_QSTR_WaveFile), MP_ROM_PTR(&audioio_wavefile_type) }, -#endif }; STATIC MP_DEFINE_CONST_DICT(audioio_module_globals, audioio_module_globals_table); From bb5cdcf9548d2a25a2aabf70e592f624c98bbec5 Mon Sep 17 00:00:00 2001 From: arms22 Date: Thu, 9 Jul 2020 11:26:45 +0900 Subject: [PATCH 159/277] Add new board BLE-SS dev board Multi Sensor --- .github/workflows/build.yml | 1 + .../bless_dev_board_multi_sensor/board.c | 12 +++++ .../mpconfigboard.h | 17 +++++++ .../mpconfigboard.mk | 8 ++++ .../bless_dev_board_multi_sensor/pins.c | 45 +++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 ports/nrf/boards/bless_dev_board_multi_sensor/board.c create mode 100644 ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.h create mode 100644 ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.mk create mode 100644 ports/nrf/boards/bless_dev_board_multi_sensor/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa3aee4a5d..adefa8b132 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,6 +142,7 @@ jobs: - "arduino_zero" - "bast_pro_mini_m0" - "bdmicro_vina_m0" + - "bless_dev_board_multi_sensor" - "capablerobot_usbhub" - "catwan_usbstick" - "circuitbrains_basic_m0" diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c new file mode 100644 index 0000000000..71b9a06577 --- /dev/null +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c @@ -0,0 +1,12 @@ +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.h b/ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.h new file mode 100644 index 0000000000..7fffd86ccd --- /dev/null +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.h @@ -0,0 +1,17 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "BLE-SS dev board Multi Sensor" +#define MICROPY_HW_MCU_NAME "nRF52840" +#define MICROPY_HW_LED_STATUS (&pin_P0_07) + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_26) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_24) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_13) /* n.c */ +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_14) /* n.c */ +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) /* n.c */ + +#define DEFAULT_UART_BUS_RX (&pin_P0_02) /* TP7 */ +#define DEFAULT_UART_BUS_TX (&pin_P0_03) /* TP6 */ + +/* Note: Flash chip is not provided. */ diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.mk b/ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.mk new file mode 100644 index 0000000000..90b0908505 --- /dev/null +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x2786 +USB_PID = 0x9207 +USB_PRODUCT = "BLE-SS dev board Multi Sensor" +USB_MANUFACTURER = "Switch Science, Inc." + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/pins.c b/ports/nrf/boards/bless_dev_board_multi_sensor/pins.c new file mode 100644 index 0000000000..c6010a8c33 --- /dev/null +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/pins.c @@ -0,0 +1,45 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_02) }, // TP7 + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P0_03) }, // TP6 + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P0_04) }, // LED1 + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_05) }, // U2-BMX055-INT1 + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_06) }, // U2-BMX055-DRDYM + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_07) }, // LED2 + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_08) }, // U4-HDC2010-DRDY/INT + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_09) }, // TP1 + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_10) }, // U3-LPS22HB-INT_DRDY + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_12) }, // S2 + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_P0_23) }, // BZ1 + { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_P0_28) }, // U2-BMX055-INT4 + { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_P0_29) }, // U2-BMX055-INT3 + { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_P0_30) }, // U2-BMX055-INT5 + { MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_P0_31) }, // S1 + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, // A0/TP7 + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, // A1/TP6 + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_24) }, // 24 - SDA + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_26) }, // 26 - SCL + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_13) }, // 13 - MISO (n.c) + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_14) }, // 14 - MOSI (n.c) + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_15) }, // 15 - SCK (n.c) + + { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P0_07) }, // 4 - LED1 + { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_P0_04) }, // 7 - LED2 + + { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P0_31) }, // 31 - S1 + { MP_ROM_QSTR(MP_QSTR_BUTTON2), MP_ROM_PTR(&pin_P0_12) }, // 12 - S2 + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_02) }, // 2 - UART RX + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_03) }, // 3 - UART TX + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_QWIIC), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From e81d22cd67c16f95879d8af9a4034d2566922631 Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Thu, 9 Jul 2020 10:01:04 +0000 Subject: [PATCH 160/277] add makerdiary nrf52840 m.2 devkit Signed-off-by: Yihui Xiong --- .../makerdiary_nrf52840_m2_devkit/README.md | 8 ++ .../makerdiary_nrf52840_m2_devkit/board.c | 103 ++++++++++++++++ .../mpconfigboard.h | 52 +++++++++ .../mpconfigboard.mk | 12 ++ .../makerdiary_nrf52840_m2_devkit/pins.c | 110 ++++++++++++++++++ 5 files changed, 285 insertions(+) create mode 100644 ports/nrf/boards/makerdiary_nrf52840_m2_devkit/README.md create mode 100644 ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c create mode 100644 ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h create mode 100644 ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk create mode 100644 ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/README.md b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/README.md new file mode 100644 index 0000000000..b75385414b --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/README.md @@ -0,0 +1,8 @@ +# Makerdiary nRF52840 M.2 Developer Kit + +The devkit is a versatile IoT prototyping platform, +including the nRF52840 M.2 Module and M.2 Dock. You can use the developer kit +to prototype your IoT products and then scale to production faster using the +nRF52840 M.2 Module combined with your custom PCB hardware. + +Refer to https://github.com/makerdiary/nrf52840-m2-devkit for more details. diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c new file mode 100644 index 0000000000..e7f946f4d0 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c @@ -0,0 +1,103 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Yihui Xiong for Makerdiary + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" + +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0x36, 1, 0b10100000, // _MADCTL for rotation 0 + 0x3a, 1, 0x55, // COLMOD - 16bit color + 0x21, 0 | DELAY, 10, // _INVON + 0x13, 0 | DELAY, 10, // _NORON + 0x29, 0 | DELAY, 255, // _DISPON +}; + +void board_init(void) { + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_P0_08, // TFT_DC Command or data + &pin_P0_06, // TFT_CS Chip select + &pin_P1_09, // TFT_RST Reset + 60000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 240, // Width (after rotation) + 240, // Height (after rotation) + 80, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // Pixels in a byte share a row. Only used for depth < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + &pin_P0_20, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true); // backlight_on_high +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h new file mode 100644 index 0000000000..a3fb7643f9 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "nrfx/hal/nrf_gpio.h" + +#define MAKERDIARYNRF52840M2DEVKIT + +#define MICROPY_HW_BOARD_NAME "Makerdiary nRF52840 M.2 Developer Kit" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(1, 15) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(1, 12) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(1, 11) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 13) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_UART_BUS_RX (&pin_P0_15) +#define DEFAULT_UART_BUS_TX (&pin_P0_16) + +#define DEFAULT_I2C_BUS_SCL (&pin_P1_06) +#define DEFAULT_I2C_BUS_SDA (&pin_P1_05) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_11) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_12) +#define DEFAULT_SPI_BUS_MISO (&pin_P1_08) diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk new file mode 100644 index 0000000000..bc5fa3c120 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x1915 +USB_PID = 0xb001 +USB_PRODUCT = "nRF52840 M.2 Developer Kit" +USB_MANUFACTURER = "Makerdiary" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "MX25R6435F" + +CIRCUITPY_ENABLE_MPY_NATIVE = 1 diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c new file mode 100644 index 0000000000..1032555dca --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c @@ -0,0 +1,110 @@ +#include "shared-bindings/board/__init__.h" + +#include "boards/board.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_AIN0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_AIN1), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_AIN2), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_AIN3), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_AIN4), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_AIN6), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_AIN7), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_VDIV), MP_ROM_PTR(&pin_P0_05) }, + + { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) }, + + { MP_ROM_QSTR(MP_QSTR_P2), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_P3), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_P4), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_P5), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_P6), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_P8), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_P9), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_P10), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_P11), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_P12), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_P13), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_P14), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_P15), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_P16), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_P17), MP_ROM_PTR(&pin_P0_17) }, + { MP_ROM_QSTR(MP_QSTR_P18), MP_ROM_PTR(&pin_P0_18) }, + { MP_ROM_QSTR(MP_QSTR_P19), MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_P20), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_P21), MP_ROM_PTR(&pin_P0_21) }, + { MP_ROM_QSTR(MP_QSTR_P25), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_P26), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_P28), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P29), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_P30), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_P31), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_P1_0), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_P1_1), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_P1_2), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_P1_3), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_P1_4), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_P1_5), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_P1_6), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_P1_7), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_P1_8), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_P1_9), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P0_21) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_22) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_P1_06) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_04) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P1_08) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_LCD_BL), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_USR_BTN), MP_ROM_PTR(&pin_P0_19) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 96f6ce222ce057df1a1f97a8d2be51232548d26f Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Thu, 9 Jul 2020 10:02:27 +0000 Subject: [PATCH 161/277] add makerdiary m60 keyboard Signed-off-by: Yihui Xiong --- .../boards/makerdiary_m60_keyboard/README.md | 4 ++ .../boards/makerdiary_m60_keyboard/board.c | 38 +++++++++++++++ .../makerdiary_m60_keyboard/mpconfigboard.h | 48 +++++++++++++++++++ .../makerdiary_m60_keyboard/mpconfigboard.mk | 13 +++++ .../nrf/boards/makerdiary_m60_keyboard/pins.c | 41 ++++++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 ports/nrf/boards/makerdiary_m60_keyboard/README.md create mode 100644 ports/nrf/boards/makerdiary_m60_keyboard/board.c create mode 100644 ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h create mode 100644 ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk create mode 100644 ports/nrf/boards/makerdiary_m60_keyboard/pins.c diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/README.md b/ports/nrf/boards/makerdiary_m60_keyboard/README.md new file mode 100644 index 0000000000..04486ba210 --- /dev/null +++ b/ports/nrf/boards/makerdiary_m60_keyboard/README.md @@ -0,0 +1,4 @@ +# Makerdiary M60 Keyboard + +M60 is a USB & BLE, modular, hot-swappable, 60% keyboard powered by Python. +Refer to https://makerdiary.com/m60 for more details. diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/board.c b/ports/nrf/boards/makerdiary_m60_keyboard/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/makerdiary_m60_keyboard/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h new file mode 100644 index 0000000000..c59a5fdb28 --- /dev/null +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "nrfx/hal/nrf_gpio.h" + +#define MAKERDIARYM60KEYBOARD + +#define MICROPY_HW_BOARD_NAME "Makerdiary M60 Keyboard" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(1, 15) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(1, 12) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(1, 11) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 13) + +#define BOARD_HAS_CRYSTAL 1 + +// #define DEFAULT_UART_BUS_RX (&pin_P0_15) +// #define DEFAULT_UART_BUS_TX (&pin_P0_16) + +#define DEFAULT_I2C_BUS_SCL (&pin_P1_06) +#define DEFAULT_I2C_BUS_SDA (&pin_P1_05) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk new file mode 100644 index 0000000000..59eba13343 --- /dev/null +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x1915 +USB_PID = 0xb001 +USB_PRODUCT = "M60 Keyboard" +USB_MANUFACTURER = "Makerdiary" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "MX25R6435F" + +CIRCUITPY_ENABLE_MPY_NATIVE = 1 + diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c new file mode 100644 index 0000000000..63c3ad1711 --- /dev/null +++ b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c @@ -0,0 +1,41 @@ +#include "shared-bindings/board/__init__.h" + +#include "boards/board.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_R1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_R2), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_R3), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_R4), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_R5), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_R6), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_R7), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_R8), MP_ROM_PTR(&pin_P0_11) }, + + { MP_ROM_QSTR(MP_QSTR_C1), MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_C2), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_C3), MP_ROM_PTR(&pin_P0_21) }, + { MP_ROM_QSTR(MP_QSTR_C4), MP_ROM_PTR(&pin_P0_22) }, + { MP_ROM_QSTR(MP_QSTR_C5), MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_C6), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_C7), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_C8), MP_ROM_PTR(&pin_P0_26) }, + + { MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_05) }, + + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_P0_27) }, + +// { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) } +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 8fef69809c34ff85651649790336fb7164cc38d3 Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Thu, 9 Jul 2020 10:04:26 +0000 Subject: [PATCH 162/277] add m60 keyboard and nrf52840 m.2 devkit to build action Signed-off-by: Yihui Xiong --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00454cc2da..f615cb7ce6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -193,6 +193,8 @@ jobs: - "itsybitsy_m4_express" - "itsybitsy_nrf52840_express" - "kicksat-sprite" + - "makerdiary_m60_keyboard" + - "makerdiary_nrf52840_m2_devkit" - "makerdiary_nrf52840_mdk" - "makerdiary_nrf52840_mdk_usb_dongle" - "meowbit_v121" From e0733d153ee159fd235794825fada7d455828007 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Wed, 8 Jul 2020 20:59:00 +0200 Subject: [PATCH 163/277] SAMD: configurable brownout, separate the variables --- ports/atmel-samd/boards/pewpew10/mpconfigboard.h | 2 +- ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h | 3 +-- ports/atmel-samd/mpconfigport.h | 14 ++++++++++---- ports/atmel-samd/supervisor/port.c | 10 ++++------ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.h b/ports/atmel-samd/boards/pewpew10/mpconfigboard.h index 940e250b46..2cb097e8dc 100644 --- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.h +++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.h @@ -44,4 +44,4 @@ #define DEFAULT_UART_BUS_RX (&pin_PA01) #define DEFAULT_UART_BUS_TX (&pin_PA00) -#define BOARD_BROWNOUT_LEVEL (6) +#define SAMD21_BOD33_LEVEL (6) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h index 7da5cf14c1..4b88c89f28 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h @@ -41,5 +41,4 @@ #define IGNORE_PIN_PB10 1 #define IGNORE_PIN_PB11 1 -#define BOARD_BROWNOUT_LEVEL (6) -// 1.6V +#define SAMD5x_E5x_BOD33_LEVEL (100) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 3a5d4e1a2f..540a2f77c7 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -112,8 +112,11 @@ #define CIRCUITPY_DEFAULT_STACK_SIZE 4096 #endif -#ifndef BOARD_BROWNOUT_LEVEL ( -#define BOARD_BROWNLOUT_LEVEL (39) +#ifndef SAMD21_BOD33_LEVEL +// Set brownout detection to ~2.7V. Default from factory is 1.7V, +// which is too low for proper operation of external SPI flash chips +// (they are 2.7-3.6V). +#define SAMD21_BOD33_LEVEL (39) // 2.77V with hysteresis off. Table 37.20 in datasheet. #endif @@ -134,8 +137,11 @@ #define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) #endif -#ifndef BOARD_BROWNOUT_LEVEL ( -#define BOARD_BROWNLOUT_LEVEL (200) +#ifndef SAMD5x_E5x_BOD33_LEVEL +// Set brownout detection to ~2.7V. Default from factory is 1.7V, +// which is too low for proper operation of external SPI flash chips +// (they are 2.7-3.6V). +#define SAMD5x_E5x_BOD33_LEVEL (200) // 2.7V: 1.5V + LEVEL * 6mV. #endif diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 5b085dc81b..65501861e0 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -206,11 +206,10 @@ static void rtc_init(void) { safe_mode_t port_init(void) { #if defined(SAMD21) - // Set brownout detection. Default from factory is 1.7V, - // which is too low for proper operation of external SPI flash chips (they are 2.7-3.6V). + // Set brownout detection. // Disable while changing level. SYSCTRL->BOD33.bit.ENABLE = 0; - SYSCTRL->BOD33.bit.LEVEL = BOARD_BROWNOUT_LEVEL; + SYSCTRL->BOD33.bit.LEVEL = SAMD21_BOD33_LEVEL; SYSCTRL->BOD33.bit.ENABLE = 1; #ifdef ENABLE_MICRO_TRACE_BUFFER @@ -225,11 +224,10 @@ safe_mode_t port_init(void) { #endif #if defined(SAM_D5X_E5X) - // Set brownout detection to ~2.7V. Default from factory is 1.7V, - // which is too low for proper operation of external SPI flash chips (they are 2.7-3.6V). + // Set brownout detection. // Disable while changing level. SUPC->BOD33.bit.ENABLE = 0; - SUPC->BOD33.bit.LEVEL = BOARD_BROWNOUT_LEVEL; + SUPC->BOD33.bit.LEVEL = SAMD5x_E5x_BOD33_LEVEL; SUPC->BOD33.bit.ENABLE = 1; // MPU (Memory Protection Unit) setup. From 678f26639433ebd26259a973aacd97e1cf765d2a Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Thu, 9 Jul 2020 10:25:46 +0000 Subject: [PATCH 164/277] fix pre-commit check --- ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk | 1 - ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk index 59eba13343..46f9885cb1 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk @@ -10,4 +10,3 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "MX25R6435F" CIRCUITPY_ENABLE_MPY_NATIVE = 1 - diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c index 1032555dca..cb3bda35ab 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/pins.c @@ -103,7 +103,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} }; From f1509debc3ae067f7ad7ba57a70e3235f4eeb564 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 7 Jul 2020 10:11:58 -0500 Subject: [PATCH 165/277] lib/mp3: update to 1.2.2 release This fixes the audio clipping bug --- lib/mp3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mp3 b/lib/mp3 index c3c664bf4d..bc58a65496 160000 --- a/lib/mp3 +++ b/lib/mp3 @@ -1 +1 @@ -Subproject commit c3c664bf4db6a36d11808dfcbb5dbf7cff1715b8 +Subproject commit bc58a654964c799e972719a63ff12694998f3549 From 2bcc5c06c2efe5fb9469cab2f8f9aa801fbde14b Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 9 Jul 2020 11:41:00 -0400 Subject: [PATCH 166/277] Fix advanced claimed pin/package timer search --- ports/stm/common-hal/microcontroller/Pin.c | 2 + ports/stm/peripherals/timers.c | 44 +++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 3e3fc05227..d919b07ea7 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -89,6 +89,8 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { never_reset_pins[pin_port] |= 1<=0; i--) { + for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) { if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) { return mcu_tim_banks[i]; } From edc48a505fd92ed246696be38cc2d3c1e2c36fcf Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 9 Jul 2020 13:10:18 -0400 Subject: [PATCH 167/277] Complete F405 pin and periph definitions --- ports/stm/.gitignore | 1 + .../peripherals/stm32f4/stm32f405xx/periph.c | 182 +++++++------- .../peripherals/stm32f4/stm32f405xx/periph.h | 35 +-- .../peripherals/stm32f4/stm32f405xx/pins.c | 233 +++++++++--------- .../peripherals/stm32f4/stm32f405xx/pins.h | 209 ++++++++-------- ports/stm/tools/parse_af_csv.py | 2 + ports/stm/tools/pins.csv | 93 ------- ports/stm/tools/stm32f767_af.csv | 168 ------------- 8 files changed, 348 insertions(+), 575 deletions(-) delete mode 100644 ports/stm/tools/pins.csv delete mode 100644 ports/stm/tools/stm32f767_af.csv diff --git a/ports/stm/.gitignore b/ports/stm/.gitignore index 5d645392ca..e46c927eec 100644 --- a/ports/stm/.gitignore +++ b/ports/stm/.gitignore @@ -5,5 +5,6 @@ build-*/ # Reference files ##################### ref/ +_working* .gdb_history diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c index e75f0b2062..e2124bc309 100644 --- a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c +++ b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c @@ -29,55 +29,57 @@ #include "peripherals/pins.h" #include "peripherals/periph.h" -// I2C +I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3}; -I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3}; - -const mcu_periph_obj_t mcu_i2c_sda_list[4] = { +const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN] = { PERIPH(1, 4, &pin_PB07), PERIPH(1, 4, &pin_PB09), PERIPH(2, 4, &pin_PB11), PERIPH(3, 4, &pin_PC09), + PERIPH(2, 4, &pin_PF00), + PERIPH(2, 4, &pin_PH05), + PERIPH(3, 4, &pin_PH08), }; - -const mcu_periph_obj_t mcu_i2c_scl_list[4] = { +const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN] = { + PERIPH(3, 4, &pin_PA08), PERIPH(1, 4, &pin_PB06), PERIPH(1, 4, &pin_PB08), PERIPH(2, 4, &pin_PB10), - PERIPH(3, 4, &pin_PA08) + PERIPH(2, 4, &pin_PF01), + PERIPH(2, 4, &pin_PH04), + PERIPH(3, 4, &pin_PH07), }; -SPI_TypeDef * mcu_spi_banks[3] = {SPI1, SPI2, SPI3}; +SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3}; -const mcu_periph_obj_t mcu_spi_sck_list[7] = { +const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN] = { PERIPH(1, 5, &pin_PA05), PERIPH(1, 5, &pin_PB03), + PERIPH(3, 6, &pin_PB03), PERIPH(2, 5, &pin_PB10), PERIPH(2, 5, &pin_PB13), - PERIPH(2, 5, &pin_PC07), - PERIPH(3, 6, &pin_PB03), PERIPH(3, 6, &pin_PC10), + PERIPH(2, 5, &pin_PI01), }; - -const mcu_periph_obj_t mcu_spi_mosi_list[6] = { +const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN] = { PERIPH(1, 5, &pin_PA07), PERIPH(1, 5, &pin_PB05), + PERIPH(3, 6, &pin_PB05), PERIPH(2, 5, &pin_PB15), PERIPH(2, 5, &pin_PC03), - PERIPH(3, 6, &pin_PB05), PERIPH(3, 6, &pin_PC12), + PERIPH(2, 5, &pin_PI03), }; - -const mcu_periph_obj_t mcu_spi_miso_list[6] = { +const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN] = { PERIPH(1, 5, &pin_PA06), PERIPH(1, 5, &pin_PB04), + PERIPH(3, 6, &pin_PB04), PERIPH(2, 5, &pin_PB14), PERIPH(2, 5, &pin_PC02), - PERIPH(3, 6, &pin_PB04), PERIPH(3, 6, &pin_PC11), + PERIPH(2, 5, &pin_PI02), }; - -const mcu_periph_obj_t mcu_spi_nss_list[6] = { +const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN] = { PERIPH(1, 5, &pin_PA04), PERIPH(1, 5, &pin_PA15), PERIPH(2, 5, &pin_PB09), @@ -89,7 +91,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[6] = { USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6}; bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true}; -const mcu_periph_obj_t mcu_uart_tx_list[12] = { +const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN] = { PERIPH(4, 8, &pin_PA00), PERIPH(2, 7, &pin_PA02), PERIPH(1, 7, &pin_PA09), @@ -103,8 +105,7 @@ const mcu_periph_obj_t mcu_uart_tx_list[12] = { PERIPH(3, 7, &pin_PD08), PERIPH(6, 8, &pin_PG14), }; - -const mcu_periph_obj_t mcu_uart_rx_list[12] = { +const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN] = { PERIPH(4, 8, &pin_PA01), PERIPH(2, 7, &pin_PA03), PERIPH(1, 7, &pin_PA10), @@ -121,74 +122,75 @@ const mcu_periph_obj_t mcu_uart_rx_list[12] = { //Timers //TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins -TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10, +TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10, TIM11, TIM12, TIM13, TIM14}; -const mcu_tim_pin_obj_t mcu_tim_pin_list[56] = { - TIM(2,1,1,&pin_PA00), - TIM(5,2,1,&pin_PA00), - TIM(2,1,2,&pin_PA01), - TIM(5,2,2,&pin_PA01), - TIM(2,1,3,&pin_PA02), - TIM(5,2,3,&pin_PA02), - TIM(2,1,4,&pin_PA03), - TIM(5,2,4,&pin_PA03), - TIM(9,3,1,&pin_PA02), - TIM(9,3,2,&pin_PA03), - TIM(3,2,1,&pin_PA06), - TIM(13,9,1,&pin_PA06), - TIM(3,2,2,&pin_PA07), - TIM(14,9,1,&pin_PA07), - TIM(1,1,1,&pin_PA08), - TIM(1,1,2,&pin_PA09), - TIM(1,1,3,&pin_PA10), - TIM(1,1,4,&pin_PA11), - TIM(2,1,1,&pin_PA15), - TIM(3,2,3,&pin_PB00), - TIM(3,2,4,&pin_PB01), - TIM(2,1,2,&pin_PB03), - TIM(3,2,1,&pin_PB04), - TIM(3,2,2,&pin_PB05), - TIM(4,2,1,&pin_PB06), - TIM(4,2,2,&pin_PB07), - TIM(4,2,3,&pin_PB08), - TIM(10,2,1,&pin_PB08), - TIM(4,2,4,&pin_PB09), - TIM(11,2,1,&pin_PB09), - TIM(2,1,3,&pin_PB10), - TIM(2,1,4,&pin_PB11), - TIM(12,9,1,&pin_PB14), - TIM(12,9,2,&pin_PB15), - TIM(3,2,1,&pin_PC06), - TIM(3,2,2,&pin_PC07), - TIM(3,2,3,&pin_PC08), - TIM(3,2,4,&pin_PC09), - TIM(8,3,1,&pin_PC06), - TIM(8,3,2,&pin_PC07), - TIM(8,3,3,&pin_PC08), - TIM(8,3,4,&pin_PC09), - TIM(4,2,1,&pin_PD12), - TIM(4,2,2,&pin_PD13), - TIM(4,2,3,&pin_PD14), - TIM(4,2,4,&pin_PD15), - TIM(9,3,1,&pin_PE05), - TIM(9,3,2,&pin_PE06), - TIM(1,1,1,&pin_PE09), - TIM(1,1,2,&pin_PE11), - TIM(1,1,3,&pin_PE13), - TIM(1,1,4,&pin_PE14), - TIM(10,3,1,&pin_PF06), - TIM(11,3,1,&pin_PF07), - TIM(13,9,1,&pin_PF08), - TIM(14,9,1,&pin_PF09), - // TIM(12,9,1,&pin_PH06), //TODO: include these when pin map is expanded - // TIM(12,9,2,&pin_PH09), - // TIM(5,2,1,&pin_PH10), - // TIM(5,2,2,&pin_PH11), - // TIM(5,2,3,&pin_PH12), - // TIM(5,2,4,&pin_PI00), - // TIM(8,3,4,&pin_PI02), - // TIM(8,3,1,&pin_PI05), - // TIM(8,3,2,&pin_PI06), - // TIM(8,3,3,&pin_PI07), +const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = { + TIM(2, 1, 1, &pin_PA00), + TIM(5, 2, 1, &pin_PA00), + TIM(2, 1, 2, &pin_PA01), + TIM(5, 2, 2, &pin_PA01), + TIM(2, 1, 3, &pin_PA02), + TIM(5, 2, 3, &pin_PA02), + TIM(9, 3, 1, &pin_PA02), + TIM(2, 1, 4, &pin_PA03), + TIM(5, 2, 4, &pin_PA03), + TIM(9, 3, 2, &pin_PA03), + TIM(2, 1, 1, &pin_PA05), + TIM(3, 2, 1, &pin_PA06), + TIM(13, 9, 1, &pin_PA06), + TIM(3, 2, 2, &pin_PA07), + TIM(14, 9, 1, &pin_PA07), + TIM(1, 1, 1, &pin_PA08), + TIM(1, 1, 2, &pin_PA09), + TIM(1, 1, 3, &pin_PA10), + TIM(1, 1, 4, &pin_PA11), + TIM(2, 1, 1, &pin_PA15), + TIM(3, 2, 3, &pin_PB00), + TIM(3, 2, 4, &pin_PB01), + TIM(2, 1, 2, &pin_PB03), + TIM(3, 2, 1, &pin_PB04), + TIM(3, 2, 2, &pin_PB05), + TIM(4, 2, 1, &pin_PB06), + TIM(4, 2, 2, &pin_PB07), + TIM(4, 2, 3, &pin_PB08), + TIM(10, 3, 1, &pin_PB08), + TIM(4, 2, 4, &pin_PB09), + TIM(11, 3, 1, &pin_PB09), + TIM(2, 1, 3, &pin_PB10), + TIM(2, 1, 4, &pin_PB11), + TIM(12, 9, 1, &pin_PB14), + TIM(12, 9, 2, &pin_PB15), + TIM(3, 2, 1, &pin_PC06), + TIM(8, 3, 1, &pin_PC06), + TIM(3, 2, 2, &pin_PC07), + TIM(8, 3, 2, &pin_PC07), + TIM(3, 2, 3, &pin_PC08), + TIM(8, 3, 3, &pin_PC08), + TIM(3, 2, 4, &pin_PC09), + TIM(8, 3, 4, &pin_PC09), + TIM(4, 2, 1, &pin_PD12), + TIM(4, 2, 2, &pin_PD13), + TIM(4, 2, 3, &pin_PD14), + TIM(4, 2, 4, &pin_PD15), + TIM(9, 3, 1, &pin_PE05), + TIM(9, 3, 2, &pin_PE06), + TIM(1, 1, 1, &pin_PE09), + TIM(1, 1, 2, &pin_PE11), + TIM(1, 1, 3, &pin_PE13), + TIM(1, 1, 4, &pin_PE14), + TIM(10, 3, 1, &pin_PF06), + TIM(11, 3, 1, &pin_PF07), + TIM(13, 9, 1, &pin_PF08), + TIM(14, 9, 1, &pin_PF09), + TIM(12, 9, 1, &pin_PH06), + TIM(12, 9, 2, &pin_PH09), + TIM(5, 2, 1, &pin_PH10), + TIM(5, 2, 2, &pin_PH11), + TIM(5, 2, 3, &pin_PH12), + TIM(5, 2, 4, &pin_PI00), + TIM(8, 3, 4, &pin_PI02), + TIM(8, 3, 1, &pin_PI05), + TIM(8, 3, 2, &pin_PI06), + TIM(8, 3, 3, &pin_PI07), }; diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h index df67a99d79..e52568c855 100644 --- a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h +++ b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h @@ -28,29 +28,36 @@ #define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H //I2C -extern I2C_TypeDef * mcu_i2c_banks[3]; - -extern const mcu_periph_obj_t mcu_i2c_sda_list[4]; -extern const mcu_periph_obj_t mcu_i2c_scl_list[4]; +#define I2C_BANK_ARRAY_LEN 3 +#define I2C_SDA_ARRAY_LEN 7 +#define I2C_SCL_ARRAY_LEN 7 +extern I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN]; //SPI -extern SPI_TypeDef * mcu_spi_banks[3]; - -extern const mcu_periph_obj_t mcu_spi_sck_list[7]; -extern const mcu_periph_obj_t mcu_spi_mosi_list[6]; -extern const mcu_periph_obj_t mcu_spi_miso_list[6]; -extern const mcu_periph_obj_t mcu_spi_nss_list[6]; +#define SPI_BANK_ARRAY_LEN 3 +#define SPI_SCK_ARRAY_LEN 7 +#define SPI_MOSI_ARRAY_LEN 7 +#define SPI_MISO_ARRAY_LEN 7 +#define SPI_NSS_ARRAY_LEN 6 +extern SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN]; //UART +#define UART_TX_ARRAY_LEN 12 +#define UART_RX_ARRAY_LEN 12 extern USART_TypeDef * mcu_uart_banks[MAX_UART]; extern bool mcu_uart_has_usart[MAX_UART]; - -extern const mcu_periph_obj_t mcu_uart_tx_list[12]; -extern const mcu_periph_obj_t mcu_uart_rx_list[12]; +extern const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN]; +extern const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN]; //Timers #define TIM_BANK_ARRAY_LEN 14 -#define TIM_PIN_ARRAY_LEN 56 +#define TIM_PIN_ARRAY_LEN 67 TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN]; const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN]; diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c index 4282741a84..62acb19550 100644 --- a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c @@ -28,33 +28,6 @@ #include "py/mphal.h" #include "peripherals/pins.h" -const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC); -const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC); -const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC); -const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC); -const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC); - -const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp -const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN -const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT - -const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9)); // 144 only -const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14)); // 144 only -const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15)); // 144 only -const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4)); // 144 only -const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5)); // 144 only -const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6)); // 144 only -const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7)); // 144 only -const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8)); // 144 only - -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13)); - const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123,0)); const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123,1)); const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123,2)); @@ -63,23 +36,69 @@ const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12,4)); const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12,5)); const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12,6)); const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12,7)); - -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15)); - +const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); +const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); +const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); +const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC); +const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC); +const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); +const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); +const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12,8)); const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12,9)); -const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); //BOOT1 - -const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC); // 144 only - -const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC); // 144 only - +const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); +const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); +const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); +const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC); +const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC); +const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC); +const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC); +const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC); +const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC); +const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC); +const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC); +const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC); +const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC); +const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15)); +const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC); +const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC); +const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC); +const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC); +const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC); +const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC); +const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC); +const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); +const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); +const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); +const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC); +const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC); +const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC); +const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC); +const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC); +const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC); +const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC); +const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC); +const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC); +const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC); +const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC); +const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC); +const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC); +const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC); +const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC); +const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC); +const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC); +const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC); +const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC); +const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC); +const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC); +const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC); +const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC); const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC); const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC); const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC); @@ -89,73 +108,63 @@ const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC); const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC); const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC); const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC); - -const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC); -const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC); -const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC); -const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC); -const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC); -const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC); - -const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC); -const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC); -const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC); -const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC); -const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC); -const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC); -const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC); -const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC); - -const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC); // 144 only - -const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC); -const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC); -const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC); -const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC); - -const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); -const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); -const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); -const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC); -const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC); -const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); -const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); -const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); - -const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC); -const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC); -const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC); - -const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC); -const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC); -const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC); -const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC); -const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC); -const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC); -const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC); -const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC); - -const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC); // 144 only - -const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); -const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); -const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC); -const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC); -const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC); -const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC); -const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC); - -const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC); -const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC); +const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); +const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); +const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); +const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9)); +const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14)); +const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15)); +const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4)); +const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5)); +const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6)); +const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7)); +const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8)); +const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); +const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); +const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); +const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC); +const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC); +const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC); +const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC); +const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC); +const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC); +const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC); +const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC); +const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC); +const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC); +const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC); +const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC); +const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC); +const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC); +const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC); +const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC); +const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC); +const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC); +const mcu_pin_obj_t pin_PH00 = PIN(7, 0, NO_ADC); +const mcu_pin_obj_t pin_PH01 = PIN(7, 1, NO_ADC); +const mcu_pin_obj_t pin_PH02 = PIN(7, 2, NO_ADC); +const mcu_pin_obj_t pin_PH03 = PIN(7, 3, NO_ADC); +const mcu_pin_obj_t pin_PH04 = PIN(7, 4, NO_ADC); +const mcu_pin_obj_t pin_PH05 = PIN(7, 5, NO_ADC); +const mcu_pin_obj_t pin_PH06 = PIN(7, 6, NO_ADC); +const mcu_pin_obj_t pin_PH07 = PIN(7, 7, NO_ADC); +const mcu_pin_obj_t pin_PH08 = PIN(7, 8, NO_ADC); +const mcu_pin_obj_t pin_PH09 = PIN(7, 9, NO_ADC); +const mcu_pin_obj_t pin_PH10 = PIN(7, 10, NO_ADC); +const mcu_pin_obj_t pin_PH11 = PIN(7, 11, NO_ADC); +const mcu_pin_obj_t pin_PH12 = PIN(7, 12, NO_ADC); +const mcu_pin_obj_t pin_PH13 = PIN(7, 13, NO_ADC); +const mcu_pin_obj_t pin_PH14 = PIN(7, 14, NO_ADC); +const mcu_pin_obj_t pin_PH15 = PIN(7, 15, NO_ADC); +const mcu_pin_obj_t pin_PI00 = PIN(8, 0, NO_ADC); +const mcu_pin_obj_t pin_PI01 = PIN(8, 1, NO_ADC); +const mcu_pin_obj_t pin_PI02 = PIN(8, 2, NO_ADC); +const mcu_pin_obj_t pin_PI03 = PIN(8, 3, NO_ADC); +const mcu_pin_obj_t pin_PI04 = PIN(8, 4, NO_ADC); +const mcu_pin_obj_t pin_PI05 = PIN(8, 5, NO_ADC); +const mcu_pin_obj_t pin_PI06 = PIN(8, 6, NO_ADC); +const mcu_pin_obj_t pin_PI07 = PIN(8, 7, NO_ADC); +const mcu_pin_obj_t pin_PI08 = PIN(8, 8, NO_ADC); +const mcu_pin_obj_t pin_PI09 = PIN(8, 9, NO_ADC); +const mcu_pin_obj_t pin_PI10 = PIN(8, 10, NO_ADC); +const mcu_pin_obj_t pin_PI11 = PIN(8, 11, NO_ADC); diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.h b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.h index e722b6e5ae..fe0eb9e53e 100644 --- a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.h +++ b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.h @@ -27,107 +27,54 @@ #ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H #define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H -//Pins in datasheet order: DocID028087 Rev 7 page 50. LQFP100 only -//pg 50 -extern const mcu_pin_obj_t pin_PE02; -extern const mcu_pin_obj_t pin_PE03; -extern const mcu_pin_obj_t pin_PE04; -extern const mcu_pin_obj_t pin_PE05; -extern const mcu_pin_obj_t pin_PE06; -extern const mcu_pin_obj_t pin_PC13; -extern const mcu_pin_obj_t pin_PC14; -//pg 51 -extern const mcu_pin_obj_t pin_PC15; -extern const mcu_pin_obj_t pin_PF00; // 144 only -extern const mcu_pin_obj_t pin_PF01; // 144 only -extern const mcu_pin_obj_t pin_PF02; // 144 only -extern const mcu_pin_obj_t pin_PF03; // 144 only -extern const mcu_pin_obj_t pin_PF04; // 144 only -extern const mcu_pin_obj_t pin_PF05; // 144 only -extern const mcu_pin_obj_t pin_PF06; // 144 only -extern const mcu_pin_obj_t pin_PF07; // 144 only -extern const mcu_pin_obj_t pin_PF08; // 144 only -extern const mcu_pin_obj_t pin_PF09; // 144 only -extern const mcu_pin_obj_t pin_PF10; // 144 only -//pg 52 -extern const mcu_pin_obj_t pin_PC00; -extern const mcu_pin_obj_t pin_PC01; -extern const mcu_pin_obj_t pin_PC02; -extern const mcu_pin_obj_t pin_PC03; extern const mcu_pin_obj_t pin_PA00; extern const mcu_pin_obj_t pin_PA01; extern const mcu_pin_obj_t pin_PA02; -//pg 53 extern const mcu_pin_obj_t pin_PA03; extern const mcu_pin_obj_t pin_PA04; extern const mcu_pin_obj_t pin_PA05; extern const mcu_pin_obj_t pin_PA06; extern const mcu_pin_obj_t pin_PA07; -extern const mcu_pin_obj_t pin_PC04; -//pg 54 -extern const mcu_pin_obj_t pin_PC05; -extern const mcu_pin_obj_t pin_PB00; -extern const mcu_pin_obj_t pin_PB01; -extern const mcu_pin_obj_t pin_PB02; -extern const mcu_pin_obj_t pin_PF11; // 144 only -extern const mcu_pin_obj_t pin_PF12; // 144 only -extern const mcu_pin_obj_t pin_PF13; // 144 only -extern const mcu_pin_obj_t pin_PF14; // 144 only -extern const mcu_pin_obj_t pin_PF15; // 144 only -extern const mcu_pin_obj_t pin_PG00; // 144 only -extern const mcu_pin_obj_t pin_PG01; // 144 only -//pg 55 -extern const mcu_pin_obj_t pin_PE07; -extern const mcu_pin_obj_t pin_PE08; -extern const mcu_pin_obj_t pin_PE09; -extern const mcu_pin_obj_t pin_PE10; -extern const mcu_pin_obj_t pin_PE11; -extern const mcu_pin_obj_t pin_PE12; -extern const mcu_pin_obj_t pin_PE13; -extern const mcu_pin_obj_t pin_PE14; -//pg 56 -extern const mcu_pin_obj_t pin_PE15; -extern const mcu_pin_obj_t pin_PB10; -extern const mcu_pin_obj_t pin_PB11; // 144 only -extern const mcu_pin_obj_t pin_PB12; -extern const mcu_pin_obj_t pin_PB13; -//pg 57 -extern const mcu_pin_obj_t pin_PB14; -extern const mcu_pin_obj_t pin_PB15; -extern const mcu_pin_obj_t pin_PD08; -extern const mcu_pin_obj_t pin_PD09; -extern const mcu_pin_obj_t pin_PD10; -extern const mcu_pin_obj_t pin_PD11; -extern const mcu_pin_obj_t pin_PD12; -//pg 58 -extern const mcu_pin_obj_t pin_PD13; -extern const mcu_pin_obj_t pin_PD14; -extern const mcu_pin_obj_t pin_PD15; -extern const mcu_pin_obj_t pin_PG02; // 144 only -extern const mcu_pin_obj_t pin_PG03; // 144 only -extern const mcu_pin_obj_t pin_PG04; // 144 only -extern const mcu_pin_obj_t pin_PG05; // 144 only -extern const mcu_pin_obj_t pin_PG06; // 144 only -extern const mcu_pin_obj_t pin_PG07; // 144 only -extern const mcu_pin_obj_t pin_PG08; // 144 only -//pg 59 -extern const mcu_pin_obj_t pin_PC06; -extern const mcu_pin_obj_t pin_PC07; -extern const mcu_pin_obj_t pin_PC08; -extern const mcu_pin_obj_t pin_PC09; extern const mcu_pin_obj_t pin_PA08; extern const mcu_pin_obj_t pin_PA09; extern const mcu_pin_obj_t pin_PA10; -//pg 60 extern const mcu_pin_obj_t pin_PA11; extern const mcu_pin_obj_t pin_PA12; extern const mcu_pin_obj_t pin_PA13; extern const mcu_pin_obj_t pin_PA14; extern const mcu_pin_obj_t pin_PA15; +extern const mcu_pin_obj_t pin_PB00; +extern const mcu_pin_obj_t pin_PB01; +extern const mcu_pin_obj_t pin_PB02; +extern const mcu_pin_obj_t pin_PB03; +extern const mcu_pin_obj_t pin_PB04; +extern const mcu_pin_obj_t pin_PB05; +extern const mcu_pin_obj_t pin_PB06; +extern const mcu_pin_obj_t pin_PB07; +extern const mcu_pin_obj_t pin_PB08; +extern const mcu_pin_obj_t pin_PB09; +extern const mcu_pin_obj_t pin_PB10; +extern const mcu_pin_obj_t pin_PB11; +extern const mcu_pin_obj_t pin_PB12; +extern const mcu_pin_obj_t pin_PB13; +extern const mcu_pin_obj_t pin_PB14; +extern const mcu_pin_obj_t pin_PB15; +extern const mcu_pin_obj_t pin_PC00; +extern const mcu_pin_obj_t pin_PC01; +extern const mcu_pin_obj_t pin_PC02; +extern const mcu_pin_obj_t pin_PC03; +extern const mcu_pin_obj_t pin_PC04; +extern const mcu_pin_obj_t pin_PC05; +extern const mcu_pin_obj_t pin_PC06; +extern const mcu_pin_obj_t pin_PC07; +extern const mcu_pin_obj_t pin_PC08; +extern const mcu_pin_obj_t pin_PC09; extern const mcu_pin_obj_t pin_PC10; extern const mcu_pin_obj_t pin_PC11; -//pg 61 extern const mcu_pin_obj_t pin_PC12; +extern const mcu_pin_obj_t pin_PC13; +extern const mcu_pin_obj_t pin_PC14; +extern const mcu_pin_obj_t pin_PC15; extern const mcu_pin_obj_t pin_PD00; extern const mcu_pin_obj_t pin_PD01; extern const mcu_pin_obj_t pin_PD02; @@ -136,23 +83,89 @@ extern const mcu_pin_obj_t pin_PD04; extern const mcu_pin_obj_t pin_PD05; extern const mcu_pin_obj_t pin_PD06; extern const mcu_pin_obj_t pin_PD07; -//pg 62 -extern const mcu_pin_obj_t pin_PG09; // 144 only -extern const mcu_pin_obj_t pin_PG10; // 144 only -extern const mcu_pin_obj_t pin_PG11; // 144 only -extern const mcu_pin_obj_t pin_PG12; // 144 only -extern const mcu_pin_obj_t pin_PG13; // 144 only -extern const mcu_pin_obj_t pin_PG14; // 144 only -extern const mcu_pin_obj_t pin_PG15; // 144 only -extern const mcu_pin_obj_t pin_PB03; -extern const mcu_pin_obj_t pin_PB04; -//pg 63 -extern const mcu_pin_obj_t pin_PB05; -extern const mcu_pin_obj_t pin_PB06; -extern const mcu_pin_obj_t pin_PB07; -extern const mcu_pin_obj_t pin_PB08; -extern const mcu_pin_obj_t pin_PB09; +extern const mcu_pin_obj_t pin_PD08; +extern const mcu_pin_obj_t pin_PD09; +extern const mcu_pin_obj_t pin_PD10; +extern const mcu_pin_obj_t pin_PD11; +extern const mcu_pin_obj_t pin_PD12; +extern const mcu_pin_obj_t pin_PD13; +extern const mcu_pin_obj_t pin_PD14; +extern const mcu_pin_obj_t pin_PD15; extern const mcu_pin_obj_t pin_PE00; extern const mcu_pin_obj_t pin_PE01; +extern const mcu_pin_obj_t pin_PE02; +extern const mcu_pin_obj_t pin_PE03; +extern const mcu_pin_obj_t pin_PE04; +extern const mcu_pin_obj_t pin_PE05; +extern const mcu_pin_obj_t pin_PE06; +extern const mcu_pin_obj_t pin_PE07; +extern const mcu_pin_obj_t pin_PE08; +extern const mcu_pin_obj_t pin_PE09; +extern const mcu_pin_obj_t pin_PE10; +extern const mcu_pin_obj_t pin_PE11; +extern const mcu_pin_obj_t pin_PE12; +extern const mcu_pin_obj_t pin_PE13; +extern const mcu_pin_obj_t pin_PE14; +extern const mcu_pin_obj_t pin_PE15; +extern const mcu_pin_obj_t pin_PF00; +extern const mcu_pin_obj_t pin_PF01; +extern const mcu_pin_obj_t pin_PF02; +extern const mcu_pin_obj_t pin_PF03; +extern const mcu_pin_obj_t pin_PF04; +extern const mcu_pin_obj_t pin_PF05; +extern const mcu_pin_obj_t pin_PF06; +extern const mcu_pin_obj_t pin_PF07; +extern const mcu_pin_obj_t pin_PF08; +extern const mcu_pin_obj_t pin_PF09; +extern const mcu_pin_obj_t pin_PF10; +extern const mcu_pin_obj_t pin_PF11; +extern const mcu_pin_obj_t pin_PF12; +extern const mcu_pin_obj_t pin_PF13; +extern const mcu_pin_obj_t pin_PF14; +extern const mcu_pin_obj_t pin_PF15; +extern const mcu_pin_obj_t pin_PG00; +extern const mcu_pin_obj_t pin_PG01; +extern const mcu_pin_obj_t pin_PG02; +extern const mcu_pin_obj_t pin_PG03; +extern const mcu_pin_obj_t pin_PG04; +extern const mcu_pin_obj_t pin_PG05; +extern const mcu_pin_obj_t pin_PG06; +extern const mcu_pin_obj_t pin_PG07; +extern const mcu_pin_obj_t pin_PG08; +extern const mcu_pin_obj_t pin_PG09; +extern const mcu_pin_obj_t pin_PG10; +extern const mcu_pin_obj_t pin_PG11; +extern const mcu_pin_obj_t pin_PG12; +extern const mcu_pin_obj_t pin_PG13; +extern const mcu_pin_obj_t pin_PG14; +extern const mcu_pin_obj_t pin_PG15; +extern const mcu_pin_obj_t pin_PH00; +extern const mcu_pin_obj_t pin_PH01; +extern const mcu_pin_obj_t pin_PH02; +extern const mcu_pin_obj_t pin_PH03; +extern const mcu_pin_obj_t pin_PH04; +extern const mcu_pin_obj_t pin_PH05; +extern const mcu_pin_obj_t pin_PH06; +extern const mcu_pin_obj_t pin_PH07; +extern const mcu_pin_obj_t pin_PH08; +extern const mcu_pin_obj_t pin_PH09; +extern const mcu_pin_obj_t pin_PH10; +extern const mcu_pin_obj_t pin_PH11; +extern const mcu_pin_obj_t pin_PH12; +extern const mcu_pin_obj_t pin_PH13; +extern const mcu_pin_obj_t pin_PH14; +extern const mcu_pin_obj_t pin_PH15; +extern const mcu_pin_obj_t pin_PI00; +extern const mcu_pin_obj_t pin_PI01; +extern const mcu_pin_obj_t pin_PI02; +extern const mcu_pin_obj_t pin_PI03; +extern const mcu_pin_obj_t pin_PI04; +extern const mcu_pin_obj_t pin_PI05; +extern const mcu_pin_obj_t pin_PI06; +extern const mcu_pin_obj_t pin_PI07; +extern const mcu_pin_obj_t pin_PI08; +extern const mcu_pin_obj_t pin_PI09; +extern const mcu_pin_obj_t pin_PI10; +extern const mcu_pin_obj_t pin_PI11; #endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py index 4e97252602..0ff8168ec2 100644 --- a/ports/stm/tools/parse_af_csv.py +++ b/ports/stm/tools/parse_af_csv.py @@ -52,6 +52,8 @@ def evaluate_tim(inper, inlist, altfn, pin): if inper[:3] == "TIM" and inper[5:7] == "CH" and inper[-1:] != 'N': inlist.append([inper[3:4],altfn,inper[-1:],pin]) + elif inper[:3] == "TIM" and inper[6:8] == "CH" and inper[-1:] != 'N': + inlist.append([inper[3:5],altfn,inper[-1:],pin]) # Open target file with open(sys.argv[1]) as csv_file: diff --git a/ports/stm/tools/pins.csv b/ports/stm/tools/pins.csv deleted file mode 100644 index b424c2f78f..0000000000 --- a/ports/stm/tools/pins.csv +++ /dev/null @@ -1,93 +0,0 @@ -A0,PA3 -A1,PC0 -A2,PC3 -A3,PB1 -A4,PC2 -A5,PF10 -A6,PF4 -A7,PF5 -A8,PF6 -D0,PB7 -D1,PB6 -D2,PG14 -D3,PE13 -D4,PE14 -D5,PE11 -D6,PE9 -D7,PG12 -D8,PF3 -D9,PD15 -D10,PD14 -D11,PB5 -D12,PA6 -D13,PA5 -D14,PB9 -D15,PB8 -D16,PC6 -D17,PB15 -D18,PB13 -D19,PB12 -D20,PA15 -D21,PC7 -D22,PB5 -D23,PB3 -D24,PA4 -D25,PB4 -D26,PG6 -D27,PB2 -D28,PD13 -D29,PD12 -D30,PD11 -D31,PE2 -D32,PA0 -D33,PB0 -D34,PE0 -D35,PB11 -D36,PB10 -D37,PE15 -D38,PE6 -D39,PE12 -D40,PE10 -D41,PE7 -D42,PE8 -D43,PC8 -D44,PC9 -D45,PC10 -D46,PC11 -D47,PC12 -D48,PD2 -D49,PG2 -D50,PG3 -D51,PD7 -D52,PD6 -D53,PD5 -D54,PD4 -D55,PD3 -D56,PE2 -D57,PE4 -D58,PE5 -D59,PE6 -D60,PE3 -D61,PF8 -D62,PF7 -D63,PF9 -D64,PG1 -D65,PG0 -D66,PD1 -D67,PD0 -D68,PF0 -D69,PF1 -D70,PF2 -D71,PE0 -D72,PB2 -SDA,PB9 -SCL,PB8 -MOSI,PB5 -MISO,PA6 -SCK,PA5 -RX,PB7 -TX,PB6 -LED1,PB00 -LED2,PE01 -LED3,PB14 -SW,PC13 diff --git a/ports/stm/tools/stm32f767_af.csv b/ports/stm/tools/stm32f767_af.csv deleted file mode 100644 index 86f10b6dc8..0000000000 --- a/ports/stm/tools/stm32f767_af.csv +++ /dev/null @@ -1,168 +0,0 @@ -PortA,PA0,,TIM2_CH1/TIM2_ETR,TIM5_CH1,TIM8_ETR,,,,USART2_CTS,UART4_TX,,SAI2_SD_B,ETH_MII_CRS,,,,EVENTOUT,ADC123_IN0 -PortA,PA1,,TIM2_CH2,TIM5_CH2,,,,,USART2_RTS,UART4_RX,QUADSPI_BK1_IO3,SAI2_MCK_B,ETH_MII_RX_CLK/ETH_RMII_REF_CLK,,,LCD_R2,EVENTOUT,ADC123_IN1 -PortA,PA2,,TIM2_CH3,TIM5_CH3,TIM9_CH1,,,,USART2_TX,SAI2_SCK_B,,,ETH_MDIO,MDIOS_MDIO,,LCD_R1,EVENTOUT,ADC123_IN2 -PortA,PA3,,TIM2_CH4,TIM5_CH4,TIM9_CH2,,,,USART2_RX,,LCD_B2,OTG_HS_ULPI_D0,ETH_MII_COL,,,LCD_B5,EVENTOUT,ADC123_IN3 -PortA,PA4,,,,,,SPI1_NSS/I2S1_WS,SPI3_NSS/I2S3_WS,USART2_CK,SPI6_NSS,,,,OTG_HS_SOF,DCMI_HSYNC,LCD_VSYNC,EVENTOUT,ADC12_IN4 -PortA,PA5,,TIM2_CH1/TIM2_ETR,,TIM8_CH1N,,SPI1_SCK/I2S1_CK,,,SPI6_SCK,,OTG_HS_ULPI_CK,,,,LCD_R4,EVENTOUT,ADC12_IN5 -PortA,PA6,,TIM1_BKIN,TIM3_CH1,TIM8_BKIN,,SPI1_MISO,,,SPI6_MISO,TIM13_CH1,,,MDIOS_MDC,DCMI_PIXCLK,LCD_G2,EVENTOUT,ADC12_IN6 -PortA,PA7,,TIM1_CH1N,TIM3_CH2,TIM8_CH1N,,SPI1_MOSI/I2S1_SD,,,SPI6_MOSI,TIM14_CH1,,ETH_MII_RX_DV/ETH_RMII_CRS_DV,FMC_SDNWE,,,EVENTOUT,ADC12_IN7 -PortA,PA8,MCO1,TIM1_CH1,,TIM8_BKIN2,I2C3_SCL,,,USART1_CK,,,OTG_FS_SOF,CAN3_RX,UART7_RX,LCD_B3,LCD_R6,EVENTOUT, -PortA,PA9,,TIM1_CH2,,,I2C3_SMBA,SPI2_SCK/I2S2_CK,,USART1_TX,,,,,,DCMI_D0,LCD_R5,EVENTOUT, -PortA,PA10,,TIM1_CH3,,,,,,USART1_RX,,LCD_B4,OTG_FS_ID,,MDIOS_MDIO,DCMI_D1,LCD_B1,EVENTOUT, -PortA,PA11,,TIM1_CH4,,,,SPI2_NSS/I2S2_WS,UART4_RX,USART1_CTS,,CAN1_RX,OTG_FS_DM,,,,LCD_R4,EVENTOUT, -PortA,PA12,,TIM1_ETR,,,,SPI2_SCK/I2S2_CK,UART4_TX,USART1_RTS,SAI2_FS_B,CAN1_TX,OTG_FS_DP,,,,LCD_R5,EVENTOUT, -PortA,PA13,JTMS/SWDIO,,,,,,,,,,,,,,,EVENTOUT, -PortA,PA14,JTCK/SWCLK,,,,,,,,,,,,,,,EVENTOUT, -PortA,PA15,JTDI,TIM2_CH1/TIM2_ETR,,,HDMI_CEC,SPI1_NSS/I2S1_WS,SPI3_NSS/I2S3_WS,SPI6_NSS,UART4_RTS,,,CAN3_TX,UART7_TX,,,EVENTOUT, -PortB,PB0,,TIM1_CH2N,TIM3_CH3,TIM8_CH2N,,,DFSDM1_CKOUT,,UART4_CTS,LCD_R3,OTG_HS_ULPI_D1,ETH_MII_RXD2,,,LCD_G1,EVENTOUT,ADC12_IN8 -PortB,PB1,,TIM1_CH3N,TIM3_CH4,TIM8_CH3N,,,DFSDM1_DATAIN1,,,LCD_R6,OTG_HS_ULPI_D2,ETH_MII_RXD3,,,LCD_G0,EVENTOUT,ADC12_IN9 -PortB,PB2,,,,,,,SAI1_SD_A,SPI3_MOSI/I2S3_SD,,QUADSPI_CLK,DFSDM1_CKIN1,,,,,EVENTOUT, -PortB,PB3,JTDO/TRACESWO,TIM2_CH2,,,,SPI1_SCK/I2S1_CK,SPI3_SCK/I2S3_CK,,SPI6_SCK,,SDMMC2_D2,CAN3_RX,UART7_RX,,,EVENTOUT, -PortB,PB4,NJTRST,,TIM3_CH1,,,SPI1_MISO,SPI3_MISO,SPI2_NSS/I2S2_WS,SPI6_MISO,,SDMMC2_D3,CAN3_TX,UART7_TX,,,EVENTOUT, -PortB,PB5,,UART5_RX,TIM3_CH2,,I2C1_SMBA,SPI1_MOSI/I2S1_SD,SPI3_MOSI/I2S3_SD,,SPI6_MOSI,CAN2_RX,OTG_HS_ULPI_D7,ETH_PPS_OUT,FMC_SDCKE1,DCMI_D10,LCD_G7,EVENTOUT, -PortB,PB6,,UART5_TX,TIM4_CH1,HDMI_CEC,I2C1_SCL,,DFSDM1_DATAIN5,USART1_TX,,CAN2_TX,QUADSPI_BK1_NCS,I2C4_SCL,FMC_SDNE1,DCMI_D5,,EVENTOUT, -PortB,PB7,,,TIM4_CH2,,I2C1_SDA,,DFSDM1_CKIN5,USART1_RX,,,,I2C4_SDA,FMC_NL,DCMI_VSYNC,,EVENTOUT, -PortB,PB8,,I2C4_SCL,TIM4_CH3,TIM10_CH1,I2C1_SCL,,DFSDM1_CKIN7,UART5_RX,,CAN1_RX,SDMMC2_D4,ETH_MII_TXD3,SDMMC1_D4,DCMI_D6,LCD_B6,EVENTOUT, -PortB,PB9,,I2C4_SDA,TIM4_CH4,TIM11_CH1,I2C1_SDA,SPI2_NSS/I2S2_WS,DFSDM1_DATAIN7,UART5_TX,,CAN1_TX,SDMMC2_D5,I2C4_SMBA,SDMMC1_D5,DCMI_D7,LCD_B7,EVENTOUT, -PortB,PB10,,TIM2_CH3,,,I2C2_SCL,SPI2_SCK/I2S2_CK,DFSDM1_DATAIN7,USART3_TX,,QUADSPI_BK1_NCS,OTG_HS_ULPI_D3,ETH_MII_RX_ER,,,LCD_G4,EVENTOUT, -PortB,PB11,,TIM2_CH4,,,I2C2_SDA,,DFSDM1_CKIN7,USART3_RX,,,OTG_HS_ULPI_D4,ETH_MII_TX_EN/ETH_RMII_TX_EN,,DSI_TE,LCD_G5,EVENTOUT, -PortB,PB12,,TIM1_BKIN,,,I2C2_SMBA,SPI2_NSS/I2S2_WS,DFSDM1_DATAIN1,USART3_CK,UART5_RX,CAN2_RX,OTG_HS_ULPI_D5,ETH_MII_TXD0/ETH_RMII_TXD0,OTG_HS_ID,,,EVENTOUT, -PortB,PB13,,TIM1_CH1N,,,,SPI2_SCK/I2S2_CK,DFSDM1_CKIN1,USART3_CTS,UART5_TX,CAN2_TX,OTG_HS_ULPI_D6,ETH_MII_TXD1/ETH_RMII_TXD1,,,,EVENTOUT, -PortB,PB14,,TIM1_CH2N,,TIM8_CH2N,USART1_TX,SPI2_MISO,DFSDM1_DATAIN2,USART3_RTS,UART4_RTS,TIM12_CH1,SDMMC2_D0,,OTG_HS_DM,,,EVENTOUT, -PortB,PB15,RTC_REFIN,TIM1_CH3N,,TIM8_CH3N,USART1_RX,SPI2_MOSI/I2S2_SD,DFSDM1_CKIN2,,UART4_CTS,TIM12_CH2,SDMMC2_D1,,OTG_HS_DP,,,EVENTOUT, -PortC,PC0,,,,DFSDM1_CKIN0,,,DFSDM1_DATAIN4,,SAI2_FS_B,,OTG_HS_ULPI_STP,,FMC_SDNWE,,LCD_R5,EVENTOUT,ADC123_IN10 -PortC,PC1,TRACED0,,,DFSDM1_DATAIN0,,SPI2_MOSI/I2S2_SD,SAI1_SD_A,,,,DFSDM1_CKIN4,ETH_MDC,MDIOS_MDC,,,EVENTOUT,ADC123_IN11 -PortC,PC2,,,,DFSDM1_CKIN1,,SPI2_MISO,DFSDM1_CKOUT,,,,OTG_HS_ULPI_DIR,ETH_MII_TXD2,FMC_SDNE0,,,EVENTOUT,ADC123_IN12 -PortC,PC3,,,,DFSDM1_DATAIN1,,SPI2_MOSI/I2S2_SD,,,,,OTG_HS_ULPI_NXT,ETH_MII_TX_CLK,FMC_SDCKE0,,,EVENTOUT,ADC123_IN13 -PortC,PC4,,,,DFSDM1_CKIN2,,I2S1_MCK,,,SPDIFRX_IN2,,,ETH_MII_RXD0/ETH_RMII_RXD0,FMC_SDNE0,,,EVENTOUT,ADC12_IN14 -PortC,PC5,,,,DFSDM1_DATAIN2,,,,,SPDIFRX_IN3,,,ETH_MII_RXD1/ETH_RMII_RXD1,FMC_SDCKE0,,,EVENTOUT,ADC12_IN15 -PortC,PC6,,,TIM3_CH1,TIM8_CH1,,I2S2_MCK,,DFSDM1_CKIN3,USART6_TX,FMC_NWAIT,SDMMC2_D6,,SDMMC1_D6,DCMI_D0,LCD_HSYNC,EVENTOUT, -PortC,PC7,,,TIM3_CH2,TIM8_CH2,,,I2S3_MCK,DFSDM1_DATAIN3,USART6_RX,FMC_NE1,SDMMC2_D7,,SDMMC1_D7,DCMI_D1,LCD_G6,EVENTOUT, -PortC,PC8,TRACED1,,TIM3_CH3,TIM8_CH3,,,,UART5_RTS,USART6_CK,FMC_NE2/FMC_NCE,,,SDMMC1_D0,DCMI_D2,,EVENTOUT, -PortC,PC9,MCO2,,TIM3_CH4,TIM8_CH4,I2C3_SDA,I2S_CKIN,,UART5_CTS,,QUADSPI_BK1_IO0,LCD_G3,,SDMMC1_D1,DCMI_D3,LCD_B2,EVENTOUT, -PortC,PC10,,,,DFSDM1_CKIN5,,,SPI3_SCK/I2S3_CK,USART3_TX,UART4_TX,QUADSPI_BK1_IO1,,,SDMMC1_D2,DCMI_D8,LCD_R2,EVENTOUT, -PortC,PC11,,,,DFSDM1_DATAIN5,,,SPI3_MISO,USART3_RX,UART4_RX,QUADSPI_BK2_NCS,,,SDMMC1_D3,DCMI_D4,,EVENTOUT, -PortC,PC12,TRACED3,,,,,,SPI3_MOSI/I2S3_SD,USART3_CK,UART5_TX,,,,SDMMC1_CK,DCMI_D9,,EVENTOUT, -PortC,PC13,,,,,,,,,,,,,,,,EVENTOUT, -PortC,PC14,,,,,,,,,,,,,,,,EVENTOUT, -PortC,PC15,,,,,,,,,,,,,,,,EVENTOUT, -PortD,PD0,,,,DFSDM1_CKIN6,,,DFSDM1_DATAIN7,,UART4_RX,CAN1_RX,,,FMC_D2,,,EVENTOUT, -PortD,PD1,,,,DFSDM1_DATAIN6,,,DFSDM1_CKIN7,,UART4_TX,CAN1_TX,,,FMC_D3,,,EVENTOUT, -PortD,PD2,TRACED2,,TIM3_ETR,,,,,,UART5_RX,,,,SDMMC1_CMD,DCMI_D11,,EVENTOUT, -PortD,PD3,,,,DFSDM1_CKOUT,,SPI2_SCK/I2S2_CK,DFSDM1_DATAIN0,USART2_CTS,,,,,FMC_CLK,DCMI_D5,LCD_G7,EVENTOUT, -PortD,PD4,,,,,,,DFSDM1_CKIN0,USART2_RTS,,,,,FMC_NOE,,,EVENTOUT, -PortD,PD5,,,,,,,,USART2_TX,,,,,FMC_NWE,,,EVENTOUT, -PortD,PD6,,,,DFSDM1_CKIN4,,SPI3_MOSI/I2S3_SD,SAI1_SD_A,USART2_RX,,,DFSDM1_DATAIN1,SDMMC2_CK,FMC_NWAIT,DCMI_D10,LCD_B2,EVENTOUT, -PortD,PD7,,,,DFSDM1_DATAIN4,,SPI1_MOSI/I2S1_SD,DFSDM1_CKIN1,USART2_CK,SPDIFRX_IN0,,,SDMMC2_CMD,FMC_NE1,,,EVENTOUT, -PortD,PD8,,,,DFSDM1_CKIN3,,,,USART3_TX,SPDIFRX_IN1,,,,FMC_D13,,,EVENTOUT, -PortD,PD9,,,,DFSDM1_DATAIN3,,,,USART3_RX,,,,,FMC_D14,,,EVENTOUT, -PortD,PD10,,,,DFSDM1_CKOUT,,,,USART3_CK,,,,,FMC_D15,,LCD_B3,EVENTOUT, -PortD,PD11,,,,,I2C4_SMBA,,,USART3_CTS,,QUADSPI_BK1_IO0,SAI2_SD_A,,FMC_A16/FMC_CLE,,,EVENTOUT, -PortD,PD12,,,TIM4_CH1,LPTIM1_IN1,I2C4_SCL,,,USART3_RTS,,QUADSPI_BK1_IO1,SAI2_FS_A,,FMC_A17/FMC_ALE,,,EVENTOUT, -PortD,PD13,,,TIM4_CH2,LPTIM1_OUT,I2C4_SDA,,,,,QUADSPI_BK1_IO3,SAI2_SCK_A,,FMC_A18,,,EVENTOUT, -PortD,PD14,,,TIM4_CH3,,,,,,UART8_CTS,,,,FMC_D0,,,EVENTOUT, -PortD,PD15,,,TIM4_CH4,,,,,,UART8_RTS,,,,FMC_D1,,,EVENTOUT, -PortE,PE0,,,TIM4_ETR,LPTIM1_ETR,,,,,UART8_RX,,SAI2_MCK_A,,FMC_NBL0,DCMI_D2,,EVENTOUT, -PortE,PE1,,,,LPTIM1_IN2,,,,,UART8_TX,,,,FMC_NBL1,DCMI_D3,,EVENTOUT, -PortE,PE2,TRACECLK,,,,,SPI4_SCK,SAI1_MCLK_A,,,QUADSPI_BK1_IO2,,ETH_MII_TXD3,FMC_A23,,,EVENTOUT, -PortE,PE3,TRACED0,,,,,,SAI1_SD_B,,,,,,FMC_A19,,,EVENTOUT, -PortE,PE4,TRACED1,,,,,SPI4_NSS,SAI1_FS_A,,,,DFSDM1_DATAIN3,,FMC_A20,DCMI_D4,LCD_B0,EVENTOUT, -PortE,PE5,TRACED2,,,TIM9_CH1,,SPI4_MISO,SAI1_SCK_A,,,,DFSDM1_CKIN3,,FMC_A21,DCMI_D6,LCD_G0,EVENTOUT, -PortE,PE6,TRACED3,TIM1_BKIN2,,TIM9_CH2,,SPI4_MOSI,SAI1_SD_A,,,,SAI2_MCK_B,,FMC_A22,DCMI_D7,LCD_G1,EVENTOUT, -PortE,PE7,,TIM1_ETR,,,,,DFSDM1_DATAIN2,,UART7_RX,,QUADSPI_BK2_IO0,,FMC_D4,,,EVENTOUT, -PortE,PE8,,TIM1_CH1N,,,,,DFSDM1_CKIN2,,UART7_TX,,QUADSPI_BK2_IO1,,FMC_D5,,,EVENTOUT, -PortE,PE9,,TIM1_CH1,,,,,DFSDM1_CKOUT,,UART7_RTS,,QUADSPI_BK2_IO2,,FMC_D6,,,EVENTOUT, -PortE,PE10,,TIM1_CH2N,,,,,DFSDM1_DATAIN4,,UART7_CTS,,QUADSPI_BK2_IO3,,FMC_D7,,,EVENTOUT, -PortE,PE11,,TIM1_CH2,,,,SPI4_NSS,DFSDM1_CKIN4,,,,SAI2_SD_B,,FMC_D8,,LCD_G3,EVENTOUT, -PortE,PE12,,TIM1_CH3N,,,,SPI4_SCK,DFSDM1_DATAIN5,,,,SAI2_SCK_B,,FMC_D9,,LCD_B4,EVENTOUT, -PortE,PE13,,TIM1_CH3,,,,SPI4_MISO,DFSDM1_CKIN5,,,,SAI2_FS_B,,FMC_D10,,LCD_DE,EVENTOUT, -PortE,PE14,,TIM1_CH4,,,,SPI4_MOSI,,,,,SAI2_MCK_B,,FMC_D11,,LCD_CLK,EVENTOUT, -PortE,PE15,,TIM1_BKIN,,,,,,,,,,,FMC_D12,,LCD_R7,EVENTOUT, -PortF,PF0,,,,,I2C2_SDA,,,,,,,,FMC_A0,,,EVENTOUT, -PortF,PF1,,,,,I2C2_SCL,,,,,,,,FMC_A1,,,EVENTOUT, -PortF,PF2,,,,,I2C2_SMBA,,,,,,,,FMC_A2,,,EVENTOUT, -PortF,PF3,,,,,,,,,,,,,FMC_A3,,,EVENTOUT,ADC3_IN9 -PortF,PF4,,,,,,,,,,,,,FMC_A4,,,EVENTOUT,ADC3_IN14 -PortF,PF5,,,,,,,,,,,,,FMC_A5,,,EVENTOUT,ADC3_IN15 -PortF,PF6,,,,TIM10_CH1,,SPI5_NSS,SAI1_SD_B,,UART7_RX,QUADSPI_BK1_IO3,,,,,,EVENTOUT,ADC3_IN4 -PortF,PF7,,,,TIM11_CH1,,SPI5_SCK,SAI1_MCLK_B,,UART7_TX,QUADSPI_BK1_IO2,,,,,,EVENTOUT,ADC3_IN5 -PortF,PF8,,,,,,SPI5_MISO,SAI1_SCK_B,,UART7_RTS,TIM13_CH1,QUADSPI_BK1_IO0,,,,,EVENTOUT,ADC3_IN6 -PortF,PF9,,,,,,SPI5_MOSI,SAI1_FS_B,,UART7_CTS,TIM14_CH1,QUADSPI_BK1_IO1,,,,,EVENTOUT,ADC3_IN7 -PortF,PF10,,,,,,,,,,QUADSPI_CLK,,,,DCMI_D11,LCD_DE,EVENTOUT,ADC3_IN8 -PortF,PF11,,,,,,SPI5_MOSI,,,,,SAI2_SD_B,,FMC_SDNRAS,DCMI_D12,,EVENTOUT, -PortF,PF12,,,,,,,,,,,,,FMC_A6,,,EVENTOUT, -PortF,PF13,,,,,I2C4_SMBA,,DFSDM1_DATAIN6,,,,,,FMC_A7,,,EVENTOUT, -PortF,PF14,,,,,I2C4_SCL,,DFSDM1_CKIN6,,,,,,FMC_A8,,,EVENTOUT, -PortF,PF15,,,,,I2C4_SDA,,,,,,,,FMC_A9,,,EVENTOUT, -PortG,PG0,,,,,,,,,,,,,FMC_A10,,,EVENTOUT, -PortG,PG1,,,,,,,,,,,,,FMC_A11,,,EVENTOUT, -PortG,PG2,,,,,,,,,,,,,FMC_A12,,,EVENTOUT, -PortG,PG3,,,,,,,,,,,,,FMC_A13,,,EVENTOUT, -PortG,PG4,,,,,,,,,,,,,FMC_A14/FMC_BA0,,,EVENTOUT, -PortG,PG5,,,,,,,,,,,,,FMC_A15/FMC_BA1,,,EVENTOUT, -PortG,PG6,,,,,,,,,,,,,FMC_NE3,DCMI_D12,LCD_R7,EVENTOUT, -PortG,PG7,,,,,,,SAI1_MCLK_A,,USART6_CK,,,,FMC_INT,DCMI_D13,LCD_CLK,EVENTOUT, -PortG,PG8,,,,,,SPI6_NSS,,SPDIFRX_IN2,USART6_RTS,,,ETH_PPS_OUT,FMC_SDCLK,,LCD_G7,EVENTOUT, -PortG,PG9,,,,,,SPI1_MISO,,SPDIFRX_IN3,USART6_RX,QUADSPI_BK2_IO2,SAI2_FS_B,SDMMC2_D0,FMC_NE2/FMC_NCE,DCMI_VSYNC,,EVENTOUT, -PortG,PG10,,,,,,SPI1_NSS/I2S1_WS,,,,LCD_G3,SAI2_SD_B,SDMMC2_D1,FMC_NE3,DCMI_D2,LCD_B2,EVENTOUT, -PortG,PG11,,,,,,SPI1_SCK/I2S1_CK,,SPDIFRX_IN0,,,SDMMC2_D2,ETH_MII_TX_EN/ETH_RMII_TX_EN,,DCMI_D3,LCD_B3,EVENTOUT, -PortG,PG12,,,,LPTIM1_IN1,,SPI6_MISO,,SPDIFRX_IN1,USART6_RTS,LCD_B4,,SDMMC2_D3,FMC_NE4,,LCD_B1,EVENTOUT, -PortG,PG13,TRACED0,,,LPTIM1_OUT,,SPI6_SCK,,,USART6_CTS,,,ETH_MII_TXD0/ETH_RMII_TXD0,FMC_A24,,LCD_R0,EVENTOUT, -PortG,PG14,TRACED1,,,LPTIM1_ETR,,SPI6_MOSI,,,USART6_TX,QUADSPI_BK2_IO3,,ETH_MII_TXD1/ETH_RMII_TXD1,FMC_A25,,LCD_B0,EVENTOUT, -PortG,PG15,,,,,,,,,USART6_CTS,,,,FMC_SDNCAS,DCMI_D13,,EVENTOUT, -PortH,PH0,,,,,,,,,,,,,,,,EVENTOUT, -PortH,PH1,,,,,,,,,,,,,,,,EVENTOUT, -PortH,PH2,,,,LPTIM1_IN2,,,,,,QUADSPI_BK2_IO0,SAI2_SCK_B,ETH_MII_CRS,FMC_SDCKE0,,LCD_R0,EVENTOUT, -PortH,PH3,,,,,,,,,,QUADSPI_BK2_IO1,SAI2_MCK_B,ETH_MII_COL,FMC_SDNE0,,LCD_R1,EVENTOUT, -PortH,PH4,,,,,I2C2_SCL,,,,,LCD_G5,OTG_HS_ULPI_NXT,,,,LCD_G4,EVENTOUT, -PortH,PH5,,,,,I2C2_SDA,SPI5_NSS,,,,,,,FMC_SDNWE,,,EVENTOUT, -PortH,PH6,,,,,I2C2_SMBA,SPI5_SCK,,,,TIM12_CH1,,ETH_MII_RXD2,FMC_SDNE1,DCMI_D8,,EVENTOUT, -PortH,PH7,,,,,I2C3_SCL,SPI5_MISO,,,,,,ETH_MII_RXD3,FMC_SDCKE1,DCMI_D9,,EVENTOUT, -PortH,PH8,,,,,I2C3_SDA,,,,,,,,FMC_D16,DCMI_HSYNC,LCD_R2,EVENTOUT, -PortH,PH9,,,,,I2C3_SMBA,,,,,TIM12_CH2,,,FMC_D17,DCMI_D0,LCD_R3,EVENTOUT, -PortH,PH10,,,TIM5_CH1,,I2C4_SMBA,,,,,,,,FMC_D18,DCMI_D1,LCD_R4,EVENTOUT, -PortH,PH11,,,TIM5_CH2,,I2C4_SCL,,,,,,,,FMC_D19,DCMI_D2,LCD_R5,EVENTOUT, -PortH,PH12,,,TIM5_CH3,,I2C4_SDA,,,,,,,,FMC_D20,DCMI_D3,LCD_R6,EVENTOUT, -PortH,PH13,,,,TIM8_CH1N,,,,,UART4_TX,CAN1_TX,,,FMC_D21,,LCD_G2,EVENTOUT, -PortH,PH14,,,,TIM8_CH2N,,,,,UART4_RX,CAN1_RX,,,FMC_D22,DCMI_D4,LCD_G3,EVENTOUT, -PortH,PH15,,,,TIM8_CH3N,,,,,,,,,FMC_D23,DCMI_D11,LCD_G4,EVENTOUT, -PortI,PI0,,,TIM5_CH4,,,SPI2_NSS/I2S2_WS,,,,,,,FMC_D24,DCMI_D13,LCD_G5,EVENTOUT, -PortI,PI1,,,,TIM8_BKIN2,,SPI2_SCK/I2S2_CK,,,,,,,FMC_D25,DCMI_D8,LCD_G6,EVENTOUT, -PortI,PI2,,,,TIM8_CH4,,SPI2_MISO,,,,,,,FMC_D26,DCMI_D9,LCD_G7,EVENTOUT, -PortI,PI3,,,,TIM8_ETR,,SPI2_MOSI/I2S2_SD,,,,,,,FMC_D27,DCMI_D10,,EVENTOUT, -PortI,PI4,,,,TIM8_BKIN,,,,,,,SAI2_MCK_A,,FMC_NBL2,DCMI_D5,LCD_B4,EVENTOUT, -PortI,PI5,,,,TIM8_CH1,,,,,,,SAI2_SCK_A,,FMC_NBL3,DCMI_VSYNC,LCD_B5,EVENTOUT, -PortI,PI6,,,,TIM8_CH2,,,,,,,SAI2_SD_A,,FMC_D28,DCMI_D6,LCD_B6,EVENTOUT, -PortI,PI7,,,,TIM8_CH3,,,,,,,SAI2_FS_A,,FMC_D29,DCMI_D7,LCD_B7,EVENTOUT, -PortI,PI8,,,,,,,,,,,,,,,,EVENTOUT, -PortI,PI9,,,,,,,,,UART4_RX,CAN1_RX,,,FMC_D30,,LCD_VSYNC,EVENTOUT, -PortI,PI10,,,,,,,,,,,,ETH_MII_RX_ER,FMC_D31,,LCD_HSYNC,EVENTOUT, -PortI,PI11,,,,,,,,,,LCD_G6,OTG_HS_ULPI_DIR,,,,,EVENTOUT, -PortI,PI12,,,,,,,,,,,,,,,LCD_HSYNC,EVENTOUT, -PortI,PI13,,,,,,,,,,,,,,,LCD_VSYNC,EVENTOUT, -PortI,PI14,,,,,,,,,,,,,,,LCD_CLK,EVENTOUT, -PortI,PI15,,,,,,,,,,LCD_G2,,,,,LCD_R0,EVENTOUT, -PortJ,PJ0,,,,,,,,,,LCD_R7,,,,,LCD_R1,EVENTOUT, -PortJ,PJ1,,,,,,,,,,,,,,,LCD_R2,EVENTOUT, -PortJ,PJ2,,,,,,,,,,,,,,DSI_TE,LCD_R3,EVENTOUT, -PortJ,PJ3,,,,,,,,,,,,,,,LCD_R4,EVENTOUT, -PortJ,PJ4,,,,,,,,,,,,,,,LCD_R5,EVENTOUT, -PortJ,PJ5,,,,,,,,,,,,,,,LCD_R6,EVENTOUT, -PortJ,PJ6,,,,,,,,,,,,,,,LCD_R7,EVENTOUT, -PortJ,PJ7,,,,,,,,,,,,,,,LCD_G0,EVENTOUT, -PortJ,PJ8,,,,,,,,,,,,,,,LCD_G1,EVENTOUT, -PortJ,PJ9,,,,,,,,,,,,,,,LCD_G2,EVENTOUT, -PortJ,PJ10,,,,,,,,,,,,,,,LCD_G3,EVENTOUT, -PortJ,PJ11,,,,,,,,,,,,,,,LCD_G4,EVENTOUT, -PortJ,PJ12,,,,,,,,,,LCD_G3,,,,,LCD_B0,EVENTOUT, -PortJ,PJ13,,,,,,,,,,LCD_G4,,,,,LCD_B1,EVENTOUT, -PortJ,PJ14,,,,,,,,,,,,,,,LCD_B2,EVENTOUT, -PortJ,PJ15,,,,,,,,,,,,,,,LCD_B3,EVENTOUT, -PortK,PK0,,,,,,,,,,,,,,,LCD_G5,EVENTOUT, -PortK,PK1,,,,,,,,,,,,,,,LCD_G6,EVENTOUT, -PortK,PK2,,,,,,,,,,,,,,,LCD_G7,EVENTOUT, -PortK,PK3,,,,,,,,,,,,,,,LCD_B4,EVENTOUT, -PortK,PK4,,,,,,,,,,,,,,,LCD_B5,EVENTOUT, -PortK,PK5,,,,,,,,,,,,,,,LCD_B6,EVENTOUT, -PortK,PK6,,,,,,,,,,,,,,,LCD_B7,EVENTOUT, -PortK,PK7,,,,,,,,,,,,,,,LCD_DE,EVENTOUT, From a7634e8bf226e1caf965684767498ce1b74ac8e6 Mon Sep 17 00:00:00 2001 From: George Waters Date: Thu, 9 Jul 2020 15:13:48 -0400 Subject: [PATCH 168/277] Set version and release in build workflow --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa7dd9dd25..463f1c680a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,9 @@ jobs: fetch-depth: 0 - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/* - name: CircuitPython version - run: git describe --dirty --tags + run: | + git describe --dirty --tags + echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)" - name: Set up Python 3.8 uses: actions/setup-python@v1 with: @@ -68,7 +70,7 @@ jobs: name: stubs path: circuitpython-stubs* - name: Docs - run: sphinx-build -E -W -b html . _build/html + run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html - uses: actions/upload-artifact@v2 with: name: docs From eb860101766741fd75326577bb779d91cb3afd01 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 9 Jul 2020 16:45:39 -0400 Subject: [PATCH 169/277] Enable RGB Matrix --- ports/stm/common-hal/rgbmatrix/RGBMatrix.c | 5 ++--- ports/stm/mpconfigport.mk | 4 ++-- ports/stm/peripherals/timers.c | 6 ++++++ ports/stm/peripherals/timers.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ports/stm/common-hal/rgbmatrix/RGBMatrix.c b/ports/stm/common-hal/rgbmatrix/RGBMatrix.c index 9e60cc3e6f..312f153580 100644 --- a/ports/stm/common-hal/rgbmatrix/RGBMatrix.c +++ b/ports/stm/common-hal/rgbmatrix/RGBMatrix.c @@ -27,17 +27,16 @@ #include #include "common-hal/rgbmatrix/RGBMatrix.h" +#include "timers.h" #include STM32_HAL_H extern void _PM_IRQ_HANDLER(void); void *common_hal_rgbmatrix_timer_allocate() { - // TODO(jepler) properly handle resource allocation including never-reset - return TIM6; + return stm_peripherals_find_timer(); } - void common_hal_rgbmatrix_timer_enable(void* ptr) { HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); } diff --git a/ports/stm/mpconfigport.mk b/ports/stm/mpconfigport.mk index 74ecf656e9..896d78bba7 100644 --- a/ports/stm/mpconfigport.mk +++ b/ports/stm/mpconfigport.mk @@ -4,8 +4,8 @@ INTERNAL_LIBM ?= 1 USB_SERIAL_NUMBER_LENGTH ?= 24 ifeq ($(MCU_VARIANT),STM32F405xx) - CIRCUITPY_FRAMEBUFFERIO ?= 0 - CIRCUITPY_RGBMATRIX ?= 0 + CIRCUITPY_FRAMEBUFFERIO ?= 1 + CIRCUITPY_RGBMATRIX ?= 1 endif ifeq ($(MCU_SERIES),F4) diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index 589c283100..924d3a16fb 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -85,6 +85,11 @@ uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer) { return source; } +size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef * instance) { + size_t tim_id = stm_peripherals_timer_get_index(instance); + return irq_map[tim_id]; +} + void timers_reset(void) { uint16_t never_reset_mask = 0x00; for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) { @@ -120,6 +125,7 @@ TIM_TypeDef * stm_peripherals_find_timer(void) { return mcu_tim_banks[i]; } } + //TODO: secondary search for timers outside the pins in the board profile // Work backwards - higher index timers have fewer pin allocations for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) { diff --git a/ports/stm/peripherals/timers.h b/ports/stm/peripherals/timers.h index 8c8a80d53c..02e4e304e3 100644 --- a/ports/stm/peripherals/timers.h +++ b/ports/stm/peripherals/timers.h @@ -41,6 +41,7 @@ void tim_clock_enable(uint16_t mask); void tim_clock_disable(uint16_t mask); uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer); +size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef * instance); void timers_reset(void); TIM_TypeDef * stm_peripherals_find_timer(void); void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void)); From 7ff499046ba6e15e115e5e3fca53204f1ec26cc3 Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Sat, 11 Jul 2020 00:37:45 +0800 Subject: [PATCH 170/277] use VID & PIDs granted by Seeed --- ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk | 4 ++-- .../nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk index 46f9885cb1..fc630e5bbe 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x1915 -USB_PID = 0xb001 +USB_VID = 0x2886 +USB_PID = 0xf002 USB_PRODUCT = "M60 Keyboard" USB_MANUFACTURER = "Makerdiary" diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk index bc5fa3c120..4e6aebc8e8 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x1915 -USB_PID = 0xb001 +USB_VID = 0x2886 +USB_PID = 0xf001 USB_PRODUCT = "nRF52840 M.2 Developer Kit" USB_MANUFACTURER = "Makerdiary" From 742f9cfdb0d286b8c4e1a30be6ba407f6e8ed47d Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 2 Jul 2020 22:57:58 +0200 Subject: [PATCH 171/277] Fluff M0: additional pins on version 1.3 of the board --- ports/atmel-samd/boards/fluff_m0/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/fluff_m0/pins.c b/ports/atmel-samd/boards/fluff_m0/pins.c index d80d46b895..ac7811328b 100644 --- a/ports/atmel-samd/boards/fluff_m0/pins.c +++ b/ports/atmel-samd/boards/fluff_m0/pins.c @@ -30,6 +30,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA28) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From b1ac6b4444eca556632839fb1c5d298f2936f8e5 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Fri, 10 Jul 2020 15:16:47 -0400 Subject: [PATCH 172/277] translations --- locale/circuitpython.pot | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f3c9d04113..237741bff4 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-10 15:16-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -307,7 +307,7 @@ msgstr "" #: ports/cxd56/common-hal/pulseio/PulseOut.c #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c -#: shared-bindings/pulseio/PWMOut.c +#: ports/stm/peripherals/timers.c shared-bindings/pulseio/PWMOut.c msgid "All timers in use" msgstr "" @@ -1311,11 +1311,7 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm/common-hal/pulseio/PulseIn.c -msgid "PulseIn not supported on this chip" -msgstr "" - -#: ports/stm/common-hal/pulseio/PulseOut.c +#: ports/stm/ref/pulseout-pre-timeralloc.c msgid "PulseOut not supported on this chip" msgstr "" @@ -1521,6 +1517,11 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" +#: ports/stm/common-hal/pulseio/PWMOut.c +msgid "" +"Timer was reserved for internal use - declare PWM pins earlier in the program" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" From 734661e79cc2b108079377642ef24fab1217c484 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 10 Jul 2020 16:42:32 -0700 Subject: [PATCH 173/277] Add support to json.load for any object with readinto This way we don't need to load the whole string version of the json into memory. --- extmod/modujson.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/extmod/modujson.c b/extmod/modujson.c index 0f93ccb110..1e831783a8 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -26,6 +26,8 @@ #include +#include "py/binary.h" +#include "py/objarray.h" #include "py/objlist.h" #include "py/objstringio.h" #include "py/parsenum.h" @@ -74,6 +76,8 @@ typedef struct _ujson_stream_t { mp_obj_t stream_obj; mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); int errcode; + mp_obj_t python_readinto[2 + 1]; + mp_obj_array_t bytearray_obj; byte cur; } ujson_stream_t; @@ -94,9 +98,37 @@ STATIC byte ujson_stream_next(ujson_stream_t *s) { return s->cur; } +STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) { + ujson_stream_t* s = obj; + s->bytearray_obj.items = buf; + s->bytearray_obj.len = size; + *errcode = 0; + mp_obj_t ret = mp_call_method_n_kw(1, 0, s->python_readinto); + if (ret == mp_const_none) { + *errcode = MP_EAGAIN; + return MP_STREAM_ERROR; + } + return mp_obj_get_int(ret); +} + STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) { - const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, MP_STREAM_OP_READ); - ujson_stream_t s = {stream_obj, stream_p->read, 0, 0}; + const mp_stream_p_t *stream_p = mp_proto_get(MP_QSTR_protocol_stream, stream_obj); + ujson_stream_t s; + if (stream_p == NULL) { + mp_load_method(stream_obj, MP_QSTR_readinto, s.python_readinto); + s.bytearray_obj.base.type = &mp_type_bytearray; + s.bytearray_obj.typecode = BYTEARRAY_TYPECODE; + s.bytearray_obj.free = 0; + // len and items are set at read time + s.python_readinto[2] = MP_OBJ_FROM_PTR(&s.bytearray_obj); + s.stream_obj = &s; + s.read = ujson_python_readinto; + } else { + stream_p = mp_get_stream_raise(stream_obj, MP_STREAM_OP_READ); + s.stream_obj = stream_obj; + s.read = stream_p->read; + } + JSON_DEBUG("got JSON stream\n"); vstr_t vstr; vstr_init(&vstr, 8); From 372bcf8a956c8b20c423333114d7aa061dd54751 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 10 Jul 2020 17:33:17 -0700 Subject: [PATCH 174/277] Fix stream version and add basic readinto test --- extmod/modujson.c | 2 ++ tests/extmod/ujson_load_readinto.py | 22 ++++++++++++++++++++++ tests/extmod/ujson_load_readinto.py.exp | 4 ++++ 3 files changed, 28 insertions(+) create mode 100644 tests/extmod/ujson_load_readinto.py create mode 100644 tests/extmod/ujson_load_readinto.py.exp diff --git a/extmod/modujson.c b/extmod/modujson.c index 1e831783a8..242726cca0 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -127,6 +127,8 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) { stream_p = mp_get_stream_raise(stream_obj, MP_STREAM_OP_READ); s.stream_obj = stream_obj; s.read = stream_p->read; + s.errcode = 0; + s.cur = 0; } JSON_DEBUG("got JSON stream\n"); diff --git a/tests/extmod/ujson_load_readinto.py b/tests/extmod/ujson_load_readinto.py new file mode 100644 index 0000000000..a277f40efc --- /dev/null +++ b/tests/extmod/ujson_load_readinto.py @@ -0,0 +1,22 @@ +import ujson as json + +# Test that json can load from any object with readinto + +class Buffer: + def __init__(self, data): + self._data = data + self._i = 0 + + def readinto(self, buf): + end = self._i + len(buf) + remaining = len(self._data) - self._i + end = min(end, len(self._data)) + l = min(len(buf), remaining) + buf[:l] = self._data[self._i:end] + self._i += l + return l + +print(json.load(Buffer(b'null'))) +print(json.load(Buffer(b'"abc\\u0064e"'))) +print(json.load(Buffer(b'[false, true, 1, -2]'))) +print(json.load(Buffer(b'{"a":true}'))) diff --git a/tests/extmod/ujson_load_readinto.py.exp b/tests/extmod/ujson_load_readinto.py.exp new file mode 100644 index 0000000000..f8c3c693be --- /dev/null +++ b/tests/extmod/ujson_load_readinto.py.exp @@ -0,0 +1,4 @@ +None +abcde +[False, True, 1, -2] +{'a': True} From 8e26fdc0e9537f30924581a846de77cfbb5b5fb7 Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Sat, 11 Jul 2020 10:51:31 +0800 Subject: [PATCH 175/277] add LED status, remove unused macros --- ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h | 4 ++-- .../nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h index c59a5fdb28..bd9caf32fc 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h @@ -27,11 +27,11 @@ #include "nrfx/hal/nrf_gpio.h" -#define MAKERDIARYM60KEYBOARD - #define MICROPY_HW_BOARD_NAME "Makerdiary M60 Keyboard" #define MICROPY_HW_MCU_NAME "nRF52840" +#define MICROPY_HW_LED_STATUS (&pin_P0_30) + #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) #define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(1, 15) diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h index a3fb7643f9..8b8d6173a6 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h @@ -27,11 +27,11 @@ #include "nrfx/hal/nrf_gpio.h" -#define MAKERDIARYNRF52840M2DEVKIT - #define MICROPY_HW_BOARD_NAME "Makerdiary nRF52840 M.2 Developer Kit" #define MICROPY_HW_MCU_NAME "nRF52840" +#define MICROPY_HW_LED_STATUS (&pin_P0_30) + #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) #define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(1, 15) From c8752ff93eb62f115e9129f7b2d20d8ed5a8ed88 Mon Sep 17 00:00:00 2001 From: Yihui Xiong Date: Sat, 11 Jul 2020 21:25:32 +0800 Subject: [PATCH 176/277] use RGB LEDs as status indicators --- ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h | 4 +++- .../boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h index bd9caf32fc..086718089a 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h @@ -30,7 +30,9 @@ #define MICROPY_HW_BOARD_NAME "Makerdiary M60 Keyboard" #define MICROPY_HW_MCU_NAME "nRF52840" -#define MICROPY_HW_LED_STATUS (&pin_P0_30) +#define CP_RGB_STATUS_R (&pin_P0_30) +#define CP_RGB_STATUS_G (&pin_P0_29) +#define CP_RGB_STATUS_B (&pin_P0_31) #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h index 8b8d6173a6..dab2ff042b 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h @@ -30,7 +30,12 @@ #define MICROPY_HW_BOARD_NAME "Makerdiary nRF52840 M.2 Developer Kit" #define MICROPY_HW_MCU_NAME "nRF52840" -#define MICROPY_HW_LED_STATUS (&pin_P0_30) +#define MICROPY_HW_LED_STATUS (&pin_P1_07) + +#define CP_RGB_STATUS_INVERTED_PWM +#define CP_RGB_STATUS_R (&pin_P0_30) +#define CP_RGB_STATUS_G (&pin_P0_29) +#define CP_RGB_STATUS_B (&pin_P0_31) #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) From b8910676db54ab260b55b756bf3ea3fcd599c995 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 13 Jul 2020 11:52:30 -0400 Subject: [PATCH 177/277] Add missing enum preprocessor protection --- ports/stm/peripherals/timers.c | 71 +++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index 924d3a16fb..1bcee36455 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -35,30 +35,97 @@ #include "shared-bindings/microcontroller/Pin.h" #define ALL_CLOCKS 0xFFFF +#define NULL_IRQ 0xFF static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)]; static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)]; static void (*stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)])(void); static size_t irq_map[] = { + #ifdef TIM1 TIM1_CC_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM2 TIM2_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM3 TIM3_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM4 TIM4_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM5 TIM5_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM6 TIM6_DAC_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM7 TIM7_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM8 TIM8_CC_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM9 TIM1_BRK_TIM9_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM10 TIM1_UP_TIM10_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM11 TIM1_TRG_COM_TIM11_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM12 TIM8_BRK_TIM12_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM13 TIM8_UP_TIM13_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM14 TIM8_TRG_COM_TIM14_IRQn, -#if (CPY_STM32H7) + #else + NULL_IRQ, + #endif + #ifdef TIM15 TIM15_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM16 TIM16_IRQn, + #else + NULL_IRQ, + #endif + #ifdef TIM17 TIM17_IRQn, -#endif + #else + NULL_IRQ, + #endif }; // Get the frequency (in Hz) of the source clock for the given timer. From 0354d4a2250eab3d9e7ef8599d322c394fb0690f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 8 Jul 2020 20:32:36 +0200 Subject: [PATCH 178/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 9 +++++++-- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/es.po | 6 +++++- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ko.po | 6 +++++- locale/nl.po | 6 +++++- locale/pl.po | 6 +++++- locale/pt_BR.po | 6 +++++- locale/sv.po | 6 +++++- locale/zh_Latn_pinyin.po | 6 +++++- 13 files changed, 67 insertions(+), 14 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index aab5f82810..a72e63eec8 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-07-06 18:10+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -824,7 +824,8 @@ msgstr "File sudah ada" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "Frequency captured is above capability. Capture Paused." -msgstr "Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." +msgstr "" +"Frekuensi yang ditangkap berada di atas kemampuan. Penangkapan Ditunda." #: ports/stm/common-hal/pulseio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" @@ -1116,6 +1117,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/cs.po b/locale/cs.po index dfe1cfa384..b6206da297 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -1100,6 +1100,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/de_DE.po b/locale/de_DE.po index f2d9258566..72d0329487 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -1119,6 +1119,10 @@ msgstr "Muss eine %q Unterklasse sein." msgid "Must provide MISO or MOSI pin" msgstr "Muss MISO- oder MOSI-Pin bereitstellen" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/es.po b/locale/es.po index 2778c53315..4f618c9d37 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-07-07 15:59+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -1116,6 +1116,10 @@ msgstr "Debe de ser una subclase de %q" msgid "Must provide MISO or MOSI pin" msgstr "Debe proporcionar un pin MISO o MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/fil.po b/locale/fil.po index 3489316130..4738619fff 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -1108,6 +1108,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/fr.po b/locale/fr.po index 2db7f47222..c3aa827df6 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" @@ -1121,6 +1121,10 @@ msgstr "Doit être une sous-classe de %q." msgid "Must provide MISO or MOSI pin" msgstr "Doit fournir une broche MISO ou MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/it_IT.po b/locale/it_IT.po index bd49e2388b..fd5d61a1a7 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -1112,6 +1112,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/ko.po b/locale/ko.po index 4bd56cde1e..975e1087df 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -1096,6 +1096,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/nl.po b/locale/nl.po index 34e9c835a2..9810c471c0 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-07-02 20:42+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -1112,6 +1112,10 @@ msgstr "%q moet een subklasse zijn." msgid "Must provide MISO or MOSI pin" msgstr "MISO of MOSI moeten worden gegeven" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/pl.po b/locale/pl.po index 7724481314..8fea2d8152 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -1097,6 +1097,10 @@ msgstr "" msgid "Must provide MISO or MOSI pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f25d2d86e6..ace88d1e3b 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-07-03 22:53+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -1119,6 +1119,10 @@ msgstr "Deve ser uma subclasse %q." msgid "Must provide MISO or MOSI pin" msgstr "Deve informar os pinos MISO ou MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/sv.po b/locale/sv.po index 3ec91c19ee..299fc796f3 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2020-06-03 18:59+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -1111,6 +1111,10 @@ msgstr "Måste vara en %q-subklass." msgid "Must provide MISO or MOSI pin" msgstr "Måste ange MISO- eller MOSI-pinne" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index db41adb536..1928ff2b61 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-02 15:29+0200\n" +"POT-Creation-Date: 2020-07-07 14:38-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -1105,6 +1105,10 @@ msgstr "Bìxū shì %q zi lèi." msgid "Must provide MISO or MOSI pin" msgstr "Bìxū tígōng MISO huò MOSI yǐn jiǎo" +#: ports/stm/common-hal/busio/SPI.c +msgid "Must provide SCK pin" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" From 9f81922be38c1a28dce54bcb0612175513fc15ce Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 8 Jul 2020 18:40:31 +0000 Subject: [PATCH 179/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (779 of 779 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index ace88d1e3b..da57f725de 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-07 14:38-0500\n" -"PO-Revision-Date: 2020-07-03 22:53+0000\n" +"PO-Revision-Date: 2020-07-09 17:23+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1121,7 +1121,7 @@ msgstr "Deve informar os pinos MISO ou MOSI" #: ports/stm/common-hal/busio/SPI.c msgid "Must provide SCK pin" -msgstr "" +msgstr "É obrigatório informar o pino SCK" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format From 8e7dab34c251ee5df3e26d453dfd6782f32d7789 Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Thu, 9 Jul 2020 19:37:05 +0000 Subject: [PATCH 180/277] Translated using Weblate (Spanish) Currently translated at 99.8% (778 of 779 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/locale/es.po b/locale/es.po index 4f618c9d37..bfa2c21cc2 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-07 14:38-0500\n" -"PO-Revision-Date: 2020-07-07 15:59+0000\n" +"PO-Revision-Date: 2020-07-10 18:15+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" @@ -576,7 +576,7 @@ msgstr "Iniciado de pin de reloj fallido." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" -msgstr "Clock stretch demasiado largo " +msgstr "Estirado de reloj demasiado largo" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" @@ -692,7 +692,7 @@ msgstr "Trozo de datos debe seguir fmt chunk" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data too large for advertisement packet" -msgstr "Data es muy grande para el paquete de advertisement." +msgstr "Data es muy grande para el paquete de anuncio" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -746,7 +746,7 @@ msgstr "Se espera un %q" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/Descriptor.c shared-bindings/_bleio/PacketBuffer.c msgid "Expected a Characteristic" -msgstr "Se esperaba una Característica." +msgstr "Se esperaba una Característica" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" @@ -776,7 +776,7 @@ msgstr "FFT se define solo para ndarrays" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." -msgstr "Fallo enviando comando" +msgstr "Fallo enviando comando." #: ports/nrf/sd_mutex.c #, c-format @@ -873,7 +873,7 @@ msgid "" "mpy-update for more info." msgstr "" "Archivo .mpy incompatible. Actualice todos los archivos .mpy. Consulte " -"http://adafru.it/mpy-update para más información" +"http://adafru.it/mpy-update para más información." #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" @@ -981,7 +981,7 @@ msgstr "Frecuencia suministrada no válida" #: supervisor/shared/safe_mode.c msgid "Invalid memory access." -msgstr "Acceso a memoria no válido" +msgstr "Acceso a memoria no válido." #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid number of bits" @@ -1065,7 +1065,7 @@ msgstr "LHS del agumento por palabra clave deberia ser un identificador" #: shared-module/displayio/Group.c msgid "Layer already in a group." -msgstr "Layer ya pertenece a un grupo" +msgstr "La capa ya pertenece a un grupo." #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass." @@ -1110,7 +1110,7 @@ msgstr "Falta el pin MISO o MOSI" #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." -msgstr "Debe de ser una subclase de %q" +msgstr "Debe de ser una subclase de %q." #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c msgid "Must provide MISO or MOSI pin" @@ -1118,7 +1118,7 @@ msgstr "Debe proporcionar un pin MISO o MOSI" #: ports/stm/common-hal/busio/SPI.c msgid "Must provide SCK pin" -msgstr "" +msgstr "Debes proveer un pin para SCK" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1239,7 +1239,7 @@ msgid "" "Object has been deinitialized and can no longer be used. Create a new object." msgstr "" "El objeto se ha desinicializado y ya no se puede utilizar. Crea un nuevo " -"objeto" +"objeto." #: ports/nrf/common-hal/busio/UART.c msgid "Odd parity is not supported" @@ -1268,7 +1268,7 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." -msgstr "El sobremuestreo debe ser un múltiplo de 8" +msgstr "El sobremuestreo debe ser un múltiplo de 8." #: shared-bindings/pulseio/PWMOut.c msgid "" @@ -1279,8 +1279,8 @@ msgstr "PWM duty_cycle debe ser entre 0 y 65535 inclusivo (16 bit resolution)" msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -"PWM frecuencia no esta escrito cuando el variable_frequency es falso en " -"construcion" +"La frecuencia de PWM no se puede escribir variable_frequency es False en la " +"construcción." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c #: ports/stm/common-hal/displayio/ParallelBus.c @@ -1465,7 +1465,7 @@ msgstr "Serializer está siendo utilizado" #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." -msgstr "Slice y value tienen diferentes longitudes" +msgstr "Slice y value tienen tamaños diferentes." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c #: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c @@ -1657,7 +1657,7 @@ msgstr "No se pudo leer los datos de la paleta de colores" #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." -msgstr "Imposible escribir en nvm" +msgstr "Imposible escribir en nvm." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2280,9 +2280,9 @@ msgid "end_x should be an int" msgstr "end_x debe ser un int" #: ports/nrf/common-hal/busio/UART.c -#, c-format +#, c-format, fuzzy msgid "error = 0x%08lX" -msgstr "error = 0x%08lx" +msgstr "error = 0x%08lX" #: py/runtime.c msgid "exceptions must derive from BaseException" From 7b31ededcd066e9eb7222a5f644ee9d521e14d7c Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 13 Jul 2020 17:00:41 +0000 Subject: [PATCH 181/277] Translated using Weblate (Swedish) Currently translated at 100.0% (779 of 779 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 299fc796f3..1ea1bb1de5 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-07 14:38-0500\n" -"PO-Revision-Date: 2020-06-03 18:59+0000\n" +"PO-Revision-Date: 2020-07-13 17:39+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -16,7 +16,7 @@ msgstr "" "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.1-dev\n" +"X-Generator: Weblate 4.2-dev\n" #: main.c msgid "" @@ -68,7 +68,7 @@ msgstr "%d adresspinnar och %d RGB-pinnar indikerar en höjd av %d, inte %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q-fel: %d" #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -99,7 +99,7 @@ msgstr "%q måste vara en tuple av längd 2" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q pin invalid" -msgstr "" +msgstr "Pinne %q ogiltig" #: shared-bindings/fontio/BuiltinFont.c msgid "%q should be an int" @@ -438,7 +438,7 @@ msgstr "Buffertlängd %d för stor. Den måste vara mindre än %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 "Buffertlängd måste vara en multipel av 512" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" @@ -604,11 +604,11 @@ msgstr "Korrupt rå kod" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" -msgstr "" +msgstr "Kan inte initiera GNSS" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" -msgstr "" +msgstr "Kan inte initiera SD-kort" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c msgid "Could not initialize UART" @@ -896,7 +896,7 @@ msgstr "Internt fel #%d" #: shared-bindings/sdioio/SDCard.c msgid "Invalid %q" -msgstr "" +msgstr "Ogiltig %q" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -1113,7 +1113,7 @@ msgstr "Måste ange MISO- eller MOSI-pinne" #: ports/stm/common-hal/busio/SPI.c msgid "Must provide SCK pin" -msgstr "" +msgstr "Måste ange SCK-pinne" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -1417,7 +1417,7 @@ msgstr "Kör i säkert läge! Sparad kod körs inte.\n" #: shared-module/sdcardio/SDCard.c msgid "SD card CSD format not supported" -msgstr "" +msgstr "SD-kort CSD-format stöds inte" #: ports/atmel-samd/common-hal/busio/I2C.c #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c @@ -1489,7 +1489,7 @@ msgstr "Ange minst en UART-pinne" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" -msgstr "" +msgstr "Systeminträdet måste vara gnss. SatellitSystem" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" @@ -2058,7 +2058,7 @@ msgstr "kan inte skicka icke-None värde till nystartad generator" #: shared-module/sdcardio/SDCard.c msgid "can't set 512 block size" -msgstr "" +msgstr "kan inte sätta blockstorlek 512" #: py/objnamedtuple.c msgid "can't set attribute" @@ -2190,7 +2190,7 @@ msgstr "kan inte invertera Vandermonde-matris" #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" -msgstr "" +msgstr "kan inte avgöra SD-kortversion" #: extmod/ulab/code/approx.c msgid "data must be iterable" @@ -2757,7 +2757,7 @@ msgstr "negativt skiftantal" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "" +msgstr "inget SD-kort" #: py/vm.c msgid "no active exception to reraise" @@ -2782,7 +2782,7 @@ msgstr "ingen reset-pinne tillgänglig" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "" +msgstr "inget svar från SD-kort" #: py/runtime.c msgid "no such attribute" @@ -3078,15 +3078,15 @@ msgstr "värdet för sleep måste vara positivt" #: extmod/ulab/code/ndarray.c msgid "slice step can't be zero" -msgstr "" +msgstr "segmentsteg kan inte vara noll" #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" -msgstr "segmentsteg får inte vara noll" +msgstr "segmentsteg kan inte vara noll" #: py/objint.c py/sequence.c msgid "small int overflow" -msgstr "värdet för konvertering till small int överskreds" +msgstr "värdet för small int överskreds" #: main.c msgid "soft reboot\n" @@ -3098,15 +3098,15 @@ msgstr "argumentet sort måste vara en ndarray" #: extmod/ulab/code/filter.c msgid "sos array must be of shape (n_section, 6)" -msgstr "" +msgstr "sos array måste ha form (n_section, 6)" #: extmod/ulab/code/filter.c msgid "sos[:, 3] should be all ones" -msgstr "" +msgstr "sos[:, 3] måste vara ettor" #: extmod/ulab/code/filter.c msgid "sosfilt requires iterable arguments" -msgstr "" +msgstr "sosfilt kräver iterable argument" #: py/objstr.c msgid "start/end indices" @@ -3195,11 +3195,11 @@ msgstr "timeout måste vara >= 0.0" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "" +msgstr "timeout för v1-kort" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "" +msgstr "timeout för v2-kort" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" @@ -3400,15 +3400,15 @@ msgstr "noll steg" #: extmod/ulab/code/filter.c msgid "zi must be an ndarray" -msgstr "" +msgstr "zi måste vara en ndarray" #: extmod/ulab/code/filter.c msgid "zi must be of float type" -msgstr "" +msgstr "zi måste vara av typ float" #: extmod/ulab/code/filter.c msgid "zi must be of shape (n_section, 2)" -msgstr "" +msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "I2C operation not supported" #~ msgstr "I2C-åtgärd stöds inte" From f1b3c88d6e2f29b94c69aa5e23c269b7f31f769f Mon Sep 17 00:00:00 2001 From: _fonzlate Date: Mon, 13 Jul 2020 17:26:13 +0000 Subject: [PATCH 182/277] Translated using Weblate (Dutch) Currently translated at 100.0% (779 of 779 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index 9810c471c0..44d829041d 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-07 14:38-0500\n" -"PO-Revision-Date: 2020-07-02 20:42+0000\n" +"PO-Revision-Date: 2020-07-13 17:39+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" "Language: nl\n" @@ -1114,7 +1114,7 @@ msgstr "MISO of MOSI moeten worden gegeven" #: ports/stm/common-hal/busio/SPI.c msgid "Must provide SCK pin" -msgstr "" +msgstr "SCK pin moet opgegeven worden" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format From 0ab2c7b10a68977b750b5ccd8b7475ad2162085d Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Mon, 13 Jul 2020 18:15:53 +0000 Subject: [PATCH 183/277] Translated using Weblate (Spanish) Currently translated at 100.0% (779 of 779 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/locale/es.po b/locale/es.po index bfa2c21cc2..38c6ecf7ee 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-07 14:38-0500\n" -"PO-Revision-Date: 2020-07-10 18:15+0000\n" +"PO-Revision-Date: 2020-07-13 19:24+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" @@ -536,7 +536,7 @@ msgstr "No se puede especificar RTS o CTS en modo RS485" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "Cannot subclass slice" +msgstr "No se puede manejar la partición en una subclase" #: shared-module/bitbangio/SPI.c msgid "Cannot transfer without MOSI and MISO pins." @@ -1279,7 +1279,7 @@ msgstr "PWM duty_cycle debe ser entre 0 y 65535 inclusivo (16 bit resolution)" msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -"La frecuencia de PWM no se puede escribir variable_frequency es False en la " +"La frecuencia de PWM no se puede escribir variable_frequency es False en la " "construcción." #: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c @@ -1685,7 +1685,7 @@ msgstr "Error suave desconocido en dispositivo: %04x" #: shared-bindings/_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." -msgstr "Número incomparable de elementos en RHS (%d esperado,%d obtenido)" +msgstr "Número incomparable de elementos en RHS (%d esperado,%d obtenido)." #: ports/nrf/common-hal/_bleio/__init__.c msgid "" @@ -1728,7 +1728,7 @@ msgstr "Tamaño de valor > max_length" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" -msgstr "funciones Viper actualmente no soportan más de 4 argumentos." +msgstr "funciones Viper no soportan por el momento, más de 4 argumentos" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Voltage read timed out" @@ -2280,7 +2280,7 @@ msgid "end_x should be an int" msgstr "end_x debe ser un int" #: ports/nrf/common-hal/busio/UART.c -#, c-format, fuzzy +#, c-format msgid "error = 0x%08lX" msgstr "error = 0x%08lX" @@ -2439,7 +2439,7 @@ msgstr "la función toma %d argumentos posicionales pero le fueron dados %d" #: shared-bindings/time/__init__.c msgid "function takes exactly 9 arguments" -msgstr "la función toma exactamente 9 argumentos." +msgstr "la función toma exactamente 9 argumentos" #: py/objgenerator.c msgid "generator already executing" From a2233ced87700e50fb70c124d0f42eefb4c0c487 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 14 Jul 2020 01:28:58 +0200 Subject: [PATCH 184/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 1 - locale/cs.po | 1 - locale/de_DE.po | 1 - locale/es.po | 1 - locale/fil.po | 1 - locale/fr.po | 1 - locale/it_IT.po | 1 - locale/ko.po | 1 - locale/nl.po | 1 - locale/pl.po | 1 - locale/pt_BR.po | 1 - locale/sv.po | 1 - locale/zh_Latn_pinyin.po | 1 - 13 files changed, 13 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index edca87f830..9e10156e6a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/cs.po b/locale/cs.po index cfd0038f00..d09cf1e94b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/de_DE.po b/locale/de_DE.po index 041b1ae510..1e168db528 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/es.po b/locale/es.po index 6245c70686..0dd09a98df 100644 --- a/locale/es.po +++ b/locale/es.po @@ -4,7 +4,6 @@ # # SPDX-License-Identifier: MIT #, fuzzy - msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/fil.po b/locale/fil.po index 2b2ade0316..1297ce186d 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/fr.po b/locale/fr.po index 58714abbf0..4582974d45 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -3,7 +3,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: 0.1\n" diff --git a/locale/it_IT.po b/locale/it_IT.po index df3000a47a..2358433825 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2,7 +2,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/ko.po b/locale/ko.po index 17bcd9837d..6829f6819f 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2,7 +2,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/nl.po b/locale/nl.po index 6d08b44966..d39d0bb189 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/pl.po b/locale/pl.po index 966b65965a..e8b7298a2a 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2,7 +2,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: \n" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index c9cd065427..024608b3db 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/sv.po b/locale/sv.po index 4973cf52a0..b588cbea7e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 64af0c2db8..0f6d55fd16 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2,7 +2,6 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT - msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" From e963cff72de0efbd4e9c0b177caab88363f67d2e Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 13 Jul 2020 22:27:06 -0500 Subject: [PATCH 185/277] Issue #2949 Run background checks during long multiplications --- py/mpz.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/py/mpz.c b/py/mpz.c index 7800cdcc45..8b8541c737 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -443,8 +443,11 @@ STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t * *id++ = carry; } - ilen = id - oidig; + ilen = id - oidig; + // check to prevent usb starvation + RUN_BACKGROUND_TASKS; } + return ilen; } From 30361f6f2a9cea4ae2aeb6dc41f5872d1f6fadee Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 13 Jul 2020 22:39:30 -0500 Subject: [PATCH 186/277] Fix formatting --- py/mpz.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/py/mpz.c b/py/mpz.c index 8b8541c737..05827d1045 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -443,12 +443,11 @@ STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t * *id++ = carry; } - ilen = id - oidig; - // check to prevent usb starvation - RUN_BACKGROUND_TASKS; + ilen = id - oidig; + // check to prevent usb starvation + RUN_BACKGROUND_TASKS; } - return ilen; } From 14799f9ee6e634d73463a9ed401b5cc9a3219749 Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 13 Jul 2020 22:43:46 -0500 Subject: [PATCH 187/277] more formatting fix --- py/mpz.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/mpz.c b/py/mpz.c index 05827d1045..4ef00f73c9 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -447,7 +447,7 @@ STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t * // check to prevent usb starvation RUN_BACKGROUND_TASKS; } - + return ilen; } From e5f7adcf5d1257cefd33831d541b829ca8267aca Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 13 Jul 2020 22:54:52 -0500 Subject: [PATCH 188/277] Fix to pass mpy-cross build --- py/mpz.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/mpz.c b/py/mpz.c index 4ef00f73c9..41b46f92ff 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -445,7 +445,9 @@ STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t * ilen = id - oidig; // check to prevent usb starvation + #ifdef RUN_BACKGROUND_TASKS RUN_BACKGROUND_TASKS; + #endif } return ilen; From 818b96ae615b074f77d5069337c790aa1dea8e39 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 14 Jul 2020 16:33:36 -0400 Subject: [PATCH 189/277] Fix IRQ enum protections --- ports/stm/common-hal/pulseio/PulseIn.c | 2 +- ports/stm/peripherals/timers.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index 8b93e52f20..478077eda7 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -133,7 +133,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu self->last_count = 0; self->last_overflow = 0; - if (HAL_TIM_Base_GetState(&tim_handle) == HAL_TIM_STATE_RESET) { + if (HAL_TIM_Base_GetState(&tim_handle) == HAL_TIM_STATE_RESET) { //TODO: there's no state yet // Find a suitable timer TIM_TypeDef * tim_instance = stm_peripherals_find_timer(); stm_peripherals_timer_reserve(tim_instance); diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index 1bcee36455..54b1fd18ab 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -67,7 +67,11 @@ static size_t irq_map[] = { NULL_IRQ, #endif #ifdef TIM6 - TIM6_DAC_IRQn, + #if !defined(DAC_BASE) || !defined(DAC1_BASE) + TIM6_IRQn, + #else + TIM6_DAC_IRQn, + #endif #else NULL_IRQ, #endif From 51b9a1aeca51c34e0894a08f88888eb4173af32a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 13 Jul 2020 10:32:52 -0500 Subject: [PATCH 190/277] tick.c: adjust whitespace --- supervisor/shared/tick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index dd7dba8f3e..01a554e156 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -104,13 +104,13 @@ void mp_hal_delay_ms(mp_uint_t delay) { // Check to see if we've been CTRL-Ced by autoreload or the user. if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))) { - // clear exception and generate stacktrace + // clear exception and generate stacktrace MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL; nlr_raise(&MP_STATE_VM(mp_kbd_exception)); } if( MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) || WATCHDOG_EXCEPTION_CHECK()) { - // stop sleeping immediately + // stop sleeping immediately break; } remaining = end_tick - port_get_raw_ticks(NULL); From dc74ae83da6f519a36d75388b5be9923a10bf063 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 14 Jul 2020 17:34:45 -0500 Subject: [PATCH 191/277] nRF: Always use sd_nvic_critical_region calls The motivation for doing this is so that we can allow common_hal_mcu_disable_interrupts in IRQ context, something that works on other ports, but not on nRF with SD enabled. This is because when SD is enabled, calling sd_softdevice_is_enabled in the context of an interrupt with priority 2 or 3 causes a HardFault. We have chosen to give the USB interrupt priority 2 on nRF, the highest priority that is compatible with SD. Since at least SoftDevice s130 v2.0.1, sd_nvic_critical_region_enter/exit have been implemented as inline functions and are safe to call even if softdevice is not enabled. Reference kindly provided by danh: https://devzone.nordicsemi.com/f/nordic-q-a/29553/sd_nvic_critical_region_enter-exit-missing-in-s130-v2 Switching to these as the default/only way to enable/disable interrupts simplifies things, and fixes several problems and potential problems: * Interrupts at priority 2 or 3 could not call common_hal_mcu_disable_interrupts because the call to sd_softdevice_is_enabled would HardFault * Hypothetically, the state of sd_softdevice_is_enabled could change from the disable to the enable call, meaning the calls would not match (__disable_irq() could be balanced with sd_nvic_critical_region_exit). This also fixes a problem I believe would exist if disable() were called twice when SD is enabled. There is a single "is_nested_critical_region" flag, and the second call would set it to 1. Both of the enable() calls that followed would call critical_region_exit(1), and interrupts would not properly be reenabled. In the new version of the code, we use our own nesting_count value to track the intended state, so now nested disable()s only call critical_region_enter() once, only updating is_nested_critical_region once; and only the second enable() call will call critical_region_exit, with the right value of i_n_c_r. Finally, in port_sleep_until_interrupt, if !sd_enabled, we really do need to __disable_irq, rather than using the common_hal_mcu routines; the reason why is documented in a comment. --- .../nrf/common-hal/microcontroller/__init__.c | 44 +++++++++---------- ports/nrf/supervisor/port.c | 13 +++++- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index f5caf68ef8..06aac9409d 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -50,36 +50,34 @@ void common_hal_mcu_delay_us(uint32_t delay) { static volatile uint32_t nesting_count = 0; static uint8_t is_nested_critical_region; -static uint8_t sd_is_enabled = false; void common_hal_mcu_disable_interrupts() { - sd_softdevice_is_enabled(&sd_is_enabled); - if (sd_is_enabled) { + if (nesting_count == 0) { + // Unlike __disable_irq(), this should only be called the first time + // "is_nested_critical_region" is sd's equivalent of our nesting count + // so a nested call would store 0 in the global and make the later + // exit call not actually reenable interrupts + // + // This only disables interrupts of priority 2 through 7; levels 0, 1, + // and 4, are exclusive to softdevice and should never be used, so + // this limitation is not important. sd_nvic_critical_region_enter(&is_nested_critical_region); - } else { - __disable_irq(); - __DMB(); - nesting_count++; } + __DMB(); + nesting_count++; } void common_hal_mcu_enable_interrupts() { - // Don't check here if SD is enabled, because we'll crash if interrupts - // were turned off and sd_softdevice_is_enabled is called. - if (sd_is_enabled) { - sd_nvic_critical_region_exit(is_nested_critical_region); - } else { - if (nesting_count == 0) { - // This is very very bad because it means there was mismatched disable/enables so we - // crash. - reset_into_safe_mode(HARD_CRASH); - } - nesting_count--; - if (nesting_count > 0) { - return; - } - __DMB(); - __enable_irq(); + if (nesting_count == 0) { + // This is very very bad because it means there was mismatched disable/enables so we + // crash. + reset_into_safe_mode(HARD_CRASH); } + nesting_count--; + if (nesting_count > 0) { + return; + } + __DMB(); + sd_nvic_critical_region_exit(is_nested_critical_region); } void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index aee2d63e1d..e681e6825f 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -313,12 +313,21 @@ void port_sleep_until_interrupt(void) { // instruction will returned as long as an interrupt is // available, even though the actual handler won't fire until // we re-enable interrupts. - common_hal_mcu_disable_interrupts(); + // + // We do not use common_hal_mcu_disable_interrupts here because + // we truly require that interrupts be disabled, while + // common_hal_mcu_disable_interrupts actually just masks the + // interrupts that are not required to allow the softdevice to + // function (whether or not SD is enabled) + int nested = __get_PRIMASK(); + __disable_irq(); if (!tud_task_event_ready()) { __DSB(); __WFI(); } - common_hal_mcu_enable_interrupts(); + if (!nested) { + __enable_irq(); + } } } From 1474fccd2fb1cf6ccd14979a3b5405d2a355054b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 11 May 2020 08:37:20 -0500 Subject: [PATCH 192/277] supervisor: Add a linked list of background callbacks In time, we should transition interrupt driven background tasks out of the overall run_background_tasks into distinct background callbacks, so that the number of checks that occur with each tick is reduced. --- main.c | 3 + supervisor/background_callback.h | 82 +++++++++++++++++++ supervisor/shared/background_callback.c | 104 ++++++++++++++++++++++++ supervisor/shared/tick.c | 6 +- supervisor/supervisor.mk | 1 + 5 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 supervisor/background_callback.h create mode 100644 supervisor/shared/background_callback.c diff --git a/main.c b/main.c index c3787122d3..201022f1af 100755 --- a/main.c +++ b/main.c @@ -45,6 +45,7 @@ #include "background.h" #include "mpconfigboard.h" +#include "supervisor/background_callback.h" #include "supervisor/cpu.h" #include "supervisor/memory.h" #include "supervisor/port.h" @@ -161,6 +162,8 @@ void stop_mp(void) { MP_STATE_VM(vfs_cur) = vfs; #endif + background_callback_reset(); + gc_deinit(); } diff --git a/supervisor/background_callback.h b/supervisor/background_callback.h new file mode 100644 index 0000000000..82025f6b7a --- /dev/null +++ b/supervisor/background_callback.h @@ -0,0 +1,82 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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. + */ + +#ifndef CIRCUITPY_INCLUDED_SUPERVISOR_BACKGROUND_CALLBACK_H +#define CIRCUITPY_INCLUDED_SUPERVISOR_BACKGROUND_CALLBACK_H + +/** Background callbacks are a linked list of tasks to call in the background. + * + * Include a member of type `background_callback_t` inside an object + * which needs to queue up background work, and zero-initialize it. + * + * To schedule the work, use background_callback_add, with fun as the + * function to call and data pointing to the object itself. + * + * Next time run_background_tasks_if_tick is called, the callback will + * be run and removed from the linked list. + * + * Queueing a task that is already queued does nothing. Unconditionally + * re-queueing it from its own background task will cause it to run during the + * very next background-tasks invocation, leading to a CircuitPython freeze, so + * don't do that. + * + * background_callback_add can be called from interrupt context. + */ +typedef void (*background_callback_fun)(void *data); +typedef struct background_callback { + background_callback_fun fun; + void *data; + struct background_callback *next; + struct background_callback *prev; +} background_callback_t; + +/* Add a background callback for which 'fun' and 'data' were previously set */ +void background_callback_add_core(background_callback_t *cb); + +/* Add a background callback to the given function with the given data. When + * the callback involves an object on the GC heap, the 'data' must be a pointer + * to that object itself, not an internal pointer. Otherwise, it can be the + * case that no other references to the object itself survive, and the object + * becomes garbage collected while an outstanding background callback still + * exists. + */ +void background_callback_add(background_callback_t *cb, background_callback_fun fun, void *data); + +/* Run all background callbacks. Normally, this is done by the supervisor + * whenever the list is non-empty */ +void background_callback_run_all(void); + +/* During soft reset, remove all pending callbacks and clear the critical section flag */ +void background_callback_reset(void); + +/* Sometimes background callbacks must be blocked. Use these functions to + * bracket the section of code where this is the case. These calls nest, and + * begins must be balanced with ends. + */ +void background_callback_begin_critical_section(void); +void background_callback_end_critical_section(void); + +#endif diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c new file mode 100644 index 0000000000..99607b7a85 --- /dev/null +++ b/supervisor/shared/background_callback.c @@ -0,0 +1,104 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 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/mpconfig.h" +#include "supervisor/background_callback.h" +#include "supervisor/shared/tick.h" +#include "shared-bindings/microcontroller/__init__.h" + +STATIC volatile background_callback_t *callback_head, *callback_tail; + +#define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts()) +#define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts()) + +void background_callback_add_core(background_callback_t *cb) { + CALLBACK_CRITICAL_BEGIN; + if (cb->prev || callback_head == cb) { + CALLBACK_CRITICAL_END; + return; + } + cb->next = 0; + cb->prev = (background_callback_t*)callback_tail; + if (callback_tail) { + callback_tail->next = cb; + cb->prev = (background_callback_t*)callback_tail; + } + if (!callback_head) { + callback_head = cb; + } + callback_tail = cb; + CALLBACK_CRITICAL_END; +} + +void background_callback_add(background_callback_t *cb, background_callback_fun fun, void *data) { + cb->fun = fun; + cb->data = data; + background_callback_add_core(cb); +} + +static bool in_background_callback; +void background_callback_run_all() { + CALLBACK_CRITICAL_BEGIN; + if(in_background_callback) { + CALLBACK_CRITICAL_END; + return; + } + in_background_callback = true; + background_callback_t *cb = (background_callback_t*)callback_head; + callback_head = NULL; + callback_tail = NULL; + while (cb) { + background_callback_t *next = cb->next; + cb->next = cb->prev = NULL; + background_callback_fun fun = cb->fun; + void *data = cb->data; + CALLBACK_CRITICAL_END; + // Leave the critical section in order to run the callback function + if (fun) { + fun(data); + } + CALLBACK_CRITICAL_BEGIN; + cb = next; + } + in_background_callback = false; + CALLBACK_CRITICAL_END; +} + +void background_callback_begin_critical_section() { + CALLBACK_CRITICAL_BEGIN; +} + +void background_callback_end_critical_section() { + CALLBACK_CRITICAL_END; +} + +void background_callback_reset() { + CALLBACK_CRITICAL_BEGIN; + callback_head = NULL; + callback_tail = NULL; + in_background_callback = false; + CALLBACK_CRITICAL_END; +} diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 01a554e156..7a2f313eb8 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -29,6 +29,7 @@ #include "py/mpstate.h" #include "supervisor/linker.h" #include "supervisor/filesystem.h" +#include "supervisor/background_callback.h" #include "supervisor/port.h" #include "supervisor/shared/autoreload.h" @@ -86,10 +87,7 @@ uint32_t supervisor_ticks_ms32() { extern void run_background_tasks(void); void PLACE_IN_ITCM(supervisor_run_background_tasks_if_tick)() { - // TODO: Add a global that can be set by anyone to indicate we should run background tasks. That - // way we can short circuit the background tasks early. We used to do it based on time but it - // breaks cases where we wake up for a short period and then sleep. If we skipped the last - // background task or more before sleeping we may end up starving a task like USB. + background_callback_run_all(); run_background_tasks(); } diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 21803ae0a3..1885366865 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -2,6 +2,7 @@ SRC_SUPERVISOR = \ main.c \ supervisor/port.c \ supervisor/shared/autoreload.c \ + supervisor/shared/background_callback.c \ supervisor/shared/board.c \ supervisor/shared/filesystem.c \ supervisor/shared/flash.c \ From 8c4a9f644407ee6fccf3720fd3b727085a2ff109 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 9 Jul 2020 09:47:10 -0500 Subject: [PATCH 193/277] supervisor: tick: only run background tasks once per tick --- supervisor/shared/tick.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 7a2f313eb8..46172d0f30 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -52,6 +52,14 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); #define WATCHDOG_EXCEPTION_CHECK() 0 #endif +static background_callback_t callback; + +extern void run_background_tasks(void); + +void background_task_tick(void *unused) { + run_background_tasks(); +} + void supervisor_tick(void) { #if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0 filesystem_tick(); @@ -69,6 +77,7 @@ void supervisor_tick(void) { #endif } #endif + background_callback_add(&callback, background_task_tick, NULL); } uint64_t supervisor_ticks_ms64() { @@ -84,11 +93,9 @@ uint32_t supervisor_ticks_ms32() { return supervisor_ticks_ms64(); } -extern void run_background_tasks(void); void PLACE_IN_ITCM(supervisor_run_background_tasks_if_tick)() { background_callback_run_all(); - run_background_tasks(); } void mp_hal_delay_ms(mp_uint_t delay) { From 742aa740f651c72a5991250d9ac898492e99389d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 7 Jul 2020 10:11:29 -0500 Subject: [PATCH 194/277] samd: audio: Move to background callback Testing performed: Played half of the Bartlebeats album :) :) --- ports/atmel-samd/audio_dma.c | 54 +++++++++++++++++++++++------------ ports/atmel-samd/audio_dma.h | 2 ++ ports/atmel-samd/background.c | 3 -- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/ports/atmel-samd/audio_dma.c b/ports/atmel-samd/audio_dma.c index 93cd96b985..c6c636160d 100644 --- a/ports/atmel-samd/audio_dma.c +++ b/ports/atmel-samd/audio_dma.c @@ -31,7 +31,7 @@ #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/audiocore/WaveFile.h" -#include "supervisor/shared/tick.h" +#include "supervisor/background_callback.h" #include "py/mpstate.h" #include "py/runtime.h" @@ -61,7 +61,6 @@ void audio_dma_free_channel(uint8_t channel) { assert(audio_dma_allocated[channel]); audio_dma_disable_channel(channel); audio_dma_allocated[channel] = false; - supervisor_disable_tick(); } void audio_dma_disable_channel(uint8_t channel) { @@ -73,7 +72,6 @@ void audio_dma_disable_channel(uint8_t channel) { void audio_dma_enable_channel(uint8_t channel) { if (channel >= AUDIO_DMA_CHANNEL_COUNT) return; - supervisor_enable_tick(); dma_enable_channel(channel); } @@ -259,6 +257,15 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, dma->beat_size *= 2; } +#ifdef SAM_D5X_E5X + int irq = dma->event_channel < 4 ? EVSYS_0_IRQn + dma->event_channel : EVSYS_4_IRQn; +#else + int irq = EVSYS_IRQn; +#endif + + NVIC_DisableIRQ(irq); + NVIC_ClearPendingIRQ(irq); + DmacDescriptor* first_descriptor = dma_descriptor(dma_channel); setup_audio_descriptor(first_descriptor, dma->beat_size, output_spacing, output_register_address); if (single_buffer) { @@ -281,6 +288,8 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, dma_configure(dma_channel, dma_trigger_source, true); audio_dma_enable_channel(dma_channel); + NVIC_EnableIRQ(irq); + return AUDIO_DMA_OK; } @@ -321,9 +330,6 @@ void audio_dma_reset(void) { for (uint8_t i = 0; i < AUDIO_DMA_CHANNEL_COUNT; i++) { audio_dma_state[i] = NULL; audio_dma_pending[i] = false; - if (audio_dma_allocated[i]) { - supervisor_disable_tick(); - } audio_dma_allocated[i] = false; audio_dma_disable_channel(i); dma_descriptor(i)->BTCTRL.bit.VALID = false; @@ -343,29 +349,39 @@ bool audio_dma_get_playing(audio_dma_t* dma) { return (status & DMAC_CHINTFLAG_TERR) == 0; } -// WARN(tannewt): DO NOT print from here. Printing calls background tasks such as this and causes a -// stack overflow. +// WARN(tannewt): DO NOT print from here, or anything it calls. Printing calls +// background tasks such as this and causes a stack overflow. +STATIC void dma_callback_fun(void *arg) { + audio_dma_t* dma = arg; + if (dma == NULL) { + return; + } -void audio_dma_background(void) { + audio_dma_load_next_block(dma); +} + +void evsyshandler_common(void) { for (uint8_t i = 0; i < AUDIO_DMA_CHANNEL_COUNT; i++) { - if (audio_dma_pending[i]) { - continue; - } audio_dma_t* dma = audio_dma_state[i]; if (dma == NULL) { continue; } - bool block_done = event_interrupt_active(dma->event_channel); if (!block_done) { continue; } - - // audio_dma_load_next_block() can call Python code, which can call audio_dma_background() - // recursively at the next background processing time. So disallow recursive calls to here. - audio_dma_pending[i] = true; - audio_dma_load_next_block(dma); - audio_dma_pending[i] = false; + background_callback_add(&dma->callback, dma_callback_fun, (void*)dma); } } + +#ifdef SAM_D5X_E5X +void EVSYS_0_Handler(void) { evsyshandler_common(); } +void EVSYS_1_Handler(void) { evsyshandler_common(); } +void EVSYS_2_Handler(void) { evsyshandler_common(); } +void EVSYS_3_Handler(void) { evsyshandler_common(); } +void EVSYS_4_Handler(void) { evsyshandler_common(); } +#else +void EVSYS_Handler(void) { evsyshandler_common(); } +#endif + #endif diff --git a/ports/atmel-samd/audio_dma.h b/ports/atmel-samd/audio_dma.h index 1ebec6f7e9..4fffd06b8f 100644 --- a/ports/atmel-samd/audio_dma.h +++ b/ports/atmel-samd/audio_dma.h @@ -31,6 +31,7 @@ #include "py/obj.h" #include "shared-module/audiocore/RawSample.h" #include "shared-module/audiocore/WaveFile.h" +#include "supervisor/background_callback.h" typedef struct { mp_obj_t sample; @@ -49,6 +50,7 @@ typedef struct { uint8_t* second_buffer; bool first_descriptor_free; DmacDescriptor* second_descriptor; + background_callback_t callback; } audio_dma_t; typedef enum { diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index 767c7f3b6b..b903456ee8 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -77,9 +77,6 @@ void run_background_tasks(void) { assert_heap_ok(); running_background_tasks = true; - #if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO - audio_dma_background(); - #endif #if CIRCUITPY_DISPLAYIO displayio_background(); #endif From bdab6c12d4332523fdbd8967c1233b3708f4883e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 11 May 2020 08:51:41 -0500 Subject: [PATCH 195/277] MP3Decoder: take advantage of background callback Before this, the mp3 file would be read into the in-memory buffer only when new samples were actually needed. This meant that the time to read mp3 content always counted against the ~22ms audio buffer length. Now, when there's at least 1 full disk block of free space in the input buffer, we can request that the buffer be filled _after_ returning from audiomp3_mp3file_get_buffer and actually filling the DMA pointers. In this way, the time taken for reading MP3 data from flash/SD is less likely to cause an underrun of audio DMA. The existing calls to fill the inbuf remain, but in most cases during streaming these become no-ops because the buffer will be over half full. --- shared-module/audiomp3/MP3Decoder.c | 54 +++++++++++++++++++++++------ shared-module/audiomp3/MP3Decoder.h | 2 ++ 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index 30357c6161..5f3f42a51b 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -36,11 +36,12 @@ #include "shared-module/audiomp3/MP3Decoder.h" #include "supervisor/shared/translate.h" +#include "supervisor/background_callback.h" #include "lib/mp3/src/mp3common.h" #define MAX_BUFFER_LEN (MAX_NSAMP * MAX_NGRAN * MAX_NCHAN * sizeof(int16_t)) -/** Fill the input buffer if it is less than half full. +/** Fill the input buffer unconditionally. * * Returns true if the input buffer contains any useful data, * false otherwise. (The input buffer will be padded to the end with @@ -50,10 +51,7 @@ * * Sets self->eof if any read of the file returns 0 bytes */ -STATIC bool mp3file_update_inbuf(audiomp3_mp3file_obj_t* self) { - // If buffer is over half full, do nothing - if (self->inbuf_offset < self->inbuf_length/2) return true; - +STATIC bool mp3file_update_inbuf_always(audiomp3_mp3file_obj_t* self) { // If we didn't previously reach the end of file, we can try reading now if (!self->eof) { @@ -87,6 +85,26 @@ STATIC bool mp3file_update_inbuf(audiomp3_mp3file_obj_t* self) { return self->inbuf_offset < self->inbuf_length; } +/** Update the inbuf from a background callback. + * + * This variant is introduced so that at the site of the + * add_background_callback_core call, the prototype matches. + */ +STATIC void mp3file_update_inbuf_cb(void* self) { + mp3file_update_inbuf_always(self); +} + +/** Fill the input buffer if it is less than half full. + * + * Returns the same as mp3file_update_inbuf_always. + */ +STATIC bool mp3file_update_inbuf_half(audiomp3_mp3file_obj_t* self) { + // If buffer is over half full, do nothing + if (self->inbuf_offset < self->inbuf_length/2) return true; + + return mp3file_update_inbuf_always(self); +} + #define READ_PTR(self) (self->inbuf + self->inbuf_offset) #define BYTES_LEFT(self) (self->inbuf_length - self->inbuf_offset) #define CONSUME(self, n) (self->inbuf_offset += n) @@ -94,7 +112,7 @@ STATIC bool mp3file_update_inbuf(audiomp3_mp3file_obj_t* self) { // http://id3.org/d3v2.3.0 // http://id3.org/id3v2.3.0 STATIC void mp3file_skip_id3v2(audiomp3_mp3file_obj_t* self) { - mp3file_update_inbuf(self); + mp3file_update_inbuf_half(self); if (BYTES_LEFT(self) < 10) { return; } @@ -129,11 +147,11 @@ STATIC void mp3file_skip_id3v2(audiomp3_mp3file_obj_t* self) { */ STATIC bool mp3file_find_sync_word(audiomp3_mp3file_obj_t* self) { do { - mp3file_update_inbuf(self); + mp3file_update_inbuf_half(self); int offset = MP3FindSyncWord(READ_PTR(self), BYTES_LEFT(self)); if (offset >= 0) { CONSUME(self, offset); - mp3file_update_inbuf(self); + mp3file_update_inbuf_half(self); return true; } CONSUME(self, MAX(0, BYTES_LEFT(self) - 16)); @@ -209,12 +227,14 @@ void common_hal_audiomp3_mp3file_construct(audiomp3_mp3file_obj_t* self, } void common_hal_audiomp3_mp3file_set_file(audiomp3_mp3file_obj_t* self, pyb_file_obj_t* file) { + background_callback_begin_critical_section(); + self->file = file; f_lseek(&self->file->fp, 0); self->inbuf_offset = self->inbuf_length; self->eof = 0; self->other_channel = -1; - mp3file_update_inbuf(self); + mp3file_update_inbuf_half(self); mp3file_find_sync_word(self); // It **SHOULD** not be necessary to do this; the buffer should be filled // with fresh content before it is returned by get_buffer(). The fact that @@ -224,7 +244,9 @@ void common_hal_audiomp3_mp3file_set_file(audiomp3_mp3file_obj_t* self, pyb_file memset(self->buffers[0], 0, MAX_BUFFER_LEN); memset(self->buffers[1], 0, MAX_BUFFER_LEN); MP3FrameInfo fi; - if(!mp3file_get_next_frame_info(self, &fi)) { + bool result = mp3file_get_next_frame_info(self, &fi); + background_callback_end_critical_section(); + if (!result) { mp_raise_msg(&mp_type_RuntimeError, translate("Failed to parse MP3 file")); } @@ -277,13 +299,15 @@ void audiomp3_mp3file_reset_buffer(audiomp3_mp3file_obj_t* self, } // We don't reset the buffer index in case we're looping and we have an odd number of buffer // loads + background_callback_begin_critical_section(); f_lseek(&self->file->fp, 0); self->inbuf_offset = self->inbuf_length; self->eof = 0; self->other_channel = -1; - mp3file_update_inbuf(self); + mp3file_update_inbuf_half(self); mp3file_skip_id3v2(self); mp3file_find_sync_word(self); + background_callback_end_critical_section(); } audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t* self, @@ -321,6 +345,14 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t* uint8_t *inbuf = READ_PTR(self); int err = MP3Decode(self->decoder, &inbuf, &bytes_left, buffer, 0); CONSUME(self, BYTES_LEFT(self) - bytes_left); + + if (self->inbuf_offset >= 512) { + background_callback_add( + &self->inbuf_fill_cb, + mp3file_update_inbuf_cb, + self); + } + if (err) { return GET_BUFFER_DONE; } diff --git a/shared-module/audiomp3/MP3Decoder.h b/shared-module/audiomp3/MP3Decoder.h index 9ee1d0949b..f91f102a27 100644 --- a/shared-module/audiomp3/MP3Decoder.h +++ b/shared-module/audiomp3/MP3Decoder.h @@ -28,6 +28,7 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE_AUDIOIO_MP3FILE_H #define MICROPY_INCLUDED_SHARED_MODULE_AUDIOIO_MP3FILE_H +#include "supervisor/background_callback.h" #include "extmod/vfs_fat.h" #include "py/obj.h" @@ -36,6 +37,7 @@ typedef struct { mp_obj_base_t base; struct _MP3DecInfo *decoder; + background_callback_t inbuf_fill_cb; uint8_t* inbuf; uint32_t inbuf_length; uint32_t inbuf_offset; From af520729fe9d941c293942730f520b50ec1daf52 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 8 Jul 2020 10:32:06 -0500 Subject: [PATCH 196/277] displayio, framebufferio: Enable supervisor tick when a display is auto-refresh This is a step towards restoring the efficiency of the background tasks --- shared-module/displayio/Display.c | 12 ++++++++++-- shared-module/displayio/EPaperDisplay.c | 4 ++++ shared-module/framebufferio/FramebufferDisplay.c | 12 ++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index a3d877f1a9..46bb6fdb57 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -137,7 +137,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, // Set the group after initialization otherwise we may send pixels while we delay in // initialization. common_hal_displayio_display_show(self, &circuitpython_splash); - self->auto_refresh = auto_refresh; + common_hal_displayio_display_set_auto_refresh(self, auto_refresh); } bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group) { @@ -383,6 +383,13 @@ bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t* self, bool auto_refresh) { self->first_manual_refresh = !auto_refresh; + if (auto_refresh != self->auto_refresh) { + if (auto_refresh) { + supervisor_enable_tick(); + } else { + supervisor_disable_tick(); + } + } self->auto_refresh = auto_refresh; } @@ -409,6 +416,7 @@ void displayio_display_background(displayio_display_obj_t* self) { } void release_display(displayio_display_obj_t* self) { + common_hal_displayio_display_set_auto_refresh(self, false); release_display_core(&self->core); #if (CIRCUITPY_PULSEIO) if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { @@ -423,7 +431,7 @@ void release_display(displayio_display_obj_t* self) { } void reset_display(displayio_display_obj_t* self) { - self->auto_refresh = true; + common_hal_displayio_display_set_auto_refresh(self, true); self->auto_brightness = true; common_hal_displayio_display_show(self, NULL); } diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 6a55687b9c..6d9e915b44 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -187,6 +187,7 @@ void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) displayio_display_core_begin_transaction(&self->core); self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, &self->refresh_display_command, 1); displayio_display_core_end_transaction(&self->core); + supervisor_enable_tick(); self->refreshing = true; displayio_display_core_finish_refresh(&self->core); @@ -301,6 +302,7 @@ bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* s if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { + supervisor_disable_tick(); self->refreshing = false; // Run stop sequence but don't wait for busy because busy is set when sleeping. send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); @@ -342,6 +344,7 @@ void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { refresh_done = supervisor_ticks_ms64() - self->core.last_refresh > self->refresh_time; } if (refresh_done) { + supervisor_disable_tick(); self->refreshing = false; // Run stop sequence but don't wait for busy because busy is set when sleeping. send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); @@ -352,6 +355,7 @@ void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { if (self->refreshing) { wait_for_busy(self); + supervisor_disable_tick(); self->refreshing = false; // Run stop sequence but don't wait for busy because busy is set when sleeping. send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c index f296da4095..7d09e0baeb 100644 --- a/shared-module/framebufferio/FramebufferDisplay.c +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -79,7 +79,7 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu // Set the group after initialization otherwise we may send pixels while we delay in // initialization. common_hal_framebufferio_framebufferdisplay_show(self, &circuitpython_splash); - self->auto_refresh = auto_refresh; + common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, auto_refresh); } bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t* self, displayio_group_t* root_group) { @@ -280,6 +280,13 @@ bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_ void common_hal_framebufferio_framebufferdisplay_set_auto_refresh(framebufferio_framebufferdisplay_obj_t* self, bool auto_refresh) { self->first_manual_refresh = !auto_refresh; + if (auto_refresh != self->auto_refresh) { + if (auto_refresh) { + supervisor_enable_tick(); + } else { + supervisor_disable_tick(); + } + } self->auto_refresh = auto_refresh; } @@ -297,12 +304,13 @@ void framebufferio_framebufferdisplay_background(framebufferio_framebufferdispla } void release_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self) { + common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, false); release_display_core(&self->core); self->framebuffer_protocol->deinit(self->framebuffer); } void reset_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self) { - self->auto_refresh = true; + common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, true); common_hal_framebufferio_framebufferdisplay_show(self, NULL); } From 36b46465167f15eaf8535608b16859e6de10fac8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 10 Jul 2020 14:42:21 -0500 Subject: [PATCH 197/277] background_callback: Avoid CALLBACK_CRITICAL_BEGIN with nothing to do CALLBACK_CRITICAL_BEGIN is heavyweight, but we can be confident we do not have work to do as long as callback_head is NULL. This gives back performance on nRF. --- supervisor/shared/background_callback.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 99607b7a85..e45c9b5c3d 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -61,8 +61,11 @@ void background_callback_add(background_callback_t *cb, background_callback_fun static bool in_background_callback; void background_callback_run_all() { + if (!callback_head) { + return; + } CALLBACK_CRITICAL_BEGIN; - if(in_background_callback) { + if (in_background_callback) { CALLBACK_CRITICAL_END; return; } From 910f69c42b1852bcbde4c4fb24ea50939ec25fac Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 15 Jul 2020 10:12:27 -0500 Subject: [PATCH 198/277] esp32s2: Take care to invoke the sub-build-system only once This allows "make -j" in the outer build system to function properly, with a potentially large decrease in build times on high end desktop systems. --- ports/esp32s2/Makefile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index b296976885..29abcab8e3 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -217,8 +217,8 @@ $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig | $(BUILD)/esp-id # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info -$(BUILD)/esp-idf/esp-idf/%.a: $(BUILD)/esp-idf/config/sdkconfig.h - ninja -C $(BUILD)/esp-idf esp-idf/$*.a +#$(BUILD)/esp-idf/esp-idf/%.a: $(BUILD)/esp-idf/config/sdkconfig.h +# ninja -C $(BUILD)/esp-idf esp-idf/$*.a $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld: $(BUILD)/esp-idf/config/sdkconfig.h ninja -C $(BUILD)/esp-idf esp-idf/esp32s2/esp32s2_out.ld @@ -230,9 +230,6 @@ $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld: $(BUILD)/esp-idf/config/ $(BUILD)/esp-idf/partition_table/partition-table.bin: $(BUILD)/esp-idf/config/sdkconfig.h IDF_PATH=$(IDF_PATH) ninja -C $(BUILD)/esp-idf partition_table/partition-table.bin -$(BUILD)/esp-idf/bootloader/bootloader.bin: $(BUILD)/esp-idf/config/sdkconfig.h - ninja -C $(BUILD)/esp-idf bootloader/bootloader.bin - # run menuconfig menuconfig: $(BUILD)/esp-idf/config ninja -C $(BUILD)/esp-idf menuconfig @@ -260,7 +257,18 @@ FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 -$(BUILD)/firmware.elf: $(OBJ) | $(ESP_IDF_COMPONENTS_EXPANDED) $(ESP_AUTOGEN_LD) +.PHONY: esp-idf-stamp +esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h + ninja -C $(BUILD)/esp-idf \ + bootloader/bootloader.bin \ + esp-idf/bootloader_support/libbootloader_support.a \ + esp-idf/esp32s2/ld/esp32s2.project.ld \ + esp-idf/esp_system/libesp_system.a \ + esp-idf/freertos/libfreertos.a \ + esp-idf/log/liblog.a \ + esp-idf/xtensa/libxtensa.a + +$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -u newlib_include_pthread_impl # $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld @@ -271,7 +279,7 @@ $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf # $(Q)$(OBJCOPY) -O binary $^ $@ # $(Q)$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@ -$(BUILD)/firmware.bin: $(BUILD)/esp-idf/partition_table/partition-table.bin $(BUILD)/esp-idf/bootloader/bootloader.bin $(BUILD)/circuitpython-firmware.bin +$(BUILD)/firmware.bin: $(BUILD)/circuitpython-firmware.bin | esp-idf-stamp $(Q)$(PYTHON) ../../tools/join_bins.py $@ 0x1000 $(BUILD)/esp-idf/bootloader/bootloader.bin 0x8000 $(BUILD)/esp-idf/partition_table/partition-table.bin 0x10000 $(BUILD)/circuitpython-firmware.bin $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin From a2919a6fb2c433cafa5c528ee03ee9c86efb93d8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 15 Jul 2020 11:45:13 -0500 Subject: [PATCH 199/277] esp32s2: Use the device's EUI-48 address as unique ID On my hardware, esptool reports MAC: 7c:df:a1:02:6c:b8 after this change, the USB descriptor says SerialNumber: 7CDFA1026CB8 and microcontroller.cpu.id has >>> "".join("%02x" % byte for byte in microcontroller.cpu.uid) 'c7fd1a20c68b' Note that the nibble-swapping between USB and cpu.uid is typical. For instance, an stm32 board has USB SerialNumber 24002500F005D42445632302 but hex-converted microcontroller.cpu.id 420052000f504d4254363220. --- .../common-hal/microcontroller/Processor.c | 24 ++++++++++++++++++- .../common-hal/microcontroller/Processor.h | 2 +- ports/esp32s2/mpconfigport.mk | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Processor.c b/ports/esp32s2/common-hal/microcontroller/Processor.c index 8eaf1a33d2..39b85a18b8 100644 --- a/ports/esp32s2/common-hal/microcontroller/Processor.c +++ b/ports/esp32s2/common-hal/microcontroller/Processor.c @@ -26,10 +26,14 @@ */ #include +#include + #include "common-hal/microcontroller/Processor.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" +#include "soc/efuse_reg.h" + float common_hal_mcu_processor_get_temperature(void) { return NAN; } @@ -42,5 +46,23 @@ uint32_t common_hal_mcu_processor_get_frequency(void) { return 0; } -void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { +STATIC uint8_t swap_nibbles(uint8_t v) { + return ((v << 4) | (v >> 4)) & 0xff; +} + +void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { + memset(raw_id, 0, COMMON_HAL_MCU_PROCESSOR_UID_LENGTH); + + uint8_t *ptr = &raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH-1]; + // MAC address contains 48 bits (6 bytes), 32 in the low order word + uint32_t mac_address_part = REG_READ(EFUSE_RD_MAC_SPI_SYS_0_REG); + *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; + *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; + *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; + *ptr-- = swap_nibbles(mac_address_part & 0xff); + + // and 16 in the high order word + mac_address_part = REG_READ(EFUSE_RD_MAC_SPI_SYS_1_REG); + *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; + *ptr-- = swap_nibbles(mac_address_part & 0xff); } diff --git a/ports/esp32s2/common-hal/microcontroller/Processor.h b/ports/esp32s2/common-hal/microcontroller/Processor.h index a2ea261c8f..f6636b333c 100644 --- a/ports/esp32s2/common-hal/microcontroller/Processor.h +++ b/ports/esp32s2/common-hal/microcontroller/Processor.h @@ -27,7 +27,7 @@ #ifndef MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H #define MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H -#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 15 +#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 6 #include "py/obj.h" diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 5686579b45..713ccbb094 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -7,7 +7,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz INTERNAL_LIBM = 1 # Chip supplied serial number, in bytes -USB_SERIAL_NUMBER_LENGTH = 30 +USB_SERIAL_NUMBER_LENGTH = 12 # Longints can be implemented as mpz, as longlong, or not LONGINT_IMPL = MPZ From 6160d11c5a04f60e54ce977fd73fafa5ba858aa0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 7 Jul 2020 11:14:43 -0500 Subject: [PATCH 200/277] supervisor: factor out, Handle USB via background callback --- ports/atmel-samd/background.c | 1 - ports/atmel-samd/supervisor/usb.c | 12 +++++++----- ports/litex/mphalport.c | 3 ++- ports/mimxrt10xx/supervisor/usb.c | 3 ++- ports/nrf/background.c | 1 - ports/nrf/supervisor/usb.c | 7 +++++-- ports/stm/supervisor/usb.c | 2 +- supervisor/shared/usb/usb.c | 11 +++++++++++ supervisor/usb.h | 3 +++ 9 files changed, 31 insertions(+), 12 deletions(-) diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index b903456ee8..5c499ab3a8 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -85,7 +85,6 @@ void run_background_tasks(void) { network_module_background(); #endif filesystem_background(); - usb_background(); running_background_tasks = false; assert_heap_ok(); diff --git a/ports/atmel-samd/supervisor/usb.c b/ports/atmel-samd/supervisor/usb.c index 650ed6a397..ea940f8988 100644 --- a/ports/atmel-samd/supervisor/usb.c +++ b/ports/atmel-samd/supervisor/usb.c @@ -29,6 +29,8 @@ #include "hpl/gclk/hpl_gclk_base.h" #include "hal_gpio.h" #include "lib/tinyusb/src/device/usbd.h" +#include "supervisor/background_callback.h" +#include "supervisor/usb.h" void init_usb_hardware(void) { #ifdef SAMD21 @@ -61,24 +63,24 @@ void init_usb_hardware(void) { #ifdef SAMD21 void USB_Handler(void) { - tud_int_handler(0); + usb_irq_handler(); } #endif #ifdef SAM_D5X_E5X void USB_0_Handler (void) { - tud_int_handler(0); + usb_irq_handler(); } void USB_1_Handler (void) { - tud_int_handler(0); + usb_irq_handler(); } void USB_2_Handler (void) { - tud_int_handler(0); + usb_irq_handler(); } void USB_3_Handler (void) { - tud_int_handler(0); + usb_irq_handler(); } #endif diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c index 84a5467951..862f163939 100644 --- a/ports/litex/mphalport.c +++ b/ports/litex/mphalport.c @@ -31,6 +31,7 @@ #include "py/mphal.h" #include "py/mpstate.h" #include "py/gc.h" +#include "supervisor/usb.h" #include "csr.h" #include "generated/soc.h" @@ -49,7 +50,7 @@ void isr(void) { #ifdef CFG_TUSB_MCU if (irqs & (1 << USB_INTERRUPT)) - tud_int_handler(0); + usb_irq_handler(); #endif if (irqs & (1 << TIMER0_INTERRUPT)) SysTick_Handler(); diff --git a/ports/mimxrt10xx/supervisor/usb.c b/ports/mimxrt10xx/supervisor/usb.c index 1bc7ea9b56..af259405a3 100644 --- a/ports/mimxrt10xx/supervisor/usb.c +++ b/ports/mimxrt10xx/supervisor/usb.c @@ -27,6 +27,7 @@ #include "fsl_clock.h" #include "tusb.h" +#include "supervisor/usb.h" void init_usb_hardware(void) { CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U); @@ -56,5 +57,5 @@ void init_usb_hardware(void) { } void USB_OTG1_IRQHandler(void) { - tud_int_handler(0); + usb_irq_handler(); } diff --git a/ports/nrf/background.c b/ports/nrf/background.c index 966c56e0b7..bc7c0d7d32 100644 --- a/ports/nrf/background.c +++ b/ports/nrf/background.c @@ -59,7 +59,6 @@ void run_background_tasks(void) { } running_background_tasks = true; filesystem_background(); - usb_background(); #if CIRCUITPY_AUDIOPWMIO audiopwmout_background(); #endif diff --git a/ports/nrf/supervisor/usb.c b/ports/nrf/supervisor/usb.c index 3d2527faaa..771e86ce03 100644 --- a/ports/nrf/supervisor/usb.c +++ b/ports/nrf/supervisor/usb.c @@ -30,6 +30,7 @@ #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" #include "lib/tinyusb/src/device/usbd.h" +#include "supervisor/background_callback.h" #ifdef SOFTDEVICE_PRESENT #include "nrf_sdm.h" @@ -42,7 +43,9 @@ extern void tusb_hal_nrf_power_event(uint32_t event); void init_usb_hardware(void) { - // 2 is max priority (0, 1 are reserved for SD) + // 2 is max priority (0, 1, and 4 are reserved for SD) + // 5 is max priority that still allows calling SD functions such as + // sd_softdevice_is_enabled NVIC_SetPriority(USBD_IRQn, 2); // USB power may already be ready at this time -> no event generated @@ -89,5 +92,5 @@ void init_usb_hardware(void) { } void USBD_IRQHandler(void) { - tud_int_handler(0); + usb_irq_handler(); } diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index 3dd0acafd0..3d53fa3749 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -130,5 +130,5 @@ void init_usb_hardware(void) { } void OTG_FS_IRQHandler(void) { - tud_int_handler(0); + usb_irq_handler(); } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index edf8101188..472be96d52 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -27,6 +27,7 @@ #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/usb.h" #include "lib/utils/interrupt_char.h" @@ -82,6 +83,16 @@ void usb_background(void) { } } +static background_callback_t callback; +static void usb_background_do(void* unused) { + usb_background(); +} + +void usb_irq_handler(void) { + tud_int_handler(0); + background_callback_add(&callback, usb_background_do, NULL); +} + //--------------------------------------------------------------------+ // tinyusb callbacks //--------------------------------------------------------------------+ diff --git a/supervisor/usb.h b/supervisor/usb.h index 29280c725b..1bed9bbb4b 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -33,6 +33,9 @@ // alive and responsive. void usb_background(void); +// Ports must call this from their particular USB IRQ handler +void usb_irq_handler(void); + // Only inits the USB peripheral clocks and pins. The peripheral will be initialized by // TinyUSB. void init_usb_hardware(void); From 1df48176ce2e4111c4629269cb86d2a6e365a3d2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 13 Jul 2020 10:33:58 -0500 Subject: [PATCH 201/277] supervisor: factor supervisor_background_tasks from sundry ports --- main.c | 2 - ports/atmel-samd/background.c | 48 ++--------------- ports/atmel-samd/background.h | 5 -- .../common-hal/frequencyio/FrequencyIn.c | 3 +- ports/atmel-samd/common-hal/pulseio/PulseIn.c | 3 +- ports/cxd56/background.c | 24 ++------- ports/cxd56/background.h | 3 -- ports/esp32s2/background.c | 25 ++------- ports/esp32s2/background.h | 3 -- ports/litex/background.c | 32 ++--------- ports/litex/background.h | 5 -- ports/mimxrt10xx/background.c | 53 ++----------------- ports/mimxrt10xx/background.h | 7 --- ports/mimxrt10xx/common-hal/pulseio/PulseIn.c | 2 +- ports/nrf/background.c | 27 ++-------- ports/nrf/background.h | 5 -- ports/stm/background.c | 28 ++-------- ports/stm/background.h | 5 -- supervisor/port.h | 8 +++ supervisor/shared/tick.c | 52 ++++++++++++++++-- supervisor/shared/tick.h | 16 +++--- 21 files changed, 95 insertions(+), 261 deletions(-) diff --git a/main.c b/main.c index 201022f1af..ce95de95f0 100755 --- a/main.c +++ b/main.c @@ -101,8 +101,6 @@ void start_mp(supervisor_allocation* heap) { reset_status_led(); autoreload_stop(); - background_tasks_reset(); - // Stack limit should be less than real stack size, so we have a chance // to recover from limit hit. (Limit is measured in bytes.) mp_stack_ctrl_init(); diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index 5c499ab3a8..62c233a3f8 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -39,59 +39,21 @@ #include "shared-module/displayio/__init__.h" #endif -volatile uint64_t last_finished_tick = 0; - -bool stack_ok_so_far = true; - -static bool running_background_tasks = false; - #ifdef MONITOR_BACKGROUND_TASKS // PB03 is physical pin "SCL" on the Metro M4 express // so you can't use this code AND an i2c peripheral // at the same time unless you change this -STATIC void start_background_task(void) { +void port_start_background_task(void) { REG_PORT_DIRSET1 = (1<<3); REG_PORT_OUTSET1 = (1<<3); } -STATIC void finish_background_task(void) { +void port_finish_background_task(void) { REG_PORT_OUTCLR1 = (1<<3); } #else -STATIC void start_background_task(void) {} -STATIC void finish_background_task(void) {} +void port_start_background_task(void) {} +void port_finish_background_task(void) {} #endif -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void run_background_tasks(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } - - start_background_task(); - - assert_heap_ok(); - running_background_tasks = true; - - #if CIRCUITPY_DISPLAYIO - displayio_background(); - #endif - - #if CIRCUITPY_NETWORK - network_module_background(); - #endif - filesystem_background(); - running_background_tasks = false; - assert_heap_ok(); - - last_finished_tick = port_get_raw_ticks(NULL); - finish_background_task(); -} - -bool background_tasks_ok(void) { - return port_get_raw_ticks(NULL) - last_finished_tick < 1024; -} +void port_background_task(void) {} diff --git a/ports/atmel-samd/background.h b/ports/atmel-samd/background.h index d9866a6abc..2a89c3b1b8 100644 --- a/ports/atmel-samd/background.h +++ b/ports/atmel-samd/background.h @@ -29,9 +29,4 @@ #include -void background_tasks_reset(void); -void run_background_tasks(void); -void run_background_vm_tasks(void); -bool background_tasks_ok(void); - #endif // MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H diff --git a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c index 1952df5637..02d0482dca 100644 --- a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +++ b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c @@ -46,6 +46,7 @@ #include "hpl_gclk_config.h" #include "shared-bindings/time/__init__.h" +#include "supervisor/shared/tick.h" #include "supervisor/shared/translate.h" #ifdef SAMD21 @@ -132,7 +133,7 @@ void frequencyin_interrupt_handler(uint8_t index) { } // Check if we've reached the upper limit of detection - if (!background_tasks_ok() || self->errored_too_fast) { + if (!supervisor_background_tasks_ok() || self->errored_too_fast) { self->errored_too_fast = true; frequencyin_emergency_cancel_capture(i); } diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c index b825579dbe..ae58b089de 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c @@ -42,6 +42,7 @@ #include "samd/timers.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/pulseio/PulseIn.h" +#include "supervisor/shared/tick.h" #include "supervisor/shared/translate.h" // This timer is shared amongst all PulseIn objects as a higher resolution clock. @@ -87,7 +88,7 @@ void pulsein_interrupt_handler(uint8_t channel) { uint32_t current_count = tc->COUNT16.COUNT.reg; pulseio_pulsein_obj_t* self = get_eic_channel_data(channel); - if (!background_tasks_ok() || self->errored_too_fast) { + if (!supervisor_background_tasks_ok() || self->errored_too_fast) { self->errored_too_fast = true; common_hal_pulseio_pulsein_pause(self); return; diff --git a/ports/cxd56/background.c b/ports/cxd56/background.c index ade257dd24..6de6d7275b 100644 --- a/ports/cxd56/background.c +++ b/ports/cxd56/background.c @@ -30,24 +30,6 @@ #include "supervisor/filesystem.h" #include "supervisor/shared/stack.h" -static bool running_background_tasks = false; - -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void run_background_tasks(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } - - assert_heap_ok(); - running_background_tasks = true; - - usb_background(); - filesystem_background(); - - running_background_tasks = false; - assert_heap_ok(); -} +void port_background_task(void) {} +void port_start_background_task(void) {} +void port_finish_background_task(void) {} diff --git a/ports/cxd56/background.h b/ports/cxd56/background.h index a38e3faed4..5f76e64429 100644 --- a/ports/cxd56/background.h +++ b/ports/cxd56/background.h @@ -27,7 +27,4 @@ #ifndef MICROPY_INCLUDED_CXD56_BACKGROUND_H #define MICROPY_INCLUDED_CXD56_BACKGROUND_H -void background_tasks_reset(void); -void run_background_tasks(void); - #endif // MICROPY_INCLUDED_CXD56_BACKGROUND_H diff --git a/ports/esp32s2/background.c b/ports/esp32s2/background.c index a90fa7d0aa..40ce9ecfdf 100644 --- a/ports/esp32s2/background.c +++ b/ports/esp32s2/background.c @@ -35,27 +35,12 @@ #include "shared-module/displayio/__init__.h" #endif -static bool running_background_tasks = false; - -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void run_background_tasks(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } +void port_background_task(void) { // Zero delay in case FreeRTOS wants to switch to something else. vTaskDelay(0); - running_background_tasks = true; - filesystem_background(); - - #if CIRCUITPY_DISPLAYIO - displayio_background(); - #endif - running_background_tasks = false; - - assert_heap_ok(); } + +void port_start_background_task(void) {} + +void port_finish_background_task(void) {} diff --git a/ports/esp32s2/background.h b/ports/esp32s2/background.h index 0e1fb7a568..cb850d4e5a 100644 --- a/ports/esp32s2/background.h +++ b/ports/esp32s2/background.h @@ -29,7 +29,4 @@ #include -void background_tasks_reset(void); -void run_background_tasks(void); - #endif // MICROPY_INCLUDED_ESP32S2_BACKGROUND_H diff --git a/ports/litex/background.c b/ports/litex/background.c index 8c18970434..174d9588ac 100644 --- a/ports/litex/background.c +++ b/ports/litex/background.c @@ -29,32 +29,6 @@ #include "supervisor/usb.h" #include "supervisor/shared/stack.h" -#if CIRCUITPY_DISPLAYIO -#include "shared-module/displayio/__init__.h" -#endif - -static bool running_background_tasks = false; - -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void run_background_tasks(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } - running_background_tasks = true; - filesystem_background(); - - #if USB_AVAILABLE - usb_background(); - #endif - - #if CIRCUITPY_DISPLAYIO - displayio_background(); - #endif - running_background_tasks = false; - - assert_heap_ok(); -} +void port_background_task(void) {} +void port_start_background_task(void) {} +void port_finish_background_task(void) {} diff --git a/ports/litex/background.h b/ports/litex/background.h index 09551c7fbb..c80fbbe5cb 100644 --- a/ports/litex/background.h +++ b/ports/litex/background.h @@ -27,9 +27,4 @@ #ifndef MICROPY_INCLUDED_LITEX_BACKGROUND_H #define MICROPY_INCLUDED_LITEX_BACKGROUND_H -#include - -void background_tasks_reset(void); -void run_background_tasks(void); - #endif // MICROPY_INCLUDED_LITEX_BACKGROUND_H diff --git a/ports/mimxrt10xx/background.c b/ports/mimxrt10xx/background.c index ff53ea44f4..a8a613d41a 100644 --- a/ports/mimxrt10xx/background.c +++ b/ports/mimxrt10xx/background.c @@ -24,58 +24,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "background.h" -//#include "audio_dma.h" -#include "supervisor/filesystem.h" -#include "supervisor/shared/tick.h" -#include "supervisor/usb.h" - -#include "py/runtime.h" -#include "shared-module/network/__init__.h" -#include "supervisor/linker.h" -#include "supervisor/shared/stack.h" - -#ifdef CIRCUITPY_DISPLAYIO -#include "shared-module/displayio/__init__.h" -#endif - -volatile uint64_t last_finished_tick = 0; - -bool stack_ok_so_far = true; - -static bool running_background_tasks = false; - -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void PLACE_IN_ITCM(run_background_tasks)(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } - assert_heap_ok(); - running_background_tasks = true; +#include "supervisor/port.h" +void port_background_task(void) { #if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO audio_dma_background(); #endif - #if CIRCUITPY_DISPLAYIO - displayio_background(); - #endif - - #if CIRCUITPY_NETWORK - network_module_background(); - #endif - filesystem_background(); - usb_background(); - running_background_tasks = false; - assert_heap_ok(); - - last_finished_tick = supervisor_ticks_ms64(); -} - -bool background_tasks_ok(void) { - return supervisor_ticks_ms64() - last_finished_tick < 1000; } +void port_start_background_task(void) {} +void port_finish_background_task(void) {} diff --git a/ports/mimxrt10xx/background.h b/ports/mimxrt10xx/background.h index 52789d0389..a3fe102acc 100644 --- a/ports/mimxrt10xx/background.h +++ b/ports/mimxrt10xx/background.h @@ -28,11 +28,4 @@ #ifndef MICROPY_INCLUDED_MIMXRT10XX_BACKGROUND_H #define MICROPY_INCLUDED_MIMXRT10XX_BACKGROUND_H -#include - -void background_tasks_reset(void); -void run_background_tasks(void); -void run_background_vm_tasks(void); -bool background_tasks_ok(void); - #endif // MICROPY_INCLUDED_MIMXRT10XX_BACKGROUND_H diff --git a/ports/mimxrt10xx/common-hal/pulseio/PulseIn.c b/ports/mimxrt10xx/common-hal/pulseio/PulseIn.c index d8bf2017ea..ec02908612 100644 --- a/ports/mimxrt10xx/common-hal/pulseio/PulseIn.c +++ b/ports/mimxrt10xx/common-hal/pulseio/PulseIn.c @@ -64,7 +64,7 @@ // // last ms. // current_us = 1000 - current_us; // pulseio_pulsein_obj_t* self = get_eic_channel_data(channel); -// if (!background_tasks_ok() || self->errored_too_fast) { +// if (!supervisor_background_tasks_ok() || self->errored_too_fast) { // self->errored_too_fast = true; // common_hal_pulseio_pulsein_pause(self); // return; diff --git a/ports/nrf/background.c b/ports/nrf/background.c index bc7c0d7d32..10543ddb21 100644 --- a/ports/nrf/background.c +++ b/ports/nrf/background.c @@ -46,35 +46,14 @@ #include "common-hal/_bleio/bonding.h" #endif -static bool running_background_tasks = false; +void port_start_background_task(void) {} +void port_finish_background_task(void) {} -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void run_background_tasks(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } - running_background_tasks = true; - filesystem_background(); +void port_background_task(void) { #if CIRCUITPY_AUDIOPWMIO audiopwmout_background(); #endif #if CIRCUITPY_AUDIOBUSIO i2s_background(); #endif - -#if CIRCUITPY_BLEIO - supervisor_bluetooth_background(); - bonding_background(); -#endif - - #if CIRCUITPY_DISPLAYIO - displayio_background(); - #endif - running_background_tasks = false; - - assert_heap_ok(); } diff --git a/ports/nrf/background.h b/ports/nrf/background.h index d53681c0fd..64a768cf9b 100644 --- a/ports/nrf/background.h +++ b/ports/nrf/background.h @@ -27,9 +27,4 @@ #ifndef MICROPY_INCLUDED_NRF_BACKGROUND_H #define MICROPY_INCLUDED_NRF_BACKGROUND_H -#include - -void background_tasks_reset(void); -void run_background_tasks(void); - #endif // MICROPY_INCLUDED_NRF_BACKGROUND_H diff --git a/ports/stm/background.c b/ports/stm/background.c index 8c18970434..d83a0ccec7 100644 --- a/ports/stm/background.c +++ b/ports/stm/background.c @@ -33,28 +33,6 @@ #include "shared-module/displayio/__init__.h" #endif -static bool running_background_tasks = false; - -void background_tasks_reset(void) { - running_background_tasks = false; -} - -void run_background_tasks(void) { - // Don't call ourselves recursively. - if (running_background_tasks) { - return; - } - running_background_tasks = true; - filesystem_background(); - - #if USB_AVAILABLE - usb_background(); - #endif - - #if CIRCUITPY_DISPLAYIO - displayio_background(); - #endif - running_background_tasks = false; - - assert_heap_ok(); -} +void port_background_task(void) {} +void port_start_background_task(void) {} +void port_finish_background_task(void) {} diff --git a/ports/stm/background.h b/ports/stm/background.h index 6225429f89..e57aa40dd7 100644 --- a/ports/stm/background.h +++ b/ports/stm/background.h @@ -27,9 +27,4 @@ #ifndef MICROPY_INCLUDED_STM32_BACKGROUND_H #define MICROPY_INCLUDED_STM32_BACKGROUND_H -#include - -void background_tasks_reset(void); -void run_background_tasks(void); - #endif // MICROPY_INCLUDED_STM32_BACKGROUND_H diff --git a/supervisor/port.h b/supervisor/port.h index 8a12d34c8a..ad5b3cf32a 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -91,4 +91,12 @@ void port_interrupt_after_ticks(uint32_t ticks); // Sleep the CPU until an interrupt is received. void port_sleep_until_interrupt(void); +// Execute port specific actions during background tasks. +void port_background_task(void); + +// Take port specific actions at the beginning and end of background tasks. +// This is used e.g., to set a monitoring pin for debug purposes. "Actual +// work" should be done in port_background_task() instead. +void port_start_background_task(void); +void port_finish_background_task(void); #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 46172d0f30..bc270030f3 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -32,8 +32,16 @@ #include "supervisor/background_callback.h" #include "supervisor/port.h" #include "supervisor/shared/autoreload.h" +#include "supervisor/shared/stack.h" -static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); +#if CIRCUITPY_BLEIO +#include "supervisor/shared/bluetooth.h" +#include "common-hal/_bleio/bonding.h" +#endif + +#if CIRCUITPY_DISPLAYIO +#include "shared-module/displayio/__init__.h" +#endif #if CIRCUITPY_GAMEPAD #include "shared-module/gamepad/__init__.h" @@ -43,6 +51,10 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); #include "shared-module/gamepadshift/__init__.h" #endif +#if CIRCUITPY_NETWORK +#include "shared-module/network/__init__.h" +#endif + #include "shared-bindings/microcontroller/__init__.h" #if CIRCUITPY_WATCHDOG @@ -52,12 +64,42 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); #define WATCHDOG_EXCEPTION_CHECK() 0 #endif +static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); + static background_callback_t callback; -extern void run_background_tasks(void); +volatile uint64_t last_finished_tick = 0; -void background_task_tick(void *unused) { - run_background_tasks(); +void supervisor_background_tasks(void *unused) { + port_start_background_task(); + + assert_heap_ok(); + + #if CIRCUITPY_DISPLAYIO + displayio_background(); + #endif + + #if CIRCUITPY_NETWORK + network_module_background(); + #endif + filesystem_background(); + + #if CIRCUITPY_BLEIO + supervisor_bluetooth_background(); + bonding_background(); + #endif + + port_background_task(); + + assert_heap_ok(); + + last_finished_tick = port_get_raw_ticks(NULL); + + port_finish_background_task(); +} + +bool supervisor_background_tasks_ok(void) { + return port_get_raw_ticks(NULL) - last_finished_tick < 1024; } void supervisor_tick(void) { @@ -77,7 +119,7 @@ void supervisor_tick(void) { #endif } #endif - background_callback_add(&callback, background_task_tick, NULL); + background_callback_add(&callback, supervisor_background_tasks, NULL); } uint64_t supervisor_ticks_ms64() { diff --git a/supervisor/shared/tick.h b/supervisor/shared/tick.h index e7e8080581..3a01bd6222 100644 --- a/supervisor/shared/tick.h +++ b/supervisor/shared/tick.h @@ -28,6 +28,7 @@ #define __INCLUDED_SUPERVISOR_TICK_H #include +#include /** @brief To be called once every ms * @@ -36,13 +37,6 @@ * interrupt context. */ extern void supervisor_tick(void); -/** @brief Cause background tasks to be called soon - * - * Normally, background tasks are only run once per tick. For other cases where - * an event noticed from an interrupt context needs to be completed by a background - * task activity, the interrupt can call supervisor_fake_tick. - */ -extern void supervisor_fake_tick(void); /** @brief Get the lower 32 bits of the time in milliseconds * * This can be more efficient than supervisor_ticks_ms64, for sites where a wraparound @@ -67,4 +61,12 @@ extern void supervisor_run_background_if_tick(void); extern void supervisor_enable_tick(void); extern void supervisor_disable_tick(void); +/** + * @brief Return true if tick-based background tasks ran within the last 1s + * + * Note that when ticks are not enabled, this function can return false; this is + * intended. + */ +extern bool supervisor_background_tasks_ok(void); + #endif From 81105cb9ef68c4d88eab206f111af448440c8f30 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 14 Jul 2020 10:08:07 -0500 Subject: [PATCH 202/277] supervisor: usb: note that it's unusual to need to call usb_background --- supervisor/usb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/supervisor/usb.h b/supervisor/usb.h index 1bed9bbb4b..2a447c3686 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -29,8 +29,10 @@ #include -// Ports must call this as frequently as they can in order to keep the USB connection -// alive and responsive. +// Ports must call this as frequently as they can in order to keep the USB +// connection alive and responsive. Normally this is called from background +// tasks after the USB IRQ handler is executed, but in specific circumstances +// it may be necessary to call it directly. void usb_background(void); // Ports must call this from their particular USB IRQ handler From 49fcfd14d213cb6f6441fc718ff8fc8e7a5cc5fa Mon Sep 17 00:00:00 2001 From: TinkeringTech Date: Wed, 15 Jul 2020 21:49:34 -0400 Subject: [PATCH 203/277] Added the TinkeringTech ScoutMakes Azul platform to CircuitPython --- .github/workflows/build.yml | 1 + .../tinkeringtech_scoutmakes_azul/README.md | 25 ++++++++ .../tinkeringtech_scoutmakes_azul/board.c | 38 +++++++++++ .../mpconfigboard.h | 63 +++++++++++++++++++ .../mpconfigboard.mk | 10 +++ .../tinkeringtech_scoutmakes_azul/pins.c | 53 ++++++++++++++++ 6 files changed, 190 insertions(+) create mode 100644 ports/nrf/boards/tinkeringtech_scoutmakes_azul/README.md create mode 100644 ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c create mode 100644 ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.h create mode 100644 ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.mk create mode 100644 ports/nrf/boards/tinkeringtech_scoutmakes_azul/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00454cc2da..3ad11b3ed7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -259,6 +259,7 @@ jobs: - "teensy41" - "teknikio_bluebird" - "thunderpack" + - "tinkeringtech_scoutmakes_azul" - "trellis_m4_express" - "trinket_m0" - "trinket_m0_haxpress" diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/README.md b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/README.md new file mode 100644 index 0000000000..614daa72cc --- /dev/null +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/README.md @@ -0,0 +1,25 @@ +# Setup + +The TinkeringTech ScoutMakes Azul is a bluetooth enabled, feather format, open source platform featuring the nRF52840 from Nordic Semiconductors. The design is based on the Adafruit nRF52840 feather express and uses the Raytac MDBT50Q-1MV2 module. + +Schematic, datasheet, pin mapping etc. can be found over [here](https://tinkeringtech.com/scoutmakes-azul). + +features: +- ARM Cortex M4F (with HW floating point acceleration) running at 64MHz +- Raytac MDBT50Q-1MV2 BLE module. FCC / IC / TELEC certified module +- 1MB flash and 256KB SRAM +- Native Open Source USB stack – pre-programmed with UF2 bootloader and CircuitPython +- 128×32 OLED display +- USB type-C +- On/off power switch +- Bluetooth Low Energy compatible 2.4GHz radio (Details available in the nRF52840 product specification) +- BT5.1 & BT5 Bluetooth Specification Certified +- Supports BT5 Long Range Feature +- 1.7v to 3.3v operation with internal linear and DC/DC voltage regulators +- 21 GPIO, 6 x 12-bit ADC pins, up to 12 PWM outputs (3 PWM modules with 4 outputs each) +- Pin #3 red LED for general purpose blinking, +- Programmable NeoPixel for colorful feedback +- 4 mounting holes +- Reset button +- Works out of the box with Adafruit feather wings. +- Open source design. diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.h b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.h new file mode 100644 index 0000000000..2d66633942 --- /dev/null +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.h @@ -0,0 +1,63 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "TinkeringTech ScoutMakes Azul" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) + +#define MICROPY_HW_LED_STATUS (&pin_P1_15) + +#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) +#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 +#endif + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_24) +#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.mk b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.mk new file mode 100644 index 0000000000..e8bd636ad9 --- /dev/null +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x80BE +USB_PRODUCT = "TinkeringTech ScoutMakes Azul" +USB_MANUFACTURER = "TinkeringTech LLC" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/pins.c b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/pins.c new file mode 100644 index 0000000000..ec2689ab45 --- /dev/null +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/pins.c @@ -0,0 +1,53 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) }, + + { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, + + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_15) }, + + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 416a32ab01631770701fe433c1e6c79a2a16b6a9 Mon Sep 17 00:00:00 2001 From: TinkeringTech Date: Wed, 15 Jul 2020 21:58:40 -0400 Subject: [PATCH 204/277] fixed build.yml file formatting errors --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ad11b3ed7..d3d12be096 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -259,7 +259,7 @@ jobs: - "teensy41" - "teknikio_bluebird" - "thunderpack" - - "tinkeringtech_scoutmakes_azul" + - "tinkeringtech_scoutmakes_azul" - "trellis_m4_express" - "trinket_m0" - "trinket_m0_haxpress" From cdfc3a2d37771b67f82ab810ebfefcbb9cd6a14e Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 16 Jul 2020 11:12:53 -0400 Subject: [PATCH 205/277] Check out active protomatter PR --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index 9f71088d2c..761d6437e8 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit 9f71088d2c32206c6f0495704ae0c040426d5764 +Subproject commit 761d6437e8cd6a131d51de96974337121a9c7164 From 6a49766df04ba23d2c5f0bdb24f826ff1355340d Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 16 Jul 2020 15:45:18 -0400 Subject: [PATCH 206/277] Fix pulseIO reset and frequency issues, remove IRQ conflict --- ports/stm/common-hal/pulseio/PulseIn.c | 13 ++++++++----- ports/stm/common-hal/pulseio/PulseOut.c | 1 - ports/stm/peripherals/timers.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index 478077eda7..db01968c4d 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -102,7 +102,9 @@ void pulsein_reset(void) { } memset(_objs, 0, sizeof(_objs)); + HAL_TIM_Base_DeInit(&tim_handle); tim_clock_disable(stm_peripherals_timer_get_index(tim_handle.Instance)); + memset(&tim_handle, 0, sizeof(tim_handle)); refcount = 0; } @@ -133,21 +135,22 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu self->last_count = 0; self->last_overflow = 0; - if (HAL_TIM_Base_GetState(&tim_handle) == HAL_TIM_STATE_RESET) { //TODO: there's no state yet + if (HAL_TIM_Base_GetState(&tim_handle) == HAL_TIM_STATE_RESET) { // Find a suitable timer TIM_TypeDef * tim_instance = stm_peripherals_find_timer(); stm_peripherals_timer_reserve(tim_instance); - // Calculate a 1ms period + // Set ticks to 1us uint32_t source = stm_peripherals_timer_get_source_freq(tim_instance); - uint32_t prescaler = source/1000000; // 1us intervals + uint32_t prescaler = source/1000000; + // Enable clocks and IRQ, set callback stm_peripherals_timer_preinit(tim_instance, 4, pulsein_timer_event_handler); // Set the new period tim_handle.Instance = tim_instance; - tim_handle.Init.Prescaler = prescaler; // divide down to 1mhz - tim_handle.Init.Period = 0xffff; + tim_handle.Init.Prescaler = prescaler - 1; + tim_handle.Init.Period = 0x10000 - 1; //65 ms period (maximum) HAL_TIM_Base_Init(&tim_handle); // Set registers manually diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c index ba817ae263..865b41dcf5 100644 --- a/ports/stm/common-hal/pulseio/PulseOut.c +++ b/ports/stm/common-hal/pulseio/PulseOut.c @@ -73,7 +73,6 @@ STATIC void start_timer(void) { tim_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer tim_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts __HAL_TIM_ENABLE_IT(&tim_handle, TIM_IT_UPDATE); - } STATIC void pulseout_event_handler(void) { diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index 54b1fd18ab..aa189da84f 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -67,7 +67,7 @@ static size_t irq_map[] = { NULL_IRQ, #endif #ifdef TIM6 - #if !defined(DAC_BASE) || !defined(DAC1_BASE) + #if !defined(DAC_BASE) && !defined(DAC1_BASE) TIM6_IRQn, #else TIM6_DAC_IRQn, From bfcaa4b2b425626c1c4040a7e9bf67ef122d6687 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 16 Jul 2020 16:11:22 -0400 Subject: [PATCH 207/277] Made requested changes in displayio --- shared-bindings/displayio/Display.c | 2 +- shared-bindings/displayio/Group.c | 16 ++++++++-------- shared-bindings/displayio/TileGrid.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 8d5fa87184..4534babca6 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -395,7 +395,7 @@ const mp_obj_property_t displayio_display_rotation_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bus: displayio = ... +//| bus: Union[ParallelBus, FourWire, I2CDisplay] = ... //| """The bus being used by the display""" //| //| diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 02915da644..1176db5634 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -190,7 +190,7 @@ const mp_obj_property_t displayio_group_y_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def append(self, layer: layer) -> None: +//| def append(self, layer: Union[vectorio.Shape, Group, TileGrid]) -> None: //| """Append a layer to the group. It will be drawn above other layers.""" //| ... //| @@ -201,7 +201,7 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append); -//| def insert(self, index: int, layer: layer) -> None: +//| def insert(self, index: int, layer: Union[vectorio.Shape, Group, TileGrid]) -> None: //| """Insert a layer into the group.""" //| ... //| @@ -214,7 +214,7 @@ STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert); -//| def index(self, layer: layer) -> int: +//| def index(self, layer: Union[vectorio.Shape, Group, TileGrid]) -> int: //| """Returns the index of the first copy of layer. Raises ValueError if not found.""" //| ... //| @@ -228,7 +228,7 @@ STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index); -//| def pop(self, i: int = -1) -> group: +//| def pop(self, i: int = -1) -> Union[vectorio.Shape, Group, TileGrid]: //| """Remove the ith item and return it.""" //| ... //| @@ -251,7 +251,7 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop); -//| def remove(self, layer: layer) -> None: +//| def remove(self, layer: Union[vectorio.Shape, Group, TileGrid]) -> None: //| """Remove the first copy of layer. Raises ValueError if it is not present.""" //| ... //| @@ -280,7 +280,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __getitem__(self, index: int) -> group: +//| def __getitem__(self, index: int) -> Union[vectorio.Shape, Group, TileGrid]: //| """Returns the value at the given index. //| //| This allows you to:: @@ -288,7 +288,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| print(group[0])""" //| ... //| -//| def __setitem__(self, index: int, value: group) -> None: +//| def __setitem__(self, index: int, value: Union[vectorio.Shape, Group, TileGrid]) -> None: //| """Sets the value at the given index. //| //| This allows you to:: @@ -296,7 +296,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| group[0] = sprite""" //| ... //| -//| def __delitem__(self, index: int) -> group: +//| def __delitem__(self, index: int) -> None: //| """Deletes the value at the given index. //| //| This allows you to:: diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index 348fcb4484..c17d984db0 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -289,7 +289,7 @@ const mp_obj_property_t displayio_tilegrid_transpose_xy_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| pixel_shader: pixel_shader = ... +//| pixel_shader: Union[ColorConverter, Palette] = ... //| """The pixel shader of the tilegrid.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) { From dc6902a33e33384e60ef825deac4fa1d9642a3b2 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 16 Jul 2020 17:11:24 -0400 Subject: [PATCH 208/277] Exclude timers from H7 builds --- ports/stm/peripherals/timers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index aa189da84f..7950d8a57b 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -34,6 +34,8 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" +#if !(CPY_STM32H7) + #define ALL_CLOCKS 0xFFFF #define NULL_IRQ 0xFF @@ -193,7 +195,9 @@ TIM_TypeDef * stm_peripherals_find_timer(void) { // If no results are found, no unclaimed pins with this timer are in this package, // and it is safe to pick if (timer_in_package == false && mcu_tim_banks[i] != NULL) { + // DEBUG: print the timer return mcu_tim_banks[i]; + mp_printf(&mp_plat_print, "Timer: %d\n",i); } } //TODO: secondary search for timers outside the pins in the board profile @@ -201,6 +205,8 @@ TIM_TypeDef * stm_peripherals_find_timer(void) { // Work backwards - higher index timers have fewer pin allocations for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) { if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) { + // DEBUG: print the timer + mp_printf(&mp_plat_print, "Timer: %d\n",i); return mcu_tim_banks[i]; } } @@ -449,3 +455,5 @@ void TIM17_IRQHandler(void) { callback_router(17); } #endif + +#endif From a18a39210919a886d4efb4c52b85a309b3403abf Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 17 Jul 2020 08:36:26 -0500 Subject: [PATCH 209/277] background_callback: Add gc collect callback A background callback must never outlive its related object. By collecting the head of the linked list of background tasks, this will not happen. One hypothetical case where this could happen is if an MP3Decoder is deleted while its callback to fill its buffer is scheduled. --- main.c | 2 ++ supervisor/background_callback.h | 5 +++++ supervisor/shared/background_callback.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/main.c b/main.c index ce95de95f0..f928d0d62f 100755 --- a/main.c +++ b/main.c @@ -493,6 +493,8 @@ void gc_collect(void) { // have lost their references in the VM even though they are mounted. gc_collect_root((void**)&MP_STATE_VM(vfs_mount_table), sizeof(mp_vfs_mount_t) / sizeof(mp_uint_t)); + background_callback_gc_collect(); + #if CIRCUITPY_DISPLAYIO displayio_gc_collect(); #endif diff --git a/supervisor/background_callback.h b/supervisor/background_callback.h index 82025f6b7a..535dd656be 100644 --- a/supervisor/background_callback.h +++ b/supervisor/background_callback.h @@ -79,4 +79,9 @@ void background_callback_reset(void); void background_callback_begin_critical_section(void); void background_callback_end_critical_section(void); +/* + * Background callbacks may stop objects from being collected + */ +void background_callback_gc_collect(void); + #endif diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index e45c9b5c3d..1be3cae2ba 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "py/gc.h" #include "py/mpconfig.h" #include "supervisor/background_callback.h" #include "supervisor/shared/tick.h" @@ -105,3 +106,8 @@ void background_callback_reset() { in_background_callback = false; CALLBACK_CRITICAL_END; } + +void background_callback_gc_collect(void) { + background_callback_t *cb = (background_callback_t*)callback_head; + gc_collect_ptr(cb); +} From d64b4e305929ccb68e0cf1ef977f42e213023f3b Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 17 Jul 2020 14:53:51 -0400 Subject: [PATCH 210/277] Made more requested changes --- shared-bindings/fontio/BuiltinFont.c | 2 +- shared-bindings/framebufferio/FramebufferDisplay.c | 4 ++-- shared-bindings/gnss/GNSS.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 9e2f81c475..5eaae624ea 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -46,7 +46,7 @@ //| ... //| -//| bitmap: bitmap = ... +//| bitmap: displayio.Bitmap = ... //| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use //| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and //| `terminalio.Terminal`.""" diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 737e0696f8..d687e3e95b 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -47,7 +47,7 @@ //| objects in CircuitPython, Display objects live until `displayio.release_displays()` //| is called. This is done so that CircuitPython can use the display itself.""" //| -//| def __init__(self, framebuffer: framebuffer, *, rotation: int = 0, auto_refresh: bool = True) -> None: +//| def __init__(self, framebuffer: rgbmatrix.RGBMatrix, *, rotation: int = 0, auto_refresh: bool = True) -> None: //| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc) //| //| :param framebuffer: The framebuffer that the display is connected to @@ -299,7 +299,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| framebuffer: framebuffer = ... +//| framebuffer: rgbmatrix.RGBMatrix = ... //| """The framebuffer being used by the display""" //| //| diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 0ecc1ac6a1..41c3a80143 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -190,7 +190,7 @@ const mp_obj_property_t gnss_timestamp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| fix: string = ... +//| fix: gnss.PositionFix = ... //| """Fix mode.""" //| STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) { From 6912d31560a617a134fcadbfdc1800a259f5e465 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 17 Jul 2020 14:32:05 -0500 Subject: [PATCH 211/277] uchip: reclaim some flash space --- ports/atmel-samd/boards/uchip/mpconfigboard.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 90b5600dcb..196068a1e0 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -9,3 +9,10 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +# Tweak inlining depending on language. +ifeq ($(TRANSLATION), zh_Latn_pinyin) +CFLAGS_INLINE_LIMIT = 45 +else +CFLAGS_INLINE_LIMIT = 70 +endif From 98eef79faaa36adbdd0b074c712aad5df7ef37a0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 17 Jul 2020 14:55:46 -0500 Subject: [PATCH 212/277] background_callback_gc_collect: We must traverse the whole list --- supervisor/shared/background_callback.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 1be3cae2ba..d10579c4f9 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -108,6 +108,23 @@ void background_callback_reset() { } void background_callback_gc_collect(void) { + // We don't enter the callback critical section here. We rely on + // gc_collect_ptr _NOT_ entering background callbacks, so it is not + // possible for the list to be cleared. + // + // However, it is possible for the list to be extended. We make the + // minor assumption that no newly added callback is for a + // collectable object. That is, we only plug the hole where an + // object becomes collectable AFTER it is added but before the + // callback is run, not the hole where an object was ALREADY + // collectable but adds a background task for itself. + // + // It's necessary to traverse the whole list here, as the callbacks + // themselves can be in non-gc memory, and some of the cb->data + // objects themselves might be in non-gc memory. background_callback_t *cb = (background_callback_t*)callback_head; - gc_collect_ptr(cb); + while(cb) { + gc_collect_ptr(cb->data); + cb = cb->next; + } } From 207369ec0978f87ceb5e57f42d30ae10025e5bc7 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Fri, 17 Jul 2020 17:28:23 -0400 Subject: [PATCH 213/277] Add boilerplate, create basic PWMOut test --- ports/esp32s2/common-hal/pulseio/PWMOut.c | 120 ++++++++++++++++++++ ports/esp32s2/common-hal/pulseio/PWMOut.h | 43 +++++++ ports/esp32s2/common-hal/pulseio/PulseIn.c | 75 ++++++++++++ ports/esp32s2/common-hal/pulseio/PulseIn.h | 53 +++++++++ ports/esp32s2/common-hal/pulseio/PulseOut.c | 60 ++++++++++ ports/esp32s2/common-hal/pulseio/PulseOut.h | 42 +++++++ ports/esp32s2/common-hal/pulseio/__init__.c | 1 + ports/esp32s2/mpconfigport.mk | 2 +- 8 files changed, 395 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/pulseio/PWMOut.c create mode 100644 ports/esp32s2/common-hal/pulseio/PWMOut.h create mode 100644 ports/esp32s2/common-hal/pulseio/PulseIn.c create mode 100644 ports/esp32s2/common-hal/pulseio/PulseIn.h create mode 100644 ports/esp32s2/common-hal/pulseio/PulseOut.c create mode 100644 ports/esp32s2/common-hal/pulseio/PulseOut.h create mode 100644 ports/esp32s2/common-hal/pulseio/__init__.c diff --git a/ports/esp32s2/common-hal/pulseio/PWMOut.c b/ports/esp32s2/common-hal/pulseio/PWMOut.c new file mode 100644 index 0000000000..8f96433c06 --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/PWMOut.c @@ -0,0 +1,120 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Uses code from Micropython, Copyright (c) 2013-2016 Damien P. George + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + +#include "common-hal/pulseio/PWMOut.h" +#include "shared-bindings/pulseio/PWMOut.h" +#include "py/runtime.h" +#include "driver/ledc.h" + +#define LEDC_LS_TIMER LEDC_TIMER_1 +#define LEDC_LS_MODE LEDC_LOW_SPEED_MODE +#define LEDC_LS_CH0_GPIO (18) +#define LEDC_LS_CH0_CHANNEL LEDC_CHANNEL_0 +#define LEDC_LS_CH1_GPIO (19) +#define LEDC_LS_CH1_CHANNEL LEDC_CHANNEL_1 +#define LEDC_LS_CH2_GPIO (4) +#define LEDC_LS_CH2_CHANNEL LEDC_CHANNEL_2 +#define LEDC_LS_CH3_GPIO (5) +#define LEDC_LS_CH3_CHANNEL LEDC_CHANNEL_3 + +#define LEDC_TEST_CH_NUM (4) +#define LEDC_TEST_DUTY (4000) +#define LEDC_TEST_FADE_TIME (3000) + + + +void pwmout_reset(void) { +} + +pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, + const mcu_pin_obj_t* pin, + uint16_t duty, + uint32_t frequency, + bool variable_frequency) { + ledc_timer_config_t ledc_timer = { + .duty_resolution = LEDC_TIMER_16_BIT, // resolution of PWM duty + .freq_hz = frequency, // frequency of PWM signal + .speed_mode = LEDC_LS_MODE, // timer mode + .timer_num = LEDC_LS_TIMER, // timer index + .clk_cfg = LEDC_AUTO_CLK, // Auto select the source clock + }; + // Set configuration of timer0 for high speed channels + ledc_timer_config(&ledc_timer); + + ledc_channel_config_t pwm_channel = { + .channel = LEDC_LS_CH0_CHANNEL, + .duty = 0, + .gpio_num = pin->number, + .speed_mode = LEDC_LS_MODE, + .hpoint = 0, + .timer_sel = LEDC_LS_TIMER + }; + + // Set LED Controller with previously prepared configuration + for (ch = 0; ch < LEDC_TEST_CH_NUM; ch++) { + ledc_channel_config(&ledc_channel[ch]); + } + + for (ch = 0; ch < LEDC_TEST_CH_NUM; ch++) { + ledc_set_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel, duty*2); + ledc_update_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel); + } + + return PWMOUT_OK; +} + +void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) { +} + +void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) { +} + +bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) { + return false; +} + +void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) { +} + +void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) { +} + +uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) { + return false; +} + +void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_t frequency) { +} + +uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) { + return false; +} + +bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self) { + return false; +} diff --git a/ports/esp32s2/common-hal/pulseio/PWMOut.h b/ports/esp32s2/common-hal/pulseio/PWMOut.h new file mode 100644 index 0000000000..28484e9238 --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/PWMOut.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H + +#include "common-hal/microcontroller/Pin.h" + +typedef struct { + mp_obj_base_t base; + uint8_t channel; + bool variable_frequency: 1; + uint16_t duty_cycle; + uint32_t frequency; + uint32_t period; +} pulseio_pwmout_obj_t; + +void pwmout_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H diff --git a/ports/esp32s2/common-hal/pulseio/PulseIn.c b/ports/esp32s2/common-hal/pulseio/PulseIn.c new file mode 100644 index 0000000000..65fc6631d4 --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/PulseIn.c @@ -0,0 +1,75 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common-hal/pulseio/PulseIn.h" +#include "py/runtime.h" + +// STATIC void pulsein_handler(uint8_t num) { +// } + +void pulsein_reset(void) { +} + +void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin, + uint16_t maxlen, bool idle_state) { + mp_raise_NotImplementedError(translate("PulseIn not supported on this chip")); +} + +bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) { + return false; +} + +void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) { +} + +void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) { +} + +void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) { +} + +void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) { +} + +uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) { + return false; +} + +uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) { + return false; +} + +uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) { + return false; +} + +bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) { + return false; +} + +uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) { + return false; +} diff --git a/ports/esp32s2/common-hal/pulseio/PulseIn.h b/ports/esp32s2/common-hal/pulseio/PulseIn.h new file mode 100644 index 0000000000..b317c516c1 --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/PulseIn.h @@ -0,0 +1,53 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H + +#include "common-hal/microcontroller/Pin.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + + const mcu_pin_obj_t* pin; + bool idle_state; + bool paused; + volatile bool first_edge; + + uint16_t* buffer; + uint16_t maxlen; + + volatile uint16_t start; + volatile uint16_t len; + volatile uint32_t last_overflow; + volatile uint16_t last_count; +} pulseio_pulsein_obj_t; + +void pulsein_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEIN_H diff --git a/ports/esp32s2/common-hal/pulseio/PulseOut.c b/ports/esp32s2/common-hal/pulseio/PulseOut.c new file mode 100644 index 0000000000..c448c578df --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/PulseOut.c @@ -0,0 +1,60 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common-hal/pulseio/PulseOut.h" + +#include "shared-bindings/pulseio/PWMOut.h" +#include "py/runtime.h" + +// STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) { +// } + +// STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) { +// } + +// STATIC void start_timer(void) { +// } + +// STATIC void pulseout_event_handler(void) { +// } + +void pulseout_reset() { +} + +void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self, + const pulseio_pwmout_obj_t* carrier) { + mp_raise_NotImplementedError(translate("PulseOut not supported on this chip")); +} + +bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) { + return false; +} + +void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) { +} + +void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pulses, uint16_t length) { +} diff --git a/ports/esp32s2/common-hal/pulseio/PulseOut.h b/ports/esp32s2/common-hal/pulseio/PulseOut.h new file mode 100644 index 0000000000..f465d00792 --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/PulseOut.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H +#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H + +#include "common-hal/microcontroller/Pin.h" +#include "common-hal/pulseio/PWMOut.h" + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + pulseio_pwmout_obj_t *pwmout; +} pulseio_pulseout_obj_t; + +void pulseout_reset(void); + +#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PULSEOUT_H diff --git a/ports/esp32s2/common-hal/pulseio/__init__.c b/ports/esp32s2/common-hal/pulseio/__init__.c new file mode 100644 index 0000000000..2bee925bc7 --- /dev/null +++ b/ports/esp32s2/common-hal/pulseio/__init__.c @@ -0,0 +1 @@ +// No pulseio module functions. diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 5686579b45..fccb14dedf 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -25,7 +25,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_MICROCONTROLLER = 1 CIRCUITPY_NVM = 0 -CIRCUITPY_PULSEIO = 0 +CIRCUITPY_PULSEIO = 1 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 CIRCUITPY_TOUCHIO = 0 From 1160635608ebeaf3868a327803c0ca248f549123 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 16 Jul 2020 19:02:26 -0700 Subject: [PATCH 214/277] Enable PYSTACK to keep function state out of the heap --- main.c | 8 ++++++++ py/circuitpy_mpconfig.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/main.c b/main.c index f928d0d62f..f1dfa63c6f 100755 --- a/main.c +++ b/main.c @@ -97,6 +97,10 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) { } } +#if MICROPY_ENABLE_PYSTACK +static size_t PLACE_IN_DTCM_BSS(_pystack)[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]; +#endif + void start_mp(supervisor_allocation* heap) { reset_status_led(); autoreload_stop(); @@ -125,6 +129,10 @@ void start_mp(supervisor_allocation* heap) { // Clear the readline history. It references the heap we're about to destroy. readline_init0(); + #if MICROPY_ENABLE_PYSTACK + mp_pystack_init(_pystack, _pystack + sizeof(_pystack)); + #endif + #if MICROPY_ENABLE_GC gc_init(heap->ptr, heap->ptr + heap->length / 4); #endif diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index d05a246fce..a7853fabda 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -119,6 +119,7 @@ #define MICROPY_QSTR_BYTES_IN_HASH (1) #define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_REPL_EVENT_DRIVEN (0) +#define MICROPY_ENABLE_PYSTACK (1) #define MICROPY_STACK_CHECK (1) #define MICROPY_STREAMS_NON_BLOCK (1) #ifndef MICROPY_USE_INTERNAL_PRINTF @@ -785,6 +786,10 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS 1000 #endif +#ifndef CIRCUITPY_PYSTACK_SIZE +#define CIRCUITPY_PYSTACK_SIZE 1024 +#endif + #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_VERBOSE_BLE 0 From 4b157aa6b8d925cbf29ceeb96da3a455f3a77f3b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 15 Jul 2020 17:59:11 -0700 Subject: [PATCH 215/277] Add find varients to bytearray --- py/objarray.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/py/objarray.c b/py/objarray.c index 7dfdc5b121..b868e62f92 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -400,6 +400,70 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_extend_obj, array_extend); #endif +#if MICROPY_PY_BUILTINS_BYTEARRAY +STATIC mp_obj_t buffer_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index) { + mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_bytearray)); + const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); + + mp_buffer_info_t haystack_bufinfo; + mp_get_buffer_raise(args[0], &haystack_bufinfo, MP_BUFFER_READ); + + mp_buffer_info_t needle_bufinfo; + mp_get_buffer_raise(args[1], &needle_bufinfo, MP_BUFFER_READ); + + if (mp_binary_get_size('@', needle_bufinfo.typecode, NULL) != 1) { + const qstr src_name = mp_obj_get_type(args[1])->name; + nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, + translate("'%q' object is not bytes-like"), + src_name)); + } + + const byte *start = haystack_bufinfo.buf; + const byte *end = haystack_bufinfo.buf + haystack_bufinfo.len; + if (n_args >= 3 && args[2] != mp_const_none) { + start += mp_get_index(self_type, haystack_bufinfo.len, args[2], true); + } + if (n_args >= 4 && args[3] != mp_const_none) { + end = haystack_bufinfo.buf + mp_get_index(self_type, haystack_bufinfo.len, args[3], true); + } + + const byte *p = NULL; + if (end >= start) { + p = find_subbytes(start, end - start, needle_bufinfo.buf, needle_bufinfo.len, direction); + } + + if (p == NULL) { + if (is_index) { + mp_raise_ValueError(translate("substring not found")); + } else { + return MP_OBJ_NEW_SMALL_INT(-1); + } + } + return MP_OBJ_NEW_SMALL_INT(p - (const byte*) haystack_bufinfo.buf); +} + +STATIC mp_obj_t buffer_find(size_t n_args, const mp_obj_t *args) { + return buffer_finder(n_args, args, 1, false); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_find_obj, 2, 4, buffer_find); + +STATIC mp_obj_t buffer_rfind(size_t n_args, const mp_obj_t *args) { + return buffer_finder(n_args, args, -1, false); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_rfind_obj, 2, 4, buffer_rfind); + +STATIC mp_obj_t buffer_index(size_t n_args, const mp_obj_t *args) { + return buffer_finder(n_args, args, 1, true); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_index_obj, 2, 4, buffer_index); + +STATIC mp_obj_t buffer_rindex(size_t n_args, const mp_obj_t *args) { + return buffer_finder(n_args, args, -1, true); +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_rindex_obj, 2, 4, buffer_rindex); + +#endif + STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { if (value == MP_OBJ_NULL) { // delete item @@ -580,6 +644,12 @@ STATIC MP_DEFINE_CONST_DICT(array_locals_dict, array_locals_dict_table); STATIC const mp_rom_map_elem_t bytearray_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&array_append_obj) }, { MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&array_extend_obj) }, + + { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&buffer_find_obj) }, + { MP_ROM_QSTR(MP_QSTR_rfind), MP_ROM_PTR(&buffer_rfind_obj) }, + { MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&buffer_index_obj) }, + { MP_ROM_QSTR(MP_QSTR_rindex), MP_ROM_PTR(&buffer_rindex_obj) }, + #if MICROPY_CPYTHON_COMPAT { MP_ROM_QSTR(MP_QSTR_decode), MP_ROM_PTR(&array_decode_obj) }, #endif From 384a7f7e70e68366f7a632a98aebbe21730888ba Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 15 Jul 2020 17:57:28 -0700 Subject: [PATCH 216/277] Move release note converter to latest markdown helper lib --- tools/convert_release_notes.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tools/convert_release_notes.py b/tools/convert_release_notes.py index 4b16f005ec..797e71834b 100644 --- a/tools/convert_release_notes.py +++ b/tools/convert_release_notes.py @@ -4,13 +4,14 @@ import sys import mistune +import mistune.renderers print(sys.argv[1]) with open(sys.argv[1], "r") as source_file: source = source_file.read() -html = mistune.Markdown() +html = mistune.create_markdown() print() print("HTML") @@ -19,39 +20,39 @@ print("From the GitHub release page:\n
") print(html(source)) print("
") -class AdafruitBBCodeRenderer: - def __init__(self, **kwargs): - self.options = kwargs - +class AdafruitBBCodeRenderer(mistune.renderers.BaseRenderer): def placeholder(self): return '' def paragraph(self, text): return text + "\n\n" + def block_text(self, text): + return text + def text(self, text): return text def link(self, link, title, text): - return "[url={}]{}[/url]".format(link, text) + return "[url={}]{}[/url]".format(link, title) def autolink(self, link, is_email): if not is_email: return "[url={}]{}[/url]".format(link, link) return link - def header(self, text, level, raw): + def heading(self, text, level): return "[b][size=150]{}[/size][/b]\n".format(text) def codespan(self, text): return "[color=#E74C3C][size=95]{}[/size][/color]".format(text) - def list_item(self, text): + def list_item(self, text, level): return "[*]{}[/*]\n".format(text.strip()) - def list(self, body, ordered=True): + def list(self, text, ordered, level, start=None): ordered_indicator = "=" if ordered else "" - return "[list{}]\n{}[/list]".format(ordered_indicator, body) + return "[list{}]\n{}[/list]".format(ordered_indicator, text) def double_emphasis(self, text): return "[b]{}[/b]".format(text) @@ -59,7 +60,10 @@ class AdafruitBBCodeRenderer: def emphasis(self, text): return "[b]{}[/b]".format(text) -bbcode = mistune.Markdown(renderer=AdafruitBBCodeRenderer()) + def strong(self, text): + return "[i]{}[/i]".format(text) + +bbcode = mistune.create_markdown(renderer=AdafruitBBCodeRenderer()) print() print("BBCode") From 518d909b2c20aed5b3ff1ca849731cdadea4ba4c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 15 Jul 2020 17:58:38 -0700 Subject: [PATCH 217/277] Add memorymonitor module --- py/circuitpy_defns.mk | 6 + py/circuitpy_mpconfig.h | 12 + py/circuitpy_mpconfig.mk | 3 + py/gc.c | 16 ++ .../memorymonitor/AllocationAlarm.c | 113 +++++++++ .../memorymonitor/AllocationAlarm.h | 38 +++ .../memorymonitor/AllocationSize.c | 222 ++++++++++++++++++ .../memorymonitor/AllocationSize.h | 42 ++++ shared-bindings/memorymonitor/__init__.c | 77 ++++++ shared-bindings/memorymonitor/__init__.h | 49 ++++ shared-module/memorymonitor/AllocationAlarm.c | 73 ++++++ shared-module/memorymonitor/AllocationAlarm.h | 49 ++++ shared-module/memorymonitor/AllocationSize.c | 87 +++++++ shared-module/memorymonitor/AllocationSize.h | 50 ++++ shared-module/memorymonitor/__init__.c | 34 +++ shared-module/memorymonitor/__init__.h | 34 +++ 16 files changed, 905 insertions(+) create mode 100644 shared-bindings/memorymonitor/AllocationAlarm.c create mode 100644 shared-bindings/memorymonitor/AllocationAlarm.h create mode 100644 shared-bindings/memorymonitor/AllocationSize.c create mode 100644 shared-bindings/memorymonitor/AllocationSize.h create mode 100644 shared-bindings/memorymonitor/__init__.c create mode 100644 shared-bindings/memorymonitor/__init__.h create mode 100644 shared-module/memorymonitor/AllocationAlarm.c create mode 100644 shared-module/memorymonitor/AllocationAlarm.h create mode 100644 shared-module/memorymonitor/AllocationSize.c create mode 100644 shared-module/memorymonitor/AllocationSize.h create mode 100644 shared-module/memorymonitor/__init__.c create mode 100644 shared-module/memorymonitor/__init__.h diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 815ee2e62b..a39e0c9ddf 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -174,6 +174,9 @@ endif ifeq ($(CIRCUITPY__EVE),1) SRC_PATTERNS += _eve/% endif +ifeq ($(CIRCUITPY_MEMORYMONITOR),1) +SRC_PATTERNS += memorymonitor/% +endif ifeq ($(CIRCUITPY_MICROCONTROLLER),1) SRC_PATTERNS += microcontroller/% endif @@ -398,6 +401,9 @@ SRC_SHARED_MODULE_ALL = \ gamepad/__init__.c \ gamepadshift/GamePadShift.c \ gamepadshift/__init__.c \ + memorymonitor/__init__.c \ + memorymonitor/AllocationAlarm.c \ + memorymonitor/AllocationSize.c \ network/__init__.c \ os/__init__.c \ random/__init__.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index d05a246fce..3c2df37ffc 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -429,6 +429,16 @@ extern const struct _mp_obj_module_t _eve_module; #define _EVE_MODULE #endif +#if CIRCUITPY_MEMORYMONITOR +extern const struct _mp_obj_module_t memorymonitor_module; +#define MEMORYMONITOR_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_memorymonitor), (mp_obj_t)&memorymonitor_module }, +#define MEMORYMONITOR_ROOT_POINTERS mp_obj_t active_allocationsizes; \ + mp_obj_t active_allocationalarms; +#else +#define MEMORYMONITOR_MODULE +#define MEMORYMONITOR_ROOT_POINTERS +#endif + #if CIRCUITPY_MICROCONTROLLER extern const struct _mp_obj_module_t microcontroller_module; #define MICROCONTROLLER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)µcontroller_module }, @@ -708,6 +718,7 @@ extern const struct _mp_obj_module_t watchdog_module; JSON_MODULE \ MATH_MODULE \ _EVE_MODULE \ + MEMORYMONITOR_MODULE \ MICROCONTROLLER_MODULE \ NEOPIXEL_WRITE_MODULE \ NETWORK_MODULE \ @@ -765,6 +776,7 @@ extern const struct _mp_obj_module_t watchdog_module; mp_obj_t terminal_tilegrid_tiles; \ BOARD_UART_ROOT_POINTER \ FLASH_ROOT_POINTERS \ + MEMORYMONITOR_ROOT_POINTERS \ NETWORK_ROOT_POINTERS \ void supervisor_run_background_tasks_if_tick(void); diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 2d4a5ecee9..baa29e26b4 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -118,6 +118,9 @@ CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH) CIRCUITPY__EVE ?= 0 CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE) +CIRCUITPY_MEMORYMONITOR ?= 0 +CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR) + CIRCUITPY_MICROCONTROLLER ?= 1 CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER) diff --git a/py/gc.c b/py/gc.c index 2f3f63522e..0f08ffb2e3 100755 --- a/py/gc.c +++ b/py/gc.c @@ -33,6 +33,10 @@ #include "supervisor/shared/safe_mode.h" +#if CIRCUITPY_MEMORYMONITOR +#include "shared-module/memorymonitor/AllocationSize.h" +#endif + #if MICROPY_ENABLE_GC #if MICROPY_DEBUG_VERBOSE // print debugging info @@ -653,6 +657,10 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) { gc_dump_alloc_table(); #endif + #if CIRCUITPY_MEMORYMONITOR + memorymonitor_allocationsizes_track_allocation(end_block - start_block + 1); + #endif + return ret_ptr; } @@ -906,6 +914,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { gc_log_change(block, new_blocks); #endif + #if CIRCUITPY_MEMORYMONITOR + memorymonitor_allocationsizes_track_allocation(new_blocks); + #endif + return ptr_in; } @@ -935,6 +947,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { gc_log_change(block, new_blocks); #endif + #if CIRCUITPY_MEMORYMONITOR + memorymonitor_allocationsizes_track_allocation(new_blocks); + #endif + return ptr_in; } diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c new file mode 100644 index 0000000000..836bf78333 --- /dev/null +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -0,0 +1,113 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/runtime0.h" +#include "shared-bindings/memorymonitor/AllocationAlarm.h" +#include "shared-bindings/util.h" +#include "supervisor/shared/translate.h" + +//| class AllocationAlarm: +//| +//| def __init__(self, *, minimum_block_count=1): +//| """Throw an exception when an allocation of ``minimum_block_count`` or more blocks +//| occurs while active. +//| +//| Track allocations:: +//| +//| import memorymonitor +//| +//| aa = memorymonitor.AllocationAlarm(minimum_block_count=2) +//| x = 2 +//| # Should not allocate any blocks. +//| with aa: +//| x = 5 +//| +//| # Should throw an exception when allocating storage for the 20 bytes. +//| with aa: +//| x = bytearray(20) +//| +//| """ +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_minimum_block_count }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_minimum_block_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + }; + 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); + mp_int_t minimum_block_count = args[ARG_minimum_block_count].u_int; + if (minimum_block_count < 1) { + mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_minimum_block_count); + } + + memorymonitor_allocationalarm_obj_t *self = m_new_obj(memorymonitor_allocationalarm_obj_t); + self->base.type = &memorymonitor_allocationalarm_type; + + common_hal_memorymonitor_allocationalarm_construct(self, minimum_block_count); + + return MP_OBJ_FROM_PTR(self); +} + +//| def __enter__(self) -> memorymonitor.AllocationAlarm: +//| """Enables the alarm.""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationalarm_obj___enter__(mp_obj_t self_in) { + common_hal_memorymonitor_allocationalarm_resume(self_in); + return self_in; +} +MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationalarm___enter___obj, memorymonitor_allocationalarm_obj___enter__); + +//| def __exit__(self) -> None: +//| """Automatically disables the allocation alarm when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationalarm_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + common_hal_memorymonitor_allocationalarm_pause(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationalarm___exit___obj, 4, 4, memorymonitor_allocationalarm_obj___exit__); + +STATIC const mp_rom_map_elem_t memorymonitor_allocationalarm_locals_dict_table[] = { + // Methods + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&memorymonitor_allocationalarm___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&memorymonitor_allocationalarm___exit___obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(memorymonitor_allocationalarm_locals_dict, memorymonitor_allocationalarm_locals_dict_table); + +const mp_obj_type_t memorymonitor_allocationalarm_type = { + { &mp_type_type }, + .name = MP_QSTR_AllocationAlarm, + .make_new = memorymonitor_allocationalarm_make_new, + .locals_dict = (mp_obj_dict_t*)&memorymonitor_allocationalarm_locals_dict, +}; diff --git a/shared-bindings/memorymonitor/AllocationAlarm.h b/shared-bindings/memorymonitor/AllocationAlarm.h new file mode 100644 index 0000000000..40f5a48c5b --- /dev/null +++ b/shared-bindings/memorymonitor/AllocationAlarm.h @@ -0,0 +1,38 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H + +#include "shared-module/memorymonitor/AllocationAlarm.h" + +extern const mp_obj_type_t memorymonitor_allocationalarm_type; + +void common_hal_memorymonitor_allocationalarm_construct(memorymonitor_allocationalarm_obj_t* self, size_t minimum_block_count); +void common_hal_memorymonitor_allocationalarm_pause(memorymonitor_allocationalarm_obj_t* self); +void common_hal_memorymonitor_allocationalarm_resume(memorymonitor_allocationalarm_obj_t* self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c new file mode 100644 index 0000000000..411e27e157 --- /dev/null +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -0,0 +1,222 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/runtime0.h" +#include "shared-bindings/memorymonitor/AllocationSize.h" +#include "shared-bindings/util.h" +#include "supervisor/shared/translate.h" + +//| class AllocationSize: +//| +//| def __init__(self): +//| """Tracks the number of allocations in power of two buckets. +//| +//| It will have 32 16bit buckets to track allocation counts. It is total allocations +//| meaning frees are ignored. Reallocated memory is counted twice, at allocation and when +//| reallocated with the larger size. +//| +//| The buckets are measured in terms of blocks which is the finest granularity of the heap. +//| This means bucket 0 will count all allocations less than or equal to the number of bytes +//| per block, typically 16. Bucket 2 will be less than or equal to 4 blocks. See +//| `bytes_per_block` to convert blocks to bytes. +//| +//| Multiple AllocationSizes can be used to track different boundaries. +//| +//| Active AllocationSizes will not be freed so make sure and pause before deleting. +//| +//| Track allocations:: +//| +//| import memorymonitor +//| +//| mm = memorymonitor.AllocationSizes() +//| print("hello world" * 3) +//| mm.pause() +//| for bucket in mm: +//| print("<", 2 ** bucket, mm[bucket]) +//| +//| # Clear the buckets +//| mm.clear() +//| +//| # Resume allocation tracking +//| mm.resume()""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + memorymonitor_allocationsize_obj_t *self = m_new_obj(memorymonitor_allocationsize_obj_t); + self->base.type = &memorymonitor_allocationsize_type; + + common_hal_memorymonitor_allocationsize_construct(self); + + return MP_OBJ_FROM_PTR(self); +} + +//| def __enter__(self, ) -> Any: +//| """No-op used by Context Managers.""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) { + common_hal_memorymonitor_allocationsize_resume(self_in); + return self_in; +} +MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize___enter___obj, memorymonitor_allocationsize_obj___enter__); + +//| def __exit__(self, ) -> Any: +//| """Automatically pauses allocation tracking when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + common_hal_memorymonitor_allocationsize_pause(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit___obj, 4, 4, memorymonitor_allocationsize_obj___exit__); + +//| def pause(self) -> None: +//| """Pause allocation tracking""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_obj_pause(mp_obj_t self_in) { + memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); + + common_hal_memorymonitor_allocationsize_pause(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_pause_obj, memorymonitor_allocationsize_obj_pause); + +//| def resume(self) -> None: +//| """Resumes allocation tracking.""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_obj_resume(mp_obj_t self_in) { + common_hal_memorymonitor_allocationsize_resume(self_in); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_resume_obj, memorymonitor_allocationsize_obj_resume); + +//| def clear(self) -> Any: +//| """Clears all captured pulses""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_obj_clear(mp_obj_t self_in) { + memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); + + common_hal_memorymonitor_allocationsize_clear(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_clear_obj, memorymonitor_allocationsize_obj_clear); + + +//| bytes_per_block: int = ... +//| """Number of bytes per block""" +//| +STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) { + memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); + + return mp_obj_new_bool(common_hal_memorymonitor_allocationsize_get_bytes_per_block(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_get_bytes_per_block_obj, memorymonitor_allocationsize_obj_get_bytes_per_block); + +const mp_obj_property_t memorymonitor_allocationsize_bytes_per_block_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&memorymonitor_allocationsize_get_bytes_per_block_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| def __len__(self, ) -> Any: +//| """Returns the current pulse length +//| +//| This allows you to:: +//| +//| pulses = pulseio.PulseIn(pin) +//| print(len(pulses))""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint16_t len = common_hal_memorymonitor_allocationsize_get_len(self); + switch (op) { + case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); + case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); + default: return MP_OBJ_NULL; // op not supported + } +} + +//| def __getitem__(self, index: Any) -> Any: +//| """Returns the value at the given index or values in slice. +//| +//| This allows you to:: +//| +//| pulses = pulseio.PulseIn(pin) +//| print(pulses[0])""" +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationsize_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) { + if (value == mp_const_none) { + // delete item + mp_raise_AttributeError(translate("Cannot delete values")); + } else { + memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); + + if (MP_OBJ_IS_TYPE(index_obj, &mp_type_slice)) { + mp_raise_NotImplementedError(translate("Slices not supported")); + } else { + size_t index = mp_get_index(&memorymonitor_allocationsize_type, common_hal_memorymonitor_allocationsize_get_len(self), index_obj, false); + if (value == MP_OBJ_SENTINEL) { + // load + return MP_OBJ_NEW_SMALL_INT(common_hal_memorymonitor_allocationsize_get_item(self, index)); + } else { + mp_raise_AttributeError(translate("Read-only")); + } + } + } + return mp_const_none; +} + +STATIC const mp_rom_map_elem_t memorymonitor_allocationsize_locals_dict_table[] = { + // Methods + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&memorymonitor_allocationsize___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&memorymonitor_allocationsize___exit___obj) }, + + // Properties + { MP_ROM_QSTR(MP_QSTR_bytes_per_block), MP_ROM_PTR(&memorymonitor_allocationsize_bytes_per_block_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(memorymonitor_allocationsize_locals_dict, memorymonitor_allocationsize_locals_dict_table); + +const mp_obj_type_t memorymonitor_allocationsize_type = { + { &mp_type_type }, + .name = MP_QSTR_AllocationSize, + .make_new = memorymonitor_allocationsize_make_new, + .subscr = memorymonitor_allocationsize_subscr, + .unary_op = memorymonitor_allocationsize_unary_op, + .getiter = mp_obj_new_generic_iterator, + .locals_dict = (mp_obj_dict_t*)&memorymonitor_allocationsize_locals_dict, +}; diff --git a/shared-bindings/memorymonitor/AllocationSize.h b/shared-bindings/memorymonitor/AllocationSize.h new file mode 100644 index 0000000000..bcd9514bf2 --- /dev/null +++ b/shared-bindings/memorymonitor/AllocationSize.h @@ -0,0 +1,42 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONSIZE_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONSIZE_H + +#include "shared-module/memorymonitor/AllocationSize.h" + +extern const mp_obj_type_t memorymonitor_allocationsize_type; + +extern void common_hal_memorymonitor_allocationsize_construct(memorymonitor_allocationsize_obj_t* self); +extern void common_hal_memorymonitor_allocationsize_pause(memorymonitor_allocationsize_obj_t* self); +extern void common_hal_memorymonitor_allocationsize_resume(memorymonitor_allocationsize_obj_t* self); +extern void common_hal_memorymonitor_allocationsize_clear(memorymonitor_allocationsize_obj_t* self); +extern size_t common_hal_memorymonitor_allocationsize_get_bytes_per_block(memorymonitor_allocationsize_obj_t* self); +extern uint16_t common_hal_memorymonitor_allocationsize_get_len(memorymonitor_allocationsize_obj_t* self); +extern uint16_t common_hal_memorymonitor_allocationsize_get_item(memorymonitor_allocationsize_obj_t* self, int16_t index); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONSIZE_H diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c new file mode 100644 index 0000000000..bfd5bf6d83 --- /dev/null +++ b/shared-bindings/memorymonitor/__init__.c @@ -0,0 +1,77 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/memorymonitor/__init__.h" +#include "shared-bindings/memorymonitor/AllocationAlarm.h" +#include "shared-bindings/memorymonitor/AllocationSize.h" + +//| """Memory monitoring helpers""" +//| + +//| class AllocationException: +//| def __init__(self, Exception: Any): +//| """Catch all exception for Bluetooth related errors.""" +//| ... +MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception) + +NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* fmt, ...) { + va_list argptr; + va_start(argptr,fmt); + mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_memorymonitor_AllocationError, fmt, argptr); + va_end(argptr); + nlr_raise(exception); +} + +STATIC const mp_rom_map_elem_t memorymonitor_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_memorymonitor) }, + { MP_ROM_QSTR(MP_QSTR_AllocationAlarm), MP_ROM_PTR(&memorymonitor_allocationalarm_type) }, + { MP_ROM_QSTR(MP_QSTR_AllocationSize), MP_ROM_PTR(&memorymonitor_allocationsize_type) }, + + // Errors + { MP_ROM_QSTR(MP_QSTR_AllocationError), MP_ROM_PTR(&mp_type_memorymonitor_AllocationError) }, +}; + +STATIC MP_DEFINE_CONST_DICT(memorymonitor_module_globals, memorymonitor_module_globals_table); + +void memorymonitor_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { + mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS; + bool is_subclass = kind & PRINT_EXC_SUBCLASS; + if (!is_subclass && (k == PRINT_EXC)) { + mp_print_str(print, qstr_str(MP_OBJ_QSTR_VALUE(memorymonitor_module_globals_table[0].value))); + mp_print_str(print, "."); + } + mp_obj_exception_print(print, o_in, kind); +} + +const mp_obj_module_t memorymonitor_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&memorymonitor_module_globals, +}; diff --git a/shared-bindings/memorymonitor/__init__.h b/shared-bindings/memorymonitor/__init__.h new file mode 100644 index 0000000000..60fcdc3f62 --- /dev/null +++ b/shared-bindings/memorymonitor/__init__.h @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR___INIT___H + +#include "py/obj.h" + + +void memorymonitor_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); + +#define MP_DEFINE_MEMORYMONITOR_EXCEPTION(exc_name, base_name) \ +const mp_obj_type_t mp_type_memorymonitor_ ## exc_name = { \ + { &mp_type_type }, \ + .name = MP_QSTR_ ## exc_name, \ + .print = memorymonitor_exception_print, \ + .make_new = mp_obj_exception_make_new, \ + .attr = mp_obj_exception_attr, \ + .parent = &mp_type_ ## base_name, \ +}; + +extern const mp_obj_type_t mp_type_memorymonitor_AllocationError; + +NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* msg, ...); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR___INIT___H diff --git a/shared-module/memorymonitor/AllocationAlarm.c b/shared-module/memorymonitor/AllocationAlarm.c new file mode 100644 index 0000000000..bbd33f2b04 --- /dev/null +++ b/shared-module/memorymonitor/AllocationAlarm.c @@ -0,0 +1,73 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/memorymonitor/__init__.h" +#include "shared-bindings/memorymonitor/AllocationAlarm.h" + +#include "py/gc.h" +#include "py/mpstate.h" +#include "py/runtime.h" + +void common_hal_memorymonitor_allocationalarm_construct(memorymonitor_allocationalarm_obj_t* self, size_t minimum_block_count) { + self->minimum_block_count = minimum_block_count; + self->next = NULL; + self->previous = NULL; +} + +void common_hal_memorymonitor_allocationalarm_pause(memorymonitor_allocationalarm_obj_t* self) { + *self->previous = self->next; + self->next = NULL; + self->previous = NULL; +} + +void common_hal_memorymonitor_allocationalarm_resume(memorymonitor_allocationalarm_obj_t* self) { + if (self->previous != NULL) { + mp_raise_RuntimeError(translate("Already running")); + } + self->next = MP_STATE_VM(active_allocationalarms); + self->previous = (memorymonitor_allocationalarm_obj_t**) &MP_STATE_VM(active_allocationalarms); + if (self->next != NULL) { + self->next->previous = &self->next; + } + MP_STATE_VM(active_allocationalarms) = self; +} + +void memorymonitor_allocationalarms_allocation(size_t block_count) { + memorymonitor_allocationalarm_obj_t* alarm = MP_OBJ_TO_PTR(MP_STATE_VM(active_allocationalarms)); + size_t alert_count = 0; + while (alarm != NULL) { + // Hold onto next in case we remove the alarm from the list. + memorymonitor_allocationalarm_obj_t* next = alarm->next; + if (block_count >= alarm->minimum_block_count) { + common_hal_memorymonitor_allocationalarm_pause(alarm); + alert_count++; + } + alarm = next; + } + if (alert_count > 0) { + mp_raise_memorymonitor_AllocationError(translate("Attempt to allocate %d blocks"), block_count); + } +} diff --git a/shared-module/memorymonitor/AllocationAlarm.h b/shared-module/memorymonitor/AllocationAlarm.h new file mode 100644 index 0000000000..ebdc0d8015 --- /dev/null +++ b/shared-module/memorymonitor/AllocationAlarm.h @@ -0,0 +1,49 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONALARM_H +#define MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONALARM_H + +#include +#include + +#include "py/obj.h" + +typedef struct _memorymonitor_allocationalarm_obj_t memorymonitor_allocationalarm_obj_t; + +#define ALLOCATION_SIZE_BUCKETS 16 + +typedef struct _memorymonitor_allocationalarm_obj_t { + mp_obj_base_t base; + size_t minimum_block_count; + // Store the location that points to us so we can remove ourselves. + memorymonitor_allocationalarm_obj_t** previous; + memorymonitor_allocationalarm_obj_t* next; +} memorymonitor_allocationalarm_obj_t; + +void memorymonitor_allocationalarms_allocation(size_t block_count); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONALARM_H diff --git a/shared-module/memorymonitor/AllocationSize.c b/shared-module/memorymonitor/AllocationSize.c new file mode 100644 index 0000000000..fb11471fd4 --- /dev/null +++ b/shared-module/memorymonitor/AllocationSize.c @@ -0,0 +1,87 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/memorymonitor/AllocationSize.h" + +#include "py/gc.h" +#include "py/mpstate.h" +#include "py/runtime.h" + +void common_hal_memorymonitor_allocationsize_construct(memorymonitor_allocationsize_obj_t* self) { + common_hal_memorymonitor_allocationsize_clear(self); + self->next = NULL; + self->previous = NULL; +} + +void common_hal_memorymonitor_allocationsize_pause(memorymonitor_allocationsize_obj_t* self) { + *self->previous = self->next; + self->next = NULL; + self->previous = NULL; +} + +void common_hal_memorymonitor_allocationsize_resume(memorymonitor_allocationsize_obj_t* self) { + if (self->previous != NULL) { + mp_raise_RuntimeError(translate("Already running")); + } + self->next = MP_STATE_VM(active_allocationsizes); + self->previous = (memorymonitor_allocationsize_obj_t**) &MP_STATE_VM(active_allocationsizes); + if (self->next != NULL) { + self->next->previous = &self->next; + } + MP_STATE_VM(active_allocationsizes) = self; +} + +void common_hal_memorymonitor_allocationsize_clear(memorymonitor_allocationsize_obj_t* self) { + for (size_t i = 0; i < ALLOCATION_SIZE_BUCKETS; i++) { + self->buckets[i] = 0; + } +} + +uint16_t common_hal_memorymonitor_allocationsize_get_len(memorymonitor_allocationsize_obj_t* self) { + return ALLOCATION_SIZE_BUCKETS; +} + +size_t common_hal_memorymonitor_allocationsize_get_bytes_per_block(memorymonitor_allocationsize_obj_t* self) { + return BYTES_PER_BLOCK; +} + +uint16_t common_hal_memorymonitor_allocationsize_get_item(memorymonitor_allocationsize_obj_t* self, int16_t index) { + return self->buckets[index]; +} + +void memorymonitor_allocationsizes_track_allocation(size_t block_count) { + memorymonitor_allocationsize_obj_t* as = MP_OBJ_TO_PTR(MP_STATE_VM(active_allocationsizes)); + size_t power_of_two = 0; + block_count >>= 1; + while (block_count != 0) { + power_of_two++; + block_count >>= 1; + } + while (as != NULL) { + as->buckets[power_of_two]++; + as = as->next; + } +} diff --git a/shared-module/memorymonitor/AllocationSize.h b/shared-module/memorymonitor/AllocationSize.h new file mode 100644 index 0000000000..3fa4e04652 --- /dev/null +++ b/shared-module/memorymonitor/AllocationSize.h @@ -0,0 +1,50 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONSIZE_H +#define MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONSIZE_H + +#include +#include + +#include "py/obj.h" + +typedef struct _memorymonitor_allocationsize_obj_t memorymonitor_allocationsize_obj_t; + +#define ALLOCATION_SIZE_BUCKETS 16 + +typedef struct _memorymonitor_allocationsize_obj_t { + mp_obj_base_t base; + uint16_t buckets[ALLOCATION_SIZE_BUCKETS]; + // Store the location that points to us so we can remove ourselves. + memorymonitor_allocationsize_obj_t** previous; + memorymonitor_allocationsize_obj_t* next; + bool paused; +} memorymonitor_allocationsize_obj_t; + +void memorymonitor_allocationsizes_track_allocation(size_t block_count); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONSIZE_H diff --git a/shared-module/memorymonitor/__init__.c b/shared-module/memorymonitor/__init__.c new file mode 100644 index 0000000000..4c24c25879 --- /dev/null +++ b/shared-module/memorymonitor/__init__.c @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-module/memorymonitor/__init__.h" +#include "shared-module/memorymonitor/AllocationAlarm.h" +#include "shared-module/memorymonitor/AllocationSize.h" + +void memorymonitor_track_allocation(size_t block_count) { + memorymonitor_allocationalarms_allocation(block_count); + memorymonitor_allocationsizes_track_allocation(block_count); +} diff --git a/shared-module/memorymonitor/__init__.h b/shared-module/memorymonitor/__init__.h new file mode 100644 index 0000000000..cf76f88f86 --- /dev/null +++ b/shared-module/memorymonitor/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_MEMORYMONITOR___INIT___H +#define MICROPY_INCLUDED_MEMORYMONITOR___INIT___H + +#include + +void memorymonitor_track_allocation(size_t block_count); + +#endif // MICROPY_INCLUDED_MEMORYMONITOR___INIT___H From a1e4814a27713bd08b836cbae2afa9c858bfd4e4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 16 Jul 2020 19:01:43 -0700 Subject: [PATCH 218/277] Get AllocationAlarm working --- main.c | 7 ++++ py/gc.c | 8 ++-- .../memorymonitor/AllocationAlarm.c | 2 + .../memorymonitor/AllocationSize.c | 38 +------------------ shared-module/memorymonitor/AllocationAlarm.c | 13 +++++++ shared-module/memorymonitor/AllocationAlarm.h | 1 + shared-module/memorymonitor/AllocationSize.c | 4 ++ shared-module/memorymonitor/AllocationSize.h | 1 + shared-module/memorymonitor/__init__.c | 5 +++ shared-module/memorymonitor/__init__.h | 1 + 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/main.c b/main.c index f928d0d62f..5ad146c9ce 100755 --- a/main.c +++ b/main.c @@ -64,6 +64,10 @@ #include "shared-module/displayio/__init__.h" #endif +#if CIRCUITPY_MEMORYMONITOR +#include "shared-module/memorymonitor/__init__.h" +#endif + #if CIRCUITPY_NETWORK #include "shared-module/network/__init__.h" #endif @@ -198,6 +202,9 @@ void cleanup_after_vm(supervisor_allocation* heap) { #if CIRCUITPY_DISPLAYIO reset_displays(); #endif + #if CIRCUITPY_MEMORYMONITOR + memorymonitor_reset(); + #endif filesystem_flush(); stop_mp(); free_memory(heap); diff --git a/py/gc.c b/py/gc.c index 0f08ffb2e3..69327060f7 100755 --- a/py/gc.c +++ b/py/gc.c @@ -34,7 +34,7 @@ #include "supervisor/shared/safe_mode.h" #if CIRCUITPY_MEMORYMONITOR -#include "shared-module/memorymonitor/AllocationSize.h" +#include "shared-module/memorymonitor/__init__.h" #endif #if MICROPY_ENABLE_GC @@ -658,7 +658,7 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) { #endif #if CIRCUITPY_MEMORYMONITOR - memorymonitor_allocationsizes_track_allocation(end_block - start_block + 1); + memorymonitor_track_allocation(end_block - start_block + 1); #endif return ret_ptr; @@ -915,7 +915,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { #endif #if CIRCUITPY_MEMORYMONITOR - memorymonitor_allocationsizes_track_allocation(new_blocks); + memorymonitor_track_allocation(new_blocks); #endif return ptr_in; @@ -948,7 +948,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { #endif #if CIRCUITPY_MEMORYMONITOR - memorymonitor_allocationsizes_track_allocation(new_blocks); + memorymonitor_track_allocation(new_blocks); #endif return ptr_in; diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c index 836bf78333..71a156f328 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.c +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -76,6 +76,8 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type return MP_OBJ_FROM_PTR(self); } +// TODO: Add .countdown(count) to skip allocations and alarm on something after the first. + //| def __enter__(self) -> memorymonitor.AllocationAlarm: //| """Enables the alarm.""" //| ... diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index 411e27e157..25ecae97b8 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -82,6 +82,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, //| ... //| STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) { + common_hal_memorymonitor_allocationsize_clear(self_in); common_hal_memorymonitor_allocationsize_resume(self_in); return self_in; } @@ -99,48 +100,13 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const m } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit___obj, 4, 4, memorymonitor_allocationsize_obj___exit__); -//| def pause(self) -> None: -//| """Pause allocation tracking""" -//| ... -//| -STATIC mp_obj_t memorymonitor_allocationsize_obj_pause(mp_obj_t self_in) { - memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); - - common_hal_memorymonitor_allocationsize_pause(self); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_pause_obj, memorymonitor_allocationsize_obj_pause); - -//| def resume(self) -> None: -//| """Resumes allocation tracking.""" -//| ... -//| -STATIC mp_obj_t memorymonitor_allocationsize_obj_resume(mp_obj_t self_in) { - common_hal_memorymonitor_allocationsize_resume(self_in); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_resume_obj, memorymonitor_allocationsize_obj_resume); - -//| def clear(self) -> Any: -//| """Clears all captured pulses""" -//| ... -//| -STATIC mp_obj_t memorymonitor_allocationsize_obj_clear(mp_obj_t self_in) { - memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); - - common_hal_memorymonitor_allocationsize_clear(self); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_clear_obj, memorymonitor_allocationsize_obj_clear); - - //| bytes_per_block: int = ... //| """Number of bytes per block""" //| STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) { memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_bool(common_hal_memorymonitor_allocationsize_get_bytes_per_block(self)); + return MP_OBJ_NEW_SMALL_INT(common_hal_memorymonitor_allocationsize_get_bytes_per_block(self)); } MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_get_bytes_per_block_obj, memorymonitor_allocationsize_obj_get_bytes_per_block); diff --git a/shared-module/memorymonitor/AllocationAlarm.c b/shared-module/memorymonitor/AllocationAlarm.c index bbd33f2b04..ed7ab75ab2 100644 --- a/shared-module/memorymonitor/AllocationAlarm.c +++ b/shared-module/memorymonitor/AllocationAlarm.c @@ -38,6 +38,11 @@ void common_hal_memorymonitor_allocationalarm_construct(memorymonitor_allocation } void common_hal_memorymonitor_allocationalarm_pause(memorymonitor_allocationalarm_obj_t* self) { + // Check to make sure we aren't already paused. We can be if we're exiting from an exception we + // caused. + if (self->previous == NULL) { + return; + } *self->previous = self->next; self->next = NULL; self->previous = NULL; @@ -62,6 +67,10 @@ void memorymonitor_allocationalarms_allocation(size_t block_count) { // Hold onto next in case we remove the alarm from the list. memorymonitor_allocationalarm_obj_t* next = alarm->next; if (block_count >= alarm->minimum_block_count) { + // Uncomment the breakpoint below if you want to use a C debugger to figure out the C + // call stack for an allocation. + // asm("bkpt"); + // Pause now because we may alert when throwing the exception too. common_hal_memorymonitor_allocationalarm_pause(alarm); alert_count++; } @@ -71,3 +80,7 @@ void memorymonitor_allocationalarms_allocation(size_t block_count) { mp_raise_memorymonitor_AllocationError(translate("Attempt to allocate %d blocks"), block_count); } } + +void memorymonitor_allocationalarms_reset(void) { + MP_STATE_VM(active_allocationalarms) = NULL; +} diff --git a/shared-module/memorymonitor/AllocationAlarm.h b/shared-module/memorymonitor/AllocationAlarm.h index ebdc0d8015..95381c6609 100644 --- a/shared-module/memorymonitor/AllocationAlarm.h +++ b/shared-module/memorymonitor/AllocationAlarm.h @@ -45,5 +45,6 @@ typedef struct _memorymonitor_allocationalarm_obj_t { } memorymonitor_allocationalarm_obj_t; void memorymonitor_allocationalarms_allocation(size_t block_count); +void memorymonitor_allocationalarms_reset(void); #endif // MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONALARM_H diff --git a/shared-module/memorymonitor/AllocationSize.c b/shared-module/memorymonitor/AllocationSize.c index fb11471fd4..c28e65592c 100644 --- a/shared-module/memorymonitor/AllocationSize.c +++ b/shared-module/memorymonitor/AllocationSize.c @@ -85,3 +85,7 @@ void memorymonitor_allocationsizes_track_allocation(size_t block_count) { as = as->next; } } + +void memorymonitor_allocationsizes_reset(void) { + MP_STATE_VM(active_allocationsizes) = NULL; +} diff --git a/shared-module/memorymonitor/AllocationSize.h b/shared-module/memorymonitor/AllocationSize.h index 3fa4e04652..3baab2213e 100644 --- a/shared-module/memorymonitor/AllocationSize.h +++ b/shared-module/memorymonitor/AllocationSize.h @@ -46,5 +46,6 @@ typedef struct _memorymonitor_allocationsize_obj_t { } memorymonitor_allocationsize_obj_t; void memorymonitor_allocationsizes_track_allocation(size_t block_count); +void memorymonitor_allocationsizes_reset(void); #endif // MICROPY_INCLUDED_SHARED_MODULE_MEMORYMONITOR_ALLOCATIONSIZE_H diff --git a/shared-module/memorymonitor/__init__.c b/shared-module/memorymonitor/__init__.c index 4c24c25879..6cb424153d 100644 --- a/shared-module/memorymonitor/__init__.c +++ b/shared-module/memorymonitor/__init__.c @@ -32,3 +32,8 @@ void memorymonitor_track_allocation(size_t block_count) { memorymonitor_allocationalarms_allocation(block_count); memorymonitor_allocationsizes_track_allocation(block_count); } + +void memorymonitor_reset(void) { + memorymonitor_allocationalarms_reset(); + memorymonitor_allocationsizes_reset(); +} diff --git a/shared-module/memorymonitor/__init__.h b/shared-module/memorymonitor/__init__.h index cf76f88f86..f47f6434bf 100644 --- a/shared-module/memorymonitor/__init__.h +++ b/shared-module/memorymonitor/__init__.h @@ -30,5 +30,6 @@ #include void memorymonitor_track_allocation(size_t block_count); +void memorymonitor_reset(void); #endif // MICROPY_INCLUDED_MEMORYMONITOR___INIT___H From 07f031c70840352893e7137abbf7d564c3d4a0b7 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 17 Jul 2020 17:02:13 -0700 Subject: [PATCH 219/277] Add ignore() and fix docs --- .../memorymonitor/AllocationAlarm.c | 26 ++++++++++++- .../memorymonitor/AllocationAlarm.h | 1 + .../memorymonitor/AllocationSize.c | 37 ++++++++----------- shared-module/memorymonitor/AllocationAlarm.c | 20 +++++++--- shared-module/memorymonitor/AllocationAlarm.h | 1 + 5 files changed, 56 insertions(+), 29 deletions(-) diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c index 71a156f328..36e2cb5b23 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.c +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -76,7 +76,27 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type return MP_OBJ_FROM_PTR(self); } -// TODO: Add .countdown(count) to skip allocations and alarm on something after the first. +//| def ignore(self, count) -> AllocationAlarm: +//| """Sets the number of applicable allocations to ignore before raising the exception. +//| Automatically set back to zero at context exit. +//| +//| Use it within a ``with`` block:: +//| +//| # Will not alarm because the bytearray allocation will be ignored. +//| with aa.ignore(2): +//| x = bytearray(20) +//| """ +//| ... +//| +STATIC mp_obj_t memorymonitor_allocationalarm_obj_ignore(mp_obj_t self_in, mp_obj_t count_obj) { + mp_int_t count = mp_obj_get_int(count_obj); + if (count < 0) { + mp_raise_ValueError_varg(translate("%q must be >= 0"), MP_QSTR_count); + } + common_hal_memorymonitor_allocationalarm_set_ignore(self_in, count); + return self_in; +} +MP_DEFINE_CONST_FUN_OBJ_2(memorymonitor_allocationalarm_ignore_obj, memorymonitor_allocationalarm_obj_ignore); //| def __enter__(self) -> memorymonitor.AllocationAlarm: //| """Enables the alarm.""" @@ -95,6 +115,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationalarm___enter___obj, memorymon //| STATIC mp_obj_t memorymonitor_allocationalarm_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; + common_hal_memorymonitor_allocationalarm_set_ignore(args[0], 0); common_hal_memorymonitor_allocationalarm_pause(args[0]); return mp_const_none; } @@ -102,6 +123,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationalarm___exit_ STATIC const mp_rom_map_elem_t memorymonitor_allocationalarm_locals_dict_table[] = { // Methods + { MP_ROM_QSTR(MP_QSTR_ignore), MP_ROM_PTR(&memorymonitor_allocationalarm_ignore_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&memorymonitor_allocationalarm___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&memorymonitor_allocationalarm___exit___obj) }, }; diff --git a/shared-bindings/memorymonitor/AllocationAlarm.h b/shared-bindings/memorymonitor/AllocationAlarm.h index 40f5a48c5b..304b9c5a72 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.h +++ b/shared-bindings/memorymonitor/AllocationAlarm.h @@ -34,5 +34,6 @@ extern const mp_obj_type_t memorymonitor_allocationalarm_type; void common_hal_memorymonitor_allocationalarm_construct(memorymonitor_allocationalarm_obj_t* self, size_t minimum_block_count); void common_hal_memorymonitor_allocationalarm_pause(memorymonitor_allocationalarm_obj_t* self); void common_hal_memorymonitor_allocationalarm_resume(memorymonitor_allocationalarm_obj_t* self); +void common_hal_memorymonitor_allocationalarm_set_ignore(memorymonitor_allocationalarm_obj_t* self, mp_int_t count); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index 25ecae97b8..3e0e31336f 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,7 +38,7 @@ //| def __init__(self): //| """Tracks the number of allocations in power of two buckets. //| -//| It will have 32 16bit buckets to track allocation counts. It is total allocations +//| It will have 16 16bit buckets to track allocation counts. It is total allocations //| meaning frees are ignored. Reallocated memory is counted twice, at allocation and when //| reallocated with the larger size. //| @@ -47,25 +47,20 @@ //| per block, typically 16. Bucket 2 will be less than or equal to 4 blocks. See //| `bytes_per_block` to convert blocks to bytes. //| -//| Multiple AllocationSizes can be used to track different boundaries. -//| -//| Active AllocationSizes will not be freed so make sure and pause before deleting. +//| Multiple AllocationSizes can be used to track different code boundaries. //| //| Track allocations:: //| //| import memorymonitor //| -//| mm = memorymonitor.AllocationSizes() -//| print("hello world" * 3) -//| mm.pause() -//| for bucket in mm: -//| print("<", 2 ** bucket, mm[bucket]) +//| mm = memorymonitor.AllocationSize() +//| with mm: +//| print("hello world" * 3) //| -//| # Clear the buckets -//| mm.clear() +//| for bucket, count in enumerate(mm): +//| print("<", 2 ** bucket, count) //| -//| # Resume allocation tracking -//| mm.resume()""" +//| """ //| ... //| STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -78,7 +73,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, } //| def __enter__(self, ) -> Any: -//| """No-op used by Context Managers.""" +//| """Clears counts and resumes tracking.""" //| ... //| STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) { @@ -118,12 +113,12 @@ const mp_obj_property_t memorymonitor_allocationsize_bytes_per_block_obj = { }; //| def __len__(self, ) -> Any: -//| """Returns the current pulse length +//| """Returns the number of allocation buckets. //| //| This allows you to:: //| -//| pulses = pulseio.PulseIn(pin) -//| print(len(pulses))""" +//| mm = memorymonitor.AllocationSize() +//| print(len(mm))""" //| ... //| STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t self_in) { @@ -137,12 +132,12 @@ STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t } //| def __getitem__(self, index: Any) -> Any: -//| """Returns the value at the given index or values in slice. +//| """Returns the allocation count for the given bucket. //| //| This allows you to:: //| -//| pulses = pulseio.PulseIn(pin) -//| print(pulses[0])""" +//| mm = memorymonitor.AllocationSize() +//| print(mm[0])""" //| ... //| STATIC mp_obj_t memorymonitor_allocationsize_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) { diff --git a/shared-module/memorymonitor/AllocationAlarm.c b/shared-module/memorymonitor/AllocationAlarm.c index ed7ab75ab2..35f4e4c636 100644 --- a/shared-module/memorymonitor/AllocationAlarm.c +++ b/shared-module/memorymonitor/AllocationAlarm.c @@ -37,6 +37,10 @@ void common_hal_memorymonitor_allocationalarm_construct(memorymonitor_allocation self->previous = NULL; } +void common_hal_memorymonitor_allocationalarm_set_ignore(memorymonitor_allocationalarm_obj_t* self, mp_int_t count) { + self->count = count; +} + void common_hal_memorymonitor_allocationalarm_pause(memorymonitor_allocationalarm_obj_t* self) { // Check to make sure we aren't already paused. We can be if we're exiting from an exception we // caused. @@ -67,12 +71,16 @@ void memorymonitor_allocationalarms_allocation(size_t block_count) { // Hold onto next in case we remove the alarm from the list. memorymonitor_allocationalarm_obj_t* next = alarm->next; if (block_count >= alarm->minimum_block_count) { - // Uncomment the breakpoint below if you want to use a C debugger to figure out the C - // call stack for an allocation. - // asm("bkpt"); - // Pause now because we may alert when throwing the exception too. - common_hal_memorymonitor_allocationalarm_pause(alarm); - alert_count++; + if (alarm->count > 0) { + alarm->count--; + } else { + // Uncomment the breakpoint below if you want to use a C debugger to figure out the C + // call stack for an allocation. + // asm("bkpt"); + // Pause now because we may alert when throwing the exception too. + common_hal_memorymonitor_allocationalarm_pause(alarm); + alert_count++; + } } alarm = next; } diff --git a/shared-module/memorymonitor/AllocationAlarm.h b/shared-module/memorymonitor/AllocationAlarm.h index 95381c6609..172c24f6c8 100644 --- a/shared-module/memorymonitor/AllocationAlarm.h +++ b/shared-module/memorymonitor/AllocationAlarm.h @@ -39,6 +39,7 @@ typedef struct _memorymonitor_allocationalarm_obj_t memorymonitor_allocationalar typedef struct _memorymonitor_allocationalarm_obj_t { mp_obj_base_t base; size_t minimum_block_count; + mp_int_t count; // Store the location that points to us so we can remove ourselves. memorymonitor_allocationalarm_obj_t** previous; memorymonitor_allocationalarm_obj_t* next; From 610e0171aac69f7cd7b7c46eb776a3624ce224a3 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 17 Jul 2020 17:43:02 -0700 Subject: [PATCH 220/277] Disable existing native networking. We're moving towards a co-processor model and a Wiznet library is already available. New native APIs will replace these for chips with networking like the ESP32S2 but they won't be these. --- .../aloriumtech_evo_m51/mpconfigboard.mk | 2 -- .../circuitbrains_deluxe_m4/mpconfigboard.mk | 2 -- .../boards/kicksat-sprite/mpconfigboard.mk | 1 - .../boards/pewpew_m4/mpconfigboard.mk | 18 +++++++----------- .../mpconfigboard.mk | 2 -- .../mpconfigboard.mk | 1 - .../boards/winterbloom_sol/mpconfigboard.mk | 1 - ports/atmel-samd/mpconfigport.mk | 3 +-- .../nrf/boards/particle_argon/mpconfigboard.mk | 4 ---- .../nrf/boards/particle_boron/mpconfigboard.mk | 4 ---- .../nrf/boards/particle_xenon/mpconfigboard.mk | 4 ---- shared-bindings/network/__init__.c | 3 +++ shared-bindings/socket/__init__.c | 3 +++ shared-bindings/wiznet/__init__.c | 7 ++++++- 14 files changed, 20 insertions(+), 35 deletions(-) diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk index 28b1434fb7..34301da3f0 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk @@ -13,6 +13,4 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 CIRCUITPY_PS2IO = 1 diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk index 7a9e5a7808..13ae59de46 100755 --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk @@ -11,6 +11,4 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, S25FL064L" LONGINT_IMPL = MPZ -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 CIRCUITPY_PS2IO = 1 diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk index febd2a6c36..9c7fe3398a 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk @@ -13,7 +13,6 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_DISPLAYIO = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_AUDIOMP3 = 0 diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index b6490433e5..c322897628 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -14,34 +14,30 @@ CIRCUITPY_FULL_BUILD = 0 # when frozen module gets smaller. CIRCUITPY_ANALOGIO = 0 CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_BITBANG_APA102 = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_GAMEPADSHIFT = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PS2IO = 0 +CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 +CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 -CIRCUITPY_AUDIOPWMIO = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BITBANG_APA102 = 0 -CIRCUITPY_BLEIO = 0 -CIRCUITPY_GAMEPADSHIFT = 0 -CIRCUITPY_NETWORK = 0 -CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_SAMD = 0 -CIRCUITPY_TOUCHIO = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 -CIRCUITPY_STAGE = 1 CIRCUITPY_MATH = 1 +CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk index 13863e565f..567f1db205 100644 --- a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk @@ -12,6 +12,4 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = AT25SF041A LONGINT_IMPL = MPZ -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 CIRCUITPY_PS2IO = 1 diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk index e06a2af7ee..7ab0ccfc9d 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk @@ -24,7 +24,6 @@ CIRCUITPY_BLEIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 diff --git a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk index 11592073f9..9217cdf23d 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk @@ -23,7 +23,6 @@ CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index face79fad7..e4cf9ca833 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -54,8 +54,7 @@ CIRCUITPY_TOUCHIO_USE_NATIVE = 0 # The ifndef's allow overriding in mpconfigboard.mk. ifndef CIRCUITPY_NETWORK -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 +CIRCUITPY_NETWORK = 0 endif ifndef CIRCUITPY_PS2IO diff --git a/ports/nrf/boards/particle_argon/mpconfigboard.mk b/ports/nrf/boards/particle_argon/mpconfigboard.mk index 2ca08b9829..f8d3d2aca2 100644 --- a/ports/nrf/boards/particle_argon/mpconfigboard.mk +++ b/ports/nrf/boards/particle_argon/mpconfigboard.mk @@ -8,7 +8,3 @@ MCU_CHIP = nrf52840 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "MX25L3233F" - -# Support for the Ethernet FeatherWing -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 diff --git a/ports/nrf/boards/particle_boron/mpconfigboard.mk b/ports/nrf/boards/particle_boron/mpconfigboard.mk index f03f43a7bc..eada97a730 100644 --- a/ports/nrf/boards/particle_boron/mpconfigboard.mk +++ b/ports/nrf/boards/particle_boron/mpconfigboard.mk @@ -8,7 +8,3 @@ MCU_CHIP = nrf52840 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "MX25L3233F" - -# Support for the Ethernet FeatherWing -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 diff --git a/ports/nrf/boards/particle_xenon/mpconfigboard.mk b/ports/nrf/boards/particle_xenon/mpconfigboard.mk index 44309bbca2..6062da378f 100644 --- a/ports/nrf/boards/particle_xenon/mpconfigboard.mk +++ b/ports/nrf/boards/particle_xenon/mpconfigboard.mk @@ -8,7 +8,3 @@ MCU_CHIP = nrf52840 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "MX25L3233F" - -# Support for the Ethernet FeatherWing -CIRCUITPY_NETWORK = 1 -MICROPY_PY_WIZNET5K = 5500 diff --git a/shared-bindings/network/__init__.c b/shared-bindings/network/__init__.c index 58aa13473e..4bd543a0a5 100644 --- a/shared-bindings/network/__init__.c +++ b/shared-bindings/network/__init__.c @@ -40,6 +40,9 @@ //| """Network Interface Management //| +//| .. warning:: This module is disabled in 6.x and will removed in 7.x. Please use networking +//| libraries instead. +//| //| This module provides a registry of configured NICs. //| It is used by the 'socket' module to look up a suitable //| NIC when a socket is created.""" diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 0ded0218bb..2485d8ef8c 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -39,6 +39,9 @@ //| """TCP, UDP and RAW socket support //| +//| .. warning:: This module is disabled in 6.x and will removed in 7.x. Please use networking +//| libraries instead. (Native networking will provide a socket compatible class.) +//| //| Create TCP, UDP and RAW sockets for communicating over the Internet.""" //| diff --git a/shared-bindings/wiznet/__init__.c b/shared-bindings/wiznet/__init__.c index bc7ff150fe..8df06b5467 100644 --- a/shared-bindings/wiznet/__init__.c +++ b/shared-bindings/wiznet/__init__.c @@ -35,7 +35,12 @@ #include "shared-module/network/__init__.h" -//| """Support for WizNet hardware, including the WizNet 5500 Ethernet adaptor.""" +//| """Support for WizNet hardware, including the WizNet 5500 Ethernet adaptor. +//| +//| +//| .. warning:: This module is disabled in 6.x and will removed in 7.x. Please use networking +//| libraries instead. +//| """ //| extern const mod_network_nic_type_t mod_network_nic_type_wiznet5k; From f38a9c8d2991a94df9d629ae33ec25fa32b61af9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 17 Jul 2020 17:55:06 -0700 Subject: [PATCH 221/277] Add cast for mpy-cross warning --- py/objarray.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/objarray.c b/py/objarray.c index b868e62f92..83defa343d 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -419,12 +419,12 @@ STATIC mp_obj_t buffer_finder(size_t n_args, const mp_obj_t *args, int direction } const byte *start = haystack_bufinfo.buf; - const byte *end = haystack_bufinfo.buf + haystack_bufinfo.len; + const byte *end = ((const byte*)haystack_bufinfo.buf) + haystack_bufinfo.len; if (n_args >= 3 && args[2] != mp_const_none) { start += mp_get_index(self_type, haystack_bufinfo.len, args[2], true); } if (n_args >= 4 && args[3] != mp_const_none) { - end = haystack_bufinfo.buf + mp_get_index(self_type, haystack_bufinfo.len, args[3], true); + end = ((const byte*)haystack_bufinfo.buf) + mp_get_index(self_type, haystack_bufinfo.len, args[3], true); } const byte *p = NULL; From 693b3e7704e1c7a9bea25d3b43c3771123e8c214 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 17 Jul 2020 18:00:58 -0700 Subject: [PATCH 222/277] Update translations --- locale/circuitpython.pot | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 6bdc91bf17..95ebeb1db2 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1,12 +1,14 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. # -# SPDX-License-Identifier: MIT - +#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:00-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -76,10 +78,15 @@ msgstr "" msgid "%q list must be a list" msgstr "" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "" @@ -313,6 +320,11 @@ msgstr "" msgid "Already advertising." msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "" @@ -348,6 +360,11 @@ msgstr "" msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -467,7 +484,9 @@ msgstr "" msgid "Can't set CCCD on local Characteristic" msgstr "" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "" @@ -1347,6 +1366,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "" @@ -1431,7 +1451,9 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" From 6ac2fe58fd316d88d545410807069a9563e0bfd5 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 17 Jul 2020 18:03:52 -0700 Subject: [PATCH 223/277] Update translations --- locale/circuitpython.pot | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 6bdc91bf17..988f89a059 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1,12 +1,14 @@ -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. # -# SPDX-License-Identifier: MIT - +#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -103,6 +105,10 @@ msgstr "" msgid "'%q' argument required" msgstr "" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3098,7 +3104,7 @@ msgstr "" msgid "struct: no fields" msgstr "" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "" From 8d692f33a8b9638e37ba6e311432eeb96c0ec825 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 18 Jul 2020 19:30:40 +0200 Subject: [PATCH 224/277] pewpew_m4: Enable analogio and usb_hid The newest version for the Stage library for PewPewM4 no longer contains embedded graphics, which frees enough space in flash to enabled back AnalogIO and also add USB_HID. There is still ~192 bytes left free. If new additions to CircuitPython make it grow further, we can disable USB_HID again. --- frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 0d2c083a2f..9596a5904e 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 0d2c083a2fb57a1562d4806775f45273abbfbfae +Subproject commit 9596a5904ed757e6fbffcf03e7aa77ae9ecf5223 diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index b6490433e5..b1a8f7c72f 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -10,20 +10,15 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -# TODO: Turn off analogio for now for space reasons, but restore it -# when frozen module gets smaller. -CIRCUITPY_ANALOGIO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_RTC = 0 CIRCUITPY_TOUCHIO = 0 -CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_AUDIOPWMIO = 0 CIRCUITPY_AUDIOMP3 = 0 @@ -33,7 +28,6 @@ CIRCUITPY_GAMEPADSHIFT = 0 CIRCUITPY_NETWORK = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_SAMD = 0 -CIRCUITPY_TOUCHIO = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_AUDIOMIXER = 1 @@ -42,6 +36,8 @@ CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 CIRCUITPY_STAGE = 1 CIRCUITPY_MATH = 1 +CIRCUITPY_ANALOGIO = 1 +CIRCUITPY_USB_HID = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf From 11ef43b071f275ee470d1339cc7a2392281b9528 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 18 Jul 2020 20:09:30 +0200 Subject: [PATCH 225/277] pewpew_m4: Disable USB_HID back German translation fails to build, so I have to disabled USB_HID after all. --- ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index b1a8f7c72f..8a67f127fb 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -19,6 +19,7 @@ CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_RTC = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_AUDIOPWMIO = 0 CIRCUITPY_AUDIOMP3 = 0 @@ -37,7 +38,6 @@ CIRCUITPY_GAMEPAD = 1 CIRCUITPY_STAGE = 1 CIRCUITPY_MATH = 1 CIRCUITPY_ANALOGIO = 1 -CIRCUITPY_USB_HID = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf From 7ba89f5330fb2a7d48efb56f1b5920e8dfffedef Mon Sep 17 00:00:00 2001 From: Thea Flowers Date: Sat, 18 Jul 2020 22:33:06 -0700 Subject: [PATCH 226/277] Add _bhb user module for Big Honking Button BHB needs better accuracy from the ADC readings. To avoid changing the ADC configuration for all boards or adding complexity to AnalogIn, I implemented a custom user module to allow the BHB to talk to the ADC in the way that it needs to. I'm open to other approaches here, but this seemed like the least invasive and complex option. --- .../mpconfigboard.mk | 4 + .../usermods/_bhb/bhb.c | 120 ++++++++++++++++++ .../usermods/_bhb/micropython.mk | 6 + 3 files changed, 130 insertions(+) create mode 100644 ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c create mode 100644 ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/micropython.mk diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk index 466e345911..35a72819b8 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk @@ -32,3 +32,7 @@ CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_RTC = 0 + +# Enable board-specific modules +USER_C_MODULES = boards/winterbloom_big_honking_button/usermods +CFLAGS += -DMODULE_BHB_ENABLED=1 diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c new file mode 100644 index 0000000000..54ce173d81 --- /dev/null +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c @@ -0,0 +1,120 @@ +#include "py/obj.h" +#include "py/runtime.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "samd/pins.h" +#include "sam.h" + +STATIC mp_obj_t _bhb_read_adc(void); + +STATIC mp_obj_t _bhb_init_adc(void) { + claim_pin(&pin_PB08); + common_hal_never_reset_pin(&pin_PB08); + + /* Enable the APB clock for the ADC. */ + PM->APBCMASK.reg |= PM_APBCMASK_ADC; + + /* Enable GCLK0 for the ADC */ + GCLK->CLKCTRL.reg = GCLK_CLKCTRL_CLKEN | + GCLK_CLKCTRL_GEN_GCLK0 | + GCLK_CLKCTRL_ID_ADC; + + /* Wait for bus synchronization. */ + while (GCLK->STATUS.bit.SYNCBUSY) {}; + + uint32_t bias = (*((uint32_t *) ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; + uint32_t linearity = (*((uint32_t *) ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos; + linearity |= ((*((uint32_t *) ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; + + /* Wait for bus synchronization. */ + while (ADC->STATUS.bit.SYNCBUSY) {}; + + /* Write the calibration data. */ + ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); + + /* Use the internal VCC reference. This is 1/2 of what's on VCCA. + since VCCA is 3.3v, this is 1.65v. + */ + ADC->REFCTRL.reg = ADC_REFCTRL_REFSEL_INTVCC1; + + /* Capture 64 samples. */ + ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_64 | ADC_AVGCTRL_ADJRES(4); + + /* Set the clock prescaler to 32, which is the same as the CircuitPython default. + Set the resolution to 16 for averaging + */ + ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV32 | + ADC_CTRLB_RESSEL_16BIT; + + /* Configure the input parameters. + + - GAIN_DIV2 means that the input voltage is halved. This is important + because the voltage reference is 1/2 of VCCA. So if you want to + measure 0-3.3v, you need to halve the input as well. + + - MUXNEG_GND means that the ADC should compare the input value to GND. + + - MUXPOS_PIN3 means that the ADC should read from AIN2, or PB08. + */ + ADC->INPUTCTRL.reg = ADC_INPUTCTRL_GAIN_DIV2 | + ADC_INPUTCTRL_MUXNEG_GND | + ADC_INPUTCTRL_MUXPOS_PIN2; + + + /* Set PB08 as an input pin. */ + PORT->Group[1].DIRCLR.reg = PORT_PB08; + + /* Enable the peripheral multiplexer for PB08. */ + PORT->Group[1].PINCFG[8].reg |= PORT_PINCFG_PMUXEN; + + /* Set PB08 to function B which is analog input. */ + PORT->Group[1].PMUX[4].reg |= PORT_PMUX_PMUXE_B; + + /* Wait for bus synchronization. */ + while (ADC->STATUS.bit.SYNCBUSY) {}; + + /* Enable the ADC. */ + ADC->CTRLA.bit.ENABLE = true; + + /* Make one read and throw it away, as per the datasheet. */ + _bhb_read_adc(); + + return mp_const_none; +} + +STATIC mp_obj_t _bhb_read_adc(void) { + /* Wait for bus synchronization. */ + while (ADC->STATUS.bit.SYNCBUSY) {}; + + /* Start the ADC using a software trigger. */ + ADC->SWTRIG.bit.START = true; + + /* Wait for the result ready flag to be set. */ + while (ADC->INTFLAG.bit.RESRDY == 0); + + /* Clear the flag. */ + ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY; + + /* Read the value. */ + uint32_t result = ADC->RESULT.reg; + + return MP_OBJ_NEW_SMALL_INT(result); +} + + +STATIC MP_DEFINE_CONST_FUN_OBJ_0(_bhb_init_adc_obj, _bhb_init_adc); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(_bhb_read_adc_obj, _bhb_read_adc); + +STATIC const mp_rom_map_elem_t _bhb_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__bhb) }, + { MP_ROM_QSTR(MP_QSTR_init_adc), MP_ROM_PTR(&_bhb_init_adc_obj) }, + { MP_ROM_QSTR(MP_QSTR_read_adc), MP_ROM_PTR(&_bhb_read_adc_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(_bhb_module_globals, _bhb_module_globals_table); + +const mp_obj_module_t _bhb_user_cmodule = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&_bhb_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR__bhb, _bhb_user_cmodule, MODULE_BHB_ENABLED); diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/micropython.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/micropython.mk new file mode 100644 index 0000000000..9374ec34ea --- /dev/null +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/micropython.mk @@ -0,0 +1,6 @@ +USERMODULES_DIR := $(USERMOD_DIR) + +# Add all C files to SRC_USERMOD. +SRC_USERMOD += $(USERMODULES_DIR)/bhb.c + +CFLAGS_USERMOD += -I$(USERMODULES_DIR) From efeae0d84fa1745595d26e66590c1944269b6aae Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Sun, 19 Jul 2020 12:27:35 -0700 Subject: [PATCH 227/277] fix 3169: Polygon.points property The getter for vectorio.Polygon#points was not updated with the data type change of the stored points list. This moves the implementation to shared_module and updates the data type to reflect the actual state. --- shared-bindings/vectorio/Polygon.c | 15 +-------------- shared-module/vectorio/Polygon.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 3443d9e426..1aca4611ea 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -49,20 +49,7 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar //| STATIC mp_obj_t vectorio_polygon_obj_get_points(mp_obj_t self_in) { vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_t list = mp_obj_new_list(0, NULL); - - size_t len = 0; - mp_obj_t *items; - mp_obj_list_get(common_hal_vectorio_polygon_get_points(self), &len, &items); - - for (size_t i = 0; i < len; i += 2) { - mp_obj_t tuple[] = { items[i], items[i+1] }; - mp_obj_list_append( - list, - mp_obj_new_tuple(2, tuple) - ); - } - return list; + return common_hal_vectorio_polygon_get_points(self); } MP_DEFINE_CONST_FUN_OBJ_1(vectorio_polygon_get_points_obj, vectorio_polygon_obj_get_points); diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c index 0025d4bfc4..aeeaf02240 100644 --- a/shared-module/vectorio/Polygon.c +++ b/shared-module/vectorio/Polygon.c @@ -20,7 +20,7 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple size_t len = 0; mp_obj_t *items; mp_obj_list_get(points_tuple_list, &len, &items); - VECTORIO_POLYGON_DEBUG("polygon_points_list len: %d\n", len); + VECTORIO_POLYGON_DEBUG(" self.len: %d, len: %d, ", self->len, len); if ( len < 3 ) { mp_raise_TypeError_varg(translate("Polygon needs at least 3 points")); @@ -28,9 +28,11 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple if ( self->len < 2*len ) { if ( self->points_list != NULL ) { + VECTORIO_POLYGON_DEBUG("free(%d), ", sizeof(self->points_list)); gc_free( self->points_list ); } self->points_list = gc_alloc( 2 * len * sizeof(int), false, false ); + VECTORIO_POLYGON_DEBUG("alloc(%p, %d)", self->points_list, 2 * len * sizeof(int)); } self->len = 2*len; @@ -56,22 +58,35 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list) { - VECTORIO_POLYGON_DEBUG("%p polygon_construct\n", self); + VECTORIO_POLYGON_DEBUG("%p polygon_construct: ", self); self->points_list = NULL; self->len = 0; self->on_dirty.obj = NULL; _clobber_points_list( self, points_list ); + VECTORIO_POLYGON_DEBUG("\n"); } mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self) { - return self->points_list; + VECTORIO_POLYGON_DEBUG("%p common_hal_vectorio_polygon_get_points {len: %d, points_list: %p}\n", self, self->len, self->points_list); + mp_obj_t list = mp_obj_new_list(0, NULL); + + for (size_t i = 0; i < self->len; i += 2) { + mp_obj_t tuple[] = { mp_obj_new_int(self->points_list[i]), mp_obj_new_int(self->points_list[i+1]) }; + mp_obj_list_append( + list, + mp_obj_new_tuple(2, tuple) + ); + } + return list; } void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t points_list) { + VECTORIO_POLYGON_DEBUG("%p common_hal_vectorio_polygon_set_points: ", self); _clobber_points_list( self, points_list ); if (self->on_dirty.obj != NULL) { self->on_dirty.event(self->on_dirty.obj); } + VECTORIO_POLYGON_DEBUG("\n"); } void common_hal_vectorio_polygon_set_on_dirty(vectorio_polygon_t *self, vectorio_event_t notification) { From db43c56f794508689b07d931c16cadd3e98aad87 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 20 Jul 2020 08:44:39 -0500 Subject: [PATCH 228/277] background callbacks: Clear any callbacks that were queued Before this, a background callback that was on the list when background_callback_reset was called could have ended up in a state that made it "un-queueable": its "prev" pointer could have been non-NULL. --- supervisor/shared/background_callback.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index d10579c4f9..8e12dd3625 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -24,6 +24,8 @@ * THE SOFTWARE. */ +#include + #include "py/gc.h" #include "py/mpconfig.h" #include "supervisor/background_callback.h" @@ -101,6 +103,12 @@ void background_callback_end_critical_section() { void background_callback_reset() { CALLBACK_CRITICAL_BEGIN; + background_callback_t *cb = (background_callback_t*)callback_head; + while(cb) { + background_callback_t *next = cb->next; + memset(cb, 0, sizeof(*cb)); + cb = next; + } callback_head = NULL; callback_tail = NULL; in_background_callback = false; From 9fd10322fedc4a7736118fdb6cb1480ad8da94f1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 20 Jul 2020 08:45:31 -0500 Subject: [PATCH 229/277] supervisor: rename some locals for clarity It's perfectly OK for these variables with static linkage to have the same name, but it's inconvenient for humans like me. --- supervisor/shared/tick.c | 4 ++-- supervisor/shared/usb/usb.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index bc270030f3..4af59f78e3 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -66,7 +66,7 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); -static background_callback_t callback; +static background_callback_t tick_callback; volatile uint64_t last_finished_tick = 0; @@ -119,7 +119,7 @@ void supervisor_tick(void) { #endif } #endif - background_callback_add(&callback, supervisor_background_tasks, NULL); + background_callback_add(&tick_callback, supervisor_background_tasks, NULL); } uint64_t supervisor_ticks_ms64() { diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 472be96d52..36b5ec05d6 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -64,8 +64,8 @@ void usb_init(void) { tusb_init(); #if MICROPY_KBD_EXCEPTION - // Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() callback will be invoked when Ctrl+C is received - // This callback always got invoked regardless of mp_interrupt_char value since we only set it once here + // Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received + // This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here tud_cdc_set_wanted_char(CHAR_CTRL_C); #endif @@ -83,14 +83,14 @@ void usb_background(void) { } } -static background_callback_t callback; +static background_callback_t usb_callback; static void usb_background_do(void* unused) { usb_background(); } void usb_irq_handler(void) { tud_int_handler(0); - background_callback_add(&callback, usb_background_do, NULL); + background_callback_add(&usb_callback, usb_background_do, NULL); } //--------------------------------------------------------------------+ From c243c13f026a4bd915f241e5fff5400aabea11ad Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 20 Jul 2020 08:52:35 -0500 Subject: [PATCH 230/277] framebufferio: Handle auto refresh flag at reset if we don't set the flag via accessor fn the tick enable might become wrong --- shared-module/displayio/__init__.c | 4 +--- shared-module/framebufferio/FramebufferDisplay.c | 5 +++++ shared-module/framebufferio/FramebufferDisplay.h | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index c898bbb98f..efc28470fb 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -190,9 +190,7 @@ void reset_displays(void) { common_hal_displayio_epaperdisplay_show(display, NULL); #if CIRCUITPY_FRAMEBUFFERIO } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { - framebufferio_framebufferdisplay_obj_t* display = &displays[i].framebuffer_display; - display->auto_refresh = true; - common_hal_framebufferio_framebufferdisplay_show(display, NULL); + framebufferio_framebufferdisplay_reset(&displays[i].framebuffer_display); #endif } } diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c index 7d09e0baeb..2a90fa0d4a 100644 --- a/shared-module/framebufferio/FramebufferDisplay.c +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -318,3 +318,8 @@ void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisp gc_collect_ptr(self->framebuffer); displayio_display_core_collect_ptrs(&self->core); } + +void framebufferio_framebufferdisplay_reset(framebufferio_framebufferdisplay_obj_t* self) { + common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, true); + common_hal_framebufferio_framebufferdisplay_show(self, NULL); +} diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h index 1b68d2ab02..ca1ab984a3 100644 --- a/shared-module/framebufferio/FramebufferDisplay.h +++ b/shared-module/framebufferio/FramebufferDisplay.h @@ -55,6 +55,7 @@ typedef struct { void framebufferio_framebufferdisplay_background(framebufferio_framebufferdisplay_obj_t* self); void release_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self); void reset_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self); +void framebufferio_framebufferdisplay_reset(framebufferio_framebufferdisplay_obj_t* self); void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisplay_obj_t* self); From e2d252a6d5f4b2425215e0a79f78b8cbfa657f9a Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Mon, 20 Jul 2020 10:12:29 -0700 Subject: [PATCH 231/277] pre-allocate list of known size --- shared-module/vectorio/Polygon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c index aeeaf02240..c44c13fd73 100644 --- a/shared-module/vectorio/Polygon.c +++ b/shared-module/vectorio/Polygon.c @@ -69,7 +69,7 @@ void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t po mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self) { VECTORIO_POLYGON_DEBUG("%p common_hal_vectorio_polygon_get_points {len: %d, points_list: %p}\n", self, self->len, self->points_list); - mp_obj_t list = mp_obj_new_list(0, NULL); + mp_obj_t list = mp_obj_new_list(self->len/2, NULL); for (size_t i = 0; i < self->len; i += 2) { mp_obj_t tuple[] = { mp_obj_new_int(self->points_list[i]), mp_obj_new_int(self->points_list[i+1]) }; From 389c81341dc7267a7f51c468d5e90602b76569ab Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 20 Jul 2020 18:16:20 -0700 Subject: [PATCH 232/277] Tweak declaration for boards with TCM --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index f1dfa63c6f..a571c547ab 100755 --- a/main.c +++ b/main.c @@ -98,7 +98,7 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) { } #if MICROPY_ENABLE_PYSTACK -static size_t PLACE_IN_DTCM_BSS(_pystack)[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]; +static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]); #endif void start_mp(supervisor_allocation* heap) { @@ -130,7 +130,7 @@ void start_mp(supervisor_allocation* heap) { readline_init0(); #if MICROPY_ENABLE_PYSTACK - mp_pystack_init(_pystack, _pystack + sizeof(_pystack)); + mp_pystack_init(_pystack, _pystack + (sizeof(_pystack) / sizeof(size_t))); #endif #if MICROPY_ENABLE_GC From e977b427aa6783858ecccd4a69e17d08f039122c Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Mon, 20 Jul 2020 20:25:31 -0700 Subject: [PATCH 233/277] vectorio: fix VectorShape non-transposed pixel placement Fixes https://github.com/adafruit/circuitpython/issues/3170 The absolute transform needs to be subtracted in all cases, not only when the coordinate system is transposed. --- shared-module/vectorio/VectorShape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/vectorio/VectorShape.c b/shared-module/vectorio/VectorShape.c index bfe8a7b259..81f46b3fa0 100644 --- a/shared-module/vectorio/VectorShape.c +++ b/shared-module/vectorio/VectorShape.c @@ -223,8 +223,8 @@ bool vectorio_vector_shape_fill_area(vectorio_vector_shape_t *self, const _displ pixel_to_get_x = (input_pixel.y - self->absolute_transform->dy * self->x - self->absolute_transform->y) / self->absolute_transform->dy; pixel_to_get_y = (input_pixel.x - self->absolute_transform->dx * self->y - self->absolute_transform->x) / self->absolute_transform->dx; } else { - pixel_to_get_x = (input_pixel.x - self->absolute_transform->dx * self->x) / self->absolute_transform->dx; - pixel_to_get_y = (input_pixel.y - self->absolute_transform->dy * self->y) / self->absolute_transform->dy; + pixel_to_get_x = (input_pixel.x - self->absolute_transform->dx * self->x - self->absolute_transform->x) / self->absolute_transform->dx; + pixel_to_get_y = (input_pixel.y - self->absolute_transform->dy * self->y - self->absolute_transform->y) / self->absolute_transform->dy; } VECTORIO_SHAPE_PIXEL_DEBUG(" get_pixel %p (%3d, %3d) -> ( %3d, %3d )", self->ishape.shape, input_pixel.x, input_pixel.y, pixel_to_get_x, pixel_to_get_y); #ifdef VECTORIO_PERF From 49decf90c940f2e9810abcf40939db33a5803ab0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 21 Jul 2020 10:11:08 -0500 Subject: [PATCH 234/277] Add option for higher optimization levels --- ports/atmel-samd/Makefile | 5 +++++ .../atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pyportal/mpconfigboard.mk | 2 ++ ports/cxd56/Makefile | 5 +++++ ports/esp32s2/Makefile | 4 ++++ ports/litex/Makefile | 4 ++++ ports/mimxrt10xx/Makefile | 4 ++++ ports/nrf/Makefile | 3 +++ ports/stm/Makefile | 4 ++++ 10 files changed, 35 insertions(+) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index eedcc94a92..9fa43af21e 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -106,6 +106,11 @@ CFLAGS += -Os -DNDEBUG CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + + $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization ifeq ($(DEBUG), 1) diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index eb02d3c270..d32dcf3d19 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 + +OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index 7a213faf4c..e898d0dda5 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -16,3 +16,5 @@ CIRCUITPY_GAMEPADSHIFT = 1 CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge + +OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk index 149141a4e3..8a197fbf02 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk @@ -10,3 +10,5 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C" LONGINT_IMPL = MPZ + +OPTIMIZATION_LEVEL = 2 diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 3766d42228..6838270a61 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -123,6 +123,11 @@ CFLAGS += \ -fdata-sections \ -Wall \ +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + + LIBM = "${shell "$(CC)" $(CFLAGS) -print-file-name=libm.a}" LIBGCC = "${shell "$(CC)" $(CFLAGS) -print-libgcc-file-name}" diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 29abcab8e3..ec6a8fc0c4 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -109,6 +109,10 @@ else ### CFLAGS += -flto endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 29149942c9..7ddf3c0610 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -83,6 +83,10 @@ else ### CFLAGS += -flto endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) # TODO: check this diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index d82b625e74..2201d92a31 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -108,6 +108,10 @@ CFLAGS += \ -Os -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + LD_FILES = $(wildcard boards/$(BOARD)/*.ld) $(addprefix linking/, flash/$(FLASH).ld chip_family/$(CHIP_FAMILY).ld common.ld) LD_SCRIPT_FLAG := -Wl,-T, diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index e1d86f7bc1..28fd44b852 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -92,6 +92,9 @@ else CFLAGS += -flto -flto-partition=none endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/stm/Makefile b/ports/stm/Makefile index e2dc2346e2..8753bd8f84 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -91,6 +91,10 @@ else # CFLAGS += -flto endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + # MCU Series is defined by the HAL package and doesn't need to be specified here C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT) From a29105fefd4fdf791376edf2df1a5d8b4c976974 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Wed, 22 Jul 2020 00:37:22 +0900 Subject: [PATCH 235/277] Improve .pyi generation --- .github/workflows/build.yml | 2 +- tools/extract_pyi.py | 142 ++++++++++++++++++++++++++++-------- 2 files changed, 112 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5ccfb71c8..d809ba8cb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: run: | sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 - pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid + pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort - name: Versions run: | gcc --version diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index b9366f6bab..e5da610352 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -2,24 +2,91 @@ # # SPDX-License-Identifier: MIT +import ast import os +import re import sys -import astroid import traceback -top_level = sys.argv[1].strip("/") -stub_directory = sys.argv[2] +import isort + + +IMPORTS_IGNORE = frozenset({'int', 'float', 'bool', 'str', 'bytes', 'tuple', 'list', 'set', 'dict', 'bytearray', 'file', 'buffer'}) +IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence'}) +IMPORTS_TYPESHED = frozenset({'ReadableBuffer', 'WritableBuffer'}) + + +def is_any(node): + node_type = type(node) + if node is None: + return True + if node_type == ast.Name and node.id == "Any": + return True + if (node_type == ast.Attribute and type(node.value) == ast.Name + and node.value.id == "typing" and node.attr == "Any"): + return True + return False + + +def report_missing_annotations(tree): + for node in ast.walk(tree): + node_type = type(node) + if node_type == ast.AnnAssign: + if is_any(node.annotation): + print(f"Missing attribute type on line {node.lineno}") + elif node_type == ast.arg: + if is_any(node.annotation) and node.arg != "self": + print(f"Missing argument type: {node.arg} on line {node.lineno}") + elif node_type == ast.FunctionDef: + if is_any(node.returns) and node.name != "__init__": + print(f"Missing return type: {node.name} on line {node.lineno}") + + +def extract_imports(tree): + modules = set() + typing = set() + typeshed = set() + + def collect_annotations(anno_tree): + if anno_tree is None: + return + for node in ast.walk(anno_tree): + node_type = type(node) + if node_type == ast.Name: + if node.id in IMPORTS_IGNORE: + continue + elif node.id in IMPORTS_TYPING: + typing.add(node.id) + elif node.id in IMPORTS_TYPESHED: + typeshed.add(node.id) + elif not node.id[0].isupper(): + modules.add(node.id) + + for node in ast.walk(tree): + node_type = type(node) + if (node_type == ast.AnnAssign) or (node_type == ast.arg): + collect_annotations(node.annotation) + elif node_type == ast.FunctionDef: + collect_annotations(node.returns) + + return { + "modules": sorted(modules), + "typing": sorted(typing), + "typeshed": sorted(typeshed), + } + def convert_folder(top_level, stub_directory): ok = 0 total = 0 filenames = sorted(os.listdir(top_level)) pyi_lines = [] + for filename in filenames: full_path = os.path.join(top_level, filename) file_lines = [] if os.path.isdir(full_path): - mok, mtotal = convert_folder(full_path, os.path.join(stub_directory, filename)) + (mok, mtotal) = convert_folder(full_path, os.path.join(stub_directory, filename)) ok += mok total += mtotal elif filename.endswith(".c"): @@ -44,44 +111,57 @@ def convert_folder(top_level, stub_directory): pyi_lines.extend(file_lines) if not pyi_lines: - return ok, total + return (ok, total) stub_filename = os.path.join(stub_directory, "__init__.pyi") print(stub_filename) stub_contents = "".join(pyi_lines) - os.makedirs(stub_directory, exist_ok=True) - with open(stub_filename, "w") as f: - f.write(stub_contents) # Validate that the module is a parseable stub. total += 1 try: - tree = astroid.parse(stub_contents) - for i in tree.body: - if 'name' in i.__dict__: - print(i.__dict__['name']) - for j in i.body: - if isinstance(j, astroid.scoped_nodes.FunctionDef): - if None in j.args.__dict__['annotations']: - print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") - if j.returns: - if 'Any' in j.returns.__dict__.values(): - print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") - elif isinstance(j, astroid.node_classes.AnnAssign): - if 'name' in j.__dict__['annotation'].__dict__: - if j.__dict__['annotation'].__dict__['name'] == 'Any': - print(f"missing attribute type on line {j.__dict__['lineno']}") - + tree = ast.parse(stub_contents) + imports = extract_imports(tree) + report_missing_annotations(tree) ok += 1 - except astroid.exceptions.AstroidSyntaxError as e: - e = e.__cause__ + except SyntaxError as e: traceback.print_exception(type(e), e, e.__traceback__) + return (ok, total) + + # Add import statements + import_lines = ["from __future__ import annotations"] + import_lines.extend(f"import {m}" for m in imports["modules"]) + import_lines.append("from typing import " + ", ".join(imports["typing"])) + import_lines.append("from _typeshed import " + ", ".join(imports["typeshed"])) + import_body = "\n".join(import_lines) + m = re.match(r'(\s*""".*?""")', stub_contents, flags=re.DOTALL) + if m: + stub_contents = m.group(1) + "\n\n" + import_body + "\n\n" + stub_contents[m.end():] + else: + stub_contents = import_body + "\n\n" + stub_contents + stub_contents = isort.code(stub_contents) + + # Adjust blank lines + stub_contents = re.sub(r"\n+class", "\n\n\nclass", stub_contents) + stub_contents = re.sub(r"\n+def", "\n\n\ndef", stub_contents) + stub_contents = re.sub(r"\n+^(\s+)def", lambda m: f"\n\n{m.group(1)}def", stub_contents, flags=re.M) + stub_contents = stub_contents.strip() + "\n" + + os.makedirs(stub_directory, exist_ok=True) + with open(stub_filename, "w") as f: + f.write(stub_contents) + print() - return ok, total + return (ok, total) -ok, total = convert_folder(top_level, stub_directory) -print(f"{ok} ok out of {total}") +if __name__ == "__main__": + top_level = sys.argv[1].strip("/") + stub_directory = sys.argv[2] -if ok != total: - sys.exit(total - ok) + (ok, total) = convert_folder(top_level, stub_directory) + + print(f"Parsing .pyi files: {total - ok} failed, {ok} passed") + + if ok != total: + sys.exit(total - ok) From 678faff464fa7810dfc12e75f73029d8e3106f0c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 11:02:23 -0700 Subject: [PATCH 236/277] Be more aggressive with uChip build --- ports/atmel-samd/boards/uchip/mpconfigboard.mk | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 196068a1e0..0e5eda0b8d 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -10,9 +10,5 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -# Tweak inlining depending on language. -ifeq ($(TRANSLATION), zh_Latn_pinyin) +# Always use aggressive inlining CFLAGS_INLINE_LIMIT = 45 -else -CFLAGS_INLINE_LIMIT = 70 -endif From 5e3a853db4ad735e3ae1c115cab3ef213a338f0d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 12:51:59 -0700 Subject: [PATCH 237/277] Turn off GC opt on uchip board --- ports/atmel-samd/boards/uchip/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 0e5eda0b8d..d08690a15a 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -12,3 +12,5 @@ CIRCUITPY_FULL_BUILD = 0 # Always use aggressive inlining CFLAGS_INLINE_LIMIT = 45 + +SUPEROPT_GC = 0 From 900edb2b8e118ff36b708afe65363e5929f00ad8 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 13:08:42 -0700 Subject: [PATCH 238/277] Only add .find without CPYTHON_COMPAT --- py/objarray.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/py/objarray.c b/py/objarray.c index 83defa343d..7bd8bacb0c 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -412,10 +412,7 @@ STATIC mp_obj_t buffer_finder(size_t n_args, const mp_obj_t *args, int direction mp_get_buffer_raise(args[1], &needle_bufinfo, MP_BUFFER_READ); if (mp_binary_get_size('@', needle_bufinfo.typecode, NULL) != 1) { - const qstr src_name = mp_obj_get_type(args[1])->name; - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, - translate("'%q' object is not bytes-like"), - src_name)); + mp_raise_TypeError(translate("a bytes-like object is required")); } const byte *start = haystack_bufinfo.buf; @@ -447,6 +444,7 @@ STATIC mp_obj_t buffer_find(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_find_obj, 2, 4, buffer_find); +#if MICROPY_CPYTHON_COMPAT STATIC mp_obj_t buffer_rfind(size_t n_args, const mp_obj_t *args) { return buffer_finder(n_args, args, -1, false); } @@ -461,6 +459,7 @@ STATIC mp_obj_t buffer_rindex(size_t n_args, const mp_obj_t *args) { return buffer_finder(n_args, args, -1, true); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_rindex_obj, 2, 4, buffer_rindex); +#endif #endif @@ -646,11 +645,11 @@ STATIC const mp_rom_map_elem_t bytearray_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&array_extend_obj) }, { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&buffer_find_obj) }, +#if MICROPY_CPYTHON_COMPAT { MP_ROM_QSTR(MP_QSTR_rfind), MP_ROM_PTR(&buffer_rfind_obj) }, { MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&buffer_index_obj) }, { MP_ROM_QSTR(MP_QSTR_rindex), MP_ROM_PTR(&buffer_rindex_obj) }, -#if MICROPY_CPYTHON_COMPAT { MP_ROM_QSTR(MP_QSTR_decode), MP_ROM_PTR(&array_decode_obj) }, #endif }; From 6db10f9c7deba015dc89090f0957ebbd742cfa8e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 15:40:51 -0700 Subject: [PATCH 239/277] Turn off find when CPYTHON_COMPAT is off --- py/objarray.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/py/objarray.c b/py/objarray.c index 7bd8bacb0c..5d83f06977 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -400,7 +400,7 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_extend_obj, array_extend); #endif -#if MICROPY_PY_BUILTINS_BYTEARRAY +#if MICROPY_PY_BUILTINS_BYTEARRAY && MICROPY_CPYTHON_COMPAT STATIC mp_obj_t buffer_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index) { mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_bytearray)); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); @@ -444,7 +444,6 @@ STATIC mp_obj_t buffer_find(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_find_obj, 2, 4, buffer_find); -#if MICROPY_CPYTHON_COMPAT STATIC mp_obj_t buffer_rfind(size_t n_args, const mp_obj_t *args) { return buffer_finder(n_args, args, -1, false); } @@ -461,8 +460,6 @@ STATIC mp_obj_t buffer_rindex(size_t n_args, const mp_obj_t *args) { MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_rindex_obj, 2, 4, buffer_rindex); #endif -#endif - STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { if (value == MP_OBJ_NULL) { // delete item @@ -644,8 +641,8 @@ STATIC const mp_rom_map_elem_t bytearray_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&array_append_obj) }, { MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&array_extend_obj) }, - { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&buffer_find_obj) }, #if MICROPY_CPYTHON_COMPAT + { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&buffer_find_obj) }, { MP_ROM_QSTR(MP_QSTR_rfind), MP_ROM_PTR(&buffer_rfind_obj) }, { MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&buffer_index_obj) }, { MP_ROM_QSTR(MP_QSTR_rindex), MP_ROM_PTR(&buffer_rindex_obj) }, From db5c3c967685036a5512406ebd3955c3f12b776d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 21 Jul 2020 17:54:47 -0500 Subject: [PATCH 240/277] dded optimization for esp32s2 --- ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk index 6e76272659..0ccfe06ed7 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -17,3 +17,5 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wroom + +OPTIMIZATION_LEVEL = 2 From ee019a96bae776661a7401e0f34cf633c908a42b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 16:08:41 -0700 Subject: [PATCH 241/277] Updates based on review --- shared-bindings/memorymonitor/AllocationSize.c | 2 +- shared-bindings/memorymonitor/__init__.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index 3e0e31336f..5016744413 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -38,7 +38,7 @@ //| def __init__(self): //| """Tracks the number of allocations in power of two buckets. //| -//| It will have 16 16bit buckets to track allocation counts. It is total allocations +//| It will have 16 16-bit buckets to track allocation counts. It is total allocations //| meaning frees are ignored. Reallocated memory is counted twice, at allocation and when //| reallocated with the larger size. //| diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index bfd5bf6d83..98f48f5251 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -36,9 +36,9 @@ //| """Memory monitoring helpers""" //| -//| class AllocationException: +//| class AllocationError: //| def __init__(self, Exception: Any): -//| """Catch all exception for Bluetooth related errors.""" +//| """Catchall exception for allocation related errors.""" //| ... MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception) From 8ff2846bb2a54ed34a9a73fffc3e154382d89e58 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 16:21:49 -0700 Subject: [PATCH 242/277] Disable countio on circuitbrains basic --- ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk index da5f1ffac8..619b7d6944 100755 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk @@ -12,6 +12,7 @@ EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ" LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_VECTORIO = 0 From eb24653d3ffa85dbe5209d5834bb87f76a7c57e1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 18:30:29 -0700 Subject: [PATCH 243/277] Fix BluetoothError doc typo we copied --- shared-bindings/_bleio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 90b185f79a..91e94e25cd 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -61,7 +61,7 @@ //| class BluetoothError: //| def __init__(self, Exception: Any): -//| """Catch all exception for Bluetooth related errors.""" +//| """Catchall exception for Bluetooth related errors.""" //| ... MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception) From 946373fdcd0d29fabbee7953099b8056c6a29cd8 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 22 Jul 2020 14:17:06 +0200 Subject: [PATCH 244/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 8 ++++++-- locale/cs.po | 8 ++++++-- locale/de_DE.po | 8 ++++++-- locale/es.po | 8 ++++++-- locale/fil.po | 8 ++++++-- locale/fr.po | 8 ++++++-- locale/it_IT.po | 8 ++++++-- locale/ko.po | 8 ++++++-- locale/nl.po | 8 ++++++-- locale/pl.po | 8 ++++++-- locale/pt_BR.po | 8 ++++++-- locale/sv.po | 8 ++++++-- locale/zh_Latn_pinyin.po | 8 ++++++-- 13 files changed, 78 insertions(+), 26 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 9e10156e6a..c85b8edfe5 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-07-06 18:10+0000\n" "Last-Translator: oon arfiandwi \n" "Language-Team: LANGUAGE \n" @@ -111,6 +111,10 @@ msgstr "%q() mengambil posisi argumen %d tapi %d yang diberikan" msgid "'%q' argument required" msgstr "'%q' argumen dibutuhkan" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3137,7 +3141,7 @@ msgstr "struct: index keluar dari jangkauan" msgid "struct: no fields" msgstr "struct: tidak ada fields" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index d09cf1e94b..2cecbcc109 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-05-24 03:22+0000\n" "Last-Translator: dronecz \n" "Language-Team: LANGUAGE \n" @@ -111,6 +111,10 @@ msgstr "" msgid "'%q' argument required" msgstr "" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3106,7 +3110,7 @@ msgstr "" msgid "struct: no fields" msgstr "" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 1e168db528..014cd749f7 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-06-16 18:24+0000\n" "Last-Translator: Andreas Buchen \n" "Language: de_DE\n" @@ -110,6 +110,10 @@ msgstr "%q() nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben" msgid "'%q' argument required" msgstr "'%q' Argument erforderlich" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3190,7 +3194,7 @@ msgstr "struct: index außerhalb gültigen Bereichs" msgid "struct: no fields" msgstr "struct: keine Felder" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "substring nicht gefunden" diff --git a/locale/es.po b/locale/es.po index 0dd09a98df..2ebad85e90 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-07-13 19:24+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" @@ -115,6 +115,10 @@ msgstr "%q() toma %d argumentos posicionales pero %d fueron dados" msgid "'%q' argument required" msgstr "argumento '%q' requerido" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3174,7 +3178,7 @@ msgstr "struct: index fuera de rango" msgid "struct: no fields" msgstr "struct: sin campos" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "substring no encontrado" diff --git a/locale/fil.po b/locale/fil.po index 1297ce186d..e359829309 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -106,6 +106,10 @@ msgstr "" msgid "'%q' argument required" msgstr "'%q' argument kailangan" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3153,7 +3157,7 @@ msgstr "struct: index hindi maabot" msgid "struct: no fields" msgstr "struct: walang fields" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "substring hindi nahanap" diff --git a/locale/fr.po b/locale/fr.po index 4582974d45..6dffd41eb5 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-06-05 17:29+0000\n" "Last-Translator: aberwag \n" "Language: fr\n" @@ -115,6 +115,10 @@ msgstr "%q() prend %d arguments positionnels mais %d ont été donnés" msgid "'%q' argument required" msgstr "'%q' argument requis" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3197,7 +3201,7 @@ msgstr "struct : index hors limites" msgid "struct: no fields" msgstr "struct : aucun champs" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "sous-chaîne non trouvée" diff --git a/locale/it_IT.po b/locale/it_IT.po index 2358433825..92b8fbaaa3 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -105,6 +105,10 @@ msgstr "%q() prende %d argomenti posizionali ma ne sono stati forniti %d" msgid "'%q' argument required" msgstr "'%q' argomento richiesto" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3160,7 +3164,7 @@ msgstr "struct: indice fuori intervallo" msgid "struct: no fields" msgstr "struct: nessun campo" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "sottostringa non trovata" diff --git a/locale/ko.po b/locale/ko.po index 6829f6819f..8aa96e9017 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" @@ -105,6 +105,10 @@ msgstr "" msgid "'%q' argument required" msgstr "" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3103,7 +3107,7 @@ msgstr "" msgid "struct: no fields" msgstr "" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index d39d0bb189..253d18a04c 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-07-13 17:39+0000\n" "Last-Translator: _fonzlate \n" "Language-Team: none\n" @@ -111,6 +111,10 @@ msgstr "%q() verwacht %d positionele argumenten maar kreeg %d" msgid "'%q' argument required" msgstr "'%q' argument vereist" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3162,7 +3166,7 @@ msgstr "struct: index buiten bereik" msgid "struct: no fields" msgstr "struct: geen velden" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "deelreeks niet gevonden" diff --git a/locale/pl.po b/locale/pl.po index e8b7298a2a..b2b2d7a16d 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -105,6 +105,10 @@ msgstr "%q() bierze %d argumentów pozycyjnych, lecz podano %d" msgid "'%q' argument required" msgstr "'%q' wymaga argumentu" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3110,7 +3114,7 @@ msgstr "struct: indeks poza zakresem" msgid "struct: no fields" msgstr "struct: brak pól" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "brak pod-łańcucha" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 024608b3db..b7062f5f0a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-07-09 17:23+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" @@ -111,6 +111,10 @@ msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" msgid "'%q' argument required" msgstr "'%q' argumento(s) requerido(s)" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3186,7 +3190,7 @@ msgstr "struct: índice fora do intervalo" msgid "struct: no fields" msgstr "struct: sem campos" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "a substring não foi encontrada" diff --git a/locale/sv.po b/locale/sv.po index b588cbea7e..ffec64bfea 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2020-07-13 17:39+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" @@ -111,6 +111,10 @@ msgstr "%q() kräver %d positionsargument men %d gavs" msgid "'%q' argument required" msgstr "'%q' argument krävs" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3155,7 +3159,7 @@ msgstr "struct: index utanför intervallet" msgid "struct: no fields" msgstr "struct: inga fält" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "det gick inte att hitta delsträng" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 0f6d55fd16..6c19fb67cd 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-07 14:38-0500\n" +"POT-Creation-Date: 2020-07-17 18:03-0700\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -111,6 +111,10 @@ msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d" msgid "'%q' argument required" msgstr "xūyào '%q' cānshù" +#: py/objarray.c +msgid "'%q' object is not bytes-like" +msgstr "" + #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -3140,7 +3144,7 @@ msgstr "jiégòu: suǒyǐn chāochū fànwéi" msgid "struct: no fields" msgstr "jiégòu: méiyǒu zìduàn" -#: py/objstr.c +#: py/objarray.c py/objstr.c msgid "substring not found" msgstr "wèi zhǎodào zi zìfú chuàn" From 2aef9b02bd8774bf98bb98a150160fdfa8b44f54 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 22 Jul 2020 11:33:19 -0500 Subject: [PATCH 245/277] update --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 9596a5904e..0d2c083a2f 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 9596a5904ed757e6fbffcf03e7aa77ae9ecf5223 +Subproject commit 0d2c083a2fb57a1562d4806775f45273abbfbfae From d83a4ac72db90253089fb33e6f01d6da8f99f8b3 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 22 Jul 2020 12:44:41 -0500 Subject: [PATCH 246/277] Changes to add compiler optimization option --- ports/atmel-samd/Makefile | 2 +- ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pyportal/mpconfigboard.mk | 1 - ports/cxd56/Makefile | 1 + ports/esp32s2/Makefile | 1 + ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk | 1 - ports/litex/Makefile | 1 + ports/mimxrt10xx/Makefile | 1 + ports/nrf/Makefile | 1 + ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk | 2 ++ ports/stm/Makefile | 1 + ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk | 2 ++ 13 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 9fa43af21e..f92e993331 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -106,11 +106,11 @@ CFLAGS += -Os -DNDEBUG CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif - $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization ifeq ($(DEBUG), 1) diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index d32dcf3d19..7e44d0c721 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -15,5 +15,4 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 - OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index e898d0dda5..d766dbe582 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -16,5 +16,4 @@ CIRCUITPY_GAMEPADSHIFT = 1 CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge - OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk index 8a197fbf02..66badb7412 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk @@ -10,5 +10,4 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C" LONGINT_IMPL = MPZ - OPTIMIZATION_LEVEL = 2 diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 6838270a61..8a23059b72 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -123,6 +123,7 @@ CFLAGS += \ -fdata-sections \ -Wall \ +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index ec6a8fc0c4..f094150d7a 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -109,6 +109,7 @@ else ### CFLAGS += -flto endif +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk index 0ccfe06ed7..70caacf87e 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -17,5 +17,4 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wroom - OPTIMIZATION_LEVEL = 2 diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 7ddf3c0610..6f083e5d4d 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -83,6 +83,7 @@ else ### CFLAGS += -flto endif +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 2201d92a31..bfc73d6382 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -108,6 +108,7 @@ CFLAGS += \ -Os -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 28fd44b852..d3c311e3fc 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -92,6 +92,7 @@ else CFLAGS += -flto -flto-partition=none endif +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif diff --git a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk index 38c9933340..db0259423d 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk +++ b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk @@ -14,3 +14,5 @@ EXTERNAL_FLASH_DEVICES = "GD25Q16C" # We use a CFLAGS define here because there are include order issues # if we try to include "mpconfigport.h" into nrfx_config.h . CFLAGS += -DCIRCUITPY_NRF_NUM_I2C=2 + +OPTIMIZATION_LEVEL = 2 diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 8753bd8f84..411d8146ce 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -91,6 +91,7 @@ else # CFLAGS += -flto endif +# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk ifdef OPTIMIZATION_LEVEL CFLAGS += -O$(OPTIMIZATION_LEVEL) endif diff --git a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk index 2b2c0d6db5..e7b54af5c8 100644 --- a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk +++ b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk @@ -15,3 +15,5 @@ LD_COMMON = boards/common_default.ld LD_DEFAULT = boards/STM32F405_default.ld LD_BOOT = boards/STM32F405_boot.ld # UF2 boot option UF2_OFFSET = 0x8010000 + +OPTIMIZATION_LEVEL = 2 From 138189bad130569ac9a9b3051543b804db54ec6f Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 22 Jul 2020 13:58:57 -0400 Subject: [PATCH 247/277] Free timers when modules de-init --- ports/stm/.gitignore | 1 - ports/stm/common-hal/microcontroller/Pin.c | 4 ++++ ports/stm/common-hal/microcontroller/Pin.h | 1 + ports/stm/common-hal/pulseio/PWMOut.c | 2 +- ports/stm/common-hal/pulseio/PulseIn.c | 3 +-- ports/stm/common-hal/pulseio/PulseOut.c | 2 +- ports/stm/common-hal/rgbmatrix/RGBMatrix.c | 11 +++++++---- ports/stm/peripherals/timers.c | 1 + ports/stm/peripherals/timers.h | 8 -------- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ports/stm/.gitignore b/ports/stm/.gitignore index e46c927eec..5d645392ca 100644 --- a/ports/stm/.gitignore +++ b/ports/stm/.gitignore @@ -5,6 +5,5 @@ build-*/ # Reference files ##################### ref/ -_working* .gdb_history diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index d919b07ea7..00763208d9 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -116,6 +116,10 @@ bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) { return !(claimed_pins[pin_port] & 1<tim->tim_index - 1]) { tim_frequencies[self->tim->tim_index - 1] = 0x00; - tim_clock_disable(1 << (self->tim->tim_index - 1)); + stm_peripherals_timer_free(self->handle.Instance); } } diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index db01968c4d..811fc8c492 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -186,14 +186,13 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) { return; } //Remove pulsein slot from shared array - HAL_NVIC_DisableIRQ(self->irq); _objs[self->pin->number] = NULL; reset_pin_number(self->pin->port, self->pin->number); self->pin = NULL; refcount--; if (refcount == 0) { - tim_clock_disable(1<< stm_peripherals_timer_get_index(tim_handle.Instance)); + stm_peripherals_timer_free(tim_handle.Instance); } } diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c index 865b41dcf5..bf578bed22 100644 --- a/ports/stm/common-hal/pulseio/PulseOut.c +++ b/ports/stm/common-hal/pulseio/PulseOut.c @@ -152,7 +152,7 @@ void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) { refcount--; if (refcount == 0) { - tim_clock_disable(1<< stm_peripherals_timer_get_index(tim_handle.Instance)); + stm_peripherals_timer_free(tim_handle.Instance); } } diff --git a/ports/stm/common-hal/rgbmatrix/RGBMatrix.c b/ports/stm/common-hal/rgbmatrix/RGBMatrix.c index 312f153580..3b42631adc 100644 --- a/ports/stm/common-hal/rgbmatrix/RGBMatrix.c +++ b/ports/stm/common-hal/rgbmatrix/RGBMatrix.c @@ -34,20 +34,23 @@ extern void _PM_IRQ_HANDLER(void); void *common_hal_rgbmatrix_timer_allocate() { - return stm_peripherals_find_timer(); + TIM_TypeDef * timer = stm_peripherals_find_timer(); + stm_peripherals_timer_reserve(timer); + return timer; } void common_hal_rgbmatrix_timer_enable(void* ptr) { - HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); + TIM_TypeDef *tim = (TIM_TypeDef*)ptr; + HAL_NVIC_EnableIRQ(stm_peripherals_timer_get_irqnum(tim)); } void common_hal_rgbmatrix_timer_disable(void* ptr) { TIM_TypeDef *tim = (TIM_TypeDef*)ptr; tim->DIER &= ~TIM_DIER_UIE; - HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn); } void common_hal_rgbmatrix_timer_free(void* ptr) { + TIM_TypeDef *tim = (TIM_TypeDef*)ptr; + stm_peripherals_timer_free(tim); common_hal_rgbmatrix_timer_disable(ptr); - // TODO(jepler) properly handle resource allocation including never-reset } diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index 7950d8a57b..baa81d2b5f 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -233,6 +233,7 @@ void stm_peripherals_timer_set_callback(void(*callback)(void), TIM_TypeDef * tim void stm_peripherals_timer_free(TIM_TypeDef * instance) { size_t tim_idx = stm_peripherals_timer_get_index(instance); + HAL_NVIC_DisableIRQ(irq_map[tim_idx]); stm_timer_callback[tim_idx] = NULL; tim_clock_disable(1 << tim_idx); stm_timer_reserved[tim_idx] = false; diff --git a/ports/stm/peripherals/timers.h b/ports/stm/peripherals/timers.h index 02e4e304e3..c4b6c63673 100644 --- a/ports/stm/peripherals/timers.h +++ b/ports/stm/peripherals/timers.h @@ -24,14 +24,6 @@ * THE SOFTWARE. */ -// typedef struct { -// TIM_TypeDef * timer; -// bool reserved; -// bool never_reset; -// void (*stm_timer_callback)(void); -// size_t irq; -// } stm_timer_t; - #include #include "py/mphal.h" #include "peripherals/periph.h" From c1f731d62e6d7bce385baec9ead3bafc46234805 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Wed, 22 Jul 2020 14:11:00 -0400 Subject: [PATCH 248/277] Claim USB pins at startup to prevent overwrites --- ports/stm/common-hal/analogio/AnalogIn.c | 4 ++-- ports/stm/common-hal/analogio/AnalogOut.c | 2 +- ports/stm/common-hal/busio/I2C.c | 6 +++--- ports/stm/common-hal/busio/SPI.c | 8 +++---- ports/stm/common-hal/busio/UART.c | 5 +++-- ports/stm/common-hal/digitalio/DigitalInOut.c | 3 ++- ports/stm/common-hal/microcontroller/Pin.c | 21 +++++++------------ ports/stm/common-hal/microcontroller/Pin.h | 3 +-- ports/stm/common-hal/pulseio/PWMOut.c | 2 +- ports/stm/common-hal/pulseio/PulseIn.c | 3 ++- ports/stm/common-hal/pulseio/PulseOut.c | 2 +- ports/stm/supervisor/usb.c | 5 +++++ shared-module/touchio/TouchIn.c | 3 ++- 13 files changed, 35 insertions(+), 32 deletions(-) diff --git a/ports/stm/common-hal/analogio/AnalogIn.c b/ports/stm/common-hal/analogio/AnalogIn.c index 1d1b308b66..588d687ee1 100644 --- a/ports/stm/common-hal/analogio/AnalogIn.c +++ b/ports/stm/common-hal/analogio/AnalogIn.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "supervisor/shared/translate.h" -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "stm32f4xx_hal.h" #include "stm32f4xx_ll_gpio.h" @@ -57,7 +57,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self, } else { mp_raise_ValueError(translate("Invalid ADC Unit value")); } - claim_pin(pin); + common_hal_mcu_pin_claim(pin); self->pin = pin; } diff --git a/ports/stm/common-hal/analogio/AnalogOut.c b/ports/stm/common-hal/analogio/AnalogOut.c index a505b2bf0f..69c1f3e045 100644 --- a/ports/stm/common-hal/analogio/AnalogOut.c +++ b/ports/stm/common-hal/analogio/AnalogOut.c @@ -86,7 +86,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, dac_on[self->dac_index] = true; self->pin = pin; - claim_pin(pin); + common_hal_mcu_pin_claim(pin); #endif } diff --git a/ports/stm/common-hal/busio/I2C.c b/ports/stm/common-hal/busio/I2C.c index 6adcf55750..b05d28c852 100644 --- a/ports/stm/common-hal/busio/I2C.c +++ b/ports/stm/common-hal/busio/I2C.c @@ -32,7 +32,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "supervisor/shared/translate.h" -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" // I2C timing specs for the H7 and F7 // Configured for maximum possible clock settings for the family @@ -161,8 +161,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, if (HAL_I2C_Init(&(self->handle)) != HAL_OK) { mp_raise_RuntimeError(translate("I2C Init Error")); } - claim_pin(sda); - claim_pin(scl); + common_hal_mcu_pin_claim(sda); + common_hal_mcu_pin_claim(scl); } void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index d4dd6cb3fc..15c746b62a 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -33,7 +33,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "boards/board.h" #include "supervisor/shared/translate.h" -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" // Note that any bugs introduced in this file can cause crashes at startup // for chips using external SPI flash. @@ -233,12 +233,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, self->phase = 0; self->bits = 8; - claim_pin(sck); + common_hal_mcu_pin_claim(sck); if (self->mosi != NULL) { - claim_pin(mosi); + common_hal_mcu_pin_claim(mosi); } if (self->miso != NULL) { - claim_pin(miso); + common_hal_mcu_pin_claim(miso); } } diff --git a/ports/stm/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c index 7450f9897a..08dae7e425 100644 --- a/ports/stm/common-hal/busio/UART.c +++ b/ports/stm/common-hal/busio/UART.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/UART.h" #include "mpconfigport.h" @@ -224,10 +225,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_raise_ValueError(translate("UART Buffer allocation error")); } } - claim_pin(rx); + common_hal_mcu_pin_claim(rx); } if (self->tx != NULL) { - claim_pin(tx); + common_hal_mcu_pin_claim(tx); } self->baudrate = baudrate; self->timeout_ms = timeout * 1000; diff --git a/ports/stm/common-hal/digitalio/DigitalInOut.c b/ports/stm/common-hal/digitalio/DigitalInOut.c index 1354e1a326..a676aeb155 100644 --- a/ports/stm/common-hal/digitalio/DigitalInOut.c +++ b/ports/stm/common-hal/digitalio/DigitalInOut.c @@ -26,6 +26,7 @@ */ #include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" @@ -46,7 +47,7 @@ void common_hal_digitalio_digitalinout_never_reset( digitalinout_result_t common_hal_digitalio_digitalinout_construct( digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) { - claim_pin(pin); + common_hal_mcu_pin_claim(pin); self->pin = pin; GPIO_InitTypeDef GPIO_InitStruct = {0}; diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 00763208d9..9fbdedeade 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -101,25 +101,15 @@ void common_hal_reset_pin(const mcu_pin_obj_t* pin) { reset_pin_number(pin->port, pin->number); } -void claim_pin(const mcu_pin_obj_t* pin) { +void claim_pin(uint8_t pin_port, uint8_t pin_number) { // Set bit in claimed_pins bitmask. - claimed_pins[pin->port] |= 1<number; - - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif + claimed_pins[pin_port] |= 1<port, pin->number); + #ifdef MICROPY_HW_NEOPIXEL + if (pin == MICROPY_HW_NEOPIXEL) { + neopixel_in_use = true; + } + #endif } void common_hal_mcu_pin_reset_number(uint8_t pin_no) { diff --git a/ports/stm/common-hal/microcontroller/Pin.h b/ports/stm/common-hal/microcontroller/Pin.h index 73e5457a5d..f461d3813f 100644 --- a/ports/stm/common-hal/microcontroller/Pin.h +++ b/ports/stm/common-hal/microcontroller/Pin.h @@ -43,9 +43,8 @@ void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. void reset_pin_number(uint8_t pin_port, uint8_t pin_number); -void claim_pin(const mcu_pin_obj_t* pin); +void claim_pin(uint8_t pin_port, uint8_t pin_number); bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number); -bool pin_number_is_resettable(uint8_t pin_port, uint8_t pin_number) void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number); GPIO_TypeDef * pin_port(uint8_t pin_port); uint16_t pin_mask(uint8_t pin_number); diff --git a/ports/stm/common-hal/pulseio/PWMOut.c b/ports/stm/common-hal/pulseio/PWMOut.c index 4df896feb0..ddbadaf4ce 100644 --- a/ports/stm/common-hal/pulseio/PWMOut.c +++ b/ports/stm/common-hal/pulseio/PWMOut.c @@ -33,7 +33,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include STM32_HAL_H -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "timers.h" diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index 811fc8c492..4052c240fe 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -31,6 +31,7 @@ #include "py/gc.h" #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/pulseio/PulseIn.h" #include "timers.h" @@ -174,7 +175,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu // Interrupt starts immediately assign_EXTI_Interrupt(self, pin->number); HAL_NVIC_EnableIRQ(self->irq); - claim_pin(pin); + common_hal_mcu_pin_claim(pin); } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) { diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c index bf578bed22..bcc25d8177 100644 --- a/ports/stm/common-hal/pulseio/PulseOut.c +++ b/ports/stm/common-hal/pulseio/PulseOut.c @@ -36,7 +36,7 @@ #include "supervisor/shared/translate.h" #include STM32_HAL_H -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "timers.h" // A single timer is shared amongst all PulseOut objects under the assumption that diff --git a/ports/stm/supervisor/usb.c b/ports/stm/supervisor/usb.c index 3d53fa3749..c0e012cc62 100644 --- a/ports/stm/supervisor/usb.c +++ b/ports/stm/supervisor/usb.c @@ -86,6 +86,8 @@ void init_usb_hardware(void) { HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); never_reset_pin_number(0, 11); never_reset_pin_number(0, 12); + claim_pin(0, 11); + claim_pin(0, 12); /* Configure VBUS Pin */ #if !(BOARD_NO_VBUS_SENSE) @@ -94,6 +96,7 @@ void init_usb_hardware(void) { GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); never_reset_pin_number(0, 9); + claim_pin(0, 9); #endif /* This for ID line debug */ @@ -108,6 +111,7 @@ void init_usb_hardware(void) { #endif HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); never_reset_pin_number(0, 10); + claim_pin(0, 10); #ifdef STM32F412Zx /* Configure POWER_SWITCH IO pin (F412 ONLY)*/ @@ -116,6 +120,7 @@ void init_usb_hardware(void) { GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); never_reset_pin_number(0, 8); + claim_pin(0, 8); #endif #if CPY_STM32H7 diff --git a/shared-module/touchio/TouchIn.c b/shared-module/touchio/TouchIn.c index 88d12b8b81..3fdf3e0ca1 100644 --- a/shared-module/touchio/TouchIn.c +++ b/shared-module/touchio/TouchIn.c @@ -31,6 +31,7 @@ #include "py/runtime.h" #include "py/mphal.h" #include "shared-bindings/touchio/TouchIn.h" +#include "shared-bindings/microcontroller/Pin.h" // This is a capacitive touch sensing routine using a single digital // pin. The pin should be connected to the sensing pad, and to ground @@ -67,7 +68,7 @@ static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { } void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, const mcu_pin_obj_t *pin) { - claim_pin(pin); + common_hal_mcu_pin_claim(pin); self->digitalinout = m_new_obj(digitalio_digitalinout_obj_t); self->digitalinout->base.type = &digitalio_digitalinout_type; From 61a2e4f94b58d8f7ad09782b0a4e4bb4414b591f Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 21 Jul 2020 20:43:28 -0400 Subject: [PATCH 249/277] Add PWMOut --- ports/esp32s2/Makefile | 2 +- ports/esp32s2/common-hal/pulseio/PWMOut.c | 169 ++++++++++++++++------ ports/esp32s2/common-hal/pulseio/PWMOut.h | 10 +- ports/esp32s2/supervisor/port.c | 4 + 4 files changed, 135 insertions(+), 50 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index b296976885..09c35fd3ad 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -262,7 +262,7 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.elf: $(OBJ) | $(ESP_IDF_COMPONENTS_EXPANDED) $(ESP_AUTOGEN_LD) $(STEPECHO) "LINK $@" - $(Q)$(CC) -o $@ $(LDFLAGS) $^ $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -u newlib_include_pthread_impl + $(Q)$(CC) -o $@ $(LDFLAGS) $^ $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group # $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf diff --git a/ports/esp32s2/common-hal/pulseio/PWMOut.c b/ports/esp32s2/common-hal/pulseio/PWMOut.c index 8f96433c06..15fe96a229 100644 --- a/ports/esp32s2/common-hal/pulseio/PWMOut.c +++ b/ports/esp32s2/common-hal/pulseio/PWMOut.c @@ -24,31 +24,33 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - +#include #include "common-hal/pulseio/PWMOut.h" #include "shared-bindings/pulseio/PWMOut.h" #include "py/runtime.h" #include "driver/ledc.h" -#define LEDC_LS_TIMER LEDC_TIMER_1 -#define LEDC_LS_MODE LEDC_LOW_SPEED_MODE -#define LEDC_LS_CH0_GPIO (18) -#define LEDC_LS_CH0_CHANNEL LEDC_CHANNEL_0 -#define LEDC_LS_CH1_GPIO (19) -#define LEDC_LS_CH1_CHANNEL LEDC_CHANNEL_1 -#define LEDC_LS_CH2_GPIO (4) -#define LEDC_LS_CH2_CHANNEL LEDC_CHANNEL_2 -#define LEDC_LS_CH3_GPIO (5) -#define LEDC_LS_CH3_CHANNEL LEDC_CHANNEL_3 - -#define LEDC_TEST_CH_NUM (4) -#define LEDC_TEST_DUTY (4000) -#define LEDC_TEST_FADE_TIME (3000) - +#define INDEX_EMPTY 0xFF +STATIC uint32_t reserved_timer_freq[LEDC_TIMER_MAX]; +STATIC uint8_t reserved_channels[LEDC_CHANNEL_MAX] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; +STATIC bool never_reset_tim[LEDC_TIMER_MAX]; +STATIC bool never_reset_chan[LEDC_CHANNEL_MAX]; void pwmout_reset(void) { + for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++ ) { + ledc_stop(LEDC_LOW_SPEED_MODE, i, 0); + if (!never_reset_chan[i]) { + reserved_channels[i] = INDEX_EMPTY; + } + } + for (size_t i = 0; i < LEDC_TIMER_MAX; i++ ) { + ledc_timer_rst(LEDC_LOW_SPEED_MODE, i); + if (!never_reset_tim[i]) { + reserved_timer_freq[i] = 0; + } + } } pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, @@ -56,65 +58,142 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, uint16_t duty, uint32_t frequency, bool variable_frequency) { - ledc_timer_config_t ledc_timer = { - .duty_resolution = LEDC_TIMER_16_BIT, // resolution of PWM duty - .freq_hz = frequency, // frequency of PWM signal - .speed_mode = LEDC_LS_MODE, // timer mode - .timer_num = LEDC_LS_TIMER, // timer index - .clk_cfg = LEDC_AUTO_CLK, // Auto select the source clock - }; - // Set configuration of timer0 for high speed channels - ledc_timer_config(&ledc_timer); - - ledc_channel_config_t pwm_channel = { - .channel = LEDC_LS_CH0_CHANNEL, - .duty = 0, - .gpio_num = pin->number, - .speed_mode = LEDC_LS_MODE, - .hpoint = 0, - .timer_sel = LEDC_LS_TIMER - }; - - // Set LED Controller with previously prepared configuration - for (ch = 0; ch < LEDC_TEST_CH_NUM; ch++) { - ledc_channel_config(&ledc_channel[ch]); + // Calculate duty cycle + uint32_t duty_bits = 0; + uint32_t interval = LEDC_APB_CLK_HZ/frequency; + for (size_t i = 0; i < 32; i++) { + if(!(interval >> i)) { + duty_bits = i - 1; + break; + } + } + if (duty_bits < 1) { + mp_raise_ValueError(translate("Invalid frequency")); + } else if (duty_bits >= LEDC_TIMER_14_BIT) { + duty_bits = LEDC_TIMER_13_BIT; } - for (ch = 0; ch < LEDC_TEST_CH_NUM; ch++) { - ledc_set_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel, duty*2); - ledc_update_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel); + // Find a viable timer + size_t timer_index = INDEX_EMPTY; + size_t channel_index = INDEX_EMPTY; + for (size_t i = 0; i < LEDC_TIMER_MAX; i++) { + if ((reserved_timer_freq[i] == frequency) && !variable_frequency) { + //prioritize matched frequencies so we don't needlessly take slots + timer_index = i; + break; + } else if (reserved_timer_freq[i] == 0) { + timer_index = i; + break; + } } + if (timer_index == INDEX_EMPTY) { + // Running out of timers isn't pin related on ESP32S2 so we can't re-use error messages + mp_raise_ValueError(translate("No more timers available")); + } + + // Find a viable channel + for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) { + if (reserved_channels[i] == INDEX_EMPTY) { + channel_index = i; + break; + } + } + if (channel_index == INDEX_EMPTY) { + mp_raise_ValueError(translate("No more channels available")); + } + + // Run configuration + self->tim_handle.timer_num = timer_index; + self->tim_handle.duty_resolution = duty_bits; + self->tim_handle.freq_hz = frequency; + self->tim_handle.speed_mode = LEDC_LOW_SPEED_MODE; + self->tim_handle.clk_cfg = LEDC_AUTO_CLK; + + if (ledc_timer_config(&(self->tim_handle)) != ESP_OK) { + mp_raise_ValueError(translate("Could not initialize timer")); + } + + self->chan_handle.channel = channel_index; + self->chan_handle.duty = duty >> (16 - duty_bits); + self->chan_handle.gpio_num = pin->number; + self->chan_handle.speed_mode = LEDC_LOW_SPEED_MODE; // Only LS is allowed on ESP32-S2 + self->chan_handle.hpoint = 0; + self->chan_handle.timer_sel = timer_index; + + if (ledc_channel_config(&(self->chan_handle))) { + mp_raise_ValueError(translate("Could not initialize channel")); + } + + // Make reservations + reserved_timer_freq[timer_index] = frequency; + reserved_channels[channel_index] = timer_index; + + self->variable_frequency = variable_frequency; + self->pin_number = pin->number; + self->deinited = false; + self->duty_resolution = duty_bits; + claim_pin(pin); + + // Set initial duty + ledc_set_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, duty >> (16 - duty_bits)); + ledc_update_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel); return PWMOUT_OK; } void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) { + never_reset_tim[self->tim_handle.timer_num] = true; + never_reset_chan[self->chan_handle.channel] = true; } void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) { + never_reset_tim[self->tim_handle.timer_num] = false; + never_reset_chan[self->chan_handle.channel] = false; } bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) { - return false; + return self->deinited == true; } void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) { + if (common_hal_pulseio_pwmout_deinited(self)) { + return; + } + ledc_stop(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, 0); + ledc_timer_rst(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num); + // Search if any other channel is using the timer + bool taken = false; + for (size_t i =0; i < LEDC_CHANNEL_MAX; i++) { + if (reserved_channels[i] == self->tim_handle.timer_num) { + taken = true; + } + } + // Variable frequency means there's only one channel on the timer + if (!taken || self->variable_frequency) { + reserved_timer_freq[self->tim_handle.timer_num] = 0; + } + reset_pin_number(self->pin_number); + reserved_channels[self->chan_handle.channel] = INDEX_EMPTY; + self->deinited = true; } void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) { + ledc_set_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, duty >> (16 - self->duty_resolution)); + ledc_update_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel); } uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) { - return false; + return ledc_get_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel) << (16 - self->duty_resolution); } void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_t frequency) { + ledc_set_freq(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num, frequency); } uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) { - return false; + return ledc_get_freq(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num); } bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self) { - return false; + return self->variable_frequency; } diff --git a/ports/esp32s2/common-hal/pulseio/PWMOut.h b/ports/esp32s2/common-hal/pulseio/PWMOut.h index 28484e9238..90a0c3ed96 100644 --- a/ports/esp32s2/common-hal/pulseio/PWMOut.h +++ b/ports/esp32s2/common-hal/pulseio/PWMOut.h @@ -28,14 +28,16 @@ #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PULSEIO_PWMOUT_H #include "common-hal/microcontroller/Pin.h" +#include "driver/ledc.h" typedef struct { mp_obj_base_t base; - uint8_t channel; + ledc_timer_config_t tim_handle; + ledc_channel_config_t chan_handle; + uint16_t pin_number; + uint8_t duty_resolution; bool variable_frequency: 1; - uint16_t duty_cycle; - uint32_t frequency; - uint32_t period; + bool deinited: 1; } pulseio_pwmout_obj_t; void pwmout_reset(void); diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index a80550b309..e4767e5146 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -38,6 +38,7 @@ #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" +#include "common-hal/pulseio/PWMOut.h" #include "supervisor/memory.h" #include "supervisor/shared/tick.h" @@ -64,6 +65,9 @@ void reset_port(void) { // A larger delay so the idle task can run and do any IDF cleanup needed. vTaskDelay(4); +#if CIRCUITPY_PULSEIO + pwmout_reset(); +#endif #if CIRCUITPY_BUSIO i2c_reset(); spi_reset(); From b42dc3b884876ba6484165e5905202cf7b902a57 Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Wed, 22 Jul 2020 19:59:14 +0000 Subject: [PATCH 250/277] Translated using Weblate (Spanish) Currently translated at 100.0% (780 of 780 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 2ebad85e90..68f44c20d8 100644 --- a/locale/es.po +++ b/locale/es.po @@ -3,13 +3,12 @@ # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT -#, fuzzy msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-17 18:03-0700\n" -"PO-Revision-Date: 2020-07-13 19:24+0000\n" +"PO-Revision-Date: 2020-07-22 20:48+0000\n" "Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" @@ -117,7 +116,7 @@ msgstr "argumento '%q' requerido" #: py/objarray.c msgid "'%q' object is not bytes-like" -msgstr "" +msgstr "el objeto '%q' no es similar a bytes" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format From 441d9d2286df2094cb6df3410114bb4e79da837f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 23 Jul 2020 01:21:48 +0200 Subject: [PATCH 251/277] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 28 ++++++++++++++++++++++++---- locale/cs.po | 28 ++++++++++++++++++++++++---- locale/de_DE.po | 28 ++++++++++++++++++++++++---- locale/es.po | 28 ++++++++++++++++++++++++---- locale/fil.po | 28 ++++++++++++++++++++++++---- locale/fr.po | 28 ++++++++++++++++++++++++---- locale/it_IT.po | 28 ++++++++++++++++++++++++---- locale/ko.po | 28 ++++++++++++++++++++++++---- locale/nl.po | 28 ++++++++++++++++++++++++---- locale/pl.po | 28 ++++++++++++++++++++++++---- locale/pt_BR.po | 28 ++++++++++++++++++++++++---- locale/sv.po | 28 ++++++++++++++++++++++++---- locale/zh_Latn_pinyin.po | 28 ++++++++++++++++++++++++---- 13 files changed, 312 insertions(+), 52 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index c85b8edfe5..bd865c0548 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -84,10 +84,15 @@ msgstr "indeks %q harus bilangan bulat, bukan %s" msgid "%q list must be a list" msgstr "daftar %q harus berupa daftar" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q harus >= 1" @@ -325,6 +330,11 @@ msgstr "Semua timer sedang digunakan" msgid "Already advertising." msgstr "Sudah disebarkan." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "AnalogIn tidak didukung pada pin yang diberikan" @@ -360,6 +370,11 @@ msgstr "Nilai array harus berupa byte tunggal." msgid "At most %d %q may be specified (not %d)" msgstr "Paling banyak %d %q dapat ditentukan (bukan %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "Mencoba alokasi heap ketika MicroPython VM tidak berjalan." @@ -481,7 +496,9 @@ msgstr "Panggil super().__init__() sebelum mengakses objek asli." msgid "Can't set CCCD on local Characteristic" msgstr "Tidak dapat mengatur CCCD pada Karakteristik lokal" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Tidak dapat menghapus nilai" @@ -1379,6 +1396,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "" @@ -1465,7 +1483,9 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 2cecbcc109..cf91416270 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -84,10 +84,15 @@ msgstr "Indexy% q musí být celá čísla, nikoli% s" msgid "%q list must be a list" msgstr "Seznam% q musí být seznam" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "% q musí být > = 1" @@ -325,6 +330,11 @@ msgstr "" msgid "Already advertising." msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "" @@ -360,6 +370,11 @@ msgstr "" msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -479,7 +494,9 @@ msgstr "" msgid "Can't set CCCD on local Characteristic" msgstr "" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "" @@ -1359,6 +1376,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "" @@ -1443,7 +1461,9 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 014cd749f7..9b07989ca6 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -83,10 +83,15 @@ msgstr "%q Indizes müssen Integer sein, nicht %s" msgid "%q list must be a list" msgstr "%q Liste muss eine Liste sein" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q muss >= 1 sein" @@ -324,6 +329,11 @@ msgstr "Alle timer werden benutzt" msgid "Already advertising." msgstr "Bereits am anbieten (advertising)." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "AnalogIn ist an diesem Pin nicht unterstützt" @@ -359,6 +369,11 @@ msgstr "Array-Werte sollten aus Einzelbytes bestehen." msgid "At most %d %q may be specified (not %d)" msgstr "Es darf höchstens %d %q spezifiziert werden (nicht %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -482,7 +497,9 @@ msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." msgid "Can't set CCCD on local Characteristic" msgstr "CCCD kann nicht auf lokales Merkmal eingestellt werden" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Kann Werte nicht löschen" @@ -1389,6 +1406,7 @@ msgstr "RTS / CTS / RS485 Wird von diesem Gerät noch nicht unterstützt" msgid "Random number generation error" msgstr "Fehler bei der Erzeugung von Zufallszahlen" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Nur lesen möglich, da Schreibgeschützt" @@ -1473,7 +1491,9 @@ msgid "Slice and value different lengths." msgstr "Slice und Wert (value) haben unterschiedliche Längen." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slices werden nicht unterstützt" diff --git a/locale/es.po b/locale/es.po index 68f44c20d8..8d19b0ab01 100644 --- a/locale/es.po +++ b/locale/es.po @@ -87,10 +87,15 @@ msgstr "%q indices deben ser enteros, no %s" msgid "%q list must be a list" msgstr "%q lista debe ser una lista" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q debe ser >= 1" @@ -330,6 +335,11 @@ msgstr "Todos los timers en uso" msgid "Already advertising." msgstr "Ya se encuentra publicando." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "El pin proporcionado no soporta AnalogIn" @@ -365,6 +375,11 @@ msgstr "Valores del array deben ser bytes individuales." msgid "At most %d %q may be specified (not %d)" msgstr "Como máximo %d %q se puede especificar (no %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -488,7 +503,9 @@ msgstr "Llame a super().__ init __() antes de acceder al objeto nativo." msgid "Can't set CCCD on local Characteristic" msgstr "No se puede configurar CCCD en la característica local" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "No se puede eliminar valores" @@ -1388,6 +1405,7 @@ msgstr "Sin capacidad de RTS/CTS/RS485 para este dispositivo" msgid "Random number generation error" msgstr "Error de generación de números aleatorios" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Solo-lectura" @@ -1472,7 +1490,9 @@ msgid "Slice and value different lengths." msgstr "Slice y value tienen tamaños diferentes." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Rebanadas no soportadas" diff --git a/locale/fil.po b/locale/fil.po index e359829309..92dc9cc910 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -76,10 +76,15 @@ msgstr "%q indeks ay dapat integers, hindi %s" msgid "%q list must be a list" msgstr "" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c #, fuzzy msgid "%q must be >= 1" msgstr "aarehas na haba dapat ang buffer slices" @@ -321,6 +326,11 @@ msgstr "Lahat ng timer ginagamit" msgid "Already advertising." msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "" @@ -356,6 +366,11 @@ msgstr "Array values ay dapat single bytes." msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -478,7 +493,9 @@ msgstr "" msgid "Can't set CCCD on local Characteristic" msgstr "" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Hindi mabura ang values" @@ -1373,6 +1390,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Basahin-lamang" @@ -1458,7 +1476,9 @@ msgid "Slice and value different lengths." msgstr "Slice at value iba't ibang haba." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Hindi suportado ang Slices" diff --git a/locale/fr.po b/locale/fr.po index 6dffd41eb5..8953efe37e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -88,10 +88,15 @@ msgstr "les indices %q doivent être des entiers, pas %s" msgid "%q list must be a list" msgstr "La liste %q doit être une liste" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q doit être >=1" @@ -329,6 +334,11 @@ msgstr "Tous les timers sont utilisés" msgid "Already advertising." msgstr "S'annonce déjà." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée" @@ -365,6 +375,11 @@ msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'." msgid "At most %d %q may be specified (not %d)" msgstr "Au plus %d %q peut être spécifié (pas %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -488,7 +503,9 @@ msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." msgid "Can't set CCCD on local Characteristic" msgstr "Impossible de définir CCCD sur une caractéristique locale" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Impossible de supprimer les valeurs" @@ -1394,6 +1411,7 @@ msgstr "RTS / CTS / RS485 Pas encore pris en charge sur cet appareil" msgid "Random number generation error" msgstr "Erreur de génération de nombres aléatoires" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Lecture seule" @@ -1478,7 +1496,9 @@ msgid "Slice and value different lengths." msgstr "Tranche et valeur de tailles différentes." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Tranches non supportées" diff --git a/locale/it_IT.po b/locale/it_IT.po index 92b8fbaaa3..9f0aea9e9b 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -76,10 +76,15 @@ msgstr "gli indici %q devono essere interi, non %s" msgid "%q list must be a list" msgstr "" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c #, fuzzy msgid "%q must be >= 1" msgstr "slice del buffer devono essere della stessa lunghezza" @@ -320,6 +325,11 @@ msgstr "Tutti i timer utilizzati" msgid "Already advertising." msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "" @@ -355,6 +365,11 @@ msgstr "Valori di Array dovrebbero essere bytes singulari" msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -478,7 +493,9 @@ msgstr "" msgid "Can't set CCCD on local Characteristic" msgstr "" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Impossibile cancellare valori" @@ -1382,6 +1399,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Sola lettura" @@ -1469,7 +1487,9 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slice non supportate" diff --git a/locale/ko.po b/locale/ko.po index 8aa96e9017..e0f4dd9cb8 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -78,10 +78,15 @@ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" msgid "%q list must be a list" msgstr "" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q 는 >=1이어야합니다" @@ -319,6 +324,11 @@ msgstr "모든 타이머가 사용 중입니다" msgid "Already advertising." msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "" @@ -354,6 +364,11 @@ msgstr "" msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -475,7 +490,9 @@ msgstr "" msgid "Can't set CCCD on local Characteristic" msgstr "" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "값을 삭제할 수 없습니다" @@ -1355,6 +1372,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "" @@ -1439,7 +1457,9 @@ msgid "Slice and value different lengths." msgstr "" #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 253d18a04c..29591dfd80 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -84,10 +84,15 @@ msgstr "%q indexen moeten integers zijn, niet %s" msgid "%q list must be a list" msgstr "%q lijst moet een lijst zijn" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q moet >= 1 zijn" @@ -325,6 +330,11 @@ msgstr "Alle timers zijn in gebruik" msgid "Already advertising." msgstr "Advertising is al bezig." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "AnalogIn niet ondersteund door gegeven pin" @@ -360,6 +370,11 @@ msgstr "Array waardes moet enkele bytes zijn." msgid "At most %d %q may be specified (not %d)" msgstr "Op zijn meest %d %q mogen worden gespecificeerd (niet %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "heap allocatie geprobeerd terwijl MicroPython VM niet draait." @@ -481,7 +496,9 @@ msgstr "Roep super().__init__() aan voor toegang native object." msgid "Can't set CCCD on local Characteristic" msgstr "Kan CCCD niet toewijzen aan lokaal Characteristic" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Kan waardes niet verwijderen" @@ -1385,6 +1402,7 @@ msgstr "RTS/CTS/RS485 Nog niet ondersteund door dit apparaat" msgid "Random number generation error" msgstr "Random number generatie fout" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Alleen-lezen" @@ -1469,7 +1487,9 @@ msgid "Slice and value different lengths." msgstr "Slice en waarde hebben verschillende lengtes." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slices niet ondersteund" diff --git a/locale/pl.po b/locale/pl.po index b2b2d7a16d..e359e71b67 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -78,10 +78,15 @@ msgstr "%q indeks musi być liczbą całkowitą, a nie %s" msgid "%q list must be a list" msgstr "" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q musi być >= 1" @@ -319,6 +324,11 @@ msgstr "Wszystkie timery w użyciu" msgid "Already advertising." msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "" @@ -354,6 +364,11 @@ msgstr "Wartości powinny być bajtami." msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -475,7 +490,9 @@ msgstr "" msgid "Can't set CCCD on local Characteristic" msgstr "" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Nie można usunąć" @@ -1357,6 +1374,7 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Tylko do odczytu" @@ -1441,7 +1459,9 @@ msgid "Slice and value different lengths." msgstr "Fragment i wartość są różnych długości." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Fragmenty nieobsługiwane" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b7062f5f0a..484764ac2b 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -84,10 +84,15 @@ msgstr "Os índices %q devem ser inteiros, e não %s" msgid "%q list must be a list" msgstr "A lista %q deve ser uma lista" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q deve ser >= 1" @@ -327,6 +332,11 @@ msgstr "Todos os temporizadores em uso" msgid "Already advertising." msgstr "Já está anunciando." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "O AnalogIn não é compatível no pino informado" @@ -362,6 +372,11 @@ msgstr "Os valores das matrizes devem ser bytes simples." msgid "At most %d %q may be specified (not %d)" msgstr "Pelo menos %d %q pode ser definido (não %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "" @@ -487,7 +502,9 @@ msgstr "Chame super().__init__() antes de acessar o objeto nativo." msgid "Can't set CCCD on local Characteristic" msgstr "Não é possível definir o CCCD com a característica local" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Não é possível excluir valores" @@ -1393,6 +1410,7 @@ msgstr "RTS/CTS/RS485 Ainda não é compatível neste dispositivo" msgid "Random number generation error" msgstr "Houve um erro na geração do número aleatório" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Somente leitura" @@ -1477,7 +1495,9 @@ msgid "Slice and value different lengths." msgstr "Fatie e avalie os diferentes comprimentos." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Fatiamento não compatível" diff --git a/locale/sv.po b/locale/sv.po index ffec64bfea..075db8ab09 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -84,10 +84,15 @@ msgstr "Indexet %q måste vara ett heltal, inte %s" msgid "%q list must be a list" msgstr "%q-listan måste vara en lista" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q måste vara >= 1" @@ -325,6 +330,11 @@ msgstr "Alla timers används" msgid "Already advertising." msgstr "Annonserar redan." +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "AnalogIn stöds inte på angiven pinne" @@ -360,6 +370,11 @@ msgstr "Matrisvärden ska bestå av enstaka bytes." msgid "At most %d %q may be specified (not %d)" msgstr "Högst %d %q kan anges (inte %d)" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "Försökte tilldela heap när MicroPython VM inte körs." @@ -481,7 +496,9 @@ msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." msgid "Can't set CCCD on local Characteristic" msgstr "Kan inte ställa in CCCD på lokal karaktäristik" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Kan inte radera värden" @@ -1381,6 +1398,7 @@ msgstr "RTS/CTS/RS485 Stöds ännu inte på den här enheten" msgid "Random number generation error" msgstr "Fel vid generering av slumptal" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Skrivskyddad" @@ -1465,7 +1483,9 @@ msgid "Slice and value different lengths." msgstr "Slice och värde har olika längd." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Slice stöds inte" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 6c19fb67cd..a820c142c6 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -84,10 +84,15 @@ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" msgid "%q list must be a list" msgstr "" +#: shared-bindings/memorymonitor/AllocationAlarm.c +msgid "%q must be >= 0" +msgstr "" + #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c -#: shared-bindings/vectorio/Rectangle.c +#: shared-bindings/displayio/Shape.c +#: shared-bindings/memorymonitor/AllocationAlarm.c +#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c msgid "%q must be >= 1" msgstr "%q bìxū dàyú huò děngyú 1" @@ -325,6 +330,11 @@ msgstr "Suǒyǒu jìshí qì shǐyòng" msgid "Already advertising." msgstr "Mùqián zhèngzài guǎngbò" +#: shared-module/memorymonitor/AllocationAlarm.c +#: shared-module/memorymonitor/AllocationSize.c +msgid "Already running" +msgstr "" + #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" msgstr "Gěi dìng de yǐn jiǎo bù zhīchí AnalogIn" @@ -360,6 +370,11 @@ msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié." msgid "At most %d %q may be specified (not %d)" msgstr "" +#: shared-module/memorymonitor/AllocationAlarm.c +#, c-format +msgid "Attempt to allocate %d blocks" +msgstr "" + #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." msgstr "MicroPython VM zài wèi yùnxíng shí chángshì fēnpèi duī." @@ -481,7 +496,9 @@ msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__() msgid "Can't set CCCD on local Characteristic" msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng" -#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/Bitmap.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" msgstr "Wúfǎ shānchú zhí" @@ -1371,6 +1388,7 @@ msgstr "" msgid "Random number generation error" msgstr "Suíjī shù shēngchéng cuòwù" +#: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Read-only" msgstr "Zhǐ dú" @@ -1455,7 +1473,9 @@ msgid "Slice and value different lengths." msgstr "Qiēpiàn hé zhí bùtóng chángdù." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/TileGrid.c shared-bindings/pulseio/PulseIn.c +#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/memorymonitor/AllocationSize.c +#: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" msgstr "Qiēpiàn bù shòu zhīchí" From 2bd6d056638f05185eb497ca2d039ebe9f386327 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 21 Jul 2020 16:26:46 -0700 Subject: [PATCH 252/277] Add externs. GCC10 complains about duplicate defines --- main.c | 2 ++ ports/atmel-samd/mphalport.h | 4 ++-- py/objstr.h | 4 ++-- shared-bindings/_pixelbuf/PixelBuf.h | 2 +- shared-bindings/digitalio/Direction.h | 2 +- shared-bindings/digitalio/DriveMode.h | 2 +- shared-bindings/digitalio/Pull.h | 2 +- shared-bindings/microcontroller/Processor.h | 2 +- shared-bindings/microcontroller/RunMode.h | 2 +- shared-bindings/nvm/ByteArray.h | 2 +- shared-bindings/os/__init__.h | 2 +- shared-bindings/supervisor/Runtime.h | 2 +- shared-bindings/usb_hid/Device.h | 2 +- supervisor/serial.h | 2 +- tools/gen_usb_descriptor.py | 10 +++++----- 15 files changed, 22 insertions(+), 20 deletions(-) diff --git a/main.c b/main.c index 2fb4689136..8c5c9ac37d 100755 --- a/main.c +++ b/main.c @@ -331,6 +331,8 @@ bool run_code_py(safe_mode_t safe_mode) { } } +FIL* boot_output_file; + void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { // If not in safe mode, run boot before initing USB and capture output in a // file. diff --git a/ports/atmel-samd/mphalport.h b/ports/atmel-samd/mphalport.h index f119717499..adc65ade53 100644 --- a/ports/atmel-samd/mphalport.h +++ b/ports/atmel-samd/mphalport.h @@ -37,8 +37,8 @@ #define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32()) // Number of bytes in receive buffer -volatile uint8_t usb_rx_count; -volatile bool mp_cdc_enabled; +extern volatile uint8_t usb_rx_count; +extern volatile bool mp_cdc_enabled; int receive_usb(void); diff --git a/py/objstr.h b/py/objstr.h index 4b5e2054e0..cddc6a83a1 100644 --- a/py/objstr.h +++ b/py/objstr.h @@ -77,8 +77,8 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s mp_obj_t index, bool is_slice); const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction); -const char nibble_to_hex_upper[16]; -const char nibble_to_hex_lower[16]; +extern const char nibble_to_hex_upper[16]; +extern const char nibble_to_hex_lower[16]; MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj); MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj); diff --git a/shared-bindings/_pixelbuf/PixelBuf.h b/shared-bindings/_pixelbuf/PixelBuf.h index 14ee2e900b..0b09a57715 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.h +++ b/shared-bindings/_pixelbuf/PixelBuf.h @@ -29,7 +29,7 @@ #include "shared-module/_pixelbuf/PixelBuf.h" -const mp_obj_type_t pixelbuf_pixelbuf_type; +extern const mp_obj_type_t pixelbuf_pixelbuf_type; void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n, pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write, uint8_t* header, diff --git a/shared-bindings/digitalio/Direction.h b/shared-bindings/digitalio/Direction.h index d71f48c2ed..17e1eda8db 100644 --- a/shared-bindings/digitalio/Direction.h +++ b/shared-bindings/digitalio/Direction.h @@ -37,7 +37,7 @@ typedef struct { mp_obj_base_t base; } digitalio_direction_obj_t; -const mp_obj_type_t digitalio_direction_type; +extern const mp_obj_type_t digitalio_direction_type; extern const digitalio_direction_obj_t digitalio_direction_input_obj; extern const digitalio_direction_obj_t digitalio_direction_output_obj; diff --git a/shared-bindings/digitalio/DriveMode.h b/shared-bindings/digitalio/DriveMode.h index 47d036b3ae..01ecaa4ae9 100644 --- a/shared-bindings/digitalio/DriveMode.h +++ b/shared-bindings/digitalio/DriveMode.h @@ -38,7 +38,7 @@ typedef struct { mp_obj_base_t base; } digitalio_drive_mode_obj_t; -const mp_obj_type_t digitalio_drive_mode_type; +extern const mp_obj_type_t digitalio_drive_mode_type; extern const digitalio_drive_mode_obj_t digitalio_drive_mode_push_pull_obj; extern const digitalio_drive_mode_obj_t digitalio_drive_mode_open_drain_obj; diff --git a/shared-bindings/digitalio/Pull.h b/shared-bindings/digitalio/Pull.h index 22fb6cd0e7..b97e8fb255 100644 --- a/shared-bindings/digitalio/Pull.h +++ b/shared-bindings/digitalio/Pull.h @@ -35,7 +35,7 @@ typedef enum _digitalio_pull_t { PULL_DOWN } digitalio_pull_t; -const mp_obj_type_t digitalio_pull_type; +extern const mp_obj_type_t digitalio_pull_type; typedef struct { mp_obj_base_t base; diff --git a/shared-bindings/microcontroller/Processor.h b/shared-bindings/microcontroller/Processor.h index 1088112f43..0f520f940c 100644 --- a/shared-bindings/microcontroller/Processor.h +++ b/shared-bindings/microcontroller/Processor.h @@ -31,7 +31,7 @@ #include "common-hal/microcontroller/Processor.h" -const mp_obj_type_t mcu_processor_type; +extern const mp_obj_type_t mcu_processor_type; uint32_t common_hal_mcu_processor_get_frequency(void); float common_hal_mcu_processor_get_temperature(void); diff --git a/shared-bindings/microcontroller/RunMode.h b/shared-bindings/microcontroller/RunMode.h index 5e8b6e6465..ce90ab93a7 100644 --- a/shared-bindings/microcontroller/RunMode.h +++ b/shared-bindings/microcontroller/RunMode.h @@ -35,7 +35,7 @@ typedef enum { RUNMODE_BOOTLOADER } mcu_runmode_t; -const mp_obj_type_t mcu_runmode_type; +extern const mp_obj_type_t mcu_runmode_type; typedef struct { mp_obj_base_t base; diff --git a/shared-bindings/nvm/ByteArray.h b/shared-bindings/nvm/ByteArray.h index 5eee3ab502..9375bcb857 100644 --- a/shared-bindings/nvm/ByteArray.h +++ b/shared-bindings/nvm/ByteArray.h @@ -29,7 +29,7 @@ #include "common-hal/nvm/ByteArray.h" -const mp_obj_type_t nvm_bytearray_type; +extern const mp_obj_type_t nvm_bytearray_type; uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self); diff --git a/shared-bindings/os/__init__.h b/shared-bindings/os/__init__.h index 3776fef643..8394890def 100644 --- a/shared-bindings/os/__init__.h +++ b/shared-bindings/os/__init__.h @@ -32,7 +32,7 @@ #include "py/objtuple.h" -const mp_rom_obj_tuple_t common_hal_os_uname_info_obj; +extern const mp_rom_obj_tuple_t common_hal_os_uname_info_obj; mp_obj_t common_hal_os_uname(void); void common_hal_os_chdir(const char* path); diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h index 864b070cdb..2dc59c3ab6 100755 --- a/shared-bindings/supervisor/Runtime.h +++ b/shared-bindings/supervisor/Runtime.h @@ -31,7 +31,7 @@ #include "py/obj.h" -const mp_obj_type_t supervisor_runtime_type; +extern const mp_obj_type_t supervisor_runtime_type; bool common_hal_get_serial_connected(void); diff --git a/shared-bindings/usb_hid/Device.h b/shared-bindings/usb_hid/Device.h index cb9a64b5ea..017995ccc3 100644 --- a/shared-bindings/usb_hid/Device.h +++ b/shared-bindings/usb_hid/Device.h @@ -29,7 +29,7 @@ #include "shared-module/usb_hid/Device.h" -const mp_obj_type_t usb_hid_device_type; +extern const mp_obj_type_t usb_hid_device_type; void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t* report, uint8_t len); uint8_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self); diff --git a/supervisor/serial.h b/supervisor/serial.h index ef88ad346d..066886303e 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -35,7 +35,7 @@ #ifdef CIRCUITPY_BOOT_OUTPUT_FILE #include "lib/oofatfs/ff.h" -FIL* boot_output_file; +extern FIL* boot_output_file; #endif void serial_early_init(void); diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py index 9a8423c323..adec33100e 100644 --- a/tools/gen_usb_descriptor.py +++ b/tools/gen_usb_descriptor.py @@ -539,14 +539,14 @@ h_file.write("""\ #include -const uint8_t usb_desc_dev[{device_length}]; +extern const uint8_t usb_desc_dev[{device_length}]; // Make sure the control buffer is big enough to fit the descriptor. #define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length} -const uint8_t usb_desc_cfg[{configuration_length}]; -uint16_t usb_serial_number[{serial_number_length}]; -uint16_t const * const string_desc_arr [{string_descriptor_length}]; +extern const uint8_t usb_desc_cfg[{configuration_length}]; +extern uint16_t usb_serial_number[{serial_number_length}]; +extern uint16_t const * const string_desc_arr [{string_descriptor_length}]; -const uint8_t hid_report_descriptor[{hid_report_descriptor_length}]; +extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}]; #define USB_HID_NUM_DEVICES {hid_num_devices} From f43834aba2ed9f8f69d961a6554bc81ecaa98f08 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 21 May 2020 11:27:09 +1000 Subject: [PATCH 253/277] py/py.mk: Use additional CFLAGS to compile string0.c. Otherwise functions like memset might get optimised to call themselves (eg with gcc 10). And provide CFLAGS_BUILTIN so these options can be changed by a port if needed. Fixes issue #6053. --- py/py.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/py/py.mk b/py/py.mk index 3cb505920c..3e1d7989f9 100644 --- a/py/py.mk +++ b/py/py.mk @@ -346,6 +346,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/ $(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h +# Standard C functions like memset need to be compiled with special flags so +# the compiler does not optimise these functions in terms of themselves. +CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto +$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) + # Force nlr code to always be compiled with space-saving optimisation so # that the function preludes are of a minimal and predictable form. $(PY_BUILD)/nlr%.o: CFLAGS += -Os From 226efb37bc771119093ac693a54dd7ce9c504ade Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 23 Jul 2020 00:34:30 +0000 Subject: [PATCH 254/277] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (783 of 783 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 484764ac2b..10f3bf6113 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-07-17 18:03-0700\n" -"PO-Revision-Date: 2020-07-09 17:23+0000\n" +"PO-Revision-Date: 2020-07-23 02:57+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -86,7 +86,7 @@ msgstr "A lista %q deve ser uma lista" #: shared-bindings/memorymonitor/AllocationAlarm.c msgid "%q must be >= 0" -msgstr "" +msgstr "%q deve ser >= 0" #: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c @@ -118,7 +118,7 @@ msgstr "'%q' argumento(s) requerido(s)" #: py/objarray.c msgid "'%q' object is not bytes-like" -msgstr "" +msgstr "objetos '%q' não são bytes-like" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format @@ -335,7 +335,7 @@ msgstr "Já está anunciando." #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" -msgstr "" +msgstr "Já está em execução" #: ports/cxd56/common-hal/analogio/AnalogIn.c msgid "AnalogIn not supported on given pin" @@ -375,7 +375,7 @@ msgstr "Pelo menos %d %q pode ser definido (não %d)" #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" -msgstr "" +msgstr "Tentativa de alocar %d blocos" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when MicroPython VM not running." From cf0a4d208e71260b6f2796ba4f1f0edc36f2dc04 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 23 Jul 2020 11:21:19 -0400 Subject: [PATCH 255/277] Fix unintended timer reset, style changes --- ports/esp32s2/common-hal/pulseio/PWMOut.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/pulseio/PWMOut.c b/ports/esp32s2/common-hal/pulseio/PWMOut.c index 15fe96a229..c4f5e18dd4 100644 --- a/ports/esp32s2/common-hal/pulseio/PWMOut.c +++ b/ports/esp32s2/common-hal/pulseio/PWMOut.c @@ -34,7 +34,7 @@ #define INDEX_EMPTY 0xFF STATIC uint32_t reserved_timer_freq[LEDC_TIMER_MAX]; -STATIC uint8_t reserved_channels[LEDC_CHANNEL_MAX] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; +STATIC uint8_t reserved_channels[LEDC_CHANNEL_MAX]; STATIC bool never_reset_tim[LEDC_TIMER_MAX]; STATIC bool never_reset_chan[LEDC_CHANNEL_MAX]; @@ -135,8 +135,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, claim_pin(pin); // Set initial duty - ledc_set_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, duty >> (16 - duty_bits)); - ledc_update_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel); + common_hal_pulseio_pwmout_set_duty_cycle(self, duty); return PWMOUT_OK; } @@ -160,7 +159,6 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) { return; } ledc_stop(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, 0); - ledc_timer_rst(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num); // Search if any other channel is using the timer bool taken = false; for (size_t i =0; i < LEDC_CHANNEL_MAX; i++) { @@ -170,6 +168,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) { } // Variable frequency means there's only one channel on the timer if (!taken || self->variable_frequency) { + ledc_timer_rst(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num); reserved_timer_freq[self->tim_handle.timer_num] = 0; } reset_pin_number(self->pin_number); @@ -178,7 +177,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) { } void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) { - ledc_set_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, duty >> (16 - self->duty_resolution)); + ledc_set_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, duty >> (16 - self->duty_resolution)); ledc_update_duty(LEDC_LOW_SPEED_MODE, self->chan_handle.channel); } From 4b6e02949d04d68bbd053436f4ea8fe2ecba38df Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 23 Jul 2020 11:06:14 -0700 Subject: [PATCH 256/277] Remove stop kwarg from I2C writeto. Fixes #2082 --- shared-bindings/bitbangio/I2C.c | 9 +++------ shared-bindings/busio/I2C.c | 15 +++++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index a9ab475bdb..212956726a 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -232,9 +232,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_rea //| :param int address: 7-bit device address //| :param bytearray buffer: buffer containing the bytes to write //| :param int start: Index to start writing from -//| :param int end: Index to read up to but not include -//| :param bool stop: If true, output an I2C stop condition after the buffer is written. -//| Deprecated. Will be removed in 6.x and act as stop=True.""" +//| :param int end: Index to read up to but not include""" //| ... //| // Shared arg parsing for writeto and writeto_then_readfrom. @@ -256,13 +254,12 @@ STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer } STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop }; + enum { ARG_address, ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { { MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, - { MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, }; bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); check_for_deinit(self); @@ -271,7 +268,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int, - args[ARG_end].u_int, args[ARG_stop].u_bool); + args[ARG_end].u_int, true); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index d34386a685..2b965fbe98 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -229,10 +229,8 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); //| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None: -//| """Write the bytes from ``buffer`` to the device selected by ``address``. -//| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be -//| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and -//| repeated start before a read. +//| """Write the bytes from ``buffer`` to the device selected by ``address`` and +//| then transmit a stop bit. //| //| If ``start`` or ``end`` is provided, then the buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like @@ -244,9 +242,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in //| :param int address: 7-bit device address //| :param bytearray buffer: buffer containing the bytes to write //| :param int start: Index to start writing from -//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)`` -//| :param bool stop: If true, output an I2C stop condition after the buffer is written. -//| Deprecated. Will be removed in 6.x and act as stop=True.""" +//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``""" //| ... //| // Shared arg parsing for writeto and writeto_then_readfrom. @@ -267,13 +263,12 @@ STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, in } STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop }; + enum { ARG_address, ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { { MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, - { MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, }; busio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); check_for_deinit(self); @@ -282,7 +277,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int, - args[ARG_end].u_int, args[ARG_stop].u_bool); + args[ARG_end].u_int, true); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); From 1ee8a09da251d428dbb1f2670f427772ce6d8e50 Mon Sep 17 00:00:00 2001 From: ikigaisense Date: Thu, 23 Jul 2020 14:39:59 -0600 Subject: [PATCH 257/277] add-ikigaisense_vita-nRF52840 --- .github/workflows/build.yml | 1 + ports/nrf/boards/ikigaisense_vita/board.c | 38 +++++++++++++++++++ .../boards/ikigaisense_vita/mpconfigboard.h | 20 ++++++++++ .../boards/ikigaisense_vita/mpconfigboard.mk | 8 ++++ ports/nrf/boards/ikigaisense_vita/pins.c | 36 ++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 ports/nrf/boards/ikigaisense_vita/board.c create mode 100644 ports/nrf/boards/ikigaisense_vita/mpconfigboard.h create mode 100644 ports/nrf/boards/ikigaisense_vita/mpconfigboard.mk create mode 100644 ports/nrf/boards/ikigaisense_vita/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d809ba8cb6..00932e4603 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -195,6 +195,7 @@ jobs: - "hallowing_m0_express" - "hallowing_m4_express" - "hiibot_bluefi" + - "ikigaisense_vita" - "imxrt1010_evk" - "imxrt1020_evk" - "imxrt1060_evk" diff --git a/ports/nrf/boards/ikigaisense_vita/board.c b/ports/nrf/boards/ikigaisense_vita/board.c new file mode 100644 index 0000000000..4421970eef --- /dev/null +++ b/ports/nrf/boards/ikigaisense_vita/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h b/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h new file mode 100644 index 0000000000..14798aeee2 --- /dev/null +++ b/ports/nrf/boards/ikigaisense_vita/mpconfigboard.h @@ -0,0 +1,20 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "IkigaiSense Vita nRF52840" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_LED_STATUS (&pin_P0_27) + +#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 + +#define CIRCUITPY_INTERNAL_NVM_SIZE (4096) + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_08) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_04) + +#define DEFAULT_UART_BUS_RX (&pin_P0_24) +#define DEFAULT_UART_BUS_TX (&pin_P0_22) diff --git a/ports/nrf/boards/ikigaisense_vita/mpconfigboard.mk b/ports/nrf/boards/ikigaisense_vita/mpconfigboard.mk new file mode 100644 index 0000000000..28bdee952d --- /dev/null +++ b/ports/nrf/boards/ikigaisense_vita/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x8094 +USB_PRODUCT = "IkigaiSense Vita nRF52840" +USB_MANUFACTURER = "IkigaiSense Technologies LTD" + +MCU_CHIP = nrf52840 + +INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/ikigaisense_vita/pins.c b/ports/nrf/boards/ikigaisense_vita/pins.c new file mode 100644 index 0000000000..021f94f306 --- /dev/null +++ b/ports/nrf/boards/ikigaisense_vita/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P1_13) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_22) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_20) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_17) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_22) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_04) }, + + { MP_ROM_QSTR(MP_QSTR_MAXTEMP_SCL), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_MAXTEMP_SDA), MP_ROM_PTR(&pin_P0_30) }, + + { MP_ROM_QSTR(MP_QSTR_ACC_SCL), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_ACC_SDA), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_ADDON_SCL), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_ADDON_SDA), MP_ROM_PTR(&pin_P0_06) }, + + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_YELLOW_LED), MP_ROM_PTR(&pin_P0_27) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 703fb9d4a102ed7065fb2f031c8224494c733681 Mon Sep 17 00:00:00 2001 From: ikigaisense Date: Thu, 23 Jul 2020 16:08:30 -0600 Subject: [PATCH 258/277] update-ndGarage_ndbit6_v2 --- ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h | 2 +- ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h index ed2d779f5b..0dc7f5d196 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.h @@ -1,4 +1,4 @@ -#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow-v2" +#define MICROPY_HW_BOARD_NAME "ndGarage[n°] Bit6: FeatherSnow-v2" #define MICROPY_HW_MCU_NAME "samd21e18" #define MICROPY_HW_LED_STATUS (&pin_PA23) diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk index 90c000418a..193a0cf991 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/mpconfigboard.mk @@ -1,7 +1,7 @@ LD_FILE = boards/samd21x18-bootloader.ld USB_VID = 0x239A USB_PID = 0x80B9 -USB_PRODUCT = "Bit7" +USB_PRODUCT = "Bit6" USB_MANUFACTURER = "ndGarage" CHIP_VARIANT = SAMD21E18A diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c index 562684fd8c..f0615df5aa 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/pins.c @@ -10,6 +10,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA03) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA09) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA23) }, From 778e8bfda97868b6a29fe5e4656aa2c2e2dd4378 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Jul 2020 19:27:02 -0500 Subject: [PATCH 259/277] Changes to optimization option --- ports/atmel-samd/Makefile | 12 +++++------- .../boards/itsybitsy_m4_express/mpconfigboard.mk | 1 - .../boards/kicksat-sprite/mpconfigboard.mk | 4 ++++ .../boards/loc_ber_m4_base_board/mpconfigboard.mk | 3 +++ ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 3 +++ ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 1 - ports/atmel-samd/boards/pyportal/mpconfigboard.mk | 1 - ports/cxd56/Makefile | 7 +++---- ports/esp32s2/Makefile | 8 ++++---- .../boards/espressif_saola_1_wroom/mpconfigboard.mk | 1 - ports/litex/Makefile | 8 ++++---- ports/mimxrt10xx/Makefile | 8 ++++---- ports/nrf/Makefile | 10 +++++----- ports/nrf/boards/pca10100/mpconfigboard.mk | 3 +++ ports/nrf/boards/simmel/mpconfigboard.mk | 4 ++++ ports/stm/Makefile | 9 ++++----- 16 files changed, 46 insertions(+), 37 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index f92e993331..25ab2c4aa7 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -87,29 +87,27 @@ INC += -I. \ ifeq ($(CHIP_FAMILY), samd21) PERIPHERALS_CHIP_FAMILY=samd21 -CFLAGS += -Os -DNDEBUG +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512 endif ifeq ($(CHIP_FAMILY), samd51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -CFLAGS += -Os -DNDEBUG +OPTIMIZATION_FLAGS ?= -O2 # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -CFLAGS += -Os -DNDEBUG +OPTIMIZATION_FLAGS ?= -O2 # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif -# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk +CFLAGS += $(OPTIMIZATION_FLAGS) -DNDEBUG $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index 7e44d0c721..eb02d3c270 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -15,4 +15,3 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 -OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk index 9c7fe3398a..71d45990b4 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk @@ -18,3 +18,7 @@ CIRCUITPY_PS2IO = 0 CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_ULAB = 0 + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os + diff --git a/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk b/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk index 55d6fa78e6..19e341428b 100644 --- a/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk +++ b/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk @@ -15,3 +15,6 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os + diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index e0adc11b06..c1fe011c40 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -46,3 +46,6 @@ CFLAGS_INLINE_LIMIT = 45 else CFLAGS_INLINE_LIMIT = 70 endif + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index d766dbe582..7a213faf4c 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -16,4 +16,3 @@ CIRCUITPY_GAMEPADSHIFT = 1 CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge -OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk index 66badb7412..149141a4e3 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk @@ -10,4 +10,3 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C" LONGINT_IMPL = MPZ -OPTIMIZATION_LEVEL = 2 diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 8a23059b72..b3e104e1ea 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -107,7 +107,6 @@ CFLAGS += \ -Dmain=spresense_main \ -D_estack=__stack \ -c \ - -Os \ -pipe \ -std=gnu11 \ -mcpu=cortex-m4 \ @@ -123,10 +122,10 @@ CFLAGS += \ -fdata-sections \ -Wall \ +OPTIMIZATION_FLAGS ?= -O2 + # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) LIBM = "${shell "$(CC)" $(CFLAGS) -print-file-name=libm.a}" diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index f094150d7a..9415f42f26 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -101,18 +101,18 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5 #Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -ggdb + OPTIMIZATION_FLAGS ?= -Og # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -Os -DNDEBUG -ggdb3 + CFLAGS += -DNDEBUG -ggdb3 + OPTIMIZATION_FLAGS ?= -O2 # TODO: Test with -flto ### CFLAGS += -flto endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk index 70caacf87e..6e76272659 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -17,4 +17,3 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wroom -OPTIMIZATION_LEVEL = 2 diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 6f083e5d4d..612953daaf 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -77,16 +77,16 @@ ifeq ($(DEBUG), 1) CFLAGS += -ggdb # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra + OPTIMIZATION_FLAGS ?= -Og else - CFLAGS += -Os -DNDEBUG -ggdb3 + CFLAGS += -DNDEBUG -ggdb3 + OPTIMIZATION_FLAGS ?= -O2 # TODO: Test with -flto ### CFLAGS += -flto endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index bfc73d6382..9177188100 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -105,13 +105,13 @@ CFLAGS += \ -DCPU_$(CHIP_VARIANT) \ -DDEBUG \ -DIMXRT10XX \ - -Os -g3 -Wno-unused-parameter \ + -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage +OPTIMIZATION_FLAGS ?= -O2 + # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) LD_FILES = $(wildcard boards/$(BOARD)/*.ld) $(addprefix linking/, flash/$(FLASH).ld chip_family/$(CHIP_FAMILY).ld common.ld) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index d3c311e3fc..3251aaa8eb 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -86,16 +86,16 @@ INC += -I../../supervisor/shared/usb #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb3 -Og + CFLAGS += -ggdb3 + OPTIMIZATION_FLAGS = -Og else - CFLAGS += -Os -DNDEBUG -ggdb3 + OPTIMIZATION_FLAGS ?= -O2 + CFLAGS += -DNDEBUG -ggdb3 CFLAGS += -flto -flto-partition=none endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 318bc02065..e15bf3a67c 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -30,3 +30,6 @@ SUPEROPT_GC = 0 # These defines must be overridden before mpconfigboard.h is included, which is # why they are passed on the command line. CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)' + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index 2bca2492fc..cad3a965c0 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -32,3 +32,7 @@ CIRCUITPY_WATCHDOG = 1 # These defines must be overridden before mpconfigboard.h is included, which is # why they are passed on the command line. CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)' -DNRFX_SPIM3_ENABLED=0 + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os + diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 411d8146ce..5865ca8450 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -85,16 +85,15 @@ ifeq ($(DEBUG), 1) # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -Os -DNDEBUG + CFLAGS += -DNDEBUG + OPTIMIZATION_FLAGS ?= -O2 CFLAGS += -ggdb3 # TODO: Test with -flto # CFLAGS += -flto endif -# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk +CFLAGS += $(OPTIMIZATION_FLAGS) # MCU Series is defined by the HAL package and doesn't need to be specified here C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT) From c937fa17606312b20b41ac29e14e465c4f6d2be6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Jul 2020 19:29:57 -0500 Subject: [PATCH 260/277] fix formatting --- ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk | 1 - ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk | 1 - ports/nrf/boards/simmel/mpconfigboard.mk | 1 - 3 files changed, 3 deletions(-) diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk index 71d45990b4..18cef738e8 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk @@ -21,4 +21,3 @@ CIRCUITPY_ULAB = 0 # Override optimization to keep binary small OPTIMIZATION_FLAGS = -Os - diff --git a/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk b/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk index 19e341428b..3c407f5306 100644 --- a/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk +++ b/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk @@ -17,4 +17,3 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 # Override optimization to keep binary small OPTIMIZATION_FLAGS = -Os - diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index cad3a965c0..8dd284d578 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -35,4 +35,3 @@ CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)' -DNRFX_SPIM3_E # Override optimization to keep binary small OPTIMIZATION_FLAGS = -Os - From ce37a442e894ca2784ae1358947b8153dfe06d9c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Jul 2020 19:35:04 -0500 Subject: [PATCH 261/277] format fix --- ports/nrf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 3251aaa8eb..13a148df3b 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -86,7 +86,7 @@ INC += -I../../supervisor/shared/usb #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb3 + CFLAGS += -ggdb3 OPTIMIZATION_FLAGS = -Og else OPTIMIZATION_FLAGS ?= -O2 From 51a79b1af7fa663bb078136611705c04df12970a Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Tue, 21 Jul 2020 00:01:22 -0700 Subject: [PATCH 262/277] add coroutine behavior for generators coroutines don't have __next__; they also call themselves coroutines. This does not change the fact that `async def` methods are generators, but it does make them behave more like CPython. --- mpy-cross/mpconfigport.h | 1 + py/compile.c | 2 +- py/emitglue.c | 2 +- py/obj.h | 2 +- py/objgenerator.c | 16 ++++++++++++++-- py/runtime0.h | 1 + tests/basics/async_coroutine.py | 13 +++++++++++++ tests/basics/async_coroutine.py.exp | 1 + 8 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 tests/basics/async_coroutine.py create mode 100644 tests/basics/async_coroutine.py.exp diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index 0b07a5b442..464c9113d5 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -40,6 +40,7 @@ #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) #define MICROPY_CPYTHON_COMPAT (1) +#define MICROPY_PY_ASYNC_AWAIT (1) #define MICROPY_USE_INTERNAL_PRINTF (0) #define MICROPY_PY_BUILTINS_STR_UNICODE (1) diff --git a/py/compile.c b/py/compile.c index 4708110056..9b0d29998a 100644 --- a/py/compile.c +++ b/py/compile.c @@ -1890,7 +1890,7 @@ STATIC void compile_async_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) { // async def compile_funcdef(comp, pns0); scope_t *fscope = (scope_t*)pns0->nodes[4]; - fscope->scope_flags |= MP_SCOPE_FLAG_GENERATOR; + fscope->scope_flags |= MP_SCOPE_FLAG_GENERATOR | MP_SCOPE_FLAG_ASYNC; } else if (MP_PARSE_NODE_STRUCT_KIND(pns0) == PN_for_stmt) { // async for compile_async_for_stmt(comp, pns0); diff --git a/py/emitglue.c b/py/emitglue.c index 3a3174b0f8..7635a73d6a 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -152,7 +152,7 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar // check for generator functions and if so wrap in generator object if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { - fun = mp_obj_new_gen_wrap(fun); + fun = mp_obj_new_gen_wrap(fun, (rc->scope_flags & MP_SCOPE_FLAG_ASYNC) != 0); } return fun; diff --git a/py/obj.h b/py/obj.h index 8536e33335..e603d4a496 100644 --- a/py/obj.h +++ b/py/obj.h @@ -665,7 +665,7 @@ mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte * mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table); mp_obj_t mp_obj_new_fun_viper(size_t n_args, void *fun_data, mp_uint_t type_sig); mp_obj_t mp_obj_new_fun_asm(size_t n_args, void *fun_data, mp_uint_t type_sig); -mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun); +mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine); mp_obj_t mp_obj_new_closure(mp_obj_t fun, size_t n_closed, const mp_obj_t *closed); mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items); mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items); diff --git a/py/objgenerator.c b/py/objgenerator.c index 6ffcfae46a..57d20e3db8 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -42,11 +42,13 @@ typedef struct _mp_obj_gen_wrap_t { mp_obj_base_t base; mp_obj_t *fun; + bool coroutine_generator; } mp_obj_gen_wrap_t; typedef struct _mp_obj_gen_instance_t { mp_obj_base_t base; mp_obj_dict_t *globals; + bool coroutine_generator; mp_code_state_t code_state; } mp_obj_gen_instance_t; @@ -64,6 +66,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t)); o->base.type = &mp_type_gen_instance; + o->coroutine_generator = self->coroutine_generator; o->globals = self_fun->globals; o->code_state.fun_bc = self_fun; o->code_state.ip = 0; @@ -78,10 +81,11 @@ const mp_obj_type_t mp_type_gen_wrap = { .unary_op = mp_generic_unary_op, }; -mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) { +mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine) { mp_obj_gen_wrap_t *o = m_new_obj(mp_obj_gen_wrap_t); o->base.type = &mp_type_gen_wrap; o->fun = MP_OBJ_TO_PTR(fun); + o->coroutine_generator = is_coroutine; return MP_OBJ_FROM_PTR(o); } @@ -91,7 +95,11 @@ mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) { STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { (void)kind; mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); - mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); + if (self->coroutine_generator) { + mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); + } else { + mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); + } } mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, mp_obj_t *ret_val) { @@ -194,6 +202,10 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o } STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) { + mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); + if (self->coroutine_generator) { + mp_raise_TypeError(translate("'coroutine' object is not an iterator")); + } return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL); } diff --git a/py/runtime0.h b/py/runtime0.h index a8089ea646..fb35c8a9f4 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -33,6 +33,7 @@ #define MP_SCOPE_FLAG_VARKEYWORDS (0x02) #define MP_SCOPE_FLAG_GENERATOR (0x04) #define MP_SCOPE_FLAG_DEFKWARGS (0x08) +#define MP_SCOPE_FLAG_ASYNC (0x10) // types for native (viper) function signature #define MP_NATIVE_TYPE_OBJ (0x00) diff --git a/tests/basics/async_coroutine.py b/tests/basics/async_coroutine.py new file mode 100644 index 0000000000..791f6df14c --- /dev/null +++ b/tests/basics/async_coroutine.py @@ -0,0 +1,13 @@ +async def f(): + pass + +try: + f() # Should not crash +except Exception as e: + print('failed to invoke') + +try: + next(f()) + print('This should fail because async def returns a coroutine, and next() is not allowed') +except Exception as e: + print('pass') diff --git a/tests/basics/async_coroutine.py.exp b/tests/basics/async_coroutine.py.exp new file mode 100644 index 0000000000..2ae28399f5 --- /dev/null +++ b/tests/basics/async_coroutine.py.exp @@ -0,0 +1 @@ +pass From 764d49e6416fe5b35b61a30981f326435a9a5c91 Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Tue, 21 Jul 2020 18:31:18 -0700 Subject: [PATCH 263/277] also disable async_coroutine test in native emitter --- tests/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests b/tests/run-tests index 151d48095b..e28600361b 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -362,7 +362,7 @@ def run_tests(pyb, tests, args, base_path=".", num_threads=1): if args.emit == 'native': skip_tests.update({'basics/%s.py' % t for t in 'gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_executing gen_yield_from_iter gen_yield_from_send gen_yield_from_stopped gen_yield_from_throw gen_yield_from_throw2 gen_yield_from_throw3 generator1 generator2 generator_args generator_close generator_closure generator_exc generator_pend_throw generator_return generator_send'.split()}) # require yield skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class globals_del string_join gen_stack_overflow'.split()}) # require yield - skip_tests.update({'basics/async_%s.py' % t for t in 'def await await2 for for2 with with2'.split()}) # require yield + skip_tests.update({'basics/async_%s.py' % t for t in 'def await await2 for for2 with with2 coroutine'.split()}) # require yield skip_tests.update({'basics/%s.py' % t for t in 'try_reraise try_reraise2'.split()}) # require raise_varargs skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support skip_tests.add('basics/array_construct2.py') # requires generators From 652767fb1c9c489f2a2b2fb1f4971c09c6da66bc Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Tue, 21 Jul 2020 18:43:48 -0700 Subject: [PATCH 264/277] translations --- locale/circuitpython.pot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 71c360889e..c7ff3def50 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-17 18:03-0700\n" +"POT-Creation-Date: 2020-07-21 18:43-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -234,6 +234,10 @@ msgstr "" msgid "'continue' outside loop" msgstr "" +#: py/objgenerator.c +msgid "'coroutine' object is not an iterator" +msgstr "" + #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "" From e9b4e0bd35b6c3024a662580e547df62ab95acd1 Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:34:34 -0700 Subject: [PATCH 265/277] remove new char*s because m0 is way oversubscribed --- py/objgenerator.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/py/objgenerator.c b/py/objgenerator.c index 57d20e3db8..df421b60c8 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -95,11 +95,13 @@ mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine) { STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { (void)kind; mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); +#if MICROPY_PY_ASYNC_AWAIT if (self->coroutine_generator) { mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); - } else { - mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); + return; } +#endif + mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); } mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, mp_obj_t *ret_val) { @@ -202,10 +204,13 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o } STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) { +#if MICROPY_PY_ASYNC_AWAIT + // This translate is literally too much for m0 boards mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); if (self->coroutine_generator) { mp_raise_TypeError(translate("'coroutine' object is not an iterator")); } +#endif return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL); } From 54a342a7f5b74f32c7a53ea483d9046e688b9830 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Fri, 24 Jul 2020 03:22:41 +0900 Subject: [PATCH 266/277] Add and correct some type hints --- .github/workflows/build.yml | 2 +- ports/atmel-samd/bindings/samd/Clock.c | 3 +- shared-bindings/_bleio/Adapter.c | 8 +- shared-bindings/_bleio/Address.c | 2 +- shared-bindings/_bleio/Characteristic.c | 2 +- shared-bindings/_bleio/Connection.c | 8 +- shared-bindings/_bleio/UUID.c | 2 +- shared-bindings/_pew/PewPew.c | 27 +++++- shared-bindings/_pixelbuf/PixelBuf.c | 14 ++- shared-bindings/_pixelbuf/__init__.c | 4 +- shared-bindings/_stage/__init__.c | 2 +- shared-bindings/aesio/aes.c | 7 +- shared-bindings/audiomixer/Mixer.c | 2 +- shared-bindings/busio/I2C.c | 85 +++++++++---------- shared-bindings/countio/Counter.c | 8 +- shared-bindings/digitalio/DigitalInOut.c | 14 +-- shared-bindings/displayio/Display.c | 4 +- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/displayio/Group.c | 3 +- shared-bindings/displayio/OnDiskBitmap.c | 2 +- shared-bindings/displayio/Palette.c | 21 ++--- shared-bindings/displayio/TileGrid.c | 2 +- .../framebufferio/FramebufferDisplay.c | 2 +- shared-bindings/gamepad/GamePad.c | 13 ++- shared-bindings/gamepadshift/GamePadShift.c | 2 +- shared-bindings/gnss/GNSS.c | 2 +- shared-bindings/gnss/PositionFix.c | 12 +-- shared-bindings/gnss/SatelliteSystem.c | 30 +++---- shared-bindings/math/__init__.c | 6 +- .../memorymonitor/AllocationAlarm.c | 6 +- .../memorymonitor/AllocationSize.c | 10 +-- shared-bindings/memorymonitor/__init__.c | 7 +- shared-bindings/microcontroller/__init__.c | 2 +- shared-bindings/multiterminal/__init__.c | 4 +- shared-bindings/neopixel_write/__init__.c | 8 +- shared-bindings/nvm/ByteArray.c | 15 +++- shared-bindings/os/__init__.c | 24 +++--- shared-bindings/pulseio/PulseOut.c | 2 +- shared-bindings/random/__init__.c | 5 +- shared-bindings/rgbmatrix/RGBMatrix.c | 2 +- shared-bindings/sdcardio/SDCard.c | 10 +-- shared-bindings/sdioio/SDCard.c | 12 +-- shared-bindings/socket/__init__.c | 2 +- shared-bindings/storage/__init__.c | 32 +++---- shared-bindings/struct/__init__.c | 8 +- shared-bindings/uheap/__init__.c | 2 +- shared-bindings/usb_hid/__init__.c | 2 +- shared-bindings/vectorio/Polygon.c | 6 +- shared-bindings/vectorio/VectorShape.c | 2 +- shared-bindings/watchdog/WatchDogMode.c | 8 +- shared-bindings/watchdog/WatchDogTimer.c | 6 +- tools/extract_pyi.py | 30 ++++--- 52 files changed, 266 insertions(+), 230 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d809ba8cb6..480d7da289 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: run: | sudo apt-get install -y eatmydata sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 - pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort + pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black - name: Versions run: | gcc --version diff --git a/ports/atmel-samd/bindings/samd/Clock.c b/ports/atmel-samd/bindings/samd/Clock.c index e1022c52f7..e8a468d77f 100644 --- a/ports/atmel-samd/bindings/samd/Clock.c +++ b/ports/atmel-samd/bindings/samd/Clock.c @@ -30,7 +30,6 @@ #include "py/objproperty.h" #include "py/runtime.h" -//| import typing //| class Clock: //| """Identifies a clock on the microcontroller. //| @@ -62,7 +61,7 @@ const mp_obj_property_t samd_clock_enabled_obj = { }, }; -//| parent: typing.Union(Clock | None) = ... +//| parent: Union[Clock, None] = ... //| """Clock parent. (read-only)""" //| STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 75212fa91f..9177a9a69d 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -135,7 +135,7 @@ const mp_obj_property_t bleio_adapter_name_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None: +//| def start_advertising(self, data: ReadableBuffer, *, scan_response: Optional[ReadableBuffer] = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None: //| """Starts advertising until `stop_advertising` is called or if connectable, another device //| connects to us. //| @@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising); -//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> iterable: +//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]: //| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are //| filtered and returned separately. //| @@ -350,11 +350,11 @@ const mp_obj_property_t bleio_adapter_connections_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def connect(self, address: Address, *, timeout: float/int) -> Connection: +//| def connect(self, address: Address, *, timeout: float) -> Connection: //| """Attempts a connection to the device with the given address. //| //| :param Address address: The address of the peripheral to connect to -//| :param float/int timeout: Try to connect for timeout seconds.""" +//| :param float timeout: Try to connect for timeout seconds.""" //| ... //| STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 2481a9199c..290b0fd09a 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __eq__(self, other: Any) -> bool: +//| def __eq__(self, other: Address) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... //| diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 593d8edcb4..2cdedaf99c 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -45,7 +45,7 @@ //| ... //| -//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Characteristic: +//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: Optional[ReadableBuffer] = None) -> Characteristic: //| """Create a new Characteristic object, and add it to this Service. //| //| :param Service service: The service that will provide this characteristic diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 5dfbc5a36c..f610d65079 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -71,11 +71,11 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) { //| def __init__(self) -> None: //| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`. //| Connections may also be made when another device initiates a connection. To use a Connection -//| created by a peer, read the `Adapter.connections` property. +//| created by a peer, read the `Adapter.connections` property.""" //| ... //| -//| def disconnect(self) -> Any: -//| ""Disconnects from the remote peripheral. Does nothing if already disconnected.""" +//| def disconnect(self) -> None: +//| """Disconnects from the remote peripheral. Does nothing if already disconnected.""" //| ... //| STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) { @@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair); -//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service: +//| def discover_remote_services(self, service_uuids_whitelist: Iterable[UUID] = None) -> Tuple[Service, ...]: //| """Do BLE discovery for all services or for the given service UUIDS, //| to find their handles and characteristics, and return the discovered services. //| `Connection.connected` must be True. diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index c6706e46a7..fa1e298a9a 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __eq__(self, other: Any) -> bool: +//| def __eq__(self, other: UUID) -> bool: //| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit.""" //| ... //| diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index 32a956c93c..0563181d9f 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -45,8 +45,31 @@ //| used internally by it. All user-visible interactions are done through //| that library.""" //| - -//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None: +//| def __init__( +//| self, +//| buffer: ReadableBuffer, +//| rows: List[ +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| ], +//| cols: List[ +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| digitalio.DigitalInOut, +//| ], +//| buttons: digitalio.DigitalInOut, +//| ) -> None: //| """Initializes matrix scanning routines. //| //| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 951395acba..598c68d1de 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| byteorder: string = ... +//| byteorder: str = ... //| """byteorder string for the buffer (read-only)""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) { @@ -257,7 +257,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show); -//| def fill(color: Union[int, Tuple[int, int, int]]) -> None: +//| def fill(self, color: Union[int, Tuple[int, int, int]]) -> None: //| """Fills the given pixelbuf with the given color.""" //| ... //| @@ -269,13 +269,19 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill); -//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]: +//| @overload +//| def __getitem__(self, index: slice) -> Tuple[Tuple, ...]: ... +//| def __getitem__(self, index: int) -> Tuple: //| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values //| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel //| intensity from 0-1.0.""" //| ... //| -//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf: +//| @overload +//| def __setitem__(self, index: slice, value: Tuple[Union[int, Tuple, List], ...]) -> None: ... +//| @overload +//| def __setitem__(self, index: slice, value: List[Union[int, Tuple, List]]) -> None: ... +//| def __setitem__(self, index: int, value: Union[int, Tuple, List]) -> None: //| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are //| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the //| red, green and blue values are packed into the lower three bytes (0xRRGGBB). diff --git a/shared-bindings/_pixelbuf/__init__.c b/shared-bindings/_pixelbuf/__init__.c index 6038fdfdcc..c714cade41 100644 --- a/shared-bindings/_pixelbuf/__init__.c +++ b/shared-bindings/_pixelbuf/__init__.c @@ -41,12 +41,12 @@ //| Byteorders are configured with strings, such as "RGB" or "RGBD".""" // TODO: Pull in docs from pypixelbuf. -//| def colorwheel(n: int) -> int: +//| def colorwheel(n: float) -> int: //| """C implementation of the common wheel() function found in many examples. //| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar).""" //| ... //| -//| def wheel(n: Any) -> Any: +//| def wheel(n: float) -> int: //| """Use of wheel() is deprecated. Please use colorwheel().""" //| diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 6a56381856..6af0e6dbf2 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -39,7 +39,7 @@ //| The `_stage` module contains native code to speed-up the ```stage`` Library //| `_.""" //| -//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> Any: +//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> None: //| """Render and send to the display a fragment of the screen. //| //| :param int x0: Left edge of the fragment. diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index e580be38be..9881bd0edc 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -12,7 +12,7 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key: Optional[ReadableBuffer], mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> None: +//| def __init__(self, key: Optional[ReadableBuffer], mode: int = 0, iv: ReadableBuffer = None, segment_size: int = 8) -> None: //| """Create a new AES state with the given key. //| //| :param bytearray key: A 16-, 24-, or 32-byte key @@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, } } -//| def encrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None: +//| def encrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the @@ -183,8 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); -//| def decrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None: -//| +//| def decrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None: //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| buffers must be a multiple of 16 bytes, and must be equal length. For diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index 0d7712b036..0356edde4d 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None: +//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, Mixer], *, voice: int = 0, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 2b965fbe98..8a0414b5a0 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -126,13 +126,12 @@ static void check_lock(busio_i2c_obj_t *self) { } //| def scan(self) -> list: +//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a +//| list of those that respond. //| -//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a -//| list of those that respond. -//| -//| :return: List of device ids on the I2C bus -//| :rtype: list""" -//| ... +//| :return: List of device ids on the I2C bus +//| :rtype: list""" +//| ... //| STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) { busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -177,19 +176,19 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); //| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None: -//| """Read into ``buffer`` from the device selected by ``address``. -//| The number of bytes read will be the length of ``buffer``. -//| At least one byte must be read. +//| """Read into ``buffer`` from the device selected by ``address``. +//| The number of bytes read will be the length of ``buffer``. +//| At least one byte must be read. //| -//| If ``start`` or ``end`` is provided, then the buffer will be sliced -//| as if ``buffer[start:end]``. This will not cause an allocation like -//| ``buf[start:end]`` will so it saves memory. +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like +//| ``buf[start:end]`` will so it saves memory. //| -//| :param int address: 7-bit device address -//| :param bytearray buffer: buffer to write into -//| :param int start: Index to start writing at -//| :param int end: Index to write up to but not include. Defaults to ``len(buffer)``""" -//| ... +//| :param int address: 7-bit device address +//| :param bytearray buffer: buffer to write into +//| :param int start: Index to start writing at +//| :param int end: Index to write up to but not include. Defaults to ``len(buffer)``""" +//| ... //| // Shared arg parsing for readfrom_into and writeto_then_readfrom. STATIC void readfrom(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end) { @@ -229,21 +228,21 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); //| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None: -//| """Write the bytes from ``buffer`` to the device selected by ``address`` and -//| then transmit a stop bit. +//| """Write the bytes from ``buffer`` to the device selected by ``address`` and +//| then transmit a stop bit. //| -//| If ``start`` or ``end`` is provided, then the buffer will be sliced -//| as if ``buffer[start:end]``. This will not cause an allocation like -//| ``buffer[start:end]`` will so it saves memory. +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like +//| ``buffer[start:end]`` will so it saves memory. //| -//| Writing a buffer or slice of length zero is permitted, as it can be used -//| to poll for the existence of a device. +//| riting a buffer or slice of length zero is permitted, as it can be used +//| to poll for the existence of a device. //| -//| :param int address: 7-bit device address -//| :param bytearray buffer: buffer containing the bytes to write -//| :param int start: Index to start writing from -//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``""" -//| ... +//| :param int address: 7-bit device address +//| :param bytearray buffer: buffer containing the bytes to write +//| :param int start: Index to start writing from +//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``""" +//| ... //| // Shared arg parsing for writeto and writeto_then_readfrom. STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end, bool stop) { @@ -283,22 +282,22 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); //| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: -//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop -//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and -//| ``in_buffer`` can be the same buffer because they are used sequentially. +//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop +//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and +//| ``in_buffer`` can be the same buffer because they are used sequentially. //| -//| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced -//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` -//| will so it saves memory. +//| f ``start`` or ``end`` is provided, then the corresponding buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` +//| will so it saves memory. //| -//| :param int address: 7-bit device address -//| :param bytearray out_buffer: buffer containing the bytes to write -//| :param bytearray in_buffer: buffer to write into -//| :param int out_start: Index to start writing from -//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)`` -//| :param int in_start: Index to start writing at -//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)``""" -//| ... +//| :param int address: 7-bit device address +//| :param bytearray out_buffer: buffer containing the bytes to write +//| :param bytearray in_buffer: buffer to write into +//| :param int out_start: Index to start writing from +//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)`` +//| :param int in_start: Index to start writing at +//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)``""" +//| ... //| STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index e40ec3b64f..616307a4bc 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -53,7 +53,7 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg return MP_OBJ_FROM_PTR(self); } -//| def deinit(self): +//| def deinit(self) -> None: //| """Deinitializes the Counter and releases any hardware resources for reuse.""" //| STATIC mp_obj_t countio_counter_deinit(mp_obj_t self_in) { @@ -69,12 +69,12 @@ STATIC void check_for_deinit(countio_counter_obj_t *self) { } } -//| def __enter__(self): +//| def __enter__(self) -> Counter: //| """No-op used by Context Managers.""" //| // Provided by context manager helper. -//| def __exit__(self): +//| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| @@ -113,7 +113,7 @@ const mp_obj_property_t countio_counter_count_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def reset(self): +//| def reset(self) -> None: //| """Resets the count back to 0.""" //| STATIC mp_obj_t countio_counter_reset(mp_obj_t self_in){ diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index 603f008e3c..e37f57220c 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -107,13 +107,13 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { } //| def switch_to_output(self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL) -> None: -//| """Set the drive mode and value and then switch to writing out digital -//| values. +//| """Set the drive mode and value and then switch to writing out digital +//| values. //| -//| :param bool value: default value to set upon switching -//| :param ~digitalio.DriveMode drive_mode: drive mode for the output -//| """ -//| ... +//| :param bool value: default value to set upon switching +//| :param ~digitalio.DriveMode drive_mode: drive mode for the output +//| """ +//| ... //| STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_value, ARG_drive_mode }; @@ -228,7 +228,7 @@ const mp_obj_property_t digitalio_digitalio_direction_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| value: Bool = ... +//| value: bool = ... //| """The digital logic level of the pin.""" //| STATIC mp_obj_t digitalio_digitalinout_obj_get_value(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 4534babca6..2d2b92325c 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum.""" //| -//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None: +//| def __init__(self, display_bus: Union[FourWire, ParallelBus], init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None: //| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a @@ -341,7 +341,6 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = { //| width: int = ... //| Gets the width of the board //| -//| STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self)); @@ -358,7 +357,6 @@ const mp_obj_property_t displayio_display_width_obj = { //| height: int = ... //| """Gets the height of the board""" //| -//| STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self)); diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 21eaf14daa..9bfc6b05d2 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None: +//| def __init__(self, display_bus: displayio, start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None: //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 1176db5634..31affc6b6a 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -264,7 +264,8 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove); -//| def __bool__(self) -> bool: ... +//| def __bool__(self) -> bool: +//| ... //| //| def __len__(self) -> int: //| """Returns the number of layers in a Group""" diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index 7e94a0401a..8a4cb8e743 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -69,7 +69,7 @@ //| while True: //| pass""" //| -//| def __init__(self, file: file) -> None: +//| def __init__(self, file: typing.BinaryIO) -> None: //| """Create an OnDiskBitmap object with the given file. //| //| :param file file: The open bitmap file""" diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 5418133e1e..c868aea9cf 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -36,12 +36,6 @@ #include "shared-bindings/util.h" #include "supervisor/shared/translate.h" - - - - - - //| class Palette: //| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to //| save memory.""" @@ -70,7 +64,8 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def __bool__(self) -> bool: ... +//| def __bool__(self) -> bool: +//| ... //| //| def __len__(self) -> int: //| """Returns the number of colors in a Palette""" @@ -86,7 +81,11 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer]) -> Optional[int]: +//| def __getitem__(self, index: int) -> Optional[int]: +//| r"""Return the pixel color at the given index as an integer.""" +//| ... +//| +//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]]) -> None: //| r"""Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1. //| //| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value). @@ -149,7 +148,8 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val return mp_const_none; } -//| def make_transparent(self, palette_index: int) -> None: ... +//| def make_transparent(self, palette_index: int) -> None: +//| ... //| STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); @@ -163,7 +163,8 @@ STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_ } MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_transparent_obj, displayio_palette_obj_make_transparent); -//| def make_opaque(self, palette_index: int) -> None: ... +//| def make_opaque(self, palette_index: int) -> None: +//| ... //| STATIC mp_obj_t displayio_palette_obj_make_opaque(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index c17d984db0..e03a46dbaf 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -48,7 +48,7 @@ //| //| A single tile grid is also known as a Sprite.""" //| -//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None: +//| def __init__(self, bitmap: Bitmap, *, pixel_shader: Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None: //| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to //| convert the value and its location to a display native pixel color. This may be a simple color //| palette lookup, a gradient, a pattern or a color transformer. diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index d687e3e95b..8c19603422 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -94,7 +94,7 @@ static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_o return MP_OBJ_TO_PTR(native_display); } -//| def show(self, group: Group) -> None: +//| def show(self, group: displayio.Group) -> None: //| """Switches to displaying the given group of layers. When group is None, the default //| CircuitPython terminal will be shown. //| diff --git a/shared-bindings/gamepad/GamePad.c b/shared-bindings/gamepad/GamePad.c index f03a6cd33e..dca1eb1e89 100644 --- a/shared-bindings/gamepad/GamePad.c +++ b/shared-bindings/gamepad/GamePad.c @@ -69,8 +69,17 @@ //| buttons = pad.get_pressed() //| time.sleep(0.1)""" //| - -//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut) -> None: +//| def __init__( +//| self, +//| b1: digitalio.DigitalInOut, +//| b2: digitalio.DigitalInOut, +//| b3: digitalio.DigitalInOut, +//| b4: digitalio.DigitalInOut, +//| b5: digitalio.DigitalInOut, +//| b6: digitalio.DigitalInOut, +//| b7: digitalio.DigitalInOut, +//| b8: digitalio.DigitalInOut, +//| ) -> None: //| """Initializes button scanning routines. //| //| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which diff --git a/shared-bindings/gamepadshift/GamePadShift.c b/shared-bindings/gamepadshift/GamePadShift.c index e05a95865c..f6488bbd75 100644 --- a/shared-bindings/gamepadshift/GamePadShift.c +++ b/shared-bindings/gamepadshift/GamePadShift.c @@ -36,7 +36,7 @@ //| class GamePadShift: //| """Scan buttons for presses through a shift register""" //| -//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut) -> None: +//| def __init__(self, clock: digitalio.DigitalInOut, data: digitalio.DigitalInOut, latch: digitalio.DigitalInOut) -> None: //| """Initializes button scanning routines. //| //| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut`` diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index f87a943b03..72aa71b8d3 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -168,7 +168,7 @@ const mp_obj_property_t gnss_timestamp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| fix: gnss.PositionFix = ... +//| fix: PositionFix = ... //| """Fix mode.""" //| STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) { diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 867911f019..7a69dfece8 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -11,19 +11,13 @@ //| """Enum-like class to define the position fix mode.""" //| //| INVALID: PositionFix = ... -//| """No measurement. -//| -//| :type PositionFix:""" +//| """No measurement.""" //| //| FIX_2D: PositionFix = ... -//| """2D fix. -//| -//| :type PositionFix:""" +//| """2D fix.""" //| //| FIX_3D: PositionFix = ... -//| """3D fix. -//| -//| :type gnss.PositionFix:""" +//| """3D fix.""" //| const mp_obj_type_t gnss_positionfix_type; diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index 951c5a0e89..7d66727b8d 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -10,30 +10,20 @@ //| def __init__(self) -> None: //| """Enum-like class to define the satellite system type.""" //| -//| GPS: SatelliteSystem = ... -//| """Global Positioning System. +//| GPS: SatelliteSystem +//| """Global Positioning System.""" //| -//| :type gnss.SatelliteSystem:""" +//| GLONASS: SatelliteSystem +//| """GLObal NAvigation Satellite System.""" //| -//| GLONASS: SatelliteSystem = ... -//| """GLObal NAvigation Satellite System. +//| SBAS: SatelliteSystem +//| """Satellite Based Augmentation System.""" //| -//| :type gnss.SatelliteSystem:""" +//| QZSS_L1CA: SatelliteSystem +//| """Quasi-Zenith Satellite System L1C/A.""" //| -//| SBAS: SatelliteSystem = ... -//| """Satellite Based Augmentation System. -//| -//| :type gnss.SatelliteSystem:""" -//| -//| QZSS_L1CA: SatelliteSystem = ... -//| """Quasi-Zenith Satellite System L1C/A. -//| -//| :type gnss.SatelliteSystem:""" -//| -//| QZSS_L1S: SatelliteSystem = ... -//| """Quasi-Zenith Satellite System L1S. -//| -//| :type gnss.SatelliteSystem:""" +//| QZSS_L1S: SatelliteSystem +//| """Quasi-Zenith Satellite System L1S.""" //| const mp_obj_type_t gnss_satellitesystem_type; diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 968da0d613..3883c03c11 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -79,10 +79,10 @@ STATIC NORETURN void math_error(void) { #define log2(x) (log(x) * 1.442695040888963407354163704) #endif -//| e: float = ... +//| e: float //| """base of the natural logarithm""" //| -//| pi: float = ... +//| pi: float //| """the ratio of a circle's circumference to its diameter""" //| @@ -126,7 +126,7 @@ STATIC NORETURN void math_error(void) { //| """Return the absolute value of ``x``.""" //| ... //| -//| def floor(x: float) -> float: +//| def floor(x: float) -> int: //| """Return an integer, being ``x`` rounded towards negative infinity.""" //| ... //| diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c index 36e2cb5b23..7de8c12874 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.c +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -35,7 +35,7 @@ //| class AllocationAlarm: //| -//| def __init__(self, *, minimum_block_count=1): +//| def __init__(self, *, minimum_block_count: int = 1) -> None: //| """Throw an exception when an allocation of ``minimum_block_count`` or more blocks //| occurs while active. //| @@ -76,7 +76,7 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type return MP_OBJ_FROM_PTR(self); } -//| def ignore(self, count) -> AllocationAlarm: +//| def ignore(self, count: int) -> AllocationAlarm: //| """Sets the number of applicable allocations to ignore before raising the exception. //| Automatically set back to zero at context exit. //| @@ -98,7 +98,7 @@ STATIC mp_obj_t memorymonitor_allocationalarm_obj_ignore(mp_obj_t self_in, mp_ob } MP_DEFINE_CONST_FUN_OBJ_2(memorymonitor_allocationalarm_ignore_obj, memorymonitor_allocationalarm_obj_ignore); -//| def __enter__(self) -> memorymonitor.AllocationAlarm: +//| def __enter__(self) -> AllocationAlarm: //| """Enables the alarm.""" //| ... //| diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index 5016744413..a7d14e4f55 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -35,7 +35,7 @@ //| class AllocationSize: //| -//| def __init__(self): +//| def __init__(self) -> None: //| """Tracks the number of allocations in power of two buckets. //| //| It will have 16 16-bit buckets to track allocation counts. It is total allocations @@ -72,7 +72,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, return MP_OBJ_FROM_PTR(self); } -//| def __enter__(self, ) -> Any: +//| def __enter__(self) -> AllocationSize: //| """Clears counts and resumes tracking.""" //| ... //| @@ -83,7 +83,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize___enter___obj, memorymonitor_allocationsize_obj___enter__); -//| def __exit__(self, ) -> Any: +//| def __exit__(self) -> None: //| """Automatically pauses allocation tracking when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... @@ -112,7 +112,7 @@ const mp_obj_property_t memorymonitor_allocationsize_bytes_per_block_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __len__(self, ) -> Any: +//| def __len__(self) -> int: //| """Returns the number of allocation buckets. //| //| This allows you to:: @@ -131,7 +131,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t } } -//| def __getitem__(self, index: Any) -> Any: +//| def __getitem__(self, index: int) -> Optional[int]: //| """Returns the allocation count for the given bucket. //| //| This allows you to:: diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 98f48f5251..c101ba5e0d 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -36,10 +36,9 @@ //| """Memory monitoring helpers""" //| -//| class AllocationError: -//| def __init__(self, Exception: Any): -//| """Catchall exception for allocation related errors.""" -//| ... +//| class AllocationError(Exception): +//| """Catchall exception for allocation related errors.""" +//| ... MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception) NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* fmt, ...) { diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 6d556cdd75..a750823400 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -133,7 +133,7 @@ STATIC mp_obj_t mcu_reset(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); -//| nvm: Any = ... +//| nvm: Optional[nvm.ByteArray] = ... //| """Available non-volatile memory. //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. //| diff --git a/shared-bindings/multiterminal/__init__.c b/shared-bindings/multiterminal/__init__.c index e4d6768ada..0f493fe2ea 100644 --- a/shared-bindings/multiterminal/__init__.c +++ b/shared-bindings/multiterminal/__init__.c @@ -37,7 +37,7 @@ //| serial connection and the optional secondary connection.""" //| -//| def get_secondary_terminal() -> secondary_terminal: +//| def get_secondary_terminal() -> Optional[typing.BinaryIO]: //| """Returns the current secondary terminal.""" //| ... //| @@ -46,7 +46,7 @@ STATIC mp_obj_t multiterminal_obj_get_secondary_terminal() { } MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal); -//| def set_secondary_terminal(stream: stream) -> None: +//| def set_secondary_terminal(stream: Optional[typing.BinaryIO]) -> None: //| """Read additional input from the given stream and write out back to it. //| This doesn't replace the core stream (usually UART or native USB) but is //| mixed in instead. diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index 5e5bc31eb7..f3f5c20373 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -51,11 +51,11 @@ //| neopixel_write.neopixel_write(pin, pixel_off)""" //| //| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: bytearray) -> None: -//| """Write buf out on the given DigitalInOut. +//| """Write buf out on the given DigitalInOut. //| -//| :param digitalinout: the DigitalInOut to output with -//| :param buf: The bytes to clock out. No assumption is made about color order""" -//| ... +//| :param digitalinout: the DigitalInOut to output with +//| :param buf: The bytes to clock out. No assumption is made about color order""" +//| ... STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) { if (!MP_OBJ_IS_TYPE(digitalinout_obj, &digitalio_digitalinout_type)) { mp_raise_TypeError_varg(translate("Expected a %q"), digitalio_digitalinout_type.name); diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index 278ac4d739..994ce70458 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -49,7 +49,8 @@ //| ... //| -//| def __bool__(self) -> bool: ... +//| def __bool__(self) -> bool: +//| ... //| //| def __len__(self) -> int: //| """Return the length. This is used by (`len`)""" @@ -70,6 +71,18 @@ STATIC const mp_rom_map_elem_t nvm_bytearray_locals_dict_table[] = { STATIC MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict_table); +//| @overload +//| def __getitem__(self, index: slice) -> bytearray: ... +//| def __getitem__(self, index: int) -> int: +//| """Returns the value at the given index.""" +//| ... +//| +//| @overload +//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... +//| def __setitem__(self, index: int, value: int) -> None: +//| """Set the value at the given index.""" +//| ... +//| STATIC mp_obj_t nvm_bytearray_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { if (value == MP_OBJ_NULL) { // delete item diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index c9aaf3b2c2..9fad6e83df 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -54,7 +54,7 @@ STATIC mp_obj_t os_uname(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); -//| def chdir(path: string) -> None: +//| def chdir(path: str) -> None: //| """Change current directory.""" //| ... //| @@ -65,7 +65,7 @@ mp_obj_t os_chdir(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir); -//| def getcwd() -> string: +//| def getcwd() -> str: //| """Get the current directory.""" //| ... //| @@ -74,7 +74,7 @@ mp_obj_t os_getcwd(void) { } MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); -//| def listdir(dir: string) -> string: +//| def listdir(dir: str) -> str: //| """With no argument, list the current directory. Otherwise list the given directory.""" //| ... //| @@ -89,7 +89,7 @@ mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir); -//| def mkdir(path: string) -> None: +//| def mkdir(path: str) -> None: //| """Create a new directory.""" //| ... //| @@ -100,7 +100,7 @@ mp_obj_t os_mkdir(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir); -//| def remove(path: string) -> None: +//| def remove(path: str) -> None: //| """Remove a file.""" //| ... //| @@ -111,7 +111,7 @@ mp_obj_t os_remove(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove); -//| def rmdir(path: string) -> None: +//| def rmdir(path: str) -> None: //| """Remove a directory.""" //| ... //| @@ -123,7 +123,7 @@ mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { } MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename); -//| def rename(old_path: string, new_path: string) -> string: +//| def rename(old_path: str, new_path: str) -> str: //| """Rename a file.""" //| ... //| @@ -134,7 +134,7 @@ mp_obj_t os_rmdir(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir); -//| def stat(path: string) -> string: +//| def stat(path: str) -> str: //| """Get the status of a file or directory. //| //| .. note:: On builds without long integers, the number of seconds @@ -149,7 +149,7 @@ mp_obj_t os_stat(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); -//| def statvfs(path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]: +//| def statvfs(path: str) -> Tuple[str, str, str, str, str, str, str, str, str, str]: //| """Get the status of a fileystem. //| //| Returns a tuple with the filesystem information in the following order: @@ -189,7 +189,7 @@ STATIC mp_obj_t os_sync(void) { } MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync); -//| def urandom(size: int) -> string: +//| def urandom(size: int) -> str: //| """Returns a string of *size* random bytes based on a hardware True Random //| Number Generator. When not available, it will raise a NotImplementedError.""" //| ... @@ -224,9 +224,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, -//| """.. data:: sep //| -//| Separator used to delineate path components such as folder and file names.""" +//| sep: str +//| """Separator used to delineate path components such as folder and file names.""" //| { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, }; diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index 9e2d687449..ca1369d932 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -41,7 +41,7 @@ //| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration //| for on and off pairs.""" //| -//| def __init__(self, carrier: pulseio.PWMOut) -> None: +//| def __init__(self, carrier: PWMOut) -> None: //| """Create a PulseOut object associated with the given PWMout object. //| //| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin. diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 10ddca4991..35756eef16 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -46,6 +46,9 @@ //| .. warning:: Numbers from this module are not cryptographically strong! Use //| bytes from `os.urandom` directly for true randomness.""" //| +//| from typing import TypeVar +//| _T = TypeVar('_T') +//| //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to @@ -129,7 +132,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(random_randint_obj, random_randint); -//| def choice(seq: list) -> Any: +//| def choice(seq: Sequence[_T]) -> _T: //| """Returns a randomly selected element from the given sequence. Raises //| IndexError when the sequence is empty.""" //| ... diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index e04336351d..fcf597bcbc 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None: +//| def __init__(self, *, width: int, bit_depth: int, rgb_pins: Sequence[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None: //| """Create a RGBMatrix object with the given attributes. The height of //| the display is determined by the number of rgb and address pins: //| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4 diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 7f53f741dd..75db6b1817 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -44,7 +44,7 @@ //| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used //| with ``storage.VfsFat`` to allow file I/O to an SD card.""" //| -//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000) -> None: +//| def __init__(self, bus: busio.SPI, cs: microcontroller.Pin, baudrate: int = 8000000) -> None: //| """Construct an SPI SD Card object with the given properties //| //| :param busio.SPI spi: The SPI bus @@ -94,7 +94,7 @@ STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_arg } -//| def count() -> int: +//| def count(self) -> int: //| """Returns the total number of sectors //| //| Due to technical limitations, this is a function and not a property. @@ -107,7 +107,7 @@ mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count); -//| def deinit() -> None: +//| def deinit(self) -> None: //| """Disable permanently. //| //| :return: None""" @@ -120,7 +120,7 @@ mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); -//| def readblocks(start_block: int, buf: bytearray) -> None: +//| def readblocks(self, start_block: int, buf: bytearray) -> None: //| //| """Read one or more blocks from the card //| @@ -144,7 +144,7 @@ mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, m MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readblocks); -//| def writeblocks(start_block: int, buf: bytearray) -> None: +//| def writeblocks(self, start_block: int, buf: bytearray) -> None: //| //| """Write one or more blocks to the card //| diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 94ba1c3871..215f914fac 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -49,7 +49,7 @@ //| 25MHz. Usually an SDCard object is used with ``storage.VfsFat`` //| to allow file I/O to an SD card.""" //| -//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int) -> None: +//| def __init__(self, clock: microcontroller.Pin, command: microcontroller.Pin, data: Sequence[microcontroller.Pin], frequency: int) -> None: //| """Construct an SDIO SD Card object with the given properties //| //| :param ~microcontroller.Pin clock: the pin to use for the clock. @@ -109,7 +109,7 @@ STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) { } } -//| def configure(*, frequency: int=0, width: int=0) -> None: +//| def configure(self, frequency: int = 0, width: int = 0) -> None: //| """Configures the SDIO bus. //| //| :param int frequency: the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the `frequency` attribute for the actual clock rate. @@ -146,7 +146,7 @@ STATIC mp_obj_t sdioio_sdcard_configure(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(sdioio_sdcard_configure_obj, 1, sdioio_sdcard_configure); -//| def count() -> int: +//| def count(self) -> int: //| """Returns the total number of sectors //| //| Due to technical limitations, this is a function and not a property. @@ -160,7 +160,7 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); -//| def readblocks(start_block: int, buf: bytearray) -> None: +//| def readblocks(self, start_block: int, buf: bytearray) -> None: //| //| """Read one or more blocks from the card //| @@ -182,7 +182,7 @@ mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); -//| def writeblocks(start_block: int, buf: bytearray) -> None: +//| def writeblocks(self, start_block: int, buf: bytearray) -> None: //| //| """Write one or more blocks to the card //| @@ -244,7 +244,7 @@ const mp_obj_property_t sdioio_sdcard_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def deinit() -> None: +//| def deinit(self) -> None: //| """Disable permanently. //| //| :return: None""" diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index a2007edf69..dbadb19558 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -512,7 +512,7 @@ STATIC const mp_obj_type_t socket_type = { .locals_dict = (mp_obj_dict_t*)&socket_locals_dict, }; -//| def getaddrinfo(host: string, port: string) -> tuple: +//| def getaddrinfo(host: str, port: int) -> tuple: //| """Gets the address information for a hostname and port //| //| Returns the appropriate family, socket type, socket protocol and diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 2defdbb625..79c5274aae 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -43,7 +43,7 @@ //| directly.""" //| -//| def mount(filesystem: VfsFat, mount_path: string, *, readonly: bool = False) -> None: +//| def mount(filesystem: VfsFat, mount_path: str, *, readonly: bool = False) -> None: //| """Mounts the given filesystem object at the given path. //| //| This is the CircuitPython analog to the UNIX ``mount`` command. @@ -80,7 +80,7 @@ mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg } MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount); -//| def umount(mount: Union[string, VfsFat]) -> None: +//| def umount(mount: Union[str, VfsFat]) -> None: //| """Unmounts the given filesystem object or if *mount* is a path, then unmount //| the filesystem mounted at that location. //| @@ -98,7 +98,7 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount); -//| def remount(mount_path: string, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None: +//| def remount(mount_path: str, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None: //| """Remounts the given path with new parameters. //| //| :param bool readonly: True when the filesystem should be readonly to CircuitPython. @@ -128,7 +128,7 @@ mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a } MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount); -//| def getmount(mount_path: string) -> VfsFat: +//| def getmount(mount_path: str) -> VfsFat: //| """Retrieves the mount object associated with the mount path""" //| ... //| @@ -168,43 +168,43 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) }, //| class VfsFat: -//| def __init__(self, block_device: string) -> None: +//| def __init__(self, block_device: str) -> None: //| """Create a new VfsFat filesystem around the given block device. //| //| :param block_device: Block device the the filesystem lives on""" //| -//| label: string = ... -//| """The filesystem label, up to 11 case-insensitive bytes. Note that -//| this property can only be set when the device is writable by the -//| microcontroller.""" -//| ... +//| label: str +//| """The filesystem label, up to 11 case-insensitive bytes. Note that +//| this property can only be set when the device is writable by the +//| microcontroller.""" +//| ... //| //| def mkfs(self) -> None: //| """Format the block device, deleting any data that may have been there""" //| ... //| -//| def open(self, path: string, mode: string) -> None: +//| def open(self, path: str, mode: str) -> None: //| """Like builtin ``open()``""" //| ... //| -//| def ilistdir(self, path: string) -> iterator: +//| def ilistdir(self, path: str) -> Iterator[Tuple[AnyStr, int, int, int]]: //| """Return an iterator whose values describe files and folders within //| ``path``""" //| ... //| -//| def mkdir(self, path: string) -> None: +//| def mkdir(self, path: str) -> None: //| """Like `os.mkdir`""" //| ... //| -//| def rmdir(self, path: string) -> None: +//| def rmdir(self, path: str) -> None: //| """Like `os.rmdir`""" //| ... //| -//| def stat(self, path: string) -> string: +//| def stat(self, path: str) -> str: //| """Like `os.stat`""" //| ... //| -//| def statvfs(self, path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]: +//| def statvfs(self, path: str) -> Tuple[str, str, str, str, str, str, str, str, str, str]: //| """Like `os.statvfs`""" //| ... //| diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index de357dde4d..d74b962125 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -62,7 +62,7 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(struct_calcsize_obj, struct_calcsize); -//| def pack(fmt: string, *values: ReadableBuffer) -> bytes: +//| def pack(fmt: str, *values: ReadableBuffer) -> bytes: //| """Pack the values according to the format string fmt. //| The return value is a bytes object encoding the values.""" //| ... @@ -80,7 +80,7 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack); -//| def pack_into(fmt: string, buffer: WriteableBuffer, offset: int, *values: readableBuffer) -> None: +//| def pack_into(fmt: str, buffer: WriteableBuffer, offset: int, *values: ReadableBuffer) -> None: //| """Pack the values according to the format string fmt into a buffer //| starting at offset. offset may be negative to count from the end of buffer.""" //| ... @@ -106,7 +106,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_into_obj, 3, MP_OBJ_FUN_ARGS_MAX, struct_pack_into); -//| def unpack(fmt: string, data: ReadableBuffer) -> tuple: +//| def unpack(fmt: str, data: ReadableBuffer) -> tuple: //| """Unpack from the data according to the format string fmt. The return value //| is a tuple of the unpacked values. The buffer size must match the size //| required by the format.""" @@ -124,7 +124,7 @@ STATIC mp_obj_t struct_unpack(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_obj, 2, 3, struct_unpack); -//| def unpack_from(fmt: string, data: ReadableBuffer, offset: int = 0) -> tuple: +//| def unpack_from(fmt: str, data: ReadableBuffer, offset: int = 0) -> tuple: //| """Unpack from the data starting at offset according to the format string fmt. //| offset may be negative to count from the end of buffer. The return value is //| a tuple of the unpacked values. The buffer size must be at least as big diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 0559d974ab..daf55a6138 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -34,7 +34,7 @@ //| """Heap size analysis""" //| -//| def info(object: Any) -> int: +//| def info(object: object) -> int: //| """Prints memory debugging info for the given object and returns the //| estimated size.""" //| ... diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index e12ea8da4e..36111e9194 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -36,7 +36,7 @@ //| The `usb_hid` module allows you to output data as a HID device.""" //| -//| usb_hid.devices: Any = ... +//| devices: Tuple[Device, ...] //| """Tuple of all active HID device interfaces.""" //| STATIC const mp_rom_map_elem_t usb_hid_module_globals_table[] = { diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index b5c9d1c423..c46e49d3e8 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -15,10 +15,8 @@ // #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) -//| from typing import List, Tuple -//| //| class Polygon: -//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ) -> None: +//| def __init__(self, points: List[Tuple[int, int]]) -> None: //| """Represents a closed shape by ordered vertices //| //| :param points: Vertices for the polygon""" @@ -44,7 +42,7 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar } -//| points: List[ Tuple[ x, y ], ... ] = ... +//| points: List[Tuple[int, int]] = ... //| """Set a new look and shape for this polygon""" //| STATIC mp_obj_t vectorio_polygon_obj_get_points(mp_obj_t self_in) { diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index d1042b1c63..43571094ff 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -20,7 +20,7 @@ //| class VectorShape: -//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None: +//| def __init__(self, shape: Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None: //| """Binds a vector shape to a location and pixel color //| //| :param shape: The shape to draw. diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index 9b9999d8bf..25476039ab 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -32,15 +32,15 @@ //| def __init__(self) -> None: //| """Enum-like class to define the run mode of the watchdog timer.""" //| -//| RAISE: watchdog.WatchDogMode = ... +//| RAISE: WatchDogMode = ... //| """Raise an exception when the WatchDogTimer expires. //| -//| :type watchdog.WatchDogMode:""" +//| :type WatchDogMode:""" //| -//| RESET: watchdog.WatchDogMode = ... +//| RESET: WatchDogMode = ... //| """Reset the system if the WatchDogTimer expires. //| -//| :type watchdog.WatchDogMode:""" +//| :type WatchDogMode:""" //| const mp_obj_type_t watchdog_watchdogmode_type; diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index 20bead106c..fe53b864b7 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -54,7 +54,7 @@ //| ... //| -//| def feed(self): +//| def feed(self) -> None: //| """Feed the watchdog timer. This must be called regularly, otherwise //| the timer will expire.""" //| ... @@ -71,7 +71,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watchdogtimer_feed); -//| def deinit(self): +//| def deinit(self) -> None: //| """Stop the watchdog timer. This may raise an error if the watchdog //| timer cannot be disabled on this platform.""" //| ... @@ -119,7 +119,7 @@ const mp_obj_property_t watchdog_watchdogtimer_timeout_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| mode: watchdog.WatchDogMode = ... +//| mode: WatchDogMode = ... //| """The current operating mode of the WatchDogTimer `watchdog.WatchDogMode`. //| //| Setting a WatchDogMode activates the WatchDog:: diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index ab223877e6..d29c3444f4 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -13,11 +13,12 @@ import sys import traceback import isort +import black -IMPORTS_IGNORE = frozenset({'int', 'float', 'bool', 'str', 'bytes', 'tuple', 'list', 'set', 'dict', 'bytearray', 'file', 'buffer'}) -IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence'}) -IMPORTS_TYPESHED = frozenset({'ReadableBuffer', 'WritableBuffer'}) +IMPORTS_IGNORE = frozenset({'int', 'float', 'bool', 'str', 'bytes', 'tuple', 'list', 'set', 'dict', 'bytearray', 'slice', 'file', 'buffer', 'range', 'array', 'struct_time'}) +IMPORTS_TYPING = frozenset({'Any', 'Optional', 'Union', 'Tuple', 'List', 'Sequence', 'Iterable', 'Iterator', 'overload'}) +IMPORTS_TYPESHED = frozenset({'ReadableBuffer', 'WriteableBuffer'}) def is_any(node): @@ -63,8 +64,9 @@ def extract_imports(tree): typing.add(node.id) elif node.id in IMPORTS_TYPESHED: typeshed.add(node.id) - elif not node.id[0].isupper(): - modules.add(node.id) + if node_type == ast.Attribute: + if type(node.value) == ast.Name: + modules.add(node.value.id) for node in ast.walk(tree): node_type = type(node) @@ -72,6 +74,9 @@ def extract_imports(tree): collect_annotations(node.annotation) elif node_type == ast.FunctionDef: collect_annotations(node.returns) + for deco in node.decorator_list: + if deco.id in IMPORTS_TYPING: + typing.add(deco.id) return { "modules": sorted(modules), @@ -134,22 +139,21 @@ def convert_folder(top_level, stub_directory): # Add import statements import_lines = ["from __future__ import annotations"] + if imports["typing"]: + import_lines.append("from typing import " + ", ".join(imports["typing"])) + if imports["typeshed"]: + import_lines.append("from _typeshed import " + ", ".join(imports["typeshed"])) import_lines.extend(f"import {m}" for m in imports["modules"]) - import_lines.append("from typing import " + ", ".join(imports["typing"])) - import_lines.append("from _typeshed import " + ", ".join(imports["typeshed"])) import_body = "\n".join(import_lines) m = re.match(r'(\s*""".*?""")', stub_contents, flags=re.DOTALL) if m: stub_contents = m.group(1) + "\n\n" + import_body + "\n\n" + stub_contents[m.end():] else: stub_contents = import_body + "\n\n" + stub_contents - stub_contents = isort.code(stub_contents) - # Adjust blank lines - stub_contents = re.sub(r"\n+class", "\n\n\nclass", stub_contents) - stub_contents = re.sub(r"\n+def", "\n\n\ndef", stub_contents) - stub_contents = re.sub(r"\n+^(\s+)def", lambda m: f"\n\n{m.group(1)}def", stub_contents, flags=re.M) - stub_contents = stub_contents.strip() + "\n" + # Code formatting + stub_contents = isort.code(stub_contents) + stub_contents = black.format_str(stub_contents, mode=black.FileMode(is_pyi=True)) os.makedirs(stub_directory, exist_ok=True) with open(stub_filename, "w") as f: From 204cdada7c20404f9e6d4c7a16b42904b7b92659 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 Jul 2020 09:53:40 -0500 Subject: [PATCH 267/277] remove unnecessary mk files parameters --- ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk | 2 -- ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk | 2 -- 2 files changed, 4 deletions(-) diff --git a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk index db0259423d..38c9933340 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk +++ b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.mk @@ -14,5 +14,3 @@ EXTERNAL_FLASH_DEVICES = "GD25Q16C" # We use a CFLAGS define here because there are include order issues # if we try to include "mpconfigport.h" into nrfx_config.h . CFLAGS += -DCIRCUITPY_NRF_NUM_I2C=2 - -OPTIMIZATION_LEVEL = 2 diff --git a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk index e7b54af5c8..2b2c0d6db5 100644 --- a/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk +++ b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk @@ -15,5 +15,3 @@ LD_COMMON = boards/common_default.ld LD_DEFAULT = boards/STM32F405_default.ld LD_BOOT = boards/STM32F405_boot.ld # UF2 boot option UF2_OFFSET = 0x8010000 - -OPTIMIZATION_LEVEL = 2 From b9cdf195e2faa1d7d140b1f6a1f6850eb0e6c731 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 Jul 2020 10:00:42 -0500 Subject: [PATCH 268/277] board mk file changes --- .../boards/pewpew_m4/mpconfigboard.mk | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index c1fe011c40..b19a6d92d6 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -10,32 +10,38 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 +# TODO: Turn off analogio for now for space reasons, but restore it +# when frozen module gets smaller. +CIRCUITPY_ANALOGIO = 0 CIRCUITPY_AUDIOBUSIO = 0 -CIRCUITPY_AUDIOPWMIO = 0 -CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BITBANGIO = 0 -CIRCUITPY_BITBANG_APA102 = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_GAMEPADSHIFT = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 +CIRCUITPY_NETWORK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PS2IO = 0 -CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 -CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_BITBANG_APA102 = 0 +CIRCUITPY_BLEIO = 0 +CIRCUITPY_GAMEPADSHIFT = 0 +CIRCUITPY_NETWORK = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_SAMD = 0 +CIRCUITPY_TOUCHIO = 0 CIRCUITPY_VECTORIO = 0 -CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 -CIRCUITPY_MATH = 1 CIRCUITPY_STAGE = 1 +CIRCUITPY_MATH = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf @@ -47,5 +53,4 @@ else CFLAGS_INLINE_LIMIT = 70 endif -# Override optimization to keep binary small OPTIMIZATION_FLAGS = -Os From 356b1a8d6dd9830d452eddc63f3c8bc890fa12f8 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Fri, 24 Jul 2020 12:29:18 -0400 Subject: [PATCH 269/277] Finish common-hal pin API --- ports/litex/common-hal/microcontroller/Pin.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/litex/common-hal/microcontroller/Pin.c b/ports/litex/common-hal/microcontroller/Pin.c index 632468f6d0..38601e0d3c 100644 --- a/ports/litex/common-hal/microcontroller/Pin.c +++ b/ports/litex/common-hal/microcontroller/Pin.c @@ -41,12 +41,19 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { claimed_pins[pin_port] &= ~(1<number); +} void claim_pin(const mcu_pin_obj_t* pin) { // Set bit in claimed_pins bitmask. claimed_pins[0] |= 1<number; } +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { + claim_pin(pin); +} + bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) { return !(claimed_pins[pin_port] & 1< Date: Fri, 24 Jul 2020 14:09:09 -0500 Subject: [PATCH 270/277] Use current mpconfigboard.mk with optimization change --- .../boards/pewpew_m4/mpconfigboard.mk | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index b19a6d92d6..fd91a46e43 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -10,38 +10,32 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -# TODO: Turn off analogio for now for space reasons, but restore it -# when frozen module gets smaller. -CIRCUITPY_ANALOGIO = 0 CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_BITBANG_APA102 = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_GAMEPADSHIFT = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PS2IO = 0 +CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 +CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 -CIRCUITPY_AUDIOPWMIO = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BITBANG_APA102 = 0 -CIRCUITPY_BLEIO = 0 -CIRCUITPY_GAMEPADSHIFT = 0 -CIRCUITPY_NETWORK = 0 -CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_SAMD = 0 -CIRCUITPY_TOUCHIO = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 -CIRCUITPY_STAGE = 1 CIRCUITPY_MATH = 1 +CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf From 739981b34e617cb66d721d1922c0f8c7c61dc794 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 Jul 2020 17:27:25 -0500 Subject: [PATCH 271/277] update for pewpew --- .../boards/pewpew_m4/mpconfigboard.mk | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index b19a6d92d6..1ea4a7601f 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -10,38 +10,32 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -# TODO: Turn off analogio for now for space reasons, but restore it -# when frozen module gets smaller. -CIRCUITPY_ANALOGIO = 0 CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_BITBANG_APA102 = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_GAMEPADSHIFT = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_NETWORK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PS2IO = 0 +CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 +CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 -CIRCUITPY_AUDIOPWMIO = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BITBANG_APA102 = 0 -CIRCUITPY_BLEIO = 0 -CIRCUITPY_GAMEPADSHIFT = 0 -CIRCUITPY_NETWORK = 0 -CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_SAMD = 0 -CIRCUITPY_TOUCHIO = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 -CIRCUITPY_STAGE = 1 CIRCUITPY_MATH = 1 +CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf @@ -52,5 +46,5 @@ CFLAGS_INLINE_LIMIT = 45 else CFLAGS_INLINE_LIMIT = 70 endif - +# Override optimization to keep binary small OPTIMIZATION_FLAGS = -Os From 9a1f1236ccf9fd525675b8b8ea34178851f968cc Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:43:15 -0700 Subject: [PATCH 272/277] require async for and async with to actually be in an async def method instead of just a generator --- py/compile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/py/compile.c b/py/compile.c index 9b0d29998a..fade4c01a4 100644 --- a/py/compile.c +++ b/py/compile.c @@ -1713,11 +1713,11 @@ STATIC void compile_yield_from(compiler_t *comp) { #if MICROPY_PY_ASYNC_AWAIT STATIC bool compile_require_async_context(compiler_t *comp, mp_parse_node_struct_t *pns) { int scope_flags = comp->scope_cur->scope_flags; - if(scope_flags & MP_SCOPE_FLAG_GENERATOR) { + if(scope_flags & MP_SCOPE_FLAG_ASYNC) { return true; } compile_syntax_error(comp, (mp_parse_node_t)pns, - translate("'async for' or 'async with' outside async function")); + translate("'await', 'async for' or 'async with' outside async function")); return false; } @@ -2645,6 +2645,7 @@ STATIC void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pn compile_syntax_error(comp, (mp_parse_node_t)pns, translate("'await' outside function")); return; } + compile_require_async_context(comp, pns); compile_atom_expr_normal(comp, pns); compile_yield_from(comp); } From a6b5870514c3e5cf05aa9b8a5ee53ff45936a86f Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Fri, 24 Jul 2020 19:58:20 -0700 Subject: [PATCH 273/277] translations --- locale/circuitpython.pot | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 4d3a877069..153f0edad2 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 18:43-0700\n" +"POT-Creation-Date: 2020-07-24 19:58-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -110,10 +110,6 @@ msgstr "" msgid "'%q' argument required" msgstr "" -#: py/objarray.c -msgid "'%q' object is not bytes-like" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" @@ -219,11 +215,11 @@ msgid "'align' requires 1 argument" msgstr "" #: py/compile.c -msgid "'async for' or 'async with' outside async function" +msgid "'await' outside function" msgstr "" #: py/compile.c -msgid "'await' outside function" +msgid "'await', 'async for' or 'async with' outside async function" msgstr "" #: py/compile.c @@ -1336,10 +1332,6 @@ msgstr "" msgid "Pull not used when direction is output." msgstr "" -#: ports/stm/ref/pulseout-pre-timeralloc.c -msgid "PulseOut not supported on this chip" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" msgstr "" @@ -1773,7 +1765,7 @@ msgstr "" msgid "__new__ arg must be a user-type" msgstr "" -#: extmod/modubinascii.c extmod/moduhashlib.c +#: extmod/modubinascii.c extmod/moduhashlib.c py/objarray.c msgid "a bytes-like object is required" msgstr "" From d9503e579b72d8bad6f556589da50ba9833b4574 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 Jul 2020 23:27:22 -0500 Subject: [PATCH 274/277] latest frozen/circuitpython-stage --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 0d2c083a2f..9596a5904e 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 0d2c083a2fb57a1562d4806775f45273abbfbfae +Subproject commit 9596a5904ed757e6fbffcf03e7aa77ae9ecf5223 From 6696915801d84b41164edafc282779085a452c2f Mon Sep 17 00:00:00 2001 From: ikigaisense Date: Sat, 25 Jul 2020 10:07:33 -0600 Subject: [PATCH 275/277] fix-ndbit6-for-ndbit6_v2 --- ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h | 1 - ports/atmel-samd/boards/ndgarage_ndbit6/pins.c | 1 - 2 files changed, 2 deletions(-) diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h b/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h index 869f207a16..51be8d7c06 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/mpconfigboard.h @@ -29,4 +29,3 @@ // USB is always used. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 - diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c b/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c index 8b3898b185..2ea5630079 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/pins.c @@ -37,4 +37,3 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); - From c4a5297ee2777596081ae247e43f4a8b5746a14a Mon Sep 17 00:00:00 2001 From: Chris Burton Date: Sat, 25 Jul 2020 17:53:27 +0000 Subject: [PATCH 276/277] Add GamePad to Commander --- ports/atmel-samd/boards/8086_commander/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk index dcc62fc9bc..5a1bc1c4dd 100644 --- a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk +++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk @@ -19,6 +19,8 @@ SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 60 +CIRCUITPY_GAMEPAD = 1 + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID From d356581651e4a11dc18787da95e2f96bfde3575d Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Sat, 25 Jul 2020 17:58:37 +0900 Subject: [PATCH 277/277] Fix several type hints --- ports/atmel-samd/bindings/samd/Clock.c | 8 ++-- shared-bindings/_bleio/Adapter.c | 14 +++---- shared-bindings/_bleio/Address.c | 12 +++--- shared-bindings/_bleio/Attribute.c | 14 +++---- shared-bindings/_bleio/Characteristic.c | 24 +++++------ shared-bindings/_bleio/CharacteristicBuffer.c | 4 +- shared-bindings/_bleio/Connection.c | 10 ++--- shared-bindings/_bleio/Descriptor.c | 42 +++++++++---------- shared-bindings/_bleio/PacketBuffer.c | 8 ++-- shared-bindings/_bleio/ScanEntry.c | 10 ++--- shared-bindings/_bleio/Service.c | 8 ++-- shared-bindings/_bleio/UUID.c | 6 +-- shared-bindings/_eve/__init__.c | 2 +- shared-bindings/_pixelbuf/PixelBuf.c | 10 ++--- shared-bindings/_stage/Layer.c | 2 +- shared-bindings/_stage/Text.c | 2 +- shared-bindings/_stage/__init__.c | 2 +- shared-bindings/aesio/aes.c | 2 +- shared-bindings/analogio/AnalogIn.c | 4 +- shared-bindings/analogio/AnalogOut.c | 2 +- shared-bindings/audiobusio/I2SOut.c | 6 +-- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/audiocore/RawSample.c | 6 +-- shared-bindings/audiocore/WaveFile.c | 6 +-- shared-bindings/audiocore/__init__.c | 7 ++++ shared-bindings/audioio/AudioOut.c | 8 ++-- shared-bindings/audiomixer/Mixer.c | 8 ++-- shared-bindings/audiomixer/MixerVoice.c | 6 +-- shared-bindings/audiomp3/MP3Decoder.c | 12 +++--- shared-bindings/audiopwmio/PWMAudioOut.c | 8 ++-- shared-bindings/bitbangio/I2C.c | 8 ++-- shared-bindings/bitbangio/SPI.c | 4 +- shared-bindings/busio/I2C.c | 10 ++--- shared-bindings/busio/SPI.c | 8 ++-- shared-bindings/busio/UART.c | 12 +++--- shared-bindings/countio/Counter.c | 2 +- shared-bindings/digitalio/DigitalInOut.c | 12 +++--- shared-bindings/digitalio/Direction.c | 4 +- shared-bindings/digitalio/DriveMode.c | 4 +- shared-bindings/digitalio/Pull.c | 4 +- shared-bindings/displayio/Bitmap.c | 4 +- shared-bindings/displayio/ColorConverter.c | 2 +- shared-bindings/displayio/Display.c | 29 +++++++------ shared-bindings/displayio/EPaperDisplay.c | 10 ++--- shared-bindings/displayio/FourWire.c | 2 +- shared-bindings/displayio/Group.c | 8 ++-- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/displayio/OnDiskBitmap.c | 4 +- shared-bindings/displayio/TileGrid.c | 22 +++++----- shared-bindings/fontio/BuiltinFont.c | 2 +- .../framebufferio/FramebufferDisplay.c | 14 +++---- shared-bindings/frequencyio/FrequencyIn.c | 2 +- shared-bindings/gnss/GNSS.c | 14 +++---- shared-bindings/gnss/PositionFix.c | 6 +-- shared-bindings/i2cperipheral/I2CPeripheral.c | 8 ++-- .../memorymonitor/AllocationSize.c | 2 +- shared-bindings/microcontroller/Pin.c | 2 +- shared-bindings/microcontroller/Processor.c | 8 ++-- shared-bindings/microcontroller/RunMode.c | 6 +-- shared-bindings/microcontroller/__init__.c | 10 ++++- shared-bindings/multiterminal/__init__.c | 2 +- shared-bindings/neopixel_write/__init__.c | 2 +- shared-bindings/os/__init__.c | 2 +- shared-bindings/pulseio/PWMOut.c | 4 +- shared-bindings/pulseio/PulseIn.c | 4 +- shared-bindings/pulseio/PulseOut.c | 2 +- shared-bindings/rgbmatrix/RGBMatrix.c | 6 +-- shared-bindings/rotaryio/IncrementalEncoder.c | 2 +- shared-bindings/rtc/RTC.c | 4 +- shared-bindings/sdcardio/SDCard.c | 4 +- shared-bindings/sdioio/SDCard.c | 6 +-- shared-bindings/socket/__init__.c | 4 +- shared-bindings/supervisor/Runtime.c | 4 +- shared-bindings/supervisor/__init__.c | 2 +- shared-bindings/terminalio/Terminal.c | 2 +- shared-bindings/touchio/TouchIn.c | 6 +-- shared-bindings/usb_hid/Device.c | 4 +- shared-bindings/usb_midi/PortIn.c | 2 +- shared-bindings/vectorio/Circle.c | 2 +- shared-bindings/vectorio/Polygon.c | 2 +- shared-bindings/vectorio/VectorShape.c | 6 +-- shared-bindings/watchdog/WatchDogMode.c | 4 +- shared-bindings/watchdog/WatchDogTimer.c | 4 +- shared-bindings/wiznet/wiznet5k.c | 6 +-- 84 files changed, 292 insertions(+), 274 deletions(-) diff --git a/ports/atmel-samd/bindings/samd/Clock.c b/ports/atmel-samd/bindings/samd/Clock.c index e8a468d77f..478a10fcd4 100644 --- a/ports/atmel-samd/bindings/samd/Clock.c +++ b/ports/atmel-samd/bindings/samd/Clock.c @@ -43,7 +43,7 @@ STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name); } -//| enabled: bool = ... +//| enabled: bool //| """Is the clock enabled? (read-only)""" //| STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) { @@ -61,7 +61,7 @@ const mp_obj_property_t samd_clock_enabled_obj = { }, }; -//| parent: Union[Clock, None] = ... +//| parent: Union[Clock, None] //| """Clock parent. (read-only)""" //| STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) { @@ -89,7 +89,7 @@ const mp_obj_property_t samd_clock_parent_obj = { }, }; -//| frequency: int = ... +//| frequency: int //| """Clock frequency in Herz. (read-only)""" //| STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) { @@ -107,7 +107,7 @@ const mp_obj_property_t samd_clock_frequency_obj = { }, }; -//| calibration: int = ... +//| calibration: int //| """Clock calibration. Not all clocks can be calibrated.""" //| STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 9177a9a69d..f898d404a0 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -71,7 +71,7 @@ //| ... //| -//| enabled: bool = ... +//| enabled: bool //| """State of the BLE adapter.""" //| STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) { @@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| address: Address = ... +//| address: Address //| """MAC address of the BLE adapter. (read-only)""" //| STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) { @@ -111,7 +111,7 @@ const mp_obj_property_t bleio_adapter_address_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| name: str = ... +//| name: str //| """name of the BLE adapter used once connected. //| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``, //| to make it easy to distinguish multiple CircuitPython boards.""" @@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising); -//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]: +//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: Optional[float] = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]: //| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are //| filtered and returned separately. //| @@ -301,7 +301,7 @@ STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan); -//| advertising: bool = ... +//| advertising: bool //| """True when the adapter is currently advertising. (read-only)""" //| STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) { @@ -317,7 +317,7 @@ const mp_obj_property_t bleio_adapter_advertising_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| connected: bool = ... +//| connected: bool //| """True when the adapter is connected to another device regardless of who initiated the //| connection. (read-only)""" //| @@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| connections: tuple = ... +//| connections: tuple //| """Tuple of active connections including those initiated through //| :py:meth:`_bleio.Adapter.connect`. (read-only)""" //| diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 290b0fd09a..94994fb702 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -77,7 +77,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| address_bytes: bytes = ... +//| address_bytes: bytes //| """The bytes that make up the device address (read-only). //| //| Note that the ``bytes`` object returned is in little-endian order: @@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| type: int = ... +//| type: int //| """The address type (read-only). //| //| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`, @@ -187,17 +187,17 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); } -//| PUBLIC: int = ... +//| PUBLIC: int //| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits).""" //| -//| RANDOM_STATIC: int = ... +//| RANDOM_STATIC: int //| """A randomly generated address that does not change often. It may never change or may change after //| a power cycle.""" //| -//| RANDOM_PRIVATE_RESOLVABLE: int = ... +//| RANDOM_PRIVATE_RESOLVABLE: int //| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK).""" //| -//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ... +//| RANDOM_PRIVATE_NON_RESOLVABLE: int //| """A randomly generated address that changes on every connection.""" //| STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = { diff --git a/shared-bindings/_bleio/Attribute.c b/shared-bindings/_bleio/Attribute.c index 7d91c93780..2c144c71b9 100644 --- a/shared-bindings/_bleio/Attribute.c +++ b/shared-bindings/_bleio/Attribute.c @@ -43,25 +43,25 @@ STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = { -//| NO_ACCESS: int = ... +//| NO_ACCESS: int //| """security mode: access not allowed""" //| -//| OPEN: int = ... +//| OPEN: int //| """security_mode: no security (link is not encrypted)""" //| -//| ENCRYPT_NO_MITM: int = ... +//| ENCRYPT_NO_MITM: int //| """security_mode: unauthenticated encryption, without man-in-the-middle protection""" //| -//| ENCRYPT_WITH_MITM: int = ... +//| ENCRYPT_WITH_MITM: int //| """security_mode: authenticated encryption, with man-in-the-middle protection""" //| -//| LESC_ENCRYPT_WITH_MITM: int = ... +//| LESC_ENCRYPT_WITH_MITM: int //| """security_mode: LESC encryption, with man-in-the-middle protection""" //| -//| SIGNED_NO_MITM: int = ... +//| SIGNED_NO_MITM: int //| """security_mode: unauthenticated data signing, without man-in-the-middle protection""" //| -//| SIGNED_WITH_MITM: int = ... +//| SIGNED_WITH_MITM: int //| """security_mode: authenticated data signing, without man-in-the-middle protection""" //| { MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) }, diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 2cdedaf99c..557a356b69 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj, -//| properties: int = ... +//| properties: int //| """An int bitmask representing which properties are set, specified as bitwise or'ing of //| of these possible values. //| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`.""" @@ -160,7 +160,7 @@ const mp_obj_property_t bleio_characteristic_properties_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| uuid: Optional[UUID] = ... +//| uuid: Optional[UUID] //| """The UUID of this characteristic. (read-only) //| //| Will be ``None`` if the 128-bit UUID for this characteristic is not known.""" @@ -180,7 +180,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| value: bytearray = ... +//| value: bytearray //| """The value of this characteristic.""" //| STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) { @@ -211,7 +211,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| descriptors: Descriptor = ... +//| descriptors: Descriptor //| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)""" //| STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) { @@ -241,7 +241,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| service: Service = ... +//| service: Service //| """The Service this Characteristic is a part of.""" //| STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) { @@ -258,7 +258,7 @@ const mp_obj_property_t bleio_characteristic_service_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None: +//| def set_cccd(self, *, notify: bool = False, indicate: bool = False) -> None: //| """Set the remote characteristic's CCCD to enable or disable notification and indication. //| //| :param bool notify: True if Characteristic should receive notifications of remote writes @@ -291,22 +291,22 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) }, // Bitmask constants to represent properties -//| BROADCAST: int = ... +//| BROADCAST: int //| """property: allowed in advertising packets""" //| -//| INDICATE: int = ... +//| INDICATE: int //| """property: server will indicate to the client when the value is set and wait for a response""" //| -//| NOTIFY: int = ... +//| NOTIFY: int //| """property: server will notify the client when the value is set""" //| -//| READ: int = ... +//| READ: int //| """property: clients may read this characteristic""" //| -//| WRITE: int = ... +//| WRITE: int //| """property: clients may write this characteristic; a response will be sent back""" //| -//| WRITE_NO_RESPONSE: int = ... +//| WRITE_NO_RESPONSE: int //| """property: clients may write this characteristic; no response will be sent back""" //| { MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) }, diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 24d7a26b64..7bcbc807e6 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -100,7 +100,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) { // These are standard stream methods. Code is in py/stream.c. // -//| def read(self, nbytes: int = None) -> Optional[bytes]: +//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]: //| """Read characters. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended @@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r return ret; } -//| in_waiting: int = ... +//| in_waiting: int //| """The number of bytes in the input buffer, available to be read""" //| STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index f610d65079..ed480ec04d 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair); -//| def discover_remote_services(self, service_uuids_whitelist: Iterable[UUID] = None) -> Tuple[Service, ...]: +//| def discover_remote_services(self, service_uuids_whitelist: Optional[Iterable[UUID]] = None) -> Tuple[Service, ...]: //| """Do BLE discovery for all services or for the given service UUIDS, //| to find their handles and characteristics, and return the discovered services. //| `Connection.connected` must be True. @@ -152,7 +152,7 @@ STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, cons } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services); -//| connected: bool = ... +//| connected: bool //| """True if connected to the remote peer.""" //| STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) { @@ -170,7 +170,7 @@ const mp_obj_property_t bleio_connection_connected_obj = { }; -//| paired: bool = ... +//| paired: bool //| """True if paired to the remote peer.""" //| STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) { @@ -188,7 +188,7 @@ const mp_obj_property_t bleio_connection_paired_obj = { }; -//| connection_interval: float = ... +//| connection_interval: float //| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers //| increase speed and decrease latency but increase power consumption. //| @@ -206,7 +206,7 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval); -//| attribute: int = ... +//| attribute: int //| """The maximum number of data bytes that can be sent in a single transmission, //| not including overhead bytes. //| diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index b709fea6dd..e24751f759 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -43,27 +43,27 @@ //| """There is no regular constructor for a Descriptor. A new local Descriptor can be created //| and attached to a Characteristic by calling `add_to_characteristic()`. //| Remote Descriptor objects are created by `Connection.discover_remote_services()` -//| as part of remote Characteristics in the remote Services that are discovered. +//| as part of remote Characteristics in the remote Services that are discovered.""" //| -//| .. classmethod:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'') +//| @classmethod +//| def add_to_characteristic(characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor: +//| """Create a new Descriptor object, and add it to this Service. //| -//| Create a new Descriptor object, and add it to this Service. +//| :param Characteristic characteristic: The characteristic that will hold this descriptor +//| :param UUID uuid: The uuid of the descriptor +//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is +//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum +//| number of data bytes that fit in a single BLE 4.x ATT packet. +//| :param bool fixed_length: True if the descriptor value is of fixed length. +//| :param buf initial_value: The initial value for this descriptor. //| -//| :param Characteristic characteristic: The characteristic that will hold this descriptor -//| :param UUID uuid: The uuid of the descriptor -//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is -//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum -//| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the descriptor value is of fixed length. -//| :param buf initial_value: The initial value for this descriptor. -//| -//| :return: the new Descriptor.""" +//| :return: the new Descriptor.""" //| ... //| STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic); STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj)); -//| uuid: UUID = ... +//| uuid: UUID //| """The descriptor uuid. (read-only)""" //| STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) { @@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| characteristic: Characteristic = ... +//| characteristic: Characteristic //| """The Characteristic this Descriptor is a part of.""" //| STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) { @@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| value: WriteableBuffer = ... +//| value: bytearray //| """The value of this descriptor.""" //| STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index bbdde37d5b..8c8970939a 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto); -//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int: +//| def write(self, data: ReadableBuffer, *, header: Optional[bytes] = None) -> int: //| """Writes all bytes from data into the same outgoing packet. The bytes from header are included //| before data when the pending packet is currently empty. //| @@ -179,12 +179,12 @@ STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_buffer_deinit); -//| packet_size: int = ... +//| packet_size: int //| """`packet_size` is the same as `incoming_packet_length`. //| The name `packet_size` is deprecated and //| will be removed in CircuitPython 6.0.0.""" //| -//| incoming_packet_length: int = ... +//| incoming_packet_length: int //| """Maximum length in bytes of a packet we are reading.""" //| STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) { @@ -205,7 +205,7 @@ const mp_obj_property_t bleio_packet_buffer_incoming_packet_length_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| outgoing_packet_length: int = ... +//| outgoing_packet_length: int //| """Maximum length in bytes of a packet we are writing.""" //| STATIC mp_obj_t bleio_packet_buffer_get_outgoing_packet_length(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index d2f0e77fd1..4f07890190 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches); -//| address: Address = ... +//| address: Address //| """The address of the device (read-only), of type `_bleio.Address`.""" //| STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) { @@ -86,7 +86,7 @@ const mp_obj_property_t bleio_scanentry_address_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| advertisement_bytes: bytes = ... +//| advertisement_bytes: bytes //| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)""" //| STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) { @@ -102,7 +102,7 @@ const mp_obj_property_t bleio_scanentry_advertisement_bytes_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| rssi: int = ... +//| rssi: int //| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)""" //| STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) { @@ -118,7 +118,7 @@ const mp_obj_property_t bleio_scanentry_rssi_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| connectable: bool = ... +//| connectable: bool //| """True if the device can be connected to. (read-only)""" //| STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) { @@ -134,7 +134,7 @@ const mp_obj_property_t bleio_scanentry_connectable_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| scan_response: bool = ... +//| scan_response: bool //| """True if the entry was a scan response. (read-only)""" //| STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index 65f920c583..f410b1798e 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(service); } -//| characteristics: Tuple[Characteristic, ...] = ... +//| characteristics: Tuple[Characteristic, ...] //| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by //| this service. (read-only)""" //| @@ -92,7 +92,7 @@ const mp_obj_property_t bleio_service_characteristics_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| remote: bool = ... +//| remote: bool //| """True if this is a service provided by a remote device. (read-only)""" //| STATIC mp_obj_t bleio_service_get_remote(mp_obj_t self_in) { @@ -109,7 +109,7 @@ const mp_obj_property_t bleio_service_remote_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| secondary: bool = ... +//| secondary: bool //| """True if this is a secondary service. (read-only)""" //| STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) { @@ -126,7 +126,7 @@ const mp_obj_property_t bleio_service_secondary_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| uuid: Optional[UUID] = ... +//| uuid: Optional[UUID] //| """The UUID of this service. (read-only) //| //| Will be ``None`` if the 128-bit UUID for this service is not known.""" diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index fa1e298a9a..6d92cf7931 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -120,7 +120,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, co return MP_OBJ_FROM_PTR(self); } -//| uuid16: int = ... +//| uuid16: int //| """The 16-bit part of the UUID. (read-only) //| //| :type: int""" @@ -139,7 +139,7 @@ const mp_obj_property_t bleio_uuid_uuid16_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| uuid128: bytes = ... +//| uuid128: bytes //| """The 128-bit value of the UUID //| Raises AttributeError if this is a 16-bit UUID. (read-only) //| @@ -165,7 +165,7 @@ const mp_obj_property_t bleio_uuid_uuid128_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| size: int = ... +//| size: int //| """128 if this UUID represents a 128-bit vendor-specific UUID. 16 if this UUID represents a //| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported. //| diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index dd7f6f8bd1..51d3d65aee 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -70,7 +70,7 @@ STATIC mp_obj_t _flush(mp_obj_t self) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush); -//| def cc(self, b: bytes) -> None: +//| def cc(self, b: ReadableBuffer) -> None: //| """Append bytes to the command FIFO. //| //| :param bytes b: The bytes to add""" diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 598c68d1de..abfe190d80 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t //| class PixelBuf: //| """A fast RGB[W] pixel buffer for LED and similar devices.""" //| -//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b"") -> None: +//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: ReadableBuffer = b"", trailer: ReadableBuffer = b"") -> None: //| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel. //| //| When brightness is less than 1.0, a second buffer will be used to store the color values @@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t } } -//| bpp: int = ... +//| bpp: int //| """The number of bytes per pixel in the buffer (read-only)""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) { @@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = { }; -//| brightness: float = ... +//| brightness: float //| """Float value between 0 and 1. Output brightness. //| //| When brightness is less than 1.0, a second buffer will be used to store the color values @@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_write: bool = ... +//| auto_write: bool //| """Whether to automatically write the pixels after each update.""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) { @@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| byteorder: str = ... +//| byteorder: str //| """byteorder string for the buffer (read-only)""" //| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) { diff --git a/shared-bindings/_stage/Layer.c b/shared-bindings/_stage/Layer.c index 5828669a78..269005ccff 100644 --- a/shared-bindings/_stage/Layer.c +++ b/shared-bindings/_stage/Layer.c @@ -33,7 +33,7 @@ //| class Layer: //| """Keep information about a single layer of graphics""" //| -//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None: +//| def __init__(self, width: int, height: int, graphic: ReadableBuffer, palette: ReadableBuffer, grid: ReadableBuffer) -> None: //| """Keep internal information about a layer of graphics (either a //| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering //| with the ``render()`` function. diff --git a/shared-bindings/_stage/Text.c b/shared-bindings/_stage/Text.c index 555eb58310..464af1b98f 100644 --- a/shared-bindings/_stage/Text.c +++ b/shared-bindings/_stage/Text.c @@ -33,7 +33,7 @@ //| class Text: //| """Keep information about a single grid of text""" //| -//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None: +//| def __init__(self, width: int, height: int, font: ReadableBuffer, palette: ReadableBuffer, chars: ReadableBuffer) -> None: //| """Keep internal information about a grid of text //| in a format suitable for fast rendering //| with the ``render()`` function. diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 6af0e6dbf2..6651b3e0ba 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -39,7 +39,7 @@ //| The `_stage` module contains native code to speed-up the ```stage`` Library //| `_.""" //| -//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> None: +//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: WriteableBuffer, display: displayio.Display, scale: int, background: int) -> None: //| """Render and send to the display a fragment of the screen. //| //| :param int x0: Left edge of the fragment. diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index 9881bd0edc..7c10693fec 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -12,7 +12,7 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key: Optional[ReadableBuffer], mode: int = 0, iv: ReadableBuffer = None, segment_size: int = 8) -> None: +//| def __init__(self, key: ReadableBuffer, mode: int = 0, iv: Optional[ReadableBuffer] = None, segment_size: int = 8) -> None: //| """Create a new AES state with the given key. //| //| :param bytearray key: A 16-, 24-, or 32-byte key diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 2164bdf3e4..2cda9355ab 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -104,7 +104,7 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__); -//| value: int = ... +//| value: int //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only) //| //| Even if the underlying analog to digital converter (ADC) is lower @@ -124,7 +124,7 @@ const mp_obj_property_t analogio_analogin_value_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| reference_voltage: Optional[float] = ... +//| reference_voltage: Optional[float] //| """The maximum voltage measurable (also known as the reference voltage) as a //| `float` in Volts.""" //| diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index 7b960d2edf..787905c3c5 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__); -//| value: int = ... +//| value: int //| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only) //| //| Even if the underlying digital to analog converter (DAC) is lower diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 304c737f62..73a78ab065 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__); -//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None: +//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -186,7 +186,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop); -//| playing: bool = ... +//| playing: bool //| """True when the audio sample is being output. (read-only)""" //| STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) { @@ -235,7 +235,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume); -//| paused: bool = ... +//| paused: bool //| """True when playback is paused. (read-only)""" //| STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) { diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 9a963bcfa9..6c5fa79394 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -210,7 +210,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat } MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record); -//| sample_rate: int = ... +//| sample_rate: int //| """The actual sample_rate of the recording. This may not match the constructed //| sample rate due to internal clock limitations.""" //| diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 20ebae0015..fd8652c143 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -38,13 +38,13 @@ //| class RawSample: //| """A raw audio sample buffer in memory""" //| -//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None: +//| def __init__(self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000) -> None: //| """Create a RawSample based on the given buffer of signed values. If channel_count is more than //| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the //| first sample will be for channel 1, the second sample will be for channel two, the third for //| channel 1 and so on. //| -//| :param array.array buffer: An `array.array` with samples +//| :param ReadableBuffer buffer: A buffer with samples //| :param int channel_count: The number of channels in the buffer //| :param int sample_rate: The desired playback sample rate //| @@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__); -//| sample_rate: Optional(int) = ... +//| sample_rate: Optional[int] //| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second). //| When the sample is looped, this can change the pitch output without changing the underlying //| sample. This will not change the sample rate of any active playback. Call ``play`` again to diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index d986d6db5c..89c731c68b 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__); -//| sample_rate: int = ... +//| sample_rate: int //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" @@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bits_per_sample: int = ... +//| bits_per_sample: int //| """Bits per sample. (read only)""" //| STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) { @@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = { (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -//| channel_count: int = ... +//| channel_count: int //| """Number of audio channels. (read only)""" //| STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) { diff --git a/shared-bindings/audiocore/__init__.c b/shared-bindings/audiocore/__init__.c index b400b94548..a27dcefa44 100644 --- a/shared-bindings/audiocore/__init__.c +++ b/shared-bindings/audiocore/__init__.c @@ -38,6 +38,13 @@ //| """Support for audio samples""" //| +//| _AudioSample = Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder] +//| """An audio sample for playback with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`. +//| +//| Supported sources are :py:class:`audiocore.WaveFile`, :py:class:`audiocore.RawSample`, +//| :py:class:`audiomixer.Mixer` and :py:class:`audiomp3.MP3Decoder`.""" +//| + STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) }, { MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) }, diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index e1a78c44c4..25620a491f 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -39,7 +39,7 @@ //| class AudioOut: //| """Output an analog audio signal""" //| -//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None: +//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None: //| """Create a AudioOut object associated with the given pin(s). This allows you to //| play audio signals out on the given pin(s). //| @@ -146,7 +146,7 @@ STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *arg STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__); -//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None: +//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -187,7 +187,7 @@ STATIC mp_obj_t audioio_audioout_obj_stop(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop); -//| playing: bool = ... +//| playing: bool //| """True when an audio sample is being output even if `paused`. (read-only)""" //| STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) { @@ -236,7 +236,7 @@ STATIC mp_obj_t audioio_audioout_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resume); -//| paused: bool = ... +//| paused: bool //| """True when playback is paused. (read-only)""" //| STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) { diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index 0356edde4d..9a78c7fad6 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -156,7 +156,7 @@ STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__); -//| playing: bool = ... +//| playing: bool //| """True when any voice is being output. (read-only)""" //| STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) { @@ -173,7 +173,7 @@ const mp_obj_property_t audiomixer_mixer_playing_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| sample_rate: int = ... +//| sample_rate: int //| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).""" //| STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| voice: Tuple[MixerVoice, ...] = ... +//| voice: Tuple[MixerVoice, ...] //| """A tuple of the mixer's `audiomixer.MixerVoice` object(s). //| //| .. code-block:: python @@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, Mixer], *, voice: int = 0, loop: bool = False) -> None: +//| def play(self, sample: audiocore._AudioSample, *, voice: int = 0, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index 26a044d464..335949bb68 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(self); } -//| def play(self, sample: Union[audiocore.WaveFile, Mixer, audiocore.RawSample], *, loop: bool = False) -> None: +//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None: //| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``. //| Does not block. Use `playing` to block. //| @@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po } MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop); -//| level: float = ... +//| level: float //| """The volume level of a voice, as a floating point number between 0 and 1.""" //| STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) { @@ -136,7 +136,7 @@ const mp_obj_property_t audiomixer_mixervoice_level_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| playing: bool = ... +//| playing: bool //| """True when this voice is being output. (read-only)""" //| diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index b7bb449572..0e427951c0 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -34,7 +34,7 @@ #include "shared-bindings/util.h" #include "supervisor/shared/translate.h" -//| class MP3: +//| class MP3Decoder: //| """Load a mp3 file for audio playback""" //| //| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None: @@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__); -//| file: file = ... +//| file: file //| """File to play back.""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) { @@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = { -//| sample_rate: int = ... +//| sample_rate: int //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" @@ -181,7 +181,7 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bits_per_sample: int = ... +//| bits_per_sample: int //| """Bits per sample. (read only)""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) { @@ -198,7 +198,7 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| channel_count: int = ... +//| channel_count: int //| """Number of audio channels. (read only)""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) { @@ -215,7 +215,7 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rms_level: float = ... +//| rms_level: float //| """The RMS audio level of a recently played moment of audio. (read only)""" //| STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) { diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index 1d740823a9..74545a4ebb 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -39,7 +39,7 @@ //| class PWMAudioOut: //| """Output an analog audio signal by varying the PWM duty cycle.""" //| -//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None: +//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None: //| """Create a PWMAudioOut object associated with the given pin(s). This allows you to //| play audio signals out on the given pin(s). In contrast to mod:`audioio`, //| the pin(s) specified are digital pins, and are driven with a device-dependent PWM @@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__); -//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None: +//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -189,7 +189,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop); -//| playing: bool = ... +//| playing: bool //| """True when an audio sample is being output even if `paused`. (read-only)""" //| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) { @@ -238,7 +238,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume); -//| paused: bool = ... +//| paused: bool //| """True when playback is paused. (read-only)""" //| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) { diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 212956726a..28ccb4746f 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -40,7 +40,7 @@ //| class I2C: //| """Two wire serial protocol""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None: +//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None: //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. @@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None: +//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a //| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start //| before a read. @@ -274,7 +274,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 0a4d62361a..3e071ed743 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -51,7 +51,7 @@ //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines //| and therefore the hardware.)""" //| -//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None: +//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None: //| """Construct an SPI object on the given pins. //| //| .. seealso:: Using this class directly requires careful lock management. @@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto); -//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` //| must be equal. diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 8a0414b5a0..4a5d39c52a 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -175,7 +175,7 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); -//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None: +//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -227,7 +227,7 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); -//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None: +//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, stop: bool = True) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and //| then transmit a stop bit. //| @@ -235,7 +235,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in //| as if ``buffer[start:end]``. This will not cause an allocation like //| ``buffer[start:end]`` will so it saves memory. //| -//| riting a buffer or slice of length zero is permitted, as it can be used +//| Writing a buffer or slice of length zero is permitted, as it can be used //| to poll for the existence of a device. //| //| :param int address: 7-bit device address @@ -281,12 +281,12 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); -//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None: +//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. //| -//| f ``start`` or ``end`` is provided, then the corresponding buffer will be sliced +//| if ``start`` or ``end`` is provided, then the corresponding buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` //| will so it saves memory. //| diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 173f8aa6df..93dc64d50b 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -53,7 +53,7 @@ //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines //| and therefore the hardware.)""" //| -//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None: +//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None: //| //| """Construct an SPI object on the given pins. //| @@ -153,7 +153,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) { //| or second (1). Rising or falling depends on clock polarity. //| :param int bits: the number of bits per word //| -//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that +//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that //| speed is not guaranteed to work. 12 MHz is the next available lower speed, and is //| within spec for the SAMD21. //| @@ -270,7 +270,7 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write); -//| def readinto(self, buffer: bytearray, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None: +//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None: //| """Read into ``buffer`` while writing ``write_value`` for each byte read. //| The SPI object must be locked. //| If the number of bytes to read is 0, nothing happens. @@ -377,7 +377,7 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args } MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_readinto); -//| frequency: int = ... +//| frequency: int //| """The actual SPI bus frequency. This may not match the frequency requested //| due to internal limitations.""" //| diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index c4e1f51348..bf0b7e721d 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -44,7 +44,7 @@ //| class UART: //| """A bidirectional serial protocol""" -//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None: +//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Optional[Parity] = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None: //| """A common bidirectional serial protocol that uses an an agreed upon speed //| rather than a shared clock line. //| @@ -263,7 +263,7 @@ STATIC mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t return ret; } -//| baudrate: int = ... +//| baudrate: int //| """The current baudrate.""" //| STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) { @@ -289,7 +289,7 @@ const mp_obj_property_t busio_uart_baudrate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| in_waiting: int = ... +//| in_waiting: int //| """The number of bytes in the input buffer, available to be read""" //| STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) { @@ -306,7 +306,7 @@ const mp_obj_property_t busio_uart_in_waiting_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| timeout: float = ... +//| timeout: float //| """The current timeout, in seconds (float).""" //| STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) { @@ -349,10 +349,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_o //| class Parity: //| """Enum-like class to define the parity used to verify correct data transfer.""" //| -//| ODD: int = ... +//| ODD: int //| """Total number of ones should be odd.""" //| -//| EVEN: int = ... +//| EVEN: int //| """Total number of ones should be even.""" //| const mp_obj_type_t busio_uart_parity_type; diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index 616307a4bc..e51db26440 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -86,7 +86,7 @@ STATIC mp_obj_t countio_counter_obj___exit__(size_t n_args, const mp_obj_t *args STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(countio_counter___exit___obj, 4, 4, countio_counter_obj___exit__); -//| count: int = ... +//| count: int //| """The current count in terms of pulses.""" //| STATIC mp_obj_t countio_counter_obj_get_count(mp_obj_t self_in) { diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index e37f57220c..351e122e0a 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -106,7 +106,7 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { } } -//| def switch_to_output(self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL) -> None: +//| def switch_to_output(self, value: bool = False, drive_mode: DriveMode = DriveMode.PUSH_PULL) -> None: //| """Set the drive mode and value and then switch to writing out digital //| values. //| @@ -139,7 +139,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_ } MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_output_obj, 1, digitalio_digitalinout_switch_to_output); -//| def switch_to_input(self, pull: Pull = None) -> None: +//| def switch_to_input(self, pull: Optional[Pull] = None) -> None: //| """Set the pull and then switch to read in digital values. //| //| :param Pull pull: pull configuration for the input @@ -179,7 +179,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_o } MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_input_obj, 1, digitalio_digitalinout_switch_to_input); -//| direction: Direction = ... +//| direction: Direction //| """The direction of the pin. //| //| Setting this will use the defaults from the corresponding @@ -228,7 +228,7 @@ const mp_obj_property_t digitalio_digitalio_direction_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| value: bool = ... +//| value: bool //| """The digital logic level of the pin.""" //| STATIC mp_obj_t digitalio_digitalinout_obj_get_value(mp_obj_t self_in) { @@ -258,7 +258,7 @@ const mp_obj_property_t digitalio_digitalinout_value_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| drive_mode: DriveMode = ... +//| drive_mode: DriveMode //| """The pin drive mode. One of: //| //| - `digitalio.DriveMode.PUSH_PULL` @@ -302,7 +302,7 @@ const mp_obj_property_t digitalio_digitalio_drive_mode_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| pull: Optional[Pull] = ... +//| pull: Optional[Pull] //| """The pin pull direction. One of: //| //| - `digitalio.Pull.UP` diff --git a/shared-bindings/digitalio/Direction.c b/shared-bindings/digitalio/Direction.c index 173ebfb2b4..0c2448ca9a 100644 --- a/shared-bindings/digitalio/Direction.c +++ b/shared-bindings/digitalio/Direction.c @@ -46,10 +46,10 @@ //| going.""" //| ... //| -//| INPUT: Direction = ... +//| INPUT: Direction //| """Read digital data in""" //| -//| OUTPUT: Direction = ... +//| OUTPUT: Direction //| """Write digital data out""" //| const mp_obj_type_t digitalio_direction_type; diff --git a/shared-bindings/digitalio/DriveMode.c b/shared-bindings/digitalio/DriveMode.c index 2f22029b0b..39b940d7f9 100644 --- a/shared-bindings/digitalio/DriveMode.c +++ b/shared-bindings/digitalio/DriveMode.c @@ -34,10 +34,10 @@ //| digital values.""" //| ... //| -//| PUSH_PULL: DriveMode = ... +//| PUSH_PULL: DriveMode //| """Output both high and low digital values""" //| -//| OPEN_DRAIN: DriveMode = ... +//| OPEN_DRAIN: DriveMode //| """Output low digital values but go into high z for digital high. This is //| useful for i2c and other protocols that share a digital line.""" //| diff --git a/shared-bindings/digitalio/Pull.c b/shared-bindings/digitalio/Pull.c index 87e2a8f1ee..ed08b0f6bc 100644 --- a/shared-bindings/digitalio/Pull.c +++ b/shared-bindings/digitalio/Pull.c @@ -34,11 +34,11 @@ //| digital values in.""" //| ... //| -//| UP: Pull = ... +//| UP: Pull //| """When the input line isn't being driven the pull up can pull the state //| of the line high so it reads as true.""" //| -//| DOWN: Pull = ... +//| DOWN: Pull //| """When the input line isn't being driven the pull down can pull the //| state of the line low so it reads as false.""" //| diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index b2cda21536..65d80fba62 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -73,7 +73,7 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| width: int = ... +//| width: int //| """Width of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_bitmap_obj_get_width(mp_obj_t self_in) { @@ -91,7 +91,7 @@ const mp_obj_property_t displayio_bitmap_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: int = ... +//| height: int //| """Height of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 17eed1a9b1..a2b6699efc 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -84,7 +84,7 @@ STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t } MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert); -//| dither: bool = ... +//| dither: bool //| """When true the color converter dithers the output by adding random noise when //| truncating to display bitdepth""" //| diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 2d2b92325c..70e29ff3e0 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -39,6 +39,11 @@ #include "shared-module/displayio/__init__.h" #include "supervisor/shared/translate.h" +//| _DisplayBus = Union[FourWire, ParallelBus, I2CDisplay] +//| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`""" +//| + +//| //| class Display: //| """Manage updating a display over a display bus //| @@ -49,8 +54,8 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum.""" //| -//| def __init__(self, display_bus: Union[FourWire, ParallelBus], init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None: -//| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). +//| def __init__(self, display_bus: _DisplayBus, init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: Optional[int] = None, brightness: float = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None: +//| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a //| command byte followed by a byte to determine the parameter count and if a delay is need after. @@ -76,7 +81,7 @@ //| of the display to minimize tearing artifacts. //| //| :param display_bus: The bus that the display is connected to -//| :type display_bus: displayio.FourWire or displayio.ParallelBus +//| :type display_bus: FourWire, ParallelBus or I2CDisplay //| :param buffer init_sequence: Byte-packed initialization sequence. //| :param int width: Width in pixels //| :param int height: Height in pixels @@ -96,7 +101,7 @@ //| :param int set_vertical_scroll: Command used to set the first row to show //| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight //| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers. -//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True. +//| :param float brightness: Initial display brightness. This value is ignored if auto_brightness is True. //| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism. //| :param bool single_byte_bounds: Display column and row commands use single bytes //| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this. @@ -245,7 +250,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos } MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh); -//| auto_refresh: None = ... +//| auto_refresh: bool //| """True when the display is refreshed automatically.""" //| STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) { @@ -270,7 +275,7 @@ const mp_obj_property_t displayio_display_auto_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| brightness: float = ... +//| brightness: float //| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When //| `auto_brightness` is True, the value of `brightness` will change automatically. //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" @@ -307,7 +312,7 @@ const mp_obj_property_t displayio_display_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_brightness: Optional[bool] = ... +//| auto_brightness: bool //| """True when the display brightness is adjusted automatically, based on an ambient //| light sensor or other method. Note that some displays may have this set to True by default, //| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False @@ -338,7 +343,7 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = { -//| width: int = ... +//| width: int //| Gets the width of the board //| STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) { @@ -354,7 +359,7 @@ const mp_obj_property_t displayio_display_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: int = ... +//| height: int //| """Gets the height of the board""" //| STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) { @@ -370,7 +375,7 @@ const mp_obj_property_t displayio_display_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rotation: int = ... +//| rotation: int //| """The rotation of the display as an int in degrees.""" //| STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) { @@ -393,7 +398,7 @@ const mp_obj_property_t displayio_display_rotation_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bus: Union[ParallelBus, FourWire, I2CDisplay] = ... +//| bus: _DisplayBus //| """The bus being used by the display""" //| //| @@ -411,7 +416,7 @@ const mp_obj_property_t displayio_display_bus_obj = { }; -//| def fill_row(self, y: int, buffer: WriteableBuffer) -> bytearray: +//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer: //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 9bfc6b05d2..ee1586fe67 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: displayio, start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None: +//| def __init__(self, display_bus: _DisplayBus, start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None: //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every @@ -205,7 +205,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh); -//| time_to_refresh: float = ... +//| time_to_refresh: float //| """Time, in fractional seconds, until the ePaper display can be refreshed.""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) { @@ -221,7 +221,7 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| width: int = ... +//| width: int //| """Gets the width of the display in pixels""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) { @@ -237,7 +237,7 @@ const mp_obj_property_t displayio_epaperdisplay_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: int = ... +//| height: int //| """Gets the height of the display in pixels""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) { @@ -253,7 +253,7 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bus: displayio = ... +//| bus: _DisplayBus //| """The bus being used by the display""" //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 83d260c0f6..455d22e725 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -42,7 +42,7 @@ //| """Manage updating a display over SPI four wire protocol in the background while Python code runs. //| It doesn't handle display initialization.""" //| -//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None: +//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: Optional[microcontroller.Pin] = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None: //| """Create a FourWire object associated with the given pins. //| //| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 31affc6b6a..31d4f5b91a 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -86,7 +86,7 @@ displayio_group_t* native_group(mp_obj_t group_obj) { return MP_OBJ_TO_PTR(native_group); } -//| hidden: bool = ... +//| hidden: bool //| """True when the Group and all of it's layers are not visible. When False, the Group's layers //| are visible if they haven't been hidden.""" //| @@ -111,7 +111,7 @@ const mp_obj_property_t displayio_group_hidden_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| scale: int = ... +//| scale: int //| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel //| will be represented by 2x2 pixels.""" //| @@ -140,7 +140,7 @@ const mp_obj_property_t displayio_group_scale_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| x: int = ... +//| x: int //| """X position of the Group in the parent.""" //| STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) { @@ -165,7 +165,7 @@ const mp_obj_property_t displayio_group_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| y: int = ... +//| y: int //| """Y position of the Group in the parent.""" //| STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index c8b6702a15..5dc4711b3b 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -42,7 +42,7 @@ //| """Manage updating a display over I2C in the background while Python code runs. //| It doesn't handle display initialization.""" //| -//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None) -> None: +//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: Optional[microcontroller.Pin] = None) -> None: //| """Create a I2CDisplay object associated with the given I2C bus and reset pin. //| //| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index 8a4cb8e743..938e408ab5 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -89,7 +89,7 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_ return MP_OBJ_FROM_PTR(self); } -//| width: int = ... +//| width: int //| """Width of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_ondiskbitmap_obj_get_width(mp_obj_t self_in) { @@ -108,7 +108,7 @@ const mp_obj_property_t displayio_ondiskbitmap_width_obj = { }; -//| height: int = ... +//| height: int //| """Height of the bitmap. (read only)""" //| STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index e03a46dbaf..73a08f5567 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -48,15 +48,15 @@ //| //| A single tile grid is also known as a Sprite.""" //| -//| def __init__(self, bitmap: Bitmap, *, pixel_shader: Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None: +//| def __init__(self, bitmap: Bitmap, *, pixel_shader: Union[ColorConverter, Palette], width: int = 1, height: int = 1, tile_width: Optional[int] = None, tile_height: Optional[int] = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None: //| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to //| convert the value and its location to a display native pixel color. This may be a simple color //| palette lookup, a gradient, a pattern or a color transformer. //| //| tile_width and tile_height match the height of the bitmap by default. //| -//| :param displayio.Bitmap bitmap: The bitmap storing one or more tiles. -//| :param displayio.Palette pixel_shader: The pixel shader that produces colors from values +//| :param Bitmap bitmap: The bitmap storing one or more tiles. +//| :param ColorConverter or Palette pixel_shader: The pixel shader that produces colors from values //| :param int width: Width of the grid in tiles. //| :param int height: Height of the grid in tiles. //| :param int tile_width: Width of a single tile in pixels. Defaults to the full Bitmap and must evenly divide into the Bitmap's dimensions. @@ -141,7 +141,7 @@ static displayio_tilegrid_t* native_tilegrid(mp_obj_t tilegrid_obj) { mp_obj_assert_native_inited(native_tilegrid); return MP_OBJ_TO_PTR(native_tilegrid); } -//| hidden: bool = ... +//| hidden: bool //| """True when the TileGrid is hidden. This may be False even when a part of a hidden Group.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_hidden(mp_obj_t self_in) { @@ -165,7 +165,7 @@ const mp_obj_property_t displayio_tilegrid_hidden_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| x: int = ... +//| x: int //| """X position of the left edge in the parent.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) { @@ -190,7 +190,7 @@ const mp_obj_property_t displayio_tilegrid_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| y: int = ... +//| y: int //| """Y position of the top edge in the parent.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) { @@ -215,7 +215,7 @@ const mp_obj_property_t displayio_tilegrid_y_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| flip_x: bool = ... +//| flip_x: bool //| """If true, the left edge rendered will be the right edge of the right-most tile.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_x(mp_obj_t self_in) { @@ -239,7 +239,7 @@ const mp_obj_property_t displayio_tilegrid_flip_x_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| flip_y: bool = ... +//| flip_y: bool //| """If true, the top edge rendered will be the bottom edge of the bottom-most tile.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_y(mp_obj_t self_in) { @@ -264,7 +264,7 @@ const mp_obj_property_t displayio_tilegrid_flip_y_obj = { }; -//| transpose_xy: bool = ... +//| transpose_xy: bool //| """If true, the TileGrid's axis will be swapped. When combined with mirroring, any 90 degree //| rotation can be achieved along with the corresponding mirrored version.""" //| @@ -289,7 +289,7 @@ const mp_obj_property_t displayio_tilegrid_transpose_xy_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| pixel_shader: Union[ColorConverter, Palette] = ... +//| pixel_shader: Union[ColorConverter, Palette] //| """The pixel shader of the tilegrid.""" //| STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) { @@ -326,7 +326,7 @@ const mp_obj_property_t displayio_tilegrid_pixel_shader_obj = { //| print(grid[0])""" //| ... //| -//| def __setitem__(self, index: Union[Tuple[int, int], int], tile_index: int) -> None: +//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None: //| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. //| diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 5eaae624ea..8ae2356bbf 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -46,7 +46,7 @@ //| ... //| -//| bitmap: displayio.Bitmap = ... +//| bitmap: displayio.Bitmap //| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use //| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and //| `terminalio.Terminal`.""" diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 8c19603422..e29718fdf3 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -151,7 +151,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, cons } MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh); -//| auto_refresh: bool = ... +//| auto_refresh: bool //| """True when the display is refreshed automatically.""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) { @@ -176,7 +176,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| brightness: float = ... +//| brightness: float //| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When //| `auto_brightness` is True, the value of `brightness` will change automatically. //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" @@ -213,7 +213,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| auto_brightness: bool = ... +//| auto_brightness: bool //| """True when the display brightness is adjusted automatically, based on an ambient //| light sensor or other method. Note that some displays may have this set to True by default, //| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False @@ -244,7 +244,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| width: int = ... +//| width: int //| """Gets the width of the framebuffer""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) { @@ -260,7 +260,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: int = ... +//| height: int //| """Gets the height of the framebuffer""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) { @@ -276,7 +276,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| rotation: int = ... +//| rotation: int //| """The rotation of the display as an int in degrees.""" //| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) { @@ -299,7 +299,7 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| framebuffer: rgbmatrix.RGBMatrix = ... +//| framebuffer: rgbmatrix.RGBMatrix //| """The framebuffer being used by the display""" //| //| diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 5f99b166c7..8b0e2b41c9 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -169,7 +169,7 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequencyin_obj_clear); -//| capture_period: int = ... +//| capture_period: int //| """The capture measurement period. Lower incoming frequencies will be measured //| more accurately with longer capture periods. Higher frequencies are more //| accurate with shorter capture periods. diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 72aa71b8d3..087c353953 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -31,10 +31,10 @@ //| print("Longitude: {0:.6f} degrees".format(nav.longitude))""" //| -//| def __init__(self) -> None: +//| def __init__(self, system: Union[SatelliteSystem, List[SatelliteSystem]]) -> None: //| """Turn on the GNSS. //| -//| :param gnss.SatelliteSystem system: satellite system to use""" +//| :param system: satellite system to use""" //| ... //| STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -98,7 +98,7 @@ STATIC mp_obj_t gnss_obj_update(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(gnss_update_obj, gnss_obj_update); -//| latitude: float = ... +//| latitude: float //| """Latitude of current position in degrees (float).""" //| STATIC mp_obj_t gnss_obj_get_latitude(mp_obj_t self_in) { @@ -115,7 +115,7 @@ const mp_obj_property_t gnss_latitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| longitude: float = ... +//| longitude: float //| """Longitude of current position in degrees (float).""" //| STATIC mp_obj_t gnss_obj_get_longitude(mp_obj_t self_in) { @@ -132,7 +132,7 @@ const mp_obj_property_t gnss_longitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| altitude: float = ... +//| altitude: float //| """Altitude of current position in meters (float).""" //| STATIC mp_obj_t gnss_obj_get_altitude(mp_obj_t self_in) { @@ -149,7 +149,7 @@ const mp_obj_property_t gnss_altitude_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| timestamp: time.struct_time = ... +//| timestamp: time.struct_time //| """Time when the position data was updated.""" //| STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) { @@ -168,7 +168,7 @@ const mp_obj_property_t gnss_timestamp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| fix: PositionFix = ... +//| fix: PositionFix //| """Fix mode.""" //| STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) { diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index 7a69dfece8..e60611d705 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -10,13 +10,13 @@ //| def __init__(self) -> None: //| """Enum-like class to define the position fix mode.""" //| -//| INVALID: PositionFix = ... +//| INVALID: PositionFix //| """No measurement.""" //| -//| FIX_2D: PositionFix = ... +//| FIX_2D: PositionFix //| """2D fix.""" //| -//| FIX_3D: PositionFix = ... +//| FIX_3D: PositionFix //| """3D fix.""" //| const mp_obj_type_t gnss_positionfix_type; diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c index b528ca9c39..cfebd472ee 100644 --- a/shared-bindings/i2cperipheral/I2CPeripheral.c +++ b/shared-bindings/i2cperipheral/I2CPeripheral.c @@ -259,7 +259,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_obj___exit__(size_t n_args, } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral_request___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_request_obj___exit__); -//| address: int = ... +//| address: int //| """The I2C address of the request.""" //| STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_address(mp_obj_t self_in) { @@ -269,7 +269,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_address(mp_obj_t self_i } MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_address_obj, i2cperipheral_i2c_peripheral_request_get_address); -//| is_read: bool = ... +//| is_read: bool //| """The I2C main controller is reading from this peripheral.""" //| STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_read(mp_obj_t self_in) { @@ -279,7 +279,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_read(mp_obj_t self_i } MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_is_read_obj, i2cperipheral_i2c_peripheral_request_get_is_read); -//| is_restart: bool = ... +//| is_restart: bool //| """Is Repeated Start Condition.""" //| STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_restart(mp_obj_t self_in) { @@ -349,7 +349,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_read(size_t n_args, const m } MP_DEFINE_CONST_FUN_OBJ_KW(i2cperipheral_i2c_peripheral_request_read_obj, 1, i2cperipheral_i2c_peripheral_request_read); -//| def write(self, buffer: bytearray) -> int: +//| def write(self, buffer: ReadableBuffer) -> int: //| """Write the data contained in buffer. //| //| :param buffer: Write out the data in this buffer diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index a7d14e4f55..b35bae3602 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -95,7 +95,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const m } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit___obj, 4, 4, memorymonitor_allocationsize_obj___exit__); -//| bytes_per_block: int = ... +//| bytes_per_block: int //| """Number of bytes per block""" //| STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) { diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index 931c0b4c45..1294b78f00 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -39,7 +39,7 @@ //| def __init__(self) -> None: //| """Identifies an IO pin on the microcontroller. They are fixed by the //| hardware so they cannot be constructed on demand. Instead, use -//| `board` or `microcontroller.pin` to reference the desired pin.""" +//| :mod:`board` or :mod:`microcontroller.pin` to reference the desired pin.""" //| ... //| diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index d9f780f846..8c703891d7 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -50,7 +50,7 @@ //| ... //| -//| frequency: int = ... +//| frequency: int //| """The CPU operating frequency in Hertz. (read-only)""" //| STATIC mp_obj_t mcu_processor_get_frequency(mp_obj_t self) { @@ -67,7 +67,7 @@ const mp_obj_property_t mcu_processor_frequency_obj = { }, }; -//| temperature: Optional[float] = ... +//| temperature: Optional[float] //| """The on-chip temperature, in Celsius, as a float. (read-only) //| //| Is `None` if the temperature is not available.""" @@ -87,7 +87,7 @@ const mp_obj_property_t mcu_processor_temperature_obj = { }, }; -//| uid: bytearray = ... +//| uid: bytearray //| """The unique id (aka serial number) of the chip as a `bytearray`. (read-only)""" //| STATIC mp_obj_t mcu_processor_get_uid(mp_obj_t self) { @@ -106,7 +106,7 @@ const mp_obj_property_t mcu_processor_uid_obj = { }, }; -//| voltage: Optional[float] = ... +//| voltage: Optional[float] //| """The input voltage to the microcontroller, as a float. (read-only) //| //| Is `None` if the voltage is not available.""" diff --git a/shared-bindings/microcontroller/RunMode.c b/shared-bindings/microcontroller/RunMode.c index 38bbb612b0..a54f40cac8 100644 --- a/shared-bindings/microcontroller/RunMode.c +++ b/shared-bindings/microcontroller/RunMode.c @@ -33,18 +33,18 @@ //| """Enum-like class to define the run mode of the microcontroller and //| CircuitPython.""" //| -//| NORMAL: RunMode = ... +//| NORMAL: RunMode //| """Run CircuitPython as normal. //| //| :type microcontroller.RunMode:""" //| -//| SAFE_MODE: RunMode = ... +//| SAFE_MODE: RunMode //| """Run CircuitPython in safe mode. User code will not be run and the //| file system will be writeable over USB. //| //| :type microcontroller.RunMode:""" //| -//| BOOTLOADER: RunMode = ... +//| BOOTLOADER: RunMode //| """Run the bootloader. //| //| :type microcontroller.RunMode:""" diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index a750823400..c00b1e314d 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -48,7 +48,7 @@ //| microcontroller. See `board` for board-specific pin mappings.""" //| -//| cpu: Processor = ... +//| cpu: Processor //| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency`` //| (clock frequency). //| This object is the sole instance of `microcontroller.Processor`.""" @@ -133,13 +133,19 @@ STATIC mp_obj_t mcu_reset(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); -//| nvm: Optional[nvm.ByteArray] = ... +//| nvm: Optional[nvm.ByteArray] //| """Available non-volatile memory. //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. //| //| :type: nvm.ByteArray or None""" //| +//| watchdog: Optional[watchdog.WatchDogTimer] +//| """Available watchdog timer. +//| This object is the sole instance of `watchdog.WatchDogTimer` when available or ``None`` otherwise.""" +//| + + //| """:mod:`microcontroller.pin` --- Microcontroller pin names //| -------------------------------------------------------- //| diff --git a/shared-bindings/multiterminal/__init__.c b/shared-bindings/multiterminal/__init__.c index 0f493fe2ea..1fbeca79cc 100644 --- a/shared-bindings/multiterminal/__init__.c +++ b/shared-bindings/multiterminal/__init__.c @@ -46,7 +46,7 @@ STATIC mp_obj_t multiterminal_obj_get_secondary_terminal() { } MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal); -//| def set_secondary_terminal(stream: Optional[typing.BinaryIO]) -> None: +//| def set_secondary_terminal(stream: typing.BinaryIO) -> None: //| """Read additional input from the given stream and write out back to it. //| This doesn't replace the core stream (usually UART or native USB) but is //| mixed in instead. diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index f3f5c20373..8eb426c2b7 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -50,7 +50,7 @@ //| pixel_off = bytearray([0, 0, 0]) //| neopixel_write.neopixel_write(pin, pixel_off)""" //| -//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: bytearray) -> None: +//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: ReadableBuffer) -> None: //| """Write buf out on the given DigitalInOut. //| //| :param digitalinout: the DigitalInOut to output with diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 9fad6e83df..2406dbc371 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -149,7 +149,7 @@ mp_obj_t os_stat(mp_obj_t path_in) { } MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); -//| def statvfs(path: str) -> Tuple[str, str, str, str, str, str, str, str, str, str]: +//| def statvfs(path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]: //| """Get the status of a fileystem. //| //| Returns a tuple with the filesystem information in the following order: diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c index 07b47c133d..e9b6c45d20 100644 --- a/shared-bindings/pulseio/PWMOut.c +++ b/shared-bindings/pulseio/PWMOut.c @@ -150,7 +150,7 @@ STATIC mp_obj_t pulseio_pwmout_obj___exit__(size_t n_args, const mp_obj_t *args) } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pulseio_pwmout_obj___exit__); -//| duty_cycle: int = ... +//| duty_cycle: int //| """16 bit value that dictates how much of one cycle is high (1) versus low //| (0). 0xffff will always be high, 0 will always be low and 0x7fff will //| be half high and then half low. @@ -186,7 +186,7 @@ const mp_obj_property_t pulseio_pwmout_duty_cycle_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| frequency: int = ... +//| frequency: int //| """32 bit value that dictates the PWM frequency in Hertz (cycles per //| second). Only writeable when constructed with ``variable_frequency=True``. //| diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 4bcff06ee2..3e44a14791 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -196,7 +196,7 @@ STATIC mp_obj_t pulseio_pulsein_obj_popleft(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_popleft_obj, pulseio_pulsein_obj_popleft); -//| maxlen: int = ... +//| maxlen: int //| """The maximum length of the PulseIn. When len() is equal to maxlen, //| it is unclear which pulses are active and which are idle.""" //| @@ -215,7 +215,7 @@ const mp_obj_property_t pulseio_pulsein_maxlen_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| paused: bool = ... +//| paused: bool //| """True when pulse capture is paused as a result of :py:func:`pause` or an error during capture //| such as a signal that is too fast.""" //| diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index ca1369d932..3d35f05445 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -110,7 +110,7 @@ STATIC mp_obj_t pulseio_pulseout_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulseout___exit___obj, 4, 4, pulseio_pulseout_obj___exit__); -//| def send(self, pulses: array.array) -> None: +//| def send(self, pulses: ReadableBuffer) -> None: //| """Pulse alternating on and off durations in microseconds starting with on. //| ``pulses`` must be an `array.array` with data type 'H' for unsigned //| halfword (two bytes). diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index fcf597bcbc..b2dd80682b 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -257,7 +257,7 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) { } } -//| brightness: float = ... +//| brightness: float //| """In the current implementation, 0.0 turns the display off entirely //| and any other value up to 1.0 turns the display on fully.""" //| @@ -301,7 +301,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(rgbmatrix_rgbmatrix_refresh_obj, rgbmatrix_rgbmatrix_refresh); -//| width: int = ... +//| width: int //| """The width of the display, in pixels""" //| STATIC mp_obj_t rgbmatrix_rgbmatrix_get_width(mp_obj_t self_in) { @@ -317,7 +317,7 @@ const mp_obj_property_t rgbmatrix_rgbmatrix_width_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| height: int = ... +//| height: int //| """The height of the display, in pixels""" //| STATIC mp_obj_t rgbmatrix_rgbmatrix_get_height(mp_obj_t self_in) { diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 37c4ee324e..8b0badbe82 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -116,7 +116,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_obj___exit__(size_t n_args, const mp STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rotaryio_incrementalencoder___exit___obj, 4, 4, rotaryio_incrementalencoder_obj___exit__); -//| position: int = ... +//| position: int //| """The current position in terms of pulses. The number of pulses per rotation is defined by the //| specific hardware.""" //| diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index 5af1f4267a..4a792484d6 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -53,7 +53,7 @@ STATIC mp_obj_t rtc_rtc_make_new(const mp_obj_type_t *type, size_t n_args, const return (mp_obj_t)&rtc_rtc_obj; } -//| datetime: time.struct_time = ... +//| datetime: time.struct_time //| """The current date and time of the RTC as a `time.struct_time`. //| //| This must be set to the current date and time whenever the board loses power:: @@ -94,7 +94,7 @@ const mp_obj_property_t rtc_rtc_datetime_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| calibration: int = ... +//| calibration: int //| """The RTC calibration value as an `int`. //| //| A positive value speeds up the clock and a negative value slows it down. diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 75db6b1817..a0582d1435 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -120,7 +120,7 @@ mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); -//| def readblocks(self, start_block: int, buf: bytearray) -> None: +//| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: //| //| """Read one or more blocks from the card //| @@ -144,7 +144,7 @@ mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, m MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readblocks); -//| def writeblocks(self, start_block: int, buf: bytearray) -> None: +//| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: //| //| """Write one or more blocks to the card //| diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 215f914fac..594fa71fff 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -160,7 +160,7 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); -//| def readblocks(self, start_block: int, buf: bytearray) -> None: +//| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: //| //| """Read one or more blocks from the card //| @@ -182,7 +182,7 @@ mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); -//| def writeblocks(self, start_block: int, buf: bytearray) -> None: +//| def writeblocks(self, start_block: int, buf: WriteableBuffer) -> None: //| //| """Write one or more blocks to the card //| @@ -194,7 +194,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; - mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); sdioio_sdcard_obj_t *self = (sdioio_sdcard_obj_t*)self_in; int result = common_hal_sdioio_sdcard_writeblocks(self, start_block, &bufinfo); if (result < 0) { diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index dbadb19558..53ac57d11a 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -212,7 +212,7 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect); -//| def send(self, bytes: bytes) -> int: +//| def send(self, bytes: ReadableBuffer) -> int: //| """Send some bytes to the connected remote address. //| Suits sockets of type SOCK_STREAM //| @@ -312,7 +312,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv); -//| def sendto(self, bytes: bytes, address: tuple) -> int: +//| def sendto(self, bytes: ReadableBuffer, address: tuple) -> int: //| """Send some bytes to a specific address. //| Suits sockets of type SOCK_DGRAM //| diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 689c299ef8..84d8370dd5 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -45,7 +45,7 @@ //| ... //| -//| serial_connected: bool = ... +//| serial_connected: bool //| """Returns the USB serial communication status (read-only). //| //| .. note:: @@ -73,7 +73,7 @@ const mp_obj_property_t supervisor_serial_connected_obj = { }; -//| serial_bytes_available: int = ... +//| 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)""" diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 1830308b7d..b59394bbcd 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -39,7 +39,7 @@ //| """Supervisor settings""" //| -//| runtime: Runtime = ... +//| runtime: Runtime //| """Runtime information, such as ``runtime.serial_connected`` //| (USB serial connection status). //| This object is the sole instance of `supervisor.Runtime`.""" diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c index 623b99e096..3d53e3cce7 100644 --- a/shared-bindings/terminalio/Terminal.c +++ b/shared-bindings/terminalio/Terminal.c @@ -40,7 +40,7 @@ //| class Terminal: //| """Display a character stream with a TileGrid""" //| -//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont) -> None: +//| def __init__(self, tilegrid: displayio.TileGrid, font: fontio.BuiltinFont) -> None: //| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be //| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap.""" //| ... diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index e05490ced5..ff723ccc74 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -108,7 +108,7 @@ STATIC mp_obj_t touchio_touchin_obj___exit__(size_t n_args, const mp_obj_t *args } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(touchio_touchin___exit___obj, 4, 4, touchio_touchin_obj___exit__); -//| value: bool = ... +//| value: bool //| """Whether the touch pad is being touched or not. (read-only) //| //| True when `raw_value` > `threshold`.""" @@ -128,7 +128,7 @@ const mp_obj_property_t touchio_touchin_value_obj = { }; -//| raw_value: int = ... +//| raw_value: int //| """The raw touch measurement as an `int`. (read-only)""" //| STATIC mp_obj_t touchio_touchin_obj_get_raw_value(mp_obj_t self_in) { @@ -147,7 +147,7 @@ const mp_obj_property_t touchio_touchin_raw_value_obj = { }; -//| threshold: Optional[int] = ... +//| threshold: Optional[int] //| """Minimum `raw_value` needed to detect a touch (and for `value` to be `True`). //| //| When the **TouchIn** object is created, an initial `raw_value` is read from the pin, diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index d071716efa..83c0df4ae4 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -58,7 +58,7 @@ STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) { } MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report); -//| usage_page: int = ... +//| usage_page: int //| """The usage page of the device as an `int`. Can be thought of a category. (read-only)""" //| STATIC mp_obj_t usb_hid_device_obj_get_usage_page(mp_obj_t self_in) { @@ -74,7 +74,7 @@ const mp_obj_property_t usb_hid_device_usage_page_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| usage: int = ... +//| usage: int //| """The functionality of the device as an int. (read-only) //| //| For example, Keyboard is 0x06 within the generic desktop usage page 0x01. diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index 5b26a94c43..c621c8c502 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -48,7 +48,7 @@ // These are standard stream methods. Code is in py/stream.c. // -//| def read(self, nbytes: int = None) -> Optional[bytes]: +//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]: //| """Read characters. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 7b010591d2..8f0d58d873 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -37,7 +37,7 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg } -//| radius : int = ... +//| radius : int //| """The radius of the circle in pixels.""" //| STATIC mp_obj_t vectorio_circle_obj_get_radius(mp_obj_t self_in) { diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index c46e49d3e8..6a72f91246 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -42,7 +42,7 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar } -//| points: List[Tuple[int, int]] = ... +//| points: List[Tuple[int, int]] //| """Set a new look and shape for this polygon""" //| STATIC mp_obj_t vectorio_polygon_obj_get_points(mp_obj_t self_in) { diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index 43571094ff..957e9dc089 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -93,7 +93,7 @@ STATIC mp_obj_t vectorio_vector_shape_make_new(const mp_obj_type_t *type, size_t } -//| x: int = ... +//| x: int //| """X position of the center point of the shape in the parent.""" //| STATIC mp_obj_t vectorio_vector_shape_obj_get_x(mp_obj_t self_in) { @@ -119,7 +119,7 @@ const mp_obj_property_t vectorio_vector_shape_x_obj = { }; -//| y: int = ... +//| y: int //| """Y position of the center point of the shape in the parent.""" //| STATIC mp_obj_t vectorio_vector_shape_obj_get_y(mp_obj_t self_in) { @@ -145,7 +145,7 @@ const mp_obj_property_t vectorio_vector_shape_y_obj = { }; -//| pixel_shader: displayio.Palette = ... +//| pixel_shader: displayio.Palette //| """The pixel shader of the shape.""" //| STATIC mp_obj_t vectorio_vector_shape_obj_get_pixel_shader(mp_obj_t self_in) { diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index 25476039ab..71512bdf8d 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -32,12 +32,12 @@ //| def __init__(self) -> None: //| """Enum-like class to define the run mode of the watchdog timer.""" //| -//| RAISE: WatchDogMode = ... +//| RAISE: WatchDogMode //| """Raise an exception when the WatchDogTimer expires. //| //| :type WatchDogMode:""" //| -//| RESET: WatchDogMode = ... +//| RESET: WatchDogMode //| """Reset the system if the WatchDogTimer expires. //| //| :type WatchDogMode:""" diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index fe53b864b7..09219f7109 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -89,7 +89,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_deinit_obj, watchdog_watchdogtimer_deinit); -//| timeout: float = ... +//| timeout: float //| """The maximum number of seconds that can elapse between calls //| to feed()""" //| @@ -119,7 +119,7 @@ const mp_obj_property_t watchdog_watchdogtimer_timeout_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| mode: WatchDogMode = ... +//| mode: WatchDogMode //| """The current operating mode of the WatchDogTimer `watchdog.WatchDogMode`. //| //| Setting a WatchDogMode activates the WatchDog:: diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index 5254681782..4e5744d827 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -84,7 +84,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, cons return ret; } -//| connected: bool = ... +//| connected: bool //| """(boolean, readonly) is this device physically connected?""" //| @@ -101,7 +101,7 @@ const mp_obj_property_t wiznet5k_connected_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| dhcp: bool = ... +//| dhcp: bool //| """(boolean, readwrite) is DHCP active on this device? //| //| * set to True to activate DHCP, False to turn it off""" @@ -134,7 +134,7 @@ const mp_obj_property_t wiznet5k_dhcp_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def ifconfig(self, params: tuple = None) -> Optional[tuple]: +//| def ifconfig(self, params: Optional[Tuple] = None) -> Optional[Tuple]: //| """Called without parameters, returns a tuple of //| (ip_address, subnet_mask, gateway_address, dns_server) //|