Skip to content

Commit 9ba4104

Browse files
authored
Merge pull request adafruit#10178 from adafruit/9.2.x
Merge current 9.2.x to main
2 parents a0b482c + c27e0da commit 9ba4104

File tree

31 files changed

+301
-48
lines changed

31 files changed

+301
-48
lines changed

.github/pull_request_template.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Thanks for submitting a pull request to CircuitPython! Remove these instructions before submitting.
2+
3+
See https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github for detailed instructions.
4+
5+
- Consider whether to submit this PR against `main` or against (if it exists) the branch for the current stable release or an upcoming minor release. The branch will be named `i.j.x`, for example, `9.2.x`. Bug fixes and minor enhancements can be submitted against the stable release branch, and will be merged to `main` regularly.
6+
- Create your own fork of `circuitpython` and create a branch for your changes.
7+
- Use `pre-commit` to check your commits before submitting. See https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/check-your-code.
8+
- Test your changes and tell us how you tested.
9+
10+
---

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ repos:
1010
hooks:
1111
- id: check-yaml
1212
- id: end-of-file-fixer
13-
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/raspberrypi/sdk|lib/tinyusb)'
13+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/mimxrt10xx/sdk|ports/raspberrypi/sdk|lib/tinyusb)'
1414
- id: trailing-whitespace
15-
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|lib/mbedtls_errors/generate_errors.diff|ports/raspberrypi/sdk|lib/tinyusb)'
15+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|lib/mbedtls_errors/generate_errors.diff|ports/raspberrypi/sdk|ports/mimxrt10xx/sdk|lib/tinyusb)'
1616
- repo: https://github.com/codespell-project/codespell
1717
rev: v2.2.4
1818
hooks:
@@ -59,3 +59,4 @@ repos:
5959
rev: "v2.5.0"
6060
hooks:
6161
- id: pyproject-fmt
62+
exclude: '^(ports/mimxrt10xx/sdk)'

docs/library/errno.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|see_cpython_module| :mod:`python:errno`.
88

99
This module provides access to symbolic error codes for `OSError` exception.
10-
The codes available may vary per CircuitPython build.
10+
Some codes are not available on the smallest CircuitPython builds, such as SAMD21, for space reasons.
1111

1212
Constants
1313
---------

ports/espressif/boards/heltec_esp32s3_wifi_lora_v3/mpconfigboard.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ CIRCUITPY_DISPLAYIO = 1
2626

2727
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes
2828
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text
29-
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x

ports/espressif/boards/waveshare_esp32_s3_geek/board.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,9 @@ uint8_t display_init_sequence[] = {
3030
};
3131

3232
static void display_init(void) {
33-
3433
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
3534
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
3635

37-
common_hal_busio_spi_construct(
38-
spi,
39-
&pin_GPIO12, // CLK
40-
&pin_GPIO11, // MOSI
41-
NULL, // MISO not connected
42-
false); // Not half-duplex
43-
44-
4536
bus->base.type = &fourwire_fourwire_type;
4637

4738
common_hal_fourwire_fourwire_construct(

ports/espressif/boards/waveshare_esp32_s3_geek/mpconfigboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO17)
1818
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO16)
1919

20-
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36)
21-
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
22-
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37)
20+
#define CIRCUITPY_BOARD_SPI (2)
21+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO12, .mosi = &pin_GPIO11}, \
22+
{.clock = &pin_GPIO36, .mosi = &pin_GPIO35, .miso = &pin_GPIO37}}

ports/espressif/boards/waveshare_esp32_s3_geek/pins.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
// SPDX-License-Identifier: MIT
66

77
#include "shared-bindings/board/__init__.h"
8-
98
#include "shared-module/displayio/__init__.h"
9+
10+
CIRCUITPY_BOARD_BUS_SINGLETON(sd_spi, spi, 1)
11+
1012
static const mp_rom_map_elem_t board_module_globals_table[] = {
1113
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
1214

@@ -64,11 +66,11 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
6466
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
6567

6668
// SD Card
67-
{ MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO36)},
68-
{ MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO35)},
69-
{ MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO37)},
70-
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO34)},
71-
{ MP_ROM_QSTR(MP_QSTR_SD_SPI), MP_ROM_PTR(&board_spi_obj) },
69+
{ MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO36) },
70+
{ MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO35) },
71+
{ MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO37) },
72+
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO34) },
73+
{ MP_ROM_QSTR(MP_QSTR_SD_SPI), MP_ROM_PTR(&board_sd_spi_obj) },
7274
// Pin 38 is for the SDIO interface, and therefore not included in the SPI object
7375

