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 AdiPort
s are used.
This struct gives access to AdiPort
s 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
impl AdiExpander
Sourcepub const fn new(port: SmartPort) -> Self
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
impl Debug for AdiExpander
Source§impl From<AdiExpander> for SmartPort
impl From<AdiExpander> for SmartPort
Source§fn from(device: AdiExpander) -> Self
fn from(device: AdiExpander) -> Self
Source§impl PartialEq for AdiExpander
impl PartialEq for AdiExpander
Source§impl SmartDevice for AdiExpander
impl SmartDevice for AdiExpander
Source§fn port_number(&self) -> u8
fn port_number(&self) -> u8
Source§fn device_type(&self) -> SmartDeviceType
fn device_type(&self) -> SmartDeviceType
SmartDeviceType
that this device is associated with. Read more