usbus: add usbus_add_interface_alt helper function

This commit is contained in:
dylad 2020-12-04 21:54:36 +01:00
parent 5673adaf48
commit 7b8feef326
2 changed files with 19 additions and 0 deletions

View File

@ -449,6 +449,15 @@ uint16_t usbus_add_string_descriptor(usbus_t *usbus, usbus_string_t *desc,
*/ */
uint16_t usbus_add_interface(usbus_t *usbus, usbus_interface_t *iface); uint16_t usbus_add_interface(usbus_t *usbus, usbus_interface_t *iface);
/**
* @brief Add alternate settings to a given interface
*
* @param[in] iface USB interface
* @param[in] alt alternate settings interface to add
*/
void usbus_add_interface_alt(usbus_interface_t *iface,
usbus_interface_alt_t *alt);
/** /**
* @brief Find an endpoint from an interface based on the endpoint properties * @brief Find an endpoint from an interface based on the endpoint properties
* *

View File

@ -121,6 +121,16 @@ uint16_t usbus_add_interface(usbus_t *usbus, usbus_interface_t *iface)
return idx; return idx;
} }
void usbus_add_interface_alt(usbus_interface_t *iface,
usbus_interface_alt_t *alt)
{
usbus_interface_alt_t **last = &iface->alts;
while (*last) {
last = &(*last)->next;
}
*last = alt;
}
void usbus_register_event_handler(usbus_t *usbus, usbus_handler_t *handler) void usbus_register_event_handler(usbus_t *usbus, usbus_handler_t *handler)
{ {
/* See note above for reasons against clist.h */ /* See note above for reasons against clist.h */