[riot-notifications] [RIOT-OS/RIOT] sam0_common: Add USB peripheral driver (#10915)

Dylan Laduranty notifications at github.com
Mon Mar 25 21:23:33 CET 2019


dylad commented on this pull request.

This is my last round. We're are almost good here !

> +}
+
+static bool _syncbusy_swrst(sam0_common_usb_t *dev)
+{
+    return dev->config->device->SYNCBUSY.bit.SWRST;
+}
+
+static inline void _poweron(void)
+{
+#if defined(CPU_FAM_SAMD21)
+    PM->AHBMASK.reg |= PM_AHBMASK_USB;
+    PM->APBBMASK.reg |= PM_APBBMASK_USB;
+    GCLK->CLKCTRL.reg = (uint32_t)(GCLK_CLKCTRL_CLKEN |
+                                   GCLK_CLKCTRL_GEN_GCLK0 |
+                                   (GCLK_CLKCTRL_ID(USB_GCLK_ID)));
+#elif defined(CPU_FAM_SAML21) || defined(CPU_FAM_SAMR30)

I would change this line to
```suggestion
#elif defined(CPU_SAML21)
```
This will prevent us to add new sub-family like the upcoming SAMR34

> +    uint8_t type = 0;
+
+    switch (ep->type) {
+        case USB_EP_TYPE_CONTROL:
+            type = 0x01;
+            break;
+        case USB_EP_TYPE_ISOCHRONOUS:
+            type = 0x02;
+            break;
+        case USB_EP_TYPE_BULK:
+            type = 0x03;
+            break;
+        case USB_EP_TYPE_INTERRUPT:
+            type = 0x04;
+            break;
+        case USB_EP_TYPE_NONE:

add default statement at the same time here ?

-- 
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/10915#pullrequestreview-218557520
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190325/a9753f71/attachment.html>


More information about the notifications mailing list