Expand description
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();
}
Structs
- Interface to a single scope channel
- Interface to an analog output channel
- A representation of all the nScopes plugged into a computer
- Primary interface to the nScope, used to set outputs, trigger sweeps of input data on scope channels, and monitor power state
- A detected link between the computer and an nScope, used to open and retrieve an nScope
- Information about the power supply status of nScope
- Interface to a pulse output channel
- Voltage information from all open channels at a given time
- Handle to an ongoing data sweep, holds received data from nScope
- A representation of a trigger used to start a data sweep
Enums
- Possible analog output polarities
- Possible analog output signal types
- Possible states of the nScope power supply
- Different trigger types used to start a data sweep
Functions
- Returns the current version of the nScope API