paulo-raca / YetAnotherArduinoPcIntLibrary

An Arduino library to handle Pin Change Interrupts
21 stars 5 forks source link

Support for AVR ATMega 328PB #3

Open davija opened 3 years ago

davija commented 3 years ago

I'm working with an ATMega328PB which is very similar to the ATMega328P but I am getting an unsupported error.

paulo-raca commented 3 years ago

Hello,

You'll need to update PinChangeInterruptBoards.h.

I believe it should be as simples as adding || defined(__AVR_ATmega328PB__) on the first #if, can you try it?

davija commented 3 years ago

I tried that and it ended up clobbering the entire port (I only needed interrupts on 3 pins).

I initially just setup an ISR on 3 pins (pins 16, 17 & 18) but I wasn't able to fully test as it caused i2c to fail (also on the same port but different pins).

I didn't take much time to investigate, but I manually setup the port and pin masks and things worked fine, so I suspect there may be something a little off with this lib. I'll take a look and see if I can do some more investigation later.

paulo-raca commented 3 years ago

What do you mean with clobbering? The library should be able to use just a handful of pins without compromising the other pins in the port.

Can you check the implementation of digitalPinToPCICR, digitalPinToPCMSK, digitalPinToPCICRbit and digitalPinToPCMSKbit?

Those should be provided by arduíno's board headers