Skip to content

Commit d234569

Browse files
committed
fixes issue with SDCard driver and also changes how the machine.SPI.Bus driver works
The spi bus driver has now been split into 4 different buy types. * `SPI.Bus`: normal SPI bus type * `SPI.DualBus`: Half duplex using both the miso and mosi pins for transmitting or receiving. This makes the driver 2 times faster when sending a ot of data * `SPI.QuadBus`: Half duplex using a total of 4 pins/lanes to transmit and receive * `SPI.OctalBus`: Half duplex using a total of 8 pins/lanes to transmit and receive
1 parent fe5276c commit d234569

File tree

4 files changed

+270
-138
lines changed

4 files changed

+270
-138
lines changed

ext_mod/lcd_bus/esp32_src/spi_bus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ static mp_obj_t mp_lcd_spi_bus_make_new(const mp_obj_type_t *type, size_t n_args
151151
self->panel_io_config.flags.quad_mode = (unsigned int)args[ARG_quad].u_bool;
152152
self->panel_io_config.flags.octal_mode = (unsigned int)args[ARG_octal].u_bool;
153153

154-
if (!spi_bus->dual) self->panel_io_config.flags.sio_mode = 0;
155-
if (!spi_bus->quad) self->panel_io_config.flags.quad_mode = 0;
156-
if (!spi_bus->octal) self->panel_io_config.flags.octal_mode = 0;
154+
if (!(spi_bus->buscfg.flags & SPICOMMON_BUSFLAG_DUAL)) self->panel_io_config.flags.sio_mode = 0;
155+
if (!(spi_bus->buscfg.flags & SPICOMMON_BUSFLAG_QUAD)) self->panel_io_config.flags.quad_mode = 0;
156+
if (!(spi_bus->buscfg.flags & SPICOMMON_BUSFLAG_OCTAL)) self->panel_io_config.flags.octal_mode = 0;
157157

158158
self->panel_io_handle.del = &spi_del;
159159
self->panel_io_handle.init = &spi_init;

micropy_updates/common/mp_spi_common.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "py/obj.h"
66
#include "py/runtime.h"
7+
#include "driver/spi_master.h"
78

89
#ifndef __MP_SPI_COMMON_H__
910
#define __MP_SPI_COMMON_H__
@@ -20,19 +21,8 @@
2021
struct _mp_machine_hw_spi_bus_obj_t {
2122
mp_obj_base_t base;
2223
uint8_t host;
23-
mp_obj_t sck;
24-
mp_obj_t mosi;
25-
mp_obj_t miso;
26-
mp_obj_t data2;
27-
mp_obj_t data3;
28-
mp_obj_t data4;
29-
mp_obj_t data5;
30-
mp_obj_t data6;
31-
mp_obj_t data7;
32-
bool dual;
33-
bool quad;
34-
bool octal;
3524
uint8_t device_count;
25+
spi_bus_config_t buscfg;
3626
mp_machine_hw_spi_device_obj_t **devices;
3727
mp_machine_hw_spi_state_t state;
3828
const void *user_data;

0 commit comments

Comments
 (0)