diff options
author | Damien George <damien.p.george@gmail.com> | 2016-10-06 12:12:20 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-10-06 12:12:20 +1100 |
commit | 0bb3c7d3b7b8e670fd92c114b07fed1235c0d1ab (patch) | |
tree | 3854c23df8779769222654640461fd16a3de9431 | |
parent | c08f50bcf7740885863224509d56229d55ac1193 (diff) | |
download | micropython-0bb3c7d3b7b8e670fd92c114b07fed1235c0d1ab.tar.gz micropython-0bb3c7d3b7b8e670fd92c114b07fed1235c0d1ab.zip |
stmhal: Enable machine.time_pulse_us() function.
-rw-r--r-- | stmhal/modmachine.c | 3 | ||||
-rw-r--r-- | stmhal/mpconfigport.h | 1 | ||||
-rw-r--r-- | stmhal/mphalport.h | 8 |
3 files changed, 8 insertions, 4 deletions
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" |