From af6a7785db7d95415d3f87d64e58cdcdc5d0ab4b Mon Sep 17 00:00:00 2001 From: HaoboGu Date: Tue, 28 Nov 2023 22:12:31 +0800 Subject: [PATCH] refactor(core): re-export usb crates in rmk Signed-off-by: HaoboGu --- Cargo.lock | 4 ---- boards/rp2040/Cargo.toml | 2 -- boards/rp2040/src/main.rs | 2 +- boards/stm32h7/Cargo.toml | 2 -- boards/stm32h7/src/main.rs | 2 +- rmk/src/lib.rs | 3 +++ 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 747c575a..5aa0d33a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -556,8 +556,6 @@ dependencies = [ "rp-pico", "rtic", "rtic-monotonics", - "usb-device", - "usbd-hid", ] [[package]] @@ -575,8 +573,6 @@ dependencies = [ "rtic-monotonics", "rtt-target 0.4.0", "stm32h7xx-hal", - "usb-device", - "usbd-hid", ] [[package]] diff --git a/boards/rp2040/Cargo.toml b/boards/rp2040/Cargo.toml index 6190d553..4d07aaca 100644 --- a/boards/rp2040/Cargo.toml +++ b/boards/rp2040/Cargo.toml @@ -33,8 +33,6 @@ cortex-m-rt = "0.7.3" log = "0.4.19" rtic = { version = "2.0.0", features = ["thumbv6-backend"] } rtic-monotonics = { version = "1.0.0", features = ["cortex-m-systick"] } -usb-device = "0.2.9" -usbd-hid = "0.6.1" [features] # avoid having to use --allow-multiple-definition linker flag diff --git a/boards/rp2040/src/main.rs b/boards/rp2040/src/main.rs index 4cdf681f..d89a8b25 100644 --- a/boards/rp2040/src/main.rs +++ b/boards/rp2040/src/main.rs @@ -17,6 +17,7 @@ mod app { use rmk::{ config::KEYBOARD_CONFIG, eeprom::EepromStorageConfig, flash::EmptyFlashWrapper, initialize_keyboard_and_usb_device, keyboard::Keyboard, usb::KeyboardUsbDevice, + usb_device::class_prelude::UsbBusAllocator, }; use rp_pico::{ hal::{ @@ -25,7 +26,6 @@ mod app { Pins, XOSC_CRYSTAL_FREQ, }; use rtic_monotonics::systick::*; - use usb_device::class_prelude::UsbBusAllocator; // Static usb bus instance static mut USB_BUS: Option> = None; diff --git a/boards/stm32h7/Cargo.toml b/boards/stm32h7/Cargo.toml index 52e257e9..51978a8c 100644 --- a/boards/stm32h7/Cargo.toml +++ b/boards/stm32h7/Cargo.toml @@ -32,8 +32,6 @@ rtt-target = "0.4.0" log = "0.4.19" rtic = { version = "2.0.1", features = ["thumbv7-backend"] } rtic-monotonics = { version = "1.0.0", features = ["cortex-m-systick"] } -usb-device = "0.2.9" -usbd-hid = "0.6.1" packed_struct = { version = "0.10.1", default-features = false } embedded-storage = { version = "0.3" } diff --git a/boards/stm32h7/src/main.rs b/boards/stm32h7/src/main.rs index f29cbdd1..8aec34a3 100644 --- a/boards/stm32h7/src/main.rs +++ b/boards/stm32h7/src/main.rs @@ -106,7 +106,7 @@ mod app { &ccdr.clocks, ); let usb_allocator = cortex_m::singleton!( - : usb_device::class_prelude::UsbBusAllocator> = + : rmk::usb_device::class_prelude::UsbBusAllocator> = UsbBus::new(usb, unsafe { &mut EP_MEMORY }) ) .unwrap(); diff --git a/rmk/src/lib.rs b/rmk/src/lib.rs index ebab041b..5d57d8ad 100644 --- a/rmk/src/lib.rs +++ b/rmk/src/lib.rs @@ -15,6 +15,9 @@ use keyboard::Keyboard; use usb::KeyboardUsbDevice; use usb_device::class_prelude::{UsbBus, UsbBusAllocator}; +pub use usb_device; +pub use usbd_hid; + pub mod action; pub mod config; pub mod debounce;