Mbed OS Reference
Loading...
Searching...
No Matches
EndpointResolver Class Reference

Utility class for resolving endpoints. More...

#include <EndpointResolver.h>

Public Member Functions

void endpoint_ctrl (uint32_t size)
 Add control endpoint size. More...
 
usb_ep_t endpoint_in (usb_ep_type_t type, uint32_t size)
 Return a free IN endpoint of the given size. More...
 
usb_ep_t endpoint_out (usb_ep_type_t type, uint32_t size)
 Return a free OUT endpoint of the given size. More...
 
usb_ep_t next_free_endpoint (bool in_not_out, usb_ep_type_t type, uint32_t size)
 Get next free endpoint. More...
 
bool valid ()
 Check if the endpoint configuration created so far is valid. More...
 
void reset ()
 Reset this class's state to when it was constructed. More...
 

Detailed Description

Utility class for resolving endpoints.

This class is intended to make the process of selecting the correct endpoint from a device endpoint table easier. It also provides a verification function to check if the device has enough resources for the given configuration.

Definition at line 39 of file EndpointResolver.h.

Member Function Documentation

◆ endpoint_ctrl()

void endpoint_ctrl ( uint32_t  size)

Add control endpoint size.

Parameters
sizeSpace reserved for control in and control out

◆ endpoint_in()

usb_ep_t endpoint_in ( usb_ep_type_t  type,
uint32_t  size 
)

Return a free IN endpoint of the given size.

Parameters
typeDesired endpoint type
sizeSpace to reserve for this endpoint
Returns
Endpoint index or 0 if there are not enough resources

◆ endpoint_out()

usb_ep_t endpoint_out ( usb_ep_type_t  type,
uint32_t  size 
)

Return a free OUT endpoint of the given size.

Parameters
typeDesired endpoint type
sizeSpace to reserve for this endpoint
Returns
Endpoint index or 0 if there are not enough resources

◆ next_free_endpoint()

usb_ep_t next_free_endpoint ( bool  in_not_out,
usb_ep_type_t  type,
uint32_t  size 
)

Get next free endpoint.

◆ valid()

bool valid ( )

Check if the endpoint configuration created so far is valid.

Returns
true if all endpoint sizes are available and fit, false otherwise

◆ reset()

void reset ( )

Reset this class's state to when it was constructed.