[−][src]Struct joycon_rs::joycon::Rumble
Rumble data for vibration.
Notice
Constraints exist.
- frequency - 0.0 < freq < 1252.0
- amplitude - 0.0 < amp < 1.799.0
Example
use joycon_rs::prelude::{*, joycon_features::JoyConFeature}; let manager = JoyConManager::get_instance(); let devices = { let lock = manager.lock(); match lock { Ok(manager) => manager.new_devices(), Err(_) => unreachable!(), } }; devices.iter() .try_for_each::<_, JoyConResult<()>>(|d| { let mut driver = SimpleJoyConDriver::new(&d)?; driver.enable_feature(JoyConFeature::Vibration)?; let rumble = Rumble::new(300.0,0.9); // ₍₍(ง˘ω˘)ว⁾⁾ Rumble! ₍₍(ง˘ω˘)ว⁾⁾ driver.rumble((Some(rumble), Some(rumble)))?; Ok(()) }) .unwrap();
Implementations
impl Rumble
[src]
pub fn frequency(self) -> f32
[src]
pub fn amplitude(self) -> f32
[src]
pub fn new(freq: f32, amp: f32) -> Self
[src]
Constructor of Rumble. If arguments not in line with constraints, args will be saturated.
pub fn is_safe(self) -> bool
[src]
The amplitudes over 1.003 are not safe for the integrity of the linear resonant actuators.
pub fn stop() -> Self
[src]
Generates stopper of rumbling.
Example
ⓘThis example is not tested
// Make JoyCon stop rambling. rumbling_controller_driver.rumble((Some(Rumble::stop()),Some(Rumble::stop()))).unwrap();
Trait Implementations
impl Clone for Rumble
[src]
impl Copy for Rumble
[src]
impl Debug for Rumble
[src]
impl Into<[u8; 4]> for Rumble
[src]
impl PartialEq<Rumble> for Rumble
[src]
impl StructuralPartialEq for Rumble
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rumble
impl Send for Rumble
impl Sync for Rumble
impl Unpin for Rumble
impl UnwindSafe for Rumble
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,