Struct joycon_rs::joycon::Rumble [−][src]
pub struct Rumble { /* fields omitted */ }
Expand description
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
Constructor of Rumble. If arguments not in line with constraints, args will be saturated.
The amplitudes over 1.003 are not safe for the integrity of the linear resonant actuators.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Rumble
impl UnwindSafe for Rumble
Blanket Implementations
Mutably borrows from an owned value. Read more