diff --git a/src/led_stateful.rs b/src/led_stateful.rs index 71eebd1..97324fb 100644 --- a/src/led_stateful.rs +++ b/src/led_stateful.rs @@ -21,32 +21,27 @@ pub struct StatefulLed { } impl StatefulLed { + /// 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, diff --git a/src/lib.rs b/src/lib.rs index 5472fff..d6c8d74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,7 @@ pub struct LedButton { } impl LedButton { - /// Creates a StatefulLed + /// Creates a stateful LedButton. /// /// # Examples /// ```