diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c index 5d92ae39a..96f48a538 100644 --- a/drivers/dht/dht.c +++ b/drivers/dht/dht.c @@ -1,3 +1,4 @@ +#ifdef MICROPY_HW_ENABLE_DHT /* * This file is part of the MicroPython project, http://micropython.org/ * @@ -87,3 +88,5 @@ timeout: mp_raise_OSError(MP_ETIMEDOUT); } MP_DEFINE_CONST_FUN_OBJ_2(dht_readinto_obj, dht_readinto); + +#endif diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 158f5f2b3..b9ebc56bf 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -630,7 +630,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_disable_irq), MP_ROM_PTR(&pyb_disable_irq_obj) }, { MP_ROM_QSTR(MP_QSTR_enable_irq), MP_ROM_PTR(&pyb_enable_irq_obj) }, +#if MICROPY_PY_MACHINE_PULSE { MP_ROM_QSTR(MP_QSTR_time_pulse_us), MP_ROM_PTR(&machine_time_pulse_us_obj) }, +#endif { MP_ROM_QSTR(MP_QSTR_mem8), MP_ROM_PTR(&machine_mem8_obj) }, { MP_ROM_QSTR(MP_QSTR_mem16), MP_ROM_PTR(&machine_mem16_obj) }, diff --git a/ports/stm32/modpyb.c b/ports/stm32/modpyb.c index 5afbbc484..8681b5755 100644 --- a/ports/stm32/modpyb.c +++ b/ports/stm32/modpyb.c @@ -30,7 +30,9 @@ #include "py/runtime.h" #include "py/mphal.h" #include "lib/utils/pyexec.h" +#if MICROPY_HW_ENABLE_DHT #include "drivers/dht/dht.h" +#endif #include "stm32_it.h" #include "irq.h" #include "led.h" @@ -164,8 +166,10 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, #endif +#if MICROPY_HW_ENABLE_DHT // This function is not intended to be public and may be moved elsewhere { MP_ROM_QSTR(MP_QSTR_dht_readinto), MP_ROM_PTR(&dht_readinto_obj) }, +#endif { MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&pyb_timer_type) }, diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index 5316113cc..2d70f3d20 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -224,3 +224,9 @@ #endif #define MICROPY_HW_USES_BOOTLOADER (MICROPY_HW_VTOR != 0x08000000) + +// drivers/dht ... a specific enviro sensor of some sort +#ifndef MICROPY_HW_ENABLE_DHT +#define MICROPY_HW_ENABLE_DHT (1) +#endif +