updated effect_info
This commit is contained in:
4 files changed
+41
-3
No files matched your search
@@ -12,3 +12,4 @@ hidapi = "2.6.6"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
access_hid_wrapper = []
|
access_hid_wrapper = []
|
||||||
|
fast_controller_experimental = []
|
||||||
@@ -7,6 +7,9 @@ pub use color::Color;
|
|||||||
pub use hid_wrapper::HidWrapperError;
|
pub use hid_wrapper::HidWrapperError;
|
||||||
pub use keymap::{Keymap, KeymapKeys};
|
pub use keymap::{Keymap, KeymapKeys};
|
||||||
pub use rgb_controller::controller::RGBController;
|
pub use rgb_controller::controller::RGBController;
|
||||||
|
pub use rgb_controller::effect_info::{
|
||||||
|
DirectionPolicy, EFFECTS, EffectInfo, HorizontalDirections, VerticalDirections,
|
||||||
|
};
|
||||||
pub use rgb_controller::effects::Effects;
|
pub use rgb_controller::effects::Effects;
|
||||||
|
|
||||||
#[cfg(feature = "access_hid_wrapper")]
|
#[cfg(feature = "access_hid_wrapper")]
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ impl RGBController {
|
|||||||
/// ```HidWrapperError::NoHidDeviceError```
|
/// ```HidWrapperError::NoHidDeviceError```
|
||||||
fn prepare_device(&mut self) -> Result<(), HidWrapperError> {
|
fn prepare_device(&mut self) -> Result<(), HidWrapperError> {
|
||||||
self.hid_wrapper.send_report(&[0x04, 0xab])?;
|
self.hid_wrapper.send_report(&[0x04, 0xab])?;
|
||||||
|
#[cfg(not(feature = "fast_controller_experimental"))]
|
||||||
|
{
|
||||||
self.hid_wrapper.get_report()?;
|
self.hid_wrapper.get_report()?;
|
||||||
|
}
|
||||||
|
|
||||||
self.hid_wrapper.send_report(&[
|
self.hid_wrapper.send_report(&[
|
||||||
0x26, 0x36, 0xf2, 0x27, 0xb7, 0x2a, 0x56, 0x77, 0x98, 0x59, 0x9c, 0x6d, 0x9f, 0xc6,
|
0x26, 0x36, 0xf2, 0x27, 0xb7, 0x2a, 0x56, 0x77, 0x98, 0x59, 0x9c, 0x6d, 0x9f, 0xc6,
|
||||||
@@ -54,7 +57,10 @@ impl RGBController {
|
|||||||
|
|
||||||
self.hid_wrapper
|
self.hid_wrapper
|
||||||
.send_report(&[0x04, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12])?;
|
.send_report(&[0x04, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12])?;
|
||||||
|
#[cfg(not(feature = "fast_controller_experimental"))]
|
||||||
|
{
|
||||||
self.hid_wrapper.get_report()?;
|
self.hid_wrapper.get_report()?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +197,10 @@ impl RGBController {
|
|||||||
/// ```HidWrapperError::NoHidDeviceError```
|
/// ```HidWrapperError::NoHidDeviceError```
|
||||||
fn apply_to_device(&mut self) -> Result<(), HidWrapperError> {
|
fn apply_to_device(&mut self) -> Result<(), HidWrapperError> {
|
||||||
self.hid_wrapper.send_report(&[0x04, 0x02])?;
|
self.hid_wrapper.send_report(&[0x04, 0x02])?;
|
||||||
|
#[cfg(not(feature = "fast_controller_experimental"))]
|
||||||
|
{
|
||||||
self.hid_wrapper.get_report()?;
|
self.hid_wrapper.get_report()?;
|
||||||
|
}
|
||||||
|
|
||||||
self.hid_wrapper.send_report(&[0x04, 0xf0])?;
|
self.hid_wrapper.send_report(&[0x04, 0xf0])?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use crate::Effects;
|
use crate::Effects;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub struct EffectInfo<'a> {
|
pub struct EffectInfo<'a> {
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
effect: Effects,
|
effect: Effects,
|
||||||
@@ -11,14 +10,12 @@ pub struct EffectInfo<'a> {
|
|||||||
requires_keymap: bool,
|
requires_keymap: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub enum DirectionPolicy {
|
pub enum DirectionPolicy {
|
||||||
None,
|
None,
|
||||||
Horizontal01,
|
Horizontal01,
|
||||||
Vertical23,
|
Vertical23,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const EFFECTS: [EffectInfo; 20] = [
|
pub const EFFECTS: [EffectInfo; 20] = [
|
||||||
EffectInfo {
|
EffectInfo {
|
||||||
name: "Static",
|
name: "Static",
|
||||||
@@ -201,3 +198,31 @@ pub const EFFECTS: [EffectInfo; 20] = [
|
|||||||
requires_keymap: true,
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user