diff options
| author | Ha Thach <[email protected]> | 2024-12-25 12:45:09 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-12-25 12:45:09 +0700 |
| commit | 86ad6e56c1700e85f1c5678607a762cfe3aa2f47 (patch) | |
| tree | 5ec921cba2240a1001cf03bc7f40269bc3175ee7 /docs/reference/getting_started.rst | |
| parent | 7c1afa837a28c7bd5210f57eda4afba4e171cad4 (diff) | |
| parent | ab9472f5848faac26d6c6160f78b8a82661c6ff6 (diff) | |
Merge pull request #2913 from hathach/release-0.18.00.18.0
update doc, bump up release 0.18.0
Diffstat (limited to 'docs/reference/getting_started.rst')
| -rw-r--r-- | docs/reference/getting_started.rst | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/docs/reference/getting_started.rst b/docs/reference/getting_started.rst index ac4ab6392..671e9fb11 100644 --- a/docs/reference/getting_started.rst +++ b/docs/reference/getting_started.rst @@ -10,7 +10,7 @@ It is relatively simple to incorporate tinyusb to your project * Copy or ``git submodule`` this repo into your project in a subfolder. Let's say it is *your_project/tinyusb* * Add all the .c in the ``tinyusb/src`` folder 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). +* 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(rhport, role) call to your reset initialization code. * Call ``tusb_int_handler(rhport, in_isr)`` in your USB IRQ Handler @@ -20,8 +20,17 @@ It is relatively simple to incorporate tinyusb to your project .. code-block:: int main(void) { - your_init_code(); - tusb_init(0, TUSB_ROLE_DEVICE); // initialize device stack on roothub port 0 + tusb_rhport_init_t dev_init = { + .role = TUSB_ROLE_DEVICE, + .speed = TUSB_SPEED_AUTO + }; + tusb_init(0, &dev_init); // initialize device stack on roothub port 0 + + tusb_rhport_init_t host_init = { + .role = TUSB_ROLE_HOST, + .speed = TUSB_SPEED_AUTO + }; + tusb_init(1, &host_init); // initialize host stack on roothub port 1 while(1) { // the mainloop your_application_code(); @@ -30,6 +39,14 @@ It is relatively simple to incorporate tinyusb to your project } } + void USB0_IRQHandler(void) { + tusb_int_handler(0, true); + } + + void USB1_IRQHandler(void) { + tusb_int_handler(1, true); + } + Examples -------- |
