Skip to content

Commit

Permalink
feat: example
Browse files Browse the repository at this point in the history
  • Loading branch information
elagil committed Aug 24, 2024
1 parent 583f5f2 commit 1190b76
Show file tree
Hide file tree
Showing 4 changed files with 277 additions and 118 deletions.
6 changes: 4 additions & 2 deletions embassy-stm32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ rand_core = "0.6.3"
sdio-host = "0.5.0"
critical-section = "1.1"
#stm32-metapac = { version = "15" }
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e0cfd165fd8fffaa0df66a35eeca83b228496645" }
# stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e0cfd165fd8fffaa0df66a35eeca83b228496645" }
stm32-metapac = { version = "15.0.0", path = "../../../stm32-data/build/stm32-metapac" }

vcell = "0.1.3"
nb = "1.0.0"
Expand All @@ -97,7 +98,8 @@ proc-macro2 = "1.0.36"
quote = "1.0.15"

#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]}
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e0cfd165fd8fffaa0df66a35eeca83b228496645", default-features = false, features = ["metadata"] }
# stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e0cfd165fd8fffaa0df66a35eeca83b228496645", default-features = false, features = ["metadata"] }
stm32-metapac = { version = "15.0.0", path = "../../../stm32-data/build/stm32-metapac", default-features = false, features = ["metadata"] }

[features]
default = ["rt"]
Expand Down
9 changes: 5 additions & 4 deletions embassy-usb/src/class/uac1/speaker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ use crate::{Builder, Handler};
/// Maximum allowed sampling rate (3 bytes) in Hz.
const MAX_SAMPLE_RATE_HZ: u32 = 0x7FFFFF;

/// Arbitrary unique identifier for the input unit
/// Arbitrary unique identifier for the input unit.
const INPUT_UNIT_ID: u8 = 0x01;

/// Arbitrary unique identifier for the feature unit
/// Arbitrary unique identifier for the feature unit.
const FEATURE_UNIT_ID: u8 = 0x02;

/// Arbitrary unique identifier for the output unit
/// Arbitrary unique identifier for the output unit.
const OUTPUT_UNIT_ID: u8 = 0x03;

// Volume settings go from -25600 to 0, in steps of 256.
Expand All @@ -52,14 +52,15 @@ const MAX_SAMPLE_RATE_COUNT: usize = 10;

/// The volume of an audio channel.
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Volume {
/// The channel is muted.
Muted,
/// The channel volume in dB. Ranges from `MIN_VOLUME_DB` (quietest) to `MAX_VOLUME_DB` (loudest).
DeciBel(f32),
}

/// Internal state for the USB Audio Class
/// Internal state for the USB Audio Class.
pub struct State<'d> {
control: Option<Control<'d>>,
shared: SharedControl<'d>,
Expand Down
1 change: 1 addition & 0 deletions examples/stm32f4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
futures-util = { version = "0.3.30", default-features = false }
heapless = { version = "0.8", default-features = false }
critical-section = "1.1"
nb = "1.0.0"
embedded-storage = "0.3.1"
micromath = "2.0.0"
Expand Down
Loading

0 comments on commit 1190b76

Please sign in to comment.