#[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

Fields

§index: u16
§val: i16
§

AnalogVelocity

Fields

§index: u16
§val: i16
§

AnalogAcceleration

Fields

§index: u16
§val: i16
§

AnalogJerk

Fields

§index: u16
§val: i16
§

Layer

Fields

§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§

source§

impl TriggerEvent

source

pub const unsafe fn bytes(&self) -> &[u8]

Convert enum to an array of bytes

Safety
source

pub const unsafe fn from_byte_array(bytes: [u8; 8]) -> Self

Convert array of bytes to enum

Safety
source

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
source

pub fn index(&self) -> u16

Attempts to determine the index value of the event If an index is not valid, return 0 instead (index may not have any meaning)

Trait Implementations§

source§

impl Clone for TriggerEvent

source§

fn clone(&self) -> TriggerEvent

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TriggerEvent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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

source§

fn from(cond: TriggerCondition) -> Self

Converts to this type from the input type.
source§

impl From<TriggerEvent> for CapabilityRun

source§

fn from(event: TriggerEvent) -> Self

Converts to this type from the input type.
source§

impl From<TriggerEvent> for u8

Convert TriggerEvent into the u8 identifier

source§

fn from(event: TriggerEvent) -> Self

Converts to this type from the input type.
source§

impl Hash for TriggerEvent

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<TriggerEvent> for TriggerEvent

source§

fn eq(&self, other: &TriggerEvent) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for TriggerEvent

source§

impl Eq for TriggerEvent

source§

impl StructuralEq for TriggerEvent

source§

impl StructuralPartialEq for TriggerEvent

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.