drivers: sam0: dac: add sam0 dac support to samc21 processors

The SAMC21 has a different revision of the DAC peripheral.
This change adds an ifdef to handle the changed SYNCBUSY register.

Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
This commit is contained in:
Stefan Giroux
2025-09-09 09:29:11 -05:00
committed by Henrik Brix Andersen
parent eb9d5c2e23
commit 6cb06cdd08

View File

@@ -100,16 +100,26 @@ static int dac_sam0_init(const struct device *dev)
/* Reset then configure the DAC */
regs->CTRLA.bit.SWRST = 1;
#if defined(DAC_STATUS_SYNCBUSY)
while (regs->STATUS.bit.SYNCBUSY) {
}
#else
while (regs->SYNCBUSY.bit.SWRST) {
}
#endif
regs->CTRLB.bit.REFSEL = cfg->refsel;
regs->CTRLB.bit.EOEN = 1;
/* Enable */
regs->CTRLA.bit.ENABLE = 1;
#if defined(DAC_STATUS_SYNCBUSY)
while (regs->STATUS.bit.SYNCBUSY) {
}
#else
while (regs->SYNCBUSY.bit.ENABLE) {
}
#endif
return 0;
}