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.

Generates stopper of rumbling.

Example
// Make JoyCon stop rambling.
rumbling_controller_driver.rumble((Some(Rumble::stop()),Some(Rumble::stop()))).unwrap();

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.