Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BinhoPulsar-0.2.0.tar.gz (71.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

BinhoPulsar-0.2.0-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

Details for the file BinhoPulsar-0.2.0.tar.gz.

File metadata

  • Download URL: BinhoPulsar-0.2.0.tar.gz
  • Upload date:
  • Size: 71.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for BinhoPulsar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15c0f66f5449160f171c9ee355d16c2e570f0b9ebe631b9e6b8055714d438fca
MD5 9b9f65887f345f1c3a58056efffb0976
BLAKE2b-256 37c349328b0db9eb444b7a77087ce927f682d5e3cbe38f9c9b550cb36a3bdd0d

See more details on using hashes here.

File details

Details for the file BinhoPulsar-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: BinhoPulsar-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 75.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for BinhoPulsar-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63d972d47d747ce377abbccca9523eb6463dddafcd4375023658b9e2cf9e7a9e
MD5 f6559a75f3b5f6423cbcd863ec9b3547
BLAKE2b-256 433168b59e8efb1f46b37e73dc07c1a8375f4116c874d6aa7f7ebb8250aa29b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page