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§
Sourceconst CALIBRATION_SIZE: usize = 0
const CALIBRATION_SIZE: usize = 0
The size of the calibration data in bytes. If 0, calibration is not supported.
Required Associated Types§
type CalibrationError: Error
Required Methods§
Sourceasync fn scan(&mut self, callback: impl FnMut(KeyChangeEvent))
async fn scan(&mut self, callback: impl FnMut(KeyChangeEvent))
Scans a key and returns the delta from the previous key scan
Provided Methods§
Sourcefn save_calibration(
&self,
_buf: &mut [u8],
) -> Result<(), Self::CalibrationError>
fn save_calibration( &self, _buf: &mut [u8], ) -> Result<(), Self::CalibrationError>
Save calibration data into the provided buffer. Returns Ok(()) on success.
Sourcefn load_calibration(
&mut self,
_buf: &[u8],
) -> Result<(), Self::CalibrationError>
fn load_calibration( &mut self, _buf: &[u8], ) -> Result<(), Self::CalibrationError>
Load calibration data from the provided buffer. Returns Ok(()) on success.
Sourcefn start_calibration(&mut self)
fn start_calibration(&mut self)
Starts calibration mode.
Sourcefn end_calibration(&mut self)
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.
RKTK API Docs