This commit is contained in:
tixiv 2009-07-11 16:50:11 +00:00
parent 9e70e8a03d
commit 42da4894c8
3 changed files with 9 additions and 7 deletions

View File

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

View File

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

View File

@ -1,5 +1,6 @@
#define DDR(port) (*(volatile uint8_t*)((&port)-1)) #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)) #define DDR_FROM_PIN(pin) (*(volatile uint8_t*)((&pin)+1))