#[repr(u8)]
pub enum TriggerCondition {
Show 14 variants None, Switch { state: Phro, index: u16, loop_condition_index: u16, }, HidLed { state: Aodo, loop_condition_index: u16, index: u8, }, AnalogDistance { reserved: u8, index: u16, val: i16, }, AnalogVelocity { reserved: u8, index: u16, val: i16, }, AnalogAcceleration { reserved: u8, index: u16, val: i16, }, AnalogJerk { reserved: u8, index: u16, val: i16, }, Layer { state: LayerState, loop_condition_index: u16, layer: u8, }, Animation { state: Dro, index: u16, loop_condition_index: u16, }, Sleep { state: Aodo, loop_condition_index: u16, }, Resume { state: Aodo, loop_condition_index: u16, }, Inactive { state: Aodo, loop_condition_index: u16, }, Active { state: Aodo, loop_condition_index: u16, }, Rotation { index: u8, loop_condition_index: u16, position: i8, },
}
Expand description

Trigger condition definitions

XXX (HaaTa): Field order is extremely important. Rust will optimize field packing if done correctly. Static assertions are included to prevent bad mistakes. Changing the enum size is an API breaking change (requires KLL compiler updates).

Variants§

§

None

§

Switch

Fields

§state: Phro

Switch state

§index: u16

Switch identification index

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

6 bytes

§

HidLed

Fields

§state: Aodo

LED state

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

§index: u8

HID LED identification (from USB HID spec, e.g. CapsLock)

5 bytes

§

AnalogDistance

Fields

§reserved: u8

Needed focontiguous packing

§index: u16

Switch identification index

§val: i16

Analog distance, units depend on the keyboard, KLL compiler handles unit conversion

6 bytes

§

AnalogVelocity

Fields

§reserved: u8

Needed for contiguous packing

§index: u16

Switch identification index

§val: i16

Analog velocity, units depend on the keyboard, KLL compiler handles unit conversion

6 bytes

§

AnalogAcceleration

Fields

§reserved: u8

Needed for contiguous packing

§index: u16

Switch identification index

§val: i16

Analog acceleration, units depend on the keyboard, KLL compiler handles unit conversion

6 bytes

§

AnalogJerk

Fields

§reserved: u8

Needed for contiguous packing

§index: u16

Switch identification index

§val: i16

Analog jerk, units depend on the keyboard, KLL compiler handles unit conversion

6 bytes

§

Layer

Fields

§state: LayerState

Layer state

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

§layer: u8

Layer index (layer 0 is the default state and does not have events)

5 bytes

§

Animation

Fields

§state: Dro

Animation state

§index: u16

Animation index

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

6 bytes

§

Sleep

Fields

§state: Aodo

Sleep state

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

Sleep events are always index 0 4 bytes

§

Resume

Fields

§state: Aodo

Resume state

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

Resume events are always index 0 4 bytes

§

Inactive

Fields

§state: Aodo

Inactive state

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

Inactive events are always index 0 4 bytes

§

Active

Fields

§state: Aodo

Active state

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

Active events are always index 0 4 bytes

§

Rotation

Fields

§index: u8

Rotation index

§loop_condition_index: u16

Scanning loop condition (number of scanning loops attached to state condition) Lookup index

§position: i8

Rotation direction (-1,+1)

5 bytes

Implementations§

Convert enum to an array of bytes

Safety

Convert array of bytes to enum

Safety

Convert slice of bytes to enum Aggressively casts the provide u8 slice to retrieve a TriggerCondition

Safety

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

Compare TriggerEvent to TriggerCondition NOTE: This is not a direct equivalent comparison each type and state can influence how the loop_condition_index is evaluated. In a way, this is similar to the voting scheme of the older C KLL implementation.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Convert TriggerCondition to TriggerEvent Used for mainly for kll validation, events are time index 0 and are assumed to be immediate with no history

Converts to this type from the input type.

Convert TriggerCondition into the u8 identifier

Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.