Skip to main content

MorseProfile

Struct MorseProfile 

Source
pub struct MorseProfile(/* private fields */);
Expand description

Configuration for morse, tap dance and tap-hold. Manually packed into 64 bits to save RAM.

Bit layout of the inner u64:

63        46 | 45      | 44           32 | 31  30 | 29       17 | 16  15 | 14  13   | 12       0
reserved     | qt_set  | quick_tap_tm    | mode   | gap_timeout | uni_tap| flow_tap | hold_timeout
  (18b)      |  (1b)   |   (13b ms)      |  (2b)  |   (13b ms)  |  (2b)  |   (2b)   |  (13b ms)
  • qt_set (bit 45): when set, quick_tap_timeout is explicitly configured (even if 0, which means “disabled”). When clear, the field is unset and callers should fall back to the global default.
  • quick_tap_timeout (bits 44-32): quick-tap timeout in ms (max 8191).
  • mode (bits 31-30): 00 = None, 01 = PermissiveHold, 10 = HoldOnOtherPress, 11 = Normal
  • flow_tap (bits 14, 13): 00/01 = None, 10 = Some(false), 11 = Some(true)
  • gap_timeout (bits 29-17): gap timeout in ms (0 = None, max 8191)
  • uni_tap (bits 16-15): 00/01 = None, 10 = Some(false), 11 = Some(true)
  • hold_timeout (bits 12-0): hold timeout in ms (0 = None, max 8191)

Implementations§

Source§

impl MorseProfile

Source

pub const fn const_default() -> Self

Source

pub fn unilateral_tap(self) -> Option<bool>

If the previous key is on the same “hand”, the current key will be determined as a tap

Source

pub const fn with_unilateral_tap(self, b: Option<bool>) -> Self

Source

pub fn enable_flow_tap(self) -> Option<bool>

Per-profile override for flow tap. None inherits the global morse setting.

Source

pub const fn with_enable_flow_tap(self, b: Option<bool>) -> Self

Source

pub fn mode(self) -> Option<MorseMode>

The decision mode of the morse/tap-hold key

Source

pub const fn with_mode(self, m: Option<MorseMode>) -> Self

Source

pub fn hold_timeout_ms(self) -> Option<u16>

If the key is pressed longer than this, it is accepted as hold (in milliseconds)

Source

pub const fn with_hold_timeout_ms(self, t: Option<u16>) -> Self

Source

pub const fn set_hold_timeout_ms(&mut self, t: u16)

Source

pub const fn set_gap_timeout_ms(&mut self, t: u16)

Source

pub fn gap_timeout_ms(self) -> Option<u16>

The time elapsed from the last release of a key is longer than this, it will break the morse pattern (in milliseconds)

Source

pub const fn with_gap_timeout_ms(self, t: Option<u16>) -> Self

Source

pub const fn quick_tap_timeout_ms(self) -> Option<u16>

Source

pub const fn with_quick_tap_timeout_ms(self, t: Option<u16>) -> Self

Source

pub const fn set_quick_tap_timeout_ms(&mut self, t: u16)

Source

pub const fn new( unilateral_tap: Option<bool>, mode: Option<MorseMode>, hold_timeout_ms: Option<u16>, gap_timeout_ms: Option<u16>, ) -> Self

Trait Implementations§

Source§

impl Clone for MorseProfile

Source§

fn clone(&self) -> MorseProfile

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for MorseProfile

Source§

impl Debug for MorseProfile

Source§

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

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

impl Default for MorseProfile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MorseProfile

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for MorseProfile

Source§

impl From<MorseProfile> for u64

Source§

fn from(val: MorseProfile) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for MorseProfile

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl MaxSize for MorseProfile

Source§

const POSTCARD_MAX_SIZE: usize

The maximum possible size that the serialization of this type can have, in bytes.
Source§

impl PartialEq for MorseProfile

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for MorseProfile

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MorseProfile

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.