This is from our WIP2 Bluetooth branch which is about a year out of date.
I copied files to other location, then created this branch and used WinMerge to merge in all related changes,
Without hopefully undoing any of the other changes
Turns out they are a lot different than other PS3 controllers.
When plugged into USB, it appears like these units do not send
any reports. They do allow us to do pairing (which is differnt)
than other PS3, as well as set the Bulb LED color, which I now
have it alternating colors every few seconds and also it tries
to pair it with a BT dongle
When connected to Bluetooth, it now is setup to generate reports,
as well as again set the bulb color and rumble.
So far it maps the 3 button bytes into the buttons field and then
simply copies most all of the data down into Axis, starting where
the Trigger button is.
JoystickBT.ino was updated, to know about this controller and as
mentioned above in the USB case it tries to pair and plays with the
color of bulb.
In the BT case it tries to display data. I did a quick and dirty
change of the Accel/Gyro like stuff which is probably totally wrong.
Pressing some of the buttons will set bulb color and pressing trigger
will set rumble.
PS3 Motion controller - very little mapping of axis
Trying out using the extended Inquiry data search instead of the real simple one. This allows us to hopefully get the name of the device as part of this, which now allows the PS4 to know it is a PS4 on the Pair type constructor.
Still WIP to understand XBox one...
Support to pair PS3 if it knows the BTADDR and user presses select and PS button and plugged in USB.
Remembers remote name, and tries to get it when PAIR version of code is running. (Currently fails).
Does some mapping of PS3 Bluetooth data to match USB HID data.
Warning: as part of debuggigng why joystickType value was changing, I changed the class to make it a function you call instead of just a member variable. Should mark it inline... I think I caught all of the places in example code that was accessing it. If we find we want ability for user probram to update it, should add another member to explicityly set it.
I have some PS3 support working... Hope I did not break PS4.... ;)
Also This assumes that you did a bind of the dongle to PS3 external, no support yet, I did this on RPI3...
Rumble needs work!
Hopefully did not break other things...
Find that the PS4 requires you to ask to connect versus some/most other devices will do the request...
Also found issue without printing, where adding a delay(1) in a couple of places appears to help when Serial1 printing is not on
Support for using the Microsoft XBox 360 wireless receiver for windows
to be able to communicate with XBox 360 wireless controllers.
In theory this should support up to 4 controllers. So far I have only
tested with one as I only have one.
Added a joystick only test that should support up to 4 joystick objects.
Changed from claim at device level to interface level. such that the Microsoft Wireless controller can support multiple joysticks...
Tested with one joystick as I only have 1 (I think)...
WIP - So far i am getting the basic values for 1 XBox 360 controller. The device should handle up to 4 devices, but so far hard coded to only handle 1...
Added support for Joysticks, that on some of them we can not receive more of the Joysticks axis. So far mainly on PS3 and PS4. So you can now get the Gyro/accel stuff. You get feedback on the DS4 touch area, PS3 you can get the pressure values on several of the buttons. LIke the RT/LT ones.
In addition added some support for Rumble. So far it appears to be working somewhat on the PS3 and PS4 controllers. On the PS4 you can also set the RGB LED light values and on the PS3 you can set the 4 LEDS on the front., which are normally used to say which controller it is.
While the other Joystick objects currently supported by the USB Host
code are driven by HID data, the Xbox does not contain HID data and
instead works at the top level.
To handle this I made the Joystick object use multiple InHeritence like:
class JoystickController : public USBDriver, public USBHIDInput
This allowed me to have the object work either way. This did add some
complexity in that some of the methods like is the object connected
(The bool operator) had to be overwritten as both of the bases classes
had it. In addition needed to update the other query functions to be
able to grab the data from mydevice or device depending on which type of
controller was connected.
Since this looked like a valid way, I then merged the Keyboard Extras
code that Keyboard and made it also do a similar multiple inheritance.
In this case however I restricted the HID top level report handle code
to only accept it if on the same object that claimed the keyboard.
The mouse test app was updated as well
Needed HID Parser to support Bidirectional Transfers
The HidParser code was setup such that the claim for a report, the caller could say I want to claim the whole thinig and allowed callback functions for processing of in buffer and out buffer.
Allow RawHID to contribute Transfer_t
Since RawHID may need more resources than most, maybe it should contribute the additional structures
The constructor for a RAWHID object allows you to specify the top usage
that it wishes to connect to. I used this for example to be able to
connect to a Teensy with the RAWHID associated with emulating the
Serial object.
If a HID Input class says that it wants to claim the whole interface, I
reuse the buffer associated with holding the HID descriptor and use it
for output buffers.