diff options
| author | hathach <[email protected]> | 2018-12-13 14:51:37 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-12-13 14:51:37 +0700 |
| commit | 1c49c479cabf1be9b1c22017c42a8480b26cebcb (patch) | |
| tree | 3b2df7468fedc34fcda895524f09c78f36ae7020 /src/host | |
| parent | af1ffe4675ca9eeeebd47a82f3508eecdc1486c5 (diff) | |
seperate tusb_task() to tud_task() and tuh_task()
tusb_task() still exists for backward compatible
Diffstat (limited to 'src/host')
| -rw-r--r-- | src/host/usbh.c | 18 | ||||
| -rw-r--r-- | src/host/usbh.h | 9 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index 27d32330a..d0b5edb63 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -601,8 +601,24 @@ bool enum_task(hcd_event_t* event) /* USB Host Driver task
* This top level thread manages all host controller event and delegates events to class-specific drivers.
+ * This should be called periodically within the mainloop or rtos thread.
+ *
+ @code
+ int main(void)
+ {
+ application_init();
+ tusb_init();
+
+ while(1) // the mainloop
+ {
+ application_code();
+
+ tuh_task(); // tinyusb host task
+ }
+ }
+ @endcode
*/
-void usbh_task(void)
+void tuh_task(void)
{
// Loop until there is no more events in the queue
while (1)
diff --git a/src/host/usbh.h b/src/host/usbh.h index 8009c5080..fee1235f4 100644 --- a/src/host/usbh.h +++ b/src/host/usbh.h @@ -78,9 +78,9 @@ typedef struct { //--------------------------------------------------------------------+ // APPLICATION API //--------------------------------------------------------------------+ -//tusb_error_t tusbh_configuration_set (uint8_t dev_addr, uint8_t configure_number) ATTR_WARN_UNUSED_RESULT; -tusb_device_state_t tuh_device_get_state (uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT ATTR_PURE; -static inline bool tuh_device_is_configured(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT ATTR_PURE; +void tuh_task(void); + +tusb_device_state_t tuh_device_get_state (uint8_t dev_addr); static inline bool tuh_device_is_configured(uint8_t dev_addr) { return tuh_device_get_state(dev_addr) == TUSB_DEVICE_STATE_CONFIGURED; @@ -89,7 +89,7 @@ static inline bool tuh_device_is_configured(uint8_t dev_addr) //--------------------------------------------------------------------+ // APPLICATION CALLBACK //--------------------------------------------------------------------+ -ATTR_WEAK uint8_t tuh_device_attached_cb (tusb_desc_device_t const *p_desc_device) ATTR_WARN_UNUSED_RESULT; +ATTR_WEAK uint8_t tuh_device_attached_cb (tusb_desc_device_t const *p_desc_device); /** Callback invoked when device is mounted (configured) */ ATTR_WEAK void tuh_mount_cb (uint8_t dev_addr); @@ -103,7 +103,6 @@ ATTR_WEAK void tuh_umount_cb(uint8_t dev_addr); #ifdef _TINY_USB_SOURCE_FILE_ bool usbh_init(void); -void usbh_task(void); bool usbh_control_xfer (uint8_t dev_addr, tusb_control_request_t* request, uint8_t* data); |
