summaryrefslogtreecommitdiff
path: root/src/class/audio/audio_device.c
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2022-01-17 12:36:39 +0700
committerGitHub <[email protected]>2022-01-17 12:36:39 +0700
commitefc29baead577185c577bf8e313f4c411f4eae9e (patch)
tree1a081093d4196ae478d2bf8e3e8136d81c2dc77e /src/class/audio/audio_device.c
parent8d373b08879ac382c59dcbfb2d351d4af35e3d00 (diff)
parent976405dea3bc421cd3631b3af93380bdb122af66 (diff)
Merge branch 'master' into port-ft90x
Diffstat (limited to 'src/class/audio/audio_device.c')
-rw-r--r--src/class/audio/audio_device.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index d9f2e284e..d21980060 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -2247,24 +2247,28 @@ static void audiod_parse_for_AS_params(audiod_function_t* audio, uint8_t const *
#if CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP
-// Input value feedback has to be in 16.16 format - the format will be converted according to speed settings automatically
bool tud_audio_n_fb_set(uint8_t func_id, uint32_t feedback)
{
TU_VERIFY(func_id < CFG_TUD_AUDIO && _audiod_fct[func_id].p_desc != NULL);
// Format the feedback value
-#if !TUD_OPT_HIGH_SPEED
- uint8_t * fb = (uint8_t *) &_audiod_fct[func_id].fb_val;
+#if CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION
+ if ( TUSB_SPEED_FULL == tud_speed_get() )
+ {
+ uint8_t * fb = (uint8_t *) &_audiod_fct[func_id].fb_val;
- // For FS format is 10.14
- *(fb++) = (feedback >> 2) & 0xFF;
- *(fb++) = (feedback >> 10) & 0xFF;
- *(fb++) = (feedback >> 18) & 0xFF;
- // 4th byte is needed to work correctly with MS Windows
- *fb = 0;
+ // For FS format is 10.14
+ *(fb++) = (feedback >> 2) & 0xFF;
+ *(fb++) = (feedback >> 10) & 0xFF;
+ *(fb++) = (feedback >> 18) & 0xFF;
+ // 4th byte is needed to work correctly with MS Windows
+ *fb = 0;
+ }else
#else
- // For HS format is 16.16 as originally demanded
- _audiod_fct[func_id].fb_val = feedback;
+ {
+ // Send value as-is, caller will choose the appropriate format
+ _audiod_fct[func_id].fb_val = feedback;
+ }
#endif
// Schedule a transmit with the new value if EP is not busy - this triggers repetitive scheduling of the feedback value