staticvoidnothing(void){}staticvolatilevoidFuncPtrintFunc[EXTERNAL_NUM_INTERRUPTS]={nothing,nothing,};voidattachInterrupt(uint8_tinterruptNum,void(*userFunc)(void),intmode){if(interruptNum<EXTERNAL_NUM_INTERRUPTS){intFunc[interruptNum]=userFunc;// Configure the interrupt mode (trigger on low input, any change, rising
// edge, or falling edge). The mode constants were chosen to correspond
// to the configuration bits in the hardware register, so we simply shift
// the mode into place.
// Enable the interrupt.
switch(interruptNum){case0:EICRA=(EICRA&~((1<<ISC00)|(1<<ISC01)))|(mode<<ISC00);EIMSK|=(1<<INT0);break;case1:EICRA=(EICRA&~((1<<ISC10)|(1<<ISC11)))|(mode<<ISC10);EIMSK|=(1<<INT1);break;case2:break;}}}
// Configure the interrupt mode (trigger on low input, any change, rising
// edge, or falling edge). The mode constants were chosen to correspond
// to the configuration bits in the hardware register, so we simply shift
// the mode into place.
// Enable the interrupt.
switch(interruptNum){case0:EICRA=(EICRA&~((1<<ISC00)|(1<<ISC01)))|(mode<<ISC00);EIMSK|=(1<<INT0);break;case1:EICRA=(EICRA&~((1<<ISC10)|(1<<ISC11)))|(mode<<ISC10);EIMSK|=(1<<INT1);break;case2:break;}}}
/*
Copyright (c) 2016 garretlab.
Added source code explanation by garretlab.
*//*
Part of the Wiring project - http://wiring.uniandes.edu.co
Copyright (c) 2004-05 Hernando Barragan
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
Modified 24 November 2006 by David A. Mellis
Modified 1 August 2010 by Mark Sproul
*/