diff --git a/src/led_ring.rs b/src/led_ring.rs index 95729ee..7dbe2d1 100644 --- a/src/led_ring.rs +++ b/src/led_ring.rs @@ -6,7 +6,7 @@ use hal::prelude::_embedded_hal_digital_OutputPin as OutputPin; /// /// The direction can be interpreted as such when the mini-USB port of the board is being held /// down. -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Direction { /// Cycle clockwise. Clockwise, @@ -25,7 +25,7 @@ impl Direction { } /// The mode the LED ring is in. -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Mode { /// All LEDs are off. Off, @@ -64,6 +64,11 @@ where } } + /// Returns the current cycle mode. + pub fn mode(&self) -> Mode { + self.mode + } + /// Enables cycle mode. pub fn enable_cycle(&mut self) { self.mode = Mode::Cycle; @@ -89,6 +94,11 @@ where self.mode == Mode::Accelerometer } + /// Returns the current cycle direction. + pub fn direction(&self) -> Direction { + self.direction + } + /// Reverses the cycle direction. /// /// This will have no immediately visible effect if the LED ring is not in cycle mode