pub struct PicoDevice {
pub handle: Arc<Mutex<RawMutex, Option<i16>>>,
pub driver: Arc<dyn PicoDriver>,
pub variant: String,
pub serial: String,
pub usb_version: String,
pub max_adc_value: i16,
pub channel_ranges: HashMap<PicoChannel, Vec<PicoRange>>,
}
Expand description
Base Pico device
Fields§
§handle: Arc<Mutex<RawMutex, Option<i16>>>
§driver: Arc<dyn PicoDriver>
§variant: String
§serial: String
§usb_version: String
§max_adc_value: i16
§channel_ranges: HashMap<PicoChannel, Vec<PicoRange>>
Implementations§
Source§impl PicoDevice
impl PicoDevice
Sourcepub fn try_open(
driver: &Arc<dyn PicoDriver>,
serial: Option<&str>,
) -> Result<PicoDevice, PicoError>
pub fn try_open( driver: &Arc<dyn PicoDriver>, serial: Option<&str>, ) -> Result<PicoDevice, PicoError>
Creates a PicoDevice with the supplied PicoDriver
and serial string.
If None
is passed for the serial, the first discovered device will be
opened.
use pico_common::Driver;
use pico_driver::LoadDriverExt;
use pico_device::PicoDevice;
// Load the required driver with a specific resolution
let driver = Driver::PS2000.try_load().unwrap();
let device1 = PicoDevice::try_open(&driver, Some("ABC/123")).unwrap();
let device2 = PicoDevice::try_open(&driver, Some("ABC/987")).unwrap();
assert_eq!(device1.variant, "2204A");
assert_eq!(device2.variant, "2205A");
pub fn get_channels(&self) -> Vec<PicoChannel>
Trait Implementations§
Source§impl Clone for PicoDevice
impl Clone for PicoDevice
Source§fn clone(&self) -> PicoDevice
fn clone(&self) -> PicoDevice
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PicoDevice
impl Debug for PicoDevice
Source§impl Display for PicoDevice
impl Display for PicoDevice
Source§impl Drop for PicoDevice
impl Drop for PicoDevice
Source§impl From<PicoDevice> for PicoStreamingDevice
impl From<PicoDevice> for PicoStreamingDevice
Source§fn from(d: PicoDevice) -> PicoStreamingDevice
fn from(d: PicoDevice) -> PicoStreamingDevice
Converts to this type from the input type.
Source§impl ToStreamDevice for PicoDevice
impl ToStreamDevice for PicoDevice
fn into_streaming_device(self) -> PicoStreamingDevice
Auto Trait Implementations§
impl Freeze for PicoDevice
impl !RefUnwindSafe for PicoDevice
impl Send for PicoDevice
impl Sync for PicoDevice
impl Unpin for PicoDevice
impl !UnwindSafe for PicoDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more