MorganS
Well-known member
I'm breadboarding a project right now and I'm going to be using a bunch of the USB modes which aren't Serial. Specifically joystick and flightsim. So I'm compiling my test code with different USB options and switching back and forth a lot.
If I use features specific to a mode without compiling in that mode, then it is an error. So I wrap my code in some #ifdef to see if the USB mode required is active. For example...
That one works great. But I can't do the same for joystick. The obvious #ifdef JOYSTICK_INTERFACE doesn't work. I even copy-pasted from the USB HID header files to make sure I typed it correctly. Other variants I tried such as #ifdef USB_FLIGHTSIM_JOYSTICK don't work either.
So how do I write #ifdef JOYSTICK_INTERFACE in a way that works when the joystick USB is enabled?
If I use features specific to a mode without compiling in that mode, then it is an error. So I wrap my code in some #ifdef to see if the USB mode required is active. For example...
Code:
#ifdef FLIGHTSIM_INTERFACE
FlightSimFloat xpYokePitch, xpSurfacePitch, xpPitchTrim;
#endif
That one works great. But I can't do the same for joystick. The obvious #ifdef JOYSTICK_INTERFACE doesn't work. I even copy-pasted from the USB HID header files to make sure I typed it correctly. Other variants I tried such as #ifdef USB_FLIGHTSIM_JOYSTICK don't work either.
So how do I write #ifdef JOYSTICK_INTERFACE in a way that works when the joystick USB is enabled?