7476
// LCD
@@ -78,6 +80,7 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
7880
{ MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO9) },
7981
{ MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) },
8082
{ MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO8) },
83+
{ MP_ROM_QSTR(MP_QSTR_LCD_SPI), MP_ROM_PTR(&board_spi_obj) },
8184
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
8285

8386
};
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
#include "mpconfigboard.h"
9+
#include "shared-bindings/busio/SPI.h"
10+
#include "shared-bindings/fourwire/FourWire.h"
11+
#include "shared-bindings/microcontroller/Pin.h"
12+
#include "shared-module/displayio/__init__.h"
13+
#include "shared-module/displayio/mipi_constants.h"
14+
#include "shared-bindings/board/__init__.h"
15+
16+
#define DELAY 0x80
17+
18+
// display init sequence according to LilyGO example app
19+
uint8_t display_init_sequence[] = {
20+
0x01, DELAY, 0x96, // _SWRESET and Delay 150ms
21+
0x11, DELAY, 0xFF, // _SLPOUT and Delay 500ms
22+
0x3A, DELAY | 1, 0x55, 0x0A, // _COLMOD and Delay 10ms
23+
0x21, DELAY, 0x0A, // _INVON Hack and Delay 10ms
24+
0x13, DELAY, 0x0A, // _NORON and Delay 10ms
25+
0x36, 0x01, 0x60, // _MADCTL
26+
0x29, DELAY, 0xFF, // _DISPON and Delay 500ms
27+
};
28+
29+
void board_init(void) {
30+
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
31+
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
32+
bus->base.type = &fourwire_fourwire_type;
33+
34+
common_hal_fourwire_fourwire_construct(
35+
bus,
36+
spi,
37+
&pin_GPIO42, // DC
38+
&pin_GPIO45, // CS
39+
&pin_GPIO0, // RST
40+
// 24000000,
41+
40000000, // baudrate
42+
0, // polarity
43+
0 // phase
44+
);
45+
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
46+
display->base.type = &busdisplay_busdisplay_type;
47+
48+
common_hal_busdisplay_busdisplay_construct(
49+
display,
50+
bus,
51+
320, // width (after rotation)
52+
240, // height (after rotation)
53+
0, // column start
54+
0, // row start
55+
0, // rotation
56+
16, // color depth
57+
false, // grayscale
58+
false, // pixels in a byte share a row. Only valid for depths < 8
59+
1, // bytes per cell. Only valid for depths < 8
60+
false, // reverse_pixels_in_byte. Only valid for depths < 8
61+
true, // reverse_pixels_in_word
62+
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
63+
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
64+
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
65+
display_init_sequence,
66+
sizeof(display_init_sequence),
67+
&pin_GPIO1, // backlight pin
68+
NO_BRIGHTNESS_COMMAND,
69+
1.0f, // brightness
70+
false, // single_byte_bounds
71+
false, // data_as_commands
72+
true, // auto_refresh
73+
60, // native_frames_per_second
74+
true, // backlight_on_high
75+
false, // SH1107_addressing
76+
50000 // backlight pwm frequency
77+
);
78+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2025 Neradoc
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
#define MICROPY_HW_BOARD_NAME "Waveshare ESP32S3 Touch LCD 2"
10+
#define MICROPY_HW_MCU_NAME "ESP32S3"
11+
12+
#define CIRCUITPY_BOARD_I2C (1)
13+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO47, .sda = &pin_GPIO48}}
14+
15+
#define CIRCUITPY_BOARD_SPI (1)
16+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO39, .mosi = &pin_GPIO38, .miso = &pin_GPIO40}}
17+
18+
#define DEFAULT_UART_BUS_RX (&pin_GPIO44)
19+
#define DEFAULT_UART_BUS_TX (&pin_GPIO43)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
USB_VID = 0x303A
2+
USB_PID = 0x82CE
3+
USB_MANUFACTURER = "Waveshare Electronics"
4+
USB_PRODUCT = "ESP32S3 Touch LCD 2"
5+
6+
IDF_TARGET = esp32s3
7+
8+
CIRCUITPY_ESP_FLASH_MODE = qio
9+
CIRCUITPY_ESP_FLASH_FREQ = 80m
10+
CIRCUITPY_ESP_FLASH_SIZE = 16MB
11+
12+
CIRCUITPY_ESP_PSRAM_SIZE = 8MB
13+
CIRCUITPY_ESP_PSRAM_MODE = opi
14+
CIRCUITPY_ESP_PSRAM_FREQ = 80m

0 commit comments

Comments
 (0)