This commit is contained in:
parent
9e70e8a03d
commit
42da4894c8
3 changed files with 9 additions and 7 deletions
|
@ -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,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
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…
Reference in a new issue