Skip to content

Commit

Permalink
docs: add: get_pwm_enable and fix at set_ pwm_enable
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulTrombin authored and patrickelectric committed Dec 6, 2023
1 parent 81b9715 commit 8261178
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ impl Navigator {
.expect("Error : Error on magnetometer during self-test")
}

/// Sets the PWM IC to be enabled through firmware and OE_pin.
/// Sets the PWM IC to be enabled through OE_pin.
///
/// # Arguments
///
Expand All @@ -412,6 +412,29 @@ impl Navigator {
}
}

/// Get the PWM IC enabling value through OE_pin.
///
/// # Examples
///
/// ```no_run
/// use navigator_rs::{Navigator};
/// use std::thread::sleep;
/// use std::time::Duration;
///
/// let mut nav = Navigator::new();
///
/// nav.init();
/// loop {
/// let previous = nav.get_pwm_enable();
/// println!("Enable pin logic value is {previous}.");
///
/// nav.set_pwm_enable(!previous);
///
/// println!("Enable pin logic value is {}.", nav.get_pwm_enable());
///
/// sleep(Duration::from_millis(1000));
/// }
/// ```
pub fn get_pwm_enable(&mut self) -> bool {
self.pwm.oe_pin.get_value().expect("Error: Get PWM value") == 1
}
Expand Down

0 comments on commit 8261178

Please sign in to comment.