/* Enable the DAC module. 
Enables the DAC interface and the selected output. If any internal reference is selected it will be enabled. */
void dac_enable(struct dac_module *const module_inst)
/* Enable the DAC module. 
Enables the DAC interface and the selected output. If any internal reference is selected it will be enabled. */
void dac_enable(struct dac_module *const module_inst)
{
	Assert(module_inst);
	Assert(module_inst->hw);
	Dac *const dac_module = module_inst->hw;
	while (dac_is_syncing(module_inst)) {
	}
	dac_module->CTRLA.reg |= DAC_CTRLA_ENABLE;
	if (module_inst->reference == DAC_REFERENCE_INTREF) {
		system_voltage_reference_enable(SYSTEM_VOLTAGE_REFERENCE_OUTPUT);
	}
	if(dac_module->DACCTRL[DAC_CHANNEL_0].reg & DAC_DACCTRL_ENABLE) {
		while(! (dac_module->STATUS.reg & DAC_STATUS_READY(DAC_CHANNEL_0 + 1))) {
		};
	} else if(dac_module->DACCTRL[DAC_CHANNEL_1].reg & DAC_DACCTRL_ENABLE) {
		while(! (dac_module->STATUS.reg & DAC_STATUS_READY(DAC_CHANNEL_1 + 1))) {
		};
	}
}