8000 Differential sound by robbederks · Pull Request #2220 · commaai/panda · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Differential sound #2220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ else:
if os.getenv("DEBUG"):
common_flags += ["-DDEBUG"]

if os.getenv("DIFFERENTIAL_SOUND"):
common_flags += ["-DDIFFERENTIAL_SOUND"]

def objcopy(source, target, env, for_signature):
return '$OBJCOPY -O binary %s %s' % (source[0], target[0])

Expand Down
2 changes: 2 additions & 0 deletions board/boards/cuatro.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ static void cuatro_set_bootkick(BootState state) {
}

static void cuatro_set_amp_enabled(bool enabled){
#ifndef DIFFERENTIAL_SOUND
set_gpio_output(GPIOA, 5, enabled);
#endif
set_gpio_output(GPIOB, 0, enabled);
}

Expand Down
7 changes: 7 additions & 0 deletions board/stm32h7/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,16 @@ void sound_init(void) {

// Init DAC
DAC1->DHR12R1 = (1UL << 11);
#ifdef DIFFERENTIAL_SOUND
DAC1->DHR12R2 = (1UL << 11);
#endif
register_set(&DAC1->MCR, 0U, 0xFFFFFFFFU);
register_set(&DAC1->CR, DAC_CR_TEN1 | (4U << DAC_CR_TSEL1_Pos) | DAC_CR_DMAEN1, 0xFFFFFFFFU);
#ifdef DIFFERENTIAL_SOUND
register_set_bits(&DAC1->CR, DAC_CR_EN1 | DAC_CR_EN2);
#else
register_set_bits(&DAC1->CR, DAC_CR_EN1);
#endif

// Setup DMAMUX (DAC_CH1_DMA as input)
register_set(&DMAMUX1_Channel1->CCR, 67U, DMAMUX_CxCR_DMAREQ_ID_Msk);
Expand Down
Loading
0