+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
"""
`keypad` - Support for scanning keys and key matrices
===========================================================
* Author(s): Melissa LeBlanc-Williams
"""
-
-__version__ = "0.0.0-auto.0"
-__repo__ = "https://github.com/adafruit/Adafruit_Blinka.git"
-
-
import time
import threading
from collections import deque
)
-class _EventQueue:
+class EventQueue:
"""
A queue of `Event` objects, filled by a `keypad` scanner such as `Keys` or `KeyMatrix`.
- You cannot create an instance of `_EventQueue` directly. Each scanner creates an
+ You cannot create an instance of `EventQueue` directly. Each scanner creates an
instance when it is created.
"""
def __init__(self, interval, max_events, scanning_function):
self._interval = interval
self._last_scan = time.monotonic()
- self._events = _EventQueue(max_events)
+ self._events = EventQueue(max_events)
self._scanning_function = scanning_function
self._scan_thread = threading.Thread(target=self._scanning_loop, daemon=True)
self._scan_thread.start()
key_count,
value_when_pressed,
interval=0.02,
- max_events=64
+ max_events=64,
):
"""
Create a `Keys` object that will scan keys attached to a parallel-in serial-out