Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions rmk-config/src/keyboard.rs

This file was deleted.

13 changes: 4 additions & 9 deletions rmk-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const EVENT_DEFAULT_CONFIG: &str = include_str!("default_config/event_default.to

pub(crate) mod chip;
pub(crate) mod communication;
pub(crate) mod keyboard;
pub mod resolved;
#[rustfmt::skip]
pub mod usb_interrupt_map;
Expand Down Expand Up @@ -343,14 +342,6 @@ impl Default for EventChannelConfig {
}
}

#[allow(dead_code)]
impl EventChannelConfig {
/// Extract values as tuple
pub fn into_values(self) -> (usize, usize, usize) {
(self.channel_size, self.pubs, self.subs)
}
}

/// Macro to define EventConfig and related code without repetition
macro_rules! define_event_config {
($($field:ident),* $(,)?) => {
Expand Down Expand Up @@ -1141,6 +1132,10 @@ impl KeyboardTomlConfig {
_ => Err("Use [[split.output]] to define outputs for split in your keyboard.toml!".to_string()),
}
}

pub(crate) fn get_dependency_config(&self) -> DependencyConfig {
self.dependency.clone().unwrap_or_default()
}
}

#[cfg(test)]
Expand Down
15 changes: 9 additions & 6 deletions rmk-config/src/resolved/identity.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::keyboard::Basic;

/// Keyboard identity for USB descriptors and BLE advertising.
pub struct Identity {
pub name: String,
Expand All @@ -13,7 +11,6 @@ pub struct Identity {
impl crate::KeyboardTomlConfig {
/// Resolve keyboard identity from TOML config.
pub fn identity(&self) -> Result<Identity, String> {
let default = Basic::default();
let keyboard = self
.keyboard
.as_ref()
Expand All @@ -22,9 +19,15 @@ impl crate::KeyboardTomlConfig {
name: keyboard.name.clone(),
vendor_id: keyboard.vendor_id,
product_id: keyboard.product_id,
manufacturer: keyboard.manufacturer.clone().unwrap_or(default.manufacturer),
product_name: keyboard.product_name.clone().unwrap_or(default.product_name),
serial_number: keyboard.serial_number.clone().unwrap_or(default.serial_number),
manufacturer: keyboard.manufacturer.clone().unwrap_or_else(|| "RMK".to_string()),
product_name: keyboard
.product_name
.clone()
.unwrap_or_else(|| "RMK Keyboard".to_string()),
serial_number: keyboard
.serial_number
.clone()
.unwrap_or_else(|| "vial:f64c2b3c:000001".to_string()),
})
}
}
3 changes: 0 additions & 3 deletions rmk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ storage = [
"dep:embassy-embedded-hal",
]

## If your PCB diode's direction is col2row, enable this feature. If it's row2col, disable this feature by `default-features = false`.
col2row = []

## Enable defmt support
defmt = [
"dep:defmt",
Expand Down
10 changes: 0 additions & 10 deletions rmk/src/ble/device_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ impl Default for PnPID {
}
}

#[derive(Debug, Default)]
pub(crate) struct DeviceConfiguration {
pub(crate) manufacturer_name: Option<&'static str>,
pub(crate) model_number: Option<&'static str>,
pub(crate) serial_number: Option<&'static str>,
pub(crate) hw_rev: Option<&'static str>,
pub(crate) fw_rev: Option<&'static str>,
pub(crate) sw_rev: Option<&'static str>,
}

#[gatt_service(uuid = service::DEVICE_INFORMATION)]
pub(crate) struct DeviceConfigurationService {
#[characteristic(uuid = "2a50", read)]
Expand Down
11 changes: 0 additions & 11 deletions rmk/src/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ pub enum CompositeReportType {
System = 0x03,
}

impl CompositeReportType {
fn from_u8(report_id: u8) -> Self {
match report_id {
0x01 => Self::Mouse,
0x02 => Self::Media,
0x03 => Self::System,
_ => Self::None,
}
}
}

/// Plover HID stenography report.
///
/// Plover (v5.1+) enumerates the keyboard as a stenography machine when it
Expand Down
37 changes: 1 addition & 36 deletions rmk/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,23 +297,6 @@ impl<'a> Keyboard<'a> {
})
}

// Clean up for leak keys, remove non morse keys in ProcessedButReleaseNotReportedYet state from the buffer
pub(crate) fn clean_buffered_processed_keys(&mut self) {
self.held_buffer.keys.retain(|k| {
if k.action.is_morse() {
true
} else {
match k.state {
KeyState::ProcessedButReleaseNotReportedYet(_) => {
warn!("NEED CLEAN: Processing buffering TAP keys with post tap: {:?}", k.event);
false
}
_ => true,
}
}
});
}

