PicoDriver

Trait PicoDriver 

Source
pub trait PicoDriver:
    Debug
    + Send
    + Sync {
Show 17 methods // Required methods fn get_driver(&self) -> Driver; fn get_version(&self) -> Result<String, PicoError>; fn get_path(&self) -> Result<Option<String>, PicoError>; fn enumerate_units(&self) -> Result<Vec<EnumerationResult>, PicoError>; fn open_unit(&self, serial: Option<&str>) -> Result<i16, PicoError>; fn ping_unit(&self, handle: i16) -> Result<(), PicoError>; fn maximum_value(&self, handle: i16) -> Result<i16, PicoError>; fn close(&self, handle: i16) -> Result<(), PicoError>; fn get_unit_info( &self, handle: i16, info_type: PicoInfo, ) -> Result<String, PicoError>; fn get_channel_ranges( &self, handle: i16, channel: PicoChannel, ) -> Result<Vec<PicoRange>, PicoError>; fn enable_channel( &self, handle: i16, channel: PicoChannel, config: &ChannelConfig, ) -> Result<(), PicoError>; fn disable_channel( &self, handle: i16, channel: PicoChannel, ) -> Result<(), PicoError>; fn set_data_buffer( &self, handle: i16, channel: PicoChannel, buffer: Arc<RwLock<RawRwLock, Pin<Vec<i16>>>>, buffer_len: usize, ) -> Result<(), PicoError>; fn start_streaming( &self, handle: i16, sample_config: &SampleConfig, ) -> Result<SampleConfig, PicoError>; fn get_latest_streaming_values<'a>( &self, handle: i16, channels: &[PicoChannel], callback: Box<dyn FnMut(usize, usize) + 'a>, ) -> Result<(), PicoError>; fn stop(&self, handle: i16) -> Result<(), PicoError>; // Provided method fn check_version(&self) -> Result<(), DriverLoadError> { ... }
}
Expand description

Common trait implemented for every driver

Required Methods§

Source

fn get_driver(&self) -> Driver

Gets the underlying driver type

Source

fn get_version(&self) -> Result<String, PicoError>

Gets the driver version string

Source

fn get_path(&self) -> Result<Option<String>, PicoError>

Gets the path to the loaded driver

Source

fn enumerate_units(&self) -> Result<Vec<EnumerationResult>, PicoError>

Returns a list of discovered serial numbers

Source

fn open_unit(&self, serial: Option<&str>) -> Result<i16, PicoError>

Opens a device, optionally with a specific serial number

Source

fn ping_unit(&self, handle: i16) -> Result<(), PicoError>

Ping a unit to see if it’s still connected

Source

fn maximum_value(&self, handle: i16) -> Result<i16, PicoError>

Get the maximum expected ADC value. This is required to scale to volts

Source

fn close(&self, handle: i16) -> Result<(), PicoError>

Close the specified unit

Source

fn get_unit_info( &self, handle: i16, info_type: PicoInfo, ) -> Result<String, PicoError>

Get one of the unit info strings

Source

fn get_channel_ranges( &self, handle: i16, channel: PicoChannel, ) -> Result<Vec<PicoRange>, PicoError>

Get valid ranges for the specified channel

Source

fn enable_channel( &self, handle: i16, channel: PicoChannel, config: &ChannelConfig, ) -> Result<(), PicoError>

Set up a channel with the supplied config

Source

fn disable_channel( &self, handle: i16, channel: PicoChannel, ) -> Result<(), PicoError>

Disable a channel

Source

fn set_data_buffer( &self, handle: i16, channel: PicoChannel, buffer: Arc<RwLock<RawRwLock, Pin<Vec<i16>>>>, buffer_len: usize, ) -> Result<(), PicoError>

Give the driver a buffer to write data into

Source

fn start_streaming( &self, handle: i16, sample_config: &SampleConfig, ) -> Result<SampleConfig, PicoError>

Starts the device streaming

Source

fn get_latest_streaming_values<'a>( &self, handle: i16, channels: &[PicoChannel], callback: Box<dyn FnMut(usize, usize) + 'a>, ) -> Result<(), PicoError>

Gets the latest streaming values

Source

fn stop(&self, handle: i16) -> Result<(), PicoError>

Stops the device streaming

Provided Methods§

Source

fn check_version(&self) -> Result<(), DriverLoadError>

Check that the driver meets the minimum version tested with these wrappers

Implementors§