pub struct SmartPort { /* private fields */ }Expand description
A struct which represents an unconfigured smart port.
Implementations§
Source§impl SmartPort
impl SmartPort
Sourcepub unsafe fn new(port: u8) -> Self
pub unsafe fn new(port: u8) -> Self
Constructs a new smart port.
§Safety
This function is unsafe because it allows the user to create multiple
mutable references to a V5 smart port. You likely want to implement
Robot::new() instead.
Sourcepub fn plugged_type(&self) -> DeviceType
pub fn plugged_type(&self) -> DeviceType
Checks the type of device currently connected to the port.
Sourcepub fn into_motor(
self,
gearset: Gearset,
encoder_units: EncoderUnits,
reverse: bool,
) -> Result<Motor, MotorError>
pub fn into_motor( self, gearset: Gearset, encoder_units: EncoderUnits, reverse: bool, ) -> Result<Motor, MotorError>
Converts a SmartPort into a Motor.
Sourcepub fn into_serial(self, baudrate: i32) -> Result<Serial, Error>
pub fn into_serial(self, baudrate: i32) -> Result<Serial, Error>
Converts a SmartPort into a Serial.
Sourcepub fn into_expander(self) -> AdiExpander
pub fn into_expander(self) -> AdiExpander
Converts a SmartPort into an AdiExpander.
Sourcepub fn into_distance(self) -> DistanceSensor
pub fn into_distance(self) -> DistanceSensor
Converts a SmartPort into a
DistanceSensor.
Sourcepub fn into_imu(self) -> InertialSensor
pub fn into_imu(self) -> InertialSensor
Converts a SmartPort into a
InertialSensor.
Sourcepub fn into_rotation(
self,
reversed: bool,
) -> Result<RotationSensor, RotationSensorError>
pub fn into_rotation( self, reversed: bool, ) -> Result<RotationSensor, RotationSensorError>
Converts a SmartPort into a
RotationSensor.
Trait Implementations§
Source§impl From<SmartPort> for AdiExpander
impl From<SmartPort> for AdiExpander
Source§impl From<SmartPort> for DistanceSensor
impl From<SmartPort> for DistanceSensor
Auto Trait Implementations§
impl Freeze for SmartPort
impl RefUnwindSafe for SmartPort
impl Send for SmartPort
impl Sync for SmartPort
impl Unpin for SmartPort
impl UnwindSafe for SmartPort
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more