BITalino Bluetooth/serial driver with Python bindings (PyO3, abi3).
Project description
bitalino-rs
Rust driver and Python bindings for BITalino biosignal acquisition devices. This project automates Bluetooth pairing/connection (RFCOMM), exposes a safe Rust API, and ships Python wheels for easy use in data pipelines.
Quick Links
- Docs: tleygue.github.io/bitalino_rs (published via GitHub Pages; sources in docs/)
- Python package:
bitalino_rs(built with maturin, published from tags) - Crate:
bitalino-rs(Rust library)
Features
- Connect to BITalino over Bluetooth without root privileges (automatic pair + bind).
- High-level Rust API plus generated Python bindings via PyO3/maturin.
- Timing-aware reads with sequence numbers, CRC tracking, and batch timestamps.
- Minimal dependencies; Ubuntu support verified in CI.
Project Layout
src/– Rust library (Bluetooth, driver, Python bindings)bitalino_rs/– Python package stub for maturin buildsdocs/– User/developer docs (mkdocs).github/workflows/– CI, release, PyPI publish
Install
Python (from PyPI, when released)
uv pip install bitalino-rs
Python (from source)
Requirements: Rust (stable), Python 3.11+, system deps (libdbus-1-dev libudev-dev on Ubuntu).
# in repo root
uv sync
Rust crate (from source)
cargo build --release
Usage
Rust
use bitalino_rs::{Bitalino, SamplingRate};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut dev = Bitalino::connect("7E:91:2B:C4:AF:08", "1234")?;
dev.start(SamplingRate::Hz1000 as u16, Some(vec![0, 1, 2]))?;
let frames = dev.read_frames(100)?;
println!("read {} frames", frames.len());
dev.stop()?;
Ok(())
}
Python
from bitalino_rs import Bitalino
dev = Bitalino.connect("7E:91:2B:C4:AF:08")
dev.start(rate=1000, channels=[0, 1, 2])
batch = dev.read_timed(200)
print(batch.timestamp_us, batch.sequence_gaps)
dev.stop()
Development
- Rust toolchain:
rustup toolchain install stable(CI uses stable with rustfmt/clippy) - System deps (Linux):
sudo apt-get install -y pkg-config libdbus-1-dev libudev-dev - Lint/format:
pre-commit run --all-files - Commit style: Conventional Commits (checked in CI)
- Tests:
cargo test --all-features --all-targets
Logging
- Default level:
info. Override withBITALINO_LOG=debug(falls back toRUST_LOGif unset). - Rust binaries: call
bitalino_rs::init_rust_logging()once (idempotent). - Python: logging is wired on import; adjust from Python with
bitalino_rs.enable_rust_logs("debug")or clear caches withbitalino_rs.reset_log_cache()after reconfiguring Python logging.
License
Apache License 2.0. See LICENSE.
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bitalino_rs-0.1.12-cp39-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bitalino_rs-0.1.12-cp39-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
beb3bdd92772efde5747010948497aa32e377ed0f1291eee6294c743e22acdff
|
|
| MD5 |
71dc92907207dbcfe8ebf1538788b96d
|
|
| BLAKE2b-256 |
2b05a48f8fc8563485dbb471b1386e5494bb784262212acf43ad6e7d9a1b46a0
|
Provenance
The following attestation bundles were made for bitalino_rs-0.1.12-cp39-abi3-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on tleygue/bitalino_rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitalino_rs-0.1.12-cp39-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
beb3bdd92772efde5747010948497aa32e377ed0f1291eee6294c743e22acdff - Sigstore transparency entry: 786564403
- Sigstore integration time:
-
Permalink:
tleygue/bitalino_rs@1906cde517df19404718b4709134b34cce306d21 -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/tleygue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1906cde517df19404718b4709134b34cce306d21 -
Trigger Event:
push
-
Statement type: