Go Down

Topic: EnableInterrupt library- to attach interrupts to Arduino pins (Read 169 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.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy