Metadata-Version: 2.4
Name: dln2-gpio-wrapper
Version: 0.1.0
Summary: A Python library for DLN2 GPIO adapters. Originally developed for Pico USB IO Board.
Author-email: IPM Group <contact@ipmgroup.dev>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/syabyr/dln2_gpio_wrapper
Project-URL: Documentation, https://github.com/syabyr/dln2_gpio_wrapper#readme
Project-URL: Repository, https://github.com/syabyr/dln2_gpio_wrapper.git
Project-URL: Bug Tracker, https://github.com/syabyr/dln2_gpio_wrapper/issues
Keywords: dln2,gpio,usb,hardware,driver
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyusb>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

# DLN2 GPIO Wrapper

A Python library for interfacing with DLN2 USB-to-GPIO adapters.
It targets the Pico USB I/O Board firmware and packages the host-side GPIO access layer as a
standalone Python project.

## Features

- Low-level DLN2 USB GPIO client built on `pyusb`
- High-level `GPIO` helper for pin enable, direction, read, write, and event config
- GPIO event polling with async packet handling
- Command-line helpers for GPIO info, watch, and toggle
- Pure Python, no compiled extension

## Installation

From source:

```bash
git clone https://github.com/syabyr/dln2_gpio_wrapper.git
cd dln2_gpio_wrapper
pip install .
```

For development:

```bash
pip install -e ".[dev]"
```

## Quick Start

```python
from dln2_gpio_wrapper import GPIO

with GPIO() as gpio:
    pin = 25
    gpio.enable(pin, output=True)
    gpio.write(pin, 1)
    print(gpio.read(pin))
    gpio.toggle(pin)
```

## Firmware Notes

- `PIN_GET_VAL` returns the current live pin level.
- Edge events are latched only in a small firmware queue and delivered asynchronously.
- Debounce is not implemented by this firmware.
- Event queue depth in firmware is limited, so bursts can overflow.

## Command-Line Tools

```bash
dln2-gpio-info --help
dln2-gpio-watch --help
dln2-gpio-toggle --help
```

## Development

```bash
make test
make build
```
