PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
167 stars 86 forks source link

New USBSerial example sketch plus... #119

Closed KurtE closed 1 year ago

KurtE commented 1 year ago

I made a version of the USBtoSerial like teensy example that instead does USB Seruak to USBHost Serial.

Put in optional constructors and the like in comments to allow users to have more knowledge of the options.

I also now added in support to the serial objects, to be able to call begin earlier on (before we actually detect the USB Host serial object and specify the Baud rate. This was an issue in an earlier forum thread.

This sketch also looks at the current baud rate of the Serial object and tries to update the USBHost one. Note: I don't update if I find Serial object baud is 0, which I am seeing in the Arduino 2.1.0 Serial monitor.

I also added in optional support the USB Serial constructors to allow you to pass in a VID, PID, what it maps to and if on Interface or whole object, to allow people an easier time to try seeing if they can easily add in their device which underlying it might be a known Serial converter chip but with different VID/PID.

Have done some testing but probably can use more.

@PaulStoffregen @Defragster @mjs513

Now if you wish we can also move these two Example sketches to a sub-directory under examples.

Let me know what you think.

Defragster commented 1 year ago

Hope to test later today ...

Defragster commented 1 year ago

a bit into tomorrow ... USBtoUSB and RawHIDtoUSB examples work!

three T_4.1's online, two are USB Hosting other T_4.1's

One Native T_4.1 running "...\libraries\QNEthernet\examples\BroadcastChat\BroadcastChat.ino" One USBHost to another USB Serial copy of that Chat One RawHID _USBHost to another USB RawHID copy of that Chat

All three Chat'ting over ethernet - two echoed through their T_4.1 Host device

===== // USBHost *** Device USERIAL1 chat> [192.168.0.210][28] NATIVE CHAT on 13287570 here [192.168.0.51][27] 12167540 usbHost to 7658860 ===== // USBHost RawHID Devices :: HID1, HID2, RawHid1, SerEmu chat> [192.168.0.210][28] NATIVE CHAT on 13287570 here chat> [192.168.0.203][28] 12167530 USB Host to 9706370 ===== // NATIVE chat> chat> [192.168.0.51][27] 12167540 usbHost to 7658860 [192.168.0.203][28] 12167530 USB Host to 9706370