Go Down

Topic: EnableInterrupt library- to attach interrupts to Arduino pins (Read 11389 times) previous topic - next topic

GreyGnome

Hello,
I would like to announce the first public release of the EnableInterrupt library. As of now, I'm calling it Alpha  code, and the release version is 0.2.

You can get it at https://github.com/GreyGnome/EnableInterrupt. See the wiki here.

The EnableInterrupt library is a new Arduino interrupt library, designed for all versions of the Arduino- at this writing, the Uno (and other ATmega328p-based boards, like the mini), Due, Leonardo (and other ATmega32u4-based boards, like the Micro), and Mega2560 (and other ATmega2560-based boards, like the MegaADK). It enables you to assign an interrupt to pins on your chip that support them, and presents a common interface to all supported chips. This means that on the Arduino Uno and Mega you don't give it an interrupt number, as per attachInterrupt. Rather, your first argument is simply a pin number. Naturally, you must give the number of a pin that's supported on that chip (see the bestiary on the Usage wiki page).

The library also blurs the distinction between the different interrupt types across the different chip types, and presents a single api for an interrupt on a pin. Please read about the interrupt types here.

At the time of this writing the code is only tested on an Arduino Uno and Mega ADK, so it has not been tested on the Due or Leonardo. But the Due is exceptionally simple to code (simply a #define), and the Leonardo is pretty simple, pin-interrupt-wise. But if someone could give me a bug report on those platforms, I'd appreciate it. Thanks.


CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

GreyGnome

Will '1284P support be included at some point?
It seems pretty straightforward- I had 644 support in the PinChangeInt library and I think the 1284p is similar, but I'd have to study the port layout a little bit closer. If the pin-to-pcint correspondence is 328p-like (on ports B, C, and D) and 644-like on port A, then that will help.

That said, I don't have a 1284p so I'll have to ask someone else to debug for me... I thought the 2560 would trivial after the 328p but I had more forgotten letter-replacement errors than I'd like to admit.  :smiley-eek-blue:

Well, no promises but the chip looks nice and, time willing, I'll give it a go in a few weeks most likely. Now that this is done / completed / to a point I'm comfortable with / released, I have a couple of other projects to take care of.

GreyGnome

I just released version 0.3 of this library, which includes a bugfix from 0.2. From the release notes:

Mon Apr 13 07:49:05 CDT 2015
Version 0.3 - Arjun reported a bug on the Uno platform:

In file included from Interrupt.ino:1:
/Users/arjunmehta94/Documents/Arduino/libraries/EnableInterrupt-master/EnableInterrupt.h: In function 'void __vector_3()':
/Users/arjunmehta94/Documents/Arduino/libraries/EnableInterrupt-master/EnableInterrupt.h:976: error: 'struct functionPointersPortB' has no member named 'pinSix'
/Users/arjunmehta94/Documents/Arduino/libraries/EnableInterrupt-master/EnableInterrupt.h:977: error: 'struct functionPointersPortB' has no member named 'pinSeven'

I have a Duemilanove; I don't know why I never saw that error. Regardless, I have included some
#ifndef lines in to protect that code from getting compiled.

You can get the library here: https://github.com/GreyGnome/EnableInterrupt. See the wiki here.

GreyGnome

I just released version 0.4 of this library, which includes a new performance mode.

You can get the library here. See the wiki here. The new mode is described here. Usage information can be found here.

From the Release Notes:

Fri May  8 07:33:26 CDT 2015
Version 0.4 - New high speed ("HiSpeed") mode. In this mode, the interrupt routine is predefined:
it ONLY updates a variable. This knocks a couple of microseconds off of the interrupt routine times; it greatly reduces the number of registers needed to be pushed/popped, and of course does not require a function call. See the wiki for details, including speed measurements.


robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

GreyGnome

I just released version 0.5 of this library, which includes ATmega644/1284(p) support.

You can get the library here. See the wiki here. The new mode is described here. Usage information can be found here.

From the Release Notes:

Fri Jun 12 06:33:20 CDT 2015
Version 0.5 (Alpha) of the library has been released. This release includes support for the ATmega1284p line of processors (includes ATmega644). The Mighty 1284 is used as the basis.  As I don't have a 1284-based processor, this code compiles but has not been tested (see examples/Might1284p). Bug reports encouraged and welcomed! It would be great if a 644/1284 owner could upload the Might1284p.ino sketch and interrupt every pin and let me know the results.

Code was refactored so that a lot of utility routines were moved into individual .h files. Now there's a lot of files, which appears ugly, but the old way was a lot uglier to my mind and looked like a big bowl of spaghetti with so many #ifdefs strewn about to handle the different chips. It was getting hard to wade through the code.

GreyGnome

Will '1284P support be included at some point?
.... Yes.   :)

