qmk_firmware/internals_udi_group.md
2020-11-10 15:02:44 +00:00

3.3 KiB

group udi_group

The UDI provides a common API for all classes, and this is used by UDC for the main control of USB Device interface.

Summary

Members Descriptions
struct udi_api_t UDI API.

struct udi_api_t

UDI API.

The callbacks within this structure are called only by USB Device Controller (UDC)

The udc_get_interface_desc() can be use by UDI to know the interface descriptor selected by UDC.

Summary

Members Descriptions
public bool(* enable Enable the interface.
public void(* disable Disable the interface.
public bool(* setup Handle a control request directed at an interface.
public uint8_t(* getsetting Returns the current setting of the selected interface.
public void(* sof_notify To signal that a SOF is occurred.

Members

public bool(* enable

Enable the interface.

This function is called when the host selects a configuration to which this interface belongs through a Set Configuration request, and when the host selects an alternate setting of this interface through a Set Interface request.

Returns

1 if function was successfully done, otherwise 0.

public void(* disable

Disable the interface.

This function is called when this interface is currently active, and

  • the host selects any configuration through a Set Configuration request, or

  • the host issues a USB reset, or

  • the device is detached from the host (i.e. Vbus is no longer present)

public bool(* setup

Handle a control request directed at an interface.

This function is called when this interface is currently active and the host sends a SETUP request with this interface as the recipient.

Use udd_g_ctrlreq to decode and response to SETUP request.

Returns

1 if this interface supports the SETUP request, otherwise 0.

public uint8_t(* getsetting

Returns the current setting of the selected interface.

This function is called when UDC when know alternate setting of selected interface.

Returns

alternate setting of selected interface

public void(* sof_notify

To signal that a SOF is occurred.