summaryrefslogtreecommitdiff
path: root/src/tusb.h
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/tusb.h
parentaf1ffe4675ca9eeeebd47a82f3508eecdc1486c5 (diff)
seperate tusb_task() to tud_task() and tuh_task()
tusb_task() still exists for backward compatible
Diffstat (limited to 'src/tusb.h')
-rw-r--r--src/tusb.h34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/tusb.h b/src/tusb.h
index e4393d067..3a13bbecc 100644
--- a/src/tusb.h
+++ b/src/tusb.h
@@ -101,32 +101,24 @@
/** \ingroup group_application_api
* @{ */
-// Initialize device/host stack according to tusb_config.h
-// return true if success
+// Initialize device/host stack
bool tusb_init(void);
-/** Run all tinyusb's internal tasks (e.g host task, device task) and invoke callback
- * This should be called periodically within the mainloop.
+// TODO
+// bool tusb_teardown(void);
- @code
- int main(void)
- {
- your_init_code();
- tusb_init();
- // other config code
-
- while(1) // the mainloop
- {
- your_application_code();
-
- tusb_task(); // handle tinyusb event, task etc ...
- }
- }
- @endcode
+// backward compatible only. TODO remove later
+static inline void tusb_task(void)
+{
+ #if TUSB_OPT_HOST_ENABLED
+ tuh_task();
+ #endif
- */
-void tusb_task(void);
+ #if TUSB_OPT_DEVICE_ENABLED
+ tud_task();
+ #endif
+}
/** @} */