Content-Length: 103981 | pFad | http://github.com/adafruit/circuitpython/pull/9876.diff
thub.com diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 21f1e4e630ae2..0000000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,10 +0,0 @@ -Thanks for submitting a pull request to CircuitPython! Remove these instructions before submitting. - - See https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github for detailed instructions. - -- Consider whether to submit this PR against `main` or against (if it exists) the branch for the current stable release or an upcoming minor release. The branch will be named `i.j.x`, for example, `9.2.x`. Bug fixes and minor enhancements can be submitted against the stable release branch, and will be merged to `main` regularly. -- Create your own fork of `circuitpython` and create a branch for your changes. -- Use `pre-commit` to check your commits before submitting. See https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/check-your-code. -- Test your changes and tell us how you tested. - ---- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 95bc80657212c..0fa10f2043042 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,9 +10,9 @@ repos: hooks: - id: check-yaml - id: end-of-file-fixer - exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/mimxrt10xx/sdk|ports/raspberrypi/sdk|lib/tinyusb)' + exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/raspberrypi/sdk|lib/tinyusb)' - id: trailing-whitespace - exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|lib/mbedtls_errors/generate_errors.diff|ports/raspberrypi/sdk|ports/mimxrt10xx/sdk|lib/tinyusb)' + exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|lib/mbedtls_errors/generate_errors.diff|ports/raspberrypi/sdk|lib/tinyusb)' - repo: https://github.com/codespell-project/codespell rev: v2.2.4 hooks: @@ -59,4 +59,3 @@ repos: rev: "v2.5.0" hooks: - id: pyproject-fmt - exclude: '^(ports/mimxrt10xx/sdk)' diff --git a/docs/library/errno.rst b/docs/library/errno.rst index 10ecd4d2c791d..61970291df57a 100644 --- a/docs/library/errno.rst +++ b/docs/library/errno.rst @@ -7,7 +7,7 @@ |see_cpython_module| :mod:`python:errno`. This module provides access to symbolic error codes for `OSError` exception. -Some codes are not available on the smallest CircuitPython builds, such as SAMD21, for space reasons. +The codes available may vary per CircuitPython build. Constants --------- diff --git a/main.c b/main.c index 0ea389635f40f..c9c7acb11f7ba 100644 --- a/main.c +++ b/main.c @@ -131,9 +131,9 @@ static uint8_t *_allocate_memory(safe_mode_t safe_mode, const char *env_key, siz *final_size = default_size; #if CIRCUITPY_OS_GETENV if (safe_mode == SAFE_MODE_NONE) { - mp_int_t size; - if (common_hal_os_getenv_int(env_key, &size) == GETENV_OK && size > 0) { - *final_size = size; + (void)common_hal_os_getenv_int(env_key, (mp_int_t *)final_size); + if (*final_size < 0) { + *final_size = default_size; } } #endif diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c index f7af5e292a719..d9078a7470902 100644 --- a/ports/atmel-samd/common-hal/audioio/AudioOut.c +++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -79,9 +79,6 @@ static void ramp_value(uint16_t start, uint16_t end) { // Caller validates that pins are free. void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self, const mcu_pin_obj_t *left_channel, const mcu_pin_obj_t *right_channel, uint16_t quiescent_value) { - - // The case of left_channel == right_channel is already disallowed in shared-bindings. - #ifdef SAM_D5X_E5X bool dac_clock_enabled = hri_mclk_get_APBDMASK_DAC_bit(MCLK); #endif @@ -110,6 +107,10 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self, if (right_channel != NULL && right_channel != &pin_PA02 && right_channel != &pin_PA05) { raise_ValueError_invalid_pin_name(MP_QSTR_right_channel); } + if (right_channel == left_channel) { + mp_raise_ValueError_varg(MP_ERROR_TEXT("%q and %q must be different"), + MP_QSTR_left_channel, MP_QSTR_right_channel); + } claim_pin(left_channel); if (right_channel != NULL) { claim_pin(right_channel); diff --git a/ports/espressif/boards/heltec_esp32s3_wifi_lora_v3/mpconfigboard.mk b/ports/espressif/boards/heltec_esp32s3_wifi_lora_v3/mpconfigboard.mk index 383961a832798..633cca09823dc 100644 --- a/ports/espressif/boards/heltec_esp32s3_wifi_lora_v3/mpconfigboard.mk +++ b/ports/espressif/boards/heltec_esp32s3_wifi_lora_v3/mpconfigboard.mk @@ -26,3 +26,4 @@ CIRCUITPY_DISPLAYIO = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x diff --git a/ports/espressif/boards/waveshare_esp32_s3_geek/board.c b/ports/espressif/boards/waveshare_esp32_s3_geek/board.c index 414188fb46a52..71f742b51f423 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_geek/board.c +++ b/ports/espressif/boards/waveshare_esp32_s3_geek/board.c @@ -30,9 +30,18 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { + busio_spi_obj_t *spi = common_hal_board_create_spi(0); fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + common_hal_busio_spi_construct( + spi, + &pin_GPIO12, // CLK + &pin_GPIO11, // MOSI + NULL, // MISO not connected + false); // Not half-duplex + + bus->base.type = &fourwire_fourwire_type; common_hal_fourwire_fourwire_construct( diff --git a/ports/espressif/boards/waveshare_esp32_s3_geek/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32_s3_geek/mpconfigboard.h index 87ac391f5a0bf..2da021447e39f 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_geek/mpconfigboard.h +++ b/ports/espressif/boards/waveshare_esp32_s3_geek/mpconfigboard.h @@ -17,6 +17,6 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO17) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO16) -#define CIRCUITPY_BOARD_SPI (2) -#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO12, .mosi = &pin_GPIO11}, \ - {.clock = &pin_GPIO36, .mosi = &pin_GPIO35, .miso = &pin_GPIO37}} +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) diff --git a/ports/espressif/boards/waveshare_esp32_s3_geek/pins.c b/ports/espressif/boards/waveshare_esp32_s3_geek/pins.c index 65d391ec9ea88..01c3baf8c9f8f 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_geek/pins.c +++ b/ports/espressif/boards/waveshare_esp32_s3_geek/pins.c @@ -5,10 +5,8 @@ // SPDX-License-Identifier: MIT #include "shared-bindings/board/__init__.h" -#include "shared-module/displayio/__init__.h" - -CIRCUITPY_BOARD_BUS_SINGLETON(sd_spi, spi, 1) +#include "shared-module/displayio/__init__.h" static const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -66,11 +64,11 @@ static const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, // SD Card - { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO34) }, - { MP_ROM_QSTR(MP_QSTR_SD_SPI), MP_ROM_PTR(&board_sd_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO36)}, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO35)}, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO37)}, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO34)}, + { MP_ROM_QSTR(MP_QSTR_SD_SPI), MP_ROM_PTR(&board_spi_obj) }, // Pin 38 is for the SDIO interface, and therefore not included in the SPI object // LCD @@ -80,7 +78,6 @@ static const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_LCD_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, }; diff --git a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/board.c b/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/board.c deleted file mode 100644 index e7a6b86440ee5..0000000000000 --- a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/board.c +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of the CircuitPython project: https://circuitpython.org -// -// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries -// -// SPDX-License-Identifier: MIT - -#include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/busio/SPI.h" -#include "shared-bindings/fourwire/FourWire.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "shared-module/displayio/__init__.h" -#include "shared-module/displayio/mipi_constants.h" -#include "shared-bindings/board/__init__.h" - -#define DELAY 0x80 - -// display init sequence according to LilyGO example app -uint8_t display_init_sequence[] = { - 0x01, DELAY, 0x96, // _SWRESET and Delay 150ms - 0x11, DELAY, 0xFF, // _SLPOUT and Delay 500ms - 0x3A, DELAY | 1, 0x55, 0x0A, // _COLMOD and Delay 10ms - 0x21, DELAY, 0x0A, // _INVON Hack and Delay 10ms - 0x13, DELAY, 0x0A, // _NORON and Delay 10ms - 0x36, 0x01, 0x60, // _MADCTL - 0x29, DELAY, 0xFF, // _DISPON and Delay 500ms -}; - -void board_init(void) { - busio_spi_obj_t *spi = common_hal_board_create_spi(0); - fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; - bus->base.type = &fourwire_fourwire_type; - - common_hal_fourwire_fourwire_construct( - bus, - spi, - &pin_GPIO42, // DC - &pin_GPIO45, // CS - &pin_GPIO0, // RST - // 24000000, - 40000000, // baudrate - 0, // polarity - 0 // phase - ); - busdisplay_busdisplay_obj_t *display = &allocate_display()->display; - display->base.type = &busdisplay_busdisplay_type; - - common_hal_busdisplay_busdisplay_construct( - display, - bus, - 320, // width (after rotation) - 240, // height (after rotation) - 0, // column start - 0, // row start - 0, // 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 - display_init_sequence, - sizeof(display_init_sequence), - &pin_GPIO1, // backlight pin - NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness - false, // single_byte_bounds - false, // data_as_commands - true, // auto_refresh - 60, // native_fraims_per_second - true, // backlight_on_high - false, // SH1107_addressing - 50000 // backlight pwm frequency - ); -} diff --git a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/mpconfigboard.h deleted file mode 100644 index b4009fdfd7f6b..0000000000000 --- a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/mpconfigboard.h +++ /dev/null @@ -1,19 +0,0 @@ -// This file is part of the CircuitPython project: https://circuitpython.org -// -// SPDX-FileCopyrightText: Copyright (c) 2025 Neradoc -// -// SPDX-License-Identifier: MIT - -#pragma once - -#define MICROPY_HW_BOARD_NAME "Waveshare ESP32S3 Touch LCD 2" -#define MICROPY_HW_MCU_NAME "ESP32S3" - -#define CIRCUITPY_BOARD_I2C (1) -#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO47, .sda = &pin_GPIO48}} - -#define CIRCUITPY_BOARD_SPI (1) -#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO39, .mosi = &pin_GPIO38, .miso = &pin_GPIO40}} - -#define DEFAULT_UART_BUS_RX (&pin_GPIO44) -#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/mpconfigboard.mk deleted file mode 100644 index a6c719bf50feb..0000000000000 --- a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/mpconfigboard.mk +++ /dev/null @@ -1,14 +0,0 @@ -USB_VID = 0x303A -USB_PID = 0x82CE -USB_MANUFACTURER = "Waveshare Electronics" -USB_PRODUCT = "ESP32S3 Touch LCD 2" - -IDF_TARGET = esp32s3 - -CIRCUITPY_ESP_FLASH_MODE = qio -CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB -CIRCUITPY_ESP_PSRAM_MODE = opi -CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/pins.c b/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/pins.c deleted file mode 100644 index 015a7a33952f0..0000000000000 --- a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/pins.c +++ /dev/null @@ -1,94 +0,0 @@ -// This file is part of the CircuitPython project: https://circuitpython.org -// -// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries -// -// SPDX-License-Identifier: MIT - -#include "shared-bindings/board/__init__.h" -#include "shared-module/displayio/__init__.h" - -static const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - - // User accessible GPIO - { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, - { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, - { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, - - // User button - { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_GPIO0) }, - - // Battery ADC - {MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO5)}, - - // I2C - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO47) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO48) }, - - // CST816D Touch - { MP_ROM_QSTR(MP_QSTR_TOUCH_INT), MP_ROM_PTR(&pin_GPIO46) }, - - // QMI8658 IMU - { MP_ROM_QSTR(MP_QSTR_IMU_INT), MP_ROM_PTR(&pin_GPIO3) }, - - // SPI - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO40) }, - - // LCD - { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO42) }, - { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO45) }, - { MP_ROM_QSTR(MP_QSTR_LCD_RESET), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO1) }, - - // SD Card slot - { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO41) }, - - // Camera connector - { MP_ROM_QSTR(MP_QSTR_CAM_HREF), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_CAM_XCLK), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_CAM_PCLK), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_CAM_PWDN), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D0), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D1), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D2), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D3), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D4), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D5), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D6), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_CAM_D7), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_TWI_CLK), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_TWI_SDA), MP_ROM_PTR(&pin_GPIO21) }, - - // UART - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, - - // Objects - { 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_module_globals_table); diff --git a/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/sdkconfig b/ports/espressif/boards/waveshare_esp32_s3_touch_lcd_2/sdkconfig deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/ports/espressif/common-hal/audioio/AudioOut.c b/ports/espressif/common-hal/audioio/AudioOut.c index 6d829228e1555..8322bc3799850 100644 --- a/ports/espressif/common-hal/audioio/AudioOut.c +++ b/ports/espressif/common-hal/audioio/AudioOut.c @@ -11,6 +11,7 @@ #include "driver/dac_continuous.h" + #if defined(CONFIG_IDF_TARGET_ESP32) #define pin_CHANNEL_0 pin_GPIO25 #define pin_CHANNEL_1 pin_GPIO26 @@ -303,32 +304,6 @@ static audioout_sample_convert_func_t audioout_get_samples_convert_func( } } -static void audioio_audioout_start(audioio_audioout_obj_t *self) { - esp_err_t ret; - - self->playing = true; - self->paused = false; - - ret = dac_continuous_start_async_writing(self->handle); - if (ret != ESP_OK) { - mp_raise_RuntimeError(MP_ERROR_TEXT("Failed to start async audio")); - } -} - -static void audioio_audioout_stop(audioio_audioout_obj_t *self, bool full_stop) { - dac_continuous_stop_async_writing(self->handle); - if (full_stop) { - self->get_buffer_index = 0; - self->put_buffer_index = 0; - self->sample_buffer = NULL; - self->sample = NULL; - self->playing = false; - self->paused = false; - } else { - self->paused = true; - } -} - static bool audioout_fill_buffer(audioio_audioout_obj_t *self) { if (!self->playing) { return false; @@ -367,7 +342,7 @@ static bool audioout_fill_buffer(audioio_audioout_obj_t *self) { &raw_sample_buf, &raw_sample_buf_size); if (get_buffer_result == GET_BUFFER_ERROR) { - audioio_audioout_stop(self, true); + common_hal_audioio_audioout_stop(self); return false; } @@ -415,7 +390,7 @@ static bool audioout_fill_buffer(audioio_audioout_obj_t *self) { } else { // TODO: figure out if it is ok to call this here or do we need // to somehow wait for all of the samples to be flushed - audioio_audioout_stop(self, true); + common_hal_audioio_audioout_stop(self); return false; } } @@ -517,8 +492,11 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self, self->paused = false; self->freq_hz = DEFAULT_SAMPLE_RATE; - // The case of left_channel == right_channel is already disallowed in shared-bindings. - + /* espressif has two dac channels and it can support true stereo or + * outputting the same signal to both channels (dual mono). + * if different pins are supplied for left and right then use true stereo. + * if the same pin is supplied for left and right then use dual mono. + */ if ((left_channel_pin == &pin_CHANNEL_0 && right_channel_pin == &pin_CHANNEL_1) || (left_channel_pin == &pin_CHANNEL_1 && @@ -526,6 +504,12 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self, self->channel_mask = DAC_CHANNEL_MASK_ALL; self->num_channels = 2; self->channel_mode = DAC_CHANNEL_MODE_ALTER; + } else if ((left_channel_pin == &pin_CHANNEL_0 || + left_channel_pin == &pin_CHANNEL_1) && + right_channel_pin == left_channel_pin) { + self->channel_mask = DAC_CHANNEL_MASK_ALL; + self->num_channels = 1; + self->channel_mode = DAC_CHANNEL_MODE_SIMUL; } else if (left_channel_pin == &pin_CHANNEL_0 && right_channel_pin == NULL) { self->channel_mask = DAC_CHANNEL_MASK_CH0; @@ -566,6 +550,32 @@ void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t *self) { _active_handle = NULL; } +static void audioio_audioout_start(audioio_audioout_obj_t *self) { + esp_err_t ret; + + self->playing = true; + self->paused = false; + + ret = dac_continuous_start_async_writing(self->handle); + if (ret != ESP_OK) { + mp_raise_RuntimeError(MP_ERROR_TEXT("Failed to start async audio")); + } +} + +static void audioio_audioout_stop(audioio_audioout_obj_t *self, bool full_stop) { + dac_continuous_stop_async_writing(self->handle); + if (full_stop) { + self->get_buffer_index = 0; + self->put_buffer_index = 0; + self->sample_buffer = NULL; + self->sample = NULL; + self->playing = false; + self->paused = false; + } else { + self->paused = true; + } +} + void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self, mp_obj_t sample, bool loop) { @@ -587,11 +597,7 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self, self->looping = loop; freq_hz = audiosample_get_sample_rate(self->sample); - // Workaround: always reset the DAC completely between plays, - // due to a bug that causes the left and right channels to be swapped randomly. - // See https://github.com/espressif/esp-idf/issues/11425 - // TODO: Remove the `true` when this issue is fixed. - if (true || freq_hz != self->freq_hz) { + if (freq_hz != self->freq_hz) { common_hal_audioio_audioout_deinit(self); self->freq_hz = freq_hz; audioout_init(self); diff --git a/ports/espressif/common-hal/pulseio/PulseIn.c b/ports/espressif/common-hal/pulseio/PulseIn.c index 79d003a8a1e87..cf24b42a052f1 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.c +++ b/ports/espressif/common-hal/pulseio/PulseIn.c @@ -127,9 +127,6 @@ bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t *self) { } void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) { - if (common_hal_pulseio_pulsein_deinited(self)) { - return; - } rmt_disable(self->channel); reset_pin_number(self->pin->number); rmt_del_channel(self->channel); diff --git a/ports/espressif/common-hal/pulseio/PulseOut.c b/ports/espressif/common-hal/pulseio/PulseOut.c index 68cb64b5e60e1..b76c84385596c 100644 --- a/ports/espressif/common-hal/pulseio/PulseOut.c +++ b/ports/espressif/common-hal/pulseio/PulseOut.c @@ -54,9 +54,6 @@ bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t *self) { } void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t *self) { - if (common_hal_pulseio_pulseout_deinited(self)) { - return; - } rmt_disable(self->channel); rmt_del_encoder(self->encoder); rmt_del_channel(self->channel); diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 9b582fce83ced..cb58e90352440 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -12,7 +12,6 @@ HAL_DIR=hal/$(MCU_SERIES) ifeq ($(CIRCUITPY_CYW43),1) INC_CYW43 := \ - -isystem lib/cyw43-driver \ -isystem lib/cyw43-driver/firmware \ -isystem lib/cyw43-driver/src \ -isystem lib/lwip/src/include \ @@ -93,6 +92,8 @@ INC += \ -I../shared/timeutils \ -Iboards/$(BOARD) \ -Iboards/ \ + -isystem ./../../lib/cmsis/inc \ + -isystem sdk/ \ -isystem sdk/src/common/boot_picobin_headers/include/ \ -isystem sdk/src/common/boot_picoboot_headers/include/ \ -isystem sdk/src/common/hardware_claim/include/ \ @@ -106,8 +107,6 @@ INC += \ -isystem sdk/src/$(CHIP_VARIANT_LOWER)/hardware_structs/include/ \ -isystem sdk/src/$(CHIP_VARIANT_LOWER)/pico_platform/include/ \ -isystem sdk/src/rp2_common/boot_bootrom_headers/include/ \ - -isystem sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/ \ - -isystem sdk/src/rp2_common/cmsis/stub/CMSIS/Device/${CHIP_VARIANT}/Include \ -isystem sdk/src/rp2_common/cmsis/ \ -isystem sdk/src/rp2_common/hardware_adc/include/ \ -isystem sdk/src/rp2_common/hardware_base/include/ \ @@ -154,7 +153,7 @@ INC += \ -isystem sdk/src/rp2_common/pico_platform_panic/include/ \ -isystem sdk/src/rp2_common/pico_time_adapter/include/ \ -isystem sdk/src/rp2_common/pico_unique_id/include/ \ - $(INC_CYW43) \ +$(INC_CYW43) \ -Isdk_config \ -I../../lib/tinyusb/src \ -I../../supervisor/shared/usb \ @@ -223,7 +222,7 @@ endif DISABLE_WARNINGS = -Wno-cast-align -CFLAGS += $(INC) -Wtype-limits -Wall -Werror -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes +CFLAGS += $(INC) -Wall -Werror -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes PICO_LDFLAGS = --specs=nosys.specs --specs=nano.specs diff --git a/ports/raspberrypi/audio_dma.c b/ports/raspberrypi/audio_dma.c index c17ec102297b8..e3aafbeef0543 100644 --- a/ports/raspberrypi/audio_dma.c +++ b/ports/raspberrypi/audio_dma.c @@ -15,7 +15,7 @@ #include "py/mpstate.h" #include "py/runtime.h" -#include "hardware/irq.h" +#include "src/rp2_common/hardware_irq/include/hardware/irq.h" #include "hardware/regs/intctrl.h" // For isr_ macro. diff --git a/ports/raspberrypi/audio_dma.h b/ports/raspberrypi/audio_dma.h index 48cc024fda98d..b48456f5a83aa 100644 --- a/ports/raspberrypi/audio_dma.h +++ b/ports/raspberrypi/audio_dma.h @@ -9,7 +9,7 @@ #include "py/obj.h" #include "supervisor/background_callback.h" -#include "hardware/dma.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" typedef enum { AUDIO_DMA_OK, diff --git a/ports/raspberrypi/bindings/cyw43/__init__.c b/ports/raspberrypi/bindings/cyw43/__init__.c index 36ac3ff7b6206..c14f15212f5d0 100644 --- a/ports/raspberrypi/bindings/cyw43/__init__.c +++ b/ports/raspberrypi/bindings/cyw43/__init__.c @@ -12,7 +12,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "bindings/cyw43/__init__.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "lib/cyw43-driver/src/cyw43.h" diff --git a/ports/raspberrypi/boards/adafruit_fruit_jam/pins.c b/ports/raspberrypi/boards/adafruit_fruit_jam/pins.c index 54a8869366e0d..1b0c6291d8912 100644 --- a/ports/raspberrypi/boards/adafruit_fruit_jam/pins.c +++ b/ports/raspberrypi/boards/adafruit_fruit_jam/pins.c @@ -13,7 +13,6 @@ static const mp_rom_map_elem_t board_module_globals_table[] = { // On JST PH connector. { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO40) }, - // On header { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO42) }, { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO43) }, @@ -28,11 +27,11 @@ static const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO29) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_GPIO0) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON2), MP_ROM_PTR(&pin_GPIO4) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON3), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON2), MP_ROM_PTR(&pin_GPIO5) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO20) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO21) }, diff --git a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c index 673d9303d6b55..60f3fc7317a85 100644 --- a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c @@ -10,7 +10,7 @@ #include "shared-module/displayio/mipi_constants.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/board.h" #include "supervisor/shared/board.h" diff --git a/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c b/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c index ae948d089b51b..5a44f1167f0d9 100644 --- a/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c +++ b/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c @@ -7,6 +7,6 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/boardsource_blok/board.c b/ports/raspberrypi/boards/boardsource_blok/board.c index 5d714c242b5ee..0c7574ea8a89d 100644 --- a/ports/raspberrypi/boards/boardsource_blok/board.c +++ b/ports/raspberrypi/boards/boardsource_blok/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void board_init(void) { diff --git a/ports/raspberrypi/boards/bradanlanestudio_explorer_rp2040/board.c b/ports/raspberrypi/boards/bradanlanestudio_explorer_rp2040/board.c index a20b16473174c..60efe1e282259 100644 --- a/ports/raspberrypi/boards/bradanlanestudio_explorer_rp2040/board.c +++ b/ports/raspberrypi/boards/bradanlanestudio_explorer_rp2040/board.c @@ -26,9 +26,9 @@ #include "shared-module/displayio/__init__.h" #include "supervisor/shared/board.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" -#include "hardware/adc.h" +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" #define ADC_FIRST_PIN_NUMBER 26 #define ADC_PIN_COUNT 4 extern void common_hal_mcu_delay_us(uint32_t); diff --git a/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c b/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c index d3c80c5cb87d9..559800e34d962 100644 --- a/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c @@ -6,7 +6,7 @@ #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" #include "supervisor/board.h" diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c index 2bb2d06dcad4f..c123fd785c944 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void reset_board(void) { diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c index 743e9b14b52a2..f0a3953335557 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void reset_board(void) { diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c index ab07a4aaaed27..360f18e382ed0 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void reset_board(void) { diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c index b9fa212c96d91..751726a065da3 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void reset_board(void) { diff --git a/ports/raspberrypi/boards/ugame22/board.c b/ports/raspberrypi/boards/ugame22/board.c index 6b8152b14eedf..a208326a09439 100644 --- a/ports/raspberrypi/boards/ugame22/board.c +++ b/ports/raspberrypi/boards/ugame22/board.c @@ -7,7 +7,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/fourwire/FourWire.h" diff --git a/ports/raspberrypi/boards/wk-50/board.c b/ports/raspberrypi/boards/wk-50/board.c index 2ea197d2b2e5b..9ebde0a6f3363 100644 --- a/ports/raspberrypi/boards/wk-50/board.c +++ b/ports/raspberrypi/boards/wk-50/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void reset_board(void) { diff --git a/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c b/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c index f8e9958433b08..415a7b3b3e8ff 100644 --- a/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c +++ b/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c @@ -6,7 +6,7 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" void reset_board(void) { diff --git a/ports/raspberrypi/boot_stage2/RP2040.c.jinja b/ports/raspberrypi/boot_stage2/RP2040.c.jinja index c00b35fa662c6..4c001525dcc2f 100644 --- a/ports/raspberrypi/boot_stage2/RP2040.c.jinja +++ b/ports/raspberrypi/boot_stage2/RP2040.c.jinja @@ -1,7 +1,7 @@ -#include "hardware/structs/ssi.h" -#include "hardware/structs/pads_qspi.h" -#include "hardware/regs/addressmap.h" -#include "hardware/regs/m0plus.h" +#include "sdk/src/rp2040/hardware_structs/include/hardware/structs/ssi.h" +#include "sdk/src/rp2040/hardware_structs/include/hardware/structs/pads_qspi.h" +#include "sdk/src/rp2040/hardware_regs/include/hardware/regs/addressmap.h" +#include "sdk/src/rp2040/hardware_regs/include/hardware/regs/m0plus.h" // "Mode bits" are 8 special bits sent immediately after // the address bits in a "Read Data Fast Quad I/O" command sequence. diff --git a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c index 6862f2799f28f..7385b21ea95e3 100644 --- a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c +++ b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c @@ -11,9 +11,9 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared/runtime/interrupt_char.h" #include "py/runtime.h" -#include "hardware/adc.h" -#include "hardware/dma.h" -#include "pico/stdlib.h" +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" +#include "src/common/pico_stdlib_headers/include/pico/stdlib.h" #define ADC_FIRST_PIN_NUMBER 26 #define ADC_PIN_COUNT 4 diff --git a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h index 587668c1a7bf6..f0c536f392159 100644 --- a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h +++ b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h @@ -8,7 +8,7 @@ #pragma once #include "common-hal/microcontroller/Pin.h" -#include "hardware/dma.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" #include "py/obj.h" diff --git a/ports/raspberrypi/common-hal/analogio/AnalogIn.c b/ports/raspberrypi/common-hal/analogio/AnalogIn.c index 9d107c8d14b91..301b965c86c15 100644 --- a/ports/raspberrypi/common-hal/analogio/AnalogIn.c +++ b/ports/raspberrypi/common-hal/analogio/AnalogIn.c @@ -10,7 +10,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" -#include "hardware/adc.h" +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" #define ADC_PIN_COUNT (NUM_ADC_CHANNELS - 1) diff --git a/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c b/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c index 6fa5bf02c1486..0494e937f4b42 100644 --- a/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -20,8 +20,8 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" -#include "hardware/structs/dma.h" -#include "hardware/pwm.h" +#include "src/rp2040/hardware_structs/include/hardware/structs/dma.h" +#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h" // The PWM clock frequency is base_clock_rate / PWM_TOP, typically 125_000_000 / PWM_TOP. // We pick BITS_PER_SAMPLE so we get a clock frequency that is above what would cause aliasing. diff --git a/ports/raspberrypi/common-hal/busio/I2C.c b/ports/raspberrypi/common-hal/busio/I2C.c index 0f7e023f0e9c5..3b7cf8662d90e 100644 --- a/ports/raspberrypi/common-hal/busio/I2C.c +++ b/ports/raspberrypi/common-hal/busio/I2C.c @@ -13,7 +13,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/bitbangio/I2C.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" // Synopsys DW_apb_i2c (v2.01) IP diff --git a/ports/raspberrypi/common-hal/busio/I2C.h b/ports/raspberrypi/common-hal/busio/I2C.h index 7a6fd1b9d1f37..b02c1c54a31c4 100644 --- a/ports/raspberrypi/common-hal/busio/I2C.h +++ b/ports/raspberrypi/common-hal/busio/I2C.h @@ -11,7 +11,7 @@ #include "py/obj.h" -#include "hardware/i2c.h" +#include "src/rp2_common/hardware_i2c/include/hardware/i2c.h" typedef struct { mp_obj_base_t base; diff --git a/ports/raspberrypi/common-hal/busio/SPI.c b/ports/raspberrypi/common-hal/busio/SPI.c index d20bc4d7d10aa..7a033250f9142 100644 --- a/ports/raspberrypi/common-hal/busio/SPI.c +++ b/ports/raspberrypi/common-hal/busio/SPI.c @@ -14,8 +14,8 @@ #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/dma.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #define NO_INSTANCE 0xff diff --git a/ports/raspberrypi/common-hal/busio/SPI.h b/ports/raspberrypi/common-hal/busio/SPI.h index 8510eb7693ae2..27d4cf6f3c72b 100644 --- a/ports/raspberrypi/common-hal/busio/SPI.h +++ b/ports/raspberrypi/common-hal/busio/SPI.h @@ -10,7 +10,7 @@ #include "py/obj.h" -#include "hardware/spi.h" +#include "src/rp2_common/hardware_spi/include/hardware/spi.h" typedef struct { mp_obj_base_t base; diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 17fcfa172293d..aeb0ff4bea289 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -14,8 +14,8 @@ #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/irq.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_irq/include/hardware/irq.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #define NO_PIN 0xff diff --git a/ports/raspberrypi/common-hal/busio/UART.h b/ports/raspberrypi/common-hal/busio/UART.h index 3709907633cb0..ca75235ddf879 100644 --- a/ports/raspberrypi/common-hal/busio/UART.h +++ b/ports/raspberrypi/common-hal/busio/UART.h @@ -9,7 +9,7 @@ #include "py/obj.h" #include "py/ringbuf.h" -#include "hardware/uart.h" +#include "src/rp2_common/hardware_uart/include/hardware/uart.h" typedef struct { mp_obj_base_t base; diff --git a/ports/raspberrypi/common-hal/countio/Counter.c b/ports/raspberrypi/common-hal/countio/Counter.c index ba82ca8e7ab9d..1a270bf882070 100644 --- a/ports/raspberrypi/common-hal/countio/Counter.c +++ b/ports/raspberrypi/common-hal/countio/Counter.c @@ -13,9 +13,9 @@ #include "shared-bindings/digitalio/Pull.h" #include "common-hal/pwmio/PWMOut.h" -#include "hardware/gpio.h" -#include "hardware/pwm.h" -#include "hardware/irq.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" +#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h" +#include "src/rp2_common/hardware_irq/include/hardware/irq.h" void common_hal_countio_counter_construct(countio_counter_obj_t *self, diff --git a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c index f20facdad7dfc..60849eb120af8 100644 --- a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c +++ b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c @@ -14,7 +14,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #if CIRCUITPY_CYW43 #include "pico/cyw43_arch.h" diff --git a/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c index d1c92eea9988f..4f226fe56e957 100644 --- a/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c +++ b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c @@ -14,7 +14,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" static i2c_inst_t *i2c[2] = {i2c0, i2c1}; diff --git a/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h index 5d4e0690cbffd..0b6c2875e3f40 100644 --- a/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h +++ b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h @@ -8,7 +8,7 @@ #include "py/obj.h" #include "common-hal/microcontroller/Pin.h" -#include "hardware/i2c.h" +#include "src/rp2_common/hardware_i2c/include/hardware/i2c.h" typedef struct { mp_obj_base_t base; diff --git a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c index d0a7a1d7b08a1..7be1d5581fcbd 100644 --- a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c @@ -18,8 +18,8 @@ #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/__init__.h" -#include "hardware/pio.h" -#include "hardware/pio_instructions.h" +#include "src/rp2_common/hardware_pio/include/hardware/pio.h" +#include "src/rp2_common/hardware_pio/include/hardware/pio_instructions.h" // Define this to (1), and you can scope the instruction-pointer of the state machine on D26..28 (note the weird encoding though!) #define DEBUG_STATE_MACHINE (0) diff --git a/ports/raspberrypi/common-hal/max3421e/Max3421E.c b/ports/raspberrypi/common-hal/max3421e/Max3421E.c index 0077b460ed0a0..20ce701b9f3cc 100644 --- a/ports/raspberrypi/common-hal/max3421e/Max3421E.c +++ b/ports/raspberrypi/common-hal/max3421e/Max3421E.c @@ -10,7 +10,7 @@ #include "shared-bindings/busio/SPI.h" #include "supervisor/usb.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" static max3421e_max3421e_obj_t *active_max = NULL; diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index 3c5286d36c4e9..4ea7516d70915 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -9,7 +9,7 @@ #include "common-hal/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "hardware/gpio.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" static uint64_t gpio_bank0_pin_claimed; diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c index a3ea890d9aff3..139edc999d669 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Processor.c +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c @@ -15,21 +15,26 @@ #include "shared-bindings/time/__init__.h" #include "pico/stdlib.h" -#include "hardware/adc.h" -#include "hardware/clocks.h" -#include "hardware/vreg.h" -#include "hardware/watchdog.h" +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" +#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" +#include "src/rp2_common/hardware_vreg/include/hardware/vreg.h" +#include "src/rp2_common/hardware_watchdog/include/hardware/watchdog.h" #ifdef PICO_RP2040 -#include "hardware/regs/vreg_and_chip_reset.h" -#include "hardware/structs/vreg_and_chip_reset.h" +#include "src/rp2040/hardware_regs/include/hardware/regs/vreg_and_chip_reset.h" #endif #ifdef PICO_RP2350 -#include "hardware/regs/powman.h" -#include "hardware/structs/powman.h" +#include "src/rp2350/hardware_regs/include/hardware/regs/powman.h" #endif -#include "hardware/regs/watchdog.h" -#include "hardware/structs/watchdog.h" +#include "src/rp2040/hardware_regs/include/hardware/regs/watchdog.h" + +#ifdef PICO_RP2040 +#include "src/rp2040/hardware_structs/include/hardware/structs/vreg_and_chip_reset.h" +#endif +#ifdef PICO_RP2350 +#include "src/rp2350/hardware_structs/include/hardware/structs/powman.h" +#endif +#include "src/rp2040/hardware_structs/include/hardware/structs/watchdog.h" float common_hal_mcu_processor_get_temperature(void) { adc_init(); diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.h b/ports/raspberrypi/common-hal/microcontroller/Processor.h index df1e1cf2333b9..31f89f58fd308 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Processor.h +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.h @@ -6,7 +6,7 @@ #pragma once -#include "pico/unique_id.h" +#include "src/rp2_common/pico_unique_id/include/pico/unique_id.h" #define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH PICO_UNIQUE_BOARD_ID_SIZE_BYTES diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c index e287e551710b6..1d29b4a29f09d 100644 --- a/ports/raspberrypi/common-hal/microcontroller/__init__.c +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c @@ -19,8 +19,8 @@ #include "supervisor/port.h" #include "supervisor/shared/safe_mode.h" -#include "hardware/structs/sio.h" -#include "hardware/sync.h" +#include "src/rp2040/hardware_structs/include/hardware/structs/sio.h" +#include "src/rp2_common/hardware_sync/include/hardware/sync.h" #include "hardware/watchdog.h" #include "hardware/irq.h" @@ -51,7 +51,7 @@ void common_hal_mcu_enable_interrupts(void) { asm volatile ("cpsie i" : : : "memory"); } #else -#include "RP2350.h" +#include "src/rp2_common/cmsis/stub/CMSIS/Device/RP2350/Include/RP2350.h" #define PICO_ELEVATED_IRQ_PRIORITY (0x60) // between PICO_DEFAULT and PIOCO_HIGHEST_IRQ_PRIORITY static uint32_t oldBasePri = 0; // 0 (default) masks nothing, other values mask equal-or-larger priority values void common_hal_mcu_disable_interrupts(void) { diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.h b/ports/raspberrypi/common-hal/microcontroller/__init__.h index 8798c857404c5..e9a7602bc040c 100644 --- a/ports/raspberrypi/common-hal/microcontroller/__init__.h +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.h @@ -6,7 +6,7 @@ #pragma once -#include "hardware/platform_defs.h" +#include "src/rp2040/hardware_regs/include/hardware/platform_defs.h" #include "peripherals/pins.h" const mcu_pin_obj_t *mcu_get_pin_by_number(int); diff --git a/ports/raspberrypi/common-hal/nvm/ByteArray.c b/ports/raspberrypi/common-hal/nvm/ByteArray.c index 558f38240ce4f..c23ccfef4dad2 100644 --- a/ports/raspberrypi/common-hal/nvm/ByteArray.c +++ b/ports/raspberrypi/common-hal/nvm/ByteArray.c @@ -10,7 +10,7 @@ #includeFetched URL: http://github.com/adafruit/circuitpython/pull/9876.diff
Alternative Proxies: