Skip to content
Mike Schwager edited this page Jun 11, 2015 · 3 revisions

Introduction

The EnableInterrupt code is delivered in a zip file with associated examples and other code. To download it, see https://github.com/GreyGnome/EnableInterrupt/wiki/Download. Here's how to install it.

NOTE: Arduino 1.6.4 sports a new and much easier way to include libraries. I plan to support this method but at the time of this writing I only support the old fashioned way, described here.

Howto

Go to your Arduino's libraries folder. Look in your Arduino IDE for the library path, if you don't know it. To do so, open up the Preferences menu item and look at the Sketchbook location entry. The libraries path will be in the libraries directory beneath the Sketchbook location.

On Linux or MacOS, cd to there. On Windows, your unzip tool may have a location where you want to unzip your files. Make sure it is in the Sketchbook location. Also make sure that you recreate full paths, if your zip tool has that option as well. The command line unzip tool will properly create all subdirectories in the zip archive.

Extract the zip file there. On Linux or MacOS:

unzip /path/to/enableinterrupt-X.Y.zip
where X and Y represent the current version you are trying to install.

This will install the following files and directories:

EnableInterrupt/NOTICE 
 EnableInterrupt/README.md 
 EnableInterrupt/LICENSE 
 EnableInterrupt/EnableInterrupt.h    (the main .h file. Include this in your sketch.)
 EnableInterrupt/ei_*.h               (a number of files included by the main .h file)
 ByteBuffer/ByteBuffer.h 
 ByteBuffer/ByteBuffer.cpp 
 EnableInterrupt/examples/<a number of subdirectories, including .ino files and Makefiles>

If you're a beginner, don't worry about the Makefiles.

Files

This is the only file used directly by the library. In regular C++ projects the .h file would be broken out into .h and .cpp, but we put everything in the single file so it can be included in other libraries. The other files are for support, testing, and examples.

EnableInterrupt/EnableInterrupt.h

These files are included by the EnableInterrupt.h file. Again, I expect the purists (or merely the neat and tidy) to scoff, but I found it much easier to manage all the #ifdef's and different chip types by splitting out some of the code into separate included files. All of this code is called from the library itself; there is no code necessary outside of the library in here:

ei_External1284.h
ei_External2560.h
ei_External328.h
ei_ExternalLeonardo.h
ei_PinChange1284.h
ei_PinChange2560.h
ei_PinChange328.h
ei_PinChangeLeonardo.h
ei_porta_speed.h
ei_portb_speed.h
ei_portc_speed.h
ei_portd_speed.h
ei_portj_speed.h
ei_portk_speed.h

Clone this wiki locally