mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Break config-traits out in to crate
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::advanced::LedCode;
|
||||
use crate::Colour;
|
||||
|
||||
pub struct InputBased {
|
||||
address: LedCode,
|
||||
led: LedCode,
|
||||
colour: Colour,
|
||||
/// - audio
|
||||
/// - cpu freq
|
||||
@@ -24,10 +24,10 @@ impl EffectState for InputBased {
|
||||
}
|
||||
|
||||
fn get_led(&self) -> LedCode {
|
||||
self.address
|
||||
self.led
|
||||
}
|
||||
|
||||
fn set_led(&mut self, address: LedCode) {
|
||||
self.address = address
|
||||
self.led = address
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{effect_state_impl, Colour, Speed};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Breathe {
|
||||
address: LedCode,
|
||||
led: LedCode,
|
||||
/// The starting colour
|
||||
start_colour1: Colour,
|
||||
/// The secondary starting colour
|
||||
@@ -26,7 +26,7 @@ pub struct Breathe {
|
||||
impl Breathe {
|
||||
pub fn new(address: LedCode, colour1: Colour, colour2: Colour, speed: Speed) -> Self {
|
||||
Self {
|
||||
address,
|
||||
led: address,
|
||||
start_colour1: colour1,
|
||||
start_colour2: colour2,
|
||||
speed,
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{effect_state_impl, Colour};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct DoomFlicker {
|
||||
address: LedCode,
|
||||
led: LedCode,
|
||||
start_colour: Colour,
|
||||
max_percentage: u8,
|
||||
min_percentage: u8,
|
||||
@@ -20,7 +20,7 @@ pub struct DoomFlicker {
|
||||
impl DoomFlicker {
|
||||
pub fn new(address: LedCode, colour: Colour, max_percentage: u8, min_percentage: u8) -> Self {
|
||||
Self {
|
||||
address,
|
||||
led: address,
|
||||
colour,
|
||||
count: 4,
|
||||
max_percentage,
|
||||
@@ -94,7 +94,7 @@ pub struct LightFlash {
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct DoomLightFlash {
|
||||
address: LedCode,
|
||||
led: LedCode,
|
||||
start_colour: Colour,
|
||||
max_percentage: u8,
|
||||
min_percentage: u8,
|
||||
@@ -111,7 +111,7 @@ pub struct DoomLightFlash {
|
||||
impl DoomLightFlash {
|
||||
pub fn new(address: LedCode, colour: Colour, max_percentage: u8, min_percentage: u8) -> Self {
|
||||
Self {
|
||||
address,
|
||||
led: address,
|
||||
colour,
|
||||
count: 4,
|
||||
max_percentage,
|
||||
|
||||
@@ -133,12 +133,12 @@ macro_rules! effect_state_impl {
|
||||
}
|
||||
|
||||
fn get_led(&self) -> $crate::advanced::LedCode {
|
||||
self.address.clone()
|
||||
self.led.clone()
|
||||
}
|
||||
|
||||
/// Change the led type
|
||||
fn set_led(&mut self, address: $crate::advanced::LedCode) {
|
||||
self.address = address;
|
||||
self.led = address;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,14 +7,17 @@ use crate::{effect_state_impl, Colour};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Static {
|
||||
address: LedCode,
|
||||
led: LedCode,
|
||||
/// The starting colour
|
||||
colour: Colour,
|
||||
}
|
||||
|
||||
impl Static {
|
||||
pub fn new(address: LedCode, colour: Colour) -> Self {
|
||||
Self { address, colour }
|
||||
Self {
|
||||
led: address,
|
||||
colour,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user