Skip to content

Commit affff48

Browse files
committed
Remove SPI bus definition from pins.c and board python module
1 parent 53c3273 commit affff48

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

  • ports/espressif/boards

ports/espressif/boards/m5stack_cores3/board.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ uint8_t display_init_sequence[] = {
3838
};
3939

4040
static bool display_init(void) {
41-
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
4241
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
42+
busio_spi_obj_t *spi = &bus->inline_bus;
43+
common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO37, NULL, false);
44+
common_hal_busio_spi_never_reset(spi);
4345
bus->base.type = &fourwire_fourwire_type;
4446

4547
common_hal_fourwire_fourwire_construct(

ports/espressif/boards/m5stack_cores3_se/pins.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
1313
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
1414

1515
// M5 Bus (except I2S)
16-
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO37) },
17-
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO35) },
18-
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) },
19-
16+
// The SPI bus MISO is also used for the TFT D/C signal, so it is not available for general use
17+
// therefore the SPI bus is not listed on the M5 Bus
2018
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
2119
{ MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) },
2220

@@ -69,6 +67,8 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
6967
{ MP_ROM_QSTR(MP_QSTR_I2S_MASTER_CLOCK), MP_ROM_PTR(&pin_GPIO0) },
7068

7169
// Display
70+
{ MP_ROM_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_GPIO37) },
71+
{ MP_ROM_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_GPIO36) },
7272
{ MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO3) },
7373
{ MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO35) },
7474

@@ -79,7 +79,6 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
7979

8080
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
8181
{ MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_obj) },
82-
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
8382
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
8483

8584
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}

0 commit comments

Comments
 (0)