GreyGnome

Fri Jun 19 09:38:43 CDT 2015
Version 0.6.2 of the library has been released. This version is designed to meet the requirements of the 1.5.x Arduino library spec. No code logic was modified; only files were moved and library.properties and keywords.txt files added.

I hope to see the library in the Arduino IDE (1.5.x and up) library manager soon. I have posted a request to the Github issues page.

You can get the library here. See the wiki here. The High Speed mode is described here. Usage information can be found here.

Finally, direct download link is here

Happiness here and here.

Here is here

GreyGnome

Tue Jun 23 06:47:10 CDT 2015

Version 0.7.0 of the library has been released. This release includes compiler directives that allow you
to eliminate unneeded ports and memory allocations, to more efficiently utilize code and static RAM. See https://github.com/GreyGnome/EnableInterrupt/wiki/SaveMemory for the new features.

The library is available in the Arduino 1.6.x  IDE Library Manager (from the Sketch Menu -> Include Library -> Manage Libraries).

The library's home page is here. See the wiki here. The memory saving features are described here. Usage information can be found here.

Finally, direct download link is here

Happiness here and here.

GreyGnome

Tue Jun 23 06:47:10 CDT 2015 Version 0.8.0 of the library has
been released. This release includes a compiler directive that allows you to query a variable and know which pin triggered the interrupt (sorry, this capability is not available on the Due). See https://github.com/GreyGnome/EnableInterrupt/wiki/Usage#Determine_the_Pin_That_Was_Interrupted

The library is available in the Arduino 1.6.x  IDE Library Manager (from the Sketch Menu -> Include Library -> Manage Libraries).

The library's home page is here. See the wiki here. Usage information can be found here.

Finally, direct download link is here

Happiness here and here.

GreyGnome

...Ooops, and v. 0.8.1 is now up. I missed a fix for the ATmega1284.  Get it at https://bintray.com/artifact/download/greygnome/generic/enableinterrupt-0.8.1.zip

GreyGnome

Version 0.8.2 is now released. Includes bugfixes for issues raised by engwan, MakkyB, and juanricos; HiSpeed mode was not working but now it is. I also received some nice bug reports and testing from TomWS1. Finally, the library.properties file was out of date.

Get it at https://bintray.com/artifact/download/greygnome/generic/enableinterrupt-0.8.2.zip

JB_AU

This was worth the return visit for , Thanks for your diligence!
Amateurs built the ark, Professionals built the Titanic

GreyGnome

Tue Sep 29 06:34:58 CDT 2015
Version 0.9.0 of the EnableInterrupt library has been released. ATtiny support has been added! Support files come from https://github.com/damellis/attiny .
Chips supported include ATtiny44/84 and ATtiny 45/85 (including Gemma). As always, bug reports are
welcome at https://github.com/GreyGnome/EnableInterrupt/issues . NOTE: I don't have an ATtiny (yet),
so the only work I could do was to make sure a sample sketch compiled.

The library is available in the Arduino 1.6.x  IDE Library Manager (from the Sketch Menu -> Include Library -> Manage Libraries).

The library's home page is here. See the wiki here. Usage information can be found here.

Finally, direct download link is here

Happiness here and here.

Reasons for delay of this release here and here (plus dad duties). Sorry about that :-( .

Go Up