Closed thaanstad closed 3 years ago
Hello! Thanks for code and kind words! I haven't worked on this for a long time and don't have hardware or time to test or work on it. I have sent an invitation to you to become a collaborator. It should give you commit access. So feel free to add this code to the repository!
/Henrik
Ideally this could get merged back into the main USB host arduino library as I think it has been very helpful. To simply communicate with another MCU with a baudrate of 115200 the example code is listed below. Perhaps you could integrate it into the library example folder structure to ease implementation for those using your cp210x driver in the future. This is the ino file that duplicates the ftdi loopback in the main library. This was tested with an arduino Uno and USB Host shield communicating with a adafruit ESP32 feather. Thanks for taking the time to work on this driver for the cp210x, works like a charm!!
include
include
include "pgmstrings.h"
include
class CP210xAsync : public CP210xAsyncOper { public: uint8_t OnInit(CP210x *pftdi); };
uint8_t CP210xAsync::OnInit(CP210x *cp210x) { uint8_t rcode = 0; rcode = cp210x->IFCEnable();
}
USB Usb; //USBHub Hub(&Usb); CP210xAsync cp210xAsync; CP210x cp210x(&Usb, &cp210xAsync);
void setup() { Serial.begin( 115200 );
if !defined(MIPSEL)
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
endif
Serial.println("Start");
if (Usb.Init() == -1) Serial.println("OSC did not start.");
delay( 200 ); }
void loop() { Usb.Task();
}