Subversion Repositories pentevo

Rev

Rev 112 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <avr/io.h>
  2.  
  3. #include "pins.h"
  4. #include "mytypes.h"
  5.  
  6. #include "rs232.h"
  7. #include "zx.h"
  8. #include "joystick.h"
  9.  
  10. void joystick_task(void)
  11. {
  12.         static UBYTE joy_state = 0;
  13.         UBYTE temp = (~JOYSTICK_PIN) & JOYSTICK_MASK;
  14.  
  15.         if ( joy_state ^ temp )
  16.         {
  17.                 //change state of joystick pins
  18.                 joy_state = temp;
  19.  
  20.                 //send to port
  21.                 zx_spi_send(SPI_KEMPSTON_JOYSTICK, joy_state, 0x7F);
  22.  
  23. #ifdef LOGENABLE
  24.         char log_joystick[] = "JS..\r\n";
  25.         log_joystick[2] = ((temp >> 4) <= 9 )?'0'+(temp >> 4):'A'+(temp >> 4)-10;
  26.         log_joystick[3] = ((temp & 0x0F) <= 9 )?'0'+(temp & 0x0F):'A'+(temp & 0x0F)-10;
  27.         to_log(log_joystick);
  28. #endif
  29.         }
  30. }
  31.