pub struct Peripherals {Show 30 fields
pub screen: Screen,
pub port_1: SmartPort,
pub port_2: SmartPort,
pub port_3: SmartPort,
pub port_4: SmartPort,
pub port_5: SmartPort,
pub port_6: SmartPort,
pub port_7: SmartPort,
pub port_8: SmartPort,
pub port_9: SmartPort,
pub port_10: SmartPort,
pub port_11: SmartPort,
pub port_12: SmartPort,
pub port_13: SmartPort,
pub port_14: SmartPort,
pub port_15: SmartPort,
pub port_16: SmartPort,
pub port_17: SmartPort,
pub port_18: SmartPort,
pub port_19: SmartPort,
pub port_20: SmartPort,
pub port_21: SmartPort,
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,
}Expand description
A struct that contains all ports on the V5 Brain
and guarentees at compile time that each port is only used once.
Because of the fact that this checks at compile time, it cannot be moved once it has been used to create a device.
If you need to store a peripherals struct for use in multiple functions, use DynamicPeripherals instead.
This struct is always preferred over DynamicPeripherals when possible.
Fields§
§screen: ScreenBrain screen
port_1: SmartPortSmart port 1 on the brain
port_2: SmartPortSmart port 2 on the brain
port_3: SmartPortSmart port 3 on the brain
port_4: SmartPortSmart port 4 on the brain
port_5: SmartPortSmart port 5 on the brain
port_6: SmartPortSmart port 6 on the brain
port_7: SmartPortSmart port 7 on the brain
port_8: SmartPortSmart port 8 on the brain
port_9: SmartPortSmart port 9 on the brain
port_10: SmartPortSmart port 10 on the brain
port_11: SmartPortSmart port 11 on the brain
port_12: SmartPortSmart port 12 on the brain
port_13: SmartPortSmart port 13 on the brain
port_14: SmartPortSmart port 14 on the brain
port_15: SmartPortSmart port 15 on the brain
port_16: SmartPortSmart port 16 on the brain
port_17: SmartPortSmart port 17 on the brain
port_18: SmartPortSmart port 18 on the brain
port_19: SmartPortSmart port 19 on the brain
port_20: SmartPortSmart port 20 on the brain
port_21: SmartPortSmart port 21 on the brain
adi_a: AdiPortAdi port A on the brain.
adi_b: AdiPortAdi port B on the brain.
adi_c: AdiPortAdi port C on the brain.
adi_d: AdiPortAdi port D on the brain.
adi_e: AdiPortAdi port E on the brain.
adi_f: AdiPortAdi port F on the brain.
adi_g: AdiPortAdi port G on the brain.
adi_h: AdiPortAdi port H on the brain.
Implementations§
Source§impl Peripherals
impl Peripherals
Sourcepub fn take() -> Option<Self>
pub fn take() -> Option<Self>
Attempts to create a new Peripherals struct, returning None if one has already been created.
After calling this function, future calls to Peripherals::take will return None.
Sourcepub unsafe fn steal() -> Self
pub unsafe fn steal() -> Self
Creates a new Peripherals struct without ensuring that is the only unique instance.
After calling this function, future calls to Peripherals::take will return None.
§Safety
Creating new SmartPorts and Peripherals instances is inherently unsafe due to the possibility of constructing more than
one device on the same port index and allowing multiple mutable references to the same hardware device.
The caller must ensure that only one mutable reference to each port is used.