diff --git a/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF b/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF index f1b5978babc581b2ea7679a2a8e2881cc95a8e3f..9faccfe4018382404b24d89bab6d7ebfce69b55c 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF +++ b/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF @@ -8,7 +8,12 @@ Bundle-Vendor: fortiss GmbH Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.fortiss.af3.platform.raspberry.model, + org.fortiss.af3.platform.raspberry.model.annotation, + org.fortiss.af3.platform.raspberry.model.annotation.impl, + org.fortiss.af3.platform.raspberry.model.annotation.util, org.fortiss.af3.platform.raspberry.model.gamepad, + org.fortiss.af3.platform.raspberry.model.gamepad.impl, + org.fortiss.af3.platform.raspberry.model.gamepad.util, org.fortiss.af3.platform.raspberry.model.impl, org.fortiss.af3.platform.raspberry.model.util, org.fortiss.af3.platform.raspberry.util diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 09e730daea59c0ae37893bc1dc4b7978487b4c7a..38984afbf398022761208042a7eb2df7e221e20c 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -29,4 +29,10 @@ <eClassifiers xsi:type="ecore:EClass" name="Right_StickX_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> <eClassifiers xsi:type="ecore:EClass" name="Right_StickY_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> </eSubpackages> + <eSubpackages name="annotation" nsURI="http://www.fortiss.org/af3/platform/raspberry/annotation" + nsPrefix="org-fortiss-af3-platform-raspberry-annotation"> + <eClassifiers xsi:type="ecore:EClass" name="Channel" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IAnnotatedSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="channel" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eClassifiers> + </eSubpackages> </ecore:EPackage> diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel index 7fd3a712369b555cc582e646c1cd443103e60ec4..65e79bd8480da88f79520beca8913996cc3a15a5 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" - modelDirectory="/org.fortiss.af3.platform.raspberry/generated-src" +<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.fortiss.af3.platform.raspberry/generated-src" modelPluginID="org.fortiss.af3.platform.raspberry" modelName="Raspberry" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" arrayAccessors="true" complianceLevel="7.0" copyrightFields="false" usedGenPackages="platform:/resource/org.fortiss.tooling.base/model/base.genmodel#//model platform:/resource/org.fortiss.af3.platform/model/platform.genmodel#//model platform:/resource/org.fortiss.tooling.kernel/model/kernel.genmodel#//model"> @@ -34,5 +34,11 @@ <genClasses ecoreClass="raspberry.ecore#//gamepad/Right_StickX_Position"/> <genClasses ecoreClass="raspberry.ecore#//gamepad/Right_StickY_Position"/> </nestedGenPackages> + <nestedGenPackages prefix="Annotation" basePackage="org.fortiss.af3.platform.raspberry.model" + disposableProviderFactory="true" ecorePackage="raspberry.ecore#//annotation"> + <genClasses ecoreClass="raspberry.ecore#//annotation/Channel"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//annotation/Channel/channel"/> + </genClasses> + </nestedGenPackages> </genPackages> </genmodel:GenModel> diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index 77b20bea9908a9e1558107d2fea94639a434f3c1..e4206d22844b536bc95465d683b024d5772b9f7f 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -17,6 +17,22 @@ class="org.fortiss.af3.platform.raspberry.model.ModelPackage" genModel="model/raspberry.genmodel"/> </extension> + + <extension point="org.eclipse.emf.ecore.generated_package"> + <!-- @generated raspberry --> + <package + uri="http://www.fortiss.org/af3/platform/raspberry/gamepad" + class="org.fortiss.af3.platform.raspberry.model.gamepad.GamepadPackage" + genModel="model/raspberry.genmodel"/> + </extension> + + <extension point="org.eclipse.emf.ecore.generated_package"> + <!-- @generated raspberry --> + <package + uri="http://www.fortiss.org/af3/platform/raspberry/annotation" + class="org.fortiss.af3.platform.raspberry.model.annotation.AnnotationPackage" + genModel="model/raspberry.genmodel"/> + </extension> <extension point="org.fortiss.tooling.kernel.modelElementCompositor"> <modelElementCompositor @@ -390,6 +406,12 @@ modelElementClass="org.fortiss.af3.platform.raspberry.model.GPO"> </modelElementClass> </annotation> + <annotation + binding="org.fortiss.af3.platform.raspberry.annotation.PWMChannelNumberValueProvider"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.ActuatorPWM"> + </modelElementClass> + </annotation> </extension> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..13abd5eb2e261bcf074b0ff2e57b64b81a442b30 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------+ +$Id: GPIOPinNumberValueProvider.java 15846 2016-02-02 09:14:08Z zverlov $ +| | +| Copyright 2015 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.af3.platform.raspberry.annotation; + +import org.fortiss.af3.platform.model.Transceiver; +import org.fortiss.af3.platform.raspberry.model.annotation.AnnotationPackage; +import org.fortiss.af3.platform.raspberry.model.annotation.Channel; +import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureValueProviderBase; +import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider; + +/** + * {@link IAnnotationValueProvider} that allows to annotate a Pin Number of a GPIO + * {@link Transceiver} used in PikeOS Platform. + * + * @author chaudhary + * @author $Author: zverlov $ + * @version $Rev: 15846 $ + * @ConQAT.Rating GREEN Hash: C69EECC82FF9912335C19FC6A5CD6996 + */ + +public class PWMChannelNumberValueProvider extends EStructuralFeatureValueProviderBase<Channel> { + + /** Constructor. */ + public PWMChannelNumberValueProvider() { + super(AnnotationPackage.Literals.CHANNEL, AnnotationPackage.Literals.CHANNEL__CHANNEL); + } + + /** {@inheritDoc} */ + @Override + public String getAnnotationName(Channel specification) { + return "PWM Channel"; + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java index c442eb2e996b86140a0534a4bcc75b33e9ccf1de..6ae59325eebc92c6d4c50e7ee669dbd1d81dd41f 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java @@ -20,8 +20,11 @@ package org.fortiss.af3.platform.raspberry.generator.executable; import org.fortiss.af3.component.model.OutputPort; import org.fortiss.af3.expression.model.terms.IExpressionTerm; import org.fortiss.af3.platform.generic.generator.executable.GenericTransmitterExecutable; +import org.fortiss.af3.platform.model.generic.GenericReceiver; import org.fortiss.af3.platform.model.generic.GenericTransmitter; import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; +import org.fortiss.af3.platform.raspberry.model.annotation.Channel; +import org.fortiss.tooling.base.utils.AnnotationUtils; /** * Executable for {@link ActuatorPWM}. @@ -61,4 +64,8 @@ public class PWMActuatorExecutable extends GenericTransmitterExecutable { public IExpressionTerm getValueWriteAccessor(OutputPort logicalSignal, IExpressionTerm value) { return super.getValueWriteAccessor(logicalSignal, value); } + + private int getPWMChannelFromModelElement(GenericReceiver modelElement) { + return AnnotationUtils.getAnnotation(modelElement, Channel.class).getChannel(); + } }