Subversion Repositories svnkaklik

Rev

Rev 6 | Blame | Last modification | View Log | Download

#include "main.h"
#include "c:\library\kaklik\CSS\PS2.c"

#define SIGN_X 4

void trigger()
{
   output_high(PIN_A0);
   output_low(PIN_A0);
   delay_us(100);
   output_high(PIN_A0);
}

void flash_red()                             // blikne ledkou
{
   output_high(LED_red);
   Delay_ms(BLIK);
   output_low(LED_red);
}

void flash_yellow()                             // blikne ledkou
{
   output_high(LED_yellow);
   Delay_ms(BLIK);
   output_low(LED_yellow);
}

void main()
{
int8 X,y,tl=0;
int8 X_old,y_old,tl_old=0;

   Delay_ms(500);
   send(ENABLE_DATA_REPORTING);

   while(true)
   {
      tl = read_byte(PRVNI);
       x = read_byte(DRUHY);
       y = read_byte(TRETI);
      trigger();


      if (bit_test(tl, SIGN_X))
      {
         output_high(LED_red);
         output_low(LED_yellow);
      }
      else
      {
         output_high(LED_yellow);
         output_low(LED_red);
      }
   }
}