diff --git a/src/rgb_controller/keymap.rs b/src/keymap.rs similarity index 97% rename from src/rgb_controller/keymap.rs rename to src/keymap.rs index ee9d721..29ad8fc 100644 --- a/src/rgb_controller/keymap.rs +++ b/src/keymap.rs @@ -1,5 +1,6 @@ use crate::color::Color; +/// an Enum to get the id of a key pub enum KeymapKeys { Escape, F1, @@ -112,6 +113,7 @@ pub enum KeymapKeys { } impl KeymapKeys { + /// returns the id of a key fn to_usize(&self) -> usize { match self { KeymapKeys::Escape => 1, @@ -237,10 +239,12 @@ impl Default for Keymap { } impl Keymap { + ///sets a single key to a color pub fn set_key(&mut self, key: KeymapKeys, color: Color) { self.map[key.to_usize()] = color.to_array(); } + //sets a all key to a color pub fn set_all_keys(&mut self, color: Color) { self.map = [color.to_array(); 144]; } diff --git a/src/lib.rs b/src/lib.rs index 5c7adc0..f4d91d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,13 @@ mod color; mod hid_wrapper; mod rgb_controller; +mod keymap; pub use color::Color; pub use hid_wrapper::HidWrapperError; pub use rgb_controller::controller::RGBController; pub use rgb_controller::effects::Effects; -pub use rgb_controller::keymap::{Keymap, KeymapKeys}; +pub use keymap::{Keymap, KeymapKeys}; #[cfg(feature = "access_hid_wrapper")] pub use hid_wrapper::HidWrapper; diff --git a/src/rgb_controller.rs b/src/rgb_controller.rs index e135a02..07882e1 100644 --- a/src/rgb_controller.rs +++ b/src/rgb_controller.rs @@ -1,4 +1,3 @@ pub mod controller; pub mod effect_info; pub mod effects; -pub mod keymap;