From 1a0b4193b7539899a41952769e7b566be7580d6a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 16 Apr 2021 16:18:01 -0700 Subject: [PATCH 01/40] Simplify the status LED to save power This also removes the need to pin share because we don't use the status LED while user code is running. The status flashes fallback to the HW_STATUS LED if no RGB LED is present. Each status has a unique blink pattern as well. One caveat is the REPL state. In order to not pin share, we set the RGB color once. PWM and single color will be shutoff immediately but DotStars and NeoPixels will hold the color until the user overrides it. Fixes #4133 --- main.c | 180 +++++-- .../boards/picoplanet/mpconfigboard.h | 9 +- ports/atmel-samd/common-hal/busio/SPI.c | 20 +- .../common-hal/microcontroller/Pin.c | 69 --- .../common-hal/microcontroller/Pin.h | 8 - ports/atmel-samd/supervisor/internal_flash.c | 19 - ports/esp32s2/common-hal/busio/SPI.c | 1 - .../esp32s2/common-hal/microcontroller/Pin.c | 31 -- .../esp32s2/common-hal/microcontroller/Pin.h | 7 - .../common-hal/microcontroller/Pin.c | 64 --- .../common-hal/microcontroller/Pin.h | 8 - .../feather_nrf52840_express/mpconfigboard.h | 2 +- .../makerdiary_m60_keyboard/mpconfigboard.h | 6 +- .../mpconfigboard.h | 8 +- .../nrf/boards/particle_xenon/mpconfigboard.h | 6 +- ports/nrf/common-hal/microcontroller/Pin.c | 63 --- ports/nrf/common-hal/microcontroller/Pin.h | 8 - ports/raspberrypi/common-hal/busio/SPI.c | 1 - .../common-hal/microcontroller/Pin.c | 78 +-- .../common-hal/microcontroller/Pin.h | 8 - ports/stm/common-hal/microcontroller/Pin.c | 63 --- ports/stm/common-hal/microcontroller/Pin.h | 8 - shared-bindings/supervisor/__init__.c | 4 +- shared-module/displayio/EPaperDisplay.c | 17 +- shared-module/displayio/EPaperDisplay.h | 2 +- .../shared/external_flash/external_flash.c | 3 - supervisor/shared/rgb_led_colors.h | 27 +- supervisor/shared/rgb_led_status.c | 486 ------------------ supervisor/shared/rgb_led_status.h | 81 --- supervisor/shared/safe_mode.c | 32 +- supervisor/shared/status_leds.c | 263 +++++++++- supervisor/shared/status_leds.h | 29 +- supervisor/supervisor.mk | 1 - 33 files changed, 464 insertions(+), 1148 deletions(-) delete mode 100644 supervisor/shared/rgb_led_status.c delete mode 100644 supervisor/shared/rgb_led_status.h diff --git a/main.c b/main.c index 3730124863..78303e1235 100755 --- a/main.c +++ b/main.c @@ -53,7 +53,6 @@ #include "supervisor/port.h" #include "supervisor/serial.h" #include "supervisor/shared/autoreload.h" -#include "supervisor/shared/rgb_led_status.h" #include "supervisor/shared/safe_mode.h" #include "supervisor/shared/stack.h" #include "supervisor/shared/status_leds.h" @@ -114,7 +113,6 @@ static void reset_devices(void) { } STATIC void start_mp(supervisor_allocation* heap) { - reset_status_led(); autoreload_stop(); supervisor_workflow_reset(); @@ -251,7 +249,6 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap) { #endif reset_port(); reset_board(); - reset_status_led(); } STATIC void print_code_py_status_message(safe_mode_t safe_mode) { @@ -284,8 +281,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { bool found_main = false; if (safe_mode == NO_SAFE_MODE) { - new_status_color(MAIN_RUNNING); - static const char * const supported_filenames[] = STRING_LIST( "code.txt", "code.py", "main.py", "main.txt"); #if CIRCUITPY_FULL_BUILD @@ -315,6 +310,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { serial_write_compressed(translate("WARNING: Your code filename has two extensions\n")); } } + #else + (void) found_main; #endif // Finished executing python code. Cleanup includes a board reset. @@ -332,42 +329,64 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { } // Program has finished running. - bool printed_press_any_key = false; #if CIRCUITPY_DISPLAYIO - bool refreshed_epaper_display = false; + size_t time_to_epaper_refresh = 1; #endif - rgb_status_animation_t animation; - prep_rgb_status_animation(&result, found_main, safe_mode, &animation); + // Setup LED blinks. + #if CIRCUITPY_STATUS_LED + uint32_t color; + uint8_t blink_count; + #if CIRCUITPY_ALARM + if (result.return_code & PYEXEC_DEEP_SLEEP) { + color = BLACK; + blink_count = 0; + } else + #endif + if (result.return_code != PYEXEC_EXCEPTION) { + if (safe_mode == NO_SAFE_MODE) { + color = ALL_DONE; + blink_count = ALL_DONE_BLINKS; + } else { + color = SAFE_MODE; + blink_count = SAFE_MODE_BLINKS; + } + } else { + color = EXCEPTION; + blink_count = EXCEPTION_BLINKS; + } + size_t pattern_start = supervisor_ticks_ms32(); + size_t single_blink_time = (OFF_ON_RATIO + 1) * BLINK_TIME_MS; + size_t blink_time = single_blink_time * blink_count; + size_t total_time = blink_time + LED_SLEEP_TIME_MS; + if (blink_count > 0) { + status_led_init(); + } + #endif + + #if CIRCUITPY_ALARM bool fake_sleeping = false; + #endif + bool skip_repl = false; while (true) { RUN_BACKGROUND_TASKS; // If a reload was requested by the supervisor or autoreload, return if (reload_requested) { - #if CIRCUITPY_ALARM - if (fake_sleeping) { - board_init(); - } - #endif reload_requested = false; - return true; + skip_repl = true; + break; } // If interrupted by keyboard, return if (serial_connected() && serial_bytes_available()) { - #if CIRCUITPY_ALARM - if (fake_sleeping) { - board_init(); - } - #endif // Skip REPL if reload was requested. - bool ctrl_d = serial_read() == CHAR_CTRL_D; - if (ctrl_d) { + skip_repl = serial_read() == CHAR_CTRL_D; + if (skip_repl) { supervisor_set_run_reason(RUN_REASON_REPL_RELOAD); } - return ctrl_d; + break; } // Check for a deep sleep alarm and restart the VM. This can happen if @@ -376,9 +395,9 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { #if CIRCUITPY_ALARM if (fake_sleeping && common_hal_alarm_woken_from_sleep()) { serial_write_compressed(translate("Woken up by alarm.\n")); - board_init(); supervisor_set_run_reason(RUN_REASON_STARTUP); - return true; + skip_repl = true; + break; } #endif @@ -398,25 +417,21 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { printed_press_any_key = false; } - // Refresh the ePaper display if we have one. That way it'll show an error message. - #if CIRCUITPY_DISPLAYIO - // Don't refresh the display if we're about to deep sleep. - #if CIRCUITPY_ALARM - refreshed_epaper_display = refreshed_epaper_display || result.return_code & PYEXEC_DEEP_SLEEP; - #endif - if (!refreshed_epaper_display) { - refreshed_epaper_display = maybe_refresh_epaperdisplay(); - } - #endif - // Sleep until our next interrupt. #if CIRCUITPY_ALARM if (result.return_code & PYEXEC_DEEP_SLEEP) { // Make sure we have been awake long enough for USB to connect (enumeration delay). int64_t connecting_delay_ticks = CIRCUITPY_USB_CONNECTED_SLEEP_DELAY * 1024 - port_get_raw_ticks(NULL); - // Until it's safe to decide whether we're real/fake sleeping, just run the RGB - if (connecting_delay_ticks < 0 && !fake_sleeping) { - fake_sleeping = true; + // Until it's safe to decide whether we're real/fake sleeping + if (fake_sleeping) { + // This waits until a pretend deep sleep alarm occurs. They are set + // during common_hal_alarm_set_deep_sleep_alarms. On some platforms + // it may also return due to another interrupt, that's why we check + // for deep sleep alarms above. If it wasn't a deep sleep alarm, + // then we'll idle here again. + common_hal_alarm_pretending_deep_sleep(); + } else if (connecting_delay_ticks < 0) { + // Entering deep sleep (may be fake or real.) new_status_color(BLACK); board_deinit(); if (!supervisor_workflow_active()) { @@ -426,27 +441,71 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { // Does not return. } else { serial_write_compressed(translate("Pretending to deep sleep until alarm, CTRL-C or file write.\n")); + fake_sleeping = true; } + } else { + // Loop while checking the time. We can't idle because we don't want to override a + // time alarm set for the deep sleep. } - } + } else #endif + { + // Refresh the ePaper display if we have one. That way it'll show an error message. + #if CIRCUITPY_DISPLAYIO + if (time_to_epaper_refresh > 0) { + time_to_epaper_refresh = maybe_refresh_epaperdisplay(); + } - if (!fake_sleeping) { - tick_rgb_status_animation(&animation); - } else { - // This waits until a pretend deep sleep alarm occurs. They are set - // during common_hal_alarm_set_deep_sleep_alarms. On some platforms - // it may also return due to another interrupt, that's why we check - // for deep sleep alarms above. If it wasn't a deep sleep alarm, - // then we'll idle here again. - - #if CIRCUITPY_ALARM - common_hal_alarm_pretending_deep_sleep(); - #else - port_idle_until_interrupt(); + #if !CIRCUITPY_STATUS_LED + port_interrupt_after_ticks(time_to_epaper_refresh); #endif + #endif + + #if CIRCUITPY_STATUS_LED + uint32_t tick_diff = supervisor_ticks_ms32() - pattern_start; + + // By default, don't sleep. + size_t time_to_next_change = 0; + if (tick_diff < blink_time) { + uint32_t blink_diff = tick_diff % (single_blink_time); + if (blink_diff >= BLINK_TIME_MS) { + new_status_color(BLACK); + time_to_next_change = single_blink_time - blink_diff; + } else { + new_status_color(color); + time_to_next_change = BLINK_TIME_MS - blink_diff; + } + } else if (tick_diff > total_time) { + pattern_start = supervisor_ticks_ms32(); + } else { + time_to_next_change = total_time - tick_diff; + } + #if CIRCUITPY_DISPLAYIO + if (time_to_epaper_refresh > 0 && time_to_next_change > 0) { + time_to_next_change = MIN(time_to_next_change, time_to_epaper_refresh); + } + #endif + if (time_to_next_change > 0) { + // time_to_next_change is in ms and ticks are slightly shorter so + // we'll undersleep just a little. It shouldn't matter. + port_interrupt_after_ticks(time_to_next_change); + } + #endif + port_idle_until_interrupt(); } } + // Done waiting, start the board back up. + #if CIRCUITPY_STATUS_LED + new_status_color(BLACK); + status_led_deinit(); + #endif + + #if CIRCUITPY_ALARM + if (fake_sleeping) { + board_init(); + } + #endif + return skip_repl; } FIL* boot_output_file; @@ -463,7 +522,6 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { bool skip_boot_output = false; if (ok_to_run) { - new_status_color(BOOT_RUNNING); #ifdef CIRCUITPY_BOOT_OUTPUT_FILE FIL file_pointer; @@ -574,7 +632,16 @@ STATIC int run_repl(void) { #endif autoreload_suspend(); + + // Set the status LED to the REPL color before running the REPL. For + // NeoPixels and DotStars this will be sticky but for PWM or single LED it + // won't. This simplifies pin sharing because they won't be in use when + // actually in the REPL. + #if CIRCUITPY_STATUS_LED + status_led_init(); new_status_color(REPL_RUNNING); + status_led_deinit(); + #endif if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { exit_code = pyexec_raw_repl(); } else { @@ -589,9 +656,8 @@ int __attribute__((used)) main(void) { // initialise the cpu and peripherals safe_mode_t safe_mode = port_init(); - // Turn on LEDs - init_status_leds(); - rgb_led_status_init(); + // Turn on RX and TX LEDs if we have them. + init_rxtx_leds(); // Wait briefly to give a reset window where we'll enter safe mode after the reset. if (safe_mode == NO_SAFE_MODE) { diff --git a/ports/atmel-samd/boards/picoplanet/mpconfigboard.h b/ports/atmel-samd/boards/picoplanet/mpconfigboard.h index 30a9169e04..153150d1e1 100644 --- a/ports/atmel-samd/boards/picoplanet/mpconfigboard.h +++ b/ports/atmel-samd/boards/picoplanet/mpconfigboard.h @@ -33,10 +33,9 @@ #define DEFAULT_SPI_BUS_SCK (&pin_PA17) #define DEFAULT_SPI_BUS_MOSI (&pin_PA16) -// #define CP_RGB_STATUS_R (&pin_PA06) -// #define CP_RGB_STATUS_G (&pin_PA05) -// #define CP_RGB_STATUS_B (&pin_PA07) -// #define CP_RGB_STATUS_INVERTED_PWM -// #define CP_RGB_STATUS_LED +// #define CIRCUITPY_RGB_STATUS_R (&pin_PA06) +// #define CIRCUITPY_RGB_STATUS_G (&pin_PA05) +// #define CIRCUITPY_RGB_STATUS_B (&pin_PA07) +// #define CIRCUITPY_RGB_STATUS_INVERTED_PWM #define MICROPY_HW_LED_STATUS (&pin_PA06) diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c index 7b4034d156..48ca8f843d 100644 --- a/ports/atmel-samd/common-hal/busio/SPI.c +++ b/ports/atmel-samd/common-hal/busio/SPI.c @@ -36,7 +36,6 @@ #include "hal/include/hal_gpio.h" #include "hal/include/hal_spi_m_sync.h" #include "hal/include/hpl_spi_m_sync.h" -#include "supervisor/shared/rgb_led_status.h" #include "samd/dma.h" #include "samd/sercom.h" @@ -72,11 +71,6 @@ void reset_sercoms(void) { if (never_reset_sercoms[i]) { continue; } - #ifdef MICROPY_HW_APA102_SERCOM - if (sercom_instances[i] == MICROPY_HW_APA102_SERCOM) { - continue; - } - #endif // SWRST is same for all modes of SERCOMs. sercom_instances[i]->SPI.CTRLA.bit.SWRST = 1; } @@ -122,15 +116,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, continue; } Sercom *potential_sercom = sercom_insts[sercom_index]; - if ( - #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102 - (potential_sercom->SPI.CTRLA.bit.ENABLE != 0 && - potential_sercom != status_apa102.spi_desc.dev.prvt && - !apa102_sck_in_use) - #else - potential_sercom->SPI.CTRLA.bit.ENABLE != 0 - #endif - ) { + if (potential_sercom->SPI.CTRLA.bit.ENABLE != 0) { continue; } clock_pinmux = PINMUX(clock->number, (i == 0) ? MUX_C : MUX_D); @@ -181,10 +167,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // 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); } diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c index 564d037e03..8032673d03 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.c +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c @@ -32,15 +32,7 @@ #include "hal/include/hal_gpio.h" #include "samd/pins.h" -#include "supervisor/shared/rgb_led_status.h" -#ifdef MICROPY_HW_NEOPIXEL -bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif #ifdef SPEAKER_ENABLE_PIN bool speaker_enable_in_use; #endif @@ -90,14 +82,6 @@ void reset_all_pins(void) { gpio_set_pin_function(PIN_PA31, GPIO_PIN_FUNCTION_G); #endif - #ifdef MICROPY_HW_NEOPIXEL - neopixel_in_use = false; - #endif - #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif - // After configuring SWD because it may be shared. #ifdef SPEAKER_ENABLE_PIN speaker_enable_in_use = false; @@ -122,25 +106,6 @@ void reset_pin_number(uint8_t pin_number) { never_reset_pins[GPIO_PORT(pin_number)] &= ~(1 << GPIO_PIN(pin_number)); - #ifdef MICROPY_HW_NEOPIXEL - if (pin_number == MICROPY_HW_NEOPIXEL->number) { - neopixel_in_use = false; - rgb_led_status_init(); - return; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number || - pin_number == MICROPY_HW_APA102_SCK->number) { - apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; - apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { - rgb_led_status_init(); - } - return; - } - #endif - if (pin_number == PIN_PA30 #ifdef SAM_D5X_E5X ) { @@ -176,20 +141,6 @@ void common_hal_reset_pin(const mcu_pin_obj_t* pin) { } void claim_pin(const mcu_pin_obj_t* pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif - #ifdef SPEAKER_ENABLE_PIN if (pin == SPEAKER_ENABLE_PIN) { speaker_enable_in_use = true; @@ -223,26 +174,6 @@ bool pin_number_is_free(uint8_t pin_number) { } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - // Special case for Metro M0 where the NeoPixel is also SWCLK -#ifndef IGNORE_PIN_PA30 - if (MICROPY_HW_NEOPIXEL == &pin_PA30 && DSU->STATUSB.bit.DBGPRES == 1) { - return false; - } -#endif - return !neopixel_in_use; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) { - return !apa102_sck_in_use; - } - #endif - #ifdef SPEAKER_ENABLE_PIN if (pin == SPEAKER_ENABLE_PIN) { return !speaker_enable_in_use; diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.h b/ports/atmel-samd/common-hal/microcontroller/Pin.h index 6e313acfd3..76da10852f 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.h +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.h @@ -31,14 +31,6 @@ #include "peripherals/samd/pins.h" -#ifdef MICROPY_HW_NEOPIXEL -extern bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; -extern bool apa102_mosi_in_use; -#endif - 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. diff --git a/ports/atmel-samd/supervisor/internal_flash.c b/ports/atmel-samd/supervisor/internal_flash.c index 98d7892c9f..afac001232 100644 --- a/ports/atmel-samd/supervisor/internal_flash.c +++ b/ports/atmel-samd/supervisor/internal_flash.c @@ -51,21 +51,10 @@ #include "hal/include/hal_flash.h" #include "supervisor/flash.h" -#include "supervisor/shared/rgb_led_status.h" static struct flash_descriptor supervisor_flash_desc; void supervisor_flash_init(void) { - // Activity LED for flash writes. - #ifdef MICROPY_HW_LED_MSC - struct port_config pin_conf; - port_get_config_defaults(&pin_conf); - - pin_conf.direction = PORT_PIN_DIR_OUTPUT; - port_pin_set_config(MICROPY_HW_LED_MSC, &pin_conf); - port_pin_set_output_level(MICROPY_HW_LED_MSC, false); - #endif - #ifdef SAM_D5X_E5X hri_mclk_set_AHBMASK_NVMCTRL_bit(MCLK); #endif @@ -114,10 +103,6 @@ bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) { } bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) { - #ifdef MICROPY_HW_LED_MSC - port_pin_set_output_level(MICROPY_HW_LED_MSC, true); - #endif - temp_status_color(ACTIVE_WRITE); // non-MBR block, copy to cache int32_t dest = convert_block_to_flash_addr(block); if (dest == -1) { @@ -136,10 +121,6 @@ bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) { if (error_code != ERR_NONE) { return false; } - clear_temp_status(); - #ifdef MICROPY_HW_LED_MSC - port_pin_set_output_level(MICROPY_HW_LED_MSC, false); - #endif return true; } diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 917b391112..0e69d9f520 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -29,7 +29,6 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/rgb_led_status.h" static bool spi_never_reset[SOC_SPI_PERIPH_NUM]; diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 5c00ca49e1..402de227d2 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -27,23 +27,15 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/rgb_led_status.h" #include "py/mphal.h" #include "components/driver/include/driver/gpio.h" #include "components/soc/include/hal/gpio_hal.h" -#ifdef MICROPY_HW_NEOPIXEL -bool neopixel_in_use; -#endif - STATIC uint32_t never_reset_pins[2]; STATIC uint32_t in_use[2]; -bool apa102_mosi_in_use; -bool apa102_sck_in_use; - STATIC void floating_gpio_reset(gpio_num_t pin_number) { // This is the same as gpio_reset_pin(), but without the pullup. // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. @@ -78,14 +70,6 @@ void reset_pin_number(gpio_num_t pin_number) { in_use[pin_number / 32] &= ~(1 << pin_number % 32); floating_gpio_reset(pin_number); - - #ifdef MICROPY_HW_NEOPIXEL - if (pin_number == MICROPY_HW_NEOPIXEL->number) { - neopixel_in_use = false; - rgb_led_status_init(); - return; - } - #endif } void common_hal_reset_pin(const mcu_pin_obj_t *pin) { @@ -106,19 +90,10 @@ void reset_all_pins(void) { } in_use[0] = 0; in_use[1] = 0; - - #ifdef MICROPY_HW_NEOPIXEL - neopixel_in_use = false; - #endif } void claim_pin(const mcu_pin_obj_t *pin) { in_use[pin->number / 32] |= (1 << (pin->number % 32)); - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif } void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) { @@ -126,12 +101,6 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) { } bool pin_number_is_free(gpio_num_t pin_number) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin_number == MICROPY_HW_NEOPIXEL->number) { - return !neopixel_in_use; - } - #endif - uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); return (in_use[offset] & mask) == 0; diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index e7b488f048..e82b28f282 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -31,13 +31,6 @@ #include "peripherals/pins.h" -extern bool apa102_mosi_in_use; -extern bool apa102_sck_in_use; - -#ifdef MICROPY_HW_NEOPIXEL -extern bool neopixel_in_use; -#endif - 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. diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index b55ab6e862..53e92d4105 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -27,15 +27,6 @@ */ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/rgb_led_status.h" - -#ifdef MICROPY_HW_NEOPIXEL -bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif STATIC bool claimed_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; STATIC bool never_reset_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; @@ -54,14 +45,6 @@ void reset_all_pins(void) { IOMUXC->SW_PAD_CTL_PAD[i] = ((mcu_pin_obj_t *)(mcu_pin_globals.map.table[i].value))->pad_reset; } } - - #ifdef MICROPY_HW_NEOPIXEL - neopixel_in_use = false; - #endif - #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif } // Since i.MX pins need extra register and reset information to reset properly, @@ -74,25 +57,6 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { claimed_pins[pin->mux_idx] = false; *(uint32_t *)pin->mux_reg = pin->mux_reset; *(uint32_t *)pin->cfg_reg = pin->pad_reset; - - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = false; - rgb_led_status_init(); - return; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin->mux_idx == MICROPY_HW_APA102_MOSI->mux_idx || - pin->mux_idx == MICROPY_HW_APA102_SCK->mux_idx) { - apa102_mosi_in_use = apa102_mosi_in_use && pin->mux_idx != MICROPY_HW_APA102_MOSI->mux_idx; - apa102_sck_in_use = apa102_sck_in_use && pin->mux_idx != MICROPY_HW_APA102_SCK->mux_idx; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { - rgb_led_status_init(); - } - return; - } - #endif } void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { @@ -100,20 +64,6 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - return !neopixel_in_use; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) { - return !apa102_sck_in_use; - } - #endif - return !claimed_pins[pin->mux_idx]; } @@ -123,20 +73,6 @@ uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t *pin) { void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) { claimed_pins[pin->mux_idx] = true; - - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif } void claim_pin(const mcu_pin_obj_t *pin) { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h index fde7fc8b8f..2638eb89b8 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h @@ -32,14 +32,6 @@ #include "pins.h" -#ifdef MICROPY_HW_NEOPIXEL -extern bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; -extern bool apa102_mosi_in_use; -#endif - void reset_all_pins(void); void claim_pin(const mcu_pin_obj_t *pin); diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h index 64988e1a28..8e4cd2287a 100644 --- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h +++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h @@ -30,7 +30,7 @@ #define MICROPY_HW_BOARD_NAME "Adafruit Feather nRF52840 Express" #define MICROPY_HW_MCU_NAME "nRF52840" -#define MICROPY_HW_NEOPIXEL (&pin_P0_16) +// #define MICROPY_HW_NEOPIXEL (&pin_P0_16) #define MICROPY_HW_LED_STATUS (&pin_P1_15) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h index 4fb6049c5f..23a98c948b 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h @@ -31,9 +31,9 @@ #define MICROPY_HW_MCU_NAME "nRF52840" // RGB LEDs use PWM peripheral, avoid using them to save energy -// #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 CIRCUITPY_RGB_STATUS_R (&pin_P0_30) +#define CIRCUITPY_RGB_STATUS_G (&pin_P0_29) +#define CIRCUITPY_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 dab2ff042b..c398ce83dc 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h @@ -32,10 +32,10 @@ #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 CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_P0_30) +#define CIRCUITPY_RGB_STATUS_G (&pin_P0_29) +#define CIRCUITPY_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/particle_xenon/mpconfigboard.h b/ports/nrf/boards/particle_xenon/mpconfigboard.h index f0d12bb0b9..b2221e163a 100644 --- a/ports/nrf/boards/particle_xenon/mpconfigboard.h +++ b/ports/nrf/boards/particle_xenon/mpconfigboard.h @@ -32,9 +32,9 @@ #define MICROPY_HW_LED_STATUS (&pin_P1_12) -#define CP_RGB_STATUS_R (&pin_P0_13) -#define CP_RGB_STATUS_G (&pin_P0_14) -#define CP_RGB_STATUS_B (&pin_P0_15) +#define CIRCUITPY_RGB_STATUS_R (&pin_P0_13) +#define CIRCUITPY_RGB_STATUS_G (&pin_P0_14) +#define CIRCUITPY_RGB_STATUS_B (&pin_P0_15) #if QSPI_FLASH_FILESYSTEM #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20) diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c index aea4f63eae..39ee601428 100644 --- a/ports/nrf/common-hal/microcontroller/Pin.c +++ b/ports/nrf/common-hal/microcontroller/Pin.c @@ -31,15 +31,7 @@ #include "py/mphal.h" #include "nrf/pins.h" -#include "supervisor/shared/rgb_led_status.h" -#ifdef MICROPY_HW_NEOPIXEL -bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif #ifdef SPEAKER_ENABLE_PIN bool speaker_enable_in_use; #endif @@ -73,14 +65,6 @@ void reset_all_pins(void) { nrf_gpio_cfg_default(pin); } - #ifdef MICROPY_HW_NEOPIXEL - neopixel_in_use = false; - #endif - #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif - // After configuring SWD because it may be shared. reset_speaker_enable_pin(); } @@ -95,25 +79,6 @@ void reset_pin_number(uint8_t pin_number) { claimed_pins[nrf_pin_port(pin_number)] &= ~(1 << nrf_relative_pin_number(pin_number)); never_reset_pins[nrf_pin_port(pin_number)] &= ~(1 << nrf_relative_pin_number(pin_number)); - #ifdef MICROPY_HW_NEOPIXEL - if (pin_number == MICROPY_HW_NEOPIXEL->number) { - neopixel_in_use = false; - rgb_led_status_init(); - return; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number || - pin_number == MICROPY_HW_APA102_SCK->number) { - apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; - apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { - rgb_led_status_init(); - } - return; - } - #endif - #ifdef SPEAKER_ENABLE_PIN if (pin_number == SPEAKER_ENABLE_PIN->number) { reset_speaker_enable_pin(); @@ -144,20 +109,6 @@ void claim_pin(const mcu_pin_obj_t *pin) { // Set bit in claimed_pins bitmask. claimed_pins[nrf_pin_port(pin->number)] |= 1 << nrf_relative_pin_number(pin->number); - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif - #ifdef SPEAKER_ENABLE_PIN if (pin == SPEAKER_ENABLE_PIN) { speaker_enable_in_use = true; @@ -171,20 +122,6 @@ bool pin_number_is_free(uint8_t pin_number) { } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - return !neopixel_in_use; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) { - return !apa102_sck_in_use; - } - #endif - #ifdef SPEAKER_ENABLE_PIN if (pin == SPEAKER_ENABLE_PIN) { return !speaker_enable_in_use; diff --git a/ports/nrf/common-hal/microcontroller/Pin.h b/ports/nrf/common-hal/microcontroller/Pin.h index 888ab6a8c4..f4623aa2dc 100644 --- a/ports/nrf/common-hal/microcontroller/Pin.h +++ b/ports/nrf/common-hal/microcontroller/Pin.h @@ -31,14 +31,6 @@ #include "peripherals/nrf/pins.h" -#ifdef MICROPY_HW_NEOPIXEL -extern bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; -extern bool apa102_mosi_in_use; -#endif - 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. diff --git a/ports/raspberrypi/common-hal/busio/SPI.c b/ports/raspberrypi/common-hal/busio/SPI.c index 0fc71136e6..23030cbd0d 100644 --- a/ports/raspberrypi/common-hal/busio/SPI.c +++ b/ports/raspberrypi/common-hal/busio/SPI.c @@ -32,7 +32,6 @@ #include "supervisor/board.h" #include "common-hal/microcontroller/Pin.h" -#include "supervisor/shared/rgb_led_status.h" #include "shared-bindings/microcontroller/Pin.h" #include "src/rp2_common/hardware_dma/include/hardware/dma.h" diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index 271966c2fe..d40c1f43b5 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -29,21 +29,8 @@ #include "common-hal/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/rgb_led_status.h" - #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" -#ifdef MICROPY_HW_NEOPIXEL -bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif -#ifdef SPEAKER_ENABLE_PIN -bool speaker_enable_in_use; -#endif - STATIC uint32_t never_reset_pins; void reset_all_pins(void) { @@ -77,31 +64,6 @@ void reset_pin_number(uint8_t pin_number) { PADS_BANK0_GPIO0_PUE_BITS | PADS_BANK0_GPIO0_PDE_BITS); hw_set_bits(&padsbank0_hw->io[pin_number], PADS_BANK0_GPIO0_OD_BITS); - - #ifdef MICROPY_HW_NEOPIXEL - if (pin_number == MICROPY_HW_NEOPIXEL->number) { - neopixel_in_use = false; - rgb_led_status_init(); - return; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number || - pin_number == MICROPY_HW_APA102_SCK->number) { - apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; - apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { - rgb_led_status_init(); - } - return; - } - #endif - - #ifdef SPEAKER_ENABLE_PIN - if (pin_number == SPEAKER_ENABLE_PIN->number) { - speaker_enable_in_use = false; - } - #endif } void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { @@ -113,25 +75,7 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { } void claim_pin(const mcu_pin_obj_t *pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif - - #ifdef SPEAKER_ENABLE_PIN - if (pin == SPEAKER_ENABLE_PIN) { - speaker_enable_in_use = true; - } - #endif + // Nothing to do because all changes will set the GPIO settings. } bool pin_number_is_free(uint8_t pin_number) { @@ -145,26 +89,6 @@ bool pin_number_is_free(uint8_t pin_number) { } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - return !neopixel_in_use; - } - #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) { - return !apa102_sck_in_use; - } - #endif - - #ifdef SPEAKER_ENABLE_PIN - if (pin == SPEAKER_ENABLE_PIN) { - return !speaker_enable_in_use; - } - #endif - return pin_number_is_free(pin->number); } diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.h b/ports/raspberrypi/common-hal/microcontroller/Pin.h index 7da3a2b88b..3e2287dc5d 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.h +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.h @@ -34,14 +34,6 @@ #include "peripherals/pins.h" -#ifdef MICROPY_HW_NEOPIXEL -extern bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; -extern bool apa102_mosi_in_use; -#endif - 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. diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 80cb9defc8..fa03a7a210 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -27,19 +27,10 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/rgb_led_status.h" #include "py/mphal.h" #include "pins.h" -#ifdef MICROPY_HW_NEOPIXEL -bool neopixel_in_use; -#endif -#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif - #if defined(TFBGA216) GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, GPIOI, GPIOJ, GPIOK}; #elif defined(LQFP144) @@ -66,14 +57,6 @@ void reset_all_pins(void) { for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) { HAL_GPIO_DeInit(ports[i], ~never_reset_pins[i]); } - - #ifdef MICROPY_HW_NEOPIXEL - neopixel_in_use = false; - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif } // Mark pin as free and return it to a quiescent state. @@ -89,25 +72,6 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { claimed_pins[pin_port] &= ~(1 << pin_number); never_reset_pins[pin_port] &= ~(1 << pin_number); HAL_GPIO_DeInit(ports[pin_port], 1 << pin_number); - - #ifdef MICROPY_HW_NEOPIXEL - if (pin_port == MICROPY_HW_NEOPIXEL->port && pin_number == MICROPY_HW_NEOPIXEL->number) { - neopixel_in_use = false; - rgb_led_status_init(); - return; - } - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - if ( - (pin_port == MICROPY_HW_APA102_MOSI->port && pin_number == MICROPY_HW_APA102_MOSI->number) - || (pin_port == MICROPY_HW_APA102_SCK->port && pin_number == MICROPY_HW_APA102_MOSI->number) - ) { - apa102_mosi_in_use = false; - apa102_sck_in_use = false; - rgb_led_status_init(); - return; - } - #endif } void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { @@ -140,20 +104,6 @@ bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) { } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - return !neopixel_in_use; - } - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - if (pin == MICROPY_HW_APA102_MOSI) { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) { - return !apa102_sck_in_use; - } - #endif - return pin_number_is_free(pin->port, pin->number); } @@ -171,19 +121,6 @@ uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t *pin) { void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) { claim_pin(pin->port, pin->number); - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_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 4a33979421..52c6efd712 100644 --- a/ports/stm/common-hal/microcontroller/Pin.h +++ b/ports/stm/common-hal/microcontroller/Pin.h @@ -31,14 +31,6 @@ #include "peripherals/pins.h" -#ifdef MICROPY_HW_NEOPIXEL -extern bool neopixel_in_use; -#endif -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; -extern bool apa102_mosi_in_use; -#endif - 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. diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 28ac68d629..b3b00f68d5 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -29,7 +29,7 @@ #include "lib/utils/interrupt_char.h" #include "supervisor/shared/autoreload.h" -#include "supervisor/shared/rgb_led_status.h" +#include "supervisor/shared/status_leds.h" #include "supervisor/shared/stack.h" #include "supervisor/shared/translate.h" #include "supervisor/shared/workflow.h" @@ -79,7 +79,7 @@ STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl) { if (brightness_int < 0 || brightness_int > 255) { mp_raise_ValueError(translate("Brightness must be between 0 and 255")); } - set_rgb_status_brightness((uint8_t)brightness_int); + set_status_brightness((uint8_t)brightness_int); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_set_rgb_status_brightness); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 7eff587757..826fe9b8ea 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -409,7 +409,7 @@ void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t *self) { gc_collect_ptr((void *)self->stop_sequence); } -bool maybe_refresh_epaperdisplay(void) { +size_t maybe_refresh_epaperdisplay(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].epaper_display.base.type != &displayio_epaperdisplay_type || displays[i].epaper_display.core.current_group != &circuitpython_splash) { @@ -417,11 +417,16 @@ bool maybe_refresh_epaperdisplay(void) { continue; } displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; - if (common_hal_displayio_epaperdisplay_get_time_to_refresh(display) != 0) { - return false; + size_t time_to_refresh = common_hal_displayio_epaperdisplay_get_time_to_refresh(display); + if (time_to_refresh > 0) { + return time_to_refresh; } - return common_hal_displayio_epaperdisplay_refresh(display); + if (common_hal_displayio_epaperdisplay_refresh(display)) { + return 0; + } + // If we could refresh but it failed, then we want to retry. + return 1; } - // Return true if no ePaper displays are available to pretend it was updated. - return true; + // Return 0 if no ePaper displays are available to pretend it was updated. + return 0; } diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 988cc57fa3..f200813626 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -61,7 +61,7 @@ typedef struct { void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t *self); void release_epaperdisplay(displayio_epaperdisplay_obj_t *self); -bool maybe_refresh_epaperdisplay(void); +size_t maybe_refresh_epaperdisplay(void); void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t *self); diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index 722393ce65..56a7f25b30 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -39,7 +39,6 @@ #include "lib/oofatfs/ff.h" #include "shared-bindings/microcontroller/__init__.h" #include "supervisor/memory.h" -#include "supervisor/shared/rgb_led_status.h" #define NO_SECTOR_LOADED 0xFFFFFFFF @@ -467,7 +466,6 @@ static void spi_flash_flush_keep_cache(bool keep_cache) { #ifdef MICROPY_HW_LED_MSC port_pin_set_output_level(MICROPY_HW_LED_MSC, true); #endif - temp_status_color(ACTIVE_WRITE); // If we've cached to the flash itself flush from there. if (MP_STATE_VM(flash_ram_cache) == NULL) { flush_scratch_flash(); @@ -475,7 +473,6 @@ static void spi_flash_flush_keep_cache(bool keep_cache) { flush_ram_cache(keep_cache); } current_sector = NO_SECTOR_LOADED; - clear_temp_status(); #ifdef MICROPY_HW_LED_MSC port_pin_set_output_level(MICROPY_HW_LED_MSC, false); #endif diff --git a/supervisor/shared/rgb_led_colors.h b/supervisor/shared/rgb_led_colors.h index 581c177442..56dc0f48d1 100644 --- a/supervisor/shared/rgb_led_colors.h +++ b/supervisor/shared/rgb_led_colors.h @@ -14,28 +14,17 @@ #define PURPLE COLOR(INTENSITY, 0, INTENSITY) #define WHITE COLOR(INTENSITY, INTENSITY, INTENSITY) -#define BOOT_RUNNING BLUE -#define MAIN_RUNNING GREEN -#define SAFE_MODE YELLOW #define ALL_DONE GREEN +#define EXCEPTION RED +#define SAFE_MODE YELLOW #define REPL_RUNNING WHITE -#define ACTIVE_WRITE 0x200000 +#define ALL_DONE_BLINKS 1 +#define EXCEPTION_BLINKS 2 +#define SAFE_MODE_BLINKS 3 -#define ALL_GOOD_CYCLE_MS 2000u +#define OFF_ON_RATIO 3 -#define LINE_NUMBER_TOGGLE_LENGTH 300u -#define EXCEPTION_TYPE_LENGTH_MS 1000u +#define LED_SLEEP_TIME_MS 5000u -#define THOUSANDS WHITE -#define HUNDREDS BLUE -#define TENS YELLOW -#define ONES CYAN - -#define INDENTATION_ERROR GREEN -#define SYNTAX_ERROR CYAN -#define NAME_ERROR WHITE -#define OS_ERROR ORANGE -#define VALUE_ERROR PURPLE -#define MPY_ERROR BLUE -#define OTHER_ERROR YELLOW +#define BLINK_TIME_MS 100u diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c deleted file mode 100644 index d6e11c2aef..0000000000 --- a/supervisor/shared/rgb_led_status.c +++ /dev/null @@ -1,486 +0,0 @@ -/* - * 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 "mphalport.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "rgb_led_status.h" -#include "supervisor/shared/tick.h" -#include "py/obj.h" - -#ifdef MICROPY_HW_NEOPIXEL -uint8_t rgb_status_brightness = 63; -#include "shared-bindings/digitalio/DigitalInOut.h" -#include "shared-bindings/neopixel_write/__init__.h" -static uint8_t status_neopixel_color[3]; -static digitalio_digitalinout_obj_t status_neopixel; -#endif - - -#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) -uint8_t rgb_status_brightness = 50; - -#define APA102_BUFFER_LENGTH 12 -static uint8_t status_apa102_color[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0xff}; - -#if CIRCUITPY_BITBANG_APA102 -#include "shared-bindings/bitbangio/SPI.h" -static bitbangio_spi_obj_t status_apa102 = { - .base = { - .type = &bitbangio_spi_type, - }, -}; -#else -#include "shared-bindings/busio/SPI.h" -busio_spi_obj_t status_apa102 = { - .base = { - .type = &busio_spi_type, - }, -}; -#endif -#endif - -#if defined(CP_RGB_STATUS_R) || defined(CP_RGB_STATUS_G) || defined(CP_RGB_STATUS_B) -#define CP_RGB_STATUS_LED - -#include "shared-bindings/pwmio/PWMOut.h" -#include "shared-bindings/microcontroller/Pin.h" - -pwmio_pwmout_obj_t rgb_status_r = { - .base = { - .type = &pwmio_pwmout_type, - }, -}; -pwmio_pwmout_obj_t rgb_status_g = { - .base = { - .type = &pwmio_pwmout_type, - }, -}; -pwmio_pwmout_obj_t rgb_status_b = { - .base = { - .type = &pwmio_pwmout_type, - }, -}; - -uint8_t rgb_status_brightness = 0xFF; - -uint16_t status_rgb_color[3] = { - 0 /* red */, 0 /* green */, 0 /* blue */ -}; -#endif - -#if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) -static uint32_t current_status_color = 0; -#endif - -static bool rgb_led_status_init_in_progress = false; -void rgb_led_status_init() { - if (rgb_led_status_init_in_progress) { - // Avoid recursion. - return; - } - rgb_led_status_init_in_progress = true; - - #ifdef MICROPY_HW_NEOPIXEL - common_hal_digitalio_digitalinout_construct(&status_neopixel, MICROPY_HW_NEOPIXEL); - // Pretend we aren't using the pins. digitalio.DigitalInOut - // will mark them as used. - neopixel_in_use = false; - common_hal_digitalio_digitalinout_switch_to_output(&status_neopixel, false, DRIVE_MODE_PUSH_PULL); - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_construct(&status_apa102, - MICROPY_HW_APA102_SCK, - MICROPY_HW_APA102_MOSI, - NULL); - #else - if (!common_hal_busio_spi_deinited(&status_apa102)) { - // This may call us recursively if common_hal_reset_pin() is called, - // The rgb_led_status_init_in_progress guard will prevent further recursion. - common_hal_busio_spi_deinit(&status_apa102); - } - common_hal_busio_spi_construct(&status_apa102, - MICROPY_HW_APA102_SCK, - MICROPY_HW_APA102_MOSI, - NULL); - common_hal_busio_spi_never_reset(&status_apa102); - #endif - // Pretend we aren't using the pins. bitbangio.SPI will - // mark them as used. - apa102_mosi_in_use = false; - apa102_sck_in_use = false; - #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_try_lock(&status_apa102); - // Use 1MHz for clock rate. Some APA102's are spec'd 800kHz-1200kHz, - // though many can run much faster. bitbang will probably run slower. - shared_module_bitbangio_spi_configure(&status_apa102, 1000000, 0, 0, 8); - #else - common_hal_busio_spi_try_lock(&status_apa102); - common_hal_busio_spi_configure(&status_apa102, 1000000, 0, 0, 8); - #endif - #endif - - - #if defined(CP_RGB_STATUS_LED) - if (common_hal_mcu_pin_is_free(CP_RGB_STATUS_R)) { - pwmout_result_t red_result = common_hal_pwmio_pwmout_construct(&rgb_status_r, CP_RGB_STATUS_R, 0, 50000, false); - - if (PWMOUT_OK == red_result) { - common_hal_pwmio_pwmout_never_reset(&rgb_status_r); - } - } - - if (common_hal_mcu_pin_is_free(CP_RGB_STATUS_G)) { - pwmout_result_t green_result = common_hal_pwmio_pwmout_construct(&rgb_status_g, CP_RGB_STATUS_G, 0, 50000, false); - - if (PWMOUT_OK == green_result) { - common_hal_pwmio_pwmout_never_reset(&rgb_status_g); - } - } - - if (common_hal_mcu_pin_is_free(CP_RGB_STATUS_B)) { - pwmout_result_t blue_result = common_hal_pwmio_pwmout_construct(&rgb_status_b, CP_RGB_STATUS_B, 0, 50000, false); - - if (PWMOUT_OK == blue_result) { - common_hal_pwmio_pwmout_never_reset(&rgb_status_b); - } - } - #endif - - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - // Force a write of the current status color. - uint32_t rgb = current_status_color; - current_status_color = 0x1000000; // Not a valid color - new_status_color(rgb); - #endif - - rgb_led_status_init_in_progress = false; -} - -void reset_status_led() { - #ifdef MICROPY_HW_NEOPIXEL - common_hal_reset_pin(MICROPY_HW_NEOPIXEL); - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - common_hal_reset_pin(MICROPY_HW_APA102_MOSI); - common_hal_reset_pin(MICROPY_HW_APA102_SCK); - #endif - #if defined(CP_RGB_STATUS_LED) - // TODO: Support sharing status LED with user. - #endif -} - -void new_status_color(uint32_t rgb) { - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - if (current_status_color == rgb) { - return; - } - uint32_t rgb_adjusted = color_brightness(rgb, rgb_status_brightness); - current_status_color = rgb; - #endif - - #ifdef MICROPY_HW_NEOPIXEL - if (neopixel_in_use) { - return; - } - status_neopixel_color[0] = (rgb_adjusted >> 8) & 0xff; - status_neopixel_color[1] = (rgb_adjusted >> 16) & 0xff; - status_neopixel_color[2] = rgb_adjusted & 0xff; - common_hal_neopixel_write(&status_neopixel, status_neopixel_color, 3); - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - if (apa102_mosi_in_use || apa102_sck_in_use) { - return; - } - status_apa102_color[5] = rgb_adjusted & 0xff; - status_apa102_color[6] = (rgb_adjusted >> 8) & 0xff; - status_apa102_color[7] = (rgb_adjusted >> 16) & 0xff; - - #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); - #else - common_hal_busio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); - #endif - #endif - - #if defined(CP_RGB_STATUS_LED) - uint8_t red_u8 = (rgb_adjusted >> 16) & 0xFF; - uint8_t green_u8 = (rgb_adjusted >> 8) & 0xFF; - uint8_t blue_u8 = rgb_adjusted & 0xFF; - - #if defined(CP_RGB_STATUS_INVERTED_PWM) - status_rgb_color[0] = (1 << 16) - 1 - ((uint16_t)(red_u8 << 8) + red_u8); - status_rgb_color[1] = (1 << 16) - 1 - ((uint16_t)(green_u8 << 8) + green_u8); - status_rgb_color[2] = (1 << 16) - 1 - ((uint16_t)(blue_u8 << 8) + blue_u8); - #else - status_rgb_color[0] = (uint16_t)(red_u8 << 8) + red_u8; - status_rgb_color[1] = (uint16_t)(green_u8 << 8) + green_u8; - status_rgb_color[2] = (uint16_t)(blue_u8 << 8) + blue_u8; - #endif - - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_r, status_rgb_color[0]); - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_g, status_rgb_color[1]); - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_b, status_rgb_color[2]); - #endif -} - -void temp_status_color(uint32_t rgb) { - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - uint32_t rgb_adjusted = rgb; - rgb_adjusted = color_brightness(rgb, rgb_status_brightness); - #endif - #ifdef MICROPY_HW_NEOPIXEL - if (neopixel_in_use) { - return; - } - uint8_t colors[3] = {(rgb_adjusted >> 8) & 0xff, (rgb_adjusted >> 16) & 0xff, rgb_adjusted & 0xff}; - common_hal_neopixel_write(&status_neopixel, colors, 3); - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - if (apa102_mosi_in_use || apa102_sck_in_use) { - return; - } - uint8_t colors[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, rgb_adjusted & 0xff, (rgb_adjusted >> 8) & 0xff, (rgb_adjusted >> 16) & 0xff, 0xff, 0xff, 0xff, 0xff}; - #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_write(&status_apa102, colors, APA102_BUFFER_LENGTH); - #else - common_hal_busio_spi_write(&status_apa102, colors, APA102_BUFFER_LENGTH); - #endif - #endif - #if defined(CP_RGB_STATUS_LED) - uint8_t red_u8 = (rgb_adjusted >> 16) & 0xFF; - uint8_t green_u8 = (rgb_adjusted >> 8) & 0xFF; - uint8_t blue_u8 = rgb_adjusted & 0xFF; - - uint16_t temp_status_color_rgb[3] = {0}; - - #if defined(CP_RGB_STATUS_INVERTED_PWM) - temp_status_color_rgb[0] = (1 << 16) - 1 - ((uint16_t)(red_u8 << 8) + red_u8); - temp_status_color_rgb[1] = (1 << 16) - 1 - ((uint16_t)(green_u8 << 8) + green_u8); - temp_status_color_rgb[2] = (1 << 16) - 1 - ((uint16_t)(blue_u8 << 8) + blue_u8); - #else - temp_status_color_rgb[0] = (uint16_t)(red_u8 << 8) + red_u8; - temp_status_color_rgb[1] = (uint16_t)(green_u8 << 8) + green_u8; - temp_status_color_rgb[2] = (uint16_t)(blue_u8 << 8) + blue_u8; - #endif - - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_r, temp_status_color_rgb[0]); - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_g, temp_status_color_rgb[1]); - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_b, temp_status_color_rgb[2]); - #endif -} - -void clear_temp_status() { - #ifdef MICROPY_HW_NEOPIXEL - if (neopixel_in_use) { - return; - } - common_hal_neopixel_write(&status_neopixel, status_neopixel_color, 3); - #endif - #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - if (apa102_mosi_in_use || apa102_sck_in_use) { - return; - } - #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); - #else - common_hal_busio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); - #endif - #endif - #if defined(CP_RGB_STATUS_LED) - - uint16_t red = 0; - uint16_t green = 0; - uint16_t blue = 0; - - #if defined(CP_RGB_STATUS_INVERTED_PWM) - red = (1 << 16) - 1 - status_rgb_color[0]; - green = (1 << 16) - 1 - status_rgb_color[1]; - blue = (1 << 16) - 1 - status_rgb_color[2]; - #else - red = status_rgb_color[0]; - green = status_rgb_color[1]; - blue = status_rgb_color[2]; - #endif - - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_r, red); - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_g, green); - common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_b, blue); - #endif -} - -uint32_t color_brightness(uint32_t color, uint8_t brightness) { - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - uint32_t result = ((color & 0xff0000) * brightness / 255) & 0xff0000; - result += ((color & 0xff00) * brightness / 255) & 0xff00; - result += ((color & 0xff) * brightness / 255) & 0xff; - return result; - #else - return color; - #endif -} - -void set_rgb_status_brightness(uint8_t level) { - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - rgb_status_brightness = level; - uint32_t current_color = current_status_color; - // Temporarily change the current color global to force the new_status_color call to update the - // LED. Usually duplicate calls of the same color are ignored without regard to brightness - // changes. - current_status_color = 0; - new_status_color(current_color); - #endif -} - -void prep_rgb_status_animation(const pyexec_result_t *result, - bool found_main, - safe_mode_t safe_mode, - rgb_status_animation_t *status) { - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - new_status_color(ALL_DONE); - status->pattern_start = supervisor_ticks_ms32(); - status->safe_mode = safe_mode; - status->found_main = found_main; - status->total_exception_cycle = 0; - status->ok = result->return_code != PYEXEC_EXCEPTION; - if (status->ok) { - // If this isn't an exception, skip exception sorting and handling - return; - } - status->ones = result->exception_line % 10; - status->ones += status->ones > 0 ? 1 : 0; - status->tens = (result->exception_line / 10) % 10; - status->tens += status->tens > 0 ? 1 : 0; - status->hundreds = (result->exception_line / 100) % 10; - status->hundreds += status->hundreds > 0 ? 1 : 0; - status->thousands = (result->exception_line / 1000) % 10; - status->thousands += status->thousands > 0 ? 1 : 0; - status->digit_sum = status->ones + status->tens + status->hundreds + status->thousands; - uint8_t num_places = 0; - uint16_t line = result->exception_line; - for (int i = 0; i < 4; i++) { - if ((line % 10) > 0) { - num_places++; - } - line /= 10; - } - if (!status->ok) { - status->total_exception_cycle = EXCEPTION_TYPE_LENGTH_MS * 3 + LINE_NUMBER_TOGGLE_LENGTH * status->digit_sum + LINE_NUMBER_TOGGLE_LENGTH * num_places; - } - if (!result->exception_type) { - status->exception_color = OTHER_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_IndentationError)) { - status->exception_color = INDENTATION_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_SyntaxError)) { - status->exception_color = SYNTAX_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_NameError)) { - status->exception_color = NAME_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_OSError)) { - status->exception_color = OS_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_ValueError)) { - status->exception_color = VALUE_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_MpyError)) { - status->exception_color = MPY_ERROR; - } else { - status->exception_color = OTHER_ERROR; - } - #endif -} - -bool tick_rgb_status_animation(rgb_status_animation_t *status) { - #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || (defined(CP_RGB_STATUS_LED)) - uint32_t tick_diff = supervisor_ticks_ms32() - status->pattern_start; - if (status->ok) { - // All is good. Ramp ALL_DONE up and down. - if (tick_diff > ALL_GOOD_CYCLE_MS) { - status->pattern_start = supervisor_ticks_ms32(); - new_status_color(BLACK); - return true; - } - - uint16_t brightness = tick_diff * 255 / (ALL_GOOD_CYCLE_MS / 2); - if (brightness > 255) { - brightness = 511 - brightness; - } - if (status->safe_mode == NO_SAFE_MODE) { - new_status_color(color_brightness(ALL_DONE, brightness)); - } else { - new_status_color(color_brightness(SAFE_MODE, brightness)); - } - } else { - if (tick_diff > status->total_exception_cycle) { - status->pattern_start = supervisor_ticks_ms32(); - return true; - } - // First flash the file color. - if (tick_diff < EXCEPTION_TYPE_LENGTH_MS) { - if (status->found_main) { - new_status_color(MAIN_RUNNING); - } else { - new_status_color(BOOT_RUNNING); - } - // Next flash the exception color. - } else if (tick_diff < EXCEPTION_TYPE_LENGTH_MS * 2) { - new_status_color(status->exception_color); - // Finally flash the line number digits from highest to lowest. - // Zeroes will not produce a flash but can be read by the absence of - // a color from the sequence. - } else if (tick_diff < (EXCEPTION_TYPE_LENGTH_MS * 2 + LINE_NUMBER_TOGGLE_LENGTH * status->digit_sum)) { - uint32_t digit_diff = tick_diff - EXCEPTION_TYPE_LENGTH_MS * 2; - if ((digit_diff % LINE_NUMBER_TOGGLE_LENGTH) < (LINE_NUMBER_TOGGLE_LENGTH / 2)) { - new_status_color(BLACK); - } else if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH * status->thousands) { - if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH) { - new_status_color(BLACK); - } else { - new_status_color(THOUSANDS); - } - } else if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH * (status->thousands + status->hundreds)) { - if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH * (status->thousands + 1)) { - new_status_color(BLACK); - } else { - new_status_color(HUNDREDS); - } - } else if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH * (status->thousands + status->hundreds + status->tens)) { - if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH * (status->thousands + status->hundreds + 1)) { - new_status_color(BLACK); - } else { - new_status_color(TENS); - } - } else { - if (digit_diff < LINE_NUMBER_TOGGLE_LENGTH * (status->thousands + status->hundreds + status->tens + 1)) { - new_status_color(BLACK); - } else { - new_status_color(ONES); - } - } - } else { - new_status_color(BLACK); - } - } - #endif - return false; // Animation is not finished. -} diff --git a/supervisor/shared/rgb_led_status.h b/supervisor/shared/rgb_led_status.h deleted file mode 100644 index 753a1167cb..0000000000 --- a/supervisor/shared/rgb_led_status.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#ifndef MICROPY_INCLUDED_SUPERVISOR_RGB_LED_STATUS_H -#define MICROPY_INCLUDED_SUPERVISOR_RGB_LED_STATUS_H - -#include -#include - -#include "lib/utils/pyexec.h" -#include "supervisor/port.h" - -#include "py/mpconfig.h" -#include "rgb_led_colors.h" - -#include "supervisor/shared/safe_mode.h" - -// Overall, the time module must be implemented. -// To work with a DotStar, one must have MICROPY_HW_APA102_SCK and -// MICROPY_HW_APA102_MOSI defined and bitbangio.SPI or busio.SPI implemented. -// To work with a NeoPixel, one must have MICROPY_HW_NEOPIXEL defined and -// neopixel_write implemented. - -#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) && !CIRCUITPY_BITBANG_APA102 -#include "common-hal/busio/SPI.h" -extern busio_spi_obj_t status_apa102; -#endif - -void rgb_led_status_init(void); -void reset_status_led(void); -void new_status_color(uint32_t rgb); -void temp_status_color(uint32_t rgb); -void clear_temp_status(void); - -uint32_t color_brightness(uint32_t color, uint8_t brightness); -void set_rgb_status_brightness(uint8_t level); - -typedef struct { - bool ok; - uint32_t pattern_start; - uint32_t total_exception_cycle; - safe_mode_t safe_mode; - uint8_t digit_sum; - uint8_t ones; - uint8_t tens; - uint8_t hundreds; - uint8_t thousands; - uint32_t exception_color; - bool found_main; -} rgb_status_animation_t; - -void prep_rgb_status_animation(const pyexec_result_t *result, - bool found_main, - safe_mode_t safe_mode, - rgb_status_animation_t *status); -bool tick_rgb_status_animation(rgb_status_animation_t *status); - -#endif // MICROPY_INCLUDED_SUPERVISOR_RGB_LED_STATUS_H diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 661fd79af8..ba31eac4cb 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -36,7 +36,7 @@ #include "supervisor/serial.h" #include "supervisor/shared/rgb_led_colors.h" -#include "supervisor/shared/rgb_led_status.h" +#include "supervisor/shared/status_leds.h" #include "supervisor/shared/translate.h" #include "supervisor/shared/tick.h" @@ -65,11 +65,9 @@ safe_mode_t wait_for_safe_mode_reset(void) { } port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); // Wait for a while to allow for reset. - temp_status_color(SAFE_MODE); - #ifdef MICROPY_HW_LED_STATUS - digitalio_digitalinout_obj_t status_led; - common_hal_digitalio_digitalinout_construct(&status_led, MICROPY_HW_LED_STATUS); - common_hal_digitalio_digitalinout_switch_to_output(&status_led, true, DRIVE_MODE_PUSH_PULL); + + #if CIRCUITPY_STATUS_LED + status_led_init(); #endif #ifdef CIRCUITPY_BOOT_BUTTON digitalio_digitalinout_obj_t boot_button; @@ -78,22 +76,32 @@ safe_mode_t wait_for_safe_mode_reset(void) { #endif uint64_t start_ticks = supervisor_ticks_ms64(); uint64_t diff = 0; + bool boot_in_safe_mode = false; while (diff < 700) { - #ifdef MICROPY_HW_LED_STATUS + #ifdef CIRCUITPY_STATUS_LED // Blink on for 100, off for 100, on for 100, off for 100 and on for 200 - common_hal_digitalio_digitalinout_set_value(&status_led, diff > 100 && diff / 100 != 2 && diff / 100 != 4); + bool led_on = diff > 100 && diff / 100 != 2 && diff / 100 != 4; + if (led_on) { + new_status_color(SAFE_MODE); + } else { + new_status_color(BLACK); + } #endif #ifdef CIRCUITPY_BOOT_BUTTON if (!common_hal_digitalio_digitalinout_get_value(&boot_button)) { - return USER_SAFE_MODE; + boot_in_safe_mode = true; + break; } #endif diff = supervisor_ticks_ms64() - start_ticks; } - #ifdef MICROPY_HW_LED_STATUS - common_hal_digitalio_digitalinout_deinit(&status_led); + #if CIRCUITPY_STATUS_LED + new_status_color(BLACK); + status_led_deinit(); #endif - clear_temp_status(); + if (boot_in_safe_mode) { + return USER_SAFE_MODE; + } port_set_saved_word(SAFE_MODE_DATA_GUARD); return NO_SAFE_MODE; } diff --git a/supervisor/shared/status_leds.c b/supervisor/shared/status_leds.c index 672242a963..a367aa3086 100644 --- a/supervisor/shared/status_leds.c +++ b/supervisor/shared/status_leds.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2017-2021 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 @@ -26,11 +26,75 @@ #include "supervisor/shared/status_leds.h" -#if CIRCUITPY_DIGITALIO -#include "common-hal/digitalio/DigitalInOut.h" +#include "mphalport.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/shared/tick.h" +#include "py/obj.h" + +#ifdef MICROPY_HW_NEOPIXEL +uint8_t rgb_status_brightness = 63; + #include "shared-bindings/digitalio/DigitalInOut.h" + #include "shared-bindings/neopixel_write/__init__.h" +static uint8_t status_neopixel_color[3]; +static digitalio_digitalinout_obj_t status_neopixel; + +#elif defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) +uint8_t rgb_status_brightness = 50; + + #define APA102_BUFFER_LENGTH 12 +static uint8_t status_apa102_color[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0xff}; + + #if CIRCUITPY_BITBANG_APA102 + #include "shared-bindings/bitbangio/SPI.h" +static bitbangio_spi_obj_t status_apa102 = { + .base = { + .type = &bitbangio_spi_type, + }, +}; + #else + #include "shared-bindings/busio/SPI.h" +busio_spi_obj_t status_apa102 = { + .base = { + .type = &busio_spi_type, + }, +}; + #endif + +#elif CIRCUITPY_PWM_RGB_LED + #include "shared-bindings/pwmio/PWMOut.h" + #include "shared-bindings/microcontroller/Pin.h" + +pwmio_pwmout_obj_t rgb_status_r = { + .base = { + .type = &pwmio_pwmout_type, + }, +}; +pwmio_pwmout_obj_t rgb_status_g = { + .base = { + .type = &pwmio_pwmout_type, + }, +}; +pwmio_pwmout_obj_t rgb_status_b = { + .base = { + .type = &pwmio_pwmout_type, + }, +}; + +uint8_t rgb_status_brightness = 0xFF; + +uint16_t status_rgb_color[3] = { + 0 /* red */, 0 /* green */, 0 /* blue */ +}; +#elif CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_STATUS) #include "shared-bindings/digitalio/DigitalInOut.h" +digitalio_digitalinout_obj_t single_color_led; + +uint8_t rgb_status_brightness = 0xff; #endif +#if CIRCUITPY_DIGITALIO && (defined(MICROPY_HW_LED_RX) || defined(MICROPY_HW_LED_TX)) +#include "shared-bindings/digitalio/DigitalInOut.h" + #ifdef MICROPY_HW_LED_RX digitalio_digitalinout_obj_t rx_led; #endif @@ -38,27 +102,210 @@ digitalio_digitalinout_obj_t rx_led; #ifdef MICROPY_HW_LED_TX digitalio_digitalinout_obj_t tx_led; #endif +#endif -void init_status_leds(void) { - #ifdef MICROPY_HW_LED_RX +#if CIRCUITPY_STATUS_LED +static uint32_t current_status_color = 0; +#endif + +static bool status_led_init_in_progress = false; +void status_led_init() { + if (status_led_init_in_progress) { + // Avoid recursion. + return; + } + status_led_init_in_progress = true; + + #ifdef MICROPY_HW_NEOPIXEL + common_hal_digitalio_digitalinout_construct(&status_neopixel, MICROPY_HW_NEOPIXEL); + common_hal_digitalio_digitalinout_switch_to_output(&status_neopixel, false, DRIVE_MODE_PUSH_PULL); + #elif defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) + #if CIRCUITPY_BITBANG_APA102 + shared_module_bitbangio_spi_construct(&status_apa102, + MICROPY_HW_APA102_SCK, + MICROPY_HW_APA102_MOSI, + NULL); + #else + if (!common_hal_busio_spi_deinited(&status_apa102)) { + common_hal_busio_spi_deinit(&status_apa102); + } + common_hal_busio_spi_construct(&status_apa102, + MICROPY_HW_APA102_SCK, + MICROPY_HW_APA102_MOSI, + NULL); + #endif + #if CIRCUITPY_BITBANG_APA102 + shared_module_bitbangio_spi_try_lock(&status_apa102); + // Use 1MHz for clock rate. Some APA102's are spec'd 800kHz-1200kHz, + // though many can run much faster. bitbang will probably run slower. + shared_module_bitbangio_spi_configure(&status_apa102, 1000000, 0, 0, 8); + #else + common_hal_busio_spi_try_lock(&status_apa102); + common_hal_busio_spi_configure(&status_apa102, 1000000, 0, 0, 8); + #endif + + + #elif CIRCUITPY_PWM_RGB_LED + if (common_hal_mcu_pin_is_free(CIRCUITPY_RGB_STATUS_R)) { + pwmout_result_t red_result = common_hal_pwmio_pwmout_construct(&rgb_status_r, CIRCUITPY_RGB_STATUS_R, 0, 50000, false); + + if (PWMOUT_OK == red_result) { + common_hal_pwmio_pwmout_never_reset(&rgb_status_r); + } + } + + if (common_hal_mcu_pin_is_free(CIRCUITPY_RGB_STATUS_G)) { + pwmout_result_t green_result = common_hal_pwmio_pwmout_construct(&rgb_status_g, CIRCUITPY_RGB_STATUS_G, 0, 50000, false); + + if (PWMOUT_OK == green_result) { + common_hal_pwmio_pwmout_never_reset(&rgb_status_g); + } + } + + if (common_hal_mcu_pin_is_free(CIRCUITPY_RGB_STATUS_B)) { + pwmout_result_t blue_result = common_hal_pwmio_pwmout_construct(&rgb_status_b, CIRCUITPY_RGB_STATUS_B, 0, 50000, false); + + if (PWMOUT_OK == blue_result) { + common_hal_pwmio_pwmout_never_reset(&rgb_status_b); + } + } + + #elif defined(MICROPY_HW_LED_STATUS) + common_hal_digitalio_digitalinout_construct(&single_color_led, MICROPY_HW_LED_STATUS); + common_hal_digitalio_digitalinout_switch_to_output(&single_color_led, true, DRIVE_MODE_PUSH_PULL); + #endif + + #if CIRCUITPY_DIGITALIO && CIRCUITPY_STATUS_LED + // Force a write of the current status color. + uint32_t rgb = current_status_color; + current_status_color = 0x1000000; // Not a valid color + new_status_color(rgb); + #endif + + status_led_init_in_progress = false; +} + +void status_led_deinit() { + #ifdef MICROPY_HW_NEOPIXEL + common_hal_reset_pin(MICROPY_HW_NEOPIXEL); + + #elif defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) + #if CIRCUITPY_BITBANG_APA102 + shared_module_bitbangio_spi_deinit(&status_apa102); + #else + common_hal_busio_spi_deinit(&status_apa102); + #endif + + #elif CIRCUITPY_PWM_RGB_LED + if (!common_hal_mcu_pin_is_free(CIRCUITPY_RGB_STATUS_R)) { + common_hal_pwmio_pwmout_deinit(&rgb_status_r); + } + + if (!common_hal_mcu_pin_is_free(CIRCUITPY_RGB_STATUS_G)) { + common_hal_pwmio_pwmout_deinit(&rgb_status_g); + } + + if (!common_hal_mcu_pin_is_free(CIRCUITPY_RGB_STATUS_B)) { + common_hal_pwmio_pwmout_deinit(&rgb_status_b); + } + + #elif defined(MICROPY_HW_LED_STATUS) + common_hal_digitalio_digitalinout_deinit(&single_color_led); + #endif +} + +void new_status_color(uint32_t rgb) { + #if CIRCUITPY_STATUS_LED + if (current_status_color == rgb) { + return; + } + uint32_t rgb_adjusted = color_brightness(rgb, rgb_status_brightness); + current_status_color = rgb; + #endif + + #ifdef MICROPY_HW_NEOPIXEL + status_neopixel_color[0] = (rgb_adjusted >> 8) & 0xff; + status_neopixel_color[1] = (rgb_adjusted >> 16) & 0xff; + status_neopixel_color[2] = rgb_adjusted & 0xff; + common_hal_neopixel_write(&status_neopixel, status_neopixel_color, 3); + + #elif defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) + status_apa102_color[5] = rgb_adjusted & 0xff; + status_apa102_color[6] = (rgb_adjusted >> 8) & 0xff; + status_apa102_color[7] = (rgb_adjusted >> 16) & 0xff; + + #if CIRCUITPY_BITBANG_APA102 + shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); + #else + common_hal_busio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); + #endif + + #elif CIRCUITPY_PWM_RGB_LED + uint8_t red_u8 = (rgb_adjusted >> 16) & 0xFF; + uint8_t green_u8 = (rgb_adjusted >> 8) & 0xFF; + uint8_t blue_u8 = rgb_adjusted & 0xFF; + + #ifdef CIRCUITPY_RGB_STATUS_INVERTED_PWM + status_rgb_color[0] = (1 << 16) - 1 - ((uint16_t)(red_u8 << 8) + red_u8); + status_rgb_color[1] = (1 << 16) - 1 - ((uint16_t)(green_u8 << 8) + green_u8); + status_rgb_color[2] = (1 << 16) - 1 - ((uint16_t)(blue_u8 << 8) + blue_u8); + #else + status_rgb_color[0] = (uint16_t)(red_u8 << 8) + red_u8; + status_rgb_color[1] = (uint16_t)(green_u8 << 8) + green_u8; + status_rgb_color[2] = (uint16_t)(blue_u8 << 8) + blue_u8; + #endif + + common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_r, status_rgb_color[0]); + common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_g, status_rgb_color[1]); + common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_b, status_rgb_color[2]); + #elif CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_STATUS) + common_hal_digitalio_digitalinout_set_value(&single_color_led, rgb_adjusted > 0); + #endif +} + +uint32_t color_brightness(uint32_t color, uint8_t brightness) { + #if CIRCUITPY_STATUS_LED + uint32_t result = ((color & 0xff0000) * brightness / 255) & 0xff0000; + result += ((color & 0xff00) * brightness / 255) & 0xff00; + result += ((color & 0xff) * brightness / 255) & 0xff; + return result; + #else + return color; + #endif +} + +void set_status_brightness(uint8_t level) { + #if CIRCUITPY_STATUS_LED + rgb_status_brightness = level; + uint32_t current_color = current_status_color; + // Temporarily change the current color global to force the new_status_color call to update the + // LED. Usually duplicate calls of the same color are ignored without regard to brightness + // changes. + current_status_color = 0; + new_status_color(current_color); + #endif +} + +void init_rxtx_leds(void) { + #if CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_RX) common_hal_digitalio_digitalinout_construct(&rx_led, MICROPY_HW_LED_RX); common_hal_digitalio_digitalinout_switch_to_output(&rx_led, true, DRIVE_MODE_PUSH_PULL); #endif - #ifdef MICROPY_HW_LED_TX + #if CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_TX) common_hal_digitalio_digitalinout_construct(&tx_led, MICROPY_HW_LED_TX); common_hal_digitalio_digitalinout_switch_to_output(&tx_led, true, DRIVE_MODE_PUSH_PULL); #endif } void toggle_rx_led(void) { - #ifdef MICROPY_HW_LED_RX + #if CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_RX) common_hal_digitalio_digitalinout_set_value(&rx_led, !common_hal_digitalio_digitalinout_get_value(&rx_led)); #endif } void toggle_tx_led(void) { - #ifdef MICROPY_HW_LED_TX + #if CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_TX) common_hal_digitalio_digitalinout_set_value(&tx_led, !common_hal_digitalio_digitalinout_get_value(&tx_led)); #endif } diff --git a/supervisor/shared/status_leds.h b/supervisor/shared/status_leds.h index 30132753f3..4a55922845 100644 --- a/supervisor/shared/status_leds.h +++ b/supervisor/shared/status_leds.h @@ -27,10 +27,35 @@ #ifndef MICROPY_INCLUDED_SUPERVISOR_STATUS_LEDS_H #define MICROPY_INCLUDED_SUPERVISOR_STATUS_LEDS_H -void init_status_leds(void); +#include +#include +#include "lib/utils/pyexec.h" +#include "supervisor/port.h" + +#include "py/mpconfig.h" +#include "rgb_led_colors.h" + +#include "supervisor/shared/safe_mode.h" + +// Overall, the time module must be implemented. +// To work with a DotStar, one must have MICROPY_HW_APA102_SCK and +// MICROPY_HW_APA102_MOSI defined and bitbangio.SPI or busio.SPI implemented. +// To work with a NeoPixel, one must have MICROPY_HW_NEOPIXEL defined and +// neopixel_write implemented. + +#define CIRCUITPY_PWM_RGB_LED defined(CIRCUITPY_RGB_STATUS_R) || defined(CIRCUITPY_RGB_STATUS_G) || defined(CIRCUITPY_RGB_STATUS_B) +#define CIRCUITPY_STATUS_LED (CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_STATUS)) || defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) || CIRCUITPY_PWM_RGB_LED + +void status_led_init(void); +void status_led_deinit(void); +void new_status_color(uint32_t rgb); + +uint32_t color_brightness(uint32_t color, uint8_t brightness); +void set_status_brightness(uint8_t level); + +void init_rxtx_leds(void); void toggle_rx_led(void); - void toggle_tx_led(void); #endif // MICROPY_INCLUDED_SUPERVISOR_STATUS_LEDS_H diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 1ca937cdab..0815a9ffc4 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -9,7 +9,6 @@ SRC_SUPERVISOR = \ supervisor/shared/flash.c \ supervisor/shared/memory.c \ supervisor/shared/micropython.c \ - supervisor/shared/rgb_led_status.c \ supervisor/shared/safe_mode.c \ supervisor/shared/stack.c \ supervisor/shared/status_leds.c \ From c931e5deb729791b3aa7eab90161f193eabf04cc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 14 May 2021 10:20:35 -0500 Subject: [PATCH 02/40] Add build_memory_info for esp32s2 This detects an overflowed flash partition, such as ``` 1452105 bytes used, -10313 bytes free in flash firmware space out of 1441792 bytes (1408.0kB). 444428 bytes used, 1652724 bytes free in ram for stack and heap out of 2097152 bytes (2048.0kB). ``` on a metro esp32-s2 built with debugging. --- ports/esp32s2/.gitignore | 2 +- ports/esp32s2/Makefile | 2 +- ports/esp32s2/tools/build_memory_info.py | 81 ++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 ports/esp32s2/tools/build_memory_info.py diff --git a/ports/esp32s2/.gitignore b/ports/esp32s2/.gitignore index 4bfc5e7845..2e3080a40d 100644 --- a/ports/esp32s2/.gitignore +++ b/ports/esp32s2/.gitignore @@ -1,2 +1,2 @@ -build* +build*/ sdkconfig.old diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 590750afcf..1d981cb42f 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -316,7 +316,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group build-$(BOARD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception - # $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld + $(Q)$(SIZE) $@ | $(PYTHON3) tools/build_memory_info.py $(BUILD)/esp-idf/sdkconfig $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/esp32s2/tools/build_memory_info.py b/ports/esp32s2/tools/build_memory_info.py new file mode 100644 index 0000000000..cf42851320 --- /dev/null +++ b/ports/esp32s2/tools/build_memory_info.py @@ -0,0 +1,81 @@ +#!/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) +# +# SPDX-License-Identifier: MIT + +import re +import sys + +# Handle size constants with K or M suffixes (allowed in .ld but not in Python). +K_PATTERN = re.compile(r"([0-9]+)[kK]") +K_REPLACE = r"(\1*1024)" + +M_PATTERN = re.compile(r"([0-9]+)[mM]") +M_REPLACE = r"(\1*1024*1024)" + +print() + +text = 0 +data = 0 +bss = 0 +# stdin is the linker output. +for line in sys.stdin: + # Uncomment to see linker output. + # print(line) + line = line.strip() + if not line.startswith("text"): + text, data, bss = map(int, line.split()[:3]) + + +def partition_size(arg): + if "4MB" in arg: + return "1408K" + else: + return "2048K" + + +regions = {} +# This file is the linker script. +with open(sys.argv[1], "r") as f: + for line in f: + line = line.strip() + if line.startswith("CONFIG_SPIRAM_SIZE"): + regions["RAM"] = line.split("=")[-1] + if line.startswith("CONFIG_PARTITION_TABLE_FILENAME"): + regions["FLASH_FIRMWARE"] = partition_size(line.split("=")[-1]) + +for region in regions: + space = regions[region] + if "/*" in space: + space = space.split("/*")[0] + space = K_PATTERN.sub(K_REPLACE, space) + space = M_PATTERN.sub(M_REPLACE, space) + regions[region] = int(eval(space)) + +firmware_region = regions["FLASH_FIRMWARE"] +ram_region = regions["RAM"] + +used_flash = data + text +free_flash = firmware_region - used_flash +used_ram = data + bss +free_ram = ram_region - used_ram +print( + "{} bytes used, {} bytes free in flash firmware space out of {} bytes ({}kB).".format( + used_flash, free_flash, firmware_region, firmware_region / 1024 + ) +) +print( + "{} bytes used, {} bytes free in ram for stack and heap out of {} bytes ({}kB).".format( + used_ram, free_ram, ram_region, ram_region / 1024 + ) +) +print() + +# Check that we have free flash space. GCC doesn't fail when the text + data +# sections don't fit in FLASH. It only counts data in RAM. +if free_flash < 0: + print("Too little flash!!!") + print() + sys.exit(-1) From 5c33c9d597c364bd2a3f4bfc418c2cf3b561e76e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 13 May 2021 11:04:07 -0700 Subject: [PATCH 03/40] Fix SAMD RTC needed to wait for sync. NeoPixel on SAMD doesn't need disabled caches. It just needed timing adjustment for 120mhz clock speed. --- main.c | 9 ++--- .../boards/feather_m4_express/mpconfigboard.h | 2 +- .../common-hal/neopixel_write/__init__.c | 39 +++---------------- ports/atmel-samd/supervisor/port.c | 20 ++++++++-- .../feather_nrf52840_express/mpconfigboard.h | 2 +- 5 files changed, 28 insertions(+), 44 deletions(-) diff --git a/main.c b/main.c index 78303e1235..1caeb12e2f 100755 --- a/main.c +++ b/main.c @@ -485,11 +485,10 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { time_to_next_change = MIN(time_to_next_change, time_to_epaper_refresh); } #endif - if (time_to_next_change > 0) { - // time_to_next_change is in ms and ticks are slightly shorter so - // we'll undersleep just a little. It shouldn't matter. - port_interrupt_after_ticks(time_to_next_change); - } + + // time_to_next_change is in ms and ticks are slightly shorter so + // we'll undersleep just a little. It shouldn't matter. + port_interrupt_after_ticks(time_to_next_change); #endif port_idle_until_interrupt(); } diff --git a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.h index a57b18e24a..ef4a556227 100644 --- a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.h @@ -12,7 +12,7 @@ // QSPI Data pins #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) // QSPI CS, QSPI SCK and NeoPixel pin -#define MICROPY_PORT_B (PORT_PB03 | PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) diff --git a/ports/atmel-samd/common-hal/neopixel_write/__init__.c b/ports/atmel-samd/common-hal/neopixel_write/__init__.c index 4677437f90..754bc97fdf 100644 --- a/ports/atmel-samd/common-hal/neopixel_write/__init__.c +++ b/ports/atmel-samd/common-hal/neopixel_write/__init__.c @@ -60,7 +60,7 @@ static void neopixel_send_buffer_core(volatile uint32_t *clraddr, uint32_t pinMa " movs r6, #3; d2: sub r6, #1; bne d2;" // delay 3 #endif #ifdef SAM_D5X_E5X - " movs r6, #3; d2: subs r6, #1; bne d2;" // delay 3 + " movs r6, #16; d2: subs r6, #1; bne d2;" // delay 3 #endif " tst r4, r5;" // mask&r5 " bne skipclr;" @@ -70,7 +70,7 @@ static void neopixel_send_buffer_core(volatile uint32_t *clraddr, uint32_t pinMa " movs r6, #6; d0: sub r6, #1; bne d0;" // delay 6 #endif #ifdef SAM_D5X_E5X - " movs r6, #6; d0: subs r6, #1; bne d0;" // delay 6 + " movs r6, #16; d0: subs r6, #1; bne d0;" // delay 6 #endif " str r1, [r0, #0];" // clr (possibly again, doesn't matter) #ifdef SAMD21 @@ -85,10 +85,13 @@ static void neopixel_send_buffer_core(volatile uint32_t *clraddr, uint32_t pinMa " movs r6, #2; d1: sub r6, #1; bne d1;" // delay 2 #endif #ifdef SAM_D5X_E5X - " movs r6, #2; d1: subs r6, #1; bne d1;" // delay 2 + " movs r6, #15; d1: subs r6, #1; bne d1;" // delay 2 #endif " b loopBit;" "nextbyte:" + #ifdef SAM_D5X_E5X + " movs r6, #12; d3: subs r6, #1; bne d3;" // delay 2 + #endif " cmp r2, r3;" " bcs neopixel_stop;" " b loopLoad;" @@ -114,42 +117,12 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout, // Turn off interrupts of any kind during timing-sensitive code. mp_hal_disable_all_interrupts(); - - #ifdef SAM_D5X_E5X - // When this routine is positioned at certain addresses, the timing logic - // below can be too fast by about 2.5x. This is some kind of (un)fortunate code - // positioning with respect to a cache line. - // Theoretically we should turn on off the CMCC caches and the - // NVM caches to ensure consistent timing. Testing shows the the NVMCTRL - // cache disabling seems to make the difference. But turn both off to make sure. - // It's difficult to test because additions to the code before the timing loop - // below change instruction placement. (though this should be less true now that - // the main code is in the cache-aligned function neopixel_send_buffer_core) - // Testing was done by adding cache changes below the loop (so only the - // first time through is wrong). - // - // Turn off instruction, data, and NVM caches to force consistent timing. - // Invalidate existing cache entries. - hri_cmcc_set_CFG_reg(CMCC, CMCC_CFG_DCDIS | CMCC_CFG_ICDIS); - hri_cmcc_write_MAINT0_reg(CMCC, CMCC_MAINT0_INVALL); - hri_nvmctrl_set_CTRLA_CACHEDIS0_bit(NVMCTRL); - hri_nvmctrl_set_CTRLA_CACHEDIS1_bit(NVMCTRL); - #endif - uint32_t pin = digitalinout->pin->number; port = &PORT->Group[GPIO_PORT(pin)]; // Convert GPIO # to port register pinMask = (1UL << (pin % 32)); // From port_pin_set_output_level ASF code. volatile uint32_t *clr = &(port->OUTCLR.reg); neopixel_send_buffer_core(clr, pinMask, pixels, numBytes); - #ifdef SAM_D5X_E5X - // Turn instruction, data, and NVM caches back on. - hri_cmcc_clear_CFG_reg(CMCC, CMCC_CFG_DCDIS | CMCC_CFG_ICDIS); - hri_nvmctrl_clear_CTRLA_CACHEDIS0_bit(NVMCTRL); - hri_nvmctrl_clear_CTRLA_CACHEDIS1_bit(NVMCTRL); - - #endif - // Update the next start. next_start_raw_ticks = port_get_raw_ticks(NULL) + 4; diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 15112f5ba7..0ba6019e07 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -462,6 +462,8 @@ static uint32_t _get_count(uint64_t *overflow_count) { return count; } +volatile bool _woken_up; + static void _port_interrupt_after_ticks(uint32_t ticks) { uint32_t current_ticks = _get_count(NULL); if (ticks > 1 << 28) { @@ -473,9 +475,16 @@ static void _port_interrupt_after_ticks(uint32_t ticks) { return; } #endif - RTC->MODE0.COMP[0].reg = current_ticks + (ticks << 4); + uint32_t target = current_ticks + (ticks << 4); + RTC->MODE0.COMP[0].reg = target; + #ifdef SAM_D5X_E5X + while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COMP0)) != 0) { + } + #endif RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0; RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0; + current_ticks = _get_count(NULL); + _woken_up = current_ticks >= target; } void RTC_Handler(void) { @@ -485,15 +494,18 @@ void RTC_Handler(void) { // Our RTC is 32 bits and we're clocking it at 16.384khz which is 16 (2 ** 4) subticks per // tick. overflowed_ticks += (1L << (32 - 4)); + } #ifdef SAM_D5X_E5X - } else if (intflag & RTC_MODE0_INTFLAG_PER2) { + if (intflag & RTC_MODE0_INTFLAG_PER2) { RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_PER2; // Do things common to all ports when the tick occurs supervisor_tick(); + } #endif - } else if (intflag & RTC_MODE0_INTFLAG_CMP0) { + if (intflag & RTC_MODE0_INTFLAG_CMP0) { // Clear the interrupt because we may have hit a sleep and _ticks_enabled RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0; + _woken_up = true; #ifdef SAMD21 if (_ticks_enabled) { // Do things common to all ports when the tick occurs. @@ -565,7 +577,7 @@ void port_idle_until_interrupt(void) { } #endif common_hal_mcu_disable_interrupts(); - if (!tud_task_event_ready() && !hold_interrupt) { + if (!tud_task_event_ready() && !hold_interrupt && !_woken_up) { __DSB(); __WFI(); } diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h index 8e4cd2287a..64988e1a28 100644 --- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h +++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h @@ -30,7 +30,7 @@ #define MICROPY_HW_BOARD_NAME "Adafruit Feather nRF52840 Express" #define MICROPY_HW_MCU_NAME "nRF52840" -// #define MICROPY_HW_NEOPIXEL (&pin_P0_16) +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) #define MICROPY_HW_LED_STATUS (&pin_P1_15) From 6164d44e6d0a9b30320dca48811fd29614cd6b44 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 18 May 2021 11:32:45 -0700 Subject: [PATCH 04/40] Turn off LED after REPL --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index 1caeb12e2f..979070ebe3 100755 --- a/main.c +++ b/main.c @@ -647,6 +647,11 @@ STATIC int run_repl(void) { exit_code = pyexec_friendly_repl(); } cleanup_after_vm(heap); + #if CIRCUITPY_STATUS_LED + status_led_init(); + new_status_color(BLACK); + status_led_deinit(); + #endif autoreload_resume(); return exit_code; } From 642fbcf87ad85bbc3be52890e6267f821d9eb752 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 18 May 2021 15:56:37 -0700 Subject: [PATCH 05/40] Handle status led power This no longer turns on status LED power before running user code. Therefore, use of the status LED on some boards will also have to enable the power. --- main.c | 28 +++++++++++++------ .../boards/feather_m4_can/mpconfigboard.h | 5 ++-- ports/atmel-samd/boards/qtpy_m0/board.c | 7 ----- .../atmel-samd/boards/qtpy_m0/mpconfigboard.h | 1 + .../boards/qtpy_m0_haxpress/board.c | 7 ----- .../boards/qtpy_m0_haxpress/mpconfigboard.h | 1 + .../mpconfigboard.h | 1 + .../mpconfigboard.h | 1 + .../mpconfigboard.h | 1 + .../unexpectedmaker_tinys2/mpconfigboard.h | 1 + .../boards/adafruit_itsybitsy_rp2040/board.c | 7 ----- .../adafruit_itsybitsy_rp2040/mpconfigboard.h | 1 + .../boards/adafruit_qtpy_rp2040/board.c | 7 ----- .../adafruit_qtpy_rp2040/mpconfigboard.h | 1 + supervisor/shared/status_leds.c | 15 ++++++++++ 15 files changed, 46 insertions(+), 38 deletions(-) diff --git a/main.c b/main.c index 979070ebe3..6cf524edbb 100755 --- a/main.c +++ b/main.c @@ -338,6 +338,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { #if CIRCUITPY_STATUS_LED uint32_t color; uint8_t blink_count; + bool led_active = false; #if CIRCUITPY_ALARM if (result.return_code & PYEXEC_DEEP_SLEEP) { color = BLACK; @@ -360,9 +361,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { size_t single_blink_time = (OFF_ON_RATIO + 1) * BLINK_TIME_MS; size_t blink_time = single_blink_time * blink_count; size_t total_time = blink_time + LED_SLEEP_TIME_MS; - if (blink_count > 0) { - status_led_init(); - } #endif #if CIRCUITPY_ALARM @@ -432,7 +430,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { common_hal_alarm_pretending_deep_sleep(); } else if (connecting_delay_ticks < 0) { // Entering deep sleep (may be fake or real.) - new_status_color(BLACK); board_deinit(); if (!supervisor_workflow_active()) { // Enter true deep sleep. When we wake up we'll be back at the @@ -469,15 +466,28 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (tick_diff < blink_time) { uint32_t blink_diff = tick_diff % (single_blink_time); if (blink_diff >= BLINK_TIME_MS) { - new_status_color(BLACK); + if (led_active) { + new_status_color(BLACK); + status_led_deinit(); + led_active = false; + } time_to_next_change = single_blink_time - blink_diff; } else { - new_status_color(color); + if (!led_active) { + status_led_init(); + new_status_color(color); + led_active = true; + } time_to_next_change = BLINK_TIME_MS - blink_diff; } } else if (tick_diff > total_time) { pattern_start = supervisor_ticks_ms32(); } else { + if (led_active) { + new_status_color(BLACK); + status_led_deinit(); + led_active = false; + } time_to_next_change = total_time - tick_diff; } #if CIRCUITPY_DISPLAYIO @@ -495,8 +505,10 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { } // Done waiting, start the board back up. #if CIRCUITPY_STATUS_LED - new_status_color(BLACK); - status_led_deinit(); + if (led_active) { + new_status_color(BLACK); + status_led_deinit(); + } #endif #if CIRCUITPY_ALARM diff --git a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.h b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.h index 20c4670e25..4cf4c57859 100644 --- a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.h +++ b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.h @@ -6,13 +6,14 @@ // Rev E #define MICROPY_HW_LED_STATUS (&pin_PA23) -#define MICROPY_HW_NEOPIXEL (&pin_PB03) +#define MICROPY_HW_NEOPIXEL (&pin_PB02) +#define CIRCUITPY_STATUS_LED_POWER (&pin_PB03) // These are pins not to reset. // QSPI Data pins #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) // QSPI CS, QSPI SCK and NeoPixel pin -#define MICROPY_PORT_B (PORT_PB03 | PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) diff --git a/ports/atmel-samd/boards/qtpy_m0/board.c b/ports/atmel-samd/boards/qtpy_m0/board.c index 6b948a9a7a..84960e73cf 100644 --- a/ports/atmel-samd/boards/qtpy_m0/board.c +++ b/ports/atmel-samd/boards/qtpy_m0/board.c @@ -25,15 +25,8 @@ */ #include "supervisor/board.h" -#include "common-hal/microcontroller/Pin.h" -#include "supervisor/shared/board.h" -#include "hal/include/hal_gpio.h" void board_init(void) { - gpio_set_pin_function(PIN_PA15, GPIO_PIN_FUNCTION_OFF); - gpio_set_pin_direction(PIN_PA15, GPIO_DIRECTION_OUT); - gpio_set_pin_level(PIN_PA15, true); // Turn on neopixel by default - never_reset_pin_number(PIN_PA15); } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.h b/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.h index 713d2c03eb..305a9b55f6 100644 --- a/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.h +++ b/ports/atmel-samd/boards/qtpy_m0/mpconfigboard.h @@ -2,6 +2,7 @@ #define MICROPY_HW_MCU_NAME "samd21e18" #define MICROPY_HW_NEOPIXEL (&pin_PA18) +#define CIRCUITPY_STATUS_LED_POWER (&pin_PA15) #define MICROPY_PORT_A (0) #define MICROPY_PORT_B (0) diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c index 6b948a9a7a..84960e73cf 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c @@ -25,15 +25,8 @@ */ #include "supervisor/board.h" -#include "common-hal/microcontroller/Pin.h" -#include "supervisor/shared/board.h" -#include "hal/include/hal_gpio.h" void board_init(void) { - gpio_set_pin_function(PIN_PA15, GPIO_PIN_FUNCTION_OFF); - gpio_set_pin_direction(PIN_PA15, GPIO_DIRECTION_OUT); - gpio_set_pin_level(PIN_PA15, true); // Turn on neopixel by default - never_reset_pin_number(PIN_PA15); } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.h b/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.h index 4e557751fc..c3434e22f0 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.h +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.h @@ -2,6 +2,7 @@ #define MICROPY_HW_MCU_NAME "samd21e18" #define MICROPY_HW_NEOPIXEL (&pin_PA18) +#define CIRCUITPY_STATUS_LED_POWER (&pin_PA15) #define MICROPY_PORT_A (0) #define MICROPY_PORT_B (0) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h index a04065d25b..d2cd01a681 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h @@ -30,6 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h index a04065d25b..d2cd01a681 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -30,6 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index 4d3e8c0972..b227fb01b3 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -30,6 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) diff --git a/ports/esp32s2/boards/unexpectedmaker_tinys2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_tinys2/mpconfigboard.h index e7d50f0894..64ef084ccd 100644 --- a/ports/esp32s2/boards/unexpectedmaker_tinys2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_tinys2/mpconfigboard.h @@ -30,6 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO2) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") diff --git a/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c b/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c index e05589883d..67486d4c23 100644 --- a/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c @@ -26,14 +26,7 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - void board_init(void) { - common_hal_never_reset_pin(&pin_GPIO16); - gpio_init(16); - gpio_set_dir(16, GPIO_OUT); - gpio_put(16, true); } bool board_requests_safe_mode(void) { diff --git a/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/mpconfigboard.h index dad4e2eae8..131ddc8cee 100644 --- a/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/mpconfigboard.h @@ -2,6 +2,7 @@ #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_NEOPIXEL (&pin_GPIO17) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO16) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) diff --git a/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c b/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c index 332145ab84..67486d4c23 100644 --- a/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c @@ -26,14 +26,7 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - void board_init(void) { - common_hal_never_reset_pin(&pin_GPIO11); - gpio_init(11); - gpio_set_dir(11, GPIO_OUT); - gpio_put(11, true); } bool board_requests_safe_mode(void) { diff --git a/ports/raspberrypi/boards/adafruit_qtpy_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_qtpy_rp2040/mpconfigboard.h index a1947deaeb..5d3795dd5d 100644 --- a/ports/raspberrypi/boards/adafruit_qtpy_rp2040/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_qtpy_rp2040/mpconfigboard.h @@ -2,6 +2,7 @@ #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_NEOPIXEL (&pin_GPIO12) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO11) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO25) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO24) diff --git a/supervisor/shared/status_leds.c b/supervisor/shared/status_leds.c index a367aa3086..386dba5387 100644 --- a/supervisor/shared/status_leds.c +++ b/supervisor/shared/status_leds.c @@ -31,6 +31,12 @@ #include "supervisor/shared/tick.h" #include "py/obj.h" + +#ifdef CIRCUITPY_STATUS_LED_POWER +#include "shared-bindings/digitalio/DigitalInOut.h" +static digitalio_digitalinout_obj_t _status_power; +#endif + #ifdef MICROPY_HW_NEOPIXEL uint8_t rgb_status_brightness = 63; #include "shared-bindings/digitalio/DigitalInOut.h" @@ -116,6 +122,11 @@ void status_led_init() { } status_led_init_in_progress = true; + #ifdef CIRCUITPY_STATUS_LED_POWER + common_hal_digitalio_digitalinout_construct(&_status_power, CIRCUITPY_STATUS_LED_POWER); + common_hal_digitalio_digitalinout_switch_to_output(&_status_power, true, DRIVE_MODE_PUSH_PULL); + #endif + #ifdef MICROPY_HW_NEOPIXEL common_hal_digitalio_digitalinout_construct(&status_neopixel, MICROPY_HW_NEOPIXEL); common_hal_digitalio_digitalinout_switch_to_output(&status_neopixel, false, DRIVE_MODE_PUSH_PULL); @@ -212,6 +223,10 @@ void status_led_deinit() { #elif defined(MICROPY_HW_LED_STATUS) common_hal_digitalio_digitalinout_deinit(&single_color_led); #endif + + #ifdef CIRCUITPY_STATUS_LED_POWER + common_hal_digitalio_digitalinout_deinit(&_status_power); + #endif } void new_status_color(uint32_t rgb) { From b78e9fcd19e1ea7d99f6e2527cb8732b02f6abce Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 May 2021 11:48:02 -0700 Subject: [PATCH 06/40] Improve STM reset reason This causes safe mode to skip the wait for reset when waking up from an alarm. (It also means we don't flash the LED for it.) --- ports/stm/common-hal/alarm/__init__.c | 11 +++++++---- ports/stm/common-hal/alarm/__init__.h | 1 + ports/stm/common-hal/microcontroller/Processor.c | 8 ++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ports/stm/common-hal/alarm/__init__.c b/ports/stm/common-hal/alarm/__init__.c index e0b900bbfc..3307d8775c 100644 --- a/ports/stm/common-hal/alarm/__init__.c +++ b/ports/stm/common-hal/alarm/__init__.c @@ -64,7 +64,7 @@ void alarm_set_wakeup_reason(stm_sleep_source_t reason) { true_deep_wake_reason = reason; } -STATIC stm_sleep_source_t _get_wakeup_cause(void) { +stm_sleep_source_t alarm_get_wakeup_cause(void) { // If in light/fake sleep, check modules if (alarm_pin_pinalarm_woke_us_up()) { return STM_WAKEUP_GPIO; @@ -73,18 +73,18 @@ STATIC stm_sleep_source_t _get_wakeup_cause(void) { return STM_WAKEUP_RTC; } // Check to see if we woke from deep sleep (reason set in port_init) - if (true_deep_wake_reason) { + if (true_deep_wake_reason != STM_WAKEUP_UNDEF) { return true_deep_wake_reason; } return STM_WAKEUP_UNDEF; } bool common_hal_alarm_woken_from_sleep(void) { - return _get_wakeup_cause() != STM_WAKEUP_UNDEF; + return alarm_get_wakeup_cause() != STM_WAKEUP_UNDEF; } STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { - stm_sleep_source_t cause = _get_wakeup_cause(); + stm_sleep_source_t cause = alarm_get_wakeup_cause(); switch (cause) { case STM_WAKEUP_RTC: { return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms); @@ -156,6 +156,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala } void NORETURN common_hal_alarm_enter_deep_sleep(void) { + alarm_set_wakeup_reason(STM_WAKEUP_UNDEF); alarm_pin_pinalarm_prepare_for_deep_sleep(); alarm_time_timealarm_prepare_for_deep_sleep(); port_disable_tick(); @@ -182,6 +183,8 @@ void common_hal_alarm_pretending_deep_sleep(void) { GPIO_InitStruct.Pull = GPIO_PULLDOWN; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + alarm_set_wakeup_reason(STM_WAKEUP_UNDEF); + port_idle_until_interrupt(); } diff --git a/ports/stm/common-hal/alarm/__init__.h b/ports/stm/common-hal/alarm/__init__.h index 4ec7222d2e..6c72364fc3 100644 --- a/ports/stm/common-hal/alarm/__init__.h +++ b/ports/stm/common-hal/alarm/__init__.h @@ -40,6 +40,7 @@ typedef enum { #define STM_ALARM_FLAG (RTC->BKP0R) extern void alarm_set_wakeup_reason(stm_sleep_source_t reason); +stm_sleep_source_t alarm_get_wakeup_cause(void); extern void alarm_reset(void); #endif // MICROPY_INCLUDED_STM32_COMMON_HAL_ALARM__INIT__H diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c index b33d96e736..13c661a60a 100644 --- a/ports/stm/common-hal/microcontroller/Processor.c +++ b/ports/stm/common-hal/microcontroller/Processor.c @@ -27,6 +27,9 @@ #include #include "py/runtime.h" +#if CIRCUITPY_ALARM +#include "common-hal/alarm/__init__.h" +#endif #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" @@ -143,5 +146,10 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { } mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + #if CIRCUITPY_ALARM + if (alarm_get_wakeup_cause() != STM_WAKEUP_UNDEF) { + return RESET_REASON_DEEP_SLEEP_ALARM; + } + #endif return RESET_REASON_UNKNOWN; } From 499a4388cf4fe8097107c89cddbede103c18491c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 May 2021 17:29:02 -0700 Subject: [PATCH 07/40] Handle inverted neopixel power --- .../boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h | 1 + ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 1 + py/circuitpy_mpconfig.h | 4 ++++ supervisor/shared/status_leds.c | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index b227fb01b3..d0d1864993 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -31,6 +31,7 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define CIRCUITPY_STATUS_LED_POWER_INVERTED (1) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 1fb1f11945..990cfd9957 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -44,6 +44,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER_INVERTED), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 18a1480a10..c71cad6aeb 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -991,6 +991,10 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_PROCESSOR_COUNT (1) #endif +#ifndef CIRCUITPY_STATUS_LED_POWER_INVERTED +#define CIRCUITPY_STATUS_LED_POWER_INVERTED (0) +#endif + #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_VERBOSE_BLE 0 diff --git a/supervisor/shared/status_leds.c b/supervisor/shared/status_leds.c index 386dba5387..e8b0983d9b 100644 --- a/supervisor/shared/status_leds.c +++ b/supervisor/shared/status_leds.c @@ -124,7 +124,8 @@ void status_led_init() { #ifdef CIRCUITPY_STATUS_LED_POWER common_hal_digitalio_digitalinout_construct(&_status_power, CIRCUITPY_STATUS_LED_POWER); - common_hal_digitalio_digitalinout_switch_to_output(&_status_power, true, DRIVE_MODE_PUSH_PULL); + common_hal_digitalio_digitalinout_switch_to_output(&_status_power, + CIRCUITPY_STATUS_LED_POWER_INVERTED == 0, DRIVE_MODE_PUSH_PULL); #endif #ifdef MICROPY_HW_NEOPIXEL From dbc0118f9ab96f7f62ef7329eb2d9d8027c58847 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 20 May 2021 04:41:56 +0200 Subject: [PATCH 08/40] 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 | 6 +++++- locale/cs.po | 6 +++++- locale/de_DE.po | 6 +++++- locale/el.po | 6 +++++- locale/en_GB.po | 6 +++++- locale/es.po | 9 +++++++-- locale/fil.po | 6 +++++- locale/fr.po | 6 +++++- locale/hi.po | 6 +++++- locale/it_IT.po | 6 +++++- locale/ja.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 +++++- 17 files changed, 87 insertions(+), 18 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 69081fae66..72cf655bb7 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1231,6 +1231,10 @@ msgstr "Nilai Unit ADC tidak valid" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "File BMP tidak valid" @@ -2352,7 +2356,7 @@ msgstr "Tipe bus tampilan tidak didukung" msgid "Unsupported format" msgstr "Format tidak didukung" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Operasi yang tidak didukung" diff --git a/locale/cs.po b/locale/cs.po index efdd695ed8..9a898afead 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1214,6 +1214,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "" @@ -2319,7 +2323,7 @@ msgstr "" msgid "Unsupported format" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index fc0116514e..aa3a4ce59c 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1231,6 +1231,10 @@ msgstr "Ungültiger ADC-Einheitenwert" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Ungültige BMP-Datei" @@ -2355,7 +2359,7 @@ msgstr "Nicht unterstützter display bus type" msgid "Unsupported format" msgstr "Nicht unterstütztes Format" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Nicht unterstützte Operation" diff --git a/locale/el.po b/locale/el.po index 868f518631..250b7821a1 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1211,6 +1211,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "" @@ -2316,7 +2320,7 @@ msgstr "" msgid "Unsupported format" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 4d1b3fb36f..5726ca6c2d 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1226,6 +1226,10 @@ msgstr "Invalid ADC unit value" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Invalid BMP file" @@ -2346,7 +2350,7 @@ msgstr "Unsupported display bus type" msgid "Unsupported format" msgstr "Unsupported format" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Unsupported operation" diff --git a/locale/es.po b/locale/es.po index 9085cb3c23..d6b4f00083 100644 --- a/locale/es.po +++ b/locale/es.po @@ -864,7 +864,8 @@ msgstr "Data es muy grande para el paquete de anuncio" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Deep sleep pins must use a rising edge with pulldown" -msgstr "Pines de sueño profundo deben usar eje de subida con jalado hacia abajo" +msgstr "" +"Pines de sueño profundo deben usar eje de subida con jalado hacia abajo" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -1243,6 +1244,10 @@ msgstr "Valor de unidad de ADC no válido" msgid "Invalid AuthMode" msgstr "AuthMode invalido" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Archivo BMP inválido" @@ -2383,7 +2388,7 @@ msgstr "Sin capacidad de bus tipo display" msgid "Unsupported format" msgstr "Formato no soportado" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Operación no soportada" diff --git a/locale/fil.po b/locale/fil.po index 95059f2c1e..bf337f8aed 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1226,6 +1226,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Mali ang BMP file" @@ -2338,7 +2342,7 @@ msgstr "Hindi supportadong tipo ng bitmap" msgid "Unsupported format" msgstr "Hindi supportadong format" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Hindi sinusuportahang operasyon" diff --git a/locale/fr.po b/locale/fr.po index 230f17f05d..4d3882e2b4 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1254,6 +1254,10 @@ msgstr "Valeur d'unité ADC non valide" msgid "Invalid AuthMode" msgstr "AuthMode invalide" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Fichier BMP invalide" @@ -2388,7 +2392,7 @@ msgstr "Type de bus d'affichage non supporté" msgid "Unsupported format" msgstr "Format non supporté" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Opération non supportée" diff --git a/locale/hi.po b/locale/hi.po index c2b945d44c..66057441ee 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1211,6 +1211,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "" @@ -2316,7 +2320,7 @@ msgstr "" msgid "Unsupported format" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index eb8613c5b7..126a837b6d 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1235,6 +1235,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "File BMP non valido" @@ -2359,7 +2363,7 @@ msgstr "tipo di bitmap non supportato" msgid "Unsupported format" msgstr "Formato non supportato" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Operazione non supportata" diff --git a/locale/ja.po b/locale/ja.po index 26874a5e4c..df128616d0 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1222,6 +1222,10 @@ msgstr "不正なADCユニット値" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "不正なBMPファイル" @@ -2331,7 +2335,7 @@ msgstr "" msgid "Unsupported format" msgstr "非対応の形式" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "非対応の操作" diff --git a/locale/ko.po b/locale/ko.po index 3895e5326d..9386d60d88 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1214,6 +1214,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "" @@ -2320,7 +2324,7 @@ msgstr "" msgid "Unsupported format" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 29089f697a..5ad8f97074 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1223,6 +1223,10 @@ msgstr "Ongeldige ADC Unit waarde" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Ongeldig BMP bestand" @@ -2348,7 +2352,7 @@ msgstr "Niet-ondersteund beeldscherm bus type" msgid "Unsupported format" msgstr "Niet-ondersteunde format" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Niet-ondersteunde operatie" diff --git a/locale/pl.po b/locale/pl.po index f6001abc34..00d2e5f0f0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1222,6 +1222,10 @@ msgstr "" msgid "Invalid AuthMode" msgstr "" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Zły BMP" @@ -2327,7 +2331,7 @@ msgstr "Zły typ magistrali wyświetlaczy" msgid "Unsupported format" msgstr "Zły format" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Zła operacja" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f7e5bfe991..b96484a7da 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1245,6 +1245,10 @@ msgstr "Valor inválido da unidade ADC" msgid "Invalid AuthMode" msgstr "AuthMode inválido" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Arquivo BMP inválido" @@ -2388,7 +2392,7 @@ msgstr "Não há suporte para o tipo do display bus" msgid "Unsupported format" msgstr "Formato não suportado" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Operação não suportada" diff --git a/locale/sv.po b/locale/sv.po index 4b4da0ecab..03fac5cefd 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1230,6 +1230,10 @@ msgstr "Ogiltigt ADC-enhetsvärde" msgid "Invalid AuthMode" msgstr "Ogiltig AuthMode" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Ogiltig BMP-fil" @@ -2362,7 +2366,7 @@ msgstr "Busstyp för display stöds inte" msgid "Unsupported format" msgstr "Formatet stöds inte" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Åtgärd som inte stöds" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 621430e4f7..ea38861aee 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1232,6 +1232,10 @@ msgstr "Wúxiào de ADC dānwèi zhí" msgid "Invalid AuthMode" msgstr "wú xiào AuthMode" +#: ports/nrf/common-hal/_bleio/__init__.c +msgid "Invalid BLE parameter" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" msgstr "Wúxiào de BMP wénjiàn" @@ -2352,7 +2356,7 @@ msgstr "Bù zhīchí de gōnggòng qìchē lèixíng" msgid "Unsupported format" msgstr "Bù zhīchí de géshì" -#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c +#: py/moduerrno.c msgid "Unsupported operation" msgstr "Bù zhīchí de cāozuò" From c82286e39b473adffd10d6e1ce1fe27981bd58d2 Mon Sep 17 00:00:00 2001 From: Noel Gaetan Date: Thu, 20 May 2021 11:47:19 +0000 Subject: [PATCH 09/40] Translated using Weblate (French) Currently translated at 96.0% (954 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 4d3882e2b4..7ab2f74361 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-06 17:51+0000\n" -"Last-Translator: Hugo Dahl \n" +"PO-Revision-Date: 2021-05-20 13:02+0000\n" +"Last-Translator: Noel Gaetan \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -100,7 +100,7 @@ msgstr "La liste %q doit être une liste" #: shared-bindings/usb_hid/Device.c msgid "%q must be 1-255" -msgstr "" +msgstr "%q doit être compris entre 1 et 255" #: shared-bindings/memorymonitor/AllocationAlarm.c msgid "%q must be >= 0" @@ -116,7 +116,7 @@ msgstr "%q doit être >= 1" #: shared-bindings/usb_hid/Device.c msgid "%q must be None or 1-255" -msgstr "" +msgstr "%q doit être NULL ou compris entre 1 et 255" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" @@ -217,7 +217,7 @@ msgstr "" #: py/obj.c #, c-format msgid "'%s' object doesn't support item assignment" -msgstr "" +msgstr "l'objet %s ne supporte pas l'assignation d'éléments" #: py/obj.c #, c-format @@ -1947,11 +1947,11 @@ msgstr "Mode RAISE n'est pas implémenté" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" -msgstr "Erreur de désinitiation du RNG (RNG DeInit)" +msgstr "Erreur de désinitialisation du RNG" #: ports/stm/common-hal/os/__init__.c msgid "RNG Init Error" -msgstr "Erreur d'initialisation du RNG (RNG Init)" +msgstr "Erreur d'initialisation du RNG" #: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c msgid "RS485 Not yet supported on this device" @@ -3720,7 +3720,7 @@ msgstr "objet " #: py/obj.c #, c-format msgid "object '%s' isn't a tuple or list" -msgstr "" +msgstr "l'objet '%s' n'est pas un tuple ou une liste" #: py/obj.c msgid "object doesn't support item assignment" @@ -3728,7 +3728,7 @@ msgstr "" #: py/obj.c msgid "object doesn't support item deletion" -msgstr "" +msgstr "l'objet ne supporte pas la suppression d'éléments" #: py/obj.c msgid "object has no len" From 131cdda2e248ef22b18cf604f55bc793a2bca253 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 20 May 2021 05:29:33 +0000 Subject: [PATCH 10/40] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (993 of 993 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 b96484a7da..3c00f177a5 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: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-15 15:52+0000\n" +"PO-Revision-Date: 2021-05-20 13:02+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1247,7 +1247,7 @@ msgstr "AuthMode inválido" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" -msgstr "" +msgstr "Parâmetro BLE inválido" #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" From 0c2c7259780836b32e30d71d14d338aa95435b61 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 20 May 2021 07:18:49 +0000 Subject: [PATCH 11/40] Translated using Weblate (Swedish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 03fac5cefd..dbd34d63d4 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-15 15:52+0000\n" +"PO-Revision-Date: 2021-05-20 13:02+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1232,7 +1232,7 @@ msgstr "Ogiltig AuthMode" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" -msgstr "" +msgstr "Ogiltig BLE-parameter" #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" From a8b623240272ee7f76badfd87cf2f3f15b3018e8 Mon Sep 17 00:00:00 2001 From: Neradoc Date: Thu, 20 May 2021 18:57:33 +0200 Subject: [PATCH 12/40] don't print out "hard crash" when USER_SAFE_MODE demanded --- supervisor/shared/safe_mode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index ca95b0d487..e53b6a9da4 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -136,7 +136,7 @@ void print_safe_mode_message(safe_mode_t reason) { serial_write_compressed(translate("You requested starting safe mode by ")); serial_write_compressed(BOARD_USER_SAFE_MODE_ACTION); serial_write_compressed(translate("To exit, please reset the board without ")); - serial_write_compressed(BOARD_USER_SAFE_MODE_ACTION); + message = BOARD_USER_SAFE_MODE_ACTION; #endif break; case MANUAL_SAFE_MODE: From 9fa7fb7092054ed9e93a6bac5cb325537ffcd12b Mon Sep 17 00:00:00 2001 From: Neradoc Date: Thu, 20 May 2021 23:17:56 +0200 Subject: [PATCH 13/40] fix ipaddress.IPv4Address from returning invalid values --- locale/circuitpython.pot | 2 +- shared-bindings/ipaddress/IPv4Address.c | 3 ++- shared-bindings/ipaddress/__init__.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1da8b1783c..a52f7b7b7d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1694,7 +1694,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/shared-bindings/ipaddress/IPv4Address.c b/shared-bindings/ipaddress/IPv4Address.c index 7e5095ced0..018f05cbf3 100644 --- a/shared-bindings/ipaddress/IPv4Address.c +++ b/shared-bindings/ipaddress/IPv4Address.c @@ -60,12 +60,13 @@ STATIC mp_obj_t ipaddress_ipv4address_make_new(const mp_obj_type_t *type, size_t uint8_t *buf = NULL; if (mp_obj_get_int_maybe(address, (mp_int_t *)&value)) { // We're done. - buf = (uint8_t *)value; + buf = (uint8_t *)&value; } else if (mp_obj_is_str(address)) { GET_STR_DATA_LEN(address, str_data, str_len); if (!ipaddress_parse_ipv4address((const char *)str_data, str_len, &value)) { mp_raise_ValueError(translate("Not a valid IP string")); } + buf = (uint8_t *)&value; } else { mp_buffer_info_t buf_info; if (mp_get_buffer(address, &buf_info, MP_BUFFER_READ)) { diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index ee12f5f0d2..44e698c1be 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -76,7 +76,7 @@ bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t return true; } -//| def ip_address(obj: Union[int]) -> IPv4Address: +//| def ip_address(obj: Union[int, str]) -> IPv4Address: //| """Return a corresponding IP address object or raise ValueError if not possible.""" //| ... //| @@ -91,7 +91,7 @@ STATIC mp_obj_t ipaddress_ip_address(mp_obj_t ip_in) { mp_raise_ValueError(translate("Not a valid IP string")); } } else { - mp_raise_ValueError(translate("Only raw int supported for ip")); + mp_raise_ValueError(translate("Only raw int or string supported for ip")); } return common_hal_ipaddress_new_ipv4address(value); From e7dc5c9911e8558be56bc23e28e5375f8ef6555b Mon Sep 17 00:00:00 2001 From: Jose David M Date: Fri, 21 May 2021 01:41:59 +0000 Subject: [PATCH 14/40] Translated using Weblate (Spanish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index d6b4f00083..8be4d46ff4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-15 15:52+0000\n" -"Last-Translator: Alvaro Figueroa \n" +"PO-Revision-Date: 2021-05-21 17:47+0000\n" +"Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1246,7 +1246,7 @@ msgstr "AuthMode invalido" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" -msgstr "" +msgstr "Parámetro BLE invalido" #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" From 25b4b4ce37880ad98c2f66e4c2820828d42b5a92 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Fri, 21 May 2021 02:19:45 +0000 Subject: [PATCH 15/40] Translated using Weblate (French) Currently translated at 96.0% (954 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 7ab2f74361..eb6e0eb2bb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-20 13:02+0000\n" -"Last-Translator: Noel Gaetan \n" +"PO-Revision-Date: 2021-05-21 17:47+0000\n" +"Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -116,7 +116,7 @@ msgstr "%q doit être >= 1" #: shared-bindings/usb_hid/Device.c msgid "%q must be None or 1-255" -msgstr "%q doit être NULL ou compris entre 1 et 255" +msgstr "%q doit être None ou compris entre 1 et 255" #: shared-module/vectorio/Polygon.c msgid "%q must be a tuple of length 2" From 2d18384cb9df5a0776344fd16b9af013768a3216 Mon Sep 17 00:00:00 2001 From: hexthat Date: Fri, 21 May 2021 05:56:36 +0000 Subject: [PATCH 16/40] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index ea38861aee..b9aa779e5b 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-12 21:48+0000\n" +"PO-Revision-Date: 2021-05-21 17:47+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -857,6 +857,7 @@ msgstr "Guǎnggào bāo de shùjù tài dà" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Deep sleep pins must use a rising edge with pulldown" msgstr "" +"shēn dù shuì mián bié zhēn bì xū shǐ yòng xià lā shàng shēng de biān yuán" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -1234,7 +1235,7 @@ msgstr "wú xiào AuthMode" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" -msgstr "" +msgstr "wú xiào BLE cān shù" #: shared-module/displayio/OnDiskBitmap.c msgid "Invalid BMP file" @@ -1695,7 +1696,7 @@ msgstr "" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Only edge detection is available on this hardware" -msgstr "" +msgstr "cǐ yìng jiàn shàng jǐn tí gòng biān yuán jiǎn cè" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1791,7 +1792,7 @@ msgstr "Quánxiàn bèi jùjué" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" -msgstr "" +msgstr "yǐn jiǎo wú fǎ cóng shēn dù shuì mián zhōng huàn xǐng" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Pin count must be at least 1" @@ -1814,7 +1815,7 @@ msgstr "Pin méiyǒu ADC nénglì" #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" -msgstr "" +msgstr "yǐn jiǎo zhōng duàn yǐ zài shǐ yòng zhōng" #: shared-bindings/adafruit_bus_device/SPIDevice.c #: shared-bindings/digitalio/DigitalInOut.c @@ -2057,7 +2058,7 @@ msgstr "bù zhī chí dà xiǎo" #: ports/stm/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" -msgstr "" +msgstr "shuì mián jì yì bù kě yòng" #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -2119,12 +2120,16 @@ msgid "" "The CircuitPython heap was corrupted because the stack was too small.\n" "Increase the stack size if you know how. If not:" msgstr "" +"diàn lù dàn duī bèi sǔn huài, yīn wéi duī zhàn tài xiǎo.\n" +"rú guǒ nín zhī dào rú hé zēng jiā duī zhàn dà xiǎo. rú guǒ méi yǒu:" #: supervisor/shared/safe_mode.c msgid "" "The `microcontroller` module was used to boot into safe mode. Press reset to " "exit safe mode." msgstr "" +"`wēi kòng zhì qì` mó kuài yòng yú qǐ dòng dào ān quán mó shì. àn chóng zhì " +"tuì chū ān quán mó shì." #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" @@ -2136,6 +2141,9 @@ msgid "" "enough power for the whole circuit and press reset (after ejecting " "CIRCUITPY)." msgstr "" +"wēi kòng zhì qì de gōng lǜ xià jiàng. què bǎo diàn yuán tí gòng\n" +"zú gòu de gōng lǜ yòng yú zhěng gè diàn lù hé àn chóng zhì (tán chū " +"CIRCUITPY hòu)." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2201,7 +2209,7 @@ msgstr "yào biān xiě de zǒng shù jù dà yú %q" #: ports/stm/common-hal/alarm/touch/TouchAlarm.c msgid "Touch alarms not available" -msgstr "" +msgstr "bù kě yòng chù mō bào jǐng qì" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -2442,12 +2450,14 @@ msgstr "Tèzhēng bù zhīchí xiě rù" #: supervisor/shared/safe_mode.c msgid "You are in safe mode because:\n" -msgstr "" +msgstr "nín chǔ yú ān quán mó shì shì yīn wéi:\n" #: supervisor/shared/safe_mode.c msgid "" "You pressed the reset button during boot. Press again to exit safe mode." msgstr "" +"zài qǐ dòng guò chéng zhōng, nín àn xià le chóng zhì àn niǔ. zài cì àn xià " +"yǐ tuì chū ān quán mó shì." #: supervisor/shared/safe_mode.c msgid "You requested starting safe mode by " From 2426ac9884ed7765a3696bd85ea7897b1687bb80 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 21 May 2021 19:47:53 +0200 Subject: [PATCH 17/40] 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/el.po | 2 +- locale/en_GB.po | 7 +++++-- locale/es.po | 7 +++++-- locale/fil.po | 2 +- locale/fr.po | 7 +++++-- locale/hi.po | 2 +- locale/it_IT.po | 2 +- locale/ja.po | 2 +- locale/ko.po | 2 +- locale/nl.po | 7 +++++-- locale/pl.po | 2 +- locale/pt_BR.po | 7 +++++-- locale/sv.po | 7 +++++-- locale/zh_Latn_pinyin.po | 7 +++++-- 17 files changed, 45 insertions(+), 24 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 72cf655bb7..be0217bf96 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1719,7 +1719,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/cs.po b/locale/cs.po index 9a898afead..de6f46f646 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1697,7 +1697,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/de_DE.po b/locale/de_DE.po index aa3a4ce59c..aff8c71509 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1721,7 +1721,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/el.po b/locale/el.po index 250b7821a1..f933431230 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1694,7 +1694,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/en_GB.po b/locale/en_GB.po index 5726ca6c2d..0e28dad664 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1713,8 +1713,8 @@ msgid "Only one color can be transparent at a time" msgstr "Only one colour can be transparent at a time" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4393,6 +4393,9 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Only raw int supported for ip" +#~ msgstr "Only raw int supported for ip" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" diff --git a/locale/es.po b/locale/es.po index 8be4d46ff4..55fb840f46 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1737,8 +1737,8 @@ msgid "Only one color can be transparent at a time" msgstr "Solo un color puede ser transparente a la vez" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "Solo se aceptan enteros crudos para ip" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4448,6 +4448,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Only raw int supported for ip" +#~ msgstr "Solo se aceptan enteros crudos para ip" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" diff --git a/locale/fil.po b/locale/fil.po index bf337f8aed..f9d4beada0 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1712,7 +1712,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/fr.po b/locale/fr.po index eb6e0eb2bb..c70841c30a 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1745,8 +1745,8 @@ msgid "Only one color can be transparent at a time" msgstr "Une seule couleur peut être transparente à la fois" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "IP n'accepte que les chiffres entiers bruts" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4459,6 +4459,9 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Only raw int supported for ip" +#~ msgstr "IP n'accepte que les chiffres entiers bruts" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" diff --git a/locale/hi.po b/locale/hi.po index 66057441ee..7dd917e051 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1694,7 +1694,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 126a837b6d..1cfd7b4063 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1726,7 +1726,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/ja.po b/locale/ja.po index df128616d0..0470193ef3 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1707,7 +1707,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/ko.po b/locale/ko.po index 9386d60d88..f2091b7fa7 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1697,7 +1697,7 @@ msgid "Only one color can be transparent at a time" msgstr "" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/nl.po b/locale/nl.po index 5ad8f97074..df9dc35e11 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1712,8 +1712,8 @@ msgid "Only one color can be transparent at a time" msgstr "Er kan maar één kleur per keer transparant zijn" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "Alleen raw int ondersteund voor IP" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4404,6 +4404,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Only raw int supported for ip" +#~ msgstr "Alleen raw int ondersteund voor IP" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" diff --git a/locale/pl.po b/locale/pl.po index 00d2e5f0f0..f23aff57e0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1705,7 +1705,7 @@ msgid "Only one color can be transparent at a time" msgstr "W danym momencie przezroczysty może być tylko jeden kolor" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" +msgid "Only raw int or string supported for ip" msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3c00f177a5..134ba55ae2 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1735,8 +1735,8 @@ msgid "Only one color can be transparent at a time" msgstr "Apenas uma cor pode ser transparente de cada vez" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "Apenas o int bruto é compatível para o ip" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4458,6 +4458,9 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Only raw int supported for ip" +#~ msgstr "Apenas o int bruto é compatível para o ip" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" diff --git a/locale/sv.po b/locale/sv.po index dbd34d63d4..cf60d5df38 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1719,8 +1719,8 @@ msgid "Only one color can be transparent at a time" msgstr "Bara en färg kan vara genomskinlig i taget" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "Endast raw int stöds för ip" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4417,6 +4417,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Only raw int supported for ip" +#~ msgstr "Endast raw int stöds för ip" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index b9aa779e5b..39a40c077d 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1722,8 +1722,8 @@ msgid "Only one color can be transparent at a time" msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" #: shared-bindings/ipaddress/__init__.c -msgid "Only raw int supported for ip" -msgstr "Ip jǐn zhīchí raw int" +msgid "Only raw int or string supported for ip" +msgstr "" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" @@ -4414,6 +4414,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Only raw int supported for ip" +#~ msgstr "Ip jǐn zhīchí raw int" + #~ msgid "" #~ "CircuitPython is in safe mode because you pressed the reset button during " #~ "boot. Press again to exit safe mode.\n" From 6808d04d53899b3c1a6dc5148405bbb1a5329b9f Mon Sep 17 00:00:00 2001 From: Neradoc Date: Fri, 21 May 2021 20:13:30 +0200 Subject: [PATCH 18/40] enable the PWM status LED on Pimonoroni Tiny 2040 and PicoSystem --- .../raspberrypi/boards/pimoroni_picosystem/mpconfigboard.h | 7 ++++--- ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_picosystem/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_picosystem/mpconfigboard.h index 8a61d6a76d..97ea17376d 100644 --- a/ports/raspberrypi/boards/pimoroni_picosystem/mpconfigboard.h +++ b/ports/raspberrypi/boards/pimoroni_picosystem/mpconfigboard.h @@ -14,9 +14,10 @@ #define MICROPY_HW_BACKLIGHT (&pin_GPIO12) #define MICROPY_HW_VBUS_DETECT (&pin_GPIO2) -#define MICROPY_HW_LED_G (&pin_GPIO13) -#define MICROPY_HW_LED_R (&pin_GPIO14) -#define MICROPY_HW_LED_B (&pin_GPIO15) +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO13) +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO14) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO15) #define MICROPY_HW_SW_Y (&pin_GPIO16) #define MICROPY_HW_SW_X (&pin_GPIO17) diff --git a/ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h index 8f188959cb..29bde18060 100644 --- a/ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h +++ b/ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h @@ -1,9 +1,10 @@ #define MICROPY_HW_BOARD_NAME "Pimoroni Tiny 2040" #define MICROPY_HW_MCU_NAME "rp2040" -#define MICROPY_HW_LED_R (&pin_GPIO18) -#define MICROPY_HW_LED_G (&pin_GPIO19) -#define MICROPY_HW_LED_B (&pin_GPIO20) +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO18) +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO19) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO20) #define MICROPY_HW_USER_SW (&pin_GPIO23) From 7d0cda261445c8d17ff14f6fc0ab2b7829167408 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 21 May 2021 15:10:18 -0400 Subject: [PATCH 19/40] gc all pointers in hid_devices properly --- shared-module/usb_hid/__init__.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shared-module/usb_hid/__init__.c b/shared-module/usb_hid/__init__.c index a92fd0c725..88909b2754 100644 --- a/shared-module/usb_hid/__init__.c +++ b/shared-module/usb_hid/__init__.c @@ -257,9 +257,13 @@ void usb_hid_save_report_descriptor(uint8_t *report_descriptor_space, size_t rep void usb_hid_gc_collect(void) { gc_collect_ptr(hid_devices_tuple); - // Mark any heap pointers in the static device list as in use. + // Mark possible heap pointers in the static device list as in use. for (mp_int_t i = 0; i < hid_devices_num; i++) { - gc_collect_ptr(&hid_devices[i]); + // Cast away the const for .report_descriptor. It could be in flash or on the heap. + // The const is necessary to have the bytes be placed only in flash. + gc_collect_ptr((void *)hid_devices[i].report_descriptor); + gc_collect_ptr(hid_devices[i].in_report_buffer); + gc_collect_ptr(hid_devices[i].out_report_buffer); } } From 5a81f275cf141b70235000a888df15bdb42f9961 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 21 May 2021 17:29:21 -0400 Subject: [PATCH 20/40] Don't change number of HID devices until it's vetted --- shared-module/usb_hid/__init__.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shared-module/usb_hid/__init__.c b/shared-module/usb_hid/__init__.c index a92fd0c725..4367f938a0 100644 --- a/shared-module/usb_hid/__init__.c +++ b/shared-module/usb_hid/__init__.c @@ -160,11 +160,13 @@ bool common_hal_usb_hid_enable(const mp_obj_t devices) { return false; } - hid_devices_num = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(devices)); - if (hid_devices_num > MAX_HID_DEVICES) { + const mp_int_t num_devices = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(devices)); + if (num_devices > MAX_HID_DEVICES) { mp_raise_ValueError_varg(translate("No more than %d HID devices allowed"), MAX_HID_DEVICES); } + hid_devices_num = num_devices; + // Remember the devices in static storage so they live across VMs. for (mp_int_t i = 0; i < hid_devices_num; i++) { // devices has already been validated to contain only usb_hid_device_obj_t objects. From c6eb0283dc52e18876b04187fc3e37b8bc03aee2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 21 May 2021 17:34:30 -0400 Subject: [PATCH 21/40] Don't set num_hid_devices before it's validated --- shared-module/usb_hid/__init__.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/shared-module/usb_hid/__init__.c b/shared-module/usb_hid/__init__.c index 4367f938a0..18b9eeb8ee 100644 --- a/shared-module/usb_hid/__init__.c +++ b/shared-module/usb_hid/__init__.c @@ -79,7 +79,7 @@ static const uint8_t usb_hid_descriptor_template[] = { static supervisor_allocation *hid_report_descriptor_allocation; static usb_hid_device_obj_t hid_devices[MAX_HID_DEVICES]; // If 0, USB HID is disabled. -static mp_int_t hid_devices_num; +static mp_int_t num_hid_devices; // This tuple is store in usb_hid.devices. static mp_obj_tuple_t *hid_devices_tuple; @@ -97,7 +97,7 @@ static mp_obj_tuple_t default_hid_devices_tuple = { }; bool usb_hid_enabled(void) { - return hid_devices_num > 0; + return num_hid_devices > 0; } void usb_hid_set_defaults(void) { @@ -140,13 +140,13 @@ size_t usb_hid_add_descriptor(uint8_t *descriptor_buf, descriptor_counts_t *desc // Make up a fresh tuple containing the device objects saved in the static // devices table. Save the tuple in usb_hid.devices. static void usb_hid_set_devices_from_hid_devices(void) { - mp_obj_t tuple_items[hid_devices_num]; - for (mp_int_t i = 0; i < hid_devices_num; i++) { + mp_obj_t tuple_items[num_hid_devices]; + for (mp_int_t i = 0; i < num_hid_devices; i++) { tuple_items[i] = &hid_devices[i]; } // Remember tuple for gc purposes. - hid_devices_tuple = mp_obj_new_tuple(hid_devices_num, tuple_items); + hid_devices_tuple = mp_obj_new_tuple(num_hid_devices, tuple_items); usb_hid_set_devices(hid_devices_tuple); } @@ -165,10 +165,10 @@ bool common_hal_usb_hid_enable(const mp_obj_t devices) { mp_raise_ValueError_varg(translate("No more than %d HID devices allowed"), MAX_HID_DEVICES); } - hid_devices_num = num_devices; + num_hid_devices = num_devices; // Remember the devices in static storage so they live across VMs. - for (mp_int_t i = 0; i < hid_devices_num; i++) { + for (mp_int_t i = 0; i < num_hid_devices; i++) { // devices has already been validated to contain only usb_hid_device_obj_t objects. usb_hid_device_obj_t *device = MP_OBJ_TO_PTR(mp_obj_subscr(devices, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL)); @@ -185,7 +185,7 @@ void usb_hid_setup_devices(void) { usb_hid_set_devices_from_hid_devices(); // Create report buffers on the heap. - for (mp_int_t i = 0; i < hid_devices_num; i++) { + for (mp_int_t i = 0; i < num_hid_devices; i++) { usb_hid_device_create_report_buffers(&hid_devices[i]); } } @@ -193,12 +193,12 @@ void usb_hid_setup_devices(void) { // Total length of the report descriptor, with all configured devices. size_t usb_hid_report_descriptor_length(void) { size_t total_hid_report_descriptor_length = 0; - for (mp_int_t i = 0; i < hid_devices_num; i++) { + for (mp_int_t i = 0; i < num_hid_devices; i++) { total_hid_report_descriptor_length += hid_devices[i].report_descriptor_length; } // Don't need space for a report id if there's only one device. - if (hid_devices_num == 1) { + if (num_hid_devices == 1) { total_hid_report_descriptor_length -= 2; } return total_hid_report_descriptor_length; @@ -212,10 +212,10 @@ void usb_hid_build_report_descriptor(uint8_t *report_descriptor_space, size_t re uint8_t *report_descriptor_start = report_descriptor_space; - for (mp_int_t i = 0; i < hid_devices_num; i++) { + for (mp_int_t i = 0; i < num_hid_devices; i++) { usb_hid_device_obj_t *device = &hid_devices[i]; // Copy the report descriptor for this device. - if (hid_devices_num == 1) { + if (num_hid_devices == 1) { // There's only one device, so it shouldn't have a report ID. // Copy the descriptor, but splice out the report id indicator and value (2 bytes). memcpy(report_descriptor_start, device->report_descriptor, device->report_id_index - 1); @@ -260,13 +260,13 @@ void usb_hid_gc_collect(void) { gc_collect_ptr(hid_devices_tuple); // Mark any heap pointers in the static device list as in use. - for (mp_int_t i = 0; i < hid_devices_num; i++) { + for (mp_int_t i = 0; i < num_hid_devices; i++) { gc_collect_ptr(&hid_devices[i]); } } usb_hid_device_obj_t *usb_hid_get_device_with_report_id(uint8_t report_id) { - for (uint8_t i = 0; i < hid_devices_num; i++) { + for (uint8_t i = 0; i < num_hid_devices; i++) { usb_hid_device_obj_t *device = &hid_devices[i]; if (device->report_id == report_id) { return &hid_devices[i]; From 5a9b95e611324660ccb0807604f16709266263bc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 21 May 2021 17:49:50 -0400 Subject: [PATCH 22/40] unlock board.I2C() on reset --- shared-module/board/__init__.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 9dbca48fd1..05900040d8 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -143,7 +143,9 @@ void reset_board_busses(void) { } } #endif + // make sure I2C lock is not held over a soft reset if (i2c_singleton != NULL) { + common_hal_busio_i2c_unlock(i2c_singleton); if (!display_using_i2c) { common_hal_busio_i2c_deinit(i2c_singleton); i2c_singleton = NULL; From 352281e23e803088209c27f8780a4e1e9d9503b1 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 21 May 2021 20:44:11 -0400 Subject: [PATCH 23/40] Adding Arduino Nano RP2040 Connect Re-commiting to fix local GitHub config issues. Adding CircuitPython support for the Arduino Nano RP2040 Connect. Have tested all digital and analog I/O, I2C, onboard LSM6DSOX. Uses the AT25SF128A external flash. --- .github/workflows/build.yml | 1 + data/nvm.toml | 2 +- .../arduino_nano_rp2040_connect/board.c | 37 +++++++++++++++ .../mpconfigboard.h | 14 ++++++ .../mpconfigboard.mk | 11 +++++ .../boards/arduino_nano_rp2040_connect/pins.c | 46 +++++++++++++++++++ 6 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 194c8a7261..165bb43e23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,6 +190,7 @@ jobs: - "arduino_mkrzero" - "arduino_nano_33_ble" - "arduino_nano_33_iot" + - "arduino_nano_rp2040_connect" - "arduino_zero" - "bast_pro_mini_m0" - "bastble" diff --git a/data/nvm.toml b/data/nvm.toml index 9b4a5241d8..e5b149599d 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 9b4a5241d8c3310b31a7925a4f2160743890a2e4 +Subproject commit e5b149599d14a8841167fe552846ca36925b87a0 diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c new file mode 100644 index 0000000000..67486d4c23 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h new file mode 100644 index 0000000000..f92b4d54c0 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Arduino Nano RP2040 Connect" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO6) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO13) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO12) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO7) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk new file mode 100644 index 0000000000..8aa009a914 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x2E8A +USB_PID = 0x0003 +USB_PRODUCT = "Arduino Nano RP2040 Connect" +USB_MANUFACTURER = "Arduino" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "AT25SF128A" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c new file mode 100644 index 0000000000..d8b831c4e4 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c @@ -0,0 +1,46 @@ +#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_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_INT1), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_MIC_CLK), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MIC_DOUT), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_RSTN_NINA), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, + + { 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 9f4eb48e70c131d3a400bf9c61b8940ef847ffb6 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Sat, 22 May 2021 01:02:06 -0400 Subject: [PATCH 24/40] Updating MISO While testing WIFI realized MISO was defined incorrectly --- .github/workflows/build.yml | 1 + data/nvm.toml | 2 +- .../arduino_nano_rp2040_connect/board.c | 37 +++++++++++++ .../mpconfigboard.h | 14 +++++ .../mpconfigboard.mk | 11 ++++ .../boards/arduino_nano_rp2040_connect/pins.c | 52 +++++++++++++++++++ 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 194c8a7261..165bb43e23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,6 +190,7 @@ jobs: - "arduino_mkrzero" - "arduino_nano_33_ble" - "arduino_nano_33_iot" + - "arduino_nano_rp2040_connect" - "arduino_zero" - "bast_pro_mini_m0" - "bastble" diff --git a/data/nvm.toml b/data/nvm.toml index 9b4a5241d8..e5b149599d 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 9b4a5241d8c3310b31a7925a4f2160743890a2e4 +Subproject commit e5b149599d14a8841167fe552846ca36925b87a0 diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c new file mode 100644 index 0000000000..67486d4c23 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h new file mode 100644 index 0000000000..f92b4d54c0 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Arduino Nano RP2040 Connect" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO6) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO13) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO12) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO7) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk new file mode 100644 index 0000000000..8aa009a914 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x2E8A +USB_PID = 0x0003 +USB_PRODUCT = "Arduino Nano RP2040 Connect" +USB_MANUFACTURER = "Arduino" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "AT25SF128A" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c new file mode 100644 index 0000000000..5f23480f80 --- /dev/null +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c @@ -0,0 +1,52 @@ +#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_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_INT1), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_MIC_CLK), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MIC_DOUT), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_RSTN_NINA), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_SPIV_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SPIV_CLK), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_SPIV_DI), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_RESET_N), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GPIO33), MP_ROM_PTR(&pin_GPIO10) }, + + { 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 38177aff33a89d3677ed7e0efc4b01232c047a53 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sat, 22 May 2021 12:36:28 +0200 Subject: [PATCH 25/40] Removed 'raw' from error message 'raw in' --- locale/circuitpython.pot | 8 ++++---- shared-bindings/ipaddress/__init__.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index a52f7b7b7d..eb75d2da6f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1672,6 +1672,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1693,10 +1697,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index 44e698c1be..314c539c27 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -91,7 +91,7 @@ STATIC mp_obj_t ipaddress_ip_address(mp_obj_t ip_in) { mp_raise_ValueError(translate("Not a valid IP string")); } } else { - mp_raise_ValueError(translate("Only raw int or string supported for ip")); + mp_raise_ValueError(translate("Only int or string supported for ip")); } return common_hal_ipaddress_new_ipv4address(value); From ac855afb48be6d7c1bcad698161575f541d7995b Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 22 May 2021 11:57:46 -0400 Subject: [PATCH 26/40] Some pin neatening and updated PID to unused Adafruit one! --- .../mpconfigboard.h | 4 +- .../mpconfigboard.mk | 5 +- .../boards/arduino_nano_rp2040_connect/pins.c | 86 ++++++++++--------- 3 files changed, 49 insertions(+), 46 deletions(-) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h index f92b4d54c0..c1e2408854 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h @@ -1,12 +1,12 @@ #define MICROPY_HW_BOARD_NAME "Arduino Nano RP2040 Connect" #define MICROPY_HW_MCU_NAME "rp2040" -#define MICROPY_HW_LED_STATUS (&pin_GPIO6) +//#define MICROPY_HW_LED_STATUS (&pin_GPIO6) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO13) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO12) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO6) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO7) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk index 8aa009a914..4eb0ac75b3 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.mk @@ -1,5 +1,6 @@ -USB_VID = 0x2E8A -USB_PID = 0x0003 +USB_VID = 0x239A +USB_PID = 0x00CF + USB_PRODUCT = "Arduino Nano RP2040 Connect" USB_MANUFACTURER = "Arduino" diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c index 73752b96c0..0efd6d32f0 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c @@ -1,14 +1,39 @@ #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_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_INT1), MP_ROM_PTR(&pin_GPIO24) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_GPIO2) }, // ESP32 FW boot state pin (confusingly named GPIO0) + { MP_ROM_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_GPIO10) }, + + // Primary SPI + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO5) }, + + // Secondary SPI connected to ESP32 + { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SCK1), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_CS1), MP_ROM_PTR(&pin_GPIO9) }, + + // Primary I2C + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO12) }, // Note these are not actually analog! + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO13) }, // Note these are not actually analog! + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO17) }, @@ -16,44 +41,21 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + // PDM onboard mic + { MP_ROM_QSTR(MP_QSTR_MICROPHONE_DATA), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_GPIO23) }, - { MP_ROM_QSTR(MP_QSTR_MIC_CLK), MP_ROM_PTR(&pin_GPIO23) }, - { MP_ROM_QSTR(MP_QSTR_MIC_DOUT), MP_ROM_PTR(&pin_GPIO22) }, + // Sensor IRQ + { MP_ROM_QSTR(MP_QSTR_INT1), MP_ROM_PTR(&pin_GPIO24) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_RSTN_NINA), MP_ROM_PTR(&pin_GPIO3) }, -<<<<<<< HEAD - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO7) }, -======= - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, ->>>>>>> 352281e23e803088209c27f8780a4e1e9d9503b1 - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, -<<<<<<< HEAD - { MP_ROM_QSTR(MP_QSTR_SPIV_CS), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_SPIV_CLK), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_SPIV_DI), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_RESET_N), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_GPIO33), MP_ROM_PTR(&pin_GPIO10) }, - -======= ->>>>>>> 352281e23e803088209c27f8780a4e1e9d9503b1 + { 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) }, From d52f149e84bcef370d893f8cbc97c0279d7c384c Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 22 May 2021 12:22:28 -0400 Subject: [PATCH 27/40] add ESP CS pin to make wifi demos easier --- ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c index 0efd6d32f0..ef9f5f1616 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c @@ -10,6 +10,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_GPIO2) }, // ESP32 FW boot state pin (confusingly named GPIO0) { MP_ROM_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_GPIO9) }, // Primary SPI { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, From 2e90d5ed07f9b76484590e9d60067d067f2bcafb Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 22 May 2021 12:39:42 -0400 Subject: [PATCH 28/40] clang a bit --- .../boards/arduino_nano_rp2040_connect/mpconfigboard.h | 2 +- ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h index c1e2408854..6ed0bac641 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/mpconfigboard.h @@ -1,7 +1,7 @@ #define MICROPY_HW_BOARD_NAME "Arduino Nano RP2040 Connect" #define MICROPY_HW_MCU_NAME "rp2040" -//#define MICROPY_HW_LED_STATUS (&pin_GPIO6) +// #define MICROPY_HW_LED_STATUS (&pin_GPIO6) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO13) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO12) diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c index ef9f5f1616..68b42ccd09 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/pins.c @@ -56,7 +56,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, - { 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) }, From 262ad3dce0b9b4e6ede02d6e89245efef0db32a3 Mon Sep 17 00:00:00 2001 From: Alvaro Figueroa Date: Fri, 21 May 2021 18:26:10 +0000 Subject: [PATCH 29/40] Translated using Weblate (Spanish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 55fb840f46..7f0fe6f404 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-21 17:47+0000\n" -"Last-Translator: Jose David M \n" +"PO-Revision-Date: 2021-05-22 17:58+0000\n" +"Last-Translator: Alvaro Figueroa \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1738,7 +1738,7 @@ msgstr "Solo un color puede ser transparente a la vez" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int or string supported for ip" -msgstr "" +msgstr "Para ip solo puede con un entero o una cadena" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" From 34c2701e5d185f9719d261a1ff37812804a9c326 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 21 May 2021 18:48:09 +0000 Subject: [PATCH 30/40] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (993 of 993 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 134ba55ae2..5f1fb323c7 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: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-20 13:02+0000\n" +"PO-Revision-Date: 2021-05-22 17:58+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1736,7 +1736,7 @@ msgstr "Apenas uma cor pode ser transparente de cada vez" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int or string supported for ip" -msgstr "" +msgstr "Apenas int ou string bruto é compatível para o ip" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" From 9d017ae88359d821c30569fd4482da89ebaae024 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 21 May 2021 18:36:37 +0000 Subject: [PATCH 31/40] Translated using Weblate (Swedish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index cf60d5df38..fade5b27a0 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-20 13:02+0000\n" +"PO-Revision-Date: 2021-05-22 17:58+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1720,7 +1720,7 @@ msgstr "Bara en färg kan vara genomskinlig i taget" #: shared-bindings/ipaddress/__init__.c msgid "Only raw int or string supported for ip" -msgstr "" +msgstr "Enbart int eller string stöds för ip" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" From c665eb9bb593c7d9028f14bc8fde0ef1ab76ad49 Mon Sep 17 00:00:00 2001 From: James Carr <70200140+lesamouraipourpre@users.noreply.github.com> Date: Sun, 23 May 2021 08:51:35 +0100 Subject: [PATCH 32/40] Incompatible .mpy file Update the *ValueError: Incompatible .mpy file* section for the upcoming 6 to 7 transition. --- docs/troubleshooting.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 45c637f349..d78c1a4568 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -45,11 +45,11 @@ This error occurs when importing a module that is stored as a ``mpy`` binary fil (rather than a ``py`` text file) that was generated by a different version of CircuitPython than the one it's being loaded into. Most versions are compatible but, rarely they aren't. In particular, the ``mpy`` binary format changed between -CircuitPython versions 1.x and 2.x, and will change again between 2.x and 3.x. +CircuitPython versions 1.x and 2.x, 2.x and 3.x, and will change again between 6.x and 7.x. -So, for instance, if you just upgraded to CircuitPython 2.x from 1.x you'll need to download a +So, for instance, if you just upgraded to CircuitPython 7.x from 6.x you'll need to download a newer version of the library that triggered the error on ``import``. They are all available in the `Adafruit bundle `_ and the `Community bundle `_. -Make sure to download a version with 2.0.0 or higher in the filename. +Make sure to download a version with 7.0.0 or higher in the filename. From 61a7212b281ac09b4da83460331f95da515f92d1 Mon Sep 17 00:00:00 2001 From: James Carr <70200140+lesamouraipourpre@users.noreply.github.com> Date: Sun, 23 May 2021 08:57:41 +0100 Subject: [PATCH 33/40] Update comment in persistentcode.c Update comment in mp_raw_code_save so that it matches the code. --- py/persistentcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/persistentcode.c b/py/persistentcode.c index ac59243350..e604569fe2 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -826,7 +826,7 @@ STATIC bool mp_raw_code_has_native(mp_raw_code_t *rc) { void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print) { // header contains: - // byte 'M' + // byte 'C' // byte version // byte feature flags // byte number of bits in a small int From 3b986e65c4d410a955d5bf17de6b7f845a2550ed Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 24 May 2021 22:32:57 +0200 Subject: [PATCH 34/40] 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/el.po | 8 ++++---- locale/en_GB.po | 8 ++++---- locale/es.po | 11 +++++++---- locale/fil.po | 8 ++++---- locale/fr.po | 8 ++++---- locale/hi.po | 8 ++++---- locale/it_IT.po | 8 ++++---- locale/ja.po | 8 ++++---- locale/ko.po | 8 ++++---- locale/nl.po | 8 ++++---- locale/pl.po | 8 ++++---- locale/pt_BR.po | 11 +++++++---- locale/sv.po | 11 +++++++---- locale/zh_Latn_pinyin.po | 8 ++++---- 17 files changed, 77 insertions(+), 68 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index be0217bf96..f0e702b7f0 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1695,6 +1695,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1718,10 +1722,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index de6f46f646..aebc210b81 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1675,6 +1675,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1696,10 +1700,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index aff8c71509..12a9112722 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1697,6 +1697,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1720,10 +1724,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/el.po b/locale/el.po index f933431230..3430bb0078 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1672,6 +1672,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1693,10 +1697,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 0e28dad664..0b9eb660c3 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1689,6 +1689,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1712,10 +1716,6 @@ msgstr "Only one alarm.time alarm can be set." msgid "Only one color can be transparent at a time" msgstr "Only one colour can be transparent at a time" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "Operation or feature not supported" diff --git a/locale/es.po b/locale/es.po index 7f0fe6f404..e3afeae954 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1713,6 +1713,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "Este hardware solo tiene capacidad para detección de borde" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1736,10 +1740,6 @@ msgstr "Solamente una alarm.time puede ser configurada." msgid "Only one color can be transparent at a time" msgstr "Solo un color puede ser transparente a la vez" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "Para ip solo puede con un entero o una cadena" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "Operación no característica no soportada" @@ -4448,6 +4448,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Only raw int or string supported for ip" +#~ msgstr "Para ip solo puede con un entero o una cadena" + #~ msgid "Only raw int supported for ip" #~ msgstr "Solo se aceptan enteros crudos para ip" diff --git a/locale/fil.po b/locale/fil.po index f9d4beada0..ca689b783e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1690,6 +1690,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1711,10 +1715,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index c70841c30a..a55d920693 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1721,6 +1721,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1744,10 +1748,6 @@ msgstr "Seulement une alarme alarm.time peut être réglée." msgid "Only one color can be transparent at a time" msgstr "Une seule couleur peut être transparente à la fois" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "Opération ou fonction non supportée" diff --git a/locale/hi.po b/locale/hi.po index 7dd917e051..ecb7d2d8cc 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1672,6 +1672,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1693,10 +1697,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 1cfd7b4063..4b58d8d02e 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1704,6 +1704,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1725,10 +1729,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 0470193ef3..aa9b79ea5b 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1685,6 +1685,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1706,10 +1710,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index f2091b7fa7..82d4928e9f 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1675,6 +1675,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1696,10 +1700,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index df9dc35e11..8ba8094d45 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1688,6 +1688,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1711,10 +1715,6 @@ msgstr "Slechts één alarm.time alarm kan worden ingesteld." msgid "Only one color can be transparent at a time" msgstr "Er kan maar één kleur per keer transparant zijn" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index f23aff57e0..5497efcba3 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1683,6 +1683,10 @@ msgstr "Wspierane są tylko nieskompresowane pliki BMP: wielkość nagłówka %d msgid "Only edge detection is available on this hardware" msgstr "" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1704,10 +1708,6 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "W danym momencie przezroczysty może być tylko jeden kolor" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5f1fb323c7..e233ef3479 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1711,6 +1711,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "Apenas a detecção de borda está disponível neste hardware" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1734,10 +1738,6 @@ msgstr "Apenas um alarme alarm.time pode ser definido." msgid "Only one color can be transparent at a time" msgstr "Apenas uma cor pode ser transparente de cada vez" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "Apenas int ou string bruto é compatível para o ip" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "A operação ou o recurso não é suportado" @@ -4458,6 +4458,9 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Only raw int or string supported for ip" +#~ msgstr "Apenas int ou string bruto é compatível para o ip" + #~ msgid "Only raw int supported for ip" #~ msgstr "Apenas o int bruto é compatível para o ip" diff --git a/locale/sv.po b/locale/sv.po index fade5b27a0..a228a6cf11 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1695,6 +1695,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "Endast kantdetektering är tillgänglig för denna hårdvara" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1718,10 +1722,6 @@ msgstr "Endast ett alarm.time kan ställas in." msgid "Only one color can be transparent at a time" msgstr "Bara en färg kan vara genomskinlig i taget" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "Enbart int eller string stöds för ip" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "Operation eller funktion stöds inte" @@ -4417,6 +4417,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Only raw int or string supported for ip" +#~ msgstr "Enbart int eller string stöds för ip" + #~ msgid "Only raw int supported for ip" #~ msgstr "Endast raw int stöds för ip" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 39a40c077d..1ed603ae85 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1698,6 +1698,10 @@ msgstr "" msgid "Only edge detection is available on this hardware" msgstr "cǐ yìng jiàn shàng jǐn tí gòng biān yuán jiǎn cè" +#: shared-bindings/ipaddress/__init__.c +msgid "Only int or string supported for ip" +msgstr "" + #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" @@ -1721,10 +1725,6 @@ msgstr "zhǐ néng shè zhì yí gè bào jǐng." msgid "Only one color can be transparent at a time" msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" -#: shared-bindings/ipaddress/__init__.c -msgid "Only raw int or string supported for ip" -msgstr "" - #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" msgstr "bù zhī chí cāo zuò huò gōng néng" From 9895fae66e21b595e65b386cc10a6e05afb4ae1e Mon Sep 17 00:00:00 2001 From: Jose David M Date: Mon, 24 May 2021 20:53:55 +0000 Subject: [PATCH 35/40] Translated using Weblate (Spanish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index e3afeae954..fb4c3f5e96 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-22 17:58+0000\n" -"Last-Translator: Alvaro Figueroa \n" +"PO-Revision-Date: 2021-05-24 21:25+0000\n" +"Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1715,7 +1715,7 @@ msgstr "Este hardware solo tiene capacidad para detección de borde" #: shared-bindings/ipaddress/__init__.c msgid "Only int or string supported for ip" -msgstr "" +msgstr "Solamente int or string son permitados para una ip" #: shared-module/displayio/OnDiskBitmap.c #, c-format From cd2530401c124c5949ab6a03985e950d13df6cfe Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 24 May 2021 20:44:15 +0000 Subject: [PATCH 36/40] Translated using Weblate (Swedish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index a228a6cf11..f38f7240af 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-22 17:58+0000\n" +"PO-Revision-Date: 2021-05-24 21:25+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1697,7 +1697,7 @@ msgstr "Endast kantdetektering är tillgänglig för denna hårdvara" #: shared-bindings/ipaddress/__init__.c msgid "Only int or string supported for ip" -msgstr "" +msgstr "Endast int eller string stöds för ip" #: shared-module/displayio/OnDiskBitmap.c #, c-format From f21eec5fe17fc70ebf4803b96cca0a6e87b9da5e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 May 2021 08:30:41 -0500 Subject: [PATCH 37/40] Work for non-psram builds This is more or less a complete re-organization of the code. * Use the actual byte size of the .bin file as the flash size, as the algorithm for packing sections into the flash is complicated * Match each section to a data region & find the high water mark in the region * Report on all the RAM regions, separately Note that elftools is a requirement of esp-idf and so does not need to be listed in our requirements.txt. --- ports/esp32s2/Makefile | 4 +- ports/esp32s2/tools/build_memory_info.py | 89 ++++++++++++------------ 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 1d981cb42f..85d8e04332 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -316,11 +316,11 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group build-$(BOARD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception - $(Q)$(SIZE) $@ | $(PYTHON3) tools/build_memory_info.py $(BUILD)/esp-idf/sdkconfig -$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf +$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py $(STEPECHO) "Create $@" $(Q)esptool.py --chip esp32s2 elf2image $(FLASH_FLAGS) --elf-sha256-offset 0xb0 -o $@ $^ + $(Q)$(PYTHON3) tools/build_memory_info.py $< $(BUILD)/esp-idf/sdkconfig $@ $(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 diff --git a/ports/esp32s2/tools/build_memory_info.py b/ports/esp32s2/tools/build_memory_info.py index cf42851320..94fd07bb52 100644 --- a/ports/esp32s2/tools/build_memory_info.py +++ b/ports/esp32s2/tools/build_memory_info.py @@ -5,72 +5,75 @@ # # SPDX-License-Identifier: MIT +import os import re import sys -# Handle size constants with K or M suffixes (allowed in .ld but not in Python). -K_PATTERN = re.compile(r"([0-9]+)[kK]") -K_REPLACE = r"(\1*1024)" - -M_PATTERN = re.compile(r"([0-9]+)[mM]") -M_REPLACE = r"(\1*1024*1024)" +from elftools.elf.elffile import ELFFile print() -text = 0 -data = 0 -bss = 0 -# stdin is the linker output. -for line in sys.stdin: - # Uncomment to see linker output. - # print(line) - line = line.strip() - if not line.startswith("text"): - text, data, bss = map(int, line.split()[:3]) +internal_memory = [ + # Name, Start, Length + ("RTC Fast Memory", (0x3FF9_E000, 0x4007_0000), 8 * 1024), + ("RTC Slow Memory", (0x5000_0000,), 8 * 1024), + ("Internal SRAM 0", (0x3FFB_0000, 0x4002_0000), 32 * 1024), + ("Internal SRAM 1", (0x3FFB_8000, 0x4002_8000), 288 * 1024), +] def partition_size(arg): if "4MB" in arg: - return "1408K" + return 1408 * 1024 else: - return "2048K" + return 2048 * 1024 -regions = {} -# This file is the linker script. -with open(sys.argv[1], "r") as f: +def align(n, m): + return m * ((n + m - 1) // m) + + +regions = dict((name, 0) for name, _, _ in internal_memory) + +# This file is the elf +with open(sys.argv[1], "rb") as stream: + elffile = ELFFile(stream) + for section in elffile.iter_sections(): + start = section["sh_addr"] + size = section["sh_size"] + offset = section["sh_offset"] + if not size or not start: + continue + for name, starts, length in internal_memory: + for mem_start in starts: + mem_end = mem_start + length + if start >= mem_start and start < mem_end: + regions[name] = max(regions.get(name, 0), size) + # print("# putting %s in %s (start=0x%x, size=%d)" % (section.name, name, start, size)) + +# This file is the sdkconfig +with open(sys.argv[2], "r") as f: for line in f: line = line.strip() - if line.startswith("CONFIG_SPIRAM_SIZE"): - regions["RAM"] = line.split("=")[-1] if line.startswith("CONFIG_PARTITION_TABLE_FILENAME"): - regions["FLASH_FIRMWARE"] = partition_size(line.split("=")[-1]) + firmware_region = int(partition_size(line.split("=")[-1])) -for region in regions: - space = regions[region] - if "/*" in space: - space = space.split("/*")[0] - space = K_PATTERN.sub(K_REPLACE, space) - space = M_PATTERN.sub(M_REPLACE, space) - regions[region] = int(eval(space)) +# This file is the bin +used_flash = os.stat(sys.argv[3]).st_size -firmware_region = regions["FLASH_FIRMWARE"] -ram_region = regions["RAM"] - -used_flash = data + text free_flash = firmware_region - used_flash -used_ram = data + bss -free_ram = ram_region - used_ram print( - "{} bytes used, {} bytes free in flash firmware space out of {} bytes ({}kB).".format( + "{:7} bytes used, {:7} bytes free in flash firmware space out of {} bytes ({}kB).".format( used_flash, free_flash, firmware_region, firmware_region / 1024 ) ) -print( - "{} bytes used, {} bytes free in ram for stack and heap out of {} bytes ({}kB).".format( - used_ram, free_ram, ram_region, ram_region / 1024 - ) -) +for name, mem_start, length in internal_memory: + if name in regions: + print( + "{:7} bytes used, {:7} bytes free in '{}' out of {} bytes ({}kB).".format( + regions[name], length - regions[name], name, length, length / 1024 + ) + ) print() # Check that we have free flash space. GCC doesn't fail when the text + data From 0e10244f2bcb74e257c9cd94a5c6453c751e3d49 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 25 May 2021 12:30:27 +0000 Subject: [PATCH 38/40] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (993 of 993 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 e233ef3479..14baa40edf 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: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-22 17:58+0000\n" +"PO-Revision-Date: 2021-05-25 17:41+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1713,7 +1713,7 @@ msgstr "Apenas a detecção de borda está disponível neste hardware" #: shared-bindings/ipaddress/__init__.c msgid "Only int or string supported for ip" -msgstr "" +msgstr "Apenas int ou string é suportado para ip" #: shared-module/displayio/OnDiskBitmap.c #, c-format From 323b8b7edd944daf112e9a996d08ae7fd9106158 Mon Sep 17 00:00:00 2001 From: hexthat Date: Mon, 24 May 2021 22:05:13 +0000 Subject: [PATCH 39/40] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1ed603ae85..0f54ddec98 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-05-21 17:47+0000\n" +"PO-Revision-Date: 2021-05-25 17:41+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -1700,7 +1700,7 @@ msgstr "cǐ yìng jiàn shàng jǐn tí gòng biān yuán jiǎn cè" #: shared-bindings/ipaddress/__init__.c msgid "Only int or string supported for ip" -msgstr "" +msgstr "jǐn zhī chí IP de zhěng shù huò zì fú chuàn" #: shared-module/displayio/OnDiskBitmap.c #, c-format From 5eb4cc6489f2a210f347650386fa520384fc9f26 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 26 May 2021 16:01:17 -0400 Subject: [PATCH 40/40] Remove non-product Adafruit boards --- .github/workflows/build.yml | 3 - ports/atmel-samd/boards/pirkey_m0/board.c | 37 ------ .../boards/pirkey_m0/mpconfigboard.h | 58 ---------- .../boards/pirkey_m0/mpconfigboard.mk | 28 ----- ports/atmel-samd/boards/pirkey_m0/pins.c | 11 -- .../atmel-samd/boards/pybadge_airlift/board.c | 105 ------------------ .../boards/pybadge_airlift/mpconfigboard.h | 26 ----- .../boards/pybadge_airlift/mpconfigboard.mk | 17 --- .../atmel-samd/boards/pybadge_airlift/pins.c | 75 ------------- .../atmel-samd/boards/pygamer_advance/board.c | 105 ------------------ .../boards/pygamer_advance/mpconfigboard.h | 28 ----- .../boards/pygamer_advance/mpconfigboard.mk | 17 --- .../atmel-samd/boards/pygamer_advance/pins.c | 77 ------------- 13 files changed, 587 deletions(-) delete mode 100644 ports/atmel-samd/boards/pirkey_m0/board.c delete mode 100644 ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h delete mode 100644 ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk delete mode 100644 ports/atmel-samd/boards/pirkey_m0/pins.c delete mode 100644 ports/atmel-samd/boards/pybadge_airlift/board.c delete mode 100644 ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h delete mode 100644 ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.mk delete mode 100644 ports/atmel-samd/boards/pybadge_airlift/pins.c delete mode 100644 ports/atmel-samd/boards/pygamer_advance/board.c delete mode 100644 ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h delete mode 100644 ports/atmel-samd/boards/pygamer_advance/mpconfigboard.mk delete mode 100644 ports/atmel-samd/boards/pygamer_advance/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 165bb43e23..0b23f4538e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -295,16 +295,13 @@ jobs: - "pimoroni_picolipo_4mb" - "pimoroni_picosystem" - "pimoroni_tiny2040" - - "pirkey_m0" - "pitaya_go" - "pyb_nano_v2" - "pybadge" - - "pybadge_airlift" - "pyboard_v11" - "pycubed" - "pycubed_mram" - "pygamer" - - "pygamer_advance" - "pyportal" - "pyportal_titano" - "pyruler" diff --git a/ports/atmel-samd/boards/pirkey_m0/board.c b/ports/atmel-samd/boards/pirkey_m0/board.c deleted file mode 100644 index 84960e73cf..0000000000 --- a/ports/atmel-samd/boards/pirkey_m0/board.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 "supervisor/board.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h deleted file mode 100644 index 866e21991b..0000000000 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h +++ /dev/null @@ -1,58 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "Adafruit pIRKey M0" -#define MICROPY_HW_MCU_NAME "samd21e18" - -#define MICROPY_HW_APA102_MOSI (&pin_PA00) -#define MICROPY_HW_APA102_SCK (&pin_PA01) - -#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) - -#define IGNORE_PIN_PA02 1 -#define IGNORE_PIN_PA03 1 -#define IGNORE_PIN_PA04 1 -#define IGNORE_PIN_PA05 1 -#define IGNORE_PIN_PA06 1 -#define IGNORE_PIN_PA07 1 -#define IGNORE_PIN_PA08 1 -#define IGNORE_PIN_PA09 1 -#define IGNORE_PIN_PA10 1 -#define IGNORE_PIN_PA11 1 -#define IGNORE_PIN_PA12 1 -#define IGNORE_PIN_PA13 1 -#define IGNORE_PIN_PA14 1 -#define IGNORE_PIN_PA15 1 -#define IGNORE_PIN_PA16 1 -#define IGNORE_PIN_PA17 1 -#define IGNORE_PIN_PA18 1 -#define IGNORE_PIN_PA19 1 -#define IGNORE_PIN_PA20 1 -#define IGNORE_PIN_PA21 1 -#define IGNORE_PIN_PA22 1 -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 -#define IGNORE_PIN_PA27 1 -#define IGNORE_PIN_PA30 1 -#define IGNORE_PIN_PA31 1 -#define IGNORE_PIN_PB00 1 -#define IGNORE_PIN_PB01 1 -#define IGNORE_PIN_PB02 1 -#define IGNORE_PIN_PB03 1 -#define IGNORE_PIN_PB04 1 -#define IGNORE_PIN_PB05 1 -#define IGNORE_PIN_PB06 1 -#define IGNORE_PIN_PB07 1 -#define IGNORE_PIN_PB08 1 -#define IGNORE_PIN_PB09 1 -#define IGNORE_PIN_PB10 1 -#define IGNORE_PIN_PB11 1 -#define IGNORE_PIN_PB12 1 -#define IGNORE_PIN_PB13 1 -#define IGNORE_PIN_PB14 1 -#define IGNORE_PIN_PB15 1 -#define IGNORE_PIN_PB16 1 -#define IGNORE_PIN_PB17 1 -#define IGNORE_PIN_PB22 1 -#define IGNORE_PIN_PB23 1 -#define IGNORE_PIN_PB30 1 -#define IGNORE_PIN_PB31 1 diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk deleted file mode 100644 index ebbd1b601b..0000000000 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk +++ /dev/null @@ -1,28 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x8028 -USB_PRODUCT = "pIRKey M0" -USB_MANUFACTURER = "Adafruit Industries LLC" - -CHIP_VARIANT = SAMD21E18A -CHIP_FAMILY = samd21 - -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = NONE -CIRCUITPY_FULL_BUILD = 0 - -# A number of modules are removed for pIRKey to make room for frozen libraries. -# Many I/O functions are not available. -# math is very large and is also removed. -CIRCUITPY_ANALOGIO = 0 -CIRCUITPY_MATH = 0 -CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_PULSEIO = 1 -CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_RTC = 0 -CIRCUITPY_USB_MIDI = 1 -CIRCUITPY_TOUCHIO = 0 - -# Include these Python libraries in firmware. -# FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IRRemote diff --git a/ports/atmel-samd/boards/pirkey_m0/pins.c b/ports/atmel-samd/boards/pirkey_m0/pins.c deleted file mode 100644 index 74e135827e..0000000000 --- a/ports/atmel-samd/boards/pirkey_m0/pins.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_REMOTEIN), MP_ROM_PTR(&pin_PA28) }, - - { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA01) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c deleted file mode 100644 index fe3549a64a..0000000000 --- a/ports/atmel-samd/boards/pybadge_airlift/board.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.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" -#include "supervisor/shared/board.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, 0x08, // _MADCTL bottom to top refresh in vsync aligned order. - 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_PB13, &pin_PB15, 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_PB05, // TFT_DC Command or data - &pin_PB06, // TFT_CS Chip select - &pin_PB07, // 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, - 320, // Width (after rotation) - 240, // Height (after rotation) - 0, // column start - 0, // row start - 90, // rotation - 16, // Color depth - false, // grayscale - false, // pixels in byte share 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 - 0x37, // set vertical scroll command - display_init_sequence, - sizeof(display_init_sequence), - &pin_PA01, // 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 - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - board_reset_user_neopixels(&pin_PA15, 5); -} diff --git a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h deleted file mode 100644 index 921669d8cb..0000000000 --- a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.h +++ /dev/null @@ -1,26 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "Adafruit Pybadge Airlift" -#define MICROPY_HW_MCU_NAME "samd51j20" - -#define CIRCUITPY_MCU_FAMILY samd51 - -// This is for Rev B -#define MICROPY_HW_LED_STATUS (&pin_PA23) - -// These are pins not to reset. -// QSPI Data pins -#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) -// DotStar pins, QSPI CS, and QSPI SCK -#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) -#define MICROPY_PORT_C (0) -#define MICROPY_PORT_D (0) - -#define DEFAULT_I2C_BUS_SCL (&pin_PA13) -#define DEFAULT_I2C_BUS_SDA (&pin_PA12) - -#define DEFAULT_SPI_BUS_SCK (&pin_PA17) -#define DEFAULT_SPI_BUS_MOSI (&pin_PB23) -#define DEFAULT_SPI_BUS_MISO (&pin_PB22) - -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.mk deleted file mode 100644 index a88e5e5e5b..0000000000 --- a/ports/atmel-samd/boards/pybadge_airlift/mpconfigboard.mk +++ /dev/null @@ -1,17 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x8043 -USB_PRODUCT = "PyBadge AirLift" -USB_MANUFACTURER = "Adafruit Industries LLC" - -CHIP_VARIANT = SAMD51J20A -CHIP_FAMILY = samd51 - -QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = GD25Q16C -LONGINT_IMPL = MPZ - -CIRCUITPY_GAMEPAD = 1 -CIRCUITPY_GAMEPADSHIFT = 1 -CIRCUITPY_STAGE = 1 - -FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge diff --git a/ports/atmel-samd/boards/pybadge_airlift/pins.c b/ports/atmel-samd/boards/pybadge_airlift/pins.c deleted file mode 100644 index 1fbe63e8eb..0000000000 --- a/ports/atmel-samd/boards/pybadge_airlift/pins.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -#include "supervisor/board.h" -#include "shared-module/displayio/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - {MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB08)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB09)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA06)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB04)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB03)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB02)}, - - {MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB17)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB16)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB03)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB02)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB14)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA15)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA20)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA21)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22)}, - - {MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA23)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23)}, - - // I2C - {MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13)}, - - // SPI - {MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23)}, - - // Special named pins - {MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PB04)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_PB14)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PA27)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_PB00)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_OUT), MP_ROM_PTR(&pin_PB30)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_CLOCK), MP_ROM_PTR(&pin_PB31)}, - - // ESP control - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA14)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PA31)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PA00)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB12)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PB16)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB17)}, - - // TFT control pins - {MP_OBJ_NEW_QSTR(MP_QSTR_TFT_LITE), MP_ROM_PTR(&pin_PA01)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_PB15)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_PB13)}, - {MP_OBJ_NEW_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_PB07)}, - {MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_PB06)}, - {MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_PB05)}, - - {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_DISPLAY), MP_ROM_PTR(&displays[0].display)} -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c deleted file mode 100644 index 0711c4298a..0000000000 --- a/ports/atmel-samd/boards/pygamer_advance/board.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ - -#include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.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" -#include "supervisor/shared/board.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, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. - 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_PB13, &pin_PB12, 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_PA00, // TFT_DC Command or data - &pin_PB15, // TFT_CS Chip select - &pin_PB05, // 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, - 320, // Width (after rotation) - 240, // Height (after rotation) - 0, // column start - 0, // row start - 90, // rotation - 16, // Color depth - false, // Grayscale - false, // pixels in a byte share a row. Only valid for depths < 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 - 0x37, // set vertical scroll command - display_init_sequence, - sizeof(display_init_sequence), - &pin_PA01, // 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 - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - board_reset_user_neopixels(&pin_PA15, 5); -} diff --git a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h b/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h deleted file mode 100644 index fbe946b72f..0000000000 --- a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.h +++ /dev/null @@ -1,28 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "Adafruit PyGamer" -#define MICROPY_HW_MCU_NAME "samd51j20" - -#define CIRCUITPY_MCU_FAMILY samd51 - -#define MICROPY_HW_LED_STATUS (&pin_PA23) - -// These are pins not to reset. -// QSPI Data pins -#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) -// DotStar pins, QSPI CS, and QSPI SCK -#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) -#define MICROPY_PORT_C (0) -#define MICROPY_PORT_D (0) - -#define DEFAULT_I2C_BUS_SCL (&pin_PA13) -#define DEFAULT_I2C_BUS_SDA (&pin_PA12) - -#define DEFAULT_SPI_BUS_SCK (&pin_PA17) -#define DEFAULT_SPI_BUS_MOSI (&pin_PB23) -#define DEFAULT_SPI_BUS_MISO (&pin_PB22) - -#define DEFAULT_UART_BUS_RX (&pin_PB17) -#define DEFAULT_UART_BUS_TX (&pin_PB16) - -// USB is always used internally so skip the pin objects for it. -#define IGNORE_PIN_PA24 1 -#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.mk b/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.mk deleted file mode 100644 index a58e016542..0000000000 --- a/ports/atmel-samd/boards/pygamer_advance/mpconfigboard.mk +++ /dev/null @@ -1,17 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x803E -USB_PRODUCT = "PyGamer Advance" -USB_MANUFACTURER = "Adafruit Industries LLC" - -CHIP_VARIANT = SAMD51J20A -CHIP_FAMILY = samd51 - -QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = GD25Q64C -LONGINT_IMPL = MPZ - -CIRCUITPY_GAMEPAD = 1 -CIRCUITPY_GAMEPADSHIFT = 1 -CIRCUITPY_STAGE = 1 - -FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge diff --git a/ports/atmel-samd/boards/pygamer_advance/pins.c b/ports/atmel-samd/boards/pygamer_advance/pins.c deleted file mode 100644 index 57a38e6947..0000000000 --- a/ports/atmel-samd/boards/pygamer_advance/pins.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -#include "supervisor/board.h" -#include "shared-module/displayio/__init__.h" - -STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB08) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB09) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA06) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB02) }, - - { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA15) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA20) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA21) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) }, - - { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) }, - - // UART - { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) }, - - // I2C - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, - - // SPI - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23) }, - - // SDCS, dup of D4 - { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PA14) }, - - // Special named pins - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PB04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_PB14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PA27) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_PB00) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_OUT), MP_ROM_PTR(&pin_PB30) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_CLOCK), MP_ROM_PTR(&pin_PB31) }, - - // TFT control pins - { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_LITE), MP_ROM_PTR(&pin_PA01) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_PB12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_PB13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_PB05) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_PB15) }, - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_PA00) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_JOYSTICK_X), MP_ROM_PTR(&pin_PB07) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_JOYSTICK_Y), MP_ROM_PTR(&pin_PB06) }, - - { 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_DISPLAY), MP_ROM_PTR(&displays[0].display)} -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);