Skip to content

Commit

Permalink
Merge pull request #172 from HaoboGu/fix/split_direct_pin
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoboGu authored Dec 9, 2024
2 parents a212bbb + e401bda commit 2db0066
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 41 deletions.
5 changes: 3 additions & 2 deletions rmk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed invalid BLE state after reconnection on Windows
- Fixed ghosting key on macOS
- Fix invalid BLE state after reconnection on Windows
- Fix ghosting key on macOS
- Fix direct pin debouncer size error

### Added

Expand Down
11 changes: 3 additions & 8 deletions rmk/src/direct_pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ pub async fn run_rmk_direct_pin<
const SIZE: usize,
const NUM_LAYER: usize,
>(
#[cfg(feature = "col2row")] direct_pins: [[Option<In>; COL]; ROW],
#[cfg(not(feature = "col2row"))] direct_pins: [[Option<In>; ROW]; COL],
direct_pins: [[Option<In>; COL]; ROW],
#[cfg(not(feature = "_no_usb"))] usb_driver: D,
#[cfg(not(feature = "_no_external_storage"))] flash: F,
default_keymap: &mut [[[KeyAction; COL]; ROW]; NUM_LAYER],
Expand Down Expand Up @@ -156,26 +155,22 @@ pub async fn run_rmk_direct_pin_with_async_flash<
const SIZE: usize,
const NUM_LAYER: usize,
>(
#[cfg(feature = "col2row")] direct_pins: [[Option<In>; COL]; ROW],
#[cfg(not(feature = "col2row"))] direct_pins: [[Option<In>; ROW]; COL],
direct_pins: [[Option<In>; COL]; ROW],
#[cfg(not(feature = "_no_usb"))] usb_driver: D,
#[cfg(not(feature = "_no_external_storage"))] flash: F,
default_keymap: &mut [[[KeyAction; COL]; ROW]; NUM_LAYER],
keyboard_config: RmkConfig<'static, Out>,
low_active: bool,
#[cfg(not(feature = "_esp_ble"))] spawner: Spawner,
) -> ! {
// Create the debouncer, use COL2ROW by default
// Create the debouncer
#[cfg(feature = "rapid_debouncer")]
let debouncer = RapidDebouncer::<COL, ROW>::new();
#[cfg(not(feature = "rapid_debouncer"))]
let debouncer = DefaultDebouncer::<COL, ROW>::new();

// Keyboard matrix
#[cfg(feature = "col2row")]
let matrix = DirectPinMatrix::<_, _, ROW, COL, SIZE>::new(direct_pins, debouncer, low_active);
#[cfg(not(feature = "col2row"))]
let matrix = DirectPinMatrix::<_, _, COL, ROW, SIZE>::new(direct_pins, debouncer, low_active);

// Dispatch according to chip and communication type
#[cfg(feature = "_nrf_ble")]
Expand Down
25 changes: 5 additions & 20 deletions rmk/src/split/central.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ pub async fn run_rmk_split_central_direct_pin<
const NUM_LAYER: usize,
const SIZE: usize,
>(
#[cfg(feature = "col2row")] direct_pins: [[Option<In>; CENTRAL_COL]; CENTRAL_ROW],
#[cfg(not(feature = "col2row"))] direct_pins: [[Option<In>; CENTRAL_ROW]; CENTRAL_COL],
direct_pins: [[Option<In>; CENTRAL_COL]; CENTRAL_ROW],
#[cfg(not(feature = "_no_usb"))] usb_driver: D,
#[cfg(not(feature = "_no_external_storage"))] flash: F,
default_keymap: &mut [[[KeyAction; TOTAL_COL]; TOTAL_ROW]; NUM_LAYER],
Expand All @@ -166,35 +165,21 @@ pub async fn run_rmk_split_central_direct_pin<
#[cfg(feature = "_nrf_ble")] central_addr: [u8; 6],
#[cfg(not(feature = "_esp_ble"))] spawner: Spawner,
) -> ! {
info!("Debouncer");
// Create the debouncer, use COL2ROW by default
#[cfg(all(feature = "col2row", feature = "rapid_debouncer"))]
let debouncer: RapidDebouncer<CENTRAL_ROW, CENTRAL_COL> = RapidDebouncer::new();
#[cfg(all(not(feature = "col2row"), feature = "rapid_debouncer"))]
#[cfg(feature = "rapid_debouncer")]
let debouncer: RapidDebouncer<CENTRAL_COL, CENTRAL_ROW> = RapidDebouncer::new();
#[cfg(all(feature = "col2row", not(feature = "rapid_debouncer")))]
let debouncer: DefaultDebouncer<CENTRAL_ROW, CENTRAL_COL> = DefaultDebouncer::new();
#[cfg(all(not(feature = "col2row"), not(feature = "rapid_debouncer")))]
#[cfg(not(feature = "rapid_debouncer"))]
let debouncer: DefaultDebouncer<CENTRAL_COL, CENTRAL_ROW> = DefaultDebouncer::new();

// Keyboard matrix, use COL2ROW by default
#[cfg(feature = "col2row")]
let matrix = CentralDirectPinMatrix::<
In,
_,
CENTRAL_ROW_OFFSET,
CENTRAL_COL_OFFSET,
CENTRAL_ROW,
CENTRAL_COL,
SIZE,
>::new(direct_pins, debouncer, low_active);
#[cfg(not(feature = "col2row"))]
let matrix = CentralDirectPinMatrix::<
In,
_,
CENTRAL_ROW_OFFSET,
CENTRAL_COL_OFFSET,
CENTRAL_COL,
CENTRAL_ROW,
CENTRAL_COL,
SIZE,
>::new(direct_pins, debouncer, low_active);

Expand Down
14 changes: 3 additions & 11 deletions rmk/src/split/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,21 @@ pub async fn run_rmk_split_peripheral_direct_pin<
const COL: usize,
const SIZE: usize,
>(
#[cfg(feature = "col2row")] direct_pins: [[Option<In>; COL]; ROW],
#[cfg(not(feature = "col2row"))] direct_pins: [[Option<In>; ROW]; COL],
direct_pins: [[Option<In>; COL]; ROW],
#[cfg(feature = "_nrf_ble")] central_addr: [u8; 6],
#[cfg(feature = "_nrf_ble")] peripheral_addr: [u8; 6],
low_active: bool,
#[cfg(not(feature = "_nrf_ble"))] serial: S,
#[cfg(feature = "_nrf_ble")] spawner: Spawner,
) {
// Create the debouncer, use COL2ROW by default
#[cfg(all(feature = "col2row", feature = "rapid_debouncer"))]
let debouncer = RapidDebouncer::<COL, ROW>::new();
#[cfg(all(feature = "col2row", not(feature = "rapid_debouncer")))]
let debouncer = DefaultDebouncer::<COL, ROW>::new();
#[cfg(all(not(feature = "col2row"), feature = "rapid_debouncer"))]
#[cfg(feature = "rapid_debouncer")]
let debouncer = RapidDebouncer::<COL, ROW>::new();
#[cfg(all(not(feature = "col2row"), not(feature = "rapid_debouncer")))]
#[cfg(not(feature = "rapid_debouncer"))]
let debouncer = DefaultDebouncer::<COL, ROW>::new();

// Keyboard matrix
#[cfg(feature = "col2row")]
let matrix = DirectPinMatrix::<_, _, ROW, COL, SIZE>::new(direct_pins, debouncer, low_active);
#[cfg(not(feature = "col2row"))]
let matrix = DirectPinMatrix::<_, _, COL, ROW, SIZE>::new(direct_pins, debouncer, low_active);

#[cfg(not(feature = "_nrf_ble"))]
initialize_serial_split_peripheral_and_run::<_, S, ROW, COL>(matrix, serial).await;
Expand Down

0 comments on commit 2db0066

Please sign in to comment.