summaryrefslogtreecommitdiff
path: root/examples/dual
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-10-11 12:58:18 +0700
committerhathach <[email protected]>2024-10-11 13:41:53 +0700
commit92602b9de3675c2d3e240bcd0838082e1a07b13b (patch)
tree69c07f1d49d9d37223a679f1956ba7c8588bdcb6 /examples/dual
parenta4fb8354e41b2604f66e7da22afa292b1a44f0a2 (diff)
change tusb_init(), tusb_rhport_init() to use init struct for expandability
Diffstat (limited to 'examples/dual')
-rw-r--r--examples/dual/host_hid_to_device_cdc/src/main.c15
-rw-r--r--examples/dual/host_info_to_device_cdc/src/main.c15
2 files changed, 26 insertions, 4 deletions
diff --git a/examples/dual/host_hid_to_device_cdc/src/main.c b/examples/dual/host_hid_to_device_cdc/src/main.c
index ce586201c..061958aae 100644
--- a/examples/dual/host_hid_to_device_cdc/src/main.c
+++ b/examples/dual/host_hid_to_device_cdc/src/main.c
@@ -79,8 +79,19 @@ int main(void) {
printf("TinyUSB Host HID <-> Device CDC Example\r\n");
// init device and host stack on configured roothub port
- tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
- tusb_init(BOARD_TUH_RHPORT, TUSB_ROLE_HOST);
+ tusb_rhport_init_t dev_init = {
+ .rhport = BOARD_TUD_RHPORT,
+ .role = TUSB_ROLE_DEVICE,
+ .speed = TUSB_SPEED_AUTO
+ };
+ tusb_init(&dev_init);
+
+ tusb_rhport_init_t host_init = {
+ .rhport = BOARD_TUH_RHPORT,
+ .role = TUSB_ROLE_HOST,
+ .speed = TUSB_SPEED_AUTO
+ };
+ tusb_init(&host_init);
if (board_init_after_tusb) {
board_init_after_tusb();
diff --git a/examples/dual/host_info_to_device_cdc/src/main.c b/examples/dual/host_info_to_device_cdc/src/main.c
index 7a862f5ad..e4d802a0c 100644
--- a/examples/dual/host_info_to_device_cdc/src/main.c
+++ b/examples/dual/host_info_to_device_cdc/src/main.c
@@ -82,8 +82,19 @@ int main(void) {
printf("TinyUSB Host Information -> Device CDC Example\r\n");
// init device and host stack on configured roothub port
- tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
- tusb_init(BOARD_TUH_RHPORT, TUSB_ROLE_HOST);
+ tusb_rhport_init_t dev_init = {
+ .rhport = BOARD_TUD_RHPORT,
+ .role = TUSB_ROLE_DEVICE,
+ .speed = TUSB_SPEED_AUTO
+ };
+ tusb_init(&dev_init);
+
+ tusb_rhport_init_t host_init = {
+ .rhport = BOARD_TUH_RHPORT,
+ .role = TUSB_ROLE_HOST,
+ .speed = TUSB_SPEED_AUTO
+ };
+ tusb_init(&host_init);
if (board_init_after_tusb) {
board_init_after_tusb();