#include <stdio.h>
#include <stdint.h>
#include <getopt.h>
#include <errno.h>
#include <unistd.h>
#include <SDL/SDL.h>
#include <helicontrol.h>
Go to the source code of this file.
Defines | |
#define | bound(min, num, max) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min)) |
#define | JOYSTICK 0 |
#define | JOYSTICK_THROTTLE_MAX -32768 |
#define | JOYSTICK_YAW_MAX -32768 |
#define | JOYSTICK_PITCH_MAX -32768 |
#define | JOYSTICK_ROLL_MAX 32768 |
#define | JOYSTICK_AXIS_SAUCER_ROLL 2 |
#define | JOYSTICK_AXIS_SAUCER_YAW 0 |
#define | JOYSTICK_AXIS_THROTTLE 1 |
#define | JOYSTICK_AXIS_YAW 2 |
#define | JOYSTICK_AXIS_PITCH 3 |
#define | JOYSTICK_BUTTON_TRIM_L 6 |
#define | JOYSTICK_BUTTON_TRIM_R 7 |
#define | JOYSTICK_BUTTON_FIRE1 4 |
#define | JOYSTICK_BUTTON_FIRE2 5 |
#define | JOYSTICK_BUTTON_PITCH1 4 |
#define | JOYSTICK_BUTTON_PITCH2 5 |
#define | INTERVAL 25000 |
#define | MODE_NORMAL 0 |
#define | MODE_JOYSTICK 1 |
#define | MODE_STOP 2 |
Functions | |
static void | usage (void) |
static void | send_frame (char protocol, char channel, char throttle, char trim, char yaw, char pitch, char special) |
int | main (int argc, char **argv) |
Variables | |
static struct option | long_options [] |
struct usb_dev_handle * | handle |
It implements a simple remote control, similar to helictrl.cc in ../tools but with joystick support (SDL, not available on win32/vs2008).
Definition in file helidemo_sdl.c.
#define bound | ( | min, | |||
num, | |||||
max | ) | ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min)) |
Definition at line 44 of file helidemo_sdl.c.
Referenced by send_frame().
#define INTERVAL 25000 |
#define JOYSTICK 0 |
#define JOYSTICK_AXIS_PITCH 3 |
#define JOYSTICK_AXIS_SAUCER_ROLL 2 |
#define JOYSTICK_AXIS_SAUCER_YAW 0 |
#define JOYSTICK_AXIS_THROTTLE 1 |
#define JOYSTICK_AXIS_YAW 2 |
#define JOYSTICK_BUTTON_FIRE1 4 |
#define JOYSTICK_BUTTON_FIRE2 5 |
#define JOYSTICK_BUTTON_PITCH1 4 |
#define JOYSTICK_BUTTON_PITCH2 5 |
#define JOYSTICK_BUTTON_TRIM_L 6 |
#define JOYSTICK_BUTTON_TRIM_R 7 |
#define JOYSTICK_PITCH_MAX -32768 |
#define JOYSTICK_ROLL_MAX 32768 |
#define JOYSTICK_THROTTLE_MAX -32768 |
#define JOYSTICK_YAW_MAX -32768 |
#define MODE_JOYSTICK 1 |
#define MODE_NORMAL 0 |
Definition at line 65 of file helidemo_sdl.c.
Referenced by main().
#define MODE_STOP 2 |
Definition at line 67 of file helidemo_sdl.c.
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 131 of file helidemo_sdl.c.
References handle, HC_Close(), HC_CMD_Repeat(), HC_CMD_Stop(), HC_Init(), INTERVAL, JOYSTICK, JOYSTICK_AXIS_PITCH, JOYSTICK_AXIS_SAUCER_ROLL, JOYSTICK_AXIS_SAUCER_YAW, JOYSTICK_AXIS_THROTTLE, JOYSTICK_AXIS_YAW, JOYSTICK_BUTTON_FIRE1, JOYSTICK_BUTTON_FIRE2, JOYSTICK_BUTTON_PITCH1, JOYSTICK_BUTTON_PITCH2, JOYSTICK_BUTTON_TRIM_L, JOYSTICK_BUTTON_TRIM_R, JOYSTICK_PITCH_MAX, JOYSTICK_ROLL_MAX, JOYSTICK_THROTTLE_MAX, JOYSTICK_YAW_MAX, long_options, MODE_JOYSTICK, MODE_NORMAL, MODE_STOP, send_frame(), and usage().
static void send_frame | ( | char | protocol, | |
char | channel, | |||
char | throttle, | |||
char | trim, | |||
char | yaw, | |||
char | pitch, | |||
char | special | |||
) | [static] |
Definition at line 102 of file helidemo_sdl.c.
References bound, handle, HC_Send_Challenger(), HC_Send_Picooz(), HC_Send_Saucer(), HC_Send_Tandemz(), and HC_Send_Uranus().
Referenced by main().
static void usage | ( | void | ) | [static] |
struct usb_dev_handle* handle |
Definition at line 100 of file helidemo_sdl.c.
Referenced by HC_Init(), main(), and send_frame().
struct option long_options[] [static] |
Initial value:
{ {"protocol", required_argument, 0, 'p'}, {"channel", required_argument, 0, 'c'}, {"throttle", required_argument, 0, 't'}, {"trim", required_argument, 0, 'm'}, {"yaw", required_argument, 0, 'y'}, {"fire", required_argument, 0, 'f'}, {"pitch", required_argument, 0, 'i'}, {"roll", required_argument, 0, 'r'}, {"stop", no_argument, 0, 's'}, {"joystick", no_argument, 0, 'j'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }
Definition at line 69 of file helidemo_sdl.c.
Referenced by main().