Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1389 → Rev 1363

/demos/trunk/input/joy.c
15,6 → 15,8
*/
 
/*
* Copyright (C) 2000 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
28,6 → 30,7
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include <kernel/kern.h>
35,8 → 38,20
#include <stdlib.h>
#include <string.h>
 
#include <drivers/shark_linuxc26.h>
#include <drivers/shark_input26.h>
#include <drivers/shark_joy26.h>
 
//void my_sysclose(KEY_EVT *e)
void my_sysclose(void)
{
JOY26_close();
INPUT26_close();
 
kern_printf("S.Ha.R.K. closed.\n\n");
sys_end();
}
 
TASK my_getjoy(void *arg) {
 
int a0, a1, a2, a3, btn;
46,7 → 61,7
printk ("(%6d %6d) %2x\n", a0, a1, btn);
task_endcycle();
if (btn == 0xF)
sys_end();
my_sysclose();
}
}
 
55,15 → 70,12
SOFT_TASK_MODEL mp;
PID pid;
 
if (!JOY26_installed()) {
printk("No Joystick found.");
sys_end();
}
soft_task_default_model(mp);
soft_task_def_level(mp,2);
soft_task_def_ctrl_jet(mp);
soft_task_def_met(mp,700);
soft_task_def_period(mp,10000);
//soft_task_def_aperiodic(mp);
soft_task_def_usemath(mp);
pid = task_create("Joy_Print", my_getjoy, &mp, NULL);
if (pid == NIL) {
71,6 → 83,10
sys_end();
} else
task_activate(pid);
/*while ( (sys_gettime(NULL)/1000) < 20000);
my_sysclose();*/
//while(1);
 
return 0;
}