Skip to main content

Device

Struct Device 

Source
pub struct Device { /* private fields */ }
Expand description

An open connection to a neoRAD-IO2 chain (closed automatically on drop).

Device is Send but not Sync: the underlying C library is not safe for concurrent calls on the same handle, and blocking mode is process-global. Note: the underlying C library also keeps process-global state, so using even separate Device values concurrently across threads is not supported.

Implementations§

Source§

impl Device

Source

pub fn request_calibration( &self, device: i32, bank: i32, header: &mut neoRADIO2frame_calHeader, ) -> Result<()>

Request calibration data (fills nothing; pair with read_calibration_array).

Source

pub fn read_calibration_array( &self, device: i32, bank: i32, header: &mut neoRADIO2frame_calHeader, ) -> Result<Vec<f32>>

Read calibration values into a Vec<f32>.

Source

pub fn request_calibration_points( &self, device: i32, bank: i32, header: &mut neoRADIO2frame_calHeader, ) -> Result<()>

Request calibration points.

Source

pub fn read_calibration_points_array( &self, device: i32, bank: i32, header: &mut neoRADIO2frame_calHeader, ) -> Result<Vec<f32>>

Read calibration points into a Vec<f32>.

Source

pub fn write_calibration( &self, device: i32, bank: i32, header: &mut neoRADIO2frame_calHeader, values: &[f32], ) -> Result<()>

Write calibration values.

Source

pub fn write_calibration_successful(&self, device: i32, bank: i32) -> Result<()>

Whether the last write_calibration completed.

Source

pub fn write_calibration_points( &self, device: i32, bank: i32, header: &mut neoRADIO2frame_calHeader, values: &[f32], ) -> Result<()>

Write calibration points.

Source

pub fn write_calibration_points_successful( &self, device: i32, bank: i32, ) -> Result<()>

Whether the last write_calibration_points completed.

Source

pub fn store_calibration(&self, device: i32, bank: i32) -> Result<()>

Store calibration to flash.

Source

pub fn is_calibration_stored(&self, device: i32, bank: i32) -> Result<bool>

Whether calibration is stored.

Source

pub fn calibration_is_valid(&self, device: i32, bank: i32) -> Result<bool>

Whether calibration is valid.

Source

pub fn clear_calibration(&self, device: i32, bank: i32) -> Result<()>

Clear stored calibration.

Source

pub fn request_calibration_info(&self, device: i32, bank: i32) -> Result<()>

Request calibration info.

Source

pub fn read_calibration_info( &self, device: i32, bank: i32, ) -> Result<neoRADIO2frame_calHeader>

Read calibration info header.

Source§

impl Device

Source

pub fn find() -> Result<Vec<DeviceInfo>>

Enumerate attached neoRAD-IO2 USB devices.

Source

pub fn open(info: &DeviceInfo) -> Result<Device>

Open a device discovered by find.

Source

pub fn is_opened(&self) -> Result<bool>

Whether the device is currently open.

Source

pub fn is_closed(&self) -> Result<bool>

Whether the device is currently closed.

Source§

impl Device

Source

pub fn chain_identify(&self) -> Result<()>

Identify the device chain.

Source

pub fn chain_is_identified(&self) -> Result<bool>

Whether the chain has been identified.

Source

pub fn chain_count(&self, identify: bool) -> Result<i32>

Number of devices in the chain. identify re-identifies first.

Source

pub fn app_start(&self, device: i32, bank: i32) -> Result<()>

Start application firmware on device/bank (bank is a bitmask).

Source

pub fn app_is_started(&self, device: i32, bank: i32) -> Result<bool>

Whether application firmware is running on device/bank.

Source

pub fn enter_bootloader(&self, device: i32, bank: i32) -> Result<()>

Enter the bootloader on device/bank.

Source§

impl Device

Source

pub fn serial_number(&self, device: i32, bank: i32) -> Result<u32>

Serial number (base-10) of device/bank.

Source

pub fn manufacturer_date( &self, device: i32, bank: i32, ) -> Result<(i32, i32, i32)>

Manufacturing date (year, month, day).

Source

pub fn firmware_version(&self, device: i32, bank: i32) -> Result<(i32, i32)>

Firmware version (major, minor).

Source

pub fn hardware_revision(&self, device: i32, bank: i32) -> Result<(i32, i32)>

Hardware revision (major, minor).

Source

pub fn device_type(&self, device: i32, bank: i32) -> Result<u32>

Device type code (see DeviceType::from_raw).

Source

pub fn request_pcbsn(&self, device: i32, bank: i32) -> Result<()>

Request the PCB serial number (call before pcbsn).

Source

pub fn pcbsn(&self, device: i32, bank: i32) -> Result<String>

PCB serial number string.

Source§

impl Device

Source

pub fn request_sensor_data( &self, device: i32, bank: i32, cal: CalType, ) -> Result<()>

Request a fresh sensor sample for device/bank.

Source

pub fn read_sensor_float(&self, device: i32, bank: i32) -> Result<f32>

Read a single sensor value as f32.

Source

pub fn read_sensor_array(&self, device: i32, bank: i32) -> Result<Vec<i32>>

Read the raw sensor sample as up to 64 integer values (device/mode specific).

Source

pub fn write_sensor(&self, device: i32, bank: i32, data: &[u8]) -> Result<()>

Write sensor/actuator data for device/bank.

Source

pub fn write_sensor_successful(&self, device: i32, bank: i32) -> Result<()>

Whether the last write_sensor completed.

Source§

impl Device

Source

pub fn toggle_led( &self, device: i32, bank: i32, mode: LedMode, led_enables: i32, ms: i32, ) -> Result<()>

Toggle LEDs on device/bank.

Source

pub fn toggle_led_successful(&self, device: i32, bank: i32) -> Result<()>

Whether the last toggle_led completed.

Source

pub fn request_settings(&self, device: i32, bank: i32) -> Result<()>

Request the device settings (call before read_settings).

Source

pub fn read_settings( &self, device: i32, bank: i32, ) -> Result<neoRADIO2_settings>

Read the raw device settings struct.

Source

pub fn write_settings( &self, device: i32, bank: i32, settings: &neoRADIO2_settings, ) -> Result<()>

Write the raw device settings struct.

Source

pub fn write_settings_successful(&self, device: i32, bank: i32) -> Result<()>

Whether the last write_settings completed.

Source

pub fn write_default_settings(&self, device: i32, bank: i32) -> Result<()>

Restore default settings on device/bank.

Source

pub fn request_statistics(&self, device: i32, bank: i32) -> Result<()>

Request performance statistics.

Source

pub fn read_statistics( &self, device: i32, bank: i32, ) -> Result<neoRADIO2_PerfStatistics>

Read raw performance statistics.

Source

pub fn status( &self, device: i32, bank: i32, bitfield: bool, ty: StatusType, ) -> Result<CommandStatus>

Query a command status.

Trait Implementations§

Source§

impl Drop for Device

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Device

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.