Skip to content

Commit

Permalink
Merge pull request #2574 from HiFiPhile/fsdev
Browse files Browse the repository at this point in the history
FSDEV fix/cleanup.
  • Loading branch information
hathach authored Apr 11, 2024
2 parents c83e28c + 0f77563 commit 6144da9
Show file tree
Hide file tree
Showing 8 changed files with 440 additions and 613 deletions.
20 changes: 10 additions & 10 deletions examples/device/audio_4_channel_mic/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,39 +104,39 @@ int main(void)
// Generate dummy data
#if CFG_TUD_AUDIO_ENABLE_ENCODING
uint16_t * p_buff = i2s_dummy_buffer[0];
uint16_t dataVal = 1;
uint16_t dataVal = 0;
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH0 saw wave
*p_buff++ = dataVal;
// CH1 inverted saw wave
*p_buff++ = 60 + AUDIO_SAMPLE_RATE/1000 - dataVal;
dataVal++;
*p_buff++ = 3200 + AUDIO_SAMPLE_RATE/1000 - dataVal;
dataVal+= 32;
}
p_buff = i2s_dummy_buffer[1];
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH3 square wave
*p_buff++ = cnt < (AUDIO_SAMPLE_RATE/1000/2) ? 120:170;
*p_buff++ = cnt < (AUDIO_SAMPLE_RATE/1000/2) ? 3400:5000;
// CH4 sinus wave
float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000);
*p_buff++ = (uint16_t)(sinf(t) * 25) + 200;
*p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000);
}
#else
uint16_t * p_buff = i2s_dummy_buffer;
uint16_t dataVal = 1;
uint16_t dataVal = 0;
for (uint16_t cnt = 0; cnt < AUDIO_SAMPLE_RATE/1000; cnt++)
{
// CH0 saw wave
*p_buff++ = dataVal;
// CH1 inverted saw wave
*p_buff++ = 60 + AUDIO_SAMPLE_RATE/1000 - dataVal;
dataVal++;
*p_buff++ = 3200 + AUDIO_SAMPLE_RATE/1000 - dataVal;
dataVal+= 32;
// CH3 square wave
*p_buff++ = cnt < (AUDIO_SAMPLE_RATE/1000/2) ? 120:170;
*p_buff++ = cnt < (AUDIO_SAMPLE_RATE/1000/2) ? 3400:5000;
// CH4 sinus wave
float t = 2*3.1415f * cnt / (AUDIO_SAMPLE_RATE/1000);
*p_buff++ = (uint16_t)(sinf(t) * 25) + 200;
*p_buff++ = (uint16_t)((int16_t)(sinf(t) * 750) + 6000);
}
#endif

Expand Down
6 changes: 1 addition & 5 deletions examples/device/uac2_headset/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
//--------------------------------------------------------------------+

// List of supported sample rates
#if defined(__RX__)
const uint32_t sample_rates[] = {44100, 48000};
#else
const uint32_t sample_rates[] = {44100, 48000, 88200, 96000};
#endif
const uint32_t sample_rates[] = {44100, 48000};

uint32_t current_sample_rate = 44100;

Expand Down
8 changes: 3 additions & 5 deletions examples/device/uac2_headset/src/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@ extern "C" {
#define CFG_TUD_AUDIO_FUNC_1_N_FORMATS 2

// Audio format type I specifications
#if defined(__RX__)
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE 48000 // 16bit/48kHz is the best quality for Renesas RX
#else
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE 96000 // 24bit/96kHz is the best quality for full-speed, high-speed is needed beyond this
#endif
/* 24bit/48kHz is the best quality for headset or 24bit/96kHz for 2ch speaker,
high-speed is needed beyond this */
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE 48000
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 1
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX 2

Expand Down
4 changes: 2 additions & 2 deletions hw/bsp/stm32h5/boards/stm32h573i_dk/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ extern "C" {
// LED
#define LED_PORT GPIOI
#define LED_PIN GPIO_PIN_9
#define LED_STATE_ON 0
#define LED_STATE_ON 1

// Button
#define BUTTON_PORT GPIOC
#define BUTTON_PIN GPIO_PIN_13
#define BUTTON_STATE_ACTIVE 0
#define BUTTON_STATE_ACTIVE 1

// UART Enable for STLink VCOM
#define UART_DEV USART1
Expand Down
4 changes: 2 additions & 2 deletions hw/bsp/stm32h5/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ void board_init(void) {
__HAL_RCC_GPIOE_CLK_ENABLE();
#endif
#ifdef __HAL_RCC_GPIOG_CLK_ENABLE
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
#endif
#ifdef __HAL_RCC_GPIOI_CLK_ENABLE
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOI_CLK_ENABLE();
#endif

UART_CLK_EN();
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/stm32l0/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ uint32_t board_millis(void)

void HardFault_Handler (void)
{
asm("bkpt");
__asm("BKPT #0\n");
}

#ifdef USE_FULL_ASSERT
Expand Down
Loading

0 comments on commit 6144da9

Please sign in to comment.