cpu/atmega_common: pseudomodule-based pin change interrupt implementation#11122
Merged
maribu merged 8 commits intoRIOT-OS:masterfrom Aug 2, 2019
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This is pseudomodule-based version of pin change interrupts for the atmega common platform. Challenge was, that each bank of pin change interrupts (PCINT0, ..., PCINT3) mixes ports. Therefore some magic has to happen.
The memory consumption is: (1 byte (state) + 8 byte (mapping) + 8*6 (config)) per used bank. This means if a single PCINT is used on a pin we need 57 bytes of additional memory.
Additionally, each cpu needs an
atmega_pcint.hfor the specific PCINT mapping.Issues/PRs references
See also #7610, #8993, #9159. This is an follow up PR for #11114
Testing
waspmote-pro) @maribu double checked config against the data sheet (no one has the board)mega-xplained) @TorbenPetersen tested with the INGA boardarduino-mega2560) PCINT9 and PCINT10 are not working yetjiminy-mega256rfr2) @maribu double checked config against the data sheetarduino-uno) @maribu tested, works as expectedTesting for non-Arduino boards
tests/periph_gpioon your avr boardUSEMODULE += atmega_pcint0, orUSEMODULE += atmega_pcint.init_intandenable_inttest if interrupts are correctly fired for a couple of pins.Testing for Arduino Uno and Arduino Mega2560
Flash and run the test added in this PR.
Update 1: Added TODO for testing
Update 2: Elaborated on testing
Update 3: Added instructions for testing on Arduino boards, added test results