summaryrefslogtreecommitdiff
path: root/examples/device/uac2_headset/src/main.c
diff options
context:
space:
mode:
authorMengsk <[email protected]>2025-10-03 10:05:27 +0200
committerMengsk <[email protected]>2025-10-03 10:15:19 +0200
commit1ded8ac94c66eca996e2089bda7ac79fcf9ddd59 (patch)
tree347e9c4ae8664d52faa8634f9e632c27c3eb7d7d /examples/device/uac2_headset/src/main.c
parent05ea8cf0ee1365dfe5b2c43c304838648f739abb (diff)
Update headset example
Signed-off-by: Mengsk <[email protected]>
Diffstat (limited to 'examples/device/uac2_headset/src/main.c')
-rw-r--r--examples/device/uac2_headset/src/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/device/uac2_headset/src/main.c b/examples/device/uac2_headset/src/main.c
index f6d3c041d..96fa66f1e 100644
--- a/examples/device/uac2_headset/src/main.c
+++ b/examples/device/uac2_headset/src/main.c
@@ -73,7 +73,7 @@ static uint32_t blink_interval_ms = BLINK_NOT_MOUNTED;
// Audio controls
// Current states
-int8_t mute[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX + 1]; // +1 for master channel 0
+uint8_t mute[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX + 1]; // +1 for master channel 0
int16_t volume[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX + 1];// +1 for master channel 0
// Buffer for microphone data
@@ -610,6 +610,10 @@ void audio_control_task(void) {
uint32_t btn = board_button_read();
+ // Even UAC1 spec have status interrupt support like UAC2, most host do not support it
+ // So you have to either use UAC2 or use old day HID volume control
+ TU_VERIFY((tud_audio_version() == 1),);
+
if (!btn_prev && btn) {
// Adjust volume between 0dB (100%) and -30dB (10%)
for (int i = 0; i < CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX + 1; i++) {