Skip to content

Commit

Permalink
Add one extra sample to CFG_TUD_AUDIO_EP_SZ_IN
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed Sep 24, 2021
1 parent 3a56257 commit 84e48c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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,9 +100,9 @@ extern "C" {
#define CFG_TUD_AUDIO_ENABLE_EP_IN 1
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX 2 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 1 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below - be aware: for different number of channels you need another descriptor!
#define CFG_TUD_AUDIO_EP_SZ_IN 16 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX // 16 Samples (16 kHz) x 2 Bytes/Sample x 1 Channel
#define CFG_TUD_AUDIO_EP_SZ_IN (16 + 1) * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX // 16 Samples (16 kHz) x 2 Bytes/Sample x 1 Channel
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN // Maximum EP IN size for all AS alternate settings used
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN + 1
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions examples/usb_microphone/usb_microphone.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "tusb.h"

#ifndef SAMPLE_RATE
#define SAMPLE_RATE (CFG_TUD_AUDIO_EP_SZ_IN / 2) * 1000
#define SAMPLE_RATE ((CFG_TUD_AUDIO_EP_SZ_IN / 2) - 1) * 1000
#endif

#ifndef SAMPLE_BUFFER_SIZE
#define SAMPLE_BUFFER_SIZE (CFG_TUD_AUDIO_EP_SZ_IN/2)
#define SAMPLE_BUFFER_SIZE ((CFG_TUD_AUDIO_EP_SZ_IN/2) - 1)
#endif

typedef void (*usb_microphone_tx_ready_handler_t)(void);
Expand Down

0 comments on commit 84e48c4

Please sign in to comment.