pub struct Controller {Show 15 fields
pub left_stick: AnalogStick,
pub right_stick: AnalogStick,
pub l1: Button,
pub l2: Button,
pub r1: Button,
pub r2: Button,
pub up: Button,
pub down: Button,
pub left: Button,
pub right: Button,
pub x: Button,
pub y: Button,
pub a: Button,
pub b: Button,
pub screen: Screen,
/* private fields */
}Expand description
Represents a Vex controller.
Fields§
§left_stick: AnalogStickThe left analog stick.
right_stick: AnalogStickThe right analog stick.
l1: ButtonThe top-left shoulder button.
l2: ButtonThe bottom-left shoulder button.
r1: ButtonThe top-right shoulder button.
r2: ButtonThe bottom-right shoulder button.
up: ButtonThe up directional button.
down: ButtonThe down directional button.
left: ButtonThe left directional button.
right: ButtonThe right directional button.
x: ButtonThe “X” button.
y: ButtonThe “Y” button.
a: ButtonThe “A” button.
b: ButtonThe “B” button.
screen: ScreenThe LCD screen
Implementations§
Source§impl Controller
impl Controller
Sourcepub unsafe fn new(id: ControllerId) -> Self
pub unsafe fn new(id: ControllerId) -> Self
Creates a new controller.
§Safety
This function is unsafe because it allows the user to create multiple
mutable references to the same controller. You likely want to implement
Robot::new instead.
Sourcepub fn is_connected(&self) -> Result<bool, ControllerError>
pub fn is_connected(&self) -> Result<bool, ControllerError>
Returns false or true if the controller is connected.
Sourcepub fn get_battery_level(&self) -> Result<i32, ControllerError>
pub fn get_battery_level(&self) -> Result<i32, ControllerError>
Gets the battery level of the controller.
Sourcepub fn get_battery_capacity(&self) -> Result<i32, ControllerError>
pub fn get_battery_capacity(&self) -> Result<i32, ControllerError>
Gets the battery capacity of the controller.
Trait Implementations§
Source§impl DataSource for Controller
impl DataSource for Controller
Auto Trait Implementations§
impl Freeze for Controller
impl !RefUnwindSafe for Controller
impl Send for Controller
impl Sync for Controller
impl Unpin for Controller
impl !UnwindSafe for Controller
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
Source§impl<T> IntoBroadcast for Twhere
T: DataSource,
impl<T> IntoBroadcast for Twhere
T: DataSource,
Source§fn into_broadcast(
self,
) -> Result<BroadcastWrapper<T>, (<T as DataSource>::Error, T)>
fn into_broadcast( self, ) -> Result<BroadcastWrapper<T>, (<T as DataSource>::Error, T)>
Converts the data source into a
BroadcastWrapper. Read more