pico-sdk
Unofficial Rust bindings and wrappers for Pico Technology oscilloscope drivers
This is a meta-crate re-exporting functionality from a number of sub-crates. These crates expose common, high-performance, high-level APIs that hide the differences between the numerous Pico drivers.
Tests
Some tests open and stream from devices and these fail if devices are not available, for example when run in CI. To run these tests, ensure that ignored tests are run too:
cargo test -- --ignored
Examples
There are a number of examples which demonstrate how the wrappers can be used
cargo run --example streaming_cli
Displays an interactive command line interface that allows selection of device, channel configuration and sample rate. Once capturing, the streaming rate is displayed along with channel values.
cargo run --example enumerate
Attempts to enumerate devices and downloads drivers which were not found in the cache location.
cargo run --example open <driver> <serial>
Loads the specified driver and attempts open the optionally specified device serial.
Usage Examples
Opening and configuring a specific ps2000 device as a PicoDevice
:
use *;
let driver = PS2000.try_load?;
let device = try_load?;
device.enable_channel;
Enumerate all required Pico oscilloscope drivers, configure the first device that's returned and stream gap-less data from it:
use *;
let enumerator = new;
// Enumerate, ignore all failures and get the first device
let device = enumerator
.enumerate
.into_iter
.flatten
.next
.expect;
// Enable and configure 2 channels
device.enable_channel;
device.enable_channel;
// Get a streaming device
let stream_device = device.to_streaming_device;
// Subscribe to streaming events on a background thread
let _stream_subscription = stream_device
.events
.subscribe_on_thread;
// Start streaming with 1k sample rate
stream_device.start?;
Enumerate all required Pico oscilloscope drivers. If a device is found but no matching driver is available, attempt to download missing drivers and try enumerating again:
use *;
let enumerator = with_resolution;
loop
License: MIT