Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiseiYokoyama committed Apr 25, 2020
1 parent ebe6f21 commit 8bc3ad3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/joycon/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,29 @@ pub mod lights {
LightsStatus::once(self)
}

/// Set HOME light.
///
/// # Example
/// ```no_run
/// use joycon_rs::prelude::{*, lights::{*, home_button::*}};
///
/// # let manager = JoyConManager::new().unwrap();
/// #
/// # let device = manager.lock()
/// # .unwrap()
/// # .managed_devices()
/// # .remove(0);
/// #
/// # let mut joycon_driver = SimpleJoyConDriver::new(&device).unwrap();
/// let pattern =
/// // loop pattern forever
/// LightEmittingPattern::new(100, 0, 0u8.into())
/// // 0.5 seconds to light up
/// .add_phase(100,500,0)
/// // 0.5 seconds to turn off
/// .add_phase(0,500,0);
/// let player_lights_status = joycon_driver.set_home_light(&pattern);
/// ```
fn set_home_light(&mut self, pattern: &home_button::LightEmittingPattern) -> JoyConResult<[u8; 362]> {
let arg: [u8;25] = pattern.clone().into();
self.send_sub_command(SubCommand::SetHOMELight, &arg)
Expand Down

0 comments on commit 8bc3ad3

Please sign in to comment.