Merge branch 'adafruit:8.2.x' into 8.2.x
This commit is contained in:
commit
2047a8d485
|
@ -144,9 +144,6 @@
|
|||
path = ports/espressif/esp-idf
|
||||
url = https://github.com/adafruit/esp-idf.git
|
||||
branch = release/v4.4-circuitpython
|
||||
[submodule "ports/espressif/certificates/nina-fw"]
|
||||
path = lib/certificates/nina-fw
|
||||
url = https://github.com/adafruit/nina-fw.git
|
||||
[submodule "frozen/Adafruit_CircuitPython_ST7789"]
|
||||
path = frozen/Adafruit_CircuitPython_ST7789
|
||||
url = https://github.com/adafruit/Adafruit_CircuitPython_ST7789
|
||||
|
@ -341,3 +338,6 @@
|
|||
[submodule "frozen/Adafruit_CircuitPython_Wave"]
|
||||
path = frozen/Adafruit_CircuitPython_Wave
|
||||
url = https://github.com/adafruit/Adafruit_CircuitPython_Wave.git
|
||||
[submodule "lib/certificates"]
|
||||
path = lib/certificates
|
||||
url = https://github.com/adafruit/certificates
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit cbb33c111f245411370c1e571012472323df3f07
|
|
@ -1,3 +0,0 @@
|
|||
We share root certificates with the nina-fw to ensure they both use the same roots.
|
||||
|
||||
https://github.com/adafruit/nina-fw
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 21205e400515a698266abaaea902bd1ea897bb5d
|
|
@ -1 +1 @@
|
|||
Subproject commit ed2e7018718caebba2b7550517b556e7734357ef
|
||||
Subproject commit c9c1189e9d6200bb09bf4a87d84be9459cae481b
|
|
@ -10,9 +10,6 @@ QSPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
|
||||
CIRCUITPY_FULL_BUILD = 0
|
||||
CIRCUITPY_AUDIOIO = 0
|
||||
CIRCUITPY_AUDIOCORE = 0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#define MICROPY_HW_BOARD_NAME "CP32-M4"
|
||||
#define MICROPY_HW_MCU_NAME "samd51j20"
|
||||
#define MICROPY_HW_MCU_NAME "samd51j20A"
|
||||
|
||||
#define MICROPY_HW_APA102_MOSI (&pin_PA12)
|
||||
#define MICROPY_HW_APA102_SCK (&pin_PA13)
|
||||
|
|
|
@ -9,6 +9,3 @@ CHIP_FAMILY = samd51
|
|||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = "W25Q128JVxM"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G.
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
|
|
|
@ -10,7 +10,4 @@ QSPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICES = GD25Q16C
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
|
||||
CIRCUITPY_BITBANG_APA102 = 1
|
||||
|
|
|
@ -11,9 +11,6 @@ CIRCUITPY_FULL_BUILD = 0
|
|||
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
|
||||
CIRCUITPY_BITBANG_APA102 = 1
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
|
|
|
@ -1,5 +1,41 @@
|
|||
#include "py/objtuple.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_obj_tuple_t matrix_addr_tuple = {
|
||||
{&mp_type_tuple},
|
||||
5,
|
||||
{
|
||||
MP_ROM_PTR(&pin_PB07),
|
||||
MP_ROM_PTR(&pin_PB08),
|
||||
MP_ROM_PTR(&pin_PB09),
|
||||
MP_ROM_PTR(&pin_PB15),
|
||||
MP_ROM_PTR(&pin_PB13),
|
||||
}
|
||||
};
|
||||
|
||||
STATIC const mp_rom_obj_tuple_t matrix_data_tuple = {
|
||||
{&mp_type_tuple},
|
||||
6,
|
||||
{
|
||||
MP_ROM_PTR(&pin_PB00),
|
||||
MP_ROM_PTR(&pin_PB01),
|
||||
MP_ROM_PTR(&pin_PB02),
|
||||
|
||||
MP_ROM_PTR(&pin_PB03),
|
||||
MP_ROM_PTR(&pin_PB04),
|
||||
MP_ROM_PTR(&pin_PB05),
|
||||
}
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t matrix_common_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rgb_pins),MP_ROM_PTR(&matrix_data_tuple) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_clock_pin),MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_latch_pin),MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_output_enable_pin),MP_ROM_PTR(&pin_PB12) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(matrix_common_dict, matrix_common_table);
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
|
@ -30,6 +66,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA17) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRESS),MP_ROM_PTR(&matrix_addr_tuple) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MTX_COMMON),MP_ROM_PTR(&matrix_common_dict) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R1),MP_ROM_PTR(&pin_PB00) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G1),MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B1),MP_ROM_PTR(&pin_PB02) },
|
||||
|
|
|
@ -10,9 +10,6 @@ QSPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICES = "W25Q16JVxM, W25Q16JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
|
||||
CIRCUITPY_BITBANG_APA102 = 1
|
||||
|
||||
#Include these Python libraries in firmware.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#define MICROPY_HW_BOARD_NAME "Adafruit Monster M4SK"
|
||||
#define MICROPY_HW_MCU_NAME "samd51j19"
|
||||
// Board is mislabeled as SAMD51J19.
|
||||
#define MICROPY_HW_MCU_NAME "samd51g19"
|
||||
|
||||
#define CIRCUITPY_MCU_FAMILY samd51
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ USB_PID = 0x8048
|
|||
USB_PRODUCT = "Monster M4SK"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
CHIP_VARIANT = SAMD51J19A
|
||||
# Board is mislabeled as SAMD51J19.
|
||||
CHIP_VARIANT = SAMD51G19A
|
||||
CHIP_FAMILY = samd51
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
|
|
|
@ -12,8 +12,6 @@ SPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
# Make room for more stuff
|
||||
CIRCUITPY_BITMAPTOOLS = 0
|
||||
CIRCUITPY_DISPLAYIO = 0
|
||||
|
|
|
@ -10,7 +10,4 @@ QSPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
|
||||
CIRCUITPY_BITBANG_APA102 = 1
|
||||
|
|
|
@ -108,6 +108,11 @@ CIRCUITPY_SAMD ?= 1
|
|||
CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12
|
||||
CIRCUITPY_WATCHDOG ?= 1
|
||||
|
||||
ifeq ($(CHIP_VARIANT),SAMD51G19A)
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
endif
|
||||
|
||||
endif # samd51
|
||||
######################################################################
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ STATIC const mp_rom_obj_tuple_t matrix_addr_tuple = {
|
|||
{&mp_type_tuple},
|
||||
5,
|
||||
{
|
||||
MP_ROM_PTR(&pin_GPIO35),
|
||||
MP_ROM_PTR(&pin_GPIO45),
|
||||
MP_ROM_PTR(&pin_GPIO36),
|
||||
MP_ROM_PTR(&pin_GPIO48),
|
||||
MP_ROM_PTR(&pin_GPIO45),
|
||||
MP_ROM_PTR(&pin_GPIO35),
|
||||
MP_ROM_PTR(&pin_GPIO21),
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "components/driver/include/driver/gpio.h"
|
||||
|
||||
void board_init(void) {
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
|
||||
if (pin_number == 13) {
|
||||
// Set D13 LED to input when not in use
|
||||
gpio_set_direction(pin_number, GPIO_MODE_DEF_INPUT);
|
||||
gpio_set_pull_mode(pin_number, GPIO_PULLDOWN_ONLY);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Arduino Nano ESP32"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
// Status LED
|
||||
#define CIRCUITPY_RGB_STATUS_INVERTED_PWM
|
||||
#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO46)
|
||||
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO0)
|
||||
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO45)
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_GPIO13)
|
||||
|
||||
#if QSPI_FLASH_FILESYSTEM
|
||||
#define MICROPY_QSPI_DATA0 (&pin_GPIO32)
|
||||
#define MICROPY_QSPI_DATA1 (&pin_GPIO31)
|
||||
#define MICROPY_QSPI_DATA2 (&pin_GPIO28)
|
||||
#define MICROPY_QSPI_DATA3 (&pin_GPIO27)
|
||||
#define MICROPY_QSPI_SCK (&pin_GPIO30)
|
||||
#define MICROPY_QSPI_CS (&pin_GPIO29)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO12)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO11)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_GPIO44)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_GPIO43)
|
|
@ -0,0 +1,17 @@
|
|||
USB_VID = 0x2341
|
||||
USB_PID = 0x0070
|
||||
|
||||
USB_PRODUCT = "Arduino Nano ESP32"
|
||||
USB_MANUFACTURER = "Arduino"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE = 8MB
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 0
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25WQ128E
|
||||
|
||||
CIRCUITPY_ESPCAMERA = 0
|
|
@ -0,0 +1,64 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO46) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO47) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO2) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO3) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO4) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO11) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO12) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO45) },
|
||||
|
||||
{ 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Component config
|
||||
#
|
||||
#
|
||||
# ESP32S3-Specific
|
||||
#
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_MODE_QUAD is not set
|
||||
CONFIG_SPIRAM_MODE_OCT=y
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
|
||||
CONFIG_SPIRAM_SIZE=8388608
|
||||
#
|
||||
# PSRAM Clock and CS IO for ESP32S3
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM Clock and CS IO for ESP32S3
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
# CONFIG_SPIRAM_SPEED_40M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# end of SPI RAM config
|
||||
|
||||
# end of ESP32S3-Specific
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3"
|
||||
# end of LWIP
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "components/driver/include/driver/gpio.h"
|
||||
|
||||
void board_init(void) {
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
|
||||
if (pin_number == 13) {
|
||||
// Set D13 LED to input when not in use
|
||||
gpio_set_direction(pin_number, GPIO_MODE_DEF_INPUT);
|
||||
gpio_set_pull_mode(pin_number, GPIO_PULLDOWN_ONLY);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Arduino Nano ESP32"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
// Status LED
|
||||
#define CIRCUITPY_RGB_STATUS_INVERTED_PWM
|
||||
#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO46)
|
||||
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO45)
|
||||
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO0)
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_GPIO13)
|
||||
|
||||
#if QSPI_FLASH_FILESYSTEM
|
||||
#define MICROPY_QSPI_DATA0 (&pin_GPIO32)
|
||||
#define MICROPY_QSPI_DATA1 (&pin_GPIO31)
|
||||
#define MICROPY_QSPI_DATA2 (&pin_GPIO28)
|
||||
#define MICROPY_QSPI_DATA3 (&pin_GPIO27)
|
||||
#define MICROPY_QSPI_SCK (&pin_GPIO30)
|
||||
#define MICROPY_QSPI_CS (&pin_GPIO29)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO12)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO11)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47)
|
|
@ -0,0 +1,17 @@
|
|||
USB_VID = 0x2341
|
||||
USB_PID = 0x056B
|
||||
|
||||
USB_PRODUCT = "Arduino Nano ESP32"
|
||||
USB_MANUFACTURER = "Arduino"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE = 8MB
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 0
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25WQ128E
|
||||
|
||||
CIRCUITPY_ESPCAMERA = 0
|
|
@ -0,0 +1,64 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO46) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO47) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO2) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO3) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO4) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO11) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO12) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO45) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
||||
{ 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Component config
|
||||
#
|
||||
#
|
||||
# ESP32S3-Specific
|
||||
#
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_MODE_QUAD is not set
|
||||
CONFIG_SPIRAM_MODE_OCT=y
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
|
||||
CONFIG_SPIRAM_SIZE=8388608
|
||||
#
|
||||
# PSRAM Clock and CS IO for ESP32S3
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM Clock and CS IO for ESP32S3
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
# CONFIG_SPIRAM_SPEED_40M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# end of SPI RAM config
|
||||
|
||||
# end of ESP32S3-Specific
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="nano-esp32"
|
||||
# end of LWIP
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
|
||||
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "MagiClick S3 N4R2"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO17)
|
||||
// #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO38)
|
||||
|
||||
#define CIRCUITPY_BOARD_I2C (1)
|
||||
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO36, .sda = &pin_GPIO35}}
|
||||
|
||||
#define CIRCUITPY_BOARD_SPI (1)
|
||||
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO5, .mosi = &pin_GPIO4, .miso = &pin_GPIO6}}
|
||||
|
||||
// #define CIRCUITPY_BOARD_UART (1)
|
||||
// #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO5, .rx = &pin_GPIO16}}
|
||||
|
||||
#define DOUBLE_TAP_PIN (&pin_GPIO6)
|
|
@ -0,0 +1,15 @@
|
|||
USB_VID = 0x303A
|
||||
USB_PID = 0x81AA
|
||||
|
||||
USB_PRODUCT = "MagiClick S3 n4r2"
|
||||
USB_MANUFACTURER = "MakerM0"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE = 4MB
|
||||
|
||||
CIRCUITPY_ESPCAMERA = 0
|
||||
CIRCUITPY_DISPLAYIO = 1
|
||||
CIRCUITPY_GIFIO = 1
|
|
@ -0,0 +1,64 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ 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_IO10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ 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_IO13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ 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_IO19), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },
|
||||
{ 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_TX), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_K1), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_K2), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_K3), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IOX), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BAT), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AUDIO_WS), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AUDIO_BCK), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AUDIO_DATA), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AUDIO_SD), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LCD_RESET), 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_module_globals_table);
|
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Component config
|
||||
#
|
||||
#
|
||||
# ESP32S3-Specific
|
||||
#
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_MODE_QUAD is not set
|
||||
CONFIG_SPIRAM_MODE_QUAD=y
|
||||
CONFIG_SPIRAM_TYPE_AUTO=y
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
CONFIG_SPIRAM_SIZE=2097152
|
||||
# end of SPI RAM config
|
||||
|
||||
# PSRAM Clock and CS IO for ESP32S3
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM Clock and CS IO for ESP32S3
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_SPEED_120M is not set
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
# CONFIG_SPIRAM_SPEED_40M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# end of SPI RAM config
|
||||
|
||||
# end of ESP32S3-Specific
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="MagiClick-ESP32S3"
|
||||
# end of LWIP
|
|
@ -34,8 +34,9 @@
|
|||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_GPIO13)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)
|
||||
#define CIRCUITPY_BOARD_I2C (2)
|
||||
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO9, .sda = &pin_GPIO8}, \
|
||||
{.scl = &pin_GPIO15, .sda = &pin_GPIO16}}
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1)
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
|
@ -89,11 +91,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, // Blue LED
|
||||
// Blue LED
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
// STEMMA QT Vertical Connector I2C IO
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_GPIO16) },
|
||||
|
||||
// Battery voltage sense pin
|
||||
// I really don't know what name to use here. Adafruit use BATTERY & VOLTAGE_MONITOR
|
||||
// I prefer VBAT or VBAT_SENSE
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO2) },
|
||||
|
@ -103,18 +110,29 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO34) },
|
||||
|
||||
// Neopixel pins
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor
|
||||
{ MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor
|
||||
// Ambient Light Sensor
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control
|
||||
// Second LDO Enable control
|
||||
{ MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
|
||||
// I2C
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_STEMMA_VERTICAL_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) },
|
||||
|
||||
// SPI
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
|
||||
// UART
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
||||
|
|
|
@ -161,6 +161,10 @@ extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self) {
|
|||
|
||||
esp_camera_deinit();
|
||||
|
||||
reset_pin_number(self->camera_config.pin_pclk);
|
||||
reset_pin_number(self->camera_config.pin_vsync);
|
||||
reset_pin_number(self->camera_config.pin_href);
|
||||
|
||||
self->camera_config.xclk_freq_hz = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,16 +36,22 @@
|
|||
// Track whether the underlying IDF mdns has been started so that we only
|
||||
// create a single inited MDNS object to CircuitPython. (After deinit, another
|
||||
// could be created.)
|
||||
STATIC bool mdns_started = false;
|
||||
STATIC mdns_server_obj_t *_active_object = NULL;
|
||||
|
||||
void mdns_server_construct(mdns_server_obj_t *self, bool workflow) {
|
||||
if (mdns_started) {
|
||||
if (_active_object != NULL) {
|
||||
if (self == _active_object) {
|
||||
return;
|
||||
}
|
||||
// Mark this object as deinited because another is already using MDNS.
|
||||
self->inited = false;
|
||||
return;
|
||||
}
|
||||
mdns_init();
|
||||
mdns_started = true;
|
||||
esp_err_t ret = mdns_init();
|
||||
if (ret != ESP_OK) {
|
||||
return;
|
||||
}
|
||||
_active_object = self;
|
||||
|
||||
uint8_t mac[6];
|
||||
esp_netif_get_mac(common_hal_wifi_radio_obj.netif, mac);
|
||||
|
@ -86,10 +92,16 @@ void common_hal_mdns_server_deinit(mdns_server_obj_t *self) {
|
|||
return;
|
||||
}
|
||||
self->inited = false;
|
||||
mdns_started = false;
|
||||
_active_object = NULL;
|
||||
mdns_free();
|
||||
}
|
||||
|
||||
void mdns_server_deinit_singleton(void) {
|
||||
if (_active_object != NULL) {
|
||||
common_hal_mdns_server_deinit(_active_object);
|
||||
}
|
||||
}
|
||||
|
||||
bool common_hal_mdns_server_deinited(mdns_server_obj_t *self) {
|
||||
return !self->inited;
|
||||
}
|
||||
|
|
|
@ -36,3 +36,5 @@ typedef struct {
|
|||
// Track if this object owns access to the underlying MDNS service.
|
||||
bool inited;
|
||||
} mdns_server_obj_t;
|
||||
|
||||
void mdns_server_deinit_singleton(void);
|
||||
|
|
|
@ -61,6 +61,9 @@ void common_hal_rgbmatrix_timer_enable(void *ptr) {
|
|||
}
|
||||
|
||||
void common_hal_rgbmatrix_timer_disable(void *ptr) {
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
timer_index_t *timer = (timer_index_t *)ptr;
|
||||
if (timer->idx == TIMER_MAX) {
|
||||
return;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "components/lwip/include/apps/ping/ping_sock.h"
|
||||
|
||||
#if CIRCUITPY_MDNS
|
||||
#include "components/mdns/include/mdns.h"
|
||||
#include "common-hal/mdns/Server.h"
|
||||
#endif
|
||||
|
||||
#define MAC_ADDRESS_LENGTH 6
|
||||
|
@ -97,7 +97,7 @@ void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) {
|
|||
common_hal_wifi_radio_stop_scanning_networks(self);
|
||||
}
|
||||
#if CIRCUITPY_MDNS
|
||||
mdns_free();
|
||||
mdns_server_deinit_singleton();
|
||||
#endif
|
||||
ESP_ERROR_CHECK(esp_wifi_stop());
|
||||
self->started = false;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 630c2724fc8c69eeaaa1bb025de52b99c5cb11aa
|
||||
Subproject commit b6b7a7aad56ede8f2d4e213c3dd3621dacc34122
|
|
@ -776,7 +776,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
|
|||
# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set
|
||||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y
|
||||
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y
|
||||
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/nina-fw/data/roots.pem"
|
||||
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem"
|
||||
# end of Certificate Bundle
|
||||
|
||||
CONFIG_MBEDTLS_ECP_RESTARTABLE=y
|
||||
|
|
|
@ -572,7 +572,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
|
|||
# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set
|
||||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y
|
||||
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y
|
||||
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/nina-fw/data/roots.pem"
|
||||
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem"
|
||||
# end of Certificate Bundle
|
||||
|
||||
CONFIG_MBEDTLS_ECP_RESTARTABLE=y
|
||||
|
|
|
@ -266,15 +266,8 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
|
|||
}
|
||||
|
||||
void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
||||
volatile uint32_t *power_cycle = (void *)(self->uarte->p_reg) + 0xFFC;
|
||||
if (!common_hal_busio_uart_deinited(self)) {
|
||||
nrfx_uarte_rx_abort(self->uarte);
|
||||
nrfx_uarte_tx_abort(self->uarte);
|
||||
nrfx_uarte_uninit(self->uarte);
|
||||
// power cycle the peripheral as per https://devzone.nordicsemi.com/f/nordic-q-a/26030/how-to-reach-nrf52840-uarte-current-supply-specification/102605#102605
|
||||
*power_cycle = 0;
|
||||
*power_cycle;
|
||||
*power_cycle = 1;
|
||||
reset_pin_number(self->tx_pin_number);
|
||||
reset_pin_number(self->rx_pin_number);
|
||||
reset_pin_number(self->rts_pin_number);
|
||||
|
|
|
@ -345,7 +345,7 @@ CFLAGS += \
|
|||
-isystem $(TOP)/lib/mbedtls/include \
|
||||
-DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"' \
|
||||
|
||||
$(BUILD)/x509_crt_bundle.S: $(TOP)/lib/certificates/nina-fw/data/roots.pem $(TOP)/tools/gen_crt_bundle.py
|
||||
$(BUILD)/x509_crt_bundle.S: $(TOP)/lib/certificates/data/roots.pem $(TOP)/tools/gen_crt_bundle.py
|
||||
$(Q)$(PYTHON) $(TOP)/tools/gen_crt_bundle.py -i $< -o $@ --asm
|
||||
OBJ_MBEDTLS := $(BUILD)/x509_crt_bundle.o
|
||||
$(patsubst %.c,$(BUILD)/%.o,$(SRC_MBEDTLS))): CFLAGS += -Wno-suggest-attribute=format
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
|
@ -64,7 +66,7 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||
mp_arg_check_num(n_args, n_kw, 3, 3, false);
|
||||
uint32_t width = mp_arg_validate_int_range(mp_obj_get_int(all_args[0]), 0, 32767, MP_QSTR_width);
|
||||
uint32_t height = mp_arg_validate_int_range(mp_obj_get_int(all_args[1]), 0, 32767, MP_QSTR_height);
|
||||
uint32_t value_count = mp_arg_validate_int_range(mp_obj_get_int(all_args[2]), 1, 65535, MP_QSTR_value_count);
|
||||
uint32_t value_count = mp_arg_validate_int_range(mp_obj_get_int(all_args[2]), 1, 65536, MP_QSTR_value_count);
|
||||
uint32_t bits = 1;
|
||||
|
||||
while ((value_count - 1) >> bits) {
|
||||
|
|
|
@ -159,7 +159,11 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
|
|||
//| parameter is specified and is not 0, it is checked against the calculated
|
||||
//| height.
|
||||
//|
|
||||
//| Up to 30 RGB pins and 8 address pins are supported.
|
||||
//| Tiled matrices, those with more than one panel, must be laid out `in a specific order, as detailed in the guide
|
||||
//| <https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython/advanced-multiple-panels>`_.
|
||||
//|
|
||||
//| At least 6 RGB pins and 5 address pins are supported, for common panels with up to 64 rows of pixels.
|
||||
//| Some microcontrollers may support more, up to a soft limit of 30 RGB pins and 8 address pins.
|
||||
//|
|
||||
//| The RGB pins must be within a single "port" and performance and memory
|
||||
//| usage are best when they are all within "close by" bits of the port.
|
||||
|
@ -188,12 +192,20 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
|
|||
//| A RGBMatrix is often used in conjunction with a
|
||||
//| `framebufferio.FramebufferDisplay`.
|
||||
//|
|
||||
//| On boards designed for use with RGBMatrix panels, ``board.MTX_ADDRESS`` is a tuple of all the address pins, and ``board.MTX_COMMON`` is a dictionary with ``rgb_pins``, ``clock_pin``, ``latch_pin``, and ``output_enable_pin``.
|
||||
//| For panels that use fewer than the maximum number of address pins, "slice" ``MTX_ADDRESS`` to get the correct number of address pins.
|
||||
//| Using these board properties makes calling the constructor simpler and more portable:
|
||||
//|
|
||||
//| .. code-block:: python
|
||||
//|
|
||||
//| matrix = rgbmatrix.RGBMatrix(..., addr_pins=board.MTX_ADDRESS[:4], **board.MTX_COMMON)
|
||||
//|
|
||||
//| :param int width: The overall width of the whole matrix in pixels. For a matrix with multiple panels in row, this is the width of a single panel times the number of panels across.
|
||||
//| :param int tile: In a multi-row matrix, the number of rows of panels
|
||||
//| :param int bit_depth: The color depth of the matrix. A value of 1 gives 8 colors, a value of 2 gives 64 colors, and so on. Increasing bit depth increases the CPU and RAM usage of the RGBMatrix, and may lower the panel refresh rate. The framebuffer is always in RGB565 format regardless of the bit depth setting
|
||||
//| :param bool serpentine: In a multi-row matrix, True when alternate rows of panels are rotated 180°, which can reduce wiring length
|
||||
//| :param Sequence[digitalio.DigitalInOut] rgb_pins: The matrix's RGB pins
|
||||
//| :param Sequence[digitalio.DigitalInOut] addr_pins: The matrix's address pins
|
||||
//| :param Sequence[digitalio.DigitalInOut] rgb_pins: The matrix's RGB pins in the order ``(R1,G1,B1,R2,G2,B2...)``
|
||||
//| :param Sequence[digitalio.DigitalInOut] addr_pins: The matrix's address pins in the order ``(A,B,C,D...)``
|
||||
//| :param digitalio.DigitalInOut clock_pin: The matrix's clock pin
|
||||
//| :param digitalio.DigitalInOut latch_pin: The matrix's latch pin
|
||||
//| :param digitalio.DigitalInOut output_enable_pin: The matrix's output enable pin
|
||||
|
@ -364,9 +376,7 @@ STATIC const mp_rom_map_elem_t rgbmatrix_rgbmatrix_locals_dict_table[] = {
|
|||
STATIC MP_DEFINE_CONST_DICT(rgbmatrix_rgbmatrix_locals_dict, rgbmatrix_rgbmatrix_locals_dict_table);
|
||||
|
||||
STATIC void rgbmatrix_rgbmatrix_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) {
|
||||
rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t *)self_in;
|
||||
|
||||
*bufinfo = self->bufinfo;
|
||||
common_hal_rgbmatrix_rgbmatrix_get_bufinfo(self_in, bufinfo);
|
||||
}
|
||||
|
||||
// These version exists so that the prototype matches the protocol,
|
||||
|
@ -430,7 +440,7 @@ STATIC mp_int_t rgbmatrix_rgbmatrix_get_buffer(mp_obj_t self_in, mp_buffer_info_
|
|||
if ((flags & MP_BUFFER_WRITE) && !(self->bufinfo.typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW)) {
|
||||
return 1;
|
||||
}
|
||||
*bufinfo = self->bufinfo;
|
||||
common_hal_rgbmatrix_rgbmatrix_get_bufinfo(self_in, bufinfo);
|
||||
bufinfo->typecode = 'H';
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ extern const mp_obj_type_t rgbmatrix_RGBMatrix_type;
|
|||
void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, bool serpentine, void *timer);
|
||||
void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t *);
|
||||
void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t *);
|
||||
void common_hal_rgbmatrix_rgbmatrix_get_bufinfo(rgbmatrix_rgbmatrix_obj_t *self, mp_buffer_info_t *bufinfo);
|
||||
void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self);
|
||||
void common_hal_rgbmatrix_rgbmatrix_set_paused(rgbmatrix_rgbmatrix_obj_t *self, bool paused);
|
||||
bool common_hal_rgbmatrix_rgbmatrix_get_paused(rgbmatrix_rgbmatrix_obj_t *self);
|
||||
|
|
|
@ -101,7 +101,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_sslcontext_load_cert_chain_obj, 1, ssl_ssl
|
|||
STATIC mp_obj_t ssl_sslcontext_load_verify_locations(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_cadata };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_cadata, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_cadata, MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
};
|
||||
ssl_sslcontext_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
|
||||
|
|
|
@ -79,8 +79,12 @@ STATIC void common_hal_rgbmatrix_rgbmatrix_construct1(rgbmatrix_rgbmatrix_obj_t
|
|||
}
|
||||
// verify that the matrix is big enough
|
||||
mp_get_index(mp_obj_get_type(self->framebuffer), self->bufinfo.len, MP_OBJ_NEW_SMALL_INT(self->bufsize - 1), false);
|
||||
self->allocation = NULL;
|
||||
} else {
|
||||
self->bufinfo.buf = common_hal_rgbmatrix_allocator_impl(self->bufsize);
|
||||
// The supervisor allocation can move memory by changing self->allocation->ptr.
|
||||
// So we hold onto it and update bufinfo every time we use it.
|
||||
self->allocation = allocate_memory(align32_size(self->bufsize), false, true);
|
||||
self->bufinfo.buf = self->allocation->ptr;
|
||||
self->bufinfo.len = self->bufsize;
|
||||
self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW;
|
||||
}
|
||||
|
@ -146,7 +150,9 @@ STATIC void free_pin_seq(uint8_t *seq, int count) {
|
|||
|
||||
extern int pm_row_count;
|
||||
STATIC void common_hal_rgbmatrix_rgbmatrix_deinit1(rgbmatrix_rgbmatrix_obj_t *self) {
|
||||
common_hal_rgbmatrix_timer_disable(self->timer);
|
||||
if (self->timer != NULL) {
|
||||
common_hal_rgbmatrix_timer_disable(self->timer);
|
||||
}
|
||||
|
||||
if (_PM_protoPtr == &self->protomatter) {
|
||||
_PM_protoPtr = NULL;
|
||||
|
@ -160,15 +166,15 @@ STATIC void common_hal_rgbmatrix_rgbmatrix_deinit1(rgbmatrix_rgbmatrix_obj_t *se
|
|||
|
||||
// If it was supervisor-allocated, it is supervisor-freed and the pointer
|
||||
// is zeroed, otherwise the pointer is just zeroed
|
||||
if (self->bufinfo.buf) {
|
||||
common_hal_rgbmatrix_free_impl(self->bufinfo.buf);
|
||||
self->bufinfo.buf = NULL;
|
||||
if (self->allocation != NULL) {
|
||||
free_memory(self->allocation);
|
||||
}
|
||||
|
||||
|
||||
// If a framebuffer was passed in to the constructor, clear the reference
|
||||
// here so that it will become GC'able
|
||||
self->framebuffer = mp_const_none;
|
||||
|
||||
self->bufinfo.buf = NULL;
|
||||
}
|
||||
|
||||
void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t *self) {
|
||||
|
@ -187,6 +193,13 @@ void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t *self) {
|
|||
self->base.type = &mp_type_NoneType;
|
||||
}
|
||||
|
||||
void common_hal_rgbmatrix_rgbmatrix_get_bufinfo(rgbmatrix_rgbmatrix_obj_t *self, mp_buffer_info_t *bufinfo) {
|
||||
if (self->allocation != NULL) {
|
||||
self->bufinfo.buf = self->allocation->ptr;
|
||||
}
|
||||
*bufinfo = self->bufinfo;
|
||||
}
|
||||
|
||||
void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self) {
|
||||
if (self->framebuffer != mp_const_none) {
|
||||
memset(&self->bufinfo, 0, sizeof(self->bufinfo));
|
||||
|
@ -196,11 +209,6 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self)
|
|||
common_hal_rgbmatrix_rgbmatrix_deinit1(self);
|
||||
common_hal_rgbmatrix_rgbmatrix_construct1(self, mp_const_none);
|
||||
#endif
|
||||
if (self->bufinfo.buf == NULL) {
|
||||
self->bufinfo.buf = common_hal_rgbmatrix_allocator_impl(self->bufsize);
|
||||
self->bufinfo.len = self->bufsize;
|
||||
self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW;
|
||||
}
|
||||
memset(self->bufinfo.buf, 0, self->bufinfo.len);
|
||||
common_hal_rgbmatrix_rgbmatrix_set_paused(self, false);
|
||||
}
|
||||
|
@ -214,6 +222,9 @@ void common_hal_rgbmatrix_rgbmatrix_set_paused(rgbmatrix_rgbmatrix_obj_t *self,
|
|||
_PM_stop(&self->protomatter);
|
||||
} else if (!paused && self->paused) {
|
||||
_PM_resume(&self->protomatter);
|
||||
if (self->allocation) {
|
||||
self->bufinfo.buf = self->allocation->ptr;
|
||||
}
|
||||
_PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width);
|
||||
_PM_swapbuffer_maybe(&self->protomatter);
|
||||
}
|
||||
|
@ -226,6 +237,9 @@ bool common_hal_rgbmatrix_rgbmatrix_get_paused(rgbmatrix_rgbmatrix_obj_t *self)
|
|||
|
||||
void common_hal_rgbmatrix_rgbmatrix_refresh(rgbmatrix_rgbmatrix_obj_t *self) {
|
||||
if (!self->paused) {
|
||||
if (self->allocation != NULL) {
|
||||
self->bufinfo.buf = self->allocation->ptr;
|
||||
}
|
||||
_PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width);
|
||||
_PM_swapbuffer_maybe(&self->protomatter);
|
||||
}
|
||||
|
@ -240,11 +254,43 @@ int common_hal_rgbmatrix_rgbmatrix_get_height(rgbmatrix_rgbmatrix_obj_t *self) {
|
|||
return computed_height;
|
||||
}
|
||||
|
||||
// Track the returned pointers and their matching allocation so that we can free
|
||||
// them even when the memory was moved by the supervisor. This prevents leaks
|
||||
// but doesn't protect against the memory being used after its been freed! The
|
||||
// long term fix is to utilize a permanent heap that can be shared with MP's
|
||||
// split heap.
|
||||
typedef struct matrix_allocation {
|
||||
void *original_pointer;
|
||||
supervisor_allocation *allocation;
|
||||
} matrix_allocation_t;
|
||||
|
||||
// Four should be more than we ever need. ProtoMatter does 3 allocations currently.
|
||||
static matrix_allocation_t allocations[4];
|
||||
|
||||
void *common_hal_rgbmatrix_allocator_impl(size_t sz) {
|
||||
supervisor_allocation *allocation = allocate_memory(align32_size(sz), false, true);
|
||||
return allocation ? allocation->ptr : NULL;
|
||||
if (allocation == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (size_t i = 0; i < sizeof(allocations); i++) {
|
||||
matrix_allocation_t *matrix_allocation = &allocations[i];
|
||||
if (matrix_allocation->original_pointer == NULL) {
|
||||
matrix_allocation->original_pointer = allocation->ptr;
|
||||
matrix_allocation->allocation = allocation;
|
||||
return allocation->ptr;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void common_hal_rgbmatrix_free_impl(void *ptr_in) {
|
||||
free_memory(allocation_from_ptr(ptr_in));
|
||||
for (size_t i = 0; i < sizeof(allocations); i++) {
|
||||
matrix_allocation_t *matrix_allocation = &allocations[i];
|
||||
if (matrix_allocation->original_pointer == ptr_in) {
|
||||
matrix_allocation->original_pointer = NULL;
|
||||
free_memory(matrix_allocation->allocation);
|
||||
matrix_allocation->allocation = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,14 @@
|
|||
|
||||
#include "py/obj.h"
|
||||
#include "lib/protomatter/src/core.h"
|
||||
#include "supervisor/memory.h"
|
||||
|
||||
extern const mp_obj_type_t rgbmatrix_RGBMatrix_type;
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
mp_obj_t framebuffer;
|
||||
mp_buffer_info_t bufinfo;
|
||||
supervisor_allocation *allocation;
|
||||
Protomatter_core protomatter;
|
||||
void *timer;
|
||||
uint16_t bufsize, width;
|
||||
|
|
|
@ -63,6 +63,8 @@ DEFAULT_CLUSTERLIST = {
|
|||
],
|
||||
"0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"],
|
||||
"0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"],
|
||||
"0x2341:0x056B": ["arduino_nano_esp32s3", "arduino_nano_esp32s3_inverted_statusled"],
|
||||
"0x2E8A:0x1020": ["waveshare_rp2040_plus_4mb", "waveshare_rp2040_plus_16mb"],
|
||||
}
|
||||
|
||||
cli_parser = argparse.ArgumentParser(
|
||||
|
|
|
@ -24,7 +24,7 @@ PORT_DEPS = {
|
|||
"cxd56": ["extmod/ulab/", "lib/tinyusb/"],
|
||||
"espressif": [
|
||||
"extmod/ulab/",
|
||||
"lib/certificates/nina-fw/",
|
||||
"lib/certificates/",
|
||||
"lib/protomatter/",
|
||||
"lib/quirc/",
|
||||
"lib/tinyusb/",
|
||||
|
@ -37,7 +37,7 @@ PORT_DEPS = {
|
|||
"lib/adafruit_floppy/",
|
||||
"lib/mbedtls/",
|
||||
"lib/mp3/",
|
||||
"lib/certificates/nina-fw/",
|
||||
"lib/certificates/",
|
||||
"lib/protomatter/",
|
||||
"lib/quirc/",
|
||||
"lib/tinyusb/",
|
||||
|
|
Loading…
Reference in New Issue