From 3c74301718d193c6acad1f71c8632b7a831fd9ee Mon Sep 17 00:00:00 2001 From: Hendrik van Essen Date: Fri, 20 Jun 2025 09:53:05 +0200 Subject: [PATCH] cpu/sam0_common/periph/dac.c: dont use DAC_CTRLA_SWRST DAC_CTRLA_SWRST clears all registers, so it also clears the config of the first DAC line after configuring the second DAC line. --- cpu/sam0_common/periph/dac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/sam0_common/periph/dac.c b/cpu/sam0_common/periph/dac.c index bacd3ab40b..96d7a62420 100644 --- a/cpu/sam0_common/periph/dac.c +++ b/cpu/sam0_common/periph/dac.c @@ -110,8 +110,8 @@ int8_t dac_init(dac_t line) _dac_init_clock(line); - /* Settings can only be changed when DAC is disabled, reset config */ - DAC->CTRLA.reg = DAC_CTRLA_SWRST; + /* Settings can only be changed when DAC is disabled */ + DAC->CTRLA.reg &= ~DAC_CTRLA_ENABLE; _sync(); #ifdef DAC_DACCTRL_ENABLE @@ -126,7 +126,7 @@ int8_t dac_init(dac_t line) #endif ; - DAC->CTRLA.reg = DAC_CTRLA_ENABLE; + DAC->CTRLA.reg |= DAC_CTRLA_ENABLE; _sync(); #ifdef DAC_STATUS_READY