nscope/
lib.rs

1/***************************************************************************************************
2 *
3 *  nLabs, LLC
4 *  https://nscope.org
5 *  Copyright(c) 2020. All Rights Reserved
6 *
7 *  This file is part of the nScope API
8 *
9 **************************************************************************************************/
10
11//! This crate provides an interface to the [nScope](https://nscope.org)
12//!
13//! # Usage
14//!
15//! This crate is [on crates.io](https://crates.io/crates/nscope) and can be
16//! used by adding `nscope` to the dependencies in your project's `Cargo.toml`.
17//!
18//!
19//! # Example
20//!
21//! ```rust,no_run
22//! extern crate nscope;
23//! use nscope::LabBench;
24//!
25//! fn main() {
26//!     // Create a LabBench
27//!     let bench = LabBench::new().expect("Cannot create LabBench");
28//!
29//!     // Print the bench to show a list of detected nScopes
30//!     println!("{:?}", bench);
31//!
32//!     // Open an nScope
33//!     let nscope = bench.open_first_available(true).expect("Cannot open nScope");
34//!
35//!     // Turn on analog output channel A1
36//!     nscope.a1.turn_on();
37//!
38//!     // Trigger an auto-triggered sweep of 20 samples at 4.0 Hz sample rate
39//!     let sweep_handle = nscope.request(4.0, 20, None);
40//!
41//!     // Loop through the received data, blocking on each sample until it arrives
42//!     for sample in sweep_handle.receiver {
43//!         // Print the sample data
44//!         println!("{:?}", sample.data);
45//!     }
46//!
47//!     // Turn off the analog output channel A1
48//!     nscope.a1.turn_off();
49//!
50//! }
51//! ```
52
53
54mod lab_bench;
55mod scope;
56mod version;
57
58pub use lab_bench::LabBench;
59pub use lab_bench::NscopeLink;
60pub use scope::Nscope;
61pub use scope::power::*;
62pub use scope::pulse_output::*;
63pub use scope::analog_output::*;
64pub use scope::analog_input::*;
65pub use scope::data_requests::*;
66pub use scope::trigger::*;
67pub use version::version;