adafruit-circuitpython-irremote 4.1.18__tar.gz → 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/PKG-INFO +1 -1
  2. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/adafruit_circuitpython_irremote.egg-info/PKG-INFO +1 -1
  3. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/adafruit_irremote.py +28 -22
  4. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/examples/irremote_transmit.py +1 -1
  5. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/pyproject.toml +1 -1
  6. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
  7. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.github/workflows/build.yml +0 -0
  8. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.github/workflows/failure-help-text.yml +0 -0
  9. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.github/workflows/release_gh.yml +0 -0
  10. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.github/workflows/release_pypi.yml +0 -0
  11. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.gitignore +0 -0
  12. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.pre-commit-config.yaml +0 -0
  13. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.pylintrc +0 -0
  14. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/.readthedocs.yaml +0 -0
  15. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/CODE_OF_CONDUCT.md +0 -0
  16. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/LICENSE +0 -0
  17. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/LICENSES/CC-BY-4.0.txt +0 -0
  18. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/LICENSES/MIT.txt +0 -0
  19. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/LICENSES/Unlicense.txt +0 -0
  20. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/README.rst +0 -0
  21. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/README.rst.license +0 -0
  22. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/adafruit_circuitpython_irremote.egg-info/SOURCES.txt +0 -0
  23. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/adafruit_circuitpython_irremote.egg-info/dependency_links.txt +0 -0
  24. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/adafruit_circuitpython_irremote.egg-info/requires.txt +0 -0
  25. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/adafruit_circuitpython_irremote.egg-info/top_level.txt +0 -0
  26. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/_static/favicon.ico +0 -0
  27. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/_static/favicon.ico.license +0 -0
  28. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/api.rst +0 -0
  29. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/api.rst.license +0 -0
  30. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/conf.py +0 -0
  31. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/examples.rst +0 -0
  32. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/examples.rst.license +0 -0
  33. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/index.rst +0 -0
  34. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/index.rst.license +0 -0
  35. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/docs/requirements.txt +0 -0
  36. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/examples/irremote_nonblocking.py +0 -0
  37. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/examples/irremote_simpletest.py +0 -0
  38. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/optional_requirements.txt +0 -0
  39. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/requirements.txt +0 -0
  40. {adafruit-circuitpython-irremote-4.1.18 → adafruit_circuitpython_irremote-5.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adafruit-circuitpython-irremote
3
- Version: 4.1.18
3
+ Version: 5.0.0
4
4
  Summary: CircuitPython library for infrared transmit and receive.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adafruit-circuitpython-irremote
3
- Version: 4.1.18
3
+ Version: 5.0.0
4
4
  Summary: CircuitPython library for infrared transmit and receive.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT
@@ -64,7 +64,7 @@ Implementation Notes
64
64
 
65
65
  """
66
66
 
67
- __version__ = "4.1.18"
67
+ __version__ = "5.0.0"
68
68
  __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git"
69
69
 
70
70
 
@@ -171,9 +171,9 @@ def decode_bits(pulses: List) -> NamedTuple:
171
171
  # convert marks/spaces to 0 and 1
172
172
  for i, pulse_length in enumerate(pulses):
173
173
  if (space * 0.75) <= pulse_length <= (space * 1.25):
174
- pulses[i] = False
175
- elif (mark * 0.75) <= pulse_length <= (mark * 1.25):
176
174
  pulses[i] = True
175
+ elif (mark * 0.75) <= pulse_length <= (mark * 1.25):
176
+ pulses[i] = False
177
177
  else:
178
178
  msg = UnparseableIRMessage(input_pulses, reason="Pulses outside mark/space")
179
179
  raise FailedToDecode(msg)
@@ -237,23 +237,20 @@ class NonblockingGenericDecode:
237
237
  # Consume from PulseIn.
238
238
  while self.pulses:
239
239
  pulse = self.pulses.popleft()
240
- self._unparsed_pulses.append(pulse)
241
- if pulse > self.max_pulse:
240
+ if pulse <= self.max_pulse:
241
+ self._unparsed_pulses.append(pulse)
242
+ else:
242
243
  # End of message! Decode it and yield a BaseIRMessage.
244
+ result = None
243
245
  try:
244
- yield decode_bits(self._unparsed_pulses)
246
+ result = decode_bits(self._unparsed_pulses)
245
247
  except FailedToDecode as err:
246
248
  # If you want to debug failed decodes, this would be a good
247
249
  # place to print/log or (re-)raise.
248
- unparseable_message = err.args[0]
249
- yield unparseable_message
250
+ result = err.args[0]
251
+
250
252
  self._unparsed_pulses.clear()
251
- # TODO Do we need to consume and throw away more pulses here?
252
- # I'm unclear about the role that "pruning" plays in the
253
- # original implementation in GenericDecode._read_pulses_non_blocking.
254
- # When we reach here, we have consumed everything from PulseIn.
255
- # If there are some pulses in self._unparsed_pulses, they represent
256
- # partial messages. We'll finish them next time read() is called.
253
+ yield result
257
254
 
258
255
 
259
256
  class GenericDecode:
@@ -345,15 +342,21 @@ class GenericDecode:
345
342
  class GenericTransmit:
346
343
  """Generic infrared transmit class that handles encoding.
347
344
 
348
- :param int header: The length of header in microseconds
349
- :param int one: The length of a one in microseconds
350
- :param int zero: The length of a zero in microseconds
345
+ :param List[int] header: The length of header in microseconds, the length should be even
346
+ :param List[int] one: The length of a one in microseconds
347
+ :param List[int] zero: The length of a zero in microseconds
351
348
  :param int trail: The length of the trail in microseconds, set to None to disable
352
349
  :param bool debug: Enable debug output, default False
353
350
  """
354
351
 
355
352
  def __init__(
356
- self, header: int, one: int, zero: int, trail: int, *, debug: bool = False
353
+ self,
354
+ header: List[int],
355
+ one: List[int],
356
+ zero: List[int],
357
+ trail: int,
358
+ *,
359
+ debug: bool = False,
357
360
  ) -> None:
358
361
  self.header = header
359
362
  self.one = one
@@ -384,14 +387,17 @@ class GenericTransmit:
384
387
  bits_to_send = nbits
385
388
 
386
389
  durations = array.array(
387
- "H", [0] * (2 + bits_to_send * 2 + (0 if self.trail is None else 1))
390
+ "H",
391
+ [0]
392
+ * (len(self.header) + bits_to_send * 2 + (0 if self.trail is None else 1)),
388
393
  )
389
394
 
390
- durations[0] = self.header[0]
391
- durations[1] = self.header[1]
395
+ for i, _ in enumerate(self.header):
396
+ durations[i] = self.header[i]
397
+
392
398
  if self.trail is not None:
393
399
  durations[-1] = self.trail
394
- out = 2
400
+ out = len(self.header)
395
401
  bit_count = 0
396
402
  for byte_index, _ in enumerate(data):
397
403
  for i in range(7, -1, -1):
@@ -18,7 +18,7 @@ button.pull = digitalio.Pull.DOWN
18
18
  pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2**15)
19
19
  # Create an encoder that will take numbers and turn them into NEC IR pulses
20
20
  encoder = adafruit_irremote.GenericTransmit(
21
- header=[9500, 4500], one=[550, 550], zero=[550, 1700], trail=0
21
+ header=[9000, 4500], one=[560, 1700], zero=[560, 1700], trail=560
22
22
  )
23
23
 
24
24
  while True:
@@ -12,7 +12,7 @@ requires = [
12
12
  [project]
13
13
  name = "adafruit-circuitpython-irremote"
14
14
  description = "CircuitPython library for infrared transmit and receive."
15
- version = "4.1.18"
15
+ version = "5.0.0"
16
16
  readme = "README.rst"
17
17
  authors = [
18
18
  {name = "Adafruit Industries", email = "circuitpython@adafruit.com"}