Enum kll_core::TriggerEvent
source · #[repr(u8)]
pub enum TriggerEvent {
Show 14 variants
None,
Switch {
state: Phro,
index: u16,
last_state: u32,
},
HidLed {
state: Aodo,
index: u8,
last_state: u32,
},
AnalogDistance {
index: u16,
val: i16,
},
AnalogVelocity {
index: u16,
val: i16,
},
AnalogAcceleration {
index: u16,
val: i16,
},
AnalogJerk {
index: u16,
val: i16,
},
Layer {
state: LayerState,
layer: u8,
last_state: u32,
},
Animation {
state: Dro,
index: u16,
last_state: u32,
},
Sleep {
state: Aodo,
last_state: u32,
},
Resume {
state: Aodo,
last_state: u32,
},
Inactive {
state: Aodo,
last_state: u32,
},
Active {
state: Aodo,
last_state: u32,
},
Rotation {
index: u8,
position: i8,
last_state: u32,
},
}
Expand description
Trigger event definitions
last_state is an incrementing counter that increases on every scan loop while the state has not changed (e.g. holding a key).
Variants
None
Switch
Fields
state: Phro
Switch state
index: u16
Switch identification index
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
HidLed
Fields
state: Aodo
LED state
index: u8
HID LED identification (from USB HID spec, e.g. CapsLock)
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
AnalogDistance
AnalogVelocity
AnalogAcceleration
AnalogJerk
Layer
Fields
state: LayerState
layer: u8
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Animation
Fields
state: Dro
index: u16
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Sleep
Fields
state: Aodo
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Resume
Fields
state: Aodo
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Inactive
Fields
state: Aodo
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Active
Fields
state: Aodo
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Rotation
Fields
index: u8
position: i8
last_state: u32
Scanning loops since the last state change (can be 0 if the state just changed)
Implementations
sourceimpl TriggerEvent
impl TriggerEvent
sourcepub const unsafe fn from_byte_array(bytes: [u8; 8]) -> Self
pub const unsafe fn from_byte_array(bytes: [u8; 8]) -> Self
Convert array of bytes to enum
Safety
sourcepub const unsafe fn from_bytes(bytes: &[u8]) -> Self
pub const unsafe fn from_bytes(bytes: &[u8]) -> Self
Convert slice of bytes to enum Aggressively casts the provide u8 slice to retrieve a TriggerEvent
Safety
Trait Implementations
sourceimpl Clone for TriggerEvent
impl Clone for TriggerEvent
sourcefn clone(&self) -> TriggerEvent
fn clone(&self) -> TriggerEvent
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for TriggerEvent
impl Debug for TriggerEvent
sourceimpl From<TriggerCondition> for TriggerEvent
impl From<TriggerCondition> for TriggerEvent
Convert TriggerCondition to TriggerEvent Used for mainly for kll validation, events are time index 0 and are assumed to be immediate with no history
sourcefn from(cond: TriggerCondition) -> Self
fn from(cond: TriggerCondition) -> Self
sourceimpl From<TriggerEvent> for CapabilityRun
impl From<TriggerEvent> for CapabilityRun
sourcefn from(event: TriggerEvent) -> Self
fn from(event: TriggerEvent) -> Self
sourceimpl From<TriggerEvent> for u8
impl From<TriggerEvent> for u8
Convert TriggerEvent into the u8 identifier