This website requires JavaScript.
Explore
Help
Sign In
mirrors
/
micropython
mirror of
https://github.com/micropython/micropython.git
Watch
1
Star
0
Fork
You've already forked micropython
0
Code
Issues
Packages
Projects
Releases
Wiki
Activity
f684e9e1ab
micropython
/
tests
/
extmod
/
machine_pulse.py.exp
10 lines
79 B
Plaintext
Raw
Normal View
History
Unescape
Escape
tests/extmod: Add test for machine.time_pulse_us().
2016-09-16 14:31:02 +01:00
value: 1
value: 0
<class 'int'>
value: 1
value: 0
value: 1
<class 'int'>
extmod/machine_pulse: Make time_pulse_us() not throw exceptions. machine.time_pulse_us() is intended to provide very fine timing, including while working with signal bursts, where each transition is tracked in row. Throwing and handling an exception may take too much time and "signal loss". So instead, in case of a timeout, just return negative value. Cases of timeout while waiting for initial signal stabilization, and during actual timing, are recognized. The documentation is updated accordingly, and rewritten somewhat to clarify the function behavior.
2017-02-05 11:20:17 +00:00
-2
-1