diff --git a/cpu/atmega2560/Makefile.dep b/cpu/atmega2560/Makefile.dep new file mode 100644 index 0000000000..8a5262d271 --- /dev/null +++ b/cpu/atmega2560/Makefile.dep @@ -0,0 +1,6 @@ +# additional PCINTs for atmega2560 +ifneq (,$(filter atmega_pcint,$(USEMODULE))) + USEMODULE += atmega_pcint1 atmega_pcint2 +endif + +include $(RIOTCPU)/atmega_common/Makefile.dep diff --git a/cpu/atmega2560/Makefile.features b/cpu/atmega2560/Makefile.features index 008260685b..39270920c7 100644 --- a/cpu/atmega2560/Makefile.features +++ b/cpu/atmega2560/Makefile.features @@ -1 +1,3 @@ --include $(RIOTCPU)/atmega_common/Makefile.features +FEATURES_PROVIDED += atmega_pcint1 atmega_pcint2 + +include $(RIOTCPU)/atmega_common/Makefile.features diff --git a/cpu/atmega2560/Makefile.include b/cpu/atmega2560/Makefile.include index 16c500d37c..07c5448328 100644 --- a/cpu/atmega2560/Makefile.include +++ b/cpu/atmega2560/Makefile.include @@ -4,5 +4,10 @@ USEMODULE += atmega_common RAM_LEN = 8K ROM_LEN = 256K +# expand atmega_pcint with additional PCINTs for atmega2560 +ifneq (,$(filter atmega_pcint,$(USEMODULE))) + USEMODULE += atmega_pcint1 atmega_pcint2 +endif + # CPU depends on the atmega common module, so include it include $(RIOTCPU)/atmega_common/Makefile.include diff --git a/cpu/atmega2560/include/atmega_pcint.h b/cpu/atmega2560/include/atmega_pcint.h new file mode 100644 index 0000000000..c0f6d6d28c --- /dev/null +++ b/cpu/atmega2560/include/atmega_pcint.h @@ -0,0 +1,16 @@ +#ifndef ATMEGA_PCINT_H +#define ATMEGA_PCINT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ATMEGA_PCINT_MAP_PCINT0 GPIO_PIN(PORT_B, 0), GPIO_PIN(PORT_B, 1), GPIO_PIN(PORT_B, 2), GPIO_PIN(PORT_B, 3), GPIO_PIN(PORT_B, 4), GPIO_PIN(PORT_B, 5), GPIO_PIN(PORT_B, 6), GPIO_PIN(PORT_B, 7) +#define ATMEGA_PCINT_MAP_PCINT1 GPIO_PIN(PORT_E, 0), GPIO_PIN(PORT_J, 0), GPIO_PIN(PORT_J, 1), GPIO_PIN(PORT_J, 2), GPIO_PIN(PORT_J, 3), GPIO_PIN(PORT_J, 4), GPIO_PIN(PORT_J, 5), GPIO_PIN(PORT_J, 6) +#define ATMEGA_PCINT_MAP_PCINT2 GPIO_PIN(PORT_K, 0), GPIO_PIN(PORT_K, 1), GPIO_PIN(PORT_K, 2), GPIO_PIN(PORT_K, 3), GPIO_PIN(PORT_K, 4), GPIO_PIN(PORT_K, 5), GPIO_PIN(PORT_K, 6), GPIO_PIN(PORT_K, 7) + +#ifdef __cplusplus +} +#endif + +#endif /* ATMEGA_PCINT_H */ diff --git a/cpu/atmega328p/Makefile.features b/cpu/atmega328p/Makefile.features index 008260685b..39270920c7 100644 --- a/cpu/atmega328p/Makefile.features +++ b/cpu/atmega328p/Makefile.features @@ -1 +1,3 @@ --include $(RIOTCPU)/atmega_common/Makefile.features +FEATURES_PROVIDED += atmega_pcint1 atmega_pcint2 + +include $(RIOTCPU)/atmega_common/Makefile.features diff --git a/cpu/atmega328p/Makefile.include b/cpu/atmega328p/Makefile.include index 20119203dd..6c2b1845b9 100644 --- a/cpu/atmega328p/Makefile.include +++ b/cpu/atmega328p/Makefile.include @@ -4,5 +4,10 @@ USEMODULE += atmega_common RAM_LEN = 2K ROM_LEN = 32K +# additional PCINTs for atmega328p +ifneq (,$(filter atmega_pcint,$(USEMODULE))) + USEMODULE += atmega_pcint1 atmega_pcint2 +endif + # CPU depends on the atmega common module, so include it include $(RIOTCPU)/atmega_common/Makefile.include diff --git a/cpu/atmega328p/include/atmega_pcint.h b/cpu/atmega328p/include/atmega_pcint.h new file mode 100644 index 0000000000..69b1d32ef8 --- /dev/null +++ b/cpu/atmega328p/include/atmega_pcint.h @@ -0,0 +1,16 @@ +#ifndef ATMEGA_PCINT_H +#define ATMEGA_PCINT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ATMEGA_PCINT_MAP_PCINT0 GPIO_PIN(PORT_B, 0), GPIO_PIN(PORT_B, 1), GPIO_PIN(PORT_B, 2), GPIO_PIN(PORT_B, 3), GPIO_PIN(PORT_B, 4), GPIO_PIN(PORT_B, 5), GPIO_PIN(PORT_B, 6), GPIO_PIN(PORT_B, 7) +#define ATMEGA_PCINT_MAP_PCINT1 GPIO_PIN(PORT_C, 0), GPIO_PIN(PORT_C, 1), GPIO_PIN(PORT_C, 2), GPIO_PIN(PORT_C, 3), GPIO_PIN(PORT_C, 4), GPIO_PIN(PORT_C, 5), GPIO_PIN(PORT_C, 6), GPIO_UNDEF +#define ATMEGA_PCINT_MAP_PCINT2 GPIO_PIN(PORT_D, 0), GPIO_PIN(PORT_D, 1), GPIO_PIN(PORT_D, 2), GPIO_PIN(PORT_D, 3), GPIO_PIN(PORT_D, 4), GPIO_PIN(PORT_D, 5), GPIO_PIN(PORT_D, 6), GPIO_PIN(PORT_D, 7) + +#ifdef __cplusplus +} +#endif + +#endif /* ATMEGA_PCINT_H */