[riot-notifications] [RIOT-OS/RIOT] [WIP] cpu/atmega_common: pin change interrupt implementation (#11114)

Marian Buschsieweke notifications at github.com
Wed Mar 6 16:13:42 CET 2019


> Because when we have a module per port, all pins would be enabled, which could result in potential conflicts?

Maybe I'm missing some detail, but I do not see any conflicts. Some "uglyness" will be required to get the offset (`port_num`) of the port in the `pcint_lookup` (the first argument to `pcint_handler`). E.g. if only for port 3 the port changed interrupts are enabled, its offset will be `0`, while it would be `1` if for port 1 and 3 interrupts are enabled.

I'm thinking about something like:

```C
#ifdef USEMODULE_AVR_PCINT_PORT0
#define PORT0_IDX (0)
#endif
#define _COUNTER0  (0)
#endif

#ifdef USEMODULE_AVR_PCINT_PORT1
#define _COUNTER1 (_COUNTER0 + 1)
#define PORT1_IDX _COUNTER1
#else
#define _COUNTER1 _COUNTER0
#endif

#ifdef USEMODULE_AVR_PCINT_PORT2
#define _COUNTER2 (_COUNTER1 + 1)
#define PORT1_IDX _COUNTER2
#else
#define _COUNTER2 _COUNTER1
#endif

#ifdef USEMODULE_AVR_PCINT_PORT3
#define PORT1_IDX (_COUNTER2 + 1)
#endif
```

And then you will be able to use `PORT<X>_IDX` for the index for each port.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11114#issuecomment-470144506
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190306/cf8b51ac/attachment-0001.html>


More information about the notifications mailing list