From ab3afda24895b78472f008c61c6794cb42b2a412 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Wed, 29 Jun 2011 21:54:39 +0000 Subject: [PATCH] faster saving of i/o at interrupt --- dart/dart.pde | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dart/dart.pde b/dart/dart.pde index 7fbefaf..1ed2a0f 100644 --- a/dart/dart.pde +++ b/dart/dart.pde @@ -57,9 +57,12 @@ void stop_timer() // stop the timer */ byte last_input=0; byte last_output=0; -static void PCint(uint8_t port) { - byte input = ( INPUT_SIG_PORTB & ~ PINB ) | ( ( INPUT_SIG_PORTC & ~ PINC ) <<1 ) |( INPUT_SIG_PORTD & ~ PIND ); - byte output = ( OUTPUT_SIG_PORTC & ~ PINC ) | (( OUTPUT_SIG_PORTD & ~ PIND ) <<2 ); // no output on B +static void PCint() { + byte PINB_COPY = PINB; + byte PINC_COPY = PINC; + byte PIND_COPY = PIND; + byte output = ( OUTPUT_SIG_PORTC & ~ PINC_COPY ) | (( OUTPUT_SIG_PORTD & ~ PIND_COPY ) <<2 ); // no output on B + byte input = ( INPUT_SIG_PORTB & ~ PINB_COPY ) | ( ( INPUT_SIG_PORTC & ~ PINC_COPY ) <<1 ) |( INPUT_SIG_PORTD & ~ PIND_COPY ); if (!input) return; @@ -76,13 +79,13 @@ static void PCint(uint8_t port) { SIGNAL(PCINT0_vect) { - PCint(0); + PCint(); } SIGNAL(PCINT1_vect) { - PCint(1); + PCint(); } SIGNAL(PCINT2_vect) { - PCint(2); + PCint(); } void setup() { -- 1.7.10.4