[riot-notifications] [RIOT-OS/RIOT] cpu/sam0_common: move PWM to common code, add support for saml21, samd5x (#14007)

benpicco notifications at github.com
Sun May 3 21:07:18 CEST 2020


@benpicco commented on this pull request.



> +                      | GCLK_CLKCTRL_GEN(cfg->gclk_src)
+                      | GCLK_CLKCTRL_ID(cfg->tim.gclk_id);
+    PM->APBCMASK.reg |= cfg->tim.pm_mask;
+#endif
+}
+
+static void poweroff(pwm_t dev)
+{
+    const pwm_conf_t *cfg = &pwm_config[dev];
+
+#ifdef MCLK
+    GCLK->PCHCTRL[cfg->tim.gclk_id].reg = 0;
+    *cfg->tim.mclk &= ~cfg->tim.mclk_mask;
+#else
+    PM->APBCMASK.reg &= ~cfg->tim.pm_mask;
+    GCLK->CLKCTRL.reg = GCLK_CLKCTRL_GEN_GCLK7


I guess the idea was to connect it to an unused GCLK so the original one can be turned off if it runs ondemand.
This was there already, I just kept that part - I can check if it makes any difference to power consumption (if something other than `SAM0_GCLK_MAIN` is used), I'd be happy to drop it.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14007#discussion_r419145580
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200503/f776d96d/attachment.htm>


More information about the notifications mailing list