tinchox3524 / arduino-pinchangeint

Automatically exported from code.google.com/p/arduino-pinchangeint
0 stars 0 forks source link

Support for PORTA pin changes (>28-pin ATmegas) #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
(Note: Winging the template here because the option to select an issue type 
(defect, enhancement, etc.) seems to have gone missing just lately. This should 
be enhancement/feature request :-) )

One of the open issues is for Mega support (80-pin ATmegas e.g. 2560), which 
looks like it might be more work. But, the mid-size (40-pin) ATmegas such as 
'644 (used in Sanguino, Mosquino) can be supported easily by adding the code 
for PORTA pin change interrupts.

I tested the attached file on an ATmega644-based Mosquino board and it appears 
to work correctly. Specific changes I made were: 

* in class PCintPort: change portInputReg(*portInputRegister(index + 2)) to 
index + 1 (actually, created a #define for this value)
* Add PCintPort portA=PCintPort(0,PCMSK0); and renumber remaining entries
* Add case for "1" (PORTA) in attachInterrupt, detachInterrupt
* Add ISR(PCINT0_vect){...} for PORTA case.

(bonus change: use Arduino 1.0's LED_BUILTIN pin definition for the LED pin, if 
available)

NOTE: I didn't add any code (#ifdef...) for making PORTA support switchable - 
I'm not entirely certain I understand your code and don't want to break 
anything! :-)

Original issue reported on code.google.com by drmn...@gmail.com on 10 May 2012 at 4:18

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, I missed this issue!  I will look at your changes and roll them into the 
code, same as I did for the MEGA stuff.  But it will require you to debug it 
for me.

Original comment by m...@schwager.com on 28 Jun 2012 at 5:29

GoogleCodeExporter commented 8 years ago

Original comment by m...@schwager.com on 28 Jun 2012 at 5:29

GoogleCodeExporter commented 8 years ago

Original comment by m...@schwager.com on 28 Jun 2012 at 5:29

GoogleCodeExporter commented 8 years ago
Sure thing, I'd be happy to test out any changes on the '644pa board I have
:-)

Tim

Original comment by drmn...@gmail.com on 29 Jun 2012 at 8:58

GoogleCodeExporter commented 8 years ago
It's been a while and as you can see this is not a high priority for me. One 
issue is that I don't have an ATmega that uses PORTA, so I can't really test my 
code. And I have other projects that are taking my time (not least of all, 
work...). 

So this *may* get fixed but unless someone tackles it, it won't be soon.

Original comment by m...@schwager.com on 29 Nov 2012 at 2:48

GoogleCodeExporter commented 8 years ago
I've been using the patches above on the '644-based Mosquino project for some 
time now without problems (have not formally tested it against other 
Arduino/chip variants however). That version with the patches applied is 
available at 
http://code.google.com/p/mosquino/source/browse/#hg%2Flibraries%2FPinChangeInt 
in case anyone has time to do such testing. (May be identical to the version 
attached above)

Original comment by drmn...@gmail.com on 29 Nov 2012 at 3:30