mirror of
https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter
synced 2024-11-22 00:52:22 -05:00
Update temp.ino
This commit is contained in:
parent
328a27126f
commit
ffad53f268
@ -67,7 +67,7 @@ ISR(INT3_vect, ISR_NAKED) { // falling edge, output joystick 4
|
|||||||
asm volatile(
|
asm volatile(
|
||||||
" push r0 \n" // save register r0
|
" push r0 \n" // save register r0
|
||||||
" lds r0, %[gpio] \n" // GPIOR1 address is 42 and out-command works only with 0-31
|
" lds r0, %[gpio] \n" // GPIOR1 address is 42 and out-command works only with 0-31
|
||||||
" out %[pin], r0 \n" // so we need lds-command
|
" out %[pin], r0 \n" // so we need lds-command and r0 register
|
||||||
" pop r0 \n" // restore previous r0
|
" pop r0 \n" // restore previous r0
|
||||||
" rjmp INT3_vect_part_2 \n" // go to part 2 for required prologue and epilogue
|
" rjmp INT3_vect_part_2 \n" // go to part 2 for required prologue and epilogue
|
||||||
:: [pin] "I" (_SFR_IO_ADDR(PORTB)), [gpio] "I" (_SFR_IO_ADDR(GPIOR1)));
|
:: [pin] "I" (_SFR_IO_ADDR(PORTB)), [gpio] "I" (_SFR_IO_ADDR(GPIOR1)));
|
||||||
@ -90,7 +90,7 @@ void setup() {
|
|||||||
EIMSK = B1100; // enable INT2 (Bx1xx) and INT3 (B1xxx)
|
EIMSK = B1100; // enable INT2 (Bx1xx) and INT3 (B1xxx)
|
||||||
|
|
||||||
//Serial.begin(115200);
|
//Serial.begin(115200);
|
||||||
//PORTD &= ~_BV(5);
|
//PORTD &= ~_BV(5); // TX-LED on
|
||||||
|
|
||||||
// We can't use millis() or micros() because Timer0 interrupts are disabled. We use 16-bit Timer1 with 1024 prescaler as "clock".
|
// We can't use millis() or micros() because Timer0 interrupts are disabled. We use 16-bit Timer1 with 1024 prescaler as "clock".
|
||||||
TIMSK1 = 0; // disable timer1 interrupts
|
TIMSK1 = 0; // disable timer1 interrupts
|
||||||
@ -118,6 +118,6 @@ void loop() {
|
|||||||
|
|
||||||
GPIOR0 = joy1; GPIOR1 = joy2;
|
GPIOR0 = joy1; GPIOR1 = joy2;
|
||||||
|
|
||||||
PORTB = *ptr; // can ISR occur while only one byte from 16-bit address is copied? should this be done interrupt off?
|
PORTB = *ptr; // is this atomic? probably, because ptr is 6-bit ptr?
|
||||||
//delayMicroseconds(10);
|
//delayMicroseconds(10);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user