diff options
author | Damien George <damien.p.george@gmail.com> | 2016-05-31 14:25:19 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-05-31 14:25:19 +0100 |
commit | 33168081f48634d45902f0a31a27d4527c88a522 (patch) | |
tree | fe0977d188cddd9f369636e5bd3e90e6d5c57013 | |
parent | cff2b7a6e3acf5fe81d9ada1c344a047332df32e (diff) | |
download | micropython-33168081f48634d45902f0a31a27d4527c88a522.tar.gz micropython-33168081f48634d45902f0a31a27d4527c88a522.zip |
extmod/machine: Add MICROPY_PY_MACHINE_PULSE config for time_pulse_us.
Since not all ports that enable the machine module have the pin HAL
functions.
-rw-r--r-- | esp8266/mpconfigport.h | 1 | ||||
-rw-r--r-- | extmod/machine_pulse.c | 2 | ||||
-rw-r--r-- | py/mpconfig.h | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h index ad11cb4d7e..df78444883 100644 --- a/esp8266/mpconfigport.h +++ b/esp8266/mpconfigport.h @@ -59,6 +59,7 @@ #define MICROPY_PY_UZLIB (1) #define MICROPY_PY_LWIP (1) #define MICROPY_PY_MACHINE (1) +#define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_WEBSOCKET (1) #define MICROPY_PY_WEBREPL (1) diff --git a/extmod/machine_pulse.c b/extmod/machine_pulse.c index 97590f8670..8c8bff510c 100644 --- a/extmod/machine_pulse.c +++ b/extmod/machine_pulse.c @@ -28,7 +28,7 @@ #include "py/mperrno.h" #include "extmod/machine_pulse.h" -#if MICROPY_PY_MACHINE +#if MICROPY_PY_MACHINE_PULSE mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us) { mp_uint_t start = mp_hal_ticks_us(); diff --git a/py/mpconfig.h b/py/mpconfig.h index 92f17724f4..084fc246f5 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -867,6 +867,11 @@ typedef double mp_float_t; #define MICROPY_PY_MACHINE (0) #endif +// Whether to include: time_pulse_us +#ifndef MICROPY_PY_MACHINE_PULSE +#define MICROPY_PY_MACHINE_PULSE (0) +#endif + #ifndef MICROPY_PY_MACHINE_I2C #define MICROPY_PY_MACHINE_I2C (0) #endif |