[riot-notifications] [RIOT-OS/RIOT] cpu/sam0_common: implement periph/dac (#13965)

Dylan Laduranty notifications at github.com
Fri May 1 15:34:29 CEST 2020

@dylad requested changes on this pull request.

Some minor changes should be applied but this is already in a pretty good shape.

- #define DAC_CLOCK_DEFAULT should belongs to boards/*/include/periph_conf.h

- Would be good to select the reference voltage through periph_conf.h too
I know VDDANA is broken on SAME54 so external reference must be used but VDDANA works on SAML21 for instance.

- SAML10/SAML11 DAC are connected to 32kHz GCLK ? Maybe it's time to allocate an unused GCLK to provide a faster clock.

> + * @author      Benjamin Valentin <benpicco at beuth-hochschule.de>
+ *
+ * @}
+ */
+#include "cpu.h"
+#include "periph/dac.h"
+#include "periph/gpio.h"
+#include "byteorder.h"
+#ifndef DAC_CLOCK
+#define DAC_VAL(in) (in >> (16 - DAC_RES_BITS))

I don't get this.
Why playing with the bit position here ?
In the current state, DAC_DACCTRL_LEFTADJ is set to 0 and we don't use dithering so we should write data to bits [0..9] or  [0..11]. there is no need for this macro, just assign the value to the register directly.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200501/0f5b64da/attachment.htm>

More information about the notifications mailing list