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

Functions

bool tusbh_hid_keyboard_is_mounted (uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT
 Check if device supports Keyboard interface or not. More...
 
bool tusbh_hid_keyboard_is_busy (uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT
 Check if the interface is currently busy or not. More...
 
tusb_error_t tusbh_hid_keyboard_get_report (uint8_t dev_addr, void *p_report)
 Perform a get report from Keyboard interface. More...
 
void tusbh_hid_keyboard_isr (uint8_t dev_addr, tusb_event_t event)
 Callback function that is invoked when an transferring event occurred. More...
 
void tusbh_hid_keyboard_mounted_cb (uint8_t dev_addr)
 Callback function that will be invoked when a device with Keyboard interface is mounted. More...
 
void tusbh_hid_keyboard_unmounted_cb (uint8_t dev_addr)
 Callback function that will be invoked when a device with Keyboard interface is unmounted. More...
 

Variables

uint8_t const hid_keycode_to_ascii_tbl [2][128]
 

Detailed Description

The interface API includes status checking function, data transferring function and callback functions

Function Documentation

tusb_error_t tusbh_hid_keyboard_get_report ( uint8_t  dev_addr,
void *  p_report 
)

Perform a get report from Keyboard interface.

Parameters
[in]dev_addrdevice address
[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. The result of usb transfer will be reported by the interface's callback function
bool tusbh_hid_keyboard_is_busy ( uint8_t  dev_addr)

Check if the interface is currently busy or not.

Parameters
[in]dev_addrdevice address
Return values
trueif the interface is busy meaning the stack is still transferring/waiting data from/to device
falseif the interface is not busy meaning the stack successfully transferred data from/to device
Note
This function is primarily used for polling/waiting result after tusbh_hid_keyboard_get_report. Alternatively, asynchronous event API can be used
bool tusbh_hid_keyboard_is_mounted ( uint8_t  dev_addr)

Check if device supports Keyboard interface or not.

Parameters
[in]dev_addrdevice address
Return values
trueif device supports Keyboard interface
falseif device does not support Keyboard interface or is not mounted
void tusbh_hid_keyboard_isr ( uint8_t  dev_addr,
tusb_event_t  event 
)

Callback function that is invoked when an transferring event occurred.

Parameters
[in]dev_addrAddress of device
[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.
Application should schedule the next report by calling tusbh_hid_keyboard_get_report within this callback
void tusbh_hid_keyboard_mounted_cb ( uint8_t  dev_addr)

Callback function that will be invoked when a device with Keyboard interface is mounted.

Parameters
[in]dev_addrAddress of newly mounted device
Note
This callback should be used by Application to set-up interface-related data
void tusbh_hid_keyboard_unmounted_cb ( uint8_t  dev_addr)

Callback function that will be invoked when a device with Keyboard interface is unmounted.

Parameters
[in]dev_addrAddress of newly unmounted device
Note
This callback should be used by Application to tear-down interface-related data