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

Marian Buschsieweke notifications at github.com
Thu Mar 7 12:12:37 CET 2019


maribu commented on this pull request.

Here the remaining remarks

> @@ -6,4 +6,7 @@ export INCLUDES += -I$(RIOTCPU)/atmega_common/include \
 # avr libc needs some RIOT-specific support code
 USEMODULE += avr_libc_extra
 
+PSEUDOMODULES += atmega_pcint
+PSEUDOMODULES += atmega_pcint%

Just add

```
ifneq (,$(filter atmega_pcint,$(USEMODULE))
    USEMODULE += atmega_pcint0 atmega_pcint1 atmega_pcint2 atmega_pcint3
endif
```

And you no longer need to handle `MODULE_ATMEGA_PCINT` in c code.

> @@ -59,6 +63,88 @@
 #endif
 
 static gpio_isr_ctx_t config[GPIO_EXT_INT_NUMOF];
+
+/**
+ * @brief detects ammount of possible PCINTs
+ */
+#if defined(MODULE_ATMEGA_PCINT) || defined(MODULE_ATMEGA_PCINT0) || defined(MODULE_ATMEGA_PCINT1) || defined(MODULE_ATMEGA_PCINT2) || defined(MODULE_ATMEGA_PCINT3)
+#include "atmega_pcint.h"
+
+#ifndef ATMEGA_PCINT_MAP_PCINT0
+#error Please define pin change interrupts in atmega_pcint.h
+#endif /* ATMEGA_PCINT_MAP_PCINT0 */
+
+/**
+ * @brief check which pcints should be enabled!
+ */
+#if defined(MODULE_ATMEGA_PCINT) || defined(MODULE_ATMEGA_PCINT0)

See comment for `Makefile.include` to see what I meant

> +
+    __exit_isr();
+}
+#if defined(PCINT0_IDX)
+ISR(PCINT0_vect, ISR_BLOCK)
+{
+    pcint_handler(PCINT0_IDX, &PCMSK0);
+}
+#endif
+
+#if defined(PCINT1_IDX)
+ISR(PCINT1_vect, ISR_BLOCK)
+{
+    pcint_handler(PCINT1_IDX, &PCMSK1);
+}
+#endif  /* PCINT1_vect */

comment needs to be updated (more occurrences below). Please also add the comment for `PCINT0_IDX` for consistency.

-- 
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/11122#pullrequestreview-211721589
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/12f3017b/attachment.html>


More information about the notifications mailing list