MCUdude / MightyCore

Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535
Other
649 stars 182 forks source link

using enableInterrupt(); with mighty core #227

Closed Hamza-arch closed 2 years ago

Hamza-arch commented 2 years ago

https://github.com/GreyGnome/EnableInterrupt EnableInterrupt library allows to use additional pins as interrupt pins. As we have only 3 external interrupt pins in Atmega 16, is it possible to increase the number of pins using this library. I have tried to use it but was not successful. I followed the instructions of https://github.com/MCUdude/MightyCore/blob/master/Library_porting.md but did not work. The issue is I believe: "The library relies on pin change interrupt (which the ATmega8535/16/32 doesn't support)" as written in MightyCoreLibraryPorting.

MCUdude commented 2 years ago

Hi! Since the ATmega16 doesn't have PCINT interrupts, you can only have an interrupt on the three "regular" interrupt pins, INT0, INT1, and INT2. If you need more interrupts, you can always switch to the pin-compatible variant ATmega164, but I'm not sure if this chip is compatible with the library. It would probably be an easy port though.