Thanks to visit codestin.com
Credit goes to github.com

Skip to content

https://github.com/adafruit/Adafruit_CircuitPython_IRRemote/issues/6 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions adafruit_irremote.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,20 @@ def decode_bits(self, pulses, debug=False):
output[i // 8] |= 1
return output

def read_pulses(self, input_pulses, max_pulse=10000):
def read_pulses(self, input_pulses, max_pulse=10000, blocking=True):
"""Read out a burst of pulses until a pulse is longer than ``max_pulse``.

:param ~pulseio.PulseIn input_pulses: Object to read pulses from
:param int max_pulse: Pulse duration to end a burst
:param bool blocking: If True, will block until pulses found.
If False, will return None if no pulses.
Defaults to True for backwards compatibility
"""
received = []
while True:
while len(input_pulses) < 8: # not too big (slower) or too small (underruns)!
pass
if not blocking:
return None
while input_pulses:
pulse = input_pulses.popleft()
if pulse > max_pulse:
Expand Down