Skip to content

Commit

Permalink
Fixed build error after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
richardclli committed Feb 1, 2025
1 parent a6c4524 commit 9011626
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
61 changes: 39 additions & 22 deletions radio/src/targets/pl18/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,46 @@ extern "C" void flushFTL();
#endif

#if defined(AUDIO_SPI)
stm32_spi_t audioSpi =
static void audio_set_rst_pin(bool set)
{
.SPIx = AUDIO_SPI,
.SCK = AUDIO_SPI_SCK_GPIO,
.MISO = AUDIO_SPI_MISO_GPIO,
.MOSI = AUDIO_SPI_MOSI_GPIO,
.CS = AUDIO_CS_GPIO,
};

vs1053b_t audioConfig =
gpio_write(AUDIO_RST_GPIO, set);
}

static void audio_set_mute_pin(bool set)
{
#if defined(INVERTED_MUTE_PIN)
gpio_write(AUDIO_MUTE_GPIO, !set);
#else
gpio_write(AUDIO_MUTE_GPIO, set);
#endif
}

static void audioInit()
{
.spi = &audioSpi,
.XDCS = AUDIO_XDCS_GPIO,
.DREQ = AUDIO_DREQ_GPIO,
.RST = AUDIO_RST_GPIO,
.MUTE = AUDIO_MUTE_GPIO,
.flags = AUDIO_MUTE_POL,
.mute_delay_ms = AUDIO_MUTE_DELAY,
.unmute_delay_ms = AUDIO_UNMUTE_DELAY,
};
static stm32_spi_t spi_dev = {
.SPIx = AUDIO_SPI,
.SCK = AUDIO_SPI_SCK_GPIO,
.MISO = AUDIO_SPI_MISO_GPIO,
.MOSI = AUDIO_SPI_MOSI_GPIO,
.CS = AUDIO_CS_GPIO,
};

static vs1053b_t vs1053 = {
.spi = &spi_dev,
.XDCS = AUDIO_XDCS_GPIO,
.DREQ = AUDIO_DREQ_GPIO,
.set_rst_pin = audio_set_rst_pin,
.set_mute_pin = audio_set_mute_pin,
.mute_delay_ms = AUDIO_MUTE_DELAY,
.unmute_delay_ms = AUDIO_UNMUTE_DELAY,
};

gpio_init(AUDIO_RST_GPIO, GPIO_OUT, 0);
gpio_init(AUDIO_MUTE_GPIO, GPIO_OUT, 0);
audio_set_mute_pin(true);

vs1053b_init(&vs1053);
}
#endif

void delay_self(int count)
Expand Down Expand Up @@ -257,11 +277,8 @@ void boardInit()
#if defined(RADIO_NB4P)
disableVoiceChip();
#endif
#if defined(AUDIO_SPI)
vs1053b_init(&audioConfig);
#else

audioInit();
#endif
monitorInit();
adcInit(&_adc_driver);
hapticInit();
Expand Down
2 changes: 1 addition & 1 deletion radio/src/targets/pl18/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@
#define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 8) // PH.08 audio amp control pin
#define AUDIO_UNMUTE_DELAY 120 // ms
#define AUDIO_MUTE_DELAY 500 // ms
#define AUDIO_MUTE_POL VS1053B_MUTE_INVERTED
#define INVERTED_MUTE_PIN
#elif defined(RADIO_NB4P)
#define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 9) // PH.09 audio amp control pin
#define AUDIO_UNMUTE_DELAY 120 // ms
Expand Down

0 comments on commit 9011626

Please sign in to comment.