Subversion Repositories pentevo

Rev

Rev 113 | Details | Compare with Previous | Last modification | View Log | RSS feed

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