Skip to main content
RKTK API Docs RKTK Home Repo

KeyscanDriver

Trait KeyscanDriver 

Source
pub trait KeyscanDriver {
    type CalibrationError: Error;

    const CALIBRATION_SIZE: usize = 0;

    // Required method
    async fn scan(&mut self, callback: impl FnMut(KeyChangeEvent));

    // Provided methods
    fn save_calibration(
        &self,
        _buf: &mut [u8],
    ) -> Result<(), Self::CalibrationError> { ... }
    fn load_calibration(
        &mut self,
        _buf: &[u8],
    ) -> Result<(), Self::CalibrationError> { ... }
    fn start_calibration(&mut self) { ... }
    fn end_calibration(&mut self) { ... }
}
Expand description

Key scanner driver interface.

The keyscan driver has two roles:

  • Scanning the keys
  • Determining which hand is currently using the keyboard on a split keyboard

This is because the key scanning circuit often includes a left/right determination circuit.

Provided Associated Constants§

Source

const CALIBRATION_SIZE: usize = 0

The size of the calibration data in bytes. If 0, calibration is not supported.

Required Associated Types§

Required Methods§

Source

async fn scan(&mut self, callback: impl FnMut(KeyChangeEvent))

Scans a key and returns the delta from the previous key scan

Provided Methods§

Source

fn save_calibration( &self, _buf: &mut [u8], ) -> Result<(), Self::CalibrationError>

Save calibration data into the provided buffer. Returns Ok(()) on success.

Source

fn load_calibration( &mut self, _buf: &[u8], ) -> Result<(), Self::CalibrationError>

Load calibration data from the provided buffer. Returns Ok(()) on success.

Source

fn start_calibration(&mut self)

Starts calibration mode.

Source

fn end_calibration(&mut self)

Ends calibration mode.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§