Skip to content

Commit

Permalink
Sample rate @ 16 kHz + bytes per sample @ 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed May 11, 2021
1 parent 509b75b commit 01b4221
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/usb_microphone/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ int main(void)
tusb_init();

// Init values
sampFreq = 44100;
sampFreq = 16000;
clkValid = 1;

sampleFreqRng.wNumSubRanges = 1;
sampleFreqRng.subrange[0].bMin = 44100;
sampleFreqRng.subrange[0].bMax = 44100;
sampleFreqRng.subrange[0].bMin = 16000;
sampleFreqRng.subrange[0].bMax = 16000;
sampleFreqRng.subrange[0].bRes = 0;

while (1)
Expand Down
4 changes: 2 additions & 2 deletions examples/usb_microphone/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ extern "C" {
#define CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX 2

// EP and buffer size - for isochronous EP´s, the buffer and EP size are equal (different sizes would not make sense)
#define CFG_TUD_AUDIO_EPSIZE_IN 48*CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX*CFG_TUD_AUDIO_N_CHANNELS_TX // 48 Samples (48 kHz) x 2 Bytes/Sample x 1 Channels
#define CFG_TUD_AUDIO_TX_FIFO_SIZE 48*2 // 48 Samples (48 kHz) x 2 Bytes/Sample (1/2 word)
#define CFG_TUD_AUDIO_EPSIZE_IN 16*CFG_TUD_AUDIO_N_BYTES_PER_SAMPLE_TX*CFG_TUD_AUDIO_N_CHANNELS_TX // 16 Samples (16 kHz) x 2 Bytes/Sample x 1 Channels
#define CFG_TUD_AUDIO_TX_FIFO_SIZE 16*2 // 16 Samples (16 kHz) x 2 Bytes/Sample (1/2 word)

// Number of Standard AS Interface Descriptors (4.9.1) defined per audio function - this is required to be able to remember the current alternate settings of these interfaces - We restrict us here to have a constant number for all audio functions (which means this has to be the maximum number of AS interfaces an audio function has and a second audio function with less AS interfaces just wastes a few bytes)
#define CFG_TUD_AUDIO_N_AS_INT 1
Expand Down
2 changes: 1 addition & 1 deletion examples/usb_microphone/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),

// Interface number, string index, EP Out & EP In address, EP size
TUD_AUDIO_MIC_DESCRIPTOR(/*_itfnum*/ ITF_NUM_AUDIO_CONTROL, /*_stridx*/ 0, /*_nBytesPerSample*/ 3, /*_nBitsUsedPerSample*/ 24, /*_epin*/ 0x80 | EPNUM_AUDIO, /*_epsize*/ 48*4)
TUD_AUDIO_MIC_DESCRIPTOR(/*_itfnum*/ ITF_NUM_AUDIO_CONTROL, /*_stridx*/ 0, /*_nBytesPerSample*/ 2, /*_nBitsUsedPerSample*/ 16, /*_epin*/ 0x80 | EPNUM_AUDIO, /*_epsize*/ 16*2)
};

// Invoked when received GET CONFIGURATION DESCRIPTOR
Expand Down

0 comments on commit 01b4221

Please sign in to comment.