Skip to content

Commit 1c6f970

Browse files
committed
some coding correction in the spi module
1 parent a27ba9f commit 1c6f970

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ext_mod/esp32_additions/spi/include/esp32_spi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
} state;
5353

5454
};
55+
5556
typedef struct _esp32_hw_spi_default_pins_t{
5657
int8_t mosi_io_num; ///< GPIO pin for Master Out Slave In (=spi_d) signal, or -1 if not used.
5758
int8_t miso_io_num; ///< GPIO pin for Master In Slave Out (=spi_q) signal, or -1 if not used.

ext_mod/esp32_additions/spi/src/esp32_spi.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "mphalport.h"
3737
#include "py/gc.h"
3838
#include "py/stackctrl.h"
39+
#include "py/objarray.h"
40+
#include "py/binary.h"
3941

4042
#include "driver/spi_master.h"
4143
#include "driver/spi_common.h"
@@ -831,7 +833,7 @@ mp_obj_t esp32_hw_spi_bus_make_new(const mp_obj_type_t *type, size_t n_args, siz
831833
data7 = -1;
832834

833835
if (args[ARG_sck].u_obj == MP_OBJ_NULL) {
834-
sck = default_pins->sclk_io_num
836+
sck = default_pins->sclk_io_num;
835837
} else if (args[ARG_sck].u_obj == mp_const_none) {
836838
sck = -1;
837839
} else {
@@ -1001,7 +1003,7 @@ mp_obj_t esp32_hw_spi_bus_make_new(const mp_obj_type_t *type, size_t n_args, siz
10011003
int dma_chan = SPI_DMA_CH_AUTO;
10021004
#endif
10031005

1004-
ret = spi_bus_initialize(self->host, &self->buscfg, dma_chan);
1006+
esp_err_t ret = spi_bus_initialize(self->host, &self->buscfg, dma_chan);
10051007
if (ret != ESP_OK) {
10061008
check_esp_err(ret);
10071009
return mp_const_none;
@@ -1015,7 +1017,7 @@ mp_obj_t esp32_hw_spi_bus_make_new(const mp_obj_type_t *type, size_t n_args, siz
10151017

10161018
STATIC mp_obj_t esp32_hw_spi_bus_deinit(mp_obj_t self_in)
10171019
{
1018-
esp32_hw_spi_dev_obj_t *self = (esp32_hw_spi_dev_obj_t *)self_in;
1020+
esp32_hw_spi_bus_obj_t *self = (esp32_hw_spi_bus_obj_t *)self_in;
10191021

10201022
esp_err_t ret = spi_bus_free(self->host);
10211023
check_esp_err(ret);

0 commit comments

Comments
 (0)