Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
#include "main.h"
2
#include "c:\library\kaklik\CSS\PS2.c"
3
 
4
#define SIGN_X 4
5
 
6
void trigger()
7
{
8
   output_high(PIN_A0);
9
   output_low(PIN_A0);
10
   delay_us(100);
11
   output_high(PIN_A0);
12
}
13
 
14
void flash_red()                             // blikne ledkou
15
{
16
   output_high(LED_red);
17
   Delay_ms(BLIK);
18
   output_low(LED_red);
19
}
20
 
21
void flash_yellow()                             // blikne ledkou
22
{
23
   output_high(LED_yellow);
24
   Delay_ms(BLIK);
25
   output_low(LED_yellow);
26
}
27
 
28
void main()
29
{
30
int8 X,y,tl=0;
31
int8 X_old,y_old,tl_old=0;
32
 
33
   Delay_ms(500);
34
   send(ENABLE_DATA_REPORTING);
35
 
36
   while(true)
37
   {
38
      tl = read_byte(PRVNI);
39
       x = read_byte(DRUHY);
40
       y = read_byte(TRETI);
41
      trigger();
42
 
43
 
44
      if (bit_test(tl, SIGN_X))
45
      {
46
         output_high(LED_red);
47
         output_low(LED_yellow);
48
      }
49
      else
50
      {
51
         output_high(LED_yellow);
52
         output_low(LED_red);
53
      }
54
   }
55
}
56
 
57