Metadata-Version: 2.4
Name: fnirsi-dps150
Version: 1.0.0
Summary: Python client for the FNIRSI DPS-150 power supply over USB serial
Author-email: Marco Tabini <marcot@tabini.ca>
License-Expression: MIT
Project-URL: Homepage, https://github.com/mtabini/fnirsi-dps150
Project-URL: Repository, https://github.com/mtabini/fnirsi-dps150
Project-URL: Issues, https://github.com/mtabini/fnirsi-dps150/issues
Keywords: fnirsi,dps-150,power-supply,serial,usb
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Topic :: Terminals :: Serial
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyserial<4,>=3.5
Provides-Extra: dev
Requires-Dist: pytest<9,>=8.0; extra == "dev"
Dynamic: license-file

# FNIRSI DPS-150

Small synchronous Python library for controlling an FNIRSI DPS-150 over USB serial.

## Credit

This project’s packet layout, command IDs, and initial protocol assumptions were derived from the reverse-engineering work published by `cho45` in [cho45/fnirsi-dps-150](https://github.com/cho45/fnirsi-dps-150). This library reimplements that protocol in Python and validates behavior against a real connected DPS-150 device.

## Setup

```bash
python -m pip install fnirsi-dps150
```

## Development Setup

```bash
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install ".[dev]"
```

## Usage

```python
from fnirsi_dps150 import DPS150

with DPS150("/dev/cu.usbmodem146061B040251") as dps:
    dps.set_voltage(5.0)
    dps.set_current(1.0)
    print(dps.read_voltage())
    print(dps.read_current())
    print(dps.read_state())
```

## CLI

```bash
source .venv/bin/activate
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 read-state
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 read-voltage
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 read-current
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 set-voltage 5.0
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 set-current 0.5
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 output-on
fnirsi-dps150 --port /dev/cu.usbmodem146061B040251 output-off
```

## Hardware Validation

Run the real-device script:

```bash
source .venv/bin/activate
python scripts/validate_device.py
```

## License

MIT. See [LICENSE](./LICENSE).

## Publishing

Build artifacts for manual upload:

```bash
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*
```
