summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-13 14:51:37 +0700
committerhathach <[email protected]>2018-12-13 14:51:37 +0700
commit1c49c479cabf1be9b1c22017c42a8480b26cebcb (patch)
tree3b2df7468fedc34fcda895524f09c78f36ae7020 /src/device
parentaf1ffe4675ca9eeeebd47a82f3508eecdc1486c5 (diff)
seperate tusb_task() to tud_task() and tuh_task()
tusb_task() still exists for backward compatible
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c18
-rw-r--r--src/device/usbd.h1
-rw-r--r--src/device/usbd_pvt.h2
3 files changed, 18 insertions, 3 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index aa81cb118..a3fbfdff9 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -208,8 +208,24 @@ static void usbd_reset(uint8_t rhport)
/* USB Device Driver task
* This top level thread manages all device 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();
+
+ tud_task(); // tinyusb device task
+ }
+ }
+ @endcode
*/
-void usbd_task (void)
+void tud_task (void)
{
// Loop until there is no more events in the queue
while (1)
diff --git a/src/device/usbd.h b/src/device/usbd.h
index f9e0d8f4d..f9e7368ce 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -81,6 +81,7 @@ extern tud_desc_set_t tud_desc_set;
// APPLICATION API
//--------------------------------------------------------------------+
bool tud_mounted(void);
+void tud_task (void);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK (WEAK is optional)
diff --git a/src/device/usbd_pvt.h b/src/device/usbd_pvt.h
index d1fccd9e0..06951673f 100644
--- a/src/device/usbd_pvt.h
+++ b/src/device/usbd_pvt.h
@@ -52,8 +52,6 @@ extern tud_desc_set_t const* usbd_desc_set;
// INTERNAL API for stack management
//--------------------------------------------------------------------+
bool usbd_init (void);
-void usbd_task (void);
-
// Carry out Data and Status stage of control transfer
// - If len = 0, it is equivalent to sending status only