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

Dylan Laduranty notifications at github.com
Wed Mar 20 22:13:53 CET 2019


dylad commented on this pull request.

Seems like we're close to an end.

> @@ -274,6 +274,21 @@ static const adc_conf_chan_t adc_channels[] = {
 #define ADC_0_CHANNELS                     (2U)
 #define ADC_NUMOF                          ADC_0_CHANNELS
 /** @} */
+
+/**
+ * @name USB peripheral configuration
+ * @{
+ */
+static const sam0_common_usb_config_t sam_usbdev_config[] = {
+    {
+        .dm     = GPIO_PIN(PA, 24),
+        .dm_mux = GPIO_MUX_G,
+        .dp     = GPIO_PIN(PA, 25),
+        .dp_mux = GPIO_MUX_G,

since GPIO_MUX_G can only be used by USB peripheral, maybe one mux line is enough ?

> +            if (*((usbopt_enable_t *)value)) {
+                _ep_unready(ep);
+            }
+            else {
+                _usbdev_ep_ready(ep, 0);
+            }
+            res = sizeof(usbopt_enable_t);
+            break;
+        default:
+            DEBUG("sam_usb: Unhandled set call: 0x%x\n", opt);
+            break;
+    }
+    return res;
+}
+
+static int _ep_unready(usbdev_ep_t *ep)

nitpick: why `_ep_unready` and `_usbdev_ep_ready` ?

> +    else {
+        _disable_ep_stall_out(ep_reg);
+        ep_reg->EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK0RDY;
+    }
+    return 0;
+}
+
+/**
+ * Endpoint event handler
+ *
+ * Calls the endpoint callback to report the event to the USB stack
+ */
+static void _usbdev_ep_esr(usbdev_ep_t *ep)
+{
+    UsbDeviceEndpoint *ep_reg = _ep_reg_from_ep(ep);
+    signed event = -1;

int32 or int16 ? I'm sure this one will be troublesome outside of ARM.

-- 
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-216968051
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190320/668eefec/attachment.html>


More information about the notifications mailing list