Commit 6cb06cdd authored by Stefan Giroux's avatar Stefan Giroux Committed by Henrik Brix Andersen
Browse files

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: default avatarStefan Giroux <stefan.g@feniex.com>
parent eb9d5c2e
Loading
Loading
Loading
Loading
+10 −0
Changes for drivers/dac/dac_sam0.c: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;
}