esp8266/modmachine: Use common machine_time_pulse_us implementation.
Testing shows that for frequencies which the esp8266 can handle -- up to about 1kHz -- `machine.time_pulse_us()` now gives more accurate results. Prior to this commit it would measure on average about 1us lower, but now the average is much closer to the true value. For example a pulse that is 1000us long, it would measure between 998 and 1000us. Now it measures between 999us and 1001us. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
#if MICROPY_PY_MACHINE_PULSE
|
||||
|
||||
MP_WEAK mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us) {
|
||||
mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us) {
|
||||
mp_uint_t nchanges = 2;
|
||||
mp_uint_t start = mp_hal_ticks_us();
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user