-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
How about this: |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your answers. |
Beta Was this translation helpful? Give feedback.
-
@Stan6314 for SAMD, you could use the tud_read() https://github.com/hathach/tinyusb/blob/master/src/device/usbd.h#L69 . SAMD controller doesn't distinguish between suspend (standby) and disconnection, which does complicate thing a bit. |
Beta Was this translation helpful? Give feedback.
-
@hathach if (was_mounted && (tud_ready()) ) { /* Do nothing here - PC is connected*/ } In callback function tud_mount_cb(void) just was_mounted variable is set true. Thank you again (twice). First for a great TinyUSB library. Secondly, for helping to solve my problem. |
Beta Was this translation helpful? Give feedback.
-
I am glad that you figured it out. Though would you mind stating the exact steps that cause the tud_read() failed to detect active connection. It sounds like a bug to me |
Beta Was this translation helpful? Give feedback.
-
Hi hathatch,
The method described above solved this problem. Thank you. |
Beta Was this translation helpful? Give feedback.
Hi hathatch,
it took some time to get to investigate the problem. The whole problem with tud_ready() appears in the sequence of operations. ( I assume that you meant tud_ready() even when you write tud_read() ).
I used Adafruit Feather M0 Express and Adafruit_TinyUSB_Arduino.