USB Composite library
USB Composite library
I've reworked how my USB Composite library allocates endpoints to allow for more devices to be composited together.
Previously, RX and TX endpoints weren't allowed to share the same number. But there is no reason why they can't do that. So, now they can, though only within the same plugin.
I also reworked the xbox360 plugin so it can be composited better.
https://github.com/arpruss/USBComposite_stm32f1
Previously, RX and TX endpoints weren't allowed to share the same number. But there is no reason why they can't do that. So, now they can, though only within the same plugin.
I also reworked the xbox360 plugin so it can be composited better.
https://github.com/arpruss/USBComposite_stm32f1
Re: USB Composite library
I added a USBMultiSerial plugin which allows for up to three USB serial ports.
Code: Select all
#include <USBComposite.h>
USBMultiSerial<2> ms;
void setup() {
ms.begin();
}
void loop() {
while(ms.ports[1].available()) {
ms.ports[0].write(ms.ports[1].read());
}
while(ms.ports[0].available()) {
ms.ports[1].write(ms.ports[0].read());
}
}
Re: USB Composite library
I rewrote USBXBox360 to allow for multiple controllers, with a backwards-compatible USBXBox360 class and a new template USBMultiXBox360<n>, which allows up to four controllers. Example code: https://github.com/arpruss/USBComposite ... box360.ino
If you want more than four controllers (the hardware should support up to seven), you can try to just change a define in usb_multi_x360.h (untested).
If you want more than four controllers (the hardware should support up to seven), you can try to just change a define in usb_multi_x360.h (untested).
Re: USB Composite library
Thanks again to arpruss making (and further developing) the STM32 to a real USB working horse for me!
Re: USB Composite library
I just added emulation of XBox 360 wireless. The battery status messages are currently static and fake, and I haven't tested everything.
The advantage of the XBox 360 wireless plugin over the wired multi XBox 360 controller plugin is that with wireless you can send connect/disconnect messages for the controllers.
The advantage of the XBox 360 wireless plugin over the wired multi XBox 360 controller plugin is that with wireless you can send connect/disconnect messages for the controllers.
Re: USB Composite library
I am working on making HID support easier to use. If it all works out, then two joysticks, a mouse and a keyboard could be put in one device as follows:
The current code would require putting together a custom device report descriptor and passing it to USBHID.begin().
I am trying to keep full backwards compatibility, which makes things more complicated.
Code: Select all
#include <USBComposite.h>
USBHID HID;
HIDJoystick Joystick1(HID);
HIDJoystick Joystick2(HID);
HIDKeyboard Keyboard(HID);
HIDMouse Mouse(HID);
setup() {
USBHID.begin();
}
I am trying to keep full backwards compatibility, which makes things more complicated.
Re: USB Composite library
This USB composite library would be great to integrate with the driver-level libusb_stm32 library:
https://github.com/dmitrystu/libusb_stm32
https://github.com/dmitrystu/libusb_stm32
Re: USB Composite library
it sounds like we can have different 'usb libraries' even if things like tiny-usb is adopted.
the reason is that tiny-usb seem to be aimed as 'cross platform' this would likely have a 'lowest common denominator' limitation for the api
while usb composite can be made into a more 'stm32 fitted' one, with additional features etc. (e.g. combo stacks) i need to spend a little time playing with it
have not really started on it yet
the reason is that tiny-usb seem to be aimed as 'cross platform' this would likely have a 'lowest common denominator' limitation for the api
while usb composite can be made into a more 'stm32 fitted' one, with additional features etc. (e.g. combo stacks) i need to spend a little time playing with it
have not really started on it yet
Re: USB Composite library
I've just merged my abstracted branch.
Now, all the hardware dependent code is in usb_generic.c.
Also, the simplified USB HID profile code is in place, so you can do things like this:
Now, all the hardware dependent code is in usb_generic.c.
Also, the simplified USB HID profile code is in place, so you can do things like this:
Code: Select all
#include <USBComposite.h>
USBHID HID;
HIDMouse mouse(HID);
HIDJoystick joystick(HID);
HIDJoystick joystick2(HID);
void setup() {
HID.begin();
}
void loop() {
mouse.move(0,5);
joystick.X(0);
joystick2.Y(0);
delay(1000);
mouse.move(0,-5);
joystick.X(151);
joystick2.Y(199);
delay(1000);
}