fleascope-rs

Crates.iofleascope-rs
lib.rsfleascope-rs
version0.4.0
created_at2025-07-24 20:10:13.372719+00
updated_at2025-08-30 22:08:09.213078+00
descriptionLibrary to interact with a Fleascope
homepagehttps://github.com/daniel-freiermuth/fleascope-rs
repositoryhttps://github.com/daniel-freiermuth/fleascope-rs
max_upload_size
id1766860
size180,117
Daniel Freiermuth (daniel-freiermuth)

documentation

README

FleaScope RS

Fast Rust library for FleaScope oscilloscope devices. High-performance data acquisition with dual probes, digital/analog triggers, and automatic calibration.

Perks

  • Fearless state handling, guarded by type states
  • read_async for cancellable reads
  • Cross-Platform: Better device discovery and serial communication across Windows/Linux/macOS.
  • Output as Polars frames

Quick Start

Connect and read data in just a few lines:

use fleascope_rs::{IdleFleaScope, DigitalTrigger};
use std::time::Duration;

// Connect and acquire data
let mut (scope, x1, x10) = IdleFleaScope::connect("FleaScope", None, true)?;
let trigger_config = DigitalTrigger::start_capturing_when()
                        .is_matching()
                        .into_trigger_fields()?;
let reading = scope.read_sync(Duration::from_millis(10), trigger_config, None)?;
let uncalibrated_frame : Polars::LazyFrame = reading.parse_csv();
let calibrated_frame = x1.apply_calibration(uncalibrated_frame)
println!("Captured {} samples", calibrated_frame.collect().height());

Device Discovery

use fleascope_rs::FleaConnector;

let devices = FleaConnector::get_available_devices(None)?;
for device in devices.take(3) {
    println!("Found: {} at {}", device.name, device.port);
}

Triggers

Digital Triggers - Pattern matching on 9 bits:

use fleascope_rs::{DigitalTrigger, BitState};

let trigger = DigitalTrigger::start_capturing_when()
    .bit0(BitState::High)
    .bit1(BitState::Low) 
    .bit2(BitState::DontCare)
    .starts_matching();

let data = scope.read_sync(Duration::from_millis(5), trigger.into_trigger_fields(), None)?;

Analog Triggers - Edge and level detection:

use fleascope_rs::AnalogTrigger;

let trigger = AnalogTrigger::start_capturing_when().rising_edge(1.5);
let data = scope.read_sync(Duration::from_millis(5), trigger.into_trigger_fields(), None)?;

Calibration

let mut (scope, x1, x10) = FleaScope::connect(None, None, true)?;

// Connect probe to ground, then 3.3V
let zero_value = x1.calibrate_0(scope)?;
let full_scale = x1.calibrate_3v3(scope)?;
x1.write_calibration_to_flash(scope)?; // Save to device

API Overview

Data Output: All methods return polars::DataFrame with:

  • time - Time in seconds from trigger
  • bnc - Voltage values (auto-converted from ADC)
  • bitmap - Digital bit values (hex string)

Use IdleFleaScope::extract_bits() to convert bitmap to individual bit columns.

Related Projects

Commit count: 31

cargo fmt