summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-06-04 21:26:45 +0200
committerDamien George <damien@micropython.org>2022-10-06 22:38:33 +1100
commit4013577af2f530599db80a6696c23be2ed335bee (patch)
treea14a8f4d5d2b76d162ed7f75b9bc00156f22ee1c
parente8615f5813855a3f839714fb62c7d8a5e0082072 (diff)
samd/modmachine: Enable SoftSPI and SoftI2C.
-rw-r--r--ports/samd/Makefile1
-rw-r--r--ports/samd/modmachine.c4
-rw-r--r--ports/samd/mpconfigport.h2
3 files changed, 7 insertions, 0 deletions
diff --git a/ports/samd/Makefile b/ports/samd/Makefile
index e3316a9d6..ea71973bd 100644
--- a/ports/samd/Makefile
+++ b/ports/samd/Makefile
@@ -110,6 +110,7 @@ SRC_C = \
lib/tinyusb/src/device/usbd_control.c \
lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
lib/tinyusb/src/tusb.c \
+ drivers/bus/softspi.c \
shared/libc/printf.c \
shared/libc/string0.c \
shared/readline/readline.c \
diff --git a/ports/samd/modmachine.c b/ports/samd/modmachine.c
index 99fccf5bf..b095a6b39 100644
--- a/ports/samd/modmachine.c
+++ b/ports/samd/modmachine.c
@@ -28,6 +28,8 @@
#include "extmod/machine_mem.h"
#include "samd_soc.h"
#include "modmachine.h"
+#include "extmod/machine_i2c.h"
+#include "extmod/machine_spi.h"
// ASF 4
#include "hal_flash.h"
@@ -129,6 +131,8 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&machine_led_type) },
+ { MP_ROM_QSTR(MP_QSTR_SoftI2C), MP_ROM_PTR(&mp_machine_soft_i2c_type) },
+ { MP_ROM_QSTR(MP_QSTR_SoftSPI), MP_ROM_PTR(&mp_machine_soft_spi_type) },
};
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
diff --git a/ports/samd/mpconfigport.h b/ports/samd/mpconfigport.h
index c29043c5d..6441818ba 100644
--- a/ports/samd/mpconfigport.h
+++ b/ports/samd/mpconfigport.h
@@ -97,6 +97,8 @@
#define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_UZLIB (1)
#define MICROPY_PY_UASYNCIO (1)
+#define MICROPY_PY_MACHINE_SOFTI2C (1)
+#define MICROPY_PY_MACHINE_SOFTSPI (1)
#define MP_STATE_PORT MP_STATE_VM