73#include "generated/airframe.h"
81#ifndef NPS_JS_AXIS_ROLL
82#define NPS_JS_AXIS_ROLL 0
84#ifndef NPS_JS_AXIS_PITCH
85#define NPS_JS_AXIS_PITCH 1
87#ifndef NPS_JS_AXIS_YAW
88#define NPS_JS_AXIS_YAW 2
90#ifndef NPS_JS_AXIS_THROTTLE
91#define NPS_JS_AXIS_THROTTLE 3
94#ifndef NPS_JS_AXIS_MODE
101#ifndef NPS_JS_BUTTON_MODE_MANUAL
102#define NPS_JS_BUTTON_MODE_MANUAL 1
104#ifndef NPS_JS_BUTTON_MODE_AUTO1
105#define NPS_JS_BUTTON_MODE_AUTO1 2
107#ifndef NPS_JS_BUTTON_MODE_AUTO2
108#define NPS_JS_BUTTON_MODE_AUTO2 3
111#ifndef NPS_JS_AXIS_MODE
112#define JS_NB_BUTTONS 3
114#define JS_NB_BUTTONS 0
171 printf(
"No joysticks attached! Quitting.\n");
178 printf(
"Joystick corresponding to SDL Index %d failed to open! Exiting.\n",
device_index);
181 printf(
"Selected joystick does not support enough axes!\n");
187 printf(
"Selected joystick does not support enough buttons!\n");
204#if NPS_JS_AXIS_THROTTLE_REVERSED
209#if NPS_JS_AXIS_ROLL_REVERSED
214#if NPS_JS_AXIS_PITCH_REVERSED
219#if NPS_JS_AXIS_YAW_REVERSED
225#ifdef NPS_JS_AXIS_MODE
226#if NPS_JS_AXIS_MODE_REVERSED
237#ifndef NPS_JS_AXIS_MODE
264 printf(
"unknown SDL event!!!\n");
#define MODE_SWITCH_MANUAL
#define MODE_SWITCH_AUTO1
#define MODE_SWITCH_AUTO2
void nps_radio_control_joystick_update(void)
Updates joystick buttons from events, directly reads current axis positions.
#define NPS_JS_BUTTON_MODE_MANUAL
#define NPS_JS_BUTTON_MODE_AUTO2
struct NpsJoystick nps_joystick
#define NPS_JS_BUTTON_MODE_AUTO1
int nps_radio_control_joystick_init(const char *device)
Initializes SDL and the joystick.
#define NPS_JS_AXIS_THROTTLE
#define NPS_JS_AXIS_PITCH
SDL_Joystick * sdl_joystick