Skip to content
Snippets Groups Projects
pinchange.ino 459 B
Newer Older
  • Learn to ignore specific revisions
  • Markus Scheck's avatar
    Markus Scheck committed
    // This module uses PIN CHANGE INTERRUPT INT3
    
    #include <avr/interrupt.h>
    #include <avr/io.h>
    #include "timer_1.h"
    
    //initialize pin change interrupt and data directions
    inline void init_pc(void) {
      // enable/ setup output port
      DDRA = 0xff; // all out
      PORTA = 0x00; // all low
    
      // enable input port
      // enable interrupt
      EICRA |= (1<<ISC30)|(1<<ISC31);
      EIMSK |= (1<<INT3);
    }
    
    ISR(INT3_vect) {
      Serial.println(timer_stop());
    }