diff options
| author | hathach <[email protected]> | 2013-11-21 12:47:55 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-11-21 12:47:55 +0700 |
| commit | 6887e5e642c71666d622d28b52e1d32fea67982c (patch) | |
| tree | 8bbb974398b88df45a16e1076c9d06ddb2814c3c /tinyusb/class/hid_device.h | |
| parent | d94efa60d62a6b6b1beecaf823ab67648563ea52 (diff) | |
refractor usbd-dcd callback, add bus event isr
Diffstat (limited to 'tinyusb/class/hid_device.h')
| -rw-r--r-- | tinyusb/class/hid_device.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/tinyusb/class/hid_device.h b/tinyusb/class/hid_device.h index 57cebaebb..ed50c8e75 100644 --- a/tinyusb/class/hid_device.h +++ b/tinyusb/class/hid_device.h @@ -49,13 +49,21 @@ //--------------------------------------------------------------------+ -// KEYBOARD Application API +// KEYBOARD APPLICATION API //--------------------------------------------------------------------+ /** \addtogroup ClassDriver_HID_Keyboard Keyboard * @{ */ /** \defgroup Keyboard_Device Device * @{ */ +/** \brief Check if the interface is configured and ready to use + * \param[in] coreid USB Controller ID + * \retval true if the interface is configured + * \retval false if the interface is not configured (e.g device is not attached) + * \note This function should be call frequently or before any xfer attempt to check if device is still attached + */ +bool tusbd_hid_keyboard_is_configured(uint8_t coreid); + /** \brief Check if the interface is currently busy or not * \param[in] coreid USB Controller ID * \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to host @@ -77,7 +85,9 @@ bool tusbd_hid_keyboard_is_busy(uint8_t coreid); */ tusb_error_t tusbd_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const *p_report); -//------------- Application Callback -------------// +//--------------------------------------------------------------------+ +// APPLICATION CALLBACK API +//--------------------------------------------------------------------+ /** \brief Callback function that is invoked when an transferring event occurred * \param[in] coreid USB Controller ID * \param[in] event an value from \ref tusb_event_t @@ -88,6 +98,8 @@ tusb_error_t tusbd_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const * \note Application should schedule the next report by calling \ref tusbh_hid_keyboard_get_report within this callback */ void tusbd_hid_keyboard_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes); +void tusbd_hid_keyboard_mounted_cb(uint8_t coreid); +void tusbd_hid_keyboard_unmounted_cb(uint8_t coreid); /** @} */ /** @} */ @@ -100,6 +112,14 @@ void tusbd_hid_keyboard_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred /** \defgroup Mouse_Device Device * @{ */ +/** \brief Check if the interface is configured and ready to use + * \param[in] coreid USB Controller ID + * \retval true if the interface is configured + * \retval false if the interface is not configured (e.g device is not attached) + * \note This function should be call frequently or before any xfer attempt to check if device is still attached + */ +bool tusbd_hid_mouse_is_configured(uint8_t coreid); + /** \brief Check if the interface is currently busy or not * \param[in] coreid USB Controller ID * \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to host @@ -121,7 +141,12 @@ bool tusbd_hid_mouse_is_busy(uint8_t coreid); */ tusb_error_t tusbd_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_report); +//--------------------------------------------------------------------+ +// APPLICATION CALLBACK API +//--------------------------------------------------------------------+ void tusbd_hid_mouse_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes); +void tusbd_hid_mouse_mounted_cb(uint8_t coreid); +void tusbd_hid_mouse_unmounted_cb(uint8_t coreid); /** @} */ /** @} */ @@ -134,10 +159,10 @@ void tusbd_hid_mouse_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred_by #ifdef _TINY_USB_SOURCE_FILE_ void hidd_init(void); -void hidd_bus_reset(uint8_t coreid); tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length); tusb_error_t hidd_control_request(uint8_t coreid, tusb_control_request_t const * p_request); void hidd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes); +void hidd_close(uint8_t coreid); #endif |
