samd/modmachine: Add machine.dht_readinto and enable on SAMD51.

This commit is contained in:
robert-hh 2022-07-07 09:49:51 +02:00 committed by Damien George
parent 0d3f0d7470
commit a7113e95d7
4 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#define MP_NEED_LOG2 (1) #define MP_NEED_LOG2 (1)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
#define MICROPY_PY_MACHINE_DHT_READINTO (1)
#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_UOS_URANDOM (1)
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (trng_random_u32()) #define MICROPY_PY_URANDOM_SEED_INIT_FUNC (trng_random_u32())
unsigned long trng_random_u32(void); unsigned long trng_random_u32(void);

View File

@ -2,6 +2,8 @@ MICROPY_VFS_LFS2 ?= 1
SRC_S += shared/runtime/gchelper_m3.s SRC_S += shared/runtime/gchelper_m3.s
SRC_C += drivers/dht/dht.c \
LIBM_SRC_C += $(addprefix lib/libm/,\ LIBM_SRC_C += $(addprefix lib/libm/,\
acoshf.c \ acoshf.c \
asinfacosf.c \ asinfacosf.c \

View File

@ -30,6 +30,7 @@
#include "extmod/machine_pulse.h" #include "extmod/machine_pulse.h"
#include "extmod/machine_i2c.h" #include "extmod/machine_i2c.h"
#include "extmod/machine_spi.h" #include "extmod/machine_spi.h"
#include "drivers/dht/dht.h"
#include "modmachine.h" #include "modmachine.h"
#include "samd_soc.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_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_time_pulse_us), MP_ROM_PTR(&machine_time_pulse_us_obj) },
{ MP_ROM_QSTR(MP_QSTR_bitstream), MP_ROM_PTR(&machine_bitstream_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. // Class constants.
// Use numerical constants instead of the symbolic names, // Use numerical constants instead of the symbolic names,

View File

@ -99,6 +99,9 @@ static inline uint64_t mp_hal_time_ns(void) {
#define MP_HAL_PIN_FMT "%u" #define MP_HAL_PIN_FMT "%u"
#define mp_hal_pin_obj_t uint #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[]; extern uint32_t machine_pin_open_drain_mask[];
mp_hal_pin_obj_t mp_hal_get_pin_obj(mp_obj_t pin_in); mp_hal_pin_obj_t mp_hal_get_pin_obj(mp_obj_t pin_in);