Skip to content

Commit

Permalink
extmod/modonewire: Make _onewire module configurable via macro option.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Sep 2, 2021
1 parent afe0634 commit d41f6dd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extmod/modonewire.c
Expand Up @@ -30,6 +30,8 @@
#include "py/obj.h"
#include "py/mphal.h"

#if MICROPY_PY_ONEWIRE

/******************************************************************************/
// Low-level 1-Wire routines

Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions ports/esp32/mpconfigport.h
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions ports/esp8266/mpconfigport.h
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions ports/mimxrt/mpconfigport.h
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ports/rp2/mpconfigport.h
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions py/mpconfig.h
Expand Up @@ -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 */

Expand Down

0 comments on commit d41f6dd

Please sign in to comment.