Metadata-Version: 2.4
Name: tm1637-rpi5-gpiod
Version: 2.0.0
Summary: TM1637 4-digit display driver for Raspberry Pi 5 using gpiod
Home-page: https://github.com/villeparamio/tm1637-rpi5-gpiod
Author: villeparamio
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Intended Audience :: Developers
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gpiod
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# TM1637 Display Library for Raspberry Pi 5 (gpiod-based)

This is a **modified version** of the [`raspberrypi-tm1637`](https://github.com/depklyon/raspberrypi-tm1637) library, adapted to work on **Raspberry Pi 5** using the **`gpiod`** backend.

## 🚀 Why this version?

The Raspberry Pi 5 uses a new GPIO controller that is **not compatible with `RPi.GPIO`**, which the original TM1637 library depends on.

This version replaces `RPi.GPIO` with **`gpiod` (libgpiod)**, the officially supported GPIO access method in Raspberry Pi OS (Bookworm and newer).

Now, version 2.0.0 of `tm1637-rpi5-gpiod`, auto-detects whether libgpiod v1 or v2 is present and uses the appropriate backend:
- libgpiod v1 (legacy API): per-line requests
- libgpiod v2 (new API): `LineSettings` + `request_lines()` + `LineRequest.set_value()`

## 📥 Installation

1. **Install required dependencies**:

   ```bash
   sudo apt update
   sudo apt install python3-libgpiod gpiod
   ```

2. **Install the library via pip**:

   ```bash
   pip install tm1637-rpi5-gpiod
   ```

   Or clone manually:

   ```bash
   git clone https://github.com/villeparamio/tm1637-rpi5-gpiod.git
   cd tm1637-rpi5-gpiod
   pip install .
   ```

## 🧪 Example usage

```python
import tm1637
from time import sleep

CLK = 24  # GPIO24 (physical pin 18)
DIO = 23  # GPIO23 (physical pin 16)

display = tm1637.TM1637(clk=CLK, dio=DIO)
display.brightness(7)

while True:
    display.show("TEST")
    sleep(2)
    display.numbers(12, 34)
    sleep(2)
```

> Make sure your user is in the `gpio` group to access `/dev/gpiochip*` without root.  
> If needed: `sudo usermod -aG gpio $USER && sudo reboot`

## 🛠 Features

- ✅ Raspberry Pi 5 compatible
- ✅ Uses `gpiod`, not `RPi.GPIO`
- ✅ Works with standard 4-digit TM1637 LED displays
- ✅ Supports numbers, text, brightness and temperature

## 🔄 Original sources

- [mcauser/micropython-tm1637](https://github.com/mcauser/micropython-tm1637)
- [depklyon/raspberrypi-tm1637](https://github.com/depklyon/raspberrypi-tm1637)

## 📜 License

This project is licensed under the **MIT License**.

## 💖 Donations

If you find this project useful and want to support its development and maintenance, please consider making a donation.  
Your contribution helps us continue improving and maintaining this free software.

### 💸 PayPal
You can easily donate via PayPal by clicking the button below:

[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?business=95M7L3UZENS6Q&no_recurring=0&currency_code=EUR)

Thank you for your support. 🙏
