Metadata-Version: 2.4
Name: pycosmicsdk
Version: 1.6.0
Summary: Python SDK built on top of the C/C++ CosmicSDK.
Author: Binho Inc
License-Expression: LicenseRef-Binho-Proprietary AND LGPL-2.1-or-later AND BSD-3-Clause
License-File: LICENSE
License-File: LICENSE.libusb
License-File: NOTICE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
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: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Typing :: Typed
Project-URL: Homepage, https://binho.io
Project-URL: Support, https://support.binho.io
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pycosmicsdk

Python SDK for the **Binho Supernova** and **Binho Pulsar** USB host adapters: I2C, I3C, SPI,
UART and GPIO from Python, with a blocking API and an `asyncio` twin for every protocol.

```bash
pip install pycosmicsdk
```

Binary wheels ship for CPython 3.10–3.14 on Linux `x86_64`, macOS `arm64` and Windows
`AMD64`. The native CosmicSDK library is linked into the wheel, so there is nothing else to
install and no path to configure.

## First steps

```python
import pycosmicsdk as p

print(p.list_devices())                      # every attached Supernova / Pulsar

with p.Device.open() as dev:                 # the first adapter found
    print(dev.info.fw_version)
    i2c = dev.i2c()
    i2c.set_voltage(voltage_mv=3300)
    i2c.bring_up(frequency_hz=400_000, pull_up=p.I2cPullUp.KOHM_1_0)
    print(sorted(i2c.scan().addresses_7bit))  # addresses that ACKed
```

| Protocol | Supernova | Pulsar |
| --- | --- | --- |
| I2C controller and target | bus A | buses A and B |
| I3C controller (all CCCs) and target | yes | — |
| SPI controller and target | yes (target not on rev B) | yes |
| UART | yes | yes |
| GPIO, with interrupts | yes | yes |

Large transfers can use the adapter's USB bulk endpoint: up to 32 KB on a Supernova and 16 KB
on a Pulsar per call.

## Linux

The adapters are USB HID devices and need no driver on any platform. On Linux, add a udev rule
so they are reachable without `root`. Without it, `list_devices()` still finds the adapter but
its serial number comes back empty.

```
# /etc/udev/rules.d/65-binho.rules
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="82fc", MODE="0660", GROUP="plugdev"
SUBSYSTEM=="usb",    ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="82fc", MODE="0660", GROUP="plugdev"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="82fd", MODE="0660", GROUP="plugdev"
SUBSYSTEM=="usb",    ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="82fd", MODE="0660", GROUP="plugdev"
```

Then run `sudo udevadm control --reload && sudo udevadm trigger` and add your user to `plugdev`.

## Versions and firmware

`MAJOR.MINOR` follows the CosmicSDK release embedded in the wheel: pycosmicsdk 1.6 carries
CosmicSDK 1.6. Features that need newer adapter firmware say so, and older firmware answers
them with `FW_UNSUPPORTED_COMMAND` rather than failing silently. Update the adapter's firmware
from [Mission Control](https://binho.io).

## Support

- Product pages and Mission Control: <https://binho.io>
- Support: <https://support.binho.io> · support@binho.io
