Fix audiod_get_AS_interface_index in audio class.
Enhance uac2_headset example with multiple sample rates. Add macro to calculate EP size.
This commit is contained in:
		@@ -1997,15 +1997,17 @@ static bool audiod_get_AS_interface_index(uint8_t itf, audiod_function_t * audio
 | 
			
		||||
    while (p_desc < p_desc_end)
 | 
			
		||||
    {
 | 
			
		||||
      // We assume the number of alternate settings is increasing thus we return the index of alternate setting zero!
 | 
			
		||||
      if (tu_desc_type(p_desc) == TUSB_DESC_INTERFACE && ((tusb_desc_interface_t const * )p_desc)->bInterfaceNumber == itf)
 | 
			
		||||
      if (tu_desc_type(p_desc) == TUSB_DESC_INTERFACE && ((tusb_desc_interface_t const * )p_desc)->bAlternateSetting == 0)
 | 
			
		||||
      {
 | 
			
		||||
        *idxItf = tmp;
 | 
			
		||||
        *pp_desc_int = p_desc;
 | 
			
		||||
        return true;
 | 
			
		||||
        if (((tusb_desc_interface_t const * )p_desc)->bInterfaceNumber == itf)
 | 
			
		||||
        {
 | 
			
		||||
          *idxItf = tmp;
 | 
			
		||||
          *pp_desc_int = p_desc;
 | 
			
		||||
          return true;
 | 
			
		||||
        }
 | 
			
		||||
        // Increase index, bytes read, and pointer
 | 
			
		||||
        tmp++;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Increase index, bytes read, and pointer
 | 
			
		||||
      tmp++;
 | 
			
		||||
      p_desc = tu_desc_next(p_desc);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -542,6 +542,11 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
 | 
			
		||||
  /* Standard AS Isochronous Feedback Endpoint Descriptor(4.10.2.1) */\
 | 
			
		||||
  TUD_AUDIO_DESC_STD_AS_ISO_FB_EP(/*_ep*/ _epfb, /*_interval*/ 1)\
 | 
			
		||||
 | 
			
		||||
//   Calculate wMaxPacketSize of Endpoints
 | 
			
		||||
#define TUD_AUDIO_EP_SIZE(_maxFrequency, _nBytesPerSample, _nChannels) \
 | 
			
		||||
    ((((_maxFrequency + ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 7999 : 999)) / ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 8000 : 1000)) + 1) * _nBytesPerSample * _nChannels)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//------------- TUD_USBTMC/USB488 -------------//
 | 
			
		||||
#define TUD_USBTMC_APP_CLASS    (TUSB_CLASS_APPLICATION_SPECIFIC)
 | 
			
		||||
#define TUD_USBTMC_APP_SUBCLASS 0x03u
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user