workspace with shared hid shape for cli

This commit is contained in:
2026-05-18 23:58:23 -07:00
parent 4e3f1f52ca
commit 4c2384fba5
20 changed files with 1302 additions and 58 deletions
+9 -3
View File
@@ -1,9 +1,15 @@
repos: repos:
- repo: local - repo: local
hooks: hooks:
- id: cargo-check - id: cargo-check-host
name: Cargo check name: Cargo check (host)
entry: cargo check entry: cargo check -p cli -p shared
pass_filenames: false
types: [file, rust]
language: system
- id: cargo-check-firmware
name: Cargo check (firmware)
entry: cargo check -p guac --target thumbv8m.main-none-eabihf
pass_filenames: false pass_filenames: false
types: [file, rust] types: [file, rust]
language: system language: system
Generated
+32 -17
View File
@@ -132,9 +132,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.61" version = "1.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"shlex", "shlex",
@@ -156,6 +156,13 @@ dependencies = [
"inout", "inout",
] ]
[[package]]
name = "cli"
version = "0.1.0"
dependencies = [
"shared",
]
[[package]] [[package]]
name = "const-init" name = "const-init"
version = "1.0.0" version = "1.0.0"
@@ -227,14 +234,14 @@ version = "0.3.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad"
dependencies = [ dependencies = [
"defmt 1.0.1", "defmt 1.1.0",
] ]
[[package]] [[package]]
name = "defmt" name = "defmt"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" checksum = "a6e524506490a1953d237cb87b1cfc1e46f88c18f10a22dfe0f507dc6bfc7f7f"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"defmt-macros", "defmt-macros",
@@ -242,9 +249,9 @@ dependencies = [
[[package]] [[package]]
name = "defmt-macros" name = "defmt-macros"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" checksum = "f0a27770e9c8f719a79d8b638281f4d828f77d8fd61e0bd94451b9b85e576a0b"
dependencies = [ dependencies = [
"defmt-parser", "defmt-parser",
"proc-macro-error2", "proc-macro-error2",
@@ -264,12 +271,12 @@ dependencies = [
[[package]] [[package]]
name = "defmt-rtt" name = "defmt-rtt"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e" checksum = "c0f73a4a4a91609e977ae3b7bd831ffa292edfd42ad140a3244a61d805b0e05e"
dependencies = [ dependencies = [
"critical-section", "critical-section",
"defmt 1.0.1", "defmt 1.1.0",
] ]
[[package]] [[package]]
@@ -357,7 +364,7 @@ dependencies = [
"bytemuck", "bytemuck",
"cortex-m", "cortex-m",
"cortex-m-rt", "cortex-m-rt",
"defmt 1.0.1", "defmt 1.1.0",
"defmt-rtt", "defmt-rtt",
"embedded-hal", "embedded-hal",
"embedded-io", "embedded-io",
@@ -366,6 +373,7 @@ dependencies = [
"nb 1.1.0", "nb 1.1.0",
"panic-halt", "panic-halt",
"panic-probe", "panic-probe",
"shared",
"static_cell", "static_cell",
"usb-device", "usb-device",
"usbd-hid", "usbd-hid",
@@ -682,23 +690,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a"
dependencies = [ dependencies = [
"cortex-m", "cortex-m",
"defmt 1.0.1", "defmt 1.1.0",
] ]
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.1.12" version = "1.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf0d9e68100b3a7989b4901972f265cd542e560a3a8a724e1e20322f4d06ce9" checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "1.1.12" version = "1.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a990e22f43e84855daf260dded30524ef4a9021cc7541c26540500a50b624389" checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -875,6 +883,13 @@ dependencies = [
"lazy_static", "lazy_static",
] ]
[[package]]
name = "shared"
version = "0.0.0"
dependencies = [
"usbd-hid",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.3.0" version = "1.3.0"
@@ -1083,7 +1098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117c289dcd316caa7aca9c0909117d8cf9d35f3ed2e7a5739067f0bcedc93e35" checksum = "117c289dcd316caa7aca9c0909117d8cf9d35f3ed2e7a5739067f0bcedc93e35"
dependencies = [ dependencies = [
"byteorder-embedded-io", "byteorder-embedded-io",
"defmt 1.0.1", "defmt 1.1.0",
"embedded-io", "embedded-io",
"modular-bitfield", "modular-bitfield",
"num-traits", "num-traits",
+8 -37
View File
@@ -1,38 +1,9 @@
[package] [workspace]
name = "guac" members = [
version = "0.1.0" "firmware",
edition = "2024" "cli",
"shared"
]
resolver = "2"
[features] default-members = ["cli", "shared"]
default = ["nodac", "hid"]
ak4490 = []
cs4398 = []
nodac = []
hid = [ "dep:usbd-hid"]
[dependencies]
atomic = "0.6.1"
bbqueue = "0.7.0"
bytemuck = { version = "1.25.0", features = ["derive"] }
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.5"
defmt = "1.0.1"
defmt-rtt = "1.1.0"
embedded-hal = "0.2.7"
embedded-io = "0.7.1"
log-to-defmt = "0.1.0"
# Includes update to usb-device 0.3, fix for isochronous and smaller critical sections
lpc55-hal = { git = "https://github.com/ktims/lpc55-hal", branch = "main" }
nb = "1.1.0"
panic-halt = "1.0.0"
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
static_cell = "2.1.1"
usb-device = { version = "0.3", features = ["control-buffer-256"] }
usbd-hid = { version = "0.10.0", optional = true }
usbd-uac2 = { version = "0.1.0", features = ["defmt"]}
[profile.release]
opt-level = "z"
lto = true
debug = true
codegen-units = 1
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "cli"
version = "0.1.0"
edition = "2024"
[dependencies]
shared = { path = "../shared" }
+3
View File
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
+1168
View File
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
[package]
name = "guac"
version = "0.1.0"
edition = "2024"
[features]
default = ["nodac", "hid"]
ak4490 = []
cs4398 = []
nodac = []
hid = [ "dep:usbd-hid", "dep:shared" ]
[dependencies]
shared = { path="../shared", optional = true }
atomic = "0.6.1"
bbqueue = "0.7.0"
bytemuck = { version = "1.25.0", features = ["derive"] }
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.5"
defmt = "1.0.1"
defmt-rtt = "1.1.0"
embedded-hal = "0.2.7"
embedded-io = "0.7.1"
log-to-defmt = "0.1.0"
# Includes update to usb-device 0.3, fix for isochronous and smaller critical sections
lpc55-hal = { git = "https://github.com/ktims/lpc55-hal", branch = "main" }
nb = "1.1.0"
panic-halt = "1.0.0"
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
static_cell = "2.1.1"
usb-device = { version = "0.3", features = ["control-buffer-256"] }
usbd-hid = { version = "0.10.0", optional = true }
usbd-uac2 = { version = "0.1.0", features = ["defmt"]}
[profile.release]
opt-level = "z"
lto = true
debug = true
codegen-units = 1
+5
View File
@@ -0,0 +1,5 @@
// Find the actual path of memory.x and add it to link search, required for building in workspace
fn main() {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
println!("cargo:rustc-link-search={}", manifest_dir);
}
View File
View File
View File
View File
+1 -1
View File
@@ -39,8 +39,8 @@ use usbd_uac2::{
use crate::dac::DacImpl; use crate::dac::DacImpl;
use crate::dma::DmaRing; use crate::dma::DmaRing;
use crate::hid::AudioTelemetryReport;
use crate::traits::Dac; use crate::traits::Dac;
use shared::hid::AudioTelemetryReport;
#[cfg(feature = "ak4490")] #[cfg(feature = "ak4490")]
pub mod dac { pub mod dac {
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "shared"
edition = "2024"
[dependencies]
usbd-hid = { version = "0.10.0" }
+24
View File
@@ -0,0 +1,24 @@
#![no_std]
pub mod hid {
use usbd_hid::descriptor::generator_prelude::*;
#[gen_hid_descriptor(
(collection = APPLICATION, usage_page = VENDOR_DEFINED_START, usage = 0x01, ) = {
average_buffer_fill=input;
frame_count=input;
dac_underflow_count=input;
usb_underflow_count=input;
dac_overflow_count=input;
}
)]
#[repr(C)]
// Note these are all actually u32
pub struct AudioTelemetryReport {
pub average_buffer_fill: i32,
pub frame_count: i32,
pub dac_underflow_count: i32,
pub usb_underflow_count: i32,
pub dac_overflow_count: i32,
}
}