Crates.io | pico-driver |
lib.rs | pico-driver |
version | 0.3.1 |
source | src |
created_at | 2020-11-12 13:11:12.14364 |
updated_at | 2021-05-12 11:04:12.029015 |
description | Unofficial Rust bindings and wrappers for Pico Technology oscilloscope drivers |
homepage | |
repository | https://github.com/meatysolutions/pico-sdk |
max_upload_size | |
id | 311550 |
size | 102,037 |
Common, safe wrappers for Pico Technology oscilloscope drivers.
This is a sub crate that you probably don't want to use directly. Try the top level
pico-sdk
crate which exposes everything from here.
Each Pico Technology oscilloscope relies on a native driver for communication and this driver will vary depending on the device product range. Each of these drivers has an interface which differs by either a few function arguments or a vastly differing API.
PS2000Driver
, PS2000ADriver
, PS3000ADriver
, PS4000Driver
,
PS4000ADriver
, PS5000ADriver
, PS6000Driver
and PS6000ADriver
wrap
their corresponding loaders and expose a safe, common API by implementing
the PicoDriver
trait. These can be constructed with a Resolution
which tells the wrapper where
to resolve the dynamic library from. The LoadDriverExt
trait supplies a shortcut to load a driver
directly from the Driver
enum via try_load
and try_load_with_resolution
.
Using the raw safe bindings to open and configure the first available device:
use pico_common::{ChannelConfig, Driver, PicoChannel, PicoCoupling, PicoInfo, PicoRange};
use pico_driver::{LoadDriverExt, Resolution};
// Load the ps2000 driver library with the default resolution
let driver = Driver::PS2000.try_load()?;
// Load the ps4000a driver library from the applications root directory
let driver = Driver::PS4000A.try_load_with_resolution(&Resolution::AppRoot)?;
// Open the first device
let handle = driver.open_unit(None)?;
let variant = driver.get_unit_info(handle, PicoInfo::VARIANT_INFO)?;
let ch_config = ChannelConfig {
coupling: PicoCoupling::DC,
range: PicoRange::X1_PROBE_2V,
offset: 0.0
};
driver.enable_channel(handle, PicoChannel::A, &ch_config)?;
License: MIT