Browse Source

feature/2015
tixiv 16 years ago
parent
commit
42da4894c8
  1. 10
      joystick/config.in
  2. 5
      joystick/nes_pad.c
  3. 1
      makros.h

10
joystick/config.in

@ -120,11 +120,11 @@ choice 'Port ds' \
'PORTB' NES_PAD_PORT_PL
choice 'Pin pl' \
"PINA PINA \
PINB PINB \
PINC PINC \
PIND PIND" \
'PINB' NES_PAD_PIN_DS
"PORTA PORTA \
PORTB PORTB \
PORTC PORTC \
PORTD PORTD" \
'PORTB' NES_PAD_PORT_DS
choice 'Bit clk' \

5
joystick/nes_pad.c

@ -5,7 +5,8 @@
#define NES_PAD_DDR_PL DDR(NES_PAD_PORT_PL)
#define NES_PAD_DDR_CLK DDR(NES_PAD_PORT_CLK)
#define NES_PAD_DDR_DS DDR(NES_PAD_PIN_DS)
#define NES_PAD_PIN_DS PIN(NES_PAD_PORT_DS)
#define NES_PAD_DDR_DS DDR(NES_PAD_PORT_DS)
volatile unsigned char fakeport;
unsigned char waitForFire;
@ -14,9 +15,9 @@ void joy_init(){
NES_PAD_DDR_PL |= 1<<NES_PAD_BIT_PL;
NES_PAD_DDR_CLK |= 1<<NES_PAD_BIT_CLK;
NES_PAD_PORT_DS |= (1<<NES_PAD_BIT_DS);//pullup
NES_PAD_DDR_DS &= ~(1<<NES_PAD_BIT_DS);
}
void readButtons(){

1
makros.h

@ -1,5 +1,6 @@
#define DDR(port) (*(volatile uint8_t*)((&port)-1))
#define PIN(port) (*(volatile uint8_t*)((&port)-2))
#define DDR_FROM_PIN(pin) (*(volatile uint8_t*)((&pin)+1))

Loading…
Cancel
Save