[riot-notifications] [RIOT-OS/RIOT] USBUS: Initial work towards an USB stack (#10916)

Koen Zandberg notifications at github.com
Thu Mar 28 09:47:38 CET 2019


bergzand commented on this pull request.



> +size_t usbus_fmt_hdr_conf(usbus_t *usbus)
+{
+    size_t len = 0;
+    usb_descriptor_configuration_t conf;
+
+    memset(&conf, 0, sizeof(usb_descriptor_configuration_t));
+    conf.length = sizeof(usb_descriptor_configuration_t);
+    conf.type = USB_TYPE_DESCRIPTOR_CONFIGURATION;
+    conf.total_length = sizeof(usb_descriptor_configuration_t);
+    conf.val = 1;
+    conf.attributes = USB_CONF_ATTR_RESERVED;
+    if (USB_CONFIG_SELF_POWERED) {
+        conf.attributes |= USB_CONF_ATTR_SELF_POWERED;
+    }
+    /* Todo: upper bound */
+    conf.max_power = USB_CONFIG_MAX_POWER / 2;

the bMaxPower (table 9-10 from the usb 2.0 spec) is in 2mA increments. I prefer to have the define in actual mA for convenience.

-- 
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/10916#discussion_r269901960
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190328/76b07eda/attachment-0001.html>


More information about the notifications mailing list