updated effect_info

This commit is contained in:
vextrixes committed 2026-06-17 21:17:46 +02:00
1 parent d30c388c2c
commit f46c4a81a6
4 files changed
+45 -7

No files matched your search

+3
View File
@@ -7,6 +7,9 @@ pub use color::Color;
pub use hid_wrapper::HidWrapperError;
pub use keymap::{Keymap, KeymapKeys};
pub use rgb_controller::controller::RGBController;
pub use rgb_controller::effect_info::{
DirectionPolicy, EFFECTS, EffectInfo, HorizontalDirections, VerticalDirections,
};
pub use rgb_controller::effects::Effects;
#[cfg(feature = "access_hid_wrapper")]
+12 -3
View File
@@ -39,7 +39,10 @@ impl RGBController {
/// ```HidWrapperError::NoHidDeviceError```
fn prepare_device(&mut self) -> Result<(), HidWrapperError> {
self.hid_wrapper.send_report(&[0x04, 0xab])?;
self.hid_wrapper.get_report()?;
#[cfg(not(feature = "fast_controller_experimental"))]
{
self.hid_wrapper.get_report()?;
}
self.hid_wrapper.send_report(&[
0x26, 0x36, 0xf2, 0x27, 0xb7, 0x2a, 0x56, 0x77, 0x98, 0x59, 0x9c, 0x6d, 0x9f, 0xc6,
@@ -54,7 +57,10 @@ impl RGBController {
self.hid_wrapper
.send_report(&[0x04, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12])?;
self.hid_wrapper.get_report()?;
#[cfg(not(feature = "fast_controller_experimental"))]
{
self.hid_wrapper.get_report()?;
}
Ok(())
}
@@ -191,7 +197,10 @@ impl RGBController {
/// ```HidWrapperError::NoHidDeviceError```
fn apply_to_device(&mut self) -> Result<(), HidWrapperError> {
self.hid_wrapper.send_report(&[0x04, 0x02])?;
self.hid_wrapper.get_report()?;
#[cfg(not(feature = "fast_controller_experimental"))]
{
self.hid_wrapper.get_report()?;
}
self.hid_wrapper.send_report(&[0x04, 0xf0])?;
+28 -3
View File
@@ -1,6 +1,5 @@
use crate::Effects;
#[allow(dead_code)]
pub struct EffectInfo<'a> {
name: &'a str,
effect: Effects,
@@ -11,14 +10,12 @@ pub struct EffectInfo<'a> {
requires_keymap: bool,
}
#[allow(dead_code)]
pub enum DirectionPolicy {
None,
Horizontal01,
Vertical23,
}
#[allow(dead_code)]
pub const EFFECTS: [EffectInfo; 20] = [
EffectInfo {
name: "Static",
@@ -201,3 +198,31 @@ pub const EFFECTS: [EffectInfo; 20] = [
requires_keymap: true,
},
];
pub enum HorizontalDirections {
Left,
Right,
}
impl HorizontalDirections {
pub fn to_u8(&self) -> u8 {
match self {
HorizontalDirections::Left => 0,
HorizontalDirections::Right => 1,
}
}
}
pub enum VerticalDirections {
Down,
Up,
}
impl VerticalDirections {
pub fn to_u8(&self) -> u8 {
match self {
VerticalDirections::Down => 2,
VerticalDirections::Up => 3,
}
}
}