From 3ca6dd6fe72545476710ed18c13b1363076a8f2d Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Mon, 19 Feb 2024 00:36:47 +0800 Subject: [PATCH] refactor: reformat code Signed-off-by: Haobo Gu --- boards/nrf52840/memory.x | 5 ++--- boards/nrf52840/src/vial.rs | 1 - boards/rp2040/src/keymap.rs | 1 - boards/rp2040/src/macros.rs | 2 +- boards/rp2040/src/main.rs | 6 +++++- boards/rp2040/src/vial.rs | 1 - boards/stm32f4/src/vial.rs | 2 +- boards/stm32h7/src/main.rs | 2 +- boards/stm32h7/src/vial.rs | 1 - rmk/src/keymap.rs | 8 ++++---- rmk/src/lib.rs | 10 +++++----- 11 files changed, 19 insertions(+), 20 deletions(-) diff --git a/boards/nrf52840/memory.x b/boards/nrf52840/memory.x index 6625284b..e0c728c1 100644 --- a/boards/nrf52840/memory.x +++ b/boards/nrf52840/memory.x @@ -5,7 +5,6 @@ MEMORY RAM : ORIGIN = 0x20000000, LENGTH = 256K /* These values correspond to the NRF52840 with Softdevices S140 7.3.0 */ - /* FLASH : ORIGIN = 0x00027000, LENGTH = 868K - RAM : ORIGIN = 0x20020000, LENGTH = 128K */ - + /* FLASH : ORIGIN = 0x00027000, LENGTH = 868K + RAM : ORIGIN = 0x20020000, LENGTH = 128K */ } \ No newline at end of file diff --git a/boards/nrf52840/src/vial.rs b/boards/nrf52840/src/vial.rs index 9c3362cf..9db93ef6 100644 --- a/boards/nrf52840/src/vial.rs +++ b/boards/nrf52840/src/vial.rs @@ -26,4 +26,3 @@ include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); // 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, // 0x00, 0x04, 0x59, 0x5A, // ]; - diff --git a/boards/rp2040/src/keymap.rs b/boards/rp2040/src/keymap.rs index ef134597..40dd1b3f 100644 --- a/boards/rp2040/src/keymap.rs +++ b/boards/rp2040/src/keymap.rs @@ -19,4 +19,3 @@ pub static KEYMAP: [[[KeyAction; COL]; ROW]; NUM_LAYER] = [ [mo!(1), a!(No), k!(Kp0)] ]), ]; - diff --git a/boards/rp2040/src/macros.rs b/boards/rp2040/src/macros.rs index 37938a02..249b878a 100644 --- a/boards/rp2040/src/macros.rs +++ b/boards/rp2040/src/macros.rs @@ -9,4 +9,4 @@ macro_rules! config_matrix_pins_rp { (input_pins, output_pins) } }; -} \ No newline at end of file +} diff --git a/boards/rp2040/src/main.rs b/boards/rp2040/src/main.rs index 2b4e7769..ca721a20 100644 --- a/boards/rp2040/src/main.rs +++ b/boards/rp2040/src/main.rs @@ -20,7 +20,11 @@ use embassy_rp::{ usb::{Driver, InterruptHandler}, }; use panic_probe as _; -use rmk::{config::{RmkConfig, KeyboardUsbConfig, VialConfig}, initialize_keyboard_with_config_and_run, keymap::KeyMap}; +use rmk::{ + config::{KeyboardUsbConfig, RmkConfig, VialConfig}, + initialize_keyboard_with_config_and_run, + keymap::KeyMap, +}; use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; diff --git a/boards/rp2040/src/vial.rs b/boards/rp2040/src/vial.rs index 9c3362cf..9db93ef6 100644 --- a/boards/rp2040/src/vial.rs +++ b/boards/rp2040/src/vial.rs @@ -26,4 +26,3 @@ include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); // 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, // 0x00, 0x04, 0x59, 0x5A, // ]; - diff --git a/boards/stm32f4/src/vial.rs b/boards/stm32f4/src/vial.rs index 4d2f5471..38ba54fc 100644 --- a/boards/stm32f4/src/vial.rs +++ b/boards/stm32f4/src/vial.rs @@ -20,4 +20,4 @@ pub const VIAL_KEYBOARD_DEF: [u8; 308] = [ 0x00, 0x00, 0x00, 0x00, 0xF5, 0x5B, 0x73, 0xB4, 0xF2, 0x19, 0x3D, 0xF2, 0x00, 0x01, 0x8D, 0x02, 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5A, -]; \ No newline at end of file +]; diff --git a/boards/stm32h7/src/main.rs b/boards/stm32h7/src/main.rs index 923519da..b2d17253 100644 --- a/boards/stm32h7/src/main.rs +++ b/boards/stm32h7/src/main.rs @@ -24,7 +24,7 @@ use embassy_stm32::{ }; use panic_probe as _; use rmk::{ - config::{RmkConfig, KeyboardUsbConfig, VialConfig}, + config::{KeyboardUsbConfig, RmkConfig, VialConfig}, initialize_keyboard_with_config_and_run, keymap::KeyMap, }; diff --git a/boards/stm32h7/src/vial.rs b/boards/stm32h7/src/vial.rs index 9c3362cf..9db93ef6 100644 --- a/boards/stm32h7/src/vial.rs +++ b/boards/stm32h7/src/vial.rs @@ -26,4 +26,3 @@ include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); // 0xD9, 0x02, 0x00, 0x00, 0xC6, 0xA2, 0x63, 0x43, 0xB1, 0xC4, 0x67, 0xFB, 0x02, 0x00, 0x00, 0x00, // 0x00, 0x04, 0x59, 0x5A, // ]; - diff --git a/rmk/src/keymap.rs b/rmk/src/keymap.rs index 4d8c5cfc..4efad332 100644 --- a/rmk/src/keymap.rs +++ b/rmk/src/keymap.rs @@ -20,9 +20,9 @@ pub(crate) struct KeyMapConfig { } /// Keymap represents the stack of layers. -/// +/// /// The conception of Keymap in rmk is borrowed from qmk: . -/// +/// /// Keymap should be binded to the actual pcb matrix definition. /// RMK detects hardware key strokes, uses tuple `(row, col, layer)` to retrieve the action from Keymap. pub struct KeyMap< @@ -53,9 +53,9 @@ impl< > KeyMap { /// Initialize a keymap from a matrix of actions - /// + /// /// # Arguments - /// + /// /// * `action_map` - [KeyAction] matrix defined in keymap /// * `storage` - backend storage for eeprom, used for saving keyboard data persistently /// * `eeconfig` - keyboard configurations which should be stored in eeprom diff --git a/rmk/src/lib.rs b/rmk/src/lib.rs index 3188cb5d..88338031 100644 --- a/rmk/src/lib.rs +++ b/rmk/src/lib.rs @@ -5,7 +5,7 @@ // Enable std in test #![cfg_attr(not(test), no_std)] -use config::{RmkConfig, KeyboardUsbConfig, VialConfig}; +use config::{KeyboardUsbConfig, RmkConfig, VialConfig}; use core::{cell::RefCell, convert::Infallible}; use defmt::{error, info}; use embassy_futures::join::join; @@ -62,9 +62,9 @@ pub(crate) fn initialize_keyboard_and_usb_device< } /// Initialize and run the keyboard service, with given keyboard usb config. This function never returns. -/// +/// /// # Arguments -/// +/// /// * `driver` - embassy usb driver instance /// * `input_pins` - input gpio pins /// * `output_pins` - output gpio pins @@ -138,9 +138,9 @@ pub async fn initialize_keyboard_with_config_and_run< } /// Initialize and run the keyboard service, this function never returns. -/// +/// /// # Arguments -/// +/// /// * `driver` - embassy usb driver instance /// * `input_pins` - input gpio pins /// * `output_pins` - output gpio pins