Skip to content

Commit

Permalink
revert!: remove encoders API
Browse files Browse the repository at this point in the history
Signed-off-by: Haobo Gu <[email protected]>
  • Loading branch information
HaoboGu committed Jan 3, 2025
1 parent 6782546 commit 017ab7d
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 106 deletions.
1 change: 0 additions & 1 deletion examples/use_config/stm32h7/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ mod my_keyboard {
driver,
f,
&mut get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/ch32v307/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ async fn main(spawner: Spawner) -> ! {
driver,
// rmk::EmptyFlashWrapper::new(),
&mut default_keymap,
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/esp32c3_ble/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ fn main() {
input_pins,
output_pins,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
));
}
1 change: 0 additions & 1 deletion examples/use_rust/esp32c6_ble/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ fn main() {
input_pins,
output_pins,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
));
}
1 change: 0 additions & 1 deletion examples/use_rust/esp32s3_ble/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ fn main() {
input_pins,
output_pins,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
));
}
1 change: 0 additions & 1 deletion examples/use_rust/hpm5300/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ async fn main(spawner: Spawner) {
usb_driver,
flash,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/nrf52832_ble/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ async fn main(spawner: Spawner) {
input_pins,
output_pins,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/nrf52840/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ async fn main(spawner: Spawner) {
driver,
f,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/nrf52840_ble/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ async fn main(spawner: Spawner) {
output_pins,
driver,
&mut keymap::get_default_keymap(),
Some(&mut keymap::get_default_encoder_map()),
keyboard_config,
spawner,
),
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/nrf52840_ble_split/src/central.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ async fn main(spawner: Spawner) {
output_pins,
driver,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
central_addr,
spawner,
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/py32f07x/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ async fn main(spawner: Spawner) {
driver,
// flash,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/rp2040/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ async fn main(spawner: Spawner) {
driver,
flash,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/rp2040_direct_pin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ async fn main(spawner: Spawner) {
driver,
flash,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
true,
spawner,
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/rp2040_split/src/central.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ async fn main(spawner: Spawner) {
driver,
flash,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
),
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/stm32f1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ async fn main(spawner: Spawner) {
driver,
f,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/stm32f4/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ async fn main(spawner: Spawner) {
driver,
f,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/stm32h7/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ async fn main(spawner: Spawner) {
driver,
f,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
1 change: 0 additions & 1 deletion examples/use_rust/stm32h7_async/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ async fn main(spawner: Spawner) {
driver,
f,
&mut keymap::get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand Down
12 changes: 0 additions & 12 deletions rmk-macro/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ pub(crate) fn rmk_entry_direct_pin(keyboard_config: &KeyboardConfig) -> TokenStr
driver,
f,
&mut get_default_keymap(),
None,
keyboard_config,
low_active,
spawner,
Expand All @@ -78,7 +77,6 @@ pub(crate) fn rmk_entry_direct_pin(keyboard_config: &KeyboardConfig) -> TokenStr
driver,
f,
&mut get_default_keymap(),
None,
keyboard_config,
low_active,
spawner
Expand All @@ -91,7 +89,6 @@ pub(crate) fn rmk_entry_direct_pin(keyboard_config: &KeyboardConfig) -> TokenStr
direct_pins,
driver,
&mut get_default_keymap(),
None,
keyboard_config,
low_active,
spawner,
Expand All @@ -102,7 +99,6 @@ pub(crate) fn rmk_entry_direct_pin(keyboard_config: &KeyboardConfig) -> TokenStr
::rmk::direct_pin::run_rmk_direct_pin::<_, ::embassy_nrf::gpio::Output, ROW, COL, SIZE, NUM_LAYER>(
direct_pins,
&mut get_default_keymap(),
None,
keyboard_config,
low_active,
spawner,
Expand All @@ -117,7 +113,6 @@ pub(crate) fn rmk_entry_direct_pin(keyboard_config: &KeyboardConfig) -> TokenStr
driver,
flash,
&mut get_default_keymap(),
None,
keyboard_config,
low_active,
spawner,
Expand All @@ -128,7 +123,6 @@ pub(crate) fn rmk_entry_direct_pin(keyboard_config: &KeyboardConfig) -> TokenStr
::esp_idf_svc::hal::task::block_on(::rmk::direct_pin::run_rmk_direct_pin::<_, ::esp_idf_svc::hal::gpio::Output, ROW, COL, SIZE, NUM_LAYER>(
direct_pins,
&mut get_default_keymap(),
None,
keyboard_config,
low_active,
));
Expand All @@ -146,7 +140,6 @@ pub(crate) fn rmk_entry_default(keyboard_config: &KeyboardConfig) -> TokenStream
driver,
f,
&mut get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand All @@ -162,7 +155,6 @@ pub(crate) fn rmk_entry_default(keyboard_config: &KeyboardConfig) -> TokenStream
driver,
f,
&mut get_default_keymap(),
None,
keyboard_config,
spawner
)
Expand All @@ -175,7 +167,6 @@ pub(crate) fn rmk_entry_default(keyboard_config: &KeyboardConfig) -> TokenStream
output_pins,
driver,
&mut get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand All @@ -186,7 +177,6 @@ pub(crate) fn rmk_entry_default(keyboard_config: &KeyboardConfig) -> TokenStream
input_pins,
output_pins,
&mut get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand All @@ -201,7 +191,6 @@ pub(crate) fn rmk_entry_default(keyboard_config: &KeyboardConfig) -> TokenStream
driver,
flash,
&mut get_default_keymap(),
None,
keyboard_config,
spawner,
)
Expand All @@ -212,7 +201,6 @@ pub(crate) fn rmk_entry_default(keyboard_config: &KeyboardConfig) -> TokenStream
input_pins,
output_pins,
&mut get_default_keymap(),
None,
keyboard_config,
));
},
Expand Down
12 changes: 6 additions & 6 deletions rmk-macro/src/split/central.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ fn expand_split_central_entry(
#central_row_offset,
#central_col_offset,
NUM_LAYER,
>(input_pins, output_pins, driver, flash, &mut get_default_keymap(), None, keyboard_config, , spawner)
>(input_pins, output_pins, driver, flash, &mut get_default_keymap(), keyboard_config, , spawner)
},
MatrixType::direct_pin => quote! {
::rmk::split::central::run_rmk_split_central_direct_pin::<
Expand All @@ -242,7 +242,7 @@ fn expand_split_central_entry(
#central_col_offset,
NUM_LAYER,
SIZE,
>(direct_pins, driver, flash, &mut get_default_keymap(), None, keyboard_config, #low_active, spawner)
>(direct_pins, driver, flash, &mut get_default_keymap(), keyboard_config, #low_active, spawner)
},
};
let mut tasks = vec![central_task];
Expand Down Expand Up @@ -291,7 +291,7 @@ fn expand_split_central_entry(
#central_row_offset,
#central_col_offset,
NUM_LAYER,
>(input_pins, output_pins, driver, &mut get_default_keymap(), None, keyboard_config, [#(#central_addr), *], spawner)
>(input_pins, output_pins, driver, &mut get_default_keymap(), keyboard_config, [#(#central_addr), *], spawner)
},
MatrixType::direct_pin => quote! {
::rmk::split::central::run_rmk_split_central_direct_pin::<
Expand All @@ -306,7 +306,7 @@ fn expand_split_central_entry(
#central_col_offset,
NUM_LAYER,
SIZE,
>(direct_pins, driver, &mut get_default_keymap(), None, keyboard_config, #low_active, [#(#central_addr), *], spawner)
>(direct_pins, driver, &mut get_default_keymap(), keyboard_config, #low_active, [#(#central_addr), *], spawner)
},
};
let mut tasks = vec![central_task];
Expand Down Expand Up @@ -342,7 +342,7 @@ fn expand_split_central_entry(
#central_row_offset,
#central_col_offset,
NUM_LAYER,
>(input_pins, output_pins, driver, flash, &mut get_default_keymap(), None, keyboard_config, spawner)
>(input_pins, output_pins, driver, flash, &mut get_default_keymap(), keyboard_config, spawner)
},
MatrixType::direct_pin => quote! {
::rmk::split::central::run_rmk_split_central_direct_pin::<
Expand All @@ -358,7 +358,7 @@ fn expand_split_central_entry(
#central_col_offset,
NUM_LAYER,
SIZE,
>(direct_pins, driver, flash, &mut get_default_keymap(), None, keyboard_config, #low_active, spawner)
>(direct_pins, driver, flash, &mut get_default_keymap(), keyboard_config, #low_active, spawner)
},
};
let mut tasks = vec![central_task];
Expand Down
4 changes: 2 additions & 2 deletions rmk/src/ble/esp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) async fn initialize_esp_ble_keyboard_with_config_and_run<
>(
mut matrix: M,
default_keymap: &mut [[[KeyAction; COL]; ROW]; NUM_LAYER],
encoder_map: Option<&mut [[(KeyAction, KeyAction); 2]; NUM_LAYER]>,

keyboard_config: RmkConfig<'static, Out>,
) -> ! {
let f = Partition::new(PartitionType::Custom, Some(c"rmk"));
Expand All @@ -61,7 +61,7 @@ pub(crate) async fn initialize_esp_ble_keyboard_with_config_and_run<
.await;

let keymap = RefCell::new(
KeyMap::new_from_storage(default_keymap, encoder_map, Some(&mut storage)).await,
KeyMap::new_from_storage(default_keymap, Some(&mut storage)).await,
);

let keyboard_report_sender = KEYBOARD_REPORT_CHANNEL.sender();
Expand Down
4 changes: 2 additions & 2 deletions rmk/src/ble/nrf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub(crate) async fn initialize_nrf_ble_keyboard_and_run<
mut matrix: M,
#[cfg(not(feature = "_no_usb"))] usb_driver: D,
default_keymap: &mut [[[KeyAction; COL]; ROW]; NUM_LAYER],
encoder_map: Option<&mut [[(KeyAction, KeyAction); 2]; NUM_LAYER]>,

mut keyboard_config: RmkConfig<'static, Out>,
ble_addr: Option<[u8; 6]>,
spawner: Spawner,
Expand All @@ -252,7 +252,7 @@ pub(crate) async fn initialize_nrf_ble_keyboard_and_run<
let flash = Flash::take(sd);
let mut storage = Storage::new(flash, default_keymap, keyboard_config.storage_config).await;
let keymap = RefCell::new(
KeyMap::new_from_storage(default_keymap, encoder_map, Some(&mut storage)).await,
KeyMap::new_from_storage(default_keymap, Some(&mut storage)).await,
);

let mut buf: [u8; 128] = [0; 128];
Expand Down
Loading

0 comments on commit 017ab7d

Please sign in to comment.