1- # The MIT License (MIT)
1+ # SPDX-FileCopyrightText: 2017 Scott Shawcroft for Adafruit Industries
22#
3- # Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
4- #
5- # Permission is hereby granted, free of charge, to any person obtaining a copy
6- # of this software and associated documentation files (the "Software"), to deal
7- # in the Software without restriction, including without limitation the rights
8- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9- # copies of the Software, and to permit persons to whom the Software is
10- # furnished to do so, subject to the following conditions:
11- #
12- # The above copyright notice and this permission notice shall be included in
13- # all copies or substantial portions of the Software.
14- #
15- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21- # THE SOFTWARE.
3+ # SPDX-License-Identifier: MIT
4+
225"""
236`adafruit_irremote`
247====================================================
@@ -92,8 +75,8 @@ class GenericDecode:
9275 def bin_data (self , pulses ):
9376 """Compute bins of pulse lengths where pulses are +-25% of the average.
9477
95- :param list pulses: Input pulse lengths
96- """
78+ :param list pulses: Input pulse lengths
79+ """
9780 bins = [[pulses [0 ], 0 ]]
9881
9982 for _ , pulse in enumerate (pulses ):
@@ -192,12 +175,12 @@ def _read_pulses_non_blocking(
192175 self , input_pulses , max_pulse = 10000 , pulse_window = 0.10
193176 ):
194177 """Read out a burst of pulses without blocking until pulses stop for a specified
195- period (pulse_window), pruning pulses after a pulse longer than ``max_pulse``.
178+ period (pulse_window), pruning pulses after a pulse longer than ``max_pulse``.
196179
197- :param ~pulseio.PulseIn input_pulses: Object to read pulses from
198- :param int max_pulse: Pulse duration to end a burst
199- :param float pulse_window: pulses are collected for this period of time
200- """
180+ :param ~pulseio.PulseIn input_pulses: Object to read pulses from
181+ :param int max_pulse: Pulse duration to end a burst
182+ :param float pulse_window: pulses are collected for this period of time
183+ """
201184 received = None
202185 recent_count = 0
203186 pruning = False
@@ -229,16 +212,16 @@ def read_pulses(
229212 blocking_delay = 0.10
230213 ):
231214 """Read out a burst of pulses until pulses stop for a specified
232- period (pulse_window), pruning pulses after a pulse longer than ``max_pulse``.
233-
234- :param ~pulseio.PulseIn input_pulses: Object to read pulses from
235- :param int max_pulse: Pulse duration to end a burst
236- :param bool blocking: If True, will block until pulses found.
237- If False, will return None if no pulses.
238- Defaults to True for backwards compatibility
239- :param float pulse_window: pulses are collected for this period of time
240- :param float blocking_delay: delay between pulse checks when blocking
241- """
215+ period (pulse_window), pruning pulses after a pulse longer than ``max_pulse``.
216+
217+ :param ~pulseio.PulseIn input_pulses: Object to read pulses from
218+ :param int max_pulse: Pulse duration to end a burst
219+ :param bool blocking: If True, will block until pulses found.
220+ If False, will return None if no pulses.
221+ Defaults to True for backwards compatibility
222+ :param float pulse_window: pulses are collected for this period of time
223+ :param float blocking_delay: delay between pulse checks when blocking
224+ """
242225 while True :
243226 pulses = self ._read_pulses_non_blocking (
244227 input_pulses , max_pulse , pulse_window
@@ -261,9 +244,9 @@ def __init__(self, header, one, zero, trail):
261244 def transmit (self , pulseout , data ):
262245 """Transmit the ``data`` using the ``pulseout``.
263246
264- :param pulseio.PulseOut pulseout: PulseOut to transmit on
265- :param bytearray data: Data to transmit
266- """
247+ :param pulseio.PulseOut pulseout: PulseOut to transmit on
248+ :param bytearray data: Data to transmit
249+ """
267250 durations = array .array ("H" , [0 ] * (2 + len (data ) * 8 * 2 + 1 ))
268251 durations [0 ] = self .header [0 ]
269252 durations [1 ] = self .header [1 ]
0 commit comments