diff options
| author | hathach <[email protected]> | 2015-05-01 19:11:25 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2015-05-01 19:11:25 +0700 |
| commit | 6ee14bdd23884854ce1b563fdc8789359e68f4e8 (patch) | |
| tree | a43df2902ff136d37de219cb65df7e94e3ad3efc /tinyusb/class | |
| parent | f09f2494bf6e78e96ca9a7aa25dd7485e4788b6c (diff) | |
simplify host API: tusbh_ to tuh_ for keyboard & mouse
Diffstat (limited to 'tinyusb/class')
| -rw-r--r-- | tinyusb/class/hid_host.c | 28 | ||||
| -rw-r--r-- | tinyusb/class/hid_host.h | 44 |
2 files changed, 36 insertions, 36 deletions
diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index a13a268b5..a9bcf8eda 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -106,19 +106,19 @@ uint8_t const hid_keycode_to_ascii_tbl[2][128] = STATIC_VAR hidh_interface_info_t keyboardh_data[TUSB_CFG_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
//------------- KEYBOARD PUBLIC API (parameter validation required) -------------//
-bool tusbh_hid_keyboard_is_mounted(uint8_t dev_addr)
+bool tuh_hid_keyboard_is_mounted(uint8_t dev_addr)
{
return tusbh_device_is_configured(dev_addr) && pipehandle_is_valid(keyboardh_data[dev_addr-1].pipe_hdl);
}
-tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void* p_report)
+tusb_error_t tuh_hid_keyboard_get_report(uint8_t dev_addr, void* p_report)
{
return hidh_interface_get_report(dev_addr, p_report, &keyboardh_data[dev_addr-1]);
}
-bool tusbh_hid_keyboard_is_busy(uint8_t dev_addr)
+bool tuh_hid_keyboard_is_busy(uint8_t dev_addr)
{
- return tusbh_hid_keyboard_is_mounted(dev_addr) &&
+ return tuh_hid_keyboard_is_mounted(dev_addr) &&
hcd_pipe_is_busy( keyboardh_data[dev_addr-1].pipe_hdl );
}
@@ -132,18 +132,18 @@ bool tusbh_hid_keyboard_is_busy(uint8_t dev_addr) STATIC_VAR hidh_interface_info_t mouseh_data[TUSB_CFG_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
//------------- Public API -------------//
-bool tusbh_hid_mouse_is_mounted(uint8_t dev_addr)
+bool tuh_hid_mouse_is_mounted(uint8_t dev_addr)
{
return tusbh_device_is_configured(dev_addr) && pipehandle_is_valid(mouseh_data[dev_addr-1].pipe_hdl);
}
-bool tusbh_hid_mouse_is_busy(uint8_t dev_addr)
+bool tuh_hid_mouse_is_busy(uint8_t dev_addr)
{
- return tusbh_hid_mouse_is_mounted(dev_addr) &&
+ return tuh_hid_mouse_is_mounted(dev_addr) &&
hcd_pipe_is_busy( mouseh_data[dev_addr-1].pipe_hdl );
}
-tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, void * report)
+tusb_error_t tuh_hid_mouse_get_report(uint8_t dev_addr, void * report)
{
return hidh_interface_get_report(dev_addr, report, &mouseh_data[dev_addr-1]);
}
@@ -229,7 +229,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con if ( HID_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
{
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &keyboardh_data[dev_addr-1]) );
- tusbh_hid_keyboard_mounted_cb(dev_addr);
+ tuh_hid_keyboard_mounted_cb(dev_addr);
} else
#endif
@@ -237,7 +237,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con if ( HID_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
{
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &mouseh_data[dev_addr-1]) );
- tusbh_hid_mouse_mounted_cb(dev_addr);
+ tuh_hid_mouse_mounted_cb(dev_addr);
} else
#endif
@@ -261,7 +261,7 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes #if TUSB_CFG_HOST_HID_KEYBOARD
if ( pipehandle_is_equal(pipe_hdl, keyboardh_data[pipe_hdl.dev_addr-1].pipe_hdl) )
{
- tusbh_hid_keyboard_isr(pipe_hdl.dev_addr, event);
+ tuh_hid_keyboard_isr(pipe_hdl.dev_addr, event);
return;
}
#endif
@@ -269,7 +269,7 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes #if TUSB_CFG_HOST_HID_MOUSE
if ( pipehandle_is_equal(pipe_hdl, mouseh_data[pipe_hdl.dev_addr-1].pipe_hdl) )
{
- tusbh_hid_mouse_isr(pipe_hdl.dev_addr, event);
+ tuh_hid_mouse_isr(pipe_hdl.dev_addr, event);
return;
}
#endif
@@ -285,7 +285,7 @@ void hidh_close(uint8_t dev_addr) if ( pipehandle_is_valid( keyboardh_data[dev_addr-1].pipe_hdl ) )
{
hidh_interface_close(&keyboardh_data[dev_addr-1]);
- tusbh_hid_keyboard_unmounted_cb(dev_addr);
+ tuh_hid_keyboard_unmounted_cb(dev_addr);
}
#endif
@@ -293,7 +293,7 @@ void hidh_close(uint8_t dev_addr) if( pipehandle_is_valid( mouseh_data[dev_addr-1].pipe_hdl ) )
{
hidh_interface_close(&mouseh_data[dev_addr-1]);
- tusbh_hid_mouse_unmounted_cb( dev_addr );
+ tuh_hid_mouse_unmounted_cb( dev_addr );
}
#endif
diff --git a/tinyusb/class/hid_host.h b/tinyusb/class/hid_host.h index 5b47f8699..dc294e533 100644 --- a/tinyusb/class/hid_host.h +++ b/tinyusb/class/hid_host.h @@ -67,16 +67,16 @@ extern uint8_t const hid_keycode_to_ascii_tbl[2][128]; // TODO used weak attr if * \retval true if device supports Keyboard interface
* \retval false if device does not support Keyboard interface or is not mounted
*/
-bool tusbh_hid_keyboard_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+bool tuh_hid_keyboard_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
/** \brief Check if the interface is currently busy or not
* \param[in] dev_addr device address
* \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to device
* \retval false if 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 \ref tusbh_hid_keyboard_get_report.
+ * \note This function is primarily used for polling/waiting result after \ref tuh_hid_keyboard_get_report.
* Alternatively, asynchronous event API can be used
*/
-bool tusbh_hid_keyboard_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+bool tuh_hid_keyboard_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
/** \brief Perform a get report from Keyboard interface
* \param[in] dev_addr device address
@@ -88,7 +88,7 @@ bool tusbh_hid_keyboard_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_U * \retval TUSB_ERROR_INVALID_PARA if 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
*/
-tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void * p_report) /*ATTR_WARN_UNUSED_RESULT*/;
+tusb_error_t tuh_hid_keyboard_get_report(uint8_t dev_addr, void * p_report) /*ATTR_WARN_UNUSED_RESULT*/;
//------------- Application Callback -------------//
/** \brief Callback function that is invoked when an transferring event occurred
@@ -98,21 +98,21 @@ tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void * p_report) / * - 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.
- * \note Application should schedule the next report by calling \ref tusbh_hid_keyboard_get_report within this callback
+ * \note Application should schedule the next report by calling \ref tuh_hid_keyboard_get_report within this callback
*/
-void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event);
+void tuh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event);
/** \brief Callback function that will be invoked when a device with Keyboard interface is mounted
* \param[in] dev_addr Address of newly mounted device
* \note This callback should be used by Application to set-up interface-related data
*/
-void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr);
+void tuh_hid_keyboard_mounted_cb(uint8_t dev_addr);
/** \brief Callback function that will be invoked when a device with Keyboard interface is unmounted
* \param[in] dev_addr Address of newly unmounted device
* \note This callback should be used by Application to tear-down interface-related data
*/
-void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr);
+void tuh_hid_keyboard_unmounted_cb(uint8_t dev_addr);
/** @} */ // Keyboard_Host
/** @} */ // ClassDriver_HID_Keyboard
@@ -132,16 +132,16 @@ void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr); * \retval true if device supports Mouse interface
* \retval false if device does not support Mouse interface or is not mounted
*/
-bool tusbh_hid_mouse_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+bool tuh_hid_mouse_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
/** \brief Check if the interface is currently busy or not
* \param[in] dev_addr device address
* \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to device
* \retval false if 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 \ref tusbh_hid_mouse_get_report.
+ * \note This function is primarily used for polling/waiting result after \ref tuh_hid_mouse_get_report.
* Alternatively, asynchronous event API can be used
*/
-bool tusbh_hid_mouse_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+bool tuh_hid_mouse_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
/** \brief Perform a get report from Mouse interface
* \param[in] dev_addr device address
@@ -153,7 +153,7 @@ bool tusbh_hid_mouse_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUS * \retval TUSB_ERROR_INVALID_PARA if 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
*/
-tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, void* p_report) /*ATTR_WARN_UNUSED_RESULT*/;
+tusb_error_t tuh_hid_mouse_get_report(uint8_t dev_addr, void* p_report) /*ATTR_WARN_UNUSED_RESULT*/;
//------------- Application Callback -------------//
/** \brief Callback function that is invoked when an transferring event occurred
@@ -163,21 +163,21 @@ tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, void* p_report) /*ATT * - 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.
- * \note Application should schedule the next report by calling \ref tusbh_hid_mouse_get_report within this callback
+ * \note Application should schedule the next report by calling \ref tuh_hid_mouse_get_report within this callback
*/
-void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event);
+void tuh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event);
/** \brief Callback function that will be invoked when a device with Mouse interface is mounted
* \param[in] dev_addr Address of newly mounted device
* \note This callback should be used by Application to set-up interface-related data
*/
-void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr);
+void tuh_hid_mouse_mounted_cb(uint8_t dev_addr);
/** \brief Callback function that will be invoked when a device with Mouse interface is unmounted
* \param[in] dev_addr Address of newly unmounted device
* \note This callback should be used by Application to tear-down interface-related data
*/
-void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr);
+void tuh_hid_mouse_unmounted_cb(uint8_t dev_addr);
/** @} */ // Mouse_Host
/** @} */ // ClassDriver_HID_Mouse
@@ -192,14 +192,14 @@ void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr); * The interface API includes status checking function, data transferring function and callback functions
* @{ */
-bool tusbh_hid_generic_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
-tusb_error_t tusbh_hid_generic_get_report(uint8_t dev_addr, void* p_report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
-tusb_error_t tusbh_hid_generic_set_report(uint8_t dev_addr, void* p_report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
-tusb_interface_status_t tusbh_hid_generic_get_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
-tusb_interface_status_t tusbh_hid_generic_set_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
+bool tuh_hid_generic_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+tusb_error_t tuh_hid_generic_get_report(uint8_t dev_addr, void* p_report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
+tusb_error_t tuh_hid_generic_set_report(uint8_t dev_addr, void* p_report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
+tusb_interface_status_t tuh_hid_generic_get_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
+tusb_interface_status_t tuh_hid_generic_set_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
//------------- Application Callback -------------//
-void tusbh_hid_generic_isr(uint8_t dev_addr, tusb_event_t event);
+void tuh_hid_generic_isr(uint8_t dev_addr, tusb_event_t event);
/** @} */ // Generic_Host
/** @} */ // ClassDriver_HID_Generic
|
