Subversion Repositories shark

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1090 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
/* CVS :        $Id: dummy.c,v 1.1 2002-10-01 10:25:00 pj Exp $ */
22
 
23
/*
24
 * Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.it>
25
 *
26
 * This program is free software; you can redistribute it and/or modify
27
 * it under the terms of the GNU General Public License as published by
28
 * the Free Software Foundation; either version 2 of the License, or
29
 * (at your option) any later version.
30
 *
31
 * This program is distributed in the hope that it will be useful,
32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 * GNU General Public License for more details.
35
 *
36
 * You should have received a copy of the GNU General Public License
37
 * along with this program; if not, write to the Free Software
38
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
39
 *
40
 */
41
 
42
//************************
43
//* file:        dummy.c *
44
//* included by: bca.c   *
45
//************************
46
 
47
PID crea_soft_dummy_radar()
48
{
49
  SOFT_TASK_MODEL m;
50
  PID pid;
51
 
52
  soft_task_default_model(m);
53
  soft_task_def_level(m,0);
54
  soft_task_def_periodic(m);
55
  soft_task_def_period(m,DUMMY_RADAR_PERIOD);
56
  soft_task_def_wcet(m,DUMMY_RADAR_WCET);
57
  soft_task_def_met(m,DUMMY_RADAR_MET);
58
 
59
  pid = task_create("dummy_radar", dummy_radar, &m, NULL);
60
  return pid;
61
}
62
 
63
TASK dummy_radar(void *argv)
64
{
65
  WORD i,r,r_max,pos;
66
  BYTE red[3]={250, 150,50};
67
  int  d[3]=  {+10,+10,+10};
68
 
69
  r =     0;
70
  r_max = ballframe_radar->r+1;
71
 
72
  while(1){
73
    for(i=0; i<3; i++) {
74
      if (red[i]<50)  d[i]=+10;
75
      if (red[i]>250) d[i]=-50;
76
      red[i] += d[i];
77
      grx_disc(ballframe_lucerossa[i]->cx,
78
               ballframe_lucerossa[i]->cy,
79
               ballframe_lucerossa[i]->r,
80
               FAB_rgb(red[i],50,50));
81
      }
82
    grx_disc(ballframe_radar->cx,
83
             ballframe_radar->cy,
84
             r_max, FAB_blue);
85
    grx_circle(ballframe_radar->cx,
86
               ballframe_radar->cy,
87
               (r+9)%r_max, FAB_white);
88
    grx_circle(ballframe_radar->cx,
89
               ballframe_radar->cy,
90
               (r+5)%r_max, FAB_rgb(200,200,255));
91
    grx_circle(ballframe_radar->cx,
92
               ballframe_radar->cy,
93
               r%r_max, FAB_rgb(100,100,255));
94
    for (i=0; i<AEREO_N_MAX; i++) {
95
      if (aereo_table[i].status
96
         &&aereo_table[i].x>X0
97
         &&aereo_table[i].y>Y0) {
98
            pos = ballframe_radar->cx - ballframe_radar->r
99
                + (aereo_table[i].x-X0)*2*ballframe_radar->r/500;
100
            grx_plot(pos,ballframe_radar->cy,FAB_yellow);
101
            }
102
      }
103
    r++;
104
 
105
  task_endcycle();
106
  }
107
}