Rev 1389 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1363 | mauro | 1 | |
2 | /* |
||
3 | * Project: S.Ha.R.K. |
||
4 | * |
||
5 | * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * |
||
7 | * Authors : Mauro Marinoni <mauro.marinoni@unipv.it> |
||
8 | * (see authors.txt for full list of hartik's authors) |
||
9 | * |
||
10 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
11 | * |
||
12 | * http://www.sssup.it |
||
13 | * http://retis.sssup.it |
||
14 | * http://shark.sssup.it |
||
15 | */ |
||
16 | |||
17 | /* |
||
18 | * This program is free software; you can redistribute it and/or modify |
||
19 | * it under the terms of the GNU General Public License as published by |
||
20 | * the Free Software Foundation; either version 2 of the License, or |
||
21 | * (at your option) any later version. |
||
22 | * |
||
23 | * This program is distributed in the hope that it will be useful, |
||
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
26 | * GNU General Public License for more details. |
||
27 | * |
||
28 | * You should have received a copy of the GNU General Public License |
||
29 | * along with this program; if not, write to the Free Software |
||
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
31 | */ |
||
32 | |||
33 | #include <kernel/kern.h> |
||
34 | #include <kernel/func.h> |
||
35 | #include <stdlib.h> |
||
36 | #include <string.h> |
||
37 | |||
38 | #include <drivers/shark_mouse26.h> |
||
39 | #include <drivers/shark_keyb26.h> |
||
40 | #include <drivers/shark_spk26.h> |
||
41 | |||
42 | void my_sysclose(KEY_EVT *e) |
||
43 | { |
||
44 | mouse_txtcursor(DISABLE); |
||
45 | |||
46 | sys_end(); |
||
47 | } |
||
48 | |||
49 | TASK my_putxy(void *arg) { |
||
50 | |||
51 | int x, y, z; |
||
52 | unsigned long btn; |
||
53 | |||
54 | clear(); |
||
55 | |||
56 | while (1) { |
||
1389 | mauro | 57 | mouse_getposition(&x, &y, &z, &btn); |
1363 | mauro | 58 | place(10, 10); |
1399 | giacomo | 59 | cprintf("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn); |
1363 | mauro | 60 | |
61 | task_endcycle(); |
||
62 | } |
||
63 | } |
||
64 | |||
65 | int main(int argc, char **argv) |
||
66 | { |
||
67 | SOFT_TASK_MODEL mp; |
||
68 | PID pid; |
||
69 | KEY_EVT ev; |
||
70 | |||
71 | ev.ascii = 'c'; |
||
72 | ev.scan = KEY_C; |
||
73 | ev.status = KEY_PRESSED; |
||
74 | ev.flag = CNTL_BIT; |
||
75 | keyb_hook(ev, my_sysclose, FALSE); |
||
76 | ev.flag = CNTR_BIT; |
||
77 | keyb_hook(ev, my_sysclose, FALSE); |
||
78 | |||
79 | mouse_txtcursor(ENABLE); |
||
80 | |||
81 | soft_task_default_model(mp); |
||
82 | soft_task_def_level(mp,2); |
||
83 | soft_task_def_ctrl_jet(mp); |
||
84 | soft_task_def_met(mp,700); |
||
85 | soft_task_def_period(mp,1000); |
||
86 | soft_task_def_usemath(mp); |
||
87 | pid = task_create("Mouse_Print", my_putxy, &mp, NULL); |
||
88 | if (pid == NIL) { |
||
1399 | giacomo | 89 | sys_shutdown_message("Could not create task <Mouse_Print>\n"); |
1363 | mauro | 90 | my_sysclose(NULL); |
91 | } else |
||
92 | task_activate(pid); |
||
93 | |||
94 | return 0; |
||
95 | } |