mattairtech / ArduinoCore-samd

This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support for SAM D|L|C (M0+ and M4F) boards including the MattairTech Xeno Mini and the MT-D21E (see https://www.mattairtech.com/). It adds support for new devices like the D51, L21, C21, and D11. It also adds new clock sources, like a high speed crystal or internal oscillator.
104 stars 43 forks source link

DAC Analog Reference #26

Open CSC-Olivier opened 5 years ago

CSC-Olivier commented 5 years ago

It seems that the DAC always use the 3.3V reference even if analogReference is used to define a different reference. I see that line 272 of wiring_analog.c is:

DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC | // Using the 3.3V reference

Is there an easy way to change this so that one can use the 1.0V reference or the 1.65V reference for the DAC?

CSC-Olivier commented 5 years ago

OK, if I change line 272 of wiring_analog.c to: DAC->CTRLB.reg = DAC_CTRLB_REFSEL_INT1V | // Using the 1V reference Then it uses the 1V reference. Not sure how to make the DAC automatically use the reference defined by analogReference though. Maybe by using DAC_CTRLB_REFSEL(value) ?