Struct AdiExpander

Source
pub struct AdiExpander {
    pub adi_a: AdiPort,
    pub adi_b: AdiPort,
    pub adi_c: AdiPort,
    pub adi_d: AdiPort,
    pub adi_e: AdiPort,
    pub adi_f: AdiPort,
    pub adi_g: AdiPort,
    pub adi_h: AdiPort,
    /* private fields */
}
Expand description

An ADI expander module plugged into a Smart Port.

ADI Expanders allow a Smart Port to be used as an “adapter” for eight additional ADI slots if all onboard AdiPorts are used.

This struct gives access to AdiPorts similarly to how Peripherals works. Ports may be partially moved out of this struct to create devices.

Fields§

§adi_a: AdiPort

ADI port A on the expander.

§adi_b: AdiPort

ADI port B on the expander.

§adi_c: AdiPort

ADI Port C on the expander.

§adi_d: AdiPort

ADI Port D on the expander.

§adi_e: AdiPort

ADI Port E on the expander.

§adi_f: AdiPort

ADI Port F on the expander.

§adi_g: AdiPort

ADI Port G on the expander.

§adi_h: AdiPort

ADI Port H on the expander.

Implementations§

Source§

impl AdiExpander

Source

pub const fn new(port: SmartPort) -> Self

Creates a new expander from a SmartPort.

An ADI expander does not return port errors itself if it is unplugged. Any disconnect handling is done by devices created from the ports on the expander.

§Examples

Creating an analog input from a port on the expander:

use vexide::prelude::*;

#[vexide::main]
async fn main(peripherals: Peripherals) {
    let expander = AdiExpander::new(peripherals.port_1);
    let analog_in = AdiAnalogIn::new(expander.adi_a);

    println!("Analog in voltage: {:?}", analog_in.voltage());
}

Trait Implementations§

Source§

impl Debug for AdiExpander

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<AdiExpander> for SmartPort

Source§

fn from(device: AdiExpander) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AdiExpander

Source§

fn eq(&self, other: &AdiExpander) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl SmartDevice for AdiExpander

Source§

fn port_number(&self) -> u8

Returns the port number of the SmartPort this device is registered on. Read more
Source§

fn device_type(&self) -> SmartDeviceType

Returns the variant of SmartDeviceType that this device is associated with. Read more
Source§

const UPDATE_INTERVAL: Duration = _

The interval at which the V5 brain reads packets from Smart devices.
Source§

fn is_connected(&self) -> bool

Determine if this device type is currently connected to the SmartPort that it’s registered to. Read more
Source§

fn timestamp(&self) -> Result<SmartDeviceTimestamp, PortError>

Returns the timestamp recorded by this device’s internal clock. Read more
Source§

fn validate_port(&self) -> Result<(), PortError>

Verify that the device type is currently plugged into this port, returning an appropriate PortError if not available. Read more
Source§

impl Eq for AdiExpander

Source§

impl StructuralPartialEq for AdiExpander

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.