reorganized the keymap file location
This commit is contained in:
3 files changed
+6
-2
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
use crate::color::Color;
|
use crate::color::Color;
|
||||||
|
|
||||||
|
/// an Enum to get the id of a key
|
||||||
pub enum KeymapKeys {
|
pub enum KeymapKeys {
|
||||||
Escape,
|
Escape,
|
||||||
F1,
|
F1,
|
||||||
@@ -112,6 +113,7 @@ pub enum KeymapKeys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl KeymapKeys {
|
impl KeymapKeys {
|
||||||
|
/// returns the id of a key
|
||||||
fn to_usize(&self) -> usize {
|
fn to_usize(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
KeymapKeys::Escape => 1,
|
KeymapKeys::Escape => 1,
|
||||||
@@ -237,10 +239,12 @@ impl Default for Keymap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Keymap {
|
impl Keymap {
|
||||||
|
///sets a single key to a color
|
||||||
pub fn set_key(&mut self, key: KeymapKeys, color: Color) {
|
pub fn set_key(&mut self, key: KeymapKeys, color: Color) {
|
||||||
self.map[key.to_usize()] = color.to_array();
|
self.map[key.to_usize()] = color.to_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sets a all key to a color
|
||||||
pub fn set_all_keys(&mut self, color: Color) {
|
pub fn set_all_keys(&mut self, color: Color) {
|
||||||
self.map = [color.to_array(); 144];
|
self.map = [color.to_array(); 144];
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,12 +1,13 @@
|
|||||||
mod color;
|
mod color;
|
||||||
mod hid_wrapper;
|
mod hid_wrapper;
|
||||||
mod rgb_controller;
|
mod rgb_controller;
|
||||||
|
mod keymap;
|
||||||
|
|
||||||
pub use color::Color;
|
pub use color::Color;
|
||||||
pub use hid_wrapper::HidWrapperError;
|
pub use hid_wrapper::HidWrapperError;
|
||||||
pub use rgb_controller::controller::RGBController;
|
pub use rgb_controller::controller::RGBController;
|
||||||
pub use rgb_controller::effects::Effects;
|
pub use rgb_controller::effects::Effects;
|
||||||
pub use rgb_controller::keymap::{Keymap, KeymapKeys};
|
pub use keymap::{Keymap, KeymapKeys};
|
||||||
|
|
||||||
#[cfg(feature = "access_hid_wrapper")]
|
#[cfg(feature = "access_hid_wrapper")]
|
||||||
pub use hid_wrapper::HidWrapper;
|
pub use hid_wrapper::HidWrapper;
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
pub mod controller;
|
pub mod controller;
|
||||||
pub mod effect_info;
|
pub mod effect_info;
|
||||||
pub mod effects;
|
pub mod effects;
|
||||||
pub mod keymap;
|
|
||||||
Reference in new issue
Block a user