add new tusb_int_handler(rhport, in_isr) as common irq handler
update tusb_init() to take rhport and role, defined as macro with optional argument for backward compatible
This commit is contained in:
@@ -12,22 +12,19 @@ It is relatively simple to incorporate tinyusb to your project
|
||||
* Add *your_project/tinyusb/src* to your include path. Also make sure your current include path also contains the configuration file tusb_config.h.
|
||||
* Make sure all required macros are all defined properly in tusb_config.h (configure file in demo application is sufficient, but you need to add a few more such as CFG_TUSB_MCU, CFG_TUSB_OS since they are passed by IDE/compiler to maintain a unique configure for all boards).
|
||||
* If you use the device stack, make sure you have created/modified usb descriptors for your own need. Ultimately you need to implement all **tud descriptor** callbacks for the stack to work.
|
||||
* Add tusb_init() call to your reset initialization code.
|
||||
* Call ``tud_int_handler()`` (device) and/or ``tuh_int_handler()`` (host) in your USB IRQ Handler
|
||||
* Add tusb_init(rhport, role) call to your reset initialization code.
|
||||
* Call ``tusb_int_handler(rhport, in_isr)`` in your USB IRQ Handler
|
||||
* Implement all enabled classes's callbacks.
|
||||
* If you don't use any RTOSes at all, you need to continuously and/or periodically call tud_task()/tuh_task() function. All of the callbacks and functionality are handled and invoked within the call of that task runner.
|
||||
|
||||
.. code-block::
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int main(void) {
|
||||
your_init_code();
|
||||
tusb_init(); // initialize tinyusb stack
|
||||
tusb_init(0, TUSB_ROLE_DEVICE); // initialize device stack on roothub port 0
|
||||
|
||||
while(1) // the mainloop
|
||||
{
|
||||
while(1) { // the mainloop
|
||||
your_application_code();
|
||||
|
||||
tud_task(); // device task
|
||||
tuh_task(); // host task
|
||||
}
|
||||
|
Reference in New Issue
Block a user