pub struct Rumble { /* private fields */ }
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§
Source§impl Rumble
impl Rumble
pub fn frequency(self) -> f32
pub fn amplitude(self) -> f32
Sourcepub fn new(freq: f32, amp: f32) -> Self
pub fn new(freq: f32, amp: f32) -> Self
Constructor of Rumble. If arguments not in line with constraints, args will be saturated.
Trait Implementations§
impl Copy for Rumble
impl StructuralPartialEq for Rumble
Auto Trait Implementations§
impl Freeze for Rumble
impl RefUnwindSafe for Rumble
impl Send for Rumble
impl Sync for Rumble
impl Unpin for Rumble
impl UnwindSafe for Rumble
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