From 615009cf0f8fb8f3feadac160fbb0a07e4de171b Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Tue, 30 Sep 2025 14:13:39 -0700 Subject: [PATCH] Differential sound (#2284) real --- board/boards/cuatro.h | 18 ------------------ board/stm32h7/sound.h | 25 ++----------------------- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/board/boards/cuatro.h b/board/boards/cuatro.h index cb532bb8..b6890f83 100644 --- a/board/boards/cuatro.h +++ b/board/boards/cuatro.h @@ -42,24 +42,6 @@ static void cuatro_set_bootkick(BootState state) { } static void cuatro_set_amp_enabled(bool enabled) { - // *** tmp, remove soon *** - static const uint8_t olds[][12] = { - {0x44, 0x00, 0x10, 0x00, 0x19, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x14, 0x00, 0x13, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x04, 0x00, 0x30, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x2f, 0x00, 0x14, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x1e, 0x00, 0x2f, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x26, 0x00, 0x15, 0x00, 0x19, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x35, 0x00, 0x32, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x37, 0x00, 0x2f, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - }; - bool is_old = false; - for (uint8_t i = 0U; i < (sizeof(olds) / sizeof(olds[0])); i++) { - is_old |= (memcmp(olds[i], ((uint8_t *)UID_BASE), 12) == 0); - } - if (is_old) set_gpio_output(GPIOA, 5, enabled); - // *** tmp end *** - set_gpio_output(GPIOB, 0, enabled); } diff --git a/board/stm32h7/sound.h b/board/stm32h7/sound.h index 9c75e465..aeee2c71 100644 --- a/board/stm32h7/sound.h +++ b/board/stm32h7/sound.h @@ -104,33 +104,12 @@ void sound_init(void) { REGISTER_INTERRUPT(BDMA_Channel0_IRQn, BDMA_Channel0_IRQ_Handler, 128U, FAULT_INTERRUPT_RATE_SOUND_DMA) REGISTER_INTERRUPT(DMA1_Stream0_IRQn, DMA1_Stream0_IRQ_Handler, 128U, FAULT_INTERRUPT_RATE_SOUND_DMA) - // *** tmp, remove soon *** - static const uint8_t olds[][12] = { - {0x44, 0x00, 0x10, 0x00, 0x19, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x14, 0x00, 0x13, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x04, 0x00, 0x30, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x2f, 0x00, 0x14, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x1e, 0x00, 0x2f, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x26, 0x00, 0x15, 0x00, 0x19, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x35, 0x00, 0x32, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - {0x37, 0x00, 0x2f, 0x00, 0x18, 0x51, 0x32, 0x34, 0x39, 0x37, 0x37, 0x30}, - }; - bool is_old = false; - for (uint8_t i = 0U; i < (sizeof(olds) / sizeof(olds[0])); i++) { - is_old |= (memcmp(olds[i], ((uint8_t *)UID_BASE), 12) == 0); - } - // *** tmp end *** - // Init DAC DAC1->DHR12R1 = (1UL << 11); - if (!is_old) DAC1->DHR12R2 = (1UL << 11); + DAC1->DHR12R2 = (1UL << 11); register_set(&DAC1->MCR, 0U, 0xFFFFFFFFU); register_set(&DAC1->CR, DAC_CR_TEN1 | (4U << DAC_CR_TSEL1_Pos) | DAC_CR_DMAEN1, 0xFFFFFFFFU); - if (is_old) { - register_set_bits(&DAC1->CR, DAC_CR_EN1); - } else { - register_set_bits(&DAC1->CR, DAC_CR_EN1 | DAC_CR_EN2); - } + register_set_bits(&DAC1->CR, DAC_CR_EN1 | DAC_CR_EN2); // Setup DMAMUX (DAC_CH1_DMA as input) register_set(&DMAMUX1_Channel1->CCR, 67U, DMAMUX_CxCR_DMAREQ_ID_Msk);