diff --git a/boards/rp2040/build.rs b/boards/rp2040/build.rs index d1acf42d..cfc8e37d 100644 --- a/boards/rp2040/build.rs +++ b/boards/rp2040/build.rs @@ -10,12 +10,17 @@ //! //! The build script also sets the linker flags to tell it which link script to use. -use std::env; +use const_gen::*; use std::fs::File; -use std::io::Write; -use std::path::PathBuf; +use std::io::{Read, Write}; +use std::path::{Path, PathBuf}; +use std::{env, fs}; +use xz2::read::XzEncoder; fn main() { + // Generate vial config at the root of project + generate_vial_config(); + // Put `memory.x` in our output directory and ensure it's // on the linker search path. let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); @@ -46,3 +51,32 @@ fn main() { println!("cargo:rustc-linker=flip-link"); } + +fn generate_vial_config() { + // Generated vial config file + let out_file = Path::new(&env::var_os("OUT_DIR").unwrap()).join("config_generated.rs"); + + let p = Path::new("vial.json"); + let mut content = String::new(); + match File::open(&p) { + Ok(mut file) => { + file.read_to_string(&mut content) + .expect("Cannot read vial.json"); + } + Err(e) => println!("Cannot find vial.json {:?}: {}", p, e), + }; + + let vial_cfg = json::stringify(json::parse(&content).unwrap()); + let mut keyboard_def_compressed: Vec = Vec::new(); + XzEncoder::new(vial_cfg.as_bytes(), 6) + .read_to_end(&mut keyboard_def_compressed) + .unwrap(); + + let keyboard_id: Vec = vec![0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; + let const_declarations = vec![ + const_declaration!(pub VIAL_KEYBOARD_DEF = keyboard_def_compressed), + const_declaration!(pub VIAL_KEYBOARD_ID = keyboard_id), + ] + .join("\n"); + fs::write(&out_file, const_declarations).unwrap(); +} diff --git a/boards/rp2040/src/main.rs b/boards/rp2040/src/main.rs index db134b0c..2b4e7769 100644 --- a/boards/rp2040/src/main.rs +++ b/boards/rp2040/src/main.rs @@ -20,7 +20,7 @@ use embassy_rp::{ usb::{Driver, InterruptHandler}, }; use panic_probe as _; -use rmk::{initialize_keyboard_and_run, keymap::KeyMap}; +use rmk::{config::{RmkConfig, KeyboardUsbConfig, VialConfig}, initialize_keyboard_with_config_and_run, keymap::KeyMap}; use static_cell::StaticCell; use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID}; @@ -63,8 +63,24 @@ async fn main(_spawner: Spawner) { None, ))); - // Initialize all utilities: keyboard, usb and keymap - initialize_keyboard_and_run::< + let keyboard_usb_config = KeyboardUsbConfig::new( + 0x4c4b, + 0x4643, + Some("Haobo"), + Some("RMK Keyboard"), + Some("00000001"), + ); + + let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); + + let keyboard_config = RmkConfig { + usb_config: keyboard_usb_config, + vial_config, + ..Default::default() + }; + + // Start serving + initialize_keyboard_with_config_and_run::< Driver<'_, USB>, Input<'_, AnyPin>, Output<'_, AnyPin>, @@ -73,13 +89,6 @@ async fn main(_spawner: Spawner) { ROW, COL, NUM_LAYER, - >( - driver, - input_pins, - output_pins, - keymap, - &VIAL_KEYBOARD_ID, - &VIAL_KEYBOARD_DEF, - ) + >(driver, input_pins, output_pins, keymap, keyboard_config) .await; } diff --git a/boards/rp2040/src/vial.rs b/boards/rp2040/src/vial.rs index 4d2f5471..9c3362cf 100644 --- a/boards/rp2040/src/vial.rs +++ b/boards/rp2040/src/vial.rs @@ -1,23 +1,29 @@ -pub const VIAL_KEYBOARD_ID: [u8; 8] = [0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; -pub const VIAL_KEYBOARD_DEF: [u8; 308] = [ - 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, - 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, - 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0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0x80, 0xCA, 0x37, 0x46, 0x7B, 0xC9, 0xF4, 0x39, 0x7B, 0x30, 0x0E, 0x22, 0xA6, 0xD3, - 0x18, 0x1B, 0xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, - 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, - 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 +// Use `build.rs` automatically generate vial config, according to `vial.json` +// Please put `vial.json` at your project's root +include!(concat!(env!("OUT_DIR"), "/config_generated.rs")); + +// Or you can manually generate vial config then put here +// pub const VIAL_KEYBOARD_ID: [u8; 8] = [0xB9, 0xBC, 0x09, 0xB2, 0x9D, 0x37, 0x4C, 0xEA]; +// pub const VIAL_KEYBOARD_DEF: [u8; 308] = [ +// 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x04, 0xE6, 0xD6, 0xB4, 0x46, 0x02, 0x00, 0x21, 0x01, +// 0x16, 0x00, 0x00, 0x00, 0x74, 0x2F, 0xE5, 0xA3, 0xE0, 0x01, 0x58, 0x00, 0xF1, 0x5D, 0x00, 0x3D, +// 0x88, 0x89, 0xC6, 0x54, 0x36, 0xC3, 0x17, 0x4F, 0xE4, 0xE2, 0x11, 0x2F, 0x22, 0xB0, 0xBC, 0xC8, +// 0x21, 0x18, 0x12, 0x8B, 0x06, 0x39, 0x42, 0xED, 0x2D, 0x7A, 0x5C, 0xC0, 0x20, 0x95, 0xFA, 0x59, +// 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xA7, 0x70, 0xB9, 0x14, 0x91, 0x13, 0xC2, 0x5F, 0x02, 0xD1, 0x1A, 0x62, 0x6B, 0xC6, +// 0xFC, 0xD3, 0x18, 0xC0, 0x62, 0xA5, 0xEA, 0xD0, 0xDF, 0x18, 0xDD, 0xD3, 0x53, 0x63, 0x11, 0x08, +// 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, +// ]; + diff --git a/boards/stm32h7/src/main.rs b/boards/stm32h7/src/main.rs index 15ce78d2..923519da 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::{KeyboardAdvancedConfig, KeyboardUsbConfig}, + config::{RmkConfig, KeyboardUsbConfig, VialConfig}, initialize_keyboard_with_config_and_run, keymap::KeyMap, }; @@ -111,8 +111,11 @@ async fn main(_spawner: Spawner) { Some("00000001"), ); - let keyboard_config = KeyboardAdvancedConfig { + let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF); + + let keyboard_config = RmkConfig { usb_config: keyboard_usb_config, + vial_config, ..Default::default() }; @@ -126,14 +129,6 @@ async fn main(_spawner: Spawner) { ROW, COL, NUM_LAYER, - >( - driver, - input_pins, - output_pins, - keymap, - keyboard_config, - VIAL_KEYBOARD_ID, - VIAL_KEYBOARD_DEF, - ) + >(driver, input_pins, output_pins, keymap, keyboard_config) .await; } diff --git a/rmk/src/config.rs b/rmk/src/config.rs index 92f6948a..b15203df 100644 --- a/rmk/src/config.rs +++ b/rmk/src/config.rs @@ -1,22 +1,43 @@ -// TODO: more configs need to be added, easy configuration -/// Advanced configurations for keyboard. +// TODO: more configs need to be added, easy configuration(from config file) +/// Configurations for RMK keyboard. #[derive(Debug, Default)] -pub struct KeyboardAdvancedConfig<'a> { +pub struct RmkConfig<'a> { pub mouse_config: MouseConfig, pub usb_config: KeyboardUsbConfig<'a>, + pub vial_config: VialConfig<'a>, +} + +/// Config for [vial](https://get.vial.today/). +/// +/// You can generate automatically using [`build.rs`](https://github.com/HaoboGu/rmk/blob/main/boards/stm32h7/build.rs). +#[derive(Debug, Default)] +pub struct VialConfig<'a> { + pub vial_keyboard_id: &'a [u8], + pub vial_keyboard_def: &'a [u8], +} + +impl<'a> VialConfig<'a> { + pub fn new(vial_keyboard_id: &'a [u8], vial_keyboard_def: &'a [u8]) -> Self { + Self { + vial_keyboard_id, + vial_keyboard_def, + } + } } /// Configuration for debouncing pub struct DebounceConfig { - pub debounce_time: u32 + /// Debounce time in ms + pub debounce_time: u32, } /// Configurations for mouse functionalities #[derive(Debug)] pub struct MouseConfig { + /// Time interval in ms of reporting mouse cursor states pub mouse_key_interval: u32, + /// Time interval in ms of reporting mouse wheel states pub mouse_wheel_interval: u32, - pub mouse_time_to_max: u32, } impl Default for MouseConfig { @@ -24,7 +45,6 @@ impl Default for MouseConfig { Self { mouse_key_interval: 20, mouse_wheel_interval: 80, - mouse_time_to_max: 80, } } } @@ -41,10 +61,15 @@ pub struct RGBLightConfig { /// Configurations for usb #[derive(Debug)] pub struct KeyboardUsbConfig<'a> { + /// Vender id pub vid: u16, + /// Product id pub pid: u16, + /// Manufacturer pub manufacturer: Option<&'a str>, + /// Product name pub product_name: Option<&'a str>, + /// Serial number pub serial_number: Option<&'a str>, } diff --git a/rmk/src/keycode.rs b/rmk/src/keycode.rs index d8647827..8f82f90e 100644 --- a/rmk/src/keycode.rs +++ b/rmk/src/keycode.rs @@ -3,9 +3,11 @@ use num_enum::FromPrimitive; use packed_struct::prelude::*; use usbd_hid::descriptor::{MediaKey, SystemControlKey}; -/// To represent all combinations of modifiers, at least 5 bits are needed: +/// To represent all combinations of modifiers, at least 5 bits are needed. /// 1 bit for Left/Right, 4 bits for modifier type. -/// | x | x | x | x | x | +/// +/// | bit0 | bit1 | bit2 | bit3 | bit4 | +/// | --- | --- | --- | --- | --- | /// | L/R | GUI | ALT |SHIFT| CTRL| #[derive(PackedStruct, Clone, Copy, Debug, Format, Default, Eq, PartialEq)] #[packed_struct(bit_numbering = "lsb0", size_bytes = "1")] diff --git a/rmk/src/lib.rs b/rmk/src/lib.rs index a896d5ec..3188cb5d 100644 --- a/rmk/src/lib.rs +++ b/rmk/src/lib.rs @@ -5,6 +5,7 @@ // Enable std in test #![cfg_attr(not(test), no_std)] +use config::{RmkConfig, KeyboardUsbConfig, VialConfig}; use core::{cell::RefCell, convert::Infallible}; use defmt::{error, info}; use embassy_futures::join::join; @@ -13,7 +14,6 @@ use embassy_usb::driver::Driver; use embedded_hal::digital::{InputPin, OutputPin}; use embedded_storage::nor_flash::NorFlash; use keyboard::Keyboard; -use config::{KeyboardAdvancedConfig, KeyboardUsbConfig}; use keymap::KeyMap; use usb::KeyboardUsbDevice; use via::process::VialService; @@ -47,7 +47,7 @@ pub(crate) fn initialize_keyboard_and_usb_device< input_pins: [In; ROW], output_pins: [Out; COL], keymap: &'static RefCell>, - vial_keyboard_Id: &'static [u8], + vial_keyboard_id: &'static [u8], vial_keyboard_def: &'static [u8], ) -> ( Keyboard<'static, In, Out, F, EEPROM_SIZE, ROW, COL, NUM_LAYER>, @@ -57,11 +57,19 @@ pub(crate) fn initialize_keyboard_and_usb_device< ( Keyboard::new(input_pins, output_pins, keymap), KeyboardUsbDevice::new(driver, KeyboardUsbConfig::default()), - VialService::new(keymap, vial_keyboard_Id, vial_keyboard_def), + VialService::new(keymap, VialConfig::new(vial_keyboard_id, vial_keyboard_def)), ) } /// 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 +/// * `keymap` - default keymap definition +/// * `keyboard_config` - other configurations of the keyboard, check [RmkConfig] struct for details pub async fn initialize_keyboard_with_config_and_run< 'a, D: Driver<'static>, @@ -77,16 +85,14 @@ pub async fn initialize_keyboard_with_config_and_run< input_pins: [In; ROW], output_pins: [Out; COL], keymap: &'static RefCell>, - keyboard_config: KeyboardAdvancedConfig<'static>, - vial_keyboard_Id: &'static [u8], - vial_keyboard_def: &'static [u8], + keyboard_config: RmkConfig<'static>, ) -> ! { // Keyboard state defined in protocol, aka capslock/numslock/scrolllock let keyboard_state = RefCell::new(0); let (mut keyboard, mut usb_device, vial_service) = ( Keyboard::new(input_pins, output_pins, keymap), KeyboardUsbDevice::new(driver, keyboard_config.usb_config), - VialService::new(keymap, vial_keyboard_Id, vial_keyboard_def), + VialService::new(keymap, keyboard_config.vial_config), ); let usb_fut = usb_device.device.run(); @@ -132,6 +138,14 @@ 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 +/// * `keymap` - default keymap definition +/// * `vial_keyboard_id`/`vial_keyboard_def` - generated keyboard id and definition for vial, you can generate automatically using [`build.rs`](https://github.com/HaoboGu/rmk/blob/main/boards/stm32h7/build.rs) pub async fn initialize_keyboard_and_run< D: Driver<'static>, In: InputPin, @@ -146,54 +160,20 @@ pub async fn initialize_keyboard_and_run< input_pins: [In; ROW], output_pins: [Out; COL], keymap: &'static RefCell>, - vial_keyboard_Id: &'static [u8], + vial_keyboard_id: &'static [u8], vial_keyboard_def: &'static [u8], ) -> ! { - let keyboard_state = RefCell::new(0); - let (mut keyboard, mut usb_device, vial_service) = ( - Keyboard::new(input_pins, output_pins, keymap), - KeyboardUsbDevice::new(driver, KeyboardUsbConfig::default()), - VialService::new(keymap, vial_keyboard_Id, vial_keyboard_def), - ); + let mut keyboard_config = RmkConfig::default(); + keyboard_config.vial_config = VialConfig::new(vial_keyboard_id, vial_keyboard_def); - let usb_fut = usb_device.device.run(); - let keyboard_fut = async { - loop { - let _ = keyboard.keyboard_task().await; - keyboard - .send_report(&mut usb_device.keyboard_hid_writer) - .await; - keyboard.send_other_report(&mut usb_device.other_hid).await; - } - }; - - let led_reader_fut = async { - let mut read_state: [u8; 1] = [0; 1]; - loop { - match usb_device.keyboard_hid_reader.read(&mut read_state).await { - Ok(_) => { - info!("Read keyboard state: {}", read_state); - let mut c = keyboard_state.borrow_mut(); - *c = read_state[0]; - // TODO: Updating of keyboard state should trigger changing of LED, or other actions - // Option 1: Update keyboard state only, the state is checked at main loop, GPIO is updated accordingly then - // Option 2: Trigger updating of LED after read a new keyboard state value - } - Err(e) => error!("Read keyboard state error: {}", e), - }; - Timer::after_millis(10).await; - } - }; - - let via_fut = async { - loop { - vial_service - .process_via_report(&mut usb_device.via_hid) - .await; - Timer::after_millis(1).await; - } - }; - join(usb_fut, join(join(keyboard_fut, led_reader_fut), via_fut)).await; + initialize_keyboard_with_config_and_run( + driver, + input_pins, + output_pins, + keymap, + keyboard_config, + ) + .await; panic!("Keyboard service is died") } diff --git a/rmk/src/via/process.rs b/rmk/src/via/process.rs index 9a5c42e4..6d2dd761 100644 --- a/rmk/src/via/process.rs +++ b/rmk/src/via/process.rs @@ -2,6 +2,7 @@ use core::cell::RefCell; use super::{protocol::*, vial::process_vial}; use crate::{ + config::VialConfig, keymap::KeyMap, usb::descriptor::ViaReport, via::keycode_convert::{from_via_keycode, to_via_keycode}, @@ -28,9 +29,7 @@ pub(crate) struct VialService< keymap: &'a RefCell>, // Vial config - vial_keyboard_id: &'a [u8], - - vial_keyboard_def: &'a [u8], + vial_config: VialConfig<'a>, } impl< @@ -44,13 +43,11 @@ impl< { pub(crate) fn new( keymap: &'a RefCell>, - vial_keyboard_id: &'a [u8], - vial_keyboard_def: &'a [u8], + vial_config: VialConfig<'a>, ) -> Self { Self { keymap, - vial_keyboard_id, - vial_keyboard_def, + vial_config, } } @@ -281,7 +278,11 @@ impl< ViaCommand::DynamicKeymapSetEncoder => { warn!("Keymap get encoder -- not supported"); } - ViaCommand::Vial => process_vial(report, self.vial_keyboard_id, self.vial_keyboard_def), + ViaCommand::Vial => process_vial( + report, + self.vial_config.vial_keyboard_id, + self.vial_config.vial_keyboard_def, + ), ViaCommand::Unhandled => report.input_data[0] = ViaCommand::Unhandled as u8, } }