fixed some minor doc issues.
This commit is contained in:
parent
ce75a8f890
commit
99c264807f
@ -21,32 +21,27 @@ pub struct StatefulLed<OP> {
|
||||
}
|
||||
|
||||
impl<OP: OutputPin> StatefulLed<OP> {
|
||||
|
||||
/// Creates a StatefulLed
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use led_button::led_stateful::StatefulLed;
|
||||
/// use led_button::led_state::LedState;
|
||||
/// use led_button::button_config::Buttonconfig;
|
||||
/// use led_button::PullConfig;
|
||||
///
|
||||
/// // ... init your hal and do a weird a dance..
|
||||
/// // shake it and dance weirdo!!
|
||||
///
|
||||
/// let led1_pin = pins.gpio15.into_push_pull_output();
|
||||
/// let button1_pin = pins.gpio16.into_pull_up_input();
|
||||
/// let led_pin = pins.gpio15.into_push_pull_output();
|
||||
///
|
||||
/// let button1 = LedButton::create(
|
||||
/// led1_pin,
|
||||
/// LedState::Off,
|
||||
/// PullConfig::PullDown,
|
||||
/// button1_pin,
|
||||
/// ButtonConfig::default(),
|
||||
/// 274000.0
|
||||
/// );
|
||||
/// let led = StatefulLed::create(led_pin, PullConfig::PullUp, LedState::Off);
|
||||
///
|
||||
/// // ... continue doing a weird a dance.
|
||||
/// led.on(); // set led in active state.
|
||||
/// led.off(); // set led in inactive state.
|
||||
/// led.toggle(); // switch to the next logical state.
|
||||
/// led.set_state(LedState::On); // set led in active state.
|
||||
/// ```
|
||||
///
|
||||
pub fn create(led_pin: OP, pull_config: PullConfig, start_state: LedState) -> Self {
|
||||
Self {
|
||||
pin : led_pin,
|
||||
|
||||
@ -36,7 +36,7 @@ pub struct LedButton<OP, IP> {
|
||||
}
|
||||
|
||||
impl<OP: OutputPin, IP: InputPin> LedButton<OP, IP> {
|
||||
/// Creates a StatefulLed
|
||||
/// Creates a stateful LedButton.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user