You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use this library to intervace with my Logitech extreme 3D pro joystick controller so I made a few additions to the source code. I basically followed the same format that the Mouse and Keyboard use but adapted it to be used for the joystick device.
void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
{
bool match = true;
JOYSTICKINFO *pjs = (JOYSTICKINFO*)buf;
// Checking if there are changes in report since the method was last called
for (uint8_t i=0; i<7; i++) {
if( buf[i] != prevState.oldPad[i] ) {
match = false;
break;
}
}
// Calling Game Pad event handler
if (!match && pjs) {
OnJoystickChanged((JOYSTICKINFO*)buf);
//OnJoystickChanged(buf);
for (uint8_t i=0; i<7; i++)
prevState.oldPad[i] = buf[i];
}
}
in hid.h, added: #define HID_PROTOCOL_JOYSTICK 0x03
And when I tried to implement this in an Arduino sketch, I got the following errors:
JoystickController:9: error: cannot declare variable 'joy' to be of abstract type 'JoystickController'
JoystickController joy(usb);
^
In file included from C:\Users\Aaron\Documents\Arduino\JoystickController\JoystickController.ino:3:0:
C:\Users\Aaron\Documents\Arduino\libraries\USBHost\src/JoystickController.h:11:7: note: because the following virtual functions are pure within 'JoystickController':
class JoystickController : public JoystickReportParser
^
In file included from C:\Users\Aaron\Documents\Arduino\libraries\USBHost\src/hidboot.h:24:0,
from C:\Users\Aaron\Documents\Arduino\libraries\USBHost\src/JoystickController.h:7,
from C:\Users\Aaron\Documents\Arduino\JoystickController\JoystickController.ino:3:
C:\Users\Aaron\Documents\Arduino\libraries\USBHost\src/hid.h:157:15: note: virtual void HIDReportParser::Parse(HID*, bool, uint32_t, uint8_t*)
virtual void Parse(HID *hid, bool is_rpt_id, uint32_t len, uint8_t *buf) = 0;
^
Using library USBHost at version 1.0.4 in folder: C:\Users\Aaron\Documents\Arduino\libraries\USBHost
exit status 1
cannot declare variable 'joy' to be of abstract type 'JoystickController'
I searched for any differences in how the mouse and keyboard controllers were initialized and I couldn't find anything. I'm not very experienced in C++ so i need some help.
Thanks in advance,
Aaron
The text was updated successfully, but these errors were encountered:
I also do not have much C++ experience but I did notice a small difference. Below shows the addition of the HID_PROTOCOL_JOYSTCK parameter. I hope this helps.
Hello,
I am trying to use this library to intervace with my Logitech extreme 3D pro joystick controller so I made a few additions to the source code. I basically followed the same format that the Mouse and Keyboard use but adapted it to be used for the joystick device.
JoystickController.cpp:
JoystickController.h:
I added this to hidboot.cpp:
and i added this to hdiboot.h:
in hid.h, added:
#define HID_PROTOCOL_JOYSTICK 0x03
And when I tried to implement this in an Arduino sketch, I got the following errors:
I searched for any differences in how the mouse and keyboard controllers were initialized and I couldn't find anything. I'm not very experienced in C++ so i need some help.
Thanks in advance,
Aaron
The text was updated successfully, but these errors were encountered: