tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Device

Functions

bool tusbd_hid_mouse_is_busy (uint8_t coreid)
 Check if the interface is currently busy or not. More...
 
tusb_error_t tusbd_hid_mouse_send (uint8_t coreid, hid_mouse_report_t const *p_report)
 Perform transfer queuing. More...
 
void tusbd_hid_mouse_mounted_cb (uint8_t coreid)
 Callback function that will be invoked when this interface is mounted (configured) by USB host. More...
 
void tusbd_hid_mouse_unmounted_cb (uint8_t coreid)
 Callback function that will be invoked when this interface is unmounted (bus reset/unplugged) More...
 
void tusbd_hid_mouse_cb (uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes)
 Callback function that is invoked when an transferring event occurred after invoking tusbd_hid_mouse_send. More...
 
uint16_t tusbd_hid_mouse_get_report_cb (uint8_t coreid, hid_request_report_type_t report_type, void **pp_report, uint16_t requested_length)
 Callback function that is invoked when USB host request HID_REQUEST_CONTROL_GET_REPORT via control endpoint. More...
 
void tusbd_hid_mouse_set_report_cb (uint8_t coreid, hid_request_report_type_t report_type, uint8_t p_report_data[], uint16_t length)
 Callback function that is invoked when USB host request HID_REQUEST_CONTROL_SET_REPORT via control endpoint. More...
 

Detailed Description

Function Documentation

void tusbd_hid_mouse_cb ( uint8_t  coreid,
tusb_event_t  event,
uint32_t  xferred_bytes 
)

Callback function that is invoked when an transferring event occurred after invoking tusbd_hid_mouse_send.

Parameters
[in]coreidUSB Controller ID
[in]eventan value from tusb_event_t
Note
event can be one of following
  • TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
  • TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
  • TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
uint16_t tusbd_hid_mouse_get_report_cb ( uint8_t  coreid,
hid_request_report_type_t  report_type,
void **  pp_report,
uint16_t  requested_length 
)

Callback function that is invoked when USB host request HID_REQUEST_CONTROL_GET_REPORT via control endpoint.

Parameters
[in]coreidUSB Controller ID
[in]report_typespecify which report (INPUT, OUTPUT, FEATURE) that host requests
[out]pp_reportpointer to buffer that application need to update, value must be accessible by USB controller (see TUSB_CFG_ATTR_USBRAM)
[in]requested_lengthnumber of bytes that host requested
Return values
non-zeroActual number of bytes in the response's buffer.
zeroindicates the current request is not supported. Tinyusb device stack will reject the request by sending STALL in the data phase.
Note
After this callback, the request is silently executed by the tinyusb stack, thus the completion of this control request will not be reported to application
bool tusbd_hid_mouse_is_busy ( uint8_t  coreid)

Check if the interface is currently busy or not.

Parameters
[in]coreidUSB Controller ID
Return values
trueif the interface is busy meaning the stack is still transferring/waiting data from/to host
falseif the interface is not busy meaning the stack successfully transferred data from/to host
Note
This function is primarily used for polling/waiting result after tusbd_hid_mouse_send.
void tusbd_hid_mouse_mounted_cb ( uint8_t  coreid)

Callback function that will be invoked when this interface is mounted (configured) by USB host.

Parameters
[in]coreidUSB Controller ID of the interface
Note
This callback should be used by Application to set-up interface-related data
tusb_error_t tusbd_hid_mouse_send ( uint8_t  coreid,
hid_mouse_report_t const *  p_report 
)

Perform transfer queuing.

Parameters
[in]coreidUSB Controller ID
[in,out]p_reportaddress that is used to store data from device. Must be accessible by usb controller (see TUSB_CFG_ATTR_USBRAM)
Returns
tusb_error_t type to indicate success or error condition.
Return values
TUSB_ERROR_NONEon success
TUSB_ERROR_INTERFACE_IS_BUSYif the interface is already transferring data with device
TUSB_ERROR_DEVICE_NOT_READYif device is not yet configured (by SET CONFIGURED request)
TUSB_ERROR_INVALID_PARAif input parameters are not correct
Note
This function is non-blocking and returns immediately. Data will be transferred when USB Host work with this interface. The result of usb transfer will be reported by the interface's callback function
void tusbd_hid_mouse_set_report_cb ( uint8_t  coreid,
hid_request_report_type_t  report_type,
uint8_t  p_report_data[],
uint16_t  length 
)

Callback function that is invoked when USB host request HID_REQUEST_CONTROL_SET_REPORT via control endpoint.

Parameters
[in]coreidUSB Controller ID
[in]report_typespecify which report (INPUT, OUTPUT, FEATURE) that host requests
[in]p_report_databuffer containing the report's data
[in]lengthnumber of bytes in the p_report_data
Note
By the time this callback is invoked, the USB control transfer is already completed in the hardware side. Application are free to handle data at its own will.
void tusbd_hid_mouse_unmounted_cb ( uint8_t  coreid)

Callback function that will be invoked when this interface is unmounted (bus reset/unplugged)

Parameters
[in]coreidUSB Controller ID of the interface
Note
This callback should be used by Application to tear-down interface-related data