-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Interrupt ordering for 32u2 and 16u2 MCU #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Please use: defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) To cover all chip variants. The rest looks correct to me. |
Done. |
Could someone please merge this patch? It does not even affect the arduinos boards, as they do not use those MCUs. |
The patch itself looks good to me. However, merging this does break compatibility, third-party cores that are already using these MCU types would break AFAICS (i.e. they would need to update their variants pin to interrupt mapping accordingly, and sketches that use hardcoded interrupt numbers also need to be changed). I'm not sure if such cores exist (I suspect @NicoHood maintains one, but other than that?). Also, what is the compelling reason to change this? I agree that logically numbered interrupts are nicer (and we should have had them from the start on all boards, but that's not going to happen anymore). Is there anything that is actually broken because of this number shuffling? |
See also: |
Yup, and I'd want that to get fixed in the Arduino code, rather than another workaround that is not obvious. Since I've implemented the 16u2/32u2 code, I'd call that more a bug, than a feature. So please fix it sooner than later. |
There at least has to be made some decision. It doesn't help if this Pull Request is open for another 7 months. If this Pull Request has no chance of being applied, then please close it with some explanation. |
@NicoHood, ah, I see that your core currently does not do the interrupt-shuffle, so changing this in Arduino would fix your core rather than break it. Any idea if there are other cores out there for these MCUs?
I'll need to defer to the devs here, @cmaglie, @lxrobotics, @facchinm, any thoughts? Personally, I would not mind merging this if we can't find any other cores that would be affected (or their maintainers are ok with changing this). |
This commit actually places a copy of your existing code for interrupt handling, but doesn't do the "mix up" you have there for "historic reasons".
The "non-mixup" code is used for the ATmega32u2 and ATmega16u2.
I didn't check every possible interrupt as the board, I'm using, doesn't expose every pin, so please have a short look over the code.