summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-09-02 12:39:50 +1000
committerDamien George <damien@micropython.org>2021-09-02 13:11:23 +1000
commitd41f6dde568df53a0f66a01a3c362e1c1e35ef14 (patch)
treed5ba1d7dff55ec64e171eb5c6b836967b5ee63d3
parentafe0634c989d81f0c887308a7bc152061cb5d319 (diff)
extmod/modonewire: Make _onewire module configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--extmod/modonewire.c4
-rw-r--r--ports/esp32/mpconfigport.h1
-rw-r--r--ports/esp8266/mpconfigport.h1
-rw-r--r--ports/mimxrt/mpconfigport.h1
-rw-r--r--ports/rp2/mpconfigport.h1
-rw-r--r--py/mpconfig.h5
6 files changed, 13 insertions, 0 deletions
diff --git a/extmod/modonewire.c b/extmod/modonewire.c
index 6abe3dfad..8b3426815 100644
--- a/extmod/modonewire.c
+++ b/extmod/modonewire.c
@@ -30,6 +30,8 @@
#include "py/obj.h"
#include "py/mphal.h"
+#if MICROPY_PY_ONEWIRE
+
/******************************************************************************/
// Low-level 1-Wire routines
@@ -160,3 +162,5 @@ const mp_obj_module_t mp_module_onewire = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&onewire_module_globals,
};
+
+#endif // MICROPY_PY_ONEWIRE
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index f8b26bfe8..b306be937 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -182,6 +182,7 @@
#define MICROPY_PY_WEBREPL (1)
#define MICROPY_PY_FRAMEBUF (1)
#define MICROPY_PY_BTREE (1)
+#define MICROPY_PY_ONEWIRE (1)
#define MICROPY_PY_USOCKET_EVENTS (MICROPY_PY_WEBREPL)
#define MICROPY_PY_BLUETOOTH_RANDOM_ADDR (1)
#define MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME ("ESP32")
diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h
index 5364dd58b..78263efec 100644
--- a/ports/esp8266/mpconfigport.h
+++ b/ports/esp8266/mpconfigport.h
@@ -86,6 +86,7 @@
#define MICROPY_PY_MACHINE_SPI (1)
#define MICROPY_PY_MACHINE_SOFTSPI (1)
#define MICROPY_PY_UWEBSOCKET (1)
+#define MICROPY_PY_ONEWIRE (1)
#define MICROPY_PY_WEBREPL (1)
#define MICROPY_PY_WEBREPL_DELAY (20)
#define MICROPY_PY_WEBREPL_STATIC_FILEBUF (1)
diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h
index 88e1872cf..be2b87e6a 100644
--- a/ports/mimxrt/mpconfigport.h
+++ b/ports/mimxrt/mpconfigport.h
@@ -130,6 +130,7 @@ uint32_t trng_random_u32(void);
#define MICROPY_PY_MACHINE_SPI (1)
#define MICROPY_PY_MACHINE_SOFTSPI (1)
#define MICROPY_PY_FRAMEBUF (1)
+#define MICROPY_PY_ONEWIRE (1)
// Use VfsLfs2's types for fileio/textio
#define mp_type_fileio mp_type_vfs_lfs2_fileio
diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h
index ad3de396b..4da34cd03 100644
--- a/ports/rp2/mpconfigport.h
+++ b/ports/rp2/mpconfigport.h
@@ -138,6 +138,7 @@
#define MICROPY_PY_MACHINE_SPI_LSB (SPI_LSB_FIRST)
#define MICROPY_PY_MACHINE_SOFTSPI (1)
#define MICROPY_PY_FRAMEBUF (1)
+#define MICROPY_PY_ONEWIRE (1)
#define MICROPY_VFS (1)
#define MICROPY_VFS_LFS2 (1)
#define MICROPY_VFS_FAT (1)
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 288b10537..1b41b6bd0 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -1517,6 +1517,11 @@ typedef double mp_float_t;
#define MICROPY_PY_BTREE (0)
#endif
+// Whether to provide the low-level "_onewire" module
+#ifndef MICROPY_PY_ONEWIRE
+#define MICROPY_PY_ONEWIRE (0)
+#endif
+
/*****************************************************************************/
/* Hooks for a port to add builtins */