Skip to content

Commit 5445636

Browse files
committed
esp32: Enable soft implementation of machine.SPI class.
1 parent 50b3f4a commit 5445636

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

esp32/modmachine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "extmod/machine_mem.h"
3939
#include "extmod/machine_pulse.h"
4040
#include "extmod/machine_i2c.h"
41+
#include "extmod/machine_spi.h"
4142
#include "modmachine.h"
4243

4344
#if MICROPY_PY_MACHINE
@@ -88,6 +89,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
8889

8990
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) },
9091
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_i2c_type) },
92+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&mp_machine_soft_spi_type) },
9193
};
9294

9395
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);

esp32/mpconfigport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
#define MICROPY_PY_MACHINE (1)
114114
#define MICROPY_PY_MACHINE_PULSE (1)
115115
#define MICROPY_PY_MACHINE_I2C (1)
116-
#define MICROPY_PY_MACHINE_SPI (0)
116+
#define MICROPY_PY_MACHINE_SPI (1)
117117
#define MICROPY_PY_USSL (0)
118118
#define MICROPY_PY_WEBSOCKET (0)
119119
#define MICROPY_PY_FRAMEBUF (1)

esp32/mphalport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ uint32_t mp_hal_get_cpu_freq(void);
5050
// C-level pin HAL
5151
#include "py/obj.h"
5252
#include "driver/gpio.h"
53+
#define MP_HAL_PIN_FMT "%u"
5354
#define mp_hal_pin_obj_t gpio_num_t
5455
mp_hal_pin_obj_t machine_pin_get_id(mp_obj_t pin_in);
5556
#define mp_hal_get_pin_obj(o) machine_pin_get_id(o)
57+
#define mp_hal_pin_name(p) (p)
5658
static inline void mp_hal_pin_input(mp_hal_pin_obj_t pin) {
5759
gpio_set_direction(pin, GPIO_MODE_INPUT);
5860
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy