8 releases (1 stable)

1.0.0 Nov 7, 2023
1.0.0-dev.7 Oct 5, 2023
1.0.0-dev.6 Sep 20, 2023
1.0.0-dev.5 Aug 23, 2023
1.0.0-dev Jun 14, 2020

#261 in Science

Download history 46/week @ 2024-07-30 1/week @ 2024-09-17 21/week @ 2024-09-24

137 downloads per month

GPL-3.0 license

49KB
1K SLoC

nscope-rs

Crates.io License Documentation

Cargo Test

A Rust implementation of the nScope API.


lib.rs:

This crate provides an interface to the nScope

Usage

This crate is on crates.io and can be used by adding nscope to the dependencies in your project's Cargo.toml.

Example

extern crate nscope;
use nscope::LabBench;

fn main() {
    // Create a LabBench
    let bench = LabBench::new().expect("Cannot create LabBench");

    // Print the bench to show a list of detected nScopes
    println!("{:?}", bench);

    // Open an nScope
    let nscope = bench.open_first_available(true).expect("Cannot open nScope");

    // Turn on analog output channel A1
    nscope.a1.turn_on();

    // Trigger an auto-triggered sweep of 20 samples at 4.0 Hz sample rate
    let sweep_handle = nscope.request(4.0, 20, None);

    // Loop through the received data, blocking on each sample until it arrives
    for sample in sweep_handle.receiver {
        // Print the sample data
        println!("{:?}", sample.data);
    }

    // Turn off the analog output channel A1
    nscope.a1.turn_off();

}

Dependencies

~3–14MB
~129K SLoC