esp32/machine_hw_spi: Fix SPI default pins reordering on ESP32-S2/S3.
The index of machine_hw_spi_obj and machine_hw_spi_default_pins arrays is assigned to 0 for ARG_id==HSPI_HOST and 1 for another SPI. On ESP32S2 and S3 HSPI_HOST=2 so the first set (idx=0) of default pins is used for SPI(id=2) aka HSPI/SPI3 and the second set (idx=1) for SPI(id=1) aka FSPI/SPI2. This makes a misleading mess in MICROPY_HW_SPIxxxx definitions and it is also in contradiction to the comments around the definitions. Change the test of ARG_id to fix the order of machine_hw_spi_default_pins. This change might require adjusting MICROPY_HW_SPIxxxx definitions in mpconfigboard.h of S2/S3 based boards. Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
parent
f9733705a9
commit
3305ec44a2
@ -458,7 +458,7 @@ mp_obj_t machine_hw_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
|||||||
|
|
||||||
machine_hw_spi_obj_t *self;
|
machine_hw_spi_obj_t *self;
|
||||||
const machine_hw_spi_default_pins_t *default_pins;
|
const machine_hw_spi_default_pins_t *default_pins;
|
||||||
if (args[ARG_id].u_int == HSPI_HOST) {
|
if (args[ARG_id].u_int == 1) { // SPI2_HOST which is FSPI_HOST on ESP32Sx, HSPI_HOST on others
|
||||||
self = &machine_hw_spi_obj[0];
|
self = &machine_hw_spi_obj[0];
|
||||||
default_pins = &machine_hw_spi_default_pins[0];
|
default_pins = &machine_hw_spi_default_pins[0];
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user