Merge pull request #15565 from dylad/pr/usbus/add_interface_alt_helper
usbus: add usbus_add_interface_alt() helper function
This commit is contained in:
commit
f9c40e31bc
@ -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
|
||||||
*
|
*
|
||||||
|
|||||||
@ -229,7 +229,7 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
|
|||||||
usbus_add_interface(usbus, &cdcecm->iface_ctrl);
|
usbus_add_interface(usbus, &cdcecm->iface_ctrl);
|
||||||
usbus_add_interface(usbus, &cdcecm->iface_data);
|
usbus_add_interface(usbus, &cdcecm->iface_data);
|
||||||
|
|
||||||
cdcecm->iface_data.alts = &cdcecm->iface_data_alt;
|
usbus_add_interface_alt(&cdcecm->iface_data, &cdcecm->iface_data_alt);
|
||||||
|
|
||||||
usbus_enable_endpoint(cdcecm->ep_out);
|
usbus_enable_endpoint(cdcecm->ep_out);
|
||||||
usbus_enable_endpoint(cdcecm->ep_in);
|
usbus_enable_endpoint(cdcecm->ep_in);
|
||||||
|
|||||||
@ -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 */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user