/// Process the latest buffered key.
///
/// The given holding key is a copy of the buffered key. Only tap-hold keys are considered now.
Expand Down Expand Up @@ -1905,9 +1888,8 @@ mod test {
use rmk_types::morse::{MorseMode, MorseProfile};

use super::*;
use crate::config::{BehaviorConfig, CombosConfig, ForksConfig, PositionalConfig};
use crate::config::{BehaviorConfig, ForksConfig, PositionalConfig};
use crate::event::{KeyPos, KeyboardEvent, KeyboardEventPos};
use crate::keyboard::combo::{Combo, ComboConfig};
use crate::test_support::test_block_on as block_on;
use crate::{a, k, layer, mo, th, thp};

Expand Down Expand Up @@ -1940,19 +1922,6 @@ mod test {
]
}

#[rustfmt::skip]
fn get_combos_config() -> CombosConfig {
// Define the function to return the appropriate combo configuration
CombosConfig {
combos: [
Some(Combo::new(ComboConfig::new([k!(V), k!(B)], k!(LShift), Some(0)))),
Some(Combo::new(ComboConfig::new([k!(R), k!(T)], k!(LAlt), Some(0)))),
None, None, None, None, None, None
],
timeout: Duration::from_millis(100),
}
}

fn create_test_keyboard_with_config(config: BehaviorConfig) -> Keyboard<'static> {
// Box::leak is acceptable in tests: nextest runs each #[test] in its own process,
// so the leaked memory is reclaimed when the process exits.
Expand Down Expand Up @@ -1984,10 +1953,6 @@ mod test {
})
}

fn event(row: u8, col: u8, pressed: bool) -> KeyboardEvent {
KeyboardEvent::key(row, col, pressed)
}

#[test]
fn test_register_key() {
let main = async {
Expand Down
4 changes: 0 additions & 4 deletions rmk/src/keyboard/combo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ impl Combo {
self.config.size()
}

pub(crate) fn started(&self) -> bool {
self.state != 0
}

pub(crate) fn keys_pressed(&self) -> u32 {
self.state.count_ones()
}
Expand Down
5 changes: 1 addition & 4 deletions rmk/src/matrix/bidirectional_matrix.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use embassy_time::{Instant, Timer};
use embassy_time::Timer;
use rmk_macro::input_device;

use crate::debounce::{DebounceState, DebouncerTrait};
Expand Down Expand Up @@ -26,8 +26,6 @@ pub struct BidirectionalMatrix<
debouncer: D,
/// Key state matrix
key_state: [[KeyState; COL]; ROW],
/// Start scanning
scan_start: Option<Instant>,
/// Current scan pos: (row_idx, col_idx)
scan_pos: (usize, usize),
/// Scan map
Expand All @@ -43,7 +41,6 @@ impl<Pin: FlexPin, D: DebouncerTrait<ROW, COL>, const PIN_NUM: usize, const ROW:
pins,
debouncer,
key_state: [[KeyState::new(); COL]; ROW],
scan_start: None,
scan_pos: (0, 0),
scan_map,
}
Expand Down
8 changes: 5 additions & 3 deletions rmk/src/matrix/direct_pin.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use embassy_time::{Instant, Timer};
use embassy_time::Timer;
use embedded_hal;
use embedded_hal::digital::InputPin;
use rmk_macro::input_device;
#[cfg(feature = "async_matrix")]
use {embassy_futures::select::select_slice, embedded_hal_async::digital::Wait, heapless::Vec};
use {embassy_futures::select::select_slice, embassy_time::Instant, embedded_hal_async::digital::Wait, heapless::Vec};

use super::{KeyState, MatrixTrait};
use crate::debounce::{DebounceState, DebouncerTrait};
Expand All @@ -27,7 +27,8 @@ pub struct DirectPinMatrix<
debouncer: D,
/// Key state matrix
key_states: [[KeyState; COL]; ROW],
/// Start scanning
/// Start scanning — used by async-matrix wait gating only.
#[cfg(feature = "async_matrix")]
scan_start: Option<Instant>,
/// Pin active level
low_active: bool,
Expand All @@ -52,6 +53,7 @@ impl<
direct_pins,
debouncer,
key_states: [[KeyState::new(); COL]; ROW],
#[cfg(feature = "async_matrix")]
scan_start: None,
low_active,
scan_pos: (0, 0),
Expand Down