From 762c15535f72a7beaafeff8fb426fbf895b585e5 Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 09:12:14 -0400 Subject: [PATCH 01/18] Lolin S2 Mini pin assignment changes --- .../esp32s2/boards/lolin_s2_mini/mpconfigboard.h | 16 ++++++++-------- .../boards/lolin_s2_mini/mpconfigboard.mk | 2 +- ports/esp32s2/boards/lolin_s2_mini/pins.c | 10 ---------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h index 4cf71911a9..411420d273 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h @@ -29,19 +29,19 @@ #define MICROPY_HW_BOARD_NAME "S2Mini" #define MICROPY_HW_MCU_NAME "ESP32S2" -#define MICROPY_HW_NEOPIXEL (&pin_GPIO1) +// #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) // no NeoPixel on S2 Mini #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") #define AUTORESET_DELAY_MS 500 -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) +// #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) // no I2C labels on S2 Mini +// #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) // no I2C labels on S2 Mini -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO37) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO36) +// #define DEFAULT_SPI_BUS_SCK (&pin_GPIO37) // no SPI labels on S2 Mini +// #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) // no SPI labels on S2 Mini +// #define DEFAULT_SPI_BUS_MISO (&pin_GPIO36) // no SPI labels on S2 Mini -#define DEFAULT_UART_BUS_RX (&pin_GPIO44) -#define DEFAULT_UART_BUS_TX (&pin_GPIO43) +// #define DEFAULT_UART_BUS_RX (&pin_GPIO44) // no UART pins on S2 Mini +// #define DEFAULT_UART_BUS_TX (&pin_GPIO43) // no UART pins on S2 Mini diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk index ce434873cc..d95bd2fec1 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk @@ -14,7 +14,7 @@ CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB -CIRCUITPY_BITBANG_NEOPIXEL = 1 +# CIRCUITPY_BITBANG_NEOPIXEL = 1 # no NeoPixel on S2 Mini # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/esp32s2/boards/lolin_s2_mini/pins.c b/ports/esp32s2/boards/lolin_s2_mini/pins.c index 5c469879f9..cbf287ea96 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/pins.c +++ b/ports/esp32s2/boards/lolin_s2_mini/pins.c @@ -6,11 +6,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // mpconfigboard.h: GPIO0: CIRCUITPY_BOOT_BUTTON { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, // RTC_GPIO0,GPIO0 - // mpconfigboard.h: GPIO1: MICROPY_HW_NEOPIXEL - left to user to solder on - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, // RTC_GPIO1,GPIO1,TOUCH1,ADC1_CH0 - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, // RTC_GPIO2,GPIO2,TOUCH2,ADC1_CH1 { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, // RTC_GPIO3,GPIO3,TOUCH3,ADC1_CH2 @@ -21,11 +18,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6 // mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0 - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7 - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4 { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5 @@ -55,15 +49,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },// SPIIO5,GPIO34,FSPICS0 // mpconfigboard.h: GPIO35/GPIO36/GPIO37: MOSI/MESO/SCK SPI - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },// SPIIO6,GPIO35,FSPID - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },// SPIIO7,GPIO36,FSPICLK - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO37) }, { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },// SPIDQS,GPIO37,FSPIQ { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },// GPIO38,FSPIWP - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },// MTCK,GPIO39,CLK_OUT3 { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },// MTDO,GPIO40,CLK_OUT2 From 765eee424ecb9dbd8fad1fb8710012a214bdd0ff Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 10:08:38 -0400 Subject: [PATCH 02/18] Lolin S2 Mini added I2C & SPI defs from Espressif MicroPython --- ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h | 12 ++++++------ ports/esp32s2/boards/lolin_s2_mini/pins.c | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h index 411420d273..f72baabbd4 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h @@ -30,18 +30,18 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" // #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) // no NeoPixel on S2 Mini -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15) +// #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") #define AUTORESET_DELAY_MS 500 -// #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) // no I2C labels on S2 Mini -// #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) // no I2C labels on S2 Mini +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Espressif MP +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Espressif MP -// #define DEFAULT_SPI_BUS_SCK (&pin_GPIO37) // no SPI labels on S2 Mini -// #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) // no SPI labels on S2 Mini -// #define DEFAULT_SPI_BUS_MISO (&pin_GPIO36) // no SPI labels on S2 Mini +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO7) // no SPI labels on S2 Mini, def from Espressif MP +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) // no SPI labels on S2 Mini, def from Espressif MP +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) // no SPI labels on S2 Mini, def from Espressif MP // #define DEFAULT_UART_BUS_RX (&pin_GPIO44) // no UART pins on S2 Mini // #define DEFAULT_UART_BUS_TX (&pin_GPIO43) // no UART pins on S2 Mini diff --git a/ports/esp32s2/boards/lolin_s2_mini/pins.c b/ports/esp32s2/boards/lolin_s2_mini/pins.c index cbf287ea96..9f8874651b 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/pins.c +++ b/ports/esp32s2/boards/lolin_s2_mini/pins.c @@ -16,13 +16,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5 { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6 + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Espressif MP, D1 Mini pin D5 GPIO14 // mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0 { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7 { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Espressif MP, D1 Mini pin D6 GPIO12 { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4 { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5 + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Espressif MP, D1 Mini pin D7 GPIRO13 { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },// RTC_GPIO12,GPIO12,TOUCH12,ADC2_CH1,FSPICLK,FSPIIO6 { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },// RTC_GPIO13,GPIO13,TOUCH13,ADC2_CH2,FSPIQ,FSPIIO7 @@ -46,10 +49,12 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // GPIO33-GPIO40: broken out as a bloc on ESP32-S2FN4R2 SoC, last 2 half of JTAG { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },// SPIIO4,GPIO33,FSPIHD + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },// def from Espressif MP, D1 Mini pin D2 GPIO4 { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },// SPIIO5,GPIO34,FSPICS0 // mpconfigboard.h: GPIO35/GPIO36/GPIO37: MOSI/MESO/SCK SPI { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },// SPIIO6,GPIO35,FSPID + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO35) },// def from Espressif MP, D1 Mini pin D1 GPIO5 { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },// SPIIO7,GPIO36,FSPICLK { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },// SPIDQS,GPIO37,FSPIQ From ef6d7fe731b707eaaf281705039fa8a4676cec00 Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 10:17:44 -0400 Subject: [PATCH 03/18] Lolin S2 Mini change 'Espressif' references to 'Wemos' --- ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h | 10 +++++----- ports/esp32s2/boards/lolin_s2_mini/pins.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h index f72baabbd4..4a20c178e8 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h @@ -36,12 +36,12 @@ #define AUTORESET_DELAY_MS 500 -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Espressif MP -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Espressif MP +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Wemos MP +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Wemos MP -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO7) // no SPI labels on S2 Mini, def from Espressif MP -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) // no SPI labels on S2 Mini, def from Espressif MP -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) // no SPI labels on S2 Mini, def from Espressif MP +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO7) // no SPI labels on S2 Mini, def from Wemos MP +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) // no SPI labels on S2 Mini, def from Wemos MP +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) // no SPI labels on S2 Mini, def from Wemos MP // #define DEFAULT_UART_BUS_RX (&pin_GPIO44) // no UART pins on S2 Mini // #define DEFAULT_UART_BUS_TX (&pin_GPIO43) // no UART pins on S2 Mini diff --git a/ports/esp32s2/boards/lolin_s2_mini/pins.c b/ports/esp32s2/boards/lolin_s2_mini/pins.c index 9f8874651b..4f8e0a9281 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/pins.c +++ b/ports/esp32s2/boards/lolin_s2_mini/pins.c @@ -16,16 +16,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5 { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6 - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Espressif MP, D1 Mini pin D5 GPIO14 + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Wemos MP, D1 Mini pin D5 GPIO14 // mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0 { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7 { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Espressif MP, D1 Mini pin D6 GPIO12 + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Wemos MP, D1 Mini pin D6 GPIO12 { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4 { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5 - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Espressif MP, D1 Mini pin D7 GPIRO13 + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Wemos MP, D1 Mini pin D7 GPIRO13 { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },// RTC_GPIO12,GPIO12,TOUCH12,ADC2_CH1,FSPICLK,FSPIIO6 { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },// RTC_GPIO13,GPIO13,TOUCH13,ADC2_CH2,FSPIQ,FSPIIO7 @@ -49,12 +49,12 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // GPIO33-GPIO40: broken out as a bloc on ESP32-S2FN4R2 SoC, last 2 half of JTAG { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },// SPIIO4,GPIO33,FSPIHD - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },// def from Espressif MP, D1 Mini pin D2 GPIO4 + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },// def from Wemos MP, D1 Mini pin D2 GPIO4 { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },// SPIIO5,GPIO34,FSPICS0 // mpconfigboard.h: GPIO35/GPIO36/GPIO37: MOSI/MESO/SCK SPI { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },// SPIIO6,GPIO35,FSPID - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO35) },// def from Espressif MP, D1 Mini pin D1 GPIO5 + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO35) },// def from Wemos MP, D1 Mini pin D1 GPIO5 { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },// SPIIO7,GPIO36,FSPICLK { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },// SPIDQS,GPIO37,FSPIQ From c0f039da2927bf94935c80e48760be05254b1bae Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 12:08:38 -0400 Subject: [PATCH 04/18] Lolin S2 Mini added pin definitions from Wemos/Lolin D1 Mini --- ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h | 2 +- ports/esp32s2/boards/lolin_s2_mini/pins.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h index 4a20c178e8..d7df2c80f5 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h @@ -27,7 +27,7 @@ // Micropython setup #define MICROPY_HW_BOARD_NAME "S2Mini" -#define MICROPY_HW_MCU_NAME "ESP32S2" +#define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP // #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) // no NeoPixel on S2 Mini // #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15) diff --git a/ports/esp32s2/boards/lolin_s2_mini/pins.c b/ports/esp32s2/boards/lolin_s2_mini/pins.c index 4f8e0a9281..e08ff7ccd6 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/pins.c +++ b/ports/esp32s2/boards/lolin_s2_mini/pins.c @@ -10,25 +10,31 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, // RTC_GPIO2,GPIO2,TOUCH2,ADC1_CH1 { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, // RTC_GPIO3,GPIO3,TOUCH3,ADC1_CH2 + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO3) }, // D1 mini pin A0 { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // RTC_GPIO4,GPIO4,TOUCH4,ADC1_CH3 { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, // RTC_GPIO5,GPIO5,TOUCH5,ADC1_CH4 + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO5) }, // D1 mini pin D0 GPIO16 { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5 { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6 { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Wemos MP, D1 Mini pin D5 GPIO14 + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO7) }, // D1 mini pin D5 GPIO14 // mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0 { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7 { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Wemos MP, D1 Mini pin D6 GPIO12 + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, // D1 mini pin D6 GPIO12 { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4 { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5 { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Wemos MP, D1 Mini pin D7 GPIRO13 + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO11) },// D1 mini pin D7 GPIO13 { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },// RTC_GPIO12,GPIO12,TOUCH12,ADC2_CH1,FSPICLK,FSPIIO6 { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },// RTC_GPIO13,GPIO13,TOUCH13,ADC2_CH2,FSPIQ,FSPIIO7 + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO13) },// D1 mini pin D8 GPIO15 { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },// RTC_GPIO14,GPIO14,TOUCH14,ADC2_CH3,FSPIWP,FSPIDQS @@ -38,9 +44,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },// XTAL_32K_P: RTC_GPIO15,GPIO15,U0RTS,ADC2_CH4,XTAL_32K_P { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },// XTAL_32K_N: RTC_GPIO16,GPIO16,U0CTS,ADC2_CH5,XTAL_32K_N + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO16) },// D1 mini pin D4 GPIO2 LED { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },// DAC_1: RTC_GPIO17,GPIO17,U1TXD,ADC2_CH6,DAC_1 { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },// DAC_2: RTC_GPIO18,GPIO18,U1RXD,ADC2_CH7,DAC_2,CLK_OUT3 + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO18) },// D1 mini pin D3 GPIO0 // skip GPIO19-GPIO20: USB_D-/USB_D+ { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },// RTC_GPIO21,GPIO21 @@ -49,12 +57,14 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { // GPIO33-GPIO40: broken out as a bloc on ESP32-S2FN4R2 SoC, last 2 half of JTAG { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },// SPIIO4,GPIO33,FSPIHD - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },// def from Wemos MP, D1 Mini pin D2 GPIO4 + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },// def from Wemos MP + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO33) },// D1 mini pin D2 GPIO4 { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },// SPIIO5,GPIO34,FSPICS0 // mpconfigboard.h: GPIO35/GPIO36/GPIO37: MOSI/MESO/SCK SPI { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },// SPIIO6,GPIO35,FSPID - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO35) },// def from Wemos MP, D1 Mini pin D1 GPIO5 + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO35) },// def from Wemos MP + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO35) },// D1 mini pin D1 GPIO5 { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },// SPIIO7,GPIO36,FSPICLK { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },// SPIDQS,GPIO37,FSPIQ From 32b9450e7f6af6e26a519af934e326fa351db5d3 Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 12:14:59 -0400 Subject: [PATCH 05/18] Lolin S2 Mini removed some redundant comments --- ports/esp32s2/boards/lolin_s2_mini/pins.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/pins.c b/ports/esp32s2/boards/lolin_s2_mini/pins.c index e08ff7ccd6..eef6db4779 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/pins.c +++ b/ports/esp32s2/boards/lolin_s2_mini/pins.c @@ -18,18 +18,18 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5 { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6 - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Wemos MP, D1 Mini pin D5 GPIO14 + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Wemos MP { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO7) }, // D1 mini pin D5 GPIO14 // mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0 { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7 { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Wemos MP, D1 Mini pin D6 GPIO12 + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, // def from Wemos MP { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, // D1 mini pin D6 GPIO12 { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4 { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5 - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Wemos MP, D1 Mini pin D7 GPIRO13 + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },// def from Wemos MP { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO11) },// D1 mini pin D7 GPIO13 { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },// RTC_GPIO12,GPIO12,TOUCH12,ADC2_CH1,FSPICLK,FSPIIO6 From 15fc44cab74e4a9bf5de9f5123e383d36a2e9f60 Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 12:20:07 -0400 Subject: [PATCH 06/18] Lolin S2 Mini fix typo in pin assignment --- ports/esp32s2/boards/lolin_s2_mini/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/pins.c b/ports/esp32s2/boards/lolin_s2_mini/pins.c index eef6db4779..e665d09685 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/pins.c +++ b/ports/esp32s2/boards/lolin_s2_mini/pins.c @@ -18,7 +18,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5 { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6 - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPI7) }, // def from Wemos MP + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO7) }, // def from Wemos MP { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO7) }, // D1 mini pin D5 GPIO14 // mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0 From 2fc372b9e198182419f6ca62a97ca5af4bc18982 Mon Sep 17 00:00:00 2001 From: durapensa <50685483+durapensa@users.noreply.github.com> Date: Fri, 3 Sep 2021 15:10:22 -0400 Subject: [PATCH 07/18] Lolin S2 Mini - Apply suggestions from code review Co-authored-by: Scott Shawcroft --- ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h | 4 ---- ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk | 1 - 2 files changed, 5 deletions(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h index d7df2c80f5..f8223f674d 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h @@ -29,8 +29,6 @@ #define MICROPY_HW_BOARD_NAME "S2Mini" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP -// #define MICROPY_HW_NEOPIXEL (&pin_GPIO1) // no NeoPixel on S2 Mini -// #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") @@ -43,5 +41,3 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) // no SPI labels on S2 Mini, def from Wemos MP #define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) // no SPI labels on S2 Mini, def from Wemos MP -// #define DEFAULT_UART_BUS_RX (&pin_GPIO44) // no UART pins on S2 Mini -// #define DEFAULT_UART_BUS_TX (&pin_GPIO43) // no UART pins on S2 Mini diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk index d95bd2fec1..e4c7aacadd 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk @@ -14,7 +14,6 @@ CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB -# CIRCUITPY_BITBANG_NEOPIXEL = 1 # no NeoPixel on S2 Mini # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 7e10785ec70749e14531b8dd69be61f81524e7d9 Mon Sep 17 00:00:00 2001 From: Durapensa Date: Fri, 3 Sep 2021 16:46:50 -0400 Subject: [PATCH 08/18] Lolin S2 Mini - fix EOF issue caught by pre-commit --- ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h index f8223f674d..18d8234c72 100644 --- a/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h @@ -40,4 +40,3 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO7) // no SPI labels on S2 Mini, def from Wemos MP #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) // no SPI labels on S2 Mini, def from Wemos MP #define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) // no SPI labels on S2 Mini, def from Wemos MP - From ff807f8f19a991c1aba7504b8ba17023ee738fa6 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Sat, 4 Sep 2021 11:17:39 +0200 Subject: [PATCH 09/18] Fix incorrect use of allocate_memory() --- main.c | 2 +- shared-bindings/supervisor/__init__.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d6ed269809..d024717beb 100755 --- a/main.c +++ b/main.c @@ -236,7 +236,7 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap, mp_obj_t exception) { size_t traceback_len = 0; mp_print_t print_count = {&traceback_len, count_strn}; mp_obj_print_exception(&print_count, exception); - prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, true); + prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, false); // Empirically, this never fails in practice - even when the heap is totally filled up // with single-block-sized objects referenced by a root pointer, exiting the VM frees // up several hundred bytes, sufficient for the traceback (which tends to be shortened diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index a9b99ed87d..8c581c9364 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -195,7 +195,7 @@ STATIC mp_obj_t supervisor_set_next_code_file(size_t n_args, const mp_obj_t *pos const char *filename = mp_obj_str_get_data(args.filename.u_obj, &len); free_memory(next_code_allocation); if (options != 0 || len != 0) { - next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, true); + next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, false); if (next_code_allocation == NULL) { m_malloc_fail(sizeof(next_code_info_t) + len + 1); } From b1e71aecb08fd94a596c9654b2c5c54dda8b4d6e Mon Sep 17 00:00:00 2001 From: hexthat Date: Fri, 3 Sep 2021 22:45:22 +0000 Subject: [PATCH 10/18] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (1021 of 1021 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 49 +++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index cfc5290654..1d05df7b4e 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-08-23 14:19+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2021-09-04 23:34+0000\n" +"Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" "MIME-Version: 1.0\n" @@ -49,6 +49,9 @@ msgid "" "paste mode; Ctrl-C to cancel, Ctrl-D to finish\n" "=== " msgstr "" +"\n" +"zhān tiē mó shì; Ctrl-C qǔ xiāo, Ctrl-D wán chéngh\n" +"=== " #: py/obj.c msgid " File \"%q\"" @@ -85,11 +88,11 @@ msgstr "" #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" -msgstr "" +msgstr "%q hé %q bāo hán chóng fù yǐn jiǎo" #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" -msgstr "" +msgstr "%q bāo hán chóng fù de yǐn jiǎo" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -114,11 +117,11 @@ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" #: py/argcheck.c msgid "%q length must be %d-%d" -msgstr "" +msgstr "%q cháng dù bì xū wéi %d-%d" #: shared-bindings/usb_hid/Device.c msgid "%q length must be >= 1" -msgstr "" +msgstr "%q cháng dù bì xū >= 1" #: shared-bindings/vectorio/Polygon.c msgid "%q list must be a list" @@ -162,7 +165,7 @@ msgstr "%q bì xū zài %d hé %d zhī jiān" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" -msgstr "" +msgstr "%q bì xū shì 2 de gōng lǜ" #: py/argcheck.c msgid "%q must of type %q" @@ -187,7 +190,7 @@ msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d" #: shared-bindings/usb_hid/Device.c msgid "%q, %q, and %q must all be the same length" -msgstr "" +msgstr "%q, %q, hé %q bì xū cháng dù xiāng tóng" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format @@ -341,7 +344,7 @@ msgstr "'yield' wàibù gōngnéng" #: shared-module/vectorio/VectorShape.c msgid "(x,y) integers required" -msgstr "" +msgstr "(x,y) suǒ xū de zhěng shù" #: py/compile.c msgid "*x must be assignment target" @@ -516,7 +519,7 @@ msgstr "dāng VM bú yùn xíng shí, cháng shì duī fēn pèi." #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" -msgstr "" +msgstr "wèi shí xiàn yīn pín zhuǎn huàn" #: shared-bindings/wifi/Radio.c msgid "AuthMode.OPEN is not used with password" @@ -1256,7 +1259,7 @@ msgstr "Jiāmì bùzú" #: ports/atmel-samd/audio_dma.c ports/raspberrypi/audio_dma.c msgid "Internal audio buffer too small" -msgstr "" +msgstr "nèi bù yīn pín huǎn chōng qì tài xiǎo" #: ports/stm/common-hal/busio/UART.c msgid "Internal define error" @@ -1551,12 +1554,12 @@ msgstr "quē shǎo dì yī zǔ yǐn jiǎo. zhǐ lìng %d shè zhì yǐn jiǎo" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "" +msgstr "shī zōng de jmp_pin. zhǐ lìng %d zài yǐn jiǎo shàng tiào yuè" #: shared-module/usb_hid/Device.c #, c-format msgid "More than %d report ids not supported" -msgstr "" +msgstr "chāo guò %d bào gào bù zhī chí de ID" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -2637,7 +2640,7 @@ msgstr "zhóu tài cháng" #: shared-bindings/bitmaptools/__init__.c msgid "background value out of range of target" -msgstr "" +msgstr "bèi jǐng zhí tuō lí mù biāo fàn wéi" #: py/builtinevex.c msgid "bad compile mode" @@ -2859,7 +2862,7 @@ msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduà #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" -msgstr "" +msgstr "wú fǎ fēn pèi xīn xíng zhuàng" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" @@ -3166,7 +3169,7 @@ msgstr "wénjiàn bìxū shì zài zì jié móshì xià dǎkāi de wénjiàn" #: shared-bindings/traceback/__init__.c msgid "file write is not available" -msgstr "" +msgstr "wén jiàn biān xiě bù kě yòng" #: shared-bindings/storage/__init__.c msgid "filesystem must provide mount method" @@ -3457,7 +3460,7 @@ msgstr "wú xiào element_size %d, bì xū shì, 1, 2, huò 4" #: shared-bindings/traceback/__init__.c msgid "invalid exception" -msgstr "" +msgstr "wú xiào lì wài" #: extmod/modframebuf.c msgid "invalid format" @@ -3498,7 +3501,7 @@ msgstr "wúxiào de hàomǎ yǔfǎ" #: py/objexcept.c shared-bindings/traceback/__init__.c msgid "invalid traceback" -msgstr "" +msgstr "wú xiào zhuī sù" #: py/objtype.c msgid "issubclass() arg 1 must be a class" @@ -3626,7 +3629,7 @@ msgstr "nèi cún shì tú: cháng dù bú shì xiàng mù huà de bèi shù" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "mode must be complete, or reduced" -msgstr "" +msgstr "mó shì bì xū wán chéng huò jiǎn shǎo" #: py/builtinimport.c msgid "module not found" @@ -3868,11 +3871,11 @@ msgstr "cāozuò shǔ bùnéng yīqǐ guǎngbò" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for 2D arrays only" -msgstr "" +msgstr "jǐn zhēn duì 2D zhèn liè dìng yì cāo zuò" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for ndarrays only" -msgstr "" +msgstr "cāo zuò jǐn dìng yì wéi ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" @@ -4042,7 +4045,7 @@ msgstr "duìliè yìchū" #: lib/utils/pyexec.c msgid "raw REPL; CTRL-B to exit\n" -msgstr "" +msgstr "yuán shǐ REPL; CTRL-B tuì chū\n" #: py/parse.c msgid "raw f-strings are not implemented" @@ -4451,7 +4454,7 @@ msgstr "Zhí bìxū fúhé %d zì jié" #: shared-bindings/bitmaptools/__init__.c msgid "value out of range of target" -msgstr "" +msgstr "zhí fàn wéi wài de mù biāo" #: shared-bindings/displayio/Bitmap.c msgid "value_count must be > 0" From 10706e93760526ac38202315dfcff861a089e1ea Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 5 Sep 2021 18:40:58 -0500 Subject: [PATCH 11/18] add frozen libraries to the board info --- tools/build_board_info.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 62a33e1dd2..eed136c545 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -109,11 +109,20 @@ def get_board_mapping(): extensions = extension_by_port[port] extensions = extension_by_board.get(board_path.name, extensions) aliases = aliases_by_board.get(board_path.name, []) + frozen_libraries = [] + with open(os.path.join(board_path, "mpconfigboard.mk")) as mpconfig: + frozen_lines = [ + line for line in mpconfig if line.startswith("FROZEN_MPY_DIRS") + ] + frozen_libraries.extend( + [line[line.rfind("/") + 1 :].strip() for line in frozen_lines] + ) boards[board_id] = { "port": port, "extensions": extensions, "download_count": 0, "aliases": aliases, + "frozen_libraries": frozen_libraries, } for alias in aliases: boards[alias] = { @@ -300,6 +309,7 @@ def generate_download_info(): "modules": support_matrix[alias], "languages": languages, "extensions": board_info["extensions"], + "frozen_libraries": board_info["frozen_libraries"], } current_info[alias]["downloads"] = alias_info["download_count"] current_info[alias]["versions"].append(new_version) From 791937b149626a4459af5b980b17cfc68c7f40be Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 5 Sep 2021 18:42:05 -0500 Subject: [PATCH 12/18] black formatted 'build_board_info.py' --- tools/build_board_info.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index eed136c545..ba6a44600f 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -139,7 +139,9 @@ def get_version_info(): version = None sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8") try: - version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + version = ( + git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + ) except sh.ErrorReturnCode_128: # No exact match pass @@ -206,7 +208,9 @@ def create_pr(changes, updated, git_info, user): ) create_branch = {"ref": "refs/heads/" + branch_name, "sha": commit_sha} - response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch) + response = github.post( + "/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch + ) if not response.ok and response.json()["message"] != "Reference already exists": print("unable to create branch") print(response.text) @@ -220,7 +224,8 @@ def create_pr(changes, updated, git_info, user): } response = github.put( - "/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file + "/repos/{}/circuitpython-org/contents/_data/files.json".format(user), + json=update_file, ) if not response.ok: print("unable to post new file") @@ -269,7 +274,9 @@ def generate_download_info(): languages = get_languages() - support_matrix = shared_bindings_matrix.support_matrix_by_board(use_branded_name=False) + support_matrix = shared_bindings_matrix.support_matrix_by_board( + use_branded_name=False + ) new_stable = "-" not in new_tag From cb586a40180b2f8ca01619033bdee4c22116c556 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 5 Sep 2021 18:42:05 -0500 Subject: [PATCH 13/18] black formatted 'build_board_info.py' --- tools/build_board_info.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index eed136c545..1769e84e84 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -220,7 +220,8 @@ def create_pr(changes, updated, git_info, user): } response = github.put( - "/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file + "/repos/{}/circuitpython-org/contents/_data/files.json".format(user), + json=update_file, ) if not response.ok: print("unable to post new file") From 86221b9895207dccf0667de119533b8ec94b43d2 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 6 Sep 2021 16:28:00 +0530 Subject: [PATCH 14/18] revert localization of repl messages --- lib/utils/pyexec.c | 6 +++--- locale/circuitpython.pot | 39 ++++++++++++++------------------------- py/builtinhelp.c | 2 +- 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index a272eefbcb..fe52fc645b 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -370,7 +370,7 @@ STATIC int pyexec_raw_repl_process_char(int c) { } goto reset; } - serial_write_compressed(translate("raw REPL; CTRL-B to exit\n")); + mp_hal_stdout_tx_str("raw REPL; CTRL-B to exit\r\n"); goto reset; } else if (c == CHAR_CTRL_B) { // change to friendly REPL @@ -469,7 +469,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) { return PYEXEC_FORCED_EXIT; } else if (ret == CHAR_CTRL_E) { // paste mode - serial_write_compressed(translate("\npaste mode; Ctrl-C to cancel, Ctrl-D to finish\n=== ")); + mp_hal_stdout_tx_str("\r\npaste mode; Ctrl-C to cancel, Ctrl-D to finish\r\n=== "); vstr_reset(MP_STATE_VM(repl_line)); repl.paste_mode = true; return 0; @@ -545,7 +545,7 @@ int pyexec_raw_repl(void) { vstr_init(&line, 32); raw_repl_reset: - serial_write_compressed(translate("raw REPL; CTRL-B to exit\n")); + mp_hal_stdout_tx_str("raw REPL; CTRL-B to exit\r\n"); for (;;) { vstr_reset(&line); diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 12b42cddf7..61cec6f617 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -35,13 +35,6 @@ msgid "" "https://github.com/adafruit/circuitpython/issues\n" msgstr "" -#: lib/utils/pyexec.c -msgid "" -"\n" -"paste mode; Ctrl-C to cancel, Ctrl-D to finish\n" -"=== " -msgstr "" - #: py/obj.c msgid " File \"%q\"" msgstr "" @@ -400,6 +393,9 @@ msgstr "" msgid "All UART peripherals are in use" msgstr "" +#: ports/nrf/common-hal/countio/Counter.c +#: ports/nrf/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/rotaryio/IncrementalEncoder.c #: shared-bindings/pwmio/PWMOut.c msgid "All channels in use" msgstr "" @@ -623,10 +619,10 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "" -#: ports/atmel-samd/common-hal/displayio/ParallelBus.c -#: ports/esp32s2/common-hal/displayio/ParallelBus.c -#: ports/nrf/common-hal/displayio/ParallelBus.c -#: ports/raspberrypi/common-hal/displayio/ParallelBus.c +#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c +#: ports/esp32s2/common-hal/paralleldisplay/ParallelBus.c +#: ports/nrf/common-hal/paralleldisplay/ParallelBus.c +#: ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" msgstr "" @@ -786,7 +782,7 @@ msgid "Column entry must be digitalio.DigitalInOut" msgstr "" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-bindings/paralleldisplay/ParallelBus.c msgid "Command must be an int between 0 and 255" msgstr "" @@ -879,12 +875,12 @@ msgstr "" msgid "DAC already in use" msgstr "" -#: ports/atmel-samd/common-hal/displayio/ParallelBus.c -#: ports/nrf/common-hal/displayio/ParallelBus.c +#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c +#: ports/nrf/common-hal/paralleldisplay/ParallelBus.c msgid "Data 0 pin must be byte aligned" msgstr "" -#: ports/esp32s2/common-hal/displayio/ParallelBus.c +#: ports/esp32s2/common-hal/paralleldisplay/ParallelBus.c msgid "Data 0 pin must be byte aligned." msgstr "" @@ -1828,11 +1824,6 @@ msgstr "" msgid "PWM slice channel A already in use" msgstr "" -#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c -#: ports/stm/common-hal/displayio/ParallelBus.c -msgid "ParallelBus not yet supported" -msgstr "" - #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" msgstr "" @@ -3655,7 +3646,7 @@ msgid "no module named '%q'" msgstr "" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/displayio/ParallelBus.c +#: shared-bindings/paralleldisplay/ParallelBus.c msgid "no reset pin available" msgstr "" @@ -3928,6 +3919,7 @@ msgstr "" #: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/crumpspace_crumps2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h +#: ports/esp32s2/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h #: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h @@ -3948,6 +3940,7 @@ msgstr "" #: ports/esp32s2/boards/targett_module_clip_wroom/mpconfigboard.h #: ports/esp32s2/boards/targett_module_clip_wrover/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +#: ports/esp32s2/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h #: ports/esp32s2/boards/unexpectedmaker_tinys2/mpconfigboard.h msgid "pressing boot button at start up.\n" @@ -3981,10 +3974,6 @@ msgstr "" msgid "queue overflow" msgstr "" -#: lib/utils/pyexec.c -msgid "raw REPL; CTRL-B to exit\n" -msgstr "" - #: py/parse.c msgid "raw f-strings are not implemented" msgstr "" diff --git a/py/builtinhelp.c b/py/builtinhelp.c index 8590c4beea..35bd3d3bca 100644 --- a/py/builtinhelp.c +++ b/py/builtinhelp.c @@ -131,7 +131,7 @@ STATIC void mp_help_print_modules(void) { #if MICROPY_ENABLE_EXTERNAL_IMPORT // let the user know there may be other modules available from the filesystem - mp_printf(MP_PYTHON_PRINTER, "%S", translate("Plus any modules on the filesystem\n")); + serial_write_compressed(translate("Plus any modules on the filesystem\n")); #endif } #endif From 8a023b04caf23b3b4b117ebc80df7e173e4ab2e1 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Mon, 6 Sep 2021 08:46:16 +0200 Subject: [PATCH 15/18] Update TinyUSB --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 831a45f14b..582e5dbac5 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 831a45f14bcc833d536cab39bef61cc67533fa73 +Subproject commit 582e5dbac53aa2ac7c24249712081833986b3f27 From d2d0bd289f32bf2525bb05c5bfe443c92c631337 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 6 Sep 2021 21:23:17 -0400 Subject: [PATCH 16/18] Fix RP2040 I2S: always copy to output buffer --- ports/raspberrypi/audio_dma.c | 141 +++++++----------- .../common-hal/audiobusio/I2SOut.c | 13 +- 2 files changed, 66 insertions(+), 88 deletions(-) diff --git a/ports/raspberrypi/audio_dma.c b/ports/raspberrypi/audio_dma.c index 7850f09cdf..b7e5a0db44 100644 --- a/ports/raspberrypi/audio_dma.c +++ b/ports/raspberrypi/audio_dma.c @@ -49,92 +49,74 @@ void audio_dma_reset(void) { } -STATIC void audio_dma_convert_samples( - audio_dma_t *dma, - uint8_t *input, uint32_t input_length, - uint8_t *available_output_buffer, uint32_t available_output_buffer_length, - uint8_t **output, uint32_t *output_length) { - +STATIC size_t audio_dma_convert_samples(audio_dma_t *dma, uint8_t *input, uint32_t input_length, uint8_t *output, uint32_t output_length) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" - // Check whether a conversion is necessary - if (dma->signed_to_unsigned || - dma->unsigned_to_signed || - dma->sample_spacing > 1 || - (dma->sample_resolution != dma->output_resolution)) { + uint32_t output_length_used = input_length / dma->sample_spacing; - // Must convert. - // Write the conversion into the passed-in output buffer - *output = available_output_buffer; - *output_length = input_length / dma->sample_spacing; + if (output_length_used > output_length) { + mp_raise_RuntimeError(translate("Internal audio buffer too small")); + } - if (*output_length > available_output_buffer_length) { + uint32_t out_i = 0; + if (dma->sample_resolution <= 8 && dma->output_resolution > 8) { + // reading bytes, writing 16-bit words, so output buffer will be bigger. + + output_length_used = output_length * 2; + if (output_length_used > output_length) { mp_raise_RuntimeError(translate("Internal audio buffer too small")); } - uint32_t out_i = 0; - if (dma->sample_resolution <= 8 && dma->output_resolution > 8) { - // reading bytes, writing 16-bit words, so output buffer will be bigger. + size_t shift = dma->output_resolution - dma->sample_resolution; - *output_length = *output_length * 2; - if (*output_length > available_output_buffer_length) { - mp_raise_RuntimeError(translate("Internal audio buffer too small")); + for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) { + if (dma->signed_to_unsigned) { + ((uint16_t *)output)[out_i] = ((uint16_t)((int8_t *)input)[i] + 0x80) << shift; + } else if (dma->unsigned_to_signed) { + ((int16_t *)output)[out_i] = ((int16_t)((uint8_t *)input)[i] - 0x80) << shift; + } else { + ((uint16_t *)output)[out_i] = ((uint16_t)((uint8_t *)input)[i]) << shift; } - - size_t shift = dma->output_resolution - dma->sample_resolution; - - for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) { - if (dma->signed_to_unsigned) { - ((uint16_t *)*output)[out_i] = ((uint16_t)((int8_t *)input)[i] + 0x80) << shift; - } else if (dma->unsigned_to_signed) { - ((int16_t *)*output)[out_i] = ((int16_t)((uint8_t *)input)[i] - 0x80) << shift; + out_i += 1; + } + } else if (dma->sample_resolution <= 8 && dma->output_resolution <= 8) { + for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) { + if (dma->signed_to_unsigned) { + ((uint8_t *)output)[out_i] = ((int8_t *)input)[i] + 0x80; + } else if (dma->unsigned_to_signed) { + ((int8_t *)output)[out_i] = ((uint8_t *)input)[i] - 0x80; + } else { + ((uint8_t *)output)[out_i] = ((uint8_t *)input)[i]; + } + out_i += 1; + } + } else if (dma->sample_resolution > 8 && dma->output_resolution > 8) { + size_t shift = 16 - dma->output_resolution; + for (uint32_t i = 0; i < input_length / 2; i += dma->sample_spacing) { + if (dma->signed_to_unsigned) { + ((uint16_t *)output)[out_i] = ((int16_t *)input)[i] + 0x8000; + } else if (dma->unsigned_to_signed) { + ((int16_t *)output)[out_i] = ((uint16_t *)input)[i] - 0x8000; + } else { + ((uint16_t *)output)[out_i] = ((uint16_t *)input)[i]; + } + if (dma->output_resolution < 16) { + if (dma->output_signed) { + ((int16_t *)output)[out_i] = ((int16_t *)output)[out_i] >> shift; } else { - ((uint16_t *)*output)[out_i] = ((uint16_t)((uint8_t *)input)[i]) << shift; + ((uint16_t *)output)[out_i] = ((uint16_t *)output)[out_i] >> shift; } - out_i += 1; } - } else if (dma->sample_resolution <= 8 && dma->output_resolution <= 8) { - for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) { - if (dma->signed_to_unsigned) { - ((uint8_t *)*output)[out_i] = ((int8_t *)input)[i] + 0x80; - } else if (dma->unsigned_to_signed) { - ((int8_t *)*output)[out_i] = ((uint8_t *)input)[i] - 0x80; - } else { - ((uint8_t *)*output)[out_i] = ((uint8_t *)input)[i]; - } - out_i += 1; - } - } else if (dma->sample_resolution > 8 && dma->output_resolution > 8) { - size_t shift = 16 - dma->output_resolution; - for (uint32_t i = 0; i < input_length / 2; i += dma->sample_spacing) { - if (dma->signed_to_unsigned) { - ((uint16_t *)*output)[out_i] = ((int16_t *)input)[i] + 0x8000; - } else if (dma->unsigned_to_signed) { - ((int16_t *)*output)[out_i] = ((uint16_t *)input)[i] - 0x8000; - } else { - ((uint16_t *)*output)[out_i] = ((uint16_t *)input)[i]; - } - if (dma->output_resolution < 16) { - if (dma->output_signed) { - ((int16_t *)*output)[out_i] = ((int16_t *)*output)[out_i] >> shift; - } else { - ((uint16_t *)*output)[out_i] = ((uint16_t *)*output)[out_i] >> shift; - } - } - out_i += 1; - } - } else { - // (dma->sample_resolution > 8 && dma->output_resolution <= 8) - // Not currently used, but might be in the future. - mp_raise_RuntimeError(translate("Audio conversion not implemented")); + out_i += 1; } } else { - // No conversion necessary. Designate the input buffer as the output buffer. - *output = input; - *output_length = input_length; + // (dma->sample_resolution > 8 && dma->output_resolution <= 8) + // Not currently used, but might be in the future. + mp_raise_RuntimeError(translate("Audio conversion not implemented")); } #pragma GCC diagnostic pop + return output_length_used; } // buffer_idx is 0 or 1. @@ -154,21 +136,14 @@ STATIC void audio_dma_load_next_block(audio_dma_t *dma, size_t buffer_idx) { // Convert the sample format resolution and signedness, as necessary. // The input sample buffer is what was read from a file, Mixer, or a raw sample buffer. - // The output buffer is one of the DMA buffers (passed in), or if no conversion was done, - // the original sample buffer (to save copying). + // The output buffer is one of the DMA buffers (passed in). - // audio_dma_convert_samples() will write the converted samples into the given output - // buffer if necessary. If no conversion was needed, it will return the sample buffer - // as the output buffer. - uint8_t *output_buffer; - uint32_t output_buffer_length; + size_t output_length_used = audio_dma_convert_samples( + dma, sample_buffer, sample_buffer_length, + dma->buffer[buffer_idx], dma->buffer_length[buffer_idx]); - audio_dma_convert_samples(dma, sample_buffer, sample_buffer_length, - dma->buffer[buffer_idx], dma->buffer_length[buffer_idx], - &output_buffer, &output_buffer_length); - - dma_channel_set_read_addr(dma_channel, output_buffer, false /* trigger */); - dma_channel_set_trans_count(dma_channel, output_buffer_length / dma->output_size, false /* trigger */); + dma_channel_set_read_addr(dma_channel, dma->buffer[buffer_idx], false /* trigger */); + dma_channel_set_trans_count(dma_channel, output_length_used / dma->output_size, false /* trigger */); if (get_buffer_result == GET_BUFFER_DONE) { if (dma->loop) { @@ -180,7 +155,7 @@ STATIC void audio_dma_load_next_block(audio_dma_t *dma, size_t buffer_idx) { (c->al1_ctrl & ~DMA_CH0_CTRL_TRIG_CHAIN_TO_BITS) | (dma_channel << DMA_CH0_CTRL_TRIG_CHAIN_TO_LSB); - if (output_buffer_length == 0 && + if (output_length_used == 0 && !dma_channel_is_busy(dma->channel[0]) && !dma_channel_is_busy(dma->channel[1])) { // No data has been read, and both DMA channels have now finished, so it's safe to stop. diff --git a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c index 0ac11c690f..da50e17f42 100644 --- a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c +++ b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -174,14 +174,19 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, uint16_t bits_per_sample_output = bits_per_sample * 2; size_t clocks_per_bit = 6; uint32_t frequency = bits_per_sample_output * audiosample_sample_rate(sample); - common_hal_rp2pio_statemachine_set_frequency(&self->state_machine, clocks_per_bit * frequency); - common_hal_rp2pio_statemachine_restart(&self->state_machine); - uint8_t channel_count = audiosample_channel_count(sample); if (channel_count > 2) { mp_raise_ValueError(translate("Too many channels in sample.")); } + common_hal_rp2pio_statemachine_set_frequency(&self->state_machine, clocks_per_bit * frequency); + common_hal_rp2pio_statemachine_restart(&self->state_machine); + + // On the RP2040, output registers are always written with a 32-bit write. + // If the write is 8 or 16 bits wide, the data will be replicated in upper bytes. + // See section 2.1.4 Narrow IO Register Writes in the RP2040 datasheet. + // This means that identical 16-bit audio data will be written in both halves of the incoming PIO + // FIFO register. Thus we get mono-to-stereo conversion for the I2S output for free. audio_dma_result result = audio_dma_setup_playback( &self->dma, sample, @@ -201,8 +206,6 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, mp_raise_RuntimeError(translate("Unable to allocate buffers for signed conversion")); } - // Turn on the state machine's clock. - self->playing = true; } From a874043e1b5bec7cef36885416f00c6cd377af3c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 7 Sep 2021 14:59:45 -0700 Subject: [PATCH 17/18] Selectively build boards based on changed files This uses a step output from the test job to set the build matrix for the board build jobs. The built boards depends on which files were changed. * Changes contained within ports/*/boards/ will build each board. * Changes contained within ports/* will build all boards from the port. * All other file changes will build all boards. All boards will be build for pushes in `adafruit/circuitpython` as well. A side-effect is that we no longer need to explicitly list the boards to build. It will automatically update as new folders are added. Related to #4009 --- .github/workflows/build.yml | 269 ++++----------------------------- tools/ci_changed_board_list.py | 94 ++++++++++++ tools/ci_new_boards_check.py | 57 ------- 3 files changed, 124 insertions(+), 296 deletions(-) create mode 100644 tools/ci_changed_board_list.py delete mode 100644 tools/ci_new_boards_check.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b490ae416..2971032018 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,10 @@ on: jobs: test: runs-on: ubuntu-20.04 + outputs: + arm-boards: ${{ steps.set-matrix.outputs.arm-boards }} + riscv-boards: ${{ steps.set-matrix.outputs.riscv-boards }} + xtensa-boards: ${{ steps.set-matrix.outputs.xtensa-boards }} steps: - name: Dump GitHub context env: @@ -43,9 +47,6 @@ jobs: run: | gcc --version python3 --version - - name: New boards check - run: python3 -u ci_new_boards_check.py - working-directory: tools - name: Duplicate USB VID/PID Check run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - name: Build and Validate Stubs @@ -139,6 +140,29 @@ jobs: # setup.py sdist was run by 'make stubs' [ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi" [ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/* + - uses: dorny/paths-filter@v2 + id: filter + with: + # Enable listing of files matching each filter. + # Paths to files will be available in `${FILTER_NAME}_files` output variable. + # Paths will be formatted as JSON array + list-files: json + + # Compare against this branch. (Ignored for PRs.) + base: ${{ github.ref }} + + # In this example all changed files are passed to the following action to do + # some custom processing. + filters: | + changed: + - '**' + - name: "Set boards to build" + id: set-matrix + working-directory: tools + env: + CHANGED_FILES: ${{ steps.filter.outputs.changed_files }} + run: | + python3 -u ci_changed_board_list.py mpy-cross-mac: runs-on: macos-10.15 @@ -203,205 +227,7 @@ jobs: strategy: fail-fast: false matrix: - board: - - "8086_commander" - - "ADM_B_NRF52840_1" - - "TG-Watch" - - "adafruit_feather_rp2040" - - "adafruit_itsybitsy_rp2040" - - "adafruit_led_glasses_nrf52840" - - "adafruit_macropad_rp2040" - - "adafruit_neokey_trinkey_m0" - - "adafruit_proxlight_trinkey_m0" - - "adafruit_qt2040_trinkey" - - "adafruit_qtpy_rp2040" - - "adafruit_rotary_trinkey_m0" - - "adafruit_slide_trinkey_m0" - - "aloriumtech_evo_m51" - - "aramcon2_badge" - - "aramcon_badge_2019" - - "arduino_mkr1300" - - "arduino_mkrzero" - - "arduino_nano_33_ble" - - "arduino_nano_33_iot" - - "arduino_nano_rp2040_connect" - - "arduino_zero" - - "bast_pro_mini_m0" - - "bastble" - - "bdmicro_vina_d21" - - "bdmicro_vina_d51" - - "bdmicro_vina_d51_pcb7" - - "bless_dev_board_multi_sensor" - - "blm_badge" - - "bluemicro840" - - "capablerobot_usbhub" - - "catwan_usbstick" - - "circuitbrains_basic_m0" - - "circuitbrains_deluxe_m4" - - "circuitplayground_bluefruit" - - "circuitplayground_express" - - "circuitplayground_express_crickit" - - "circuitplayground_express_displayio" - - "clue_nrf52840_express" - - "cp32-m4" - - "cp_sapling_m0" - - "cp_sapling_m0_revb" - - "cp_sapling_m0_spiflash" - - "cytron_maker_pi_rp2040" - - "datalore_ip_m4" - - "datum_distance" - - "datum_imu" - - "datum_light" - - "datum_weather" - - "dynalora_usb" - - "dynossat_edu_eps" - - "dynossat_edu_obc" - - "electronut_labs_blip" - - "electronut_labs_papyr" - - "escornabot_makech" - - "espruino_pico" - - "espruino_wifi" - - "feather_bluefruit_sense" - - "feather_m0_adalogger" - - "feather_m0_basic" - - "feather_m0_express" - - "feather_m0_express_crickit" - - "feather_m0_rfm69" - - "feather_m0_rfm9x" - - "feather_m0_supersized" - - "feather_m4_can" - - "feather_m4_express" - - "feather_m7_1011" - - "feather_mimxrt1011" - - "feather_mimxrt1062" - - "feather_nrf52840_express" - - "feather_stm32f405_express" - - "fluff_m0" - - "gemma_m0" - - "grandcentral_m4_express" - - "hallowing_m0_express" - - "hallowing_m4_express" - - "hiibot_bluefi" - - "huntercat_nfc" - - "ikigaisense_vita" - - "imxrt1010_evk" - - "imxrt1020_evk" - - "imxrt1060_evk" - - "itsybitsy_m0_express" - - "itsybitsy_m4_express" - - "itsybitsy_nrf52840_express" - - "jpconstantineau_encoderpad_rp2040" - - "kicksat-sprite" - - "loc_ber_m4_base_board" - - "makerdiary_m60_keyboard" - - "makerdiary_nrf52840_m2_devkit" - - "makerdiary_nrf52840_mdk" - - "makerdiary_nrf52840_mdk_usb_dongle" - - "matrixportal_m4" - - "meowbit_v121" - - "meowmeow" - - "metro_m0_express" - - "metro_m4_airlift_lite" - - "metro_m4_express" - - "metro_m7_1011" - - "metro_nrf52840_express" - - "microbit_v2" - - "mini_sam_m4" - - "monster_m4sk" - - "ndgarage_ndbit6" - - "ndgarage_ndbit6_v2" - - "neopixel_trinkey_m0" - - "nfc_copy_cat" - - "nice_nano" - - "nucleo_f746zg" - - "nucleo_f767zi" - - "nucleo_h743zi_2" - - "ohs2020_badge" - - "openbook_m4" - - "openmv_h7" - - "particle_argon" - - "particle_boron" - - "particle_xenon" - - "pca10056" - - "pca10059" - - "pca10100" - - "pewpew10" - - "pewpew_m4" - - "picoplanet" - - "pimoroni_interstate75" - - "pimoroni_keybow2040" - - "pimoroni_pga2040" - - "pimoroni_picolipo_16mb" - - "pimoroni_picolipo_4mb" - - "pimoroni_picosystem" - - "pimoroni_plasma2040" - - "pimoroni_tiny2040" - - "pitaya_go" - - "pyb_nano_v2" - - "pybadge" - - "pyboard_v11" - - "pycubed" - - "pycubed_mram" - - "pygamer" - - "pyportal" - - "pyportal_titano" - - "pyruler" - - "qtpy_m0" - - "qtpy_m0_haxpress" - - "raspberry_pi_pico" - - "raytac_mdbt50q-db-40" - - "raytac_mdbt50q-rx" - - "robohatmm1_m4" - - "sam32" - - "same54_xplained" - - "seeeduino_wio_terminal" - - "seeeduino_xiao" - - "sensebox_mcu" - - "serpente" - - "shirtty" - - "silicognition-m4-shim" - - "simmel" - - "snekboard" - - "sparkfun_lumidrive" - - "sparkfun_micromod_rp2040" - - "sparkfun_nrf52840_micromod" - - "sparkfun_nrf52840_mini" - - "sparkfun_pro_micro_rp2040" - - "sparkfun_qwiic_micro_no_flash" - - "sparkfun_qwiic_micro_with_flash" - - "sparkfun_redboard_turbo" - - "sparkfun_samd21_dev" - - "sparkfun_samd21_mini" - - "sparkfun_samd51_micromod" - - "sparkfun_samd51_thing_plus" - - "sparkfun_stm32f405_micromod" - - "sparkfun_thing_plus_rp2040" - - "spresense" - - "stackrduino_m0_pro" - - "stm32f411ce_blackpill" - - "stm32f411ce_blackpill_with_flash" - - "stm32f411ve_discovery" - - "stm32f412zg_discovery" - - "stm32f4_discovery" - - "stm32f746g_discovery" - - "stringcar_m0_express" - - "teensy40" - - "teensy41" - - "teknikio_bluebird" - - "thunderpack_v11" - - "thunderpack_v12" - - "tinkeringtech_scoutmakes_azul" - - "trellis_m4_express" - - "trinket_m0" - - "trinket_m0_haxpress" - - "uartlogger2" - - "uchip" - - "ugame10" - - "warmbit_bluepixel" - - "winterbloom_big_honking_button" - - "winterbloom_sol" - - "xinabox_cc03" - - "xinabox_cs11" + board: ${{ fromJSON(needs.test.outputs.arm-boards) }} steps: - name: Set up Python 3.8 @@ -451,8 +277,7 @@ jobs: strategy: fail-fast: false matrix: - board: - - "fomu" + board: ${{ fromJSON(needs.test.outputs.riscv-boards) }} steps: - name: Set up Python 3.8 @@ -501,41 +326,7 @@ jobs: strategy: fail-fast: false matrix: - board: - - "adafruit_feather_esp32s2_nopsram" - - "adafruit_feather_esp32s2_tftback_nopsram" - - "adafruit_funhouse" - - "adafruit_magtag_2.9_grayscale" - - "adafruit_metro_esp32s2" - - "ai_thinker_esp_12k_nodemcu" - - "artisense_rd00" - - "atmegazero_esp32s2" - - "crumpspace_crumps2" - - "electroniccats_bastwifi" - - "espressif_hmi_devkit_1" - - "espressif_kaluga_1" - - "espressif_kaluga_1.3" - - "espressif_saola_1_wroom" - - "espressif_saola_1_wrover" - - "franzininho_wifi_wroom" - - "franzininho_wifi_wrover" - - "gravitech_cucumber_m" - - "gravitech_cucumber_ms" - - "gravitech_cucumber_r" - - "gravitech_cucumber_rs" - - "lilygo_ttgo_t8_s2_st7789" - - "lolin_s2_mini" - - "microdev_micro_s2" - - "morpheans_morphesp-240" - - "muselab_nanoesp32_s2_wroom" - - "muselab_nanoesp32_s2_wrover" - - "odt_pixelwing_esp32_s2" - - "targett_module_clip_wroom" - - "targett_module_clip_wrover" - - "unexpectedmaker_feathers2" - - "unexpectedmaker_feathers2_neo" - - "unexpectedmaker_feathers2_prerelease" - - "unexpectedmaker_tinys2" + board: ${{ fromJSON(needs.test.outputs.xtensa-boards) }} steps: - name: Set up Python 3.8 diff --git a/tools/ci_changed_board_list.py b/tools/ci_changed_board_list.py new file mode 100644 index 0000000000..221b1ecaa3 --- /dev/null +++ b/tools/ci_changed_board_list.py @@ -0,0 +1,94 @@ +#! /usr/bin/env python3 + +"""This script is used in GitHub Actions to determine what boards are built + based on what files were changed. The base commit varies depending on the + event that triggered run. Pull request runs will compare to the base branch + while pushes will compare to the current ref. We override this for the + adafruit/circuitpython repo so we build all boards for pushes. + """ + +# SPDX-FileCopyrightText: 2021 Scott Shawcroft +# +# SPDX-License-Identifier: MIT + +import sys +import os +import json +import yaml +import re + +import build_board_info + +PORT_TO_ARCH = { + "atmel-samd": "arm", + "cxd56": "arm", + "esp32s2": "xtensa", + "litex": "riscv", + "mimxrt10xx": "arm", + "nrf": "arm", + "raspberrypi": "arm", + "stm": "arm", +} + +changed_files = json.loads(os.environ["CHANGED_FILES"]) +print("changed_files") +print(changed_files) + +# Get boards in json format +boards_info_json = build_board_info.get_board_mapping() +all_board_ids = set() +port_to_boards = {} +board_to_port = {} +for board_id in boards_info_json: + info = boards_info_json[board_id] + if info.get("alias", False): + continue + all_board_ids.add(board_id) + port = info["port"] + if port not in port_to_boards: + port_to_boards[port] = set() + port_to_boards[port].add(board_id) + board_to_port[board_id] = port + +# Build all boards if this is a push to an adafruit/circuitpython branch because we save the artifacts. +boards_to_build = all_board_ids +if not changed_files or ( + os.environ.get("GITHUB_EVENT_NAME", "") == "push" + and os.environ.get("GITHUB_REPOSITORY", "") == "adafruit/circuitpython" +): + print("Building all boards because of adafruit/circuitpython branch") +else: + print("Adding boards to build based on changed files") + boards_to_build = set() + board_pattern = re.compile(r"ports/\w+/boards/(\w+)/") + port_pattern = re.compile(r"ports/(\w+)/") + for p in changed_files: + # See if it is board specific + board_matches = board_pattern.search(p) + if board_matches: + board = board_matches.group(1) + boards_to_build.add(board) + continue + + # See if it is port specific + port_matches = port_pattern.search(p) + if port_matches: + port = port_matches.group(1) + boards_to_build.update(port_to_boards[port]) + continue + + # Otherwise build it all + boards_to_build = all_board_ids + break + +# Split boards by architecture. +print("Building boards:") +arch_to_boards = {"arm": [], "riscv": [], "xtensa": []} +for board in boards_to_build: + print(" ", board) + arch = PORT_TO_ARCH[board_to_port[board]] + arch_to_boards[arch].append(board) + +# Set the step outputs for each architecture +for arch in arch_to_boards: + print("::set-output name=" + arch + "-boards::" + json.dumps(sorted(arch_to_boards[arch]))) diff --git a/tools/ci_new_boards_check.py b/tools/ci_new_boards_check.py deleted file mode 100644 index 3b41c8d67b..0000000000 --- a/tools/ci_new_boards_check.py +++ /dev/null @@ -1,57 +0,0 @@ -#! /usr/bin/env python3 - -# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) -# -# SPDX-License-Identifier: MIT - -import sys -import os -import json -import yaml - -import build_board_info - -workflow_file = ".github/workflows/build.yml" - -# Get boards in json format -boards_info_json = build_board_info.get_board_mapping() - -# Get all the boards out of the json format -info_boards = [ - board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False) -] - -# We need to know the path of the workflow file -base_path = os.path.dirname(__file__) -yml_path = os.path.abspath(os.path.join(base_path, "..", workflow_file)) - -# Loading board list based on build jobs in the workflow file. -ci_boards = [] -with open(yml_path, "r") as f: - workflow = yaml.safe_load(f) - -ok = True -for job in workflow["jobs"]: - if not job.startswith("build"): - continue - job_boards = workflow["jobs"][job]["strategy"]["matrix"]["board"] - if job_boards != sorted(job_boards): - print('Boards for job "{}" not sorted. Must be:'.format(job)) - print(' - "' + '"\n - "'.join(sorted(job_boards)) + '"') - ok = False - ci_boards.extend(job_boards) - -# All the travis_boards elements must be on info_boards -info_boards.sort() -ci_boards.sort() - -missing_boards = set(info_boards) - set(ci_boards) - -if missing_boards: - ok = False - print("Boards missing in {}:".format(workflow_file)) - for board in missing_boards: - print(board) - -if not ok: - sys.exit(1) From 3c8eca3ef9c3a92f21d74d15ba3ddcf66d381d1d Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 7 Sep 2021 18:23:19 -0400 Subject: [PATCH 18/18] Update frozen libraries for 7.0.0 --- frozen/Adafruit_CircuitPython_BLE | 2 +- frozen/Adafruit_CircuitPython_Display_Shapes | 2 +- frozen/Adafruit_CircuitPython_Display_Text | 2 +- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_MIDI | 2 +- frozen/Adafruit_CircuitPython_ST7789 | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_BLE b/frozen/Adafruit_CircuitPython_BLE index ad4f2d32d3..9ae0e7f870 160000 --- a/frozen/Adafruit_CircuitPython_BLE +++ b/frozen/Adafruit_CircuitPython_BLE @@ -1 +1 @@ -Subproject commit ad4f2d32d3a35b412bab7c6c0ba3b7a46d5da5aa +Subproject commit 9ae0e7f870c0dd508d8a27c179b5d63b47567f85 diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes index c6ea5d17c8..99bf9e741d 160000 --- a/frozen/Adafruit_CircuitPython_Display_Shapes +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -1 +1 @@ -Subproject commit c6ea5d17c8c7bd391b3977c0195cff60dddf3f25 +Subproject commit 99bf9e741dccd1271317e782eed49cbf42a4efae diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text index c31c0ef2da..99a296fb3b 160000 --- a/frozen/Adafruit_CircuitPython_Display_Text +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -1 +1 @@ -Subproject commit c31c0ef2da48bfed7da2188039b59251f02110ea +Subproject commit 99a296fb3bdf2743f9b5f487649d7721c8f83c24 diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 78b0fbbb00..1cb554987d 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 78b0fbbb00c0431042b460fe20a76bbc440c4793 +Subproject commit 1cb554987df86b008e5a0feaa56f0a24d806bf28 diff --git a/frozen/Adafruit_CircuitPython_MIDI b/frozen/Adafruit_CircuitPython_MIDI index 01ae093f1f..0f5651650c 160000 --- a/frozen/Adafruit_CircuitPython_MIDI +++ b/frozen/Adafruit_CircuitPython_MIDI @@ -1 +1 @@ -Subproject commit 01ae093f1f73c152941cde9f4f850b163d278df2 +Subproject commit 0f5651650c11a24e531e5dd1eadfc5654d84a478 diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 index 9020acbab0..460e971e32 160000 --- a/frozen/Adafruit_CircuitPython_ST7789 +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -1 +1 @@ -Subproject commit 9020acbab070d5842dcba83a5b7f7b7c86dc7414 +Subproject commit 460e971e32ea53176b39ec093ae98fdac0d39d86