8000 waveshare_esp32_s3_geek: fix SPI busses and board_init() · adafruit/circuitpython@bda1dc9 · GitHub
[go: up one dir, main page]

Skip to content

Commit bda1dc9

Browse files
committed
waveshare_esp32_s3_geek: fix SPI busses and board_init()
1 parent ae285da commit bda1dc9

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

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
};

0 commit comments

Comments
 (0)
0