Basic SDK for Binho Pulsar
Project description
PulsarSDK: Python SDK for Binho Pulsar USB Host Adapter
PulsarSDK is a Python package for interacting with the Binho Pulsar USB host adapter. The Pulsar adapter provides simplified control of embedded systems, supporting I2C, SPI, UART, and GPIO communication protocols.
Prerequisites
Ensure your system meets the following requirements before installing the PulsarSDK:
- Python 3.8 or higher
- Windows, macOS, or Linux
- Binho Pulsar USB host adapter with up-to-date firmware
Installation
Install the latest version of the PulsarSDK from PyPi using pip:
pip install BinhoPulsar
After installation, the SDK is ready for use in your Python projects.
API Overview
The Pulsar host adapter shares its API with the Binho Supernova adapter. If you're familiar with the SupernovaSDK, transitioning to the PulsarSDK will be straightforward, as the same commands and interfaces are used for the supported protocols.
Basic Usage Example
This example demonstrates how to use the Pulsar SDK with a Pulsar device. The Pulsar operates asynchronously; commands are sent to the host adapter, and responses are handled via a callback function.
from BinhoPulsar import getConnectedPulsarDevicesList
from BinhoPulsar.Pulsar import Pulsar
from BinhoPulsar.definitions import *
# Get connected Pulsar devices
devices = getConnectedPulsarDevicesList()
print(devices)
# Open a connection to the first Pulsar device
pulsar = Pulsar()
print(pulsar.open(path=devices[0]["path"]))
# Define a callback function to handle responses from the device
def callback(pulsar_message: dict, system_message: dict):
print(f"Transaction ID: {pulsar_message['id']}")
print(f"Command Code: {pulsar_message['command']}")
print(f"Command Name: {pulsar_message['name']}")
print(f"Message Length: {pulsar_message['length']}")
print(f"Message Content: {pulsar_message['message']}")
# Register the callback function
print(pulsar.onEvent(callback))
# Define a transaction ID for tracking requests
transaction_id = 0
# Send a request to retrieve the manufacturer string from a connected USB device
request_result = pulsar.getUsbString(transaction_id, GetUsbStringSubCommand.MANUFACTURER)
# Example result: {'type': 'request_validation_result', 'id': 0, 'command': 96, 'code value': 0, 'code name': 'SUCCESS', 'message': 'GET USB STRING request successful'}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file BinhoPulsar-0.3.0.tar.gz
.
File metadata
- Download URL: BinhoPulsar-0.3.0.tar.gz
- Upload date:
- Size: 71.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ed308b47b3faf3867a30cee502d113b860ce410885bb6a51710437bd5b4c64c |
|
MD5 | c96b98fa32614f07f64729d5d63ad412 |
|
BLAKE2b-256 | 894f695c32bd70be0fbc86278d21ae5d00d26546b63d48fd386d25a7ed823a50 |
File details
Details for the file BinhoPulsar-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: BinhoPulsar-0.3.0-py3-none-any.whl
- Upload date:
- Size: 75.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b586f49b349ff95c04d9ca898b3bf7190a3fbfce442472e8eea249af6c90c24 |
|
MD5 | a8a86dc84a3b3ac9507b46d8fcf4a70b |
|
BLAKE2b-256 | e961a33db3f790868af56d5f594989cbaa3651f37660da426e6602cfc3c82352 |