diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c index 229e278f13..8bd04f3ec9 100644 --- a/stmhal/modmachine.c +++ b/stmhal/modmachine.c @@ -31,6 +31,7 @@ #include "py/runtime.h" #include "py/mphal.h" #include "extmod/machine_mem.h" +#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "lib/fatfs/ff.h" #include "lib/fatfs/diskio.h" @@ -517,6 +518,8 @@ STATIC const mp_map_elem_t machine_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&pyb_disable_irq_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&pyb_enable_irq_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_time_pulse_us), (mp_obj_t)&machine_time_pulse_us_obj }, + { MP_ROM_QSTR(MP_QSTR_mem8), (mp_obj_t)&machine_mem8_obj }, { MP_ROM_QSTR(MP_QSTR_mem16), (mp_obj_t)&machine_mem16_obj }, { MP_ROM_QSTR(MP_QSTR_mem32), (mp_obj_t)&machine_mem32_obj }, diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index ef02cbf927..52fbcad681 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -95,6 +95,7 @@ #define MICROPY_PY_UHEAPQ (1) #define MICROPY_PY_UHASHLIB (1) #define MICROPY_PY_MACHINE (1) +#define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SPI_MIN_DELAY (0) diff --git a/stmhal/mphalport.h b/stmhal/mphalport.h index d342f96e17..29a9fd6c39 100644 --- a/stmhal/mphalport.h +++ b/stmhal/mphalport.h @@ -34,12 +34,12 @@ extern const unsigned char mp_hal_status_to_errno_table[4]; NORETURN void mp_hal_raise(HAL_StatusTypeDef status); void mp_hal_set_interrupt_char(int c); // -1 to disable -#define mp_hal_delay_ms HAL_Delay -#define mp_hal_ticks_ms HAL_GetTick - -// needed for machine.I2C +// timing functions #include "stmhal/systick.h" +#define mp_hal_delay_ms HAL_Delay #define mp_hal_delay_us_fast(us) sys_tick_udelay(us) +#define mp_hal_ticks_ms HAL_GetTick +#define mp_hal_ticks_us() sys_tick_get_microseconds() // C-level pin HAL #include "stmhal/pin.h"