From 51ed8e0e5be0464b0269bcc9c3bf4e7896eabb38 Mon Sep 17 00:00:00 2001 From: Johannes Eder <eder@fortiss.org> Date: Tue, 30 May 2017 12:43:55 +0000 Subject: [PATCH] GPIO PIN annotation --- .../trunk/plugin.xml | 15 +++++++++++++++ .../generator/executable/GPIExecutable.java | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index 3967d841..77b20bea 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -376,6 +376,21 @@ </target> </transformationProvider> </extension> + <extension + point="org.fortiss.tooling.base.annotation"> + <annotation + binding="org.fortiss.af3.platform.annotation.valueprovider.GPIOPinNumberValueProvider"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.GPI"> + </modelElementClass> + </annotation> + <annotation + binding="org.fortiss.af3.platform.annotation.valueprovider.GPIOPinNumberValueProvider"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.GPO"> + </modelElementClass> + </annotation> + </extension> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPIExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPIExecutable.java index dd8ed0ef..9e378c1c 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPIExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPIExecutable.java @@ -20,8 +20,10 @@ package org.fortiss.af3.platform.raspberry.generator.executable; import org.fortiss.af3.component.model.InputPort; import org.fortiss.af3.expression.model.terms.IExpressionTerm; import org.fortiss.af3.platform.generic.generator.executable.GenericReceiverExecutable; +import org.fortiss.af3.platform.model.annotation.GPIOPin; import org.fortiss.af3.platform.model.generic.GenericReceiver; import org.fortiss.af3.platform.raspberry.model.GPI; +import org.fortiss.tooling.base.utils.AnnotationUtils; /** * Executable for {@link GPI}. @@ -41,6 +43,13 @@ public class GPIExecutable extends GenericReceiverExecutable { /** {@inheritDoc} */ @Override public IExpressionTerm getInitialization() { + + // --------------------------------------- + // Example: How to extract PIN information + GPIOPin annotation = AnnotationUtils.getAnnotation(modelElement, GPIOPin.class); + int pinNumber = annotation.getPinNumber(); + // --------------------------------------- + return super.getInitialization(); } -- GitLab