summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/samd/mcu/samd51/mpconfigmcu.h1
-rw-r--r--ports/samd/mcu/samd51/mpconfigmcu.mk2
-rw-r--r--ports/samd/modmachine.c4
-rw-r--r--ports/samd/mphalport.h3
4 files changed, 10 insertions, 0 deletions
diff --git a/ports/samd/mcu/samd51/mpconfigmcu.h b/ports/samd/mcu/samd51/mpconfigmcu.h
index 819bc1bb1..a266adf93 100644
--- a/ports/samd/mcu/samd51/mpconfigmcu.h
+++ b/ports/samd/mcu/samd51/mpconfigmcu.h
@@ -13,6 +13,7 @@
#define MP_NEED_LOG2 (1)
#define MICROPY_PY_CMATH (0)
+#define MICROPY_PY_MACHINE_DHT_READINTO (1)
#define MICROPY_PY_UOS_URANDOM (1)
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (trng_random_u32())
unsigned long trng_random_u32(void);
diff --git a/ports/samd/mcu/samd51/mpconfigmcu.mk b/ports/samd/mcu/samd51/mpconfigmcu.mk
index f8ed02f84..ed4df82c6 100644
--- a/ports/samd/mcu/samd51/mpconfigmcu.mk
+++ b/ports/samd/mcu/samd51/mpconfigmcu.mk
@@ -2,6 +2,8 @@ MICROPY_VFS_LFS2 ?= 1
SRC_S += shared/runtime/gchelper_m3.s
+SRC_C += drivers/dht/dht.c \
+
LIBM_SRC_C += $(addprefix lib/libm/,\
acoshf.c \
asinfacosf.c \
diff --git a/ports/samd/modmachine.c b/ports/samd/modmachine.c
index db3f159cc..14baf279d 100644
--- a/ports/samd/modmachine.c
+++ b/ports/samd/modmachine.c
@@ -30,6 +30,7 @@
#include "extmod/machine_pulse.h"
#include "extmod/machine_i2c.h"
#include "extmod/machine_spi.h"
+#include "drivers/dht/dht.h"
#include "modmachine.h"
#include "samd_soc.h"
@@ -179,6 +180,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
{ MP_ROM_QSTR(MP_QSTR_time_pulse_us), MP_ROM_PTR(&machine_time_pulse_us_obj) },
{ MP_ROM_QSTR(MP_QSTR_bitstream), MP_ROM_PTR(&machine_bitstream_obj) },
+ #if MICROPY_PY_MACHINE_DHT_READINTO
+ { MP_ROM_QSTR(MP_QSTR_dht_readinto), MP_ROM_PTR(&dht_readinto_obj) },
+ #endif
// Class constants.
// Use numerical constants instead of the symbolic names,
diff --git a/ports/samd/mphalport.h b/ports/samd/mphalport.h
index 6f4f838cf..3879240f9 100644
--- a/ports/samd/mphalport.h
+++ b/ports/samd/mphalport.h
@@ -99,6 +99,9 @@ static inline uint64_t mp_hal_time_ns(void) {
#define MP_HAL_PIN_FMT "%u"
#define mp_hal_pin_obj_t uint
+#define mp_hal_quiet_timing_enter() MICROPY_BEGIN_ATOMIC_SECTION()
+#define mp_hal_quiet_timing_exit(irq_state) MICROPY_END_ATOMIC_SECTION(irq_state)
+
extern uint32_t machine_pin_open_drain_mask[];
mp_hal_pin_obj_t mp_hal_get_pin_obj(mp_obj_t pin_in);