summaryrefslogtreecommitdiff
path: root/extmod/machine_spi.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-11-11 15:43:55 +1100
committerDamien George <damien@micropython.org>2022-11-11 16:24:32 +1100
commita513558e3a72b47880faa847de64949e7fc746f6 (patch)
treeadbada6a58ec0a3d2f7c457a1f5b0f838b7cebd7 /extmod/machine_spi.c
parent2f0565367339595bf3130acf8e20d3d4e9bad499 (diff)
extmod: Add and reorganise compilation guards and includes.
To reduce dependencies on header files when extmod components are disabled. Signed-off-by: Damien George <damien.p.george@gmail.com>
Diffstat (limited to 'extmod/machine_spi.c')
-rw-r--r--extmod/machine_spi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/extmod/machine_spi.c b/extmod/machine_spi.c
index bb35cff38..8c4d91a3c 100644
--- a/extmod/machine_spi.c
+++ b/extmod/machine_spi.c
@@ -28,6 +28,9 @@
#include <string.h>
#include "py/runtime.h"
+
+#if MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_SOFTSPI
+
#include "extmod/machine_spi.h"
// if a port didn't define MSB/LSB constants then provide them
@@ -39,8 +42,6 @@
/******************************************************************************/
// MicroPython bindings for generic machine.SPI
-#if MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_SOFTSPI
-
STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);