diff options
Diffstat (limited to 'linuxjoystick.c')
-rw-r--r-- | linuxjoystick.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/linuxjoystick.c b/linuxjoystick.c index aa80603..0a90535 100644 --- a/linuxjoystick.c +++ b/linuxjoystick.c @@ -2,7 +2,7 @@ #define LINUXJOYSTICK_AXES 6
-static char *version = "$Revision: 1.5 $";
+static char *version = "$Revision: 1.6 $";
/*------------------------------------------------------------------------------
* CLASS DEF
@@ -14,9 +14,9 @@ typedef struct _linuxjoystick { t_int x_fd;
t_symbol *x_devname;
t_clock *x_clock;
- int read_ok;
- int started;
- int x_delaytime;
+ int x_read_ok;
+ int x_started;
+ int x_delay;
#ifdef __gnu_linux__
struct input_event x_input_event;
#endif
@@ -34,10 +34,10 @@ typedef struct _linuxjoystick { void linuxjoystick_stop(t_linuxjoystick* x) {
DEBUG(post("linuxjoystick_stop"););
- if (x->x_fd >= 0 && x->started) {
+ if (x->x_fd >= 0 && x->x_started) {
clock_unset(x->x_clock);
post("linuxjoystick: polling stopped");
- x->started = 0;
+ x->x_started = 0;
}
}
@@ -268,8 +268,8 @@ static int linuxjoystick_read(t_linuxjoystick *x,int fd) { }
#endif
- if (x->started) {
- clock_delay(x->x_clock, x->x_delaytime);
+ if (x->x_started) {
+ clock_delay(x->x_clock, x->x_delay);
}
return 1;
@@ -286,9 +286,9 @@ void linuxjoystick_delay(t_linuxjoystick* x, t_float f) { /* if the user sets the delay less than zero, reset to default */
if ( f > 0 ) {
- x->x_delaytime = (int)f;
+ x->x_delay = (int)f;
} else {
- x->x_delaytime = 5;
+ x->x_delay = DEFAULT_DELAY;
}
}
@@ -296,10 +296,10 @@ void linuxjoystick_start(t_linuxjoystick* x) { DEBUG(post("linuxjoystick_start"););
#ifdef __linux__
- if (x->x_fd >= 0 && !x->started) {
- clock_delay(x->x_clock, 5);
+ if (x->x_fd >= 0 && !x->x_started) {
+ clock_delay(x->x_clock, DEFAULT_DELAY);
post("linuxjoystick: polling started");
- x->started = 1;
+ x->x_started = 1;
} else {
post("You need to set a input device (i.e /dev/input/event0)");
}
@@ -332,9 +332,9 @@ static void *linuxjoystick_new(t_symbol *s) { /* init vars */
x->x_fd = -1;
- x->read_ok = 1;
- x->started = 0;
- x->x_delaytime = 5;
+ x->x_read_ok = 1;
+ x->x_started = 0;
+ x->x_delay = DEFAULT_DELAY;
x->x_clock = clock_new(x, (t_method)linuxjoystick_read);
/* create outlets for each axis */
|