Commit 0bb3c7d3 authored by Damien George's avatar Damien George
Browse files

stmhal: Enable machine.time_pulse_us() function.

parent c08f50bc
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "py/mphal.h" #include "py/mphal.h"
#include "extmod/machine_mem.h" #include "extmod/machine_mem.h"
#include "extmod/machine_pulse.h"
#include "extmod/machine_i2c.h" #include "extmod/machine_i2c.h"
#include "lib/fatfs/ff.h" #include "lib/fatfs/ff.h"
#include "lib/fatfs/diskio.h" #include "lib/fatfs/diskio.h"
...@@ -517,6 +518,8 @@ STATIC const mp_map_elem_t machine_module_globals_table[] = { ...@@ -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_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_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_mem8), (mp_obj_t)&machine_mem8_obj },
{ MP_ROM_QSTR(MP_QSTR_mem16), (mp_obj_t)&machine_mem16_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 }, { MP_ROM_QSTR(MP_QSTR_mem32), (mp_obj_t)&machine_mem32_obj },
......
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
#define MICROPY_PY_UHEAPQ (1) #define MICROPY_PY_UHEAPQ (1)
#define MICROPY_PY_UHASHLIB (1) #define MICROPY_PY_UHASHLIB (1)
#define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE (1)
#define MICROPY_PY_MACHINE_PULSE (1)
#define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SPI (1)
#define MICROPY_PY_MACHINE_SPI_MIN_DELAY (0) #define MICROPY_PY_MACHINE_SPI_MIN_DELAY (0)
......
...@@ -34,12 +34,12 @@ extern const unsigned char mp_hal_status_to_errno_table[4]; ...@@ -34,12 +34,12 @@ extern const unsigned char mp_hal_status_to_errno_table[4];
NORETURN void mp_hal_raise(HAL_StatusTypeDef status); NORETURN void mp_hal_raise(HAL_StatusTypeDef status);
void mp_hal_set_interrupt_char(int c); // -1 to disable void mp_hal_set_interrupt_char(int c); // -1 to disable
#define mp_hal_delay_ms HAL_Delay // timing functions
#define mp_hal_ticks_ms HAL_GetTick
// needed for machine.I2C
#include "stmhal/systick.h" #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_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 // C-level pin HAL
#include "stmhal/pin.h" #include "stmhal/pin.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment