]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/rotaryio.py
Add PIO implementation of rotaryio for the Pi 5
[Adafruit_Blinka-hackapet.git] / src / rotaryio.py
1 # SPDX-FileCopyrightText: 2025 Melissa LeBlanc-Williams for Adafruit Industries
2 #
3 # SPDX-License-Identifier: MIT
4 """
5 `rotaryio` - Support for reading rotation sensors
6 ===========================================================
7 See `CircuitPython:rotaryio` in CircuitPython for more details.
8
9 * Author(s): Melissa LeBlanc-Williams
10 """
11
12 from adafruit_blinka.agnostic import detector
13
14 # Import any board specific modules here
15 if detector.board.any_raspberry_pi_5_board:
16     from adafruit_blinka.microcontroller.bcm283x.rotaryio import IncrementalEncoder
17 elif detector.board.any_embedded_linux:
18     #fall back to the generic linux implementation
19     from adafruit_blinka.microcontroller.generic_linux.rotaryio import IncrementalEncoder
20 else:
21     # For non-Linux Boards, threading likely will work in the same way
22     raise NotImplementedError("Board not supported")