diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/icons/gamepad.png b/org.fortiss.af3.platform.raspberry.ui/trunk/icons/gamepad.png new file mode 100644 index 0000000000000000000000000000000000000000..85aa454e653cbfbb5ccb4f3ff33e10fd0559effa Binary files /dev/null and b/org.fortiss.af3.platform.raspberry.ui/trunk/icons/gamepad.png differ diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/icons/unknown.png b/org.fortiss.af3.platform.raspberry.ui/trunk/icons/unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..c0566b2742c049219c71ef4477baf97a36947abf Binary files /dev/null and b/org.fortiss.af3.platform.raspberry.ui/trunk/icons/unknown.png differ diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml index 130e9d8e99a9a0ba08bb03f119d0880ea15d7c30..8a8dd241cabd97e300be5d4ab2ba5671026a7817 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml @@ -48,12 +48,87 @@ <modelElementClass modelElementClass="org.fortiss.af3.platform.raspberry.model.CanConnector"> </modelElementClass> + </editPartFactory> +</extension> +<extension + point="org.fortiss.tooling.kernel.ui.modelElementHandler"> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.PWMActuatorHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.ActuatorPWM"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> <modelElementClass - modelElementClass="org.fortiss.af3.platform.raspberry.model.SensorConnector"> + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Button1"> </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> <modelElementClass - modelElementClass="org.fortiss.af3.platform.raspberry.model.ActuatorConnector"> + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Button2"> </modelElementClass> - </editPartFactory> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Button3"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Button4"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL1"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL2"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.ButtonR1"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.ButtonR2"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickX_Position"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickY_Position"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickX_Position"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.GamepadReceiverHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position"> + </modelElementClass> + </modelElementHandler> </extension> </plugin> diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editpart/EditPartFactory.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editpart/EditPartFactory.java index ccfec9d6d2f1aca82d273295fd174259eadb3482..926331f9efd823122b48ebc48f88d0513f495967 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editpart/EditPartFactory.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/editpart/EditPartFactory.java @@ -20,11 +20,9 @@ package org.fortiss.af3.platform.raspberry.ui.editpart; import org.eclipse.gef.EditPart; import org.eclipse.swt.graphics.Color; import org.fortiss.af3.platform.model.PlatformConnectorUnit; -import org.fortiss.af3.platform.raspberry.model.ActuatorConnector; import org.fortiss.af3.platform.raspberry.model.CanBus; import org.fortiss.af3.platform.raspberry.model.CanConnector; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; -import org.fortiss.af3.platform.raspberry.model.SensorConnector; import org.fortiss.af3.platform.ui.DefaultStyle; import org.fortiss.af3.platform.ui.editpart.generic.ExecutionUnitEditPart; import org.fortiss.af3.platform.ui.editpart.generic.StickyPlatformConnectorUnitEditPart; @@ -59,8 +57,7 @@ public class EditPartFactory implements IEditPartFactory { }; } else if(model instanceof CanBus) { return new TransmissionUnitDefaultEditPart((CanBus)model); - } else if(model instanceof CanConnector || model instanceof SensorConnector || - model instanceof ActuatorConnector) { + } else if(model instanceof CanConnector) { return new StickyPlatformConnectorUnitEditPart((PlatformConnectorUnit)model); } return null; diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/CanBusHandler.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/CanBusHandler.java index 80896163253a640110905b5f14d95a1e0377a4fd..6abb6989c741268c71524740df9a0a888f6a657e 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/CanBusHandler.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/CanBusHandler.java @@ -17,12 +17,13 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.ui.handler; +import static org.fortiss.af3.platform.raspberry.ui.AF3PlatformRaspberryUIActivator.getImageDescriptor; + import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.resource.ImageDescriptor; import org.fortiss.af3.platform.raspberry.model.CanBus; -import org.fortiss.af3.platform.raspberry.ui.AF3PlatformRaspberryUIActivator; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase; @@ -46,7 +47,7 @@ public class CanBusHandler extends ModelElementHandlerBase<CanBus> { /** {@inheritDoc} */ @Override public ImageDescriptor getIconImageDescriptor() { - return AF3PlatformRaspberryUIActivator.getImageDescriptor("icons/can-logo.jpeg"); + return getImageDescriptor("icons/can-logo.jpeg"); } /** {@inheritDoc} */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/WheelEncoderExecutable.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/GamepadReceiverHandler.java similarity index 57% rename from org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/WheelEncoderExecutable.java rename to org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/GamepadReceiverHandler.java index 5da6e0d0a515c476a402cb868e33039af5875b8f..2ee6c1705c1ded53d5302f18940d846b86b0ab09 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/WheelEncoderExecutable.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/GamepadReceiverHandler.java @@ -1,7 +1,7 @@ /*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +$Id$ | | -| Copyright 2017 fortiss GmbH | +| Copyright 2011 ForTISS GmbH | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | @@ -15,25 +15,27 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.generator.executable; +package org.fortiss.af3.platform.raspberry.ui.handler; -import org.fortiss.af3.platform.generic.generator.executable.GenericReceiverExecutable; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; -import org.fortiss.af3.platform.raspberry.model.WheelEncoder; +import static org.fortiss.af3.platform.raspberry.ui.AF3PlatformRaspberryUIActivator.getImageDescriptor; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.fortiss.af3.platform.model.Receiver; +import org.fortiss.af3.platform.model.generic.GenericReceiver; +import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase; /** - * Executable for {@link SensorLaserRangeFinder}. + * Handler for {@link GenericReceiver}s. * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @author hoelzl + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating GREEN Hash: D80CF94CBBADB4627AAEDA1F34ABF0A5 */ -public class WheelEncoderExecutable extends GenericReceiverExecutable { - - /** Constructor. */ - public WheelEncoderExecutable(WheelEncoder modelElement) { - super(modelElement); +public class GamepadReceiverHandler extends NamedCommentedModelElementHandlerBase<Receiver> { + /** {@inheritDoc} */ + @Override + public ImageDescriptor getIconImageDescriptor() { + return getImageDescriptor("icons/gamepad.png"); } - } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/PWMActuatorHandler.java similarity index 50% rename from org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java rename to org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/PWMActuatorHandler.java index bec3e38f8def54624677b3424b3edb232f165cdb..01b6f5de30d1d9ba6186d26f26d566f998384aab 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/PWMActuatorHandler.java @@ -1,7 +1,7 @@ /*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +$Id$ | | -| Copyright 2017 fortiss GmbH | +| Copyright 2011 ForTISS GmbH | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | @@ -15,50 +15,27 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.generator.executable; +package org.fortiss.af3.platform.raspberry.ui.handler; -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 static org.fortiss.af3.platform.raspberry.ui.AF3PlatformRaspberryUIActivator.getImageDescriptor; + +import org.eclipse.jface.resource.ImageDescriptor; import org.fortiss.af3.platform.model.generic.GenericReceiver; -import org.fortiss.af3.platform.raspberry.model.SensorIMU; +import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; +import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase; /** - * Executable for {@link SensorIMU}. + * Handler for {@link GenericReceiver}s. * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @author hoelzl + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating GREEN Hash: D80CF94CBBADB4627AAEDA1F34ABF0A5 */ -public class IMUSensorExecutable extends GenericReceiverExecutable { - - /** Constructor. */ - public IMUSensorExecutable(GenericReceiver modelElement) { - super(modelElement); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getInitialization() { - return super.getInitialization(); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return super.getNoValGuardAccessor(logicalSignal); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getTermination() { - return super.getTermination(); - } - +public class PWMActuatorHandler extends NamedCommentedModelElementHandlerBase<ActuatorPWM> { /** {@inheritDoc} */ @Override - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return super.getValueReadAccessor(logicalSignal); + public ImageDescriptor getIconImageDescriptor() { + return getImageDescriptor("icons/unknown.png"); } } diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/RaspberryPiHandler.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/RaspberryPiHandler.java index b56bcee3cb7fd311b455267551cd06e9eb4c05c5..470c2a5cc76534e7ef9fd9aedb65e6f606e422a2 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/RaspberryPiHandler.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/handler/RaspberryPiHandler.java @@ -17,12 +17,13 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.ui.handler; +import static org.fortiss.af3.platform.raspberry.ui.AF3PlatformRaspberryUIActivator.getImageDescriptor; + import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.resource.ImageDescriptor; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; -import org.fortiss.af3.platform.raspberry.ui.AF3PlatformRaspberryUIActivator; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase; @@ -46,7 +47,7 @@ public class RaspberryPiHandler extends ModelElementHandlerBase<RaspberryPi> { /** {@inheritDoc} */ @Override public ImageDescriptor getIconImageDescriptor() { - return AF3PlatformRaspberryUIActivator.getImageDescriptor("icons/raspberry-pi-logo.png"); + return getImageDescriptor("icons/raspberry-pi-logo.png"); } /** {@inheritDoc} */ @@ -54,5 +55,4 @@ public class RaspberryPiHandler extends ModelElementHandlerBase<RaspberryPi> { public List<EObject> getConnectors(RaspberryPi element) { return (List)element.getConnectors(); } - } diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java index 448ebb2f3099aaef5b068e9d9ce91cbe5e03b83d..def32a99b41ce4f02c405774ee7f3fa6533047a6 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java @@ -27,13 +27,7 @@ import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createRec import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; import org.fortiss.af3.platform.raspberry.model.CanBus; import org.fortiss.af3.platform.raspberry.model.CanConnector; -import org.fortiss.af3.platform.raspberry.model.GPI; -import org.fortiss.af3.platform.raspberry.model.GPO; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; -import org.fortiss.af3.platform.raspberry.model.SensorIMU; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; -import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; -import org.fortiss.af3.platform.raspberry.model.WheelEncoder; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -82,41 +76,11 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(con, 0, 0); registerPrototype("CanConnector", con, CATEGORY_NAME); - SensorIMU imu = RaspberryModelElementFactory.createSensorIMU(); - setNodePosition(imu, 0, 0); - setConnectorPosition(imu, 0, 0); - registerPrototype("IMU_Sensor", imu, CATEGORY_NAME); - - SensorLaserRangeFinder slrf = RaspberryModelElementFactory.createSensorLaserRangeFinder(); - setNodePosition(slrf, 0, 0); - setConnectorPosition(slrf, 0, 0); - registerPrototype("LaserRangeFinder_Sensor", slrf, CATEGORY_NAME); - - SensorLaserScanner sls = RaspberryModelElementFactory.createSensorLaserScanner(); - setNodePosition(sls, 0, 0); - setConnectorPosition(sls, 0, 0); - registerPrototype("LaserScanner_Sensor", sls, CATEGORY_NAME); - ActuatorPWM pwm = RaspberryModelElementFactory.createActuatorPWM(); setNodePosition(pwm, 0, 0); setConnectorPosition(pwm, 0, 0); registerPrototype("PWM_Actuator", pwm, CATEGORY_NAME); - GPI gpi = RaspberryModelElementFactory.createGPI(); - setNodePosition(gpi, 0, 0); - setConnectorPosition(gpi, 0, 0); - registerPrototype("GPI", gpi, CATEGORY_NAME); - - GPO gpo = RaspberryModelElementFactory.createGPO(); - setNodePosition(gpo, 0, 0); - setConnectorPosition(gpo, 0, 0); - registerPrototype("GPO", gpo, CATEGORY_NAME); - - WheelEncoder wEncoder = RaspberryModelElementFactory.createWheelEncoder(); - setNodePosition(wEncoder, 0, 0); - setConnectorPosition(wEncoder, 0, 0); - registerPrototype("WheelEncoder", wEncoder, CATEGORY_NAME); - Button1 button1 = RaspberryModelElementFactory.createButton1(); setNodePosition(button1, 0, 0); setConnectorPosition(button1, 0, 0); @@ -176,6 +140,5 @@ public class ProtoypeProvider extends PrototypeProviderBase { setNodePosition(Right_StickY, 0, 0); setConnectorPosition(Right_StickY, 0, 0); registerPrototype(Right_StickY.getName(), Right_StickY, GAMEPAD); - } } diff --git a/org.fortiss.af3.platform.raspberry/trunk/.classpath b/org.fortiss.af3.platform.raspberry/trunk/.classpath index f440d5cd4faa53f89f889d9f1fe9b4f8dee3887b..2a10db21e6c126519507f182a5c864f43893d616 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/.classpath +++ b/org.fortiss.af3.platform.raspberry/trunk/.classpath @@ -2,7 +2,7 @@ <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="generated-src"/> + <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="build"/> </classpath> diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/af3.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/af3.h new file mode 100644 index 0000000000000000000000000000000000000000..e1338f8a8bde05c802dc515ef065673e120399f3 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/af3.h @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_AF3_H_ +#define INC_AF3_H_ + +#include <canthread.h> +#include <stdbool.h> +#include <stdint.h> + +// Make sure "data_dictionary.h" is included before "autofocus3_layer.h" for generated code +#ifndef __HEADER_data_dictionary_h +typedef bool GEN_TYPE_boolean; +typedef int GEN_TYPE_int; +typedef double GEN_TYPE_double; +#endif + +/** Sets the unit identifier of this execution unit (mostly used when communicating with the control center. */ +void af3_set_execution_unit_identifier(char* identifier); + +/** Create a message containing a boolean value for this id. */ +struct can_thread_message* af3_create_message_bool(uint8_t id, GEN_TYPE_boolean value); +/** Create a message containing an integer value for this id. */ +struct can_thread_message* af3_create_message_int(uint8_t id, GEN_TYPE_int value); +/** Create a message containing a double value for this id. */ +struct can_thread_message* af3_create_message_double(uint8_t id, GEN_TYPE_double value); + +/** Returns whether the message represents a NoVal value. */ +GEN_TYPE_boolean af3_is_noval(can_thread_message_t* message); +/** Returns the boolean value contained in the message. */ +GEN_TYPE_boolean af3_get_boolean(can_thread_message_t* message); +/** Returns the integer value contained in the message. */ +GEN_TYPE_int af3_get_int(can_thread_message_t* message); +/** Returns the double value contained in the message. */ +GEN_TYPE_double af3_get_double(can_thread_message_t* message); + +/** Activates the control center connection. */ +void af3_cc_activate(char* server_ip_address, uint16_t server_port); +/** Sends a NoVal signal with the given name to the control center. */ +void af3_cc_send_noval(char* signal, uint64_t timestamp); +/** Sends a boolean signal with the given name to the control center. */ +void af3_cc_send_boolean(char* signal, GEN_TYPE_boolean value, uint64_t timestamp); +/** Sends an int signal with the given name to the control center. */ +void af3_cc_send_int(char* signal, GEN_TYPE_int value, uint64_t timestamp); +/** Sends a double signal with the given name to the control center. */ +void af3_cc_send_double(char* signal, GEN_TYPE_double value, uint64_t timestamp); +/** Deactivates the control center connection. */ +void af3_cc_deactivate(); + +#endif /* INC_AF3_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/cancatalog.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/cancatalog.h new file mode 100644 index 0000000000000000000000000000000000000000..d918a7734ddae53c327e462c77e1e0d00b5798d3 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/cancatalog.h @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_CANCATALOG_H_ +#define INC_CANCATALOG_H_ + +#include <stdint.h> + +#include "canthread.h" +#include "caninbox.h" + +/** Type of catalog entry receivers, which must reclaim the memory of the message after using it. */ +typedef void (*can_catalog_receive_handler_t)(can_thread_message_t* message); + +/** Initializes the cancatalog sub-system registering it with the canthreadsub-system. */ +void can_catalog_initialize(const char* if_name, uint64_t can_thread_sleep_in_micros); + +/** Sets name and handler function for the CAN message with the given id. */ +void can_catalog_set_entry(uint8_t entry_id, char* signal_name, can_inbox_t* inbox); + +/** Returns the catalog entry name for the CAN message with the given id. */ +char* can_catalog_entry_name(uint8_t entry_id); + +/** Unsets the catalog entry with the given id. */ +void can_catalog_unset_entry(uint8_t entry_id); + +/** Destroys the cancatalog and frees its resources. */ +void can_catalog_destroy(); + +#endif /* INC_CANCATALOG_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/caninbox.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/caninbox.h new file mode 100644 index 0000000000000000000000000000000000000000..718f98e5daa5eda1394be2d38099168b06df319a --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/caninbox.h @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_CANINBOX_H_ +#define INC_CANINBOX_H_ + +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <pthread.h> + +#include "canthread.h" + +typedef struct can_inbox can_inbox_t; +typedef bool (*can_inbox_acceptance_callback_t)(uint8_t message_id, uint64_t payload); + +/** Creates an inbox with the given number of slots. */ +can_inbox_t* can_inbox_create(char* name, int slots); + +/** Adds the slot identifier to the next inbox slot and configures the blocking behavior for the pull and push requests. */ +void can_inbox_add_slot(can_inbox_t* inbox, uint8_t message_id, char* signal_name); + +/** Sets the synchronization option for the given inbox slot. */ +void can_inbox_set_slot_synchronization(can_inbox_t* inbox, bool blocking_push, bool blocking_pull); + +/** Set the acceptance callback for this inbox. */ +void can_inbox_set_acceptance_callback(can_inbox_t* inbox, can_inbox_acceptance_callback_t callback); + +/** Returns whether all slots in the inbox are filled. */ +bool can_inbox_is_full(can_inbox_t* inbox); + +/** Returns whether all slots in the inbox are empty. */ +bool can_inbox_is_empty(can_inbox_t* inbox); + +/** Pushes the message into inbox slots. Blocks if the slot is not empty and block flag is set. Returns true upon success. */ +bool can_inbox_push_message(can_inbox_t* inbox, uint8_t slot_id, can_thread_message_t* message); + +/** Pulls the message from the inbox. Blocks if the slot is not empty and block flag is set. */ +struct can_thread_message* can_inbox_pull_message(can_inbox_t* inbox, uint8_t slot_id); + +/** Clears all remaining messages in the inbox and frees their memory. */ +void can_inbox_clear(can_inbox_t* inbox); + +/** Frees the memory used by the inbox, its slots, and any message still contained therein. */ +void can_inbox_destroy(can_inbox_t* inbox); + +#endif /* INC_CANINBOX_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/canoutbox.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/canoutbox.h new file mode 100644 index 0000000000000000000000000000000000000000..ee462d4a91a919e6873b6c5a46225ca1c75293ce --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/canoutbox.h @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ + +#ifndef INC_CANOUTBOX_H_ +#define INC_CANOUTBOX_H_ + +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <pthread.h> + +#include "canthread.h" + +typedef struct can_outbox can_outbox_t; + +/** Creates an outbox with the given name. */ +can_outbox_t* can_outbox_create(char* name); + +/** Pushes the message into outbox slots. Blocks if the slot is not empty and block flag is set. Returns true upon success. */ +bool can_outbox_push_message(can_outbox_t* outbox, can_thread_message_t* message); + +/** Pulls the message from the outbox. Blocks if the slot is not empty and block flag is set. */ +struct can_thread_message* can_outbox_pull_message(can_outbox_t* outbox); + +/** Clears all remaining messages in the outbox and frees their memory. */ +void can_outbox_clear(can_outbox_t* outbox); + +/** Frees the memory used by the outbox, its slots, and any message still contained therein. */ +void can_outbox_destroy(can_outbox_t* outbox); + +#endif /* INC_CANOUTBOX_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/cansocket.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/cansocket.h new file mode 100644 index 0000000000000000000000000000000000000000..adbd08ca9feae7fa29cbb7bc24ab98f78fdbf781 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/cansocket.h @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef __CANSOCKET_H +#define __CANSOCKET_H + +#include <stdbool.h> +#include <stddef.h> +#include <unistd.h> + +#include <sys/socket.h> + +#include <linux/if.h> +#include <linux/can.h> + +#define LIBCANSOCKET_ERROR -1 + +/** The CAN socket structure. */ +struct can_socket { + int number; // socket number + struct sockaddr_can address; // socket address + struct ifreq ifreq; // socket ioctl interface +}; +typedef struct can_socket can_socket_t; + +typedef struct can_frame can_frame_t; + +/** + * Opens a can socket on the interface (usually "can0") and returns the + * initialized socket structure. + */ +can_socket_t* can_socket_open(const char *if_name); + +/** Closes the socket and frees the socket structure pointer. */ +void can_socket_close(can_socket_t* can_socket); + +/** Sends a can frame via the socket. */ +size_t can_socket_send(can_socket_t* can_socket, can_frame_t* frame); + +/** Checks if some bytes are available on the can. */ +bool can_socket_available(can_socket_t* can_socket); + +/** Receives a can frame via the socket. */ +size_t can_socket_receive(can_socket_t* can_socket, can_frame_t* frame); + +#endif // __CANSOCKET_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/canthread.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/canthread.h new file mode 100644 index 0000000000000000000000000000000000000000..82f1dcb7366555f21053e867329b9ce7593d7116 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/canthread.h @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef __CANTHREAD_H +#define __CANTHREAD_H + +#include <cansocket.h> +#include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +/** The message structure for CAN threads. */ +struct can_thread_message { + uint8_t message_id; + uint8_t data[8]; +}; +typedef struct can_thread_message can_thread_message_t; + +/** + * Creates a sender thread and a receiver thread for the interface using + * the handler functions for submission acknowledgments and retrieval handling. + * Note that the message pointers are reclaimed after the acknowledge and + * retrieve functions are called. + */ +bool can_thread_create( + const char* if_name, + void (*acknowlege)(can_thread_message_t* message), + void (*retrieve)(can_thread_message_t* message)); + +/** + * Creates a can message to be posted to the sender thread. Only up to + * 8 bytes from the variable argument list are used. + */ +can_thread_message_t* can_thread_message_create(uint8_t id, int vargsc, ...); + +/** Fills the message with the 64-bit int value (big-endian encoding). */ +void can_thread_message_set(can_thread_message_t* message, uint64_t value); + +/** Returns the 64-bit int value extracted from the message. */ +uint64_t can_thread_message_get(can_thread_message_t* message); + +/** Set the sleep time for sender and receiver thread. */ +void can_thread_set_thread_sleep_in_micros(uint32_t micros); + +/** Posts a message via the sender thread. */ +void can_thread_message_post(can_thread_message_t* message); + +/** Terminate the can threads and wait until they have shut down. */ +void can_thread_terminate(); + +#endif // __CANTHREAD_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/debugprint.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/debugprint.h new file mode 100644 index 0000000000000000000000000000000000000000..a209e64f21de4313d242fbd28ecf7c992a2876f4 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/debugprint.h @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_DEBUGPRINT_H_ +#define INC_DEBUGPRINT_H_ + +#define DEBUG_PRINT_LEVEL_NONE 0 +#define DEBUG_PRINT_LEVEL_FEW 1 +#define DEBUG_PRINT_LEVEL_MANY 2 +#define DEBUG_PRINT_LEVEL_ALL 3 + +extern int global_debug_print_level; + +#ifdef DEBUG + #define USE_DEBUG_PRINTING 1 +#else + #define USE_DEBUG_PRINTING 0 +#endif + +#define debug_print(lvl, fmt, ...) \ + if(USE_DEBUG_PRINTING) if(lvl <= global_debug_print_level) fprintf(stderr, fmt, ##__VA_ARGS__) + +#endif /* INC_DEBUGPRINT_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/gamepad.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/gamepad.h new file mode 100644 index 0000000000000000000000000000000000000000..9866ec350263db962cdcad69f81a7388f177c9c7 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/gamepad.h @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Thomas Boehm, Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_GAMEPAD_H_ +#define INC_GAMEPAD_H_ + +#include <stdint.h> + +#define GAMEPAD_AXIS_LEFT_STICK_HORIZONTAL 0 +#define GAMEPAD_AXIS_LEFT_STICK_VERTICAL 1 +#define GAMEPAD_AXIS_RIGHT_STICK_HORIZONTAL 2 +#define GAMEPAD_AXIS_RIGHT_STICK_VERTICAL 3 +#define GAMEPAD_AXIS_CROSS_PAD_HORIZONTAL 4 +#define GAMEPAD_AXIS_CROSS_PAD_VERTICAL 5 + +#define GAMEPAD_BUTTON_1 6 +#define GAMEPAD_BUTTON_2 7 +#define GAMEPAD_BUTTON_3 8 +#define GAMEPAD_BUTTON_4 9 +#define GAMEPAD_BUTTON_L1 10 +#define GAMEPAD_BUTTON_R1 11 +#define GAMEPAD_BUTTON_L2 12 +#define GAMEPAD_BUTTON_R2 13 +#define GAMEPAD_BUTTON_SELECT 14 +#define GAMEPAD_BUTTON_START 15 +#define GAMEPAD_BUTTON_LEFT_STICK 16 +#define GAMEPAD_BUTTON_RIGHT_STICK 17 + +struct gamepad_configuration { + const char* device_id; + uint64_t waiting_sleep_in_micros; + void (*axis_callback)(uint8_t axis, uint16_t value); + void (*button_callback)(uint8_t button, uint16_t old_value, uint16_t new_value); +}; +typedef struct gamepad_configuration gamepad_configuration_t; + +/** Initializes the gamepad and starts its thread. */ +void gamepad_initialize(gamepad_configuration_t* configuration); + +/** Get the axis position for the given axis. */ +int16_t gamepad_get_axis_position(uint8_t axisID); + +/** Get the button state for the given button. */ +int16_t gamepad_get_button_state(uint8_t buttonID); + +/** Terminates the gamepad thread and frees its resources. */ +void gamepad_terminate(); + +#endif /* INC_GAMEPAD_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_can.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_can.h new file mode 100644 index 0000000000000000000000000000000000000000..884b00b3a07d19be0878dc408b54562126abcc7e --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_can.h @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ + +#ifndef INC_PROTOCOL_CAN_H_ +#define INC_PROTOCOL_CAN_H_ + +#include <stdint.h> + +struct protocol_can_config { + uint8_t can_id_worker_done; + uint8_t can_id_coordinator_clock; + uint8_t can_id_global_shutdown; +}; +typedef struct protocol_can_config protocol_can_config_t; + +#endif /* INC_PROTOCOL_CAN_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_control_center.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_control_center.h new file mode 100644 index 0000000000000000000000000000000000000000..768f86e8b02a36ecb651dc39a1ffb47928b75554 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_control_center.h @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ + +#ifndef INC_PROTOCOL_CONTROL_CENTER_H_ +#define INC_PROTOCOL_CONTROL_CENTER_H_ + +#include <stddef.h> +#include <stdint.h> + +struct protocol_control_center_configuration { + char* server_ip_address; + uint16_t server_port; +}; +typedef struct protocol_control_center_configuration protocol_control_center_configuration_t; + +/** Create the connection to the control center. */ +void protocol_control_center_create(protocol_control_center_configuration_t* config); + +/** Writes len bytes of the given text to the control center. */ +void protocol_control_center_write(char* text, size_t len); + +/** Terminates the connection to the control center. */ +void protocol_control_center_terminate(); + +#endif /* INC_PROTOCOL_CONTROL_CENTER_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_coordinator.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_coordinator.h new file mode 100644 index 0000000000000000000000000000000000000000..013d4733d6cf1e37f1ca4c692e4ab69094d3554f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_coordinator.h @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_PROTOCOL_COORDINATOR_H_ +#define INC_PROTOCOL_COORDINATOR_H_ + +#include <stdint.h> + +#include "caninbox.h" +#include "protocol_worker.h" +#include "timeutil.h" + +/** Main function of coordinator unit. */ +int protocol_coordinator_main( + protocol_can_config_t* can_config, + protocol_worker_clock_config_t* clock_config, + protocol_worker_computation_config_t* computation_config); + +#endif /* INC_PROTOCOL_COORDINATOR_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_factory.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_factory.h new file mode 100644 index 0000000000000000000000000000000000000000..969b0b17aa0cd26cefd43decbfcb6cc1c260f39f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_factory.h @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ + +#ifndef INC_PROTOCOL_FACTORY_H_ +#define INC_PROTOCOL_FACTORY_H_ + +#include "protocol_can.h" +#include "protocol_worker.h" +#include "protocol_coordinator.h" + +/** Creates a CAN configuration. */ +protocol_can_config_t* protocol_can_config_create( + uint8_t can_id_worker_done, + uint8_t can_id_coordinator_clock, + uint8_t can_id_global_shutdown); + +/** Creates a worker clock configuration. */ +protocol_worker_clock_config_t* protocol_worker_clock_config_create( + uint64_t cycle_timeout_in_millis, + uint64_t stop_at_logical_time, + uint64_t waiting_sleep_in_micros); + +/** Creates a worker computation configuration. */ +protocol_worker_computation_config_t* protocol_worker_computation_config_create( + char* name, + void(*worker)(void), + can_inbox_t* remote_units_sync_inbox, + can_inbox_t* application_inbox, + can_outbox_t* application_outbox, + uint64_t simulated_workload_in_millis); + +#endif /* INC_PROTOCOL_FACTORY_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_worker.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_worker.h new file mode 100644 index 0000000000000000000000000000000000000000..4f6af85bc635b5b4792e1cfab9311af62964b822 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/protocol_worker.h @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_PROTOCOL_WORKER_H_ +#define INC_PROTOCOL_WORKER_H_ + +#include <caninbox.h> +#include <canoutbox.h> +#include <stdint.h> + +#include "protocol_can.h" + +struct protocol_worker_computation_config { + char* name; + void(*worker)(void); + can_inbox_t* remote_units_sync_inbox; + can_inbox_t* application_inbox; + can_outbox_t* application_outbox; + uint64_t simulated_workload_in_millis; +}; +typedef struct protocol_worker_computation_config protocol_worker_computation_config_t; + +struct protocol_worker_clock_config { + uint64_t cycle_timeout_in_millis; + uint64_t stop_at_logical_time; + uint64_t waiting_sleep_in_micros; +}; +typedef struct protocol_worker_clock_config protocol_worker_clock_config_t; + +/** Main function of worker unit. */ +int protocol_worker_main( + protocol_can_config_t* can_config, + protocol_worker_clock_config_t* clock_config, + protocol_worker_computation_config_t* computation_config); + + +#endif /* INC_PROTOCOL_WORKER_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/timeutil.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/timeutil.h new file mode 100644 index 0000000000000000000000000000000000000000..d8db484c1e7de7d33acebf08d08778b5cba6441f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/timeutil.h @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2017 fortiss GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Florian Hoelzl - initial API and implementation + *******************************************************************************/ +#ifndef INC_TIMEUTIL_H_ +#define INC_TIMEUTIL_H_ +#include <stdint.h> + +#define MICROS_IN_NANOS (uint64_t)1000 +#define MILLIS_IN_MICROS (uint64_t)1000 +#define SECONDS_IN_MILLIS (uint64_t)1000 + +#define MILLIS_IN_NANOS MILLIS_IN_MICROS * MICROS_IN_NANOS +#define SECONDS_IN_MICROS SECONDS_IN_MILLIS * MILLIS_IN_MICROS +#define SECONDS_IN_NANOS SECONDS_IN_MILLIS * MILLIS_IN_NANOS + +#define YEARS_IN_SECONDS (uint64_t)365 * (uint64_t)24 * (uint64_t)3600; + +/** Returns the current time in microseconds. */ +uint64_t time_util_get_current_micros(); + +/** Returns the elapsed microseconds since the start time. */ +uint64_t time_util_get_elapsed_micros_since(uint64_t start_time); + +/** Sleeps for the amount of seconds. */ +void time_util_sleep_seconds(uint64_t seconds); + +/** Sleeps for the amount of milliseconds. */ +void time_util_sleep_millis(uint64_t millis); + +/** Sleeps for the amount of microseconds. */ +void time_util_sleep_micros(uint64_t micros); + +#endif /* INC_TIMEUTIL_H_ */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/bricklet_distance_us.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/bricklet_distance_us.h new file mode 100644 index 0000000000000000000000000000000000000000..1e40e6461941104a68bbd1d3057ff3f41e569903 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/bricklet_distance_us.h @@ -0,0 +1,358 @@ +/* *********************************************************** + * This file was automatically generated on 2017-07-27. * + * * + * C/C++ Bindings Version 2.1.17 * + * * + * If you have a bugfix for this file and want to commit it, * + * please fix the bug in the generator. You can find a link * + * to the generators git repository on tinkerforge.com * + *************************************************************/ + +#ifndef BRICKLET_DISTANCE_US_H +#define BRICKLET_DISTANCE_US_H + +#include "ip_connection.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \defgroup BrickletDistanceUS Distance US Bricklet + */ + +/** + * \ingroup BrickletDistanceUS + * + * Measures distance between 2cm and 400cm with ultrasound + */ +typedef Device DistanceUS; + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_GET_DISTANCE_VALUE 1 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_SET_DISTANCE_CALLBACK_PERIOD 2 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_GET_DISTANCE_CALLBACK_PERIOD 3 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD 4 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD 5 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_SET_DEBOUNCE_PERIOD 6 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_GET_DEBOUNCE_PERIOD 7 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_SET_MOVING_AVERAGE 10 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_GET_MOVING_AVERAGE 11 + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_FUNCTION_GET_IDENTITY 255 + +/** + * \ingroup BrickletDistanceUS + * + * Signature: \code void callback(uint16_t distance, void *user_data) \endcode + * + * This callback is triggered periodically with the period that is set by + * {@link distance_us_set_distance_callback_period}. The parameter is the distance value + * of the sensor. + * + * The {@link DISTANCE_US_CALLBACK_DISTANCE} callback is only triggered if the distance value has changed + * since the last triggering. + */ +#define DISTANCE_US_CALLBACK_DISTANCE 8 + +/** + * \ingroup BrickletDistanceUS + * + * Signature: \code void callback(uint16_t distance, void *user_data) \endcode + * + * This callback is triggered when the threshold as set by + * {@link distance_us_set_distance_callback_threshold} is reached. + * The parameter is the distance value of the sensor. + * + * If the threshold keeps being reached, the callback is triggered periodically + * with the period as set by {@link distance_us_set_debounce_period}. + */ +#define DISTANCE_US_CALLBACK_DISTANCE_REACHED 9 + + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_THRESHOLD_OPTION_OFF 'x' + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_THRESHOLD_OPTION_OUTSIDE 'o' + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_THRESHOLD_OPTION_INSIDE 'i' + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_THRESHOLD_OPTION_SMALLER '<' + +/** + * \ingroup BrickletDistanceUS + */ +#define DISTANCE_US_THRESHOLD_OPTION_GREATER '>' + +/** + * \ingroup BrickletDistanceUS + * + * This constant is used to identify a Distance US Bricklet. + * + * The {@link distance_us_get_identity} function and the + * {@link IPCON_CALLBACK_ENUMERATE} callback of the IP Connection have a + * \c device_identifier parameter to specify the Brick's or Bricklet's type. + */ +#define DISTANCE_US_DEVICE_IDENTIFIER 229 + +/** + * \ingroup BrickletDistanceUS + * + * This constant represents the display name of a Distance US Bricklet. + */ +#define DISTANCE_US_DEVICE_DISPLAY_NAME "Distance US Bricklet" + +/** + * \ingroup BrickletDistanceUS + * + * Creates the device object \c distance_us with the unique device ID \c uid and adds + * it to the IPConnection \c ipcon. + */ +void distance_us_create(DistanceUS *distance_us, const char *uid, IPConnection *ipcon); + +/** + * \ingroup BrickletDistanceUS + * + * Removes the device object \c distance_us from its IPConnection and destroys it. + * The device object cannot be used anymore afterwards. + */ +void distance_us_destroy(DistanceUS *distance_us); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the response expected flag for the function specified by the + * \c function_id parameter. It is *true* if the function is expected to + * send a response, *false* otherwise. + * + * For getter functions this is enabled by default and cannot be disabled, + * because those functions will always send a response. For callback + * configuration functions it is enabled by default too, but can be disabled + * via the distance_us_set_response_expected function. For setter functions it is + * disabled by default and can be enabled. + * + * Enabling the response expected flag for a setter function allows to + * detect timeouts and other error conditions calls of this setter as well. + * The device will then send a response for this purpose. If this flag is + * disabled for a setter function then no response is send and errors are + * silently ignored, because they cannot be detected. + */ +int distance_us_get_response_expected(DistanceUS *distance_us, uint8_t function_id, bool *ret_response_expected); + +/** + * \ingroup BrickletDistanceUS + * + * Changes the response expected flag of the function specified by the + * \c function_id parameter. This flag can only be changed for setter + * (default value: *false*) and callback configuration functions + * (default value: *true*). For getter functions it is always enabled. + * + * Enabling the response expected flag for a setter function allows to detect + * timeouts and other error conditions calls of this setter as well. The device + * will then send a response for this purpose. If this flag is disabled for a + * setter function then no response is send and errors are silently ignored, + * because they cannot be detected. + */ +int distance_us_set_response_expected(DistanceUS *distance_us, uint8_t function_id, bool response_expected); + +/** + * \ingroup BrickletDistanceUS + * + * Changes the response expected flag for all setter and callback configuration + * functions of this device at once. + */ +int distance_us_set_response_expected_all(DistanceUS *distance_us, bool response_expected); + +/** + * \ingroup BrickletDistanceUS + * + * Registers the given \c function with the given \c callback_id. The + * \c user_data will be passed as the last parameter to the \c function. + */ +void distance_us_register_callback(DistanceUS *distance_us, int16_t callback_id, void *function, void *user_data); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the API version (major, minor, release) of the bindings for this + * device. + */ +int distance_us_get_api_version(DistanceUS *distance_us, uint8_t ret_api_version[3]); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the current distance value measured by the sensor. The value has a + * range of 0 to 4095. A small value corresponds to a small distance, a big + * value corresponds to a big distance. The relation between the measured distance + * value and the actual distance is affected by the 5V supply voltage (deviations + * in the supply voltage result in deviations in the distance values) and is + * non-linear (resolution is bigger at close range). + * + * If you want to get the distance value periodically, it is recommended to + * use the {@link DISTANCE_US_CALLBACK_DISTANCE} callback and set the period with + * {@link distance_us_set_distance_callback_period}. + */ +int distance_us_get_distance_value(DistanceUS *distance_us, uint16_t *ret_distance); + +/** + * \ingroup BrickletDistanceUS + * + * Sets the period in ms with which the {@link DISTANCE_US_CALLBACK_DISTANCE} callback is triggered + * periodically. A value of 0 turns the callback off. + * + * Der {@link DISTANCE_US_CALLBACK_DISTANCE} callback is only triggered if the distance value has changed + * since the last triggering. + * + * The default value is 0. + */ +int distance_us_set_distance_callback_period(DistanceUS *distance_us, uint32_t period); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the period as set by {@link distance_us_set_distance_callback_period}. + */ +int distance_us_get_distance_callback_period(DistanceUS *distance_us, uint32_t *ret_period); + +/** + * \ingroup BrickletDistanceUS + * + * Sets the thresholds for the {@link DISTANCE_US_CALLBACK_DISTANCE_REACHED} callback. + * + * The following options are possible: + * + * \verbatim + * "Option", "Description" + * + * "'x'", "Callback is turned off" + * "'o'", "Callback is triggered when the distance value is *outside* the min and max values" + * "'i'", "Callback is triggered when the distance value is *inside* the min and max values" + * "'<'", "Callback is triggered when the distance value is smaller than the min value (max is ignored)" + * "'>'", "Callback is triggered when the distance value is greater than the min value (max is ignored)" + * \endverbatim + * + * The default value is ('x', 0, 0). + */ +int distance_us_set_distance_callback_threshold(DistanceUS *distance_us, char option, uint16_t min, uint16_t max); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the threshold as set by {@link distance_us_set_distance_callback_threshold}. + */ +int distance_us_get_distance_callback_threshold(DistanceUS *distance_us, char *ret_option, uint16_t *ret_min, uint16_t *ret_max); + +/** + * \ingroup BrickletDistanceUS + * + * Sets the period in ms with which the threshold callbacks + * + * * {@link DISTANCE_US_CALLBACK_DISTANCE_REACHED}, + * + * are triggered, if the thresholds + * + * * {@link distance_us_set_distance_callback_threshold}, + * + * keep being reached. + * + * The default value is 100. + */ +int distance_us_set_debounce_period(DistanceUS *distance_us, uint32_t debounce); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the debounce period as set by {@link distance_us_set_debounce_period}. + */ +int distance_us_get_debounce_period(DistanceUS *distance_us, uint32_t *ret_debounce); + +/** + * \ingroup BrickletDistanceUS + * + * Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__ + * for the distance value. + * + * Setting the length to 0 will turn the averaging completely off. With less + * averaging, there is more noise on the data. + * + * The range for the averaging is 0-100. + * + * The default value is 20. + */ +int distance_us_set_moving_average(DistanceUS *distance_us, uint8_t average); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the length moving average as set by {@link distance_us_set_moving_average}. + */ +int distance_us_get_moving_average(DistanceUS *distance_us, uint8_t *ret_average); + +/** + * \ingroup BrickletDistanceUS + * + * Returns the UID, the UID where the Bricklet is connected to, + * the position, the hardware and firmware version as well as the + * device identifier. + * + * The position can be 'a', 'b', 'c' or 'd'. + * + * The device identifier numbers can be found :ref:`here <device_identifier>`. + * |device_identifier_constant| + */ +int distance_us_get_identity(DistanceUS *distance_us, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/bricklet_segment_display_4x7.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/bricklet_segment_display_4x7.h new file mode 100644 index 0000000000000000000000000000000000000000..d3cab94542158bb275fac61e8a654e5e975e0d72 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/bricklet_segment_display_4x7.h @@ -0,0 +1,236 @@ +/* *********************************************************** + * This file was automatically generated on 2017-07-27. * + * * + * C/C++ Bindings Version 2.1.17 * + * * + * If you have a bugfix for this file and want to commit it, * + * please fix the bug in the generator. You can find a link * + * to the generators git repository on tinkerforge.com * + *************************************************************/ + +#ifndef BRICKLET_SEGMENT_DISPLAY_4X7_H +#define BRICKLET_SEGMENT_DISPLAY_4X7_H + +#include "ip_connection.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \defgroup BrickletSegmentDisplay4x7 Segment Display 4x7 Bricklet + */ + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Four 7-segment displays with switchable colon + */ +typedef Device SegmentDisplay4x7; + +/** + * \ingroup BrickletSegmentDisplay4x7 + */ +#define SEGMENT_DISPLAY_4X7_FUNCTION_SET_SEGMENTS 1 + +/** + * \ingroup BrickletSegmentDisplay4x7 + */ +#define SEGMENT_DISPLAY_4X7_FUNCTION_GET_SEGMENTS 2 + +/** + * \ingroup BrickletSegmentDisplay4x7 + */ +#define SEGMENT_DISPLAY_4X7_FUNCTION_START_COUNTER 3 + +/** + * \ingroup BrickletSegmentDisplay4x7 + */ +#define SEGMENT_DISPLAY_4X7_FUNCTION_GET_COUNTER_VALUE 4 + +/** + * \ingroup BrickletSegmentDisplay4x7 + */ +#define SEGMENT_DISPLAY_4X7_FUNCTION_GET_IDENTITY 255 + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Signature: \code void callback(void *user_data) \endcode + * + * This callback is triggered when the counter (see {@link segment_display_4x7_start_counter}) is + * finished. + */ +#define SEGMENT_DISPLAY_4X7_CALLBACK_COUNTER_FINISHED 5 + + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * This constant is used to identify a Segment Display 4x7 Bricklet. + * + * The {@link segment_display_4x7_get_identity} function and the + * {@link IPCON_CALLBACK_ENUMERATE} callback of the IP Connection have a + * \c device_identifier parameter to specify the Brick's or Bricklet's type. + */ +#define SEGMENT_DISPLAY_4X7_DEVICE_IDENTIFIER 237 + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * This constant represents the display name of a Segment Display 4x7 Bricklet. + */ +#define SEGMENT_DISPLAY_4X7_DEVICE_DISPLAY_NAME "Segment Display 4x7 Bricklet" + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Creates the device object \c segment_display_4x7 with the unique device ID \c uid and adds + * it to the IPConnection \c ipcon. + */ +void segment_display_4x7_create(SegmentDisplay4x7 *segment_display_4x7, const char *uid, IPConnection *ipcon); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Removes the device object \c segment_display_4x7 from its IPConnection and destroys it. + * The device object cannot be used anymore afterwards. + */ +void segment_display_4x7_destroy(SegmentDisplay4x7 *segment_display_4x7); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Returns the response expected flag for the function specified by the + * \c function_id parameter. It is *true* if the function is expected to + * send a response, *false* otherwise. + * + * For getter functions this is enabled by default and cannot be disabled, + * because those functions will always send a response. For callback + * configuration functions it is enabled by default too, but can be disabled + * via the segment_display_4x7_set_response_expected function. For setter functions it is + * disabled by default and can be enabled. + * + * Enabling the response expected flag for a setter function allows to + * detect timeouts and other error conditions calls of this setter as well. + * The device will then send a response for this purpose. If this flag is + * disabled for a setter function then no response is send and errors are + * silently ignored, because they cannot be detected. + */ +int segment_display_4x7_get_response_expected(SegmentDisplay4x7 *segment_display_4x7, uint8_t function_id, bool *ret_response_expected); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Changes the response expected flag of the function specified by the + * \c function_id parameter. This flag can only be changed for setter + * (default value: *false*) and callback configuration functions + * (default value: *true*). For getter functions it is always enabled. + * + * Enabling the response expected flag for a setter function allows to detect + * timeouts and other error conditions calls of this setter as well. The device + * will then send a response for this purpose. If this flag is disabled for a + * setter function then no response is send and errors are silently ignored, + * because they cannot be detected. + */ +int segment_display_4x7_set_response_expected(SegmentDisplay4x7 *segment_display_4x7, uint8_t function_id, bool response_expected); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Changes the response expected flag for all setter and callback configuration + * functions of this device at once. + */ +int segment_display_4x7_set_response_expected_all(SegmentDisplay4x7 *segment_display_4x7, bool response_expected); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Registers the given \c function with the given \c callback_id. The + * \c user_data will be passed as the last parameter to the \c function. + */ +void segment_display_4x7_register_callback(SegmentDisplay4x7 *segment_display_4x7, int16_t callback_id, void *function, void *user_data); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Returns the API version (major, minor, release) of the bindings for this + * device. + */ +int segment_display_4x7_get_api_version(SegmentDisplay4x7 *segment_display_4x7, uint8_t ret_api_version[3]); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * The 7-segment display can be set with bitmaps. Every bit controls one + * segment: + * + * .. image:: /Images/Bricklets/bricklet_segment_display_4x7_bit_order.png + * :scale: 100 % + * :alt: Bit order of one segment + * :align: center + * + * For example to set a "5" you would want to activate segments 0, 2, 3, 5 and 6. + * This is represented by the number 0b01101101 = 0x6d = 109. + * + * The brightness can be set between 0 (dark) and 7 (bright). The colon + * parameter turns the colon of the display on or off. + */ +int segment_display_4x7_set_segments(SegmentDisplay4x7 *segment_display_4x7, uint8_t segments[4], uint8_t brightness, bool colon); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Returns the segment, brightness and color data as set by + * {@link segment_display_4x7_set_segments}. + */ +int segment_display_4x7_get_segments(SegmentDisplay4x7 *segment_display_4x7, uint8_t ret_segments[4], uint8_t *ret_brightness, bool *ret_colon); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Starts a counter with the *from* value that counts to the *to* + * value with the each step incremented by *increment*. + * The *length* of the increment is given in ms. + * + * Example: If you set *from* to 0, *to* to 100, *increment* to 1 and + * *length* to 1000, a counter that goes from 0 to 100 with one second + * pause between each increment will be started. + * + * The maximum values for *from*, *to* and *increment* is 9999, + * the minimum value is -999. + * + * Using a negative increment allows to count backwards. + * + * You can stop the counter at every time by calling {@link segment_display_4x7_set_segments}. + */ +int segment_display_4x7_start_counter(SegmentDisplay4x7 *segment_display_4x7, int16_t value_from, int16_t value_to, int16_t increment, uint32_t length); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Returns the counter value that is currently shown on the display. + * + * If there is no counter running a 0 will be returned. + */ +int segment_display_4x7_get_counter_value(SegmentDisplay4x7 *segment_display_4x7, uint16_t *ret_value); + +/** + * \ingroup BrickletSegmentDisplay4x7 + * + * Returns the UID, the UID where the Bricklet is connected to, + * the position, the hardware and firmware version as well as the + * device identifier. + * + * The position can be 'a', 'b', 'c' or 'd'. + * + * The device identifier numbers can be found :ref:`here <device_identifier>`. + * |device_identifier_constant| + */ +int segment_display_4x7_get_identity(SegmentDisplay4x7 *segment_display_4x7, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/ip_connection.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/ip_connection.h new file mode 100644 index 0000000000000000000000000000000000000000..e714bc1c0b998b534d4b168bfbc8f37ee639758f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/ip_connection.h @@ -0,0 +1,687 @@ +/* + * Copyright (C) 2012-2014 Matthias Bolte <matthias@tinkerforge.com> + * Copyright (C) 2011 Olaf Lüke <olaf@tinkerforge.com> + * + * Redistribution and use in source and binary forms of this file, + * with or without modification, are permitted. See the Creative + * Commons Zero (CC0 1.0) License for more details. + */ + +#ifndef IP_CONNECTION_H +#define IP_CONNECTION_H + +/** + * \defgroup IPConnection IP Connection + */ + +#ifndef __STDC_LIMIT_MACROS + #define __STDC_LIMIT_MACROS +#endif +#include <stdint.h> +#include <string.h> +#include <stdlib.h> + +#if (!defined __cplusplus && defined __GNUC__) || (defined _MSC_VER && _MSC_VER >= 1600) + #include <stdbool.h> +#endif + +#ifdef _WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include <windows.h> +#else + #include <pthread.h> + #include <semaphore.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + E_OK = 0, + E_TIMEOUT = -1, + E_NO_STREAM_SOCKET = -2, + E_HOSTNAME_INVALID = -3, + E_NO_CONNECT = -4, + E_NO_THREAD = -5, + E_NOT_ADDED = -6, // unused since v2.0 + E_ALREADY_CONNECTED = -7, + E_NOT_CONNECTED = -8, + E_INVALID_PARAMETER = -9, // error response from device + E_NOT_SUPPORTED = -10, // error response from device + E_UNKNOWN_ERROR_CODE = -11, // error response from device + E_STREAM_OUT_OF_SYNC = -12 +}; + +#ifdef IPCON_EXPOSE_MILLISLEEP + +void millisleep(uint32_t msec); + +#endif // IPCON_EXPOSE_MILLISLEEP + +#ifdef IPCON_EXPOSE_INTERNALS + +typedef struct _Socket Socket; + +typedef struct { +#ifdef _WIN32 + CRITICAL_SECTION handle; +#else + pthread_mutex_t handle; +#endif +} Mutex; + +void mutex_create(Mutex *mutex); + +void mutex_destroy(Mutex *mutex); + +void mutex_lock(Mutex *mutex); + +void mutex_unlock(Mutex *mutex); + +typedef struct { +#ifdef _WIN32 + HANDLE handle; +#else + pthread_cond_t condition; + pthread_mutex_t mutex; + bool flag; +#endif +} Event; + +typedef struct { +#ifdef _WIN32 + HANDLE handle; +#else + sem_t object; + sem_t *pointer; +#endif +} Semaphore; + +typedef void (*ThreadFunction)(void *opaque); + +typedef struct { +#ifdef _WIN32 + HANDLE handle; + DWORD id; +#else + pthread_t handle; +#endif + ThreadFunction function; + void *opaque; +} Thread; + +typedef struct { + Mutex mutex; + int used; + int allocated; + uint32_t *keys; + void **values; +} Table; + +typedef struct _QueueItem { + struct _QueueItem *next; + int kind; + void *data; +} QueueItem; + +typedef struct { + Mutex mutex; + Semaphore semaphore; + QueueItem *head; + QueueItem *tail; +} Queue; + +#if defined _MSC_VER || defined __BORLANDC__ + #pragma pack(push) + #pragma pack(1) + #define ATTRIBUTE_PACKED +#elif defined __GNUC__ + #ifdef _WIN32 + // workaround struct packing bug in GCC 4.7 on Windows + // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 + #define ATTRIBUTE_PACKED __attribute__((gcc_struct, packed)) + #else + #define ATTRIBUTE_PACKED __attribute__((packed)) + #endif +#else + #error unknown compiler, do not know how to enable struct packing +#endif + +typedef struct { + uint32_t uid; // always little endian + uint8_t length; + uint8_t function_id; + uint8_t sequence_number_and_options; + uint8_t error_code_and_future_use; +} ATTRIBUTE_PACKED PacketHeader; + +typedef struct { + PacketHeader header; + uint8_t payload[64]; + uint8_t optional_data[8]; +} ATTRIBUTE_PACKED Packet; + +#if defined _MSC_VER || defined __BORLANDC__ + #pragma pack(pop) +#endif +#undef ATTRIBUTE_PACKED + +#endif // IPCON_EXPOSE_INTERNALS + +typedef struct _IPConnection IPConnection; +typedef struct _IPConnectionPrivate IPConnectionPrivate; +typedef struct _Device Device; +typedef struct _DevicePrivate DevicePrivate; + +#ifdef IPCON_EXPOSE_INTERNALS + +typedef struct _CallbackContext CallbackContext; +typedef struct _HighLevelCallback HighLevelCallback; + +/** + * \internal + */ +struct _HighLevelCallback { + bool exists; + void *data; + size_t length; +}; + +#endif + +typedef void (*EnumerateCallbackFunction)(const char *uid, + const char *connected_uid, + char position, + uint8_t hardware_version[3], + uint8_t firmware_version[3], + uint16_t device_identifier, + uint8_t enumeration_type, + void *user_data); +typedef void (*ConnectedCallbackFunction)(uint8_t connect_reason, + void *user_data); +typedef void (*DisconnectedCallbackFunction)(uint8_t disconnect_reason, + void *user_data); + +#ifdef IPCON_EXPOSE_INTERNALS + +typedef void (*CallbackWrapperFunction)(DevicePrivate *device_p, Packet *packet); + +#endif + +/** + * \internal + */ +struct _Device { + DevicePrivate *p; +}; + +#ifdef IPCON_EXPOSE_INTERNALS + +#define DEVICE_NUM_FUNCTION_IDS 256 + +/** + * \internal + */ +struct _DevicePrivate { + int ref_count; + + uint32_t uid; // always host endian + + IPConnectionPrivate *ipcon_p; + + uint8_t api_version[3]; + + Mutex request_mutex; + + uint8_t expected_response_function_id; // protected by request_mutex + uint8_t expected_response_sequence_number; // protected by request_mutex + Mutex response_mutex; + Packet response_packet; // protected by response_mutex + Event response_event; + int response_expected[DEVICE_NUM_FUNCTION_IDS]; + + Mutex stream_mutex; + + void *registered_callbacks[DEVICE_NUM_FUNCTION_IDS * 2]; + void *registered_callback_user_data[DEVICE_NUM_FUNCTION_IDS * 2]; + CallbackWrapperFunction callback_wrappers[DEVICE_NUM_FUNCTION_IDS]; + HighLevelCallback high_level_callbacks[DEVICE_NUM_FUNCTION_IDS]; +}; + +/** + * \internal + */ +enum { + DEVICE_RESPONSE_EXPECTED_INVALID_FUNCTION_ID = 0, + DEVICE_RESPONSE_EXPECTED_ALWAYS_TRUE, // getter + DEVICE_RESPONSE_EXPECTED_TRUE, // setter + DEVICE_RESPONSE_EXPECTED_FALSE // setter, default +}; + +/** + * \internal + */ +void device_create(Device *device, const char *uid, + IPConnectionPrivate *ipcon_p, uint8_t api_version_major, + uint8_t api_version_minor, uint8_t api_version_release); + +/** + * \internal + */ +void device_release(DevicePrivate *device_p); + +/** + * \internal + */ +int device_get_response_expected(DevicePrivate *device_p, uint8_t function_id, + bool *ret_response_expected); + +/** + * \internal + */ +int device_set_response_expected(DevicePrivate *device_p, uint8_t function_id, + bool response_expected); + +/** + * \internal + */ +int device_set_response_expected_all(DevicePrivate *device_p, bool response_expected); + +/** + * \internal + */ +void device_register_callback(DevicePrivate *device_p, int16_t callback_id, + void *function, void *user_data); + +/** + * \internal + */ +int device_get_api_version(DevicePrivate *device_p, uint8_t ret_api_version[3]); + +/** + * \internal + */ +int device_send_request(DevicePrivate *device_p, Packet *request, Packet *response); + +#endif // IPCON_EXPOSE_INTERNALS + +/** + * \ingroup IPConnection + * + * Possible IDs for ipcon_register_callback. + */ +enum { + IPCON_CALLBACK_ENUMERATE = 253, + IPCON_CALLBACK_CONNECTED = 0, + IPCON_CALLBACK_DISCONNECTED = 1 +}; + +/** + * \ingroup IPConnection + * + * Possible values for enumeration_type parameter of EnumerateCallback. + */ +enum { + IPCON_ENUMERATION_TYPE_AVAILABLE = 0, + IPCON_ENUMERATION_TYPE_CONNECTED = 1, + IPCON_ENUMERATION_TYPE_DISCONNECTED = 2 +}; + +/** + * \ingroup IPConnection + * + * Possible values for connect_reason parameter of ConnectedCallback. + */ +enum { + IPCON_CONNECT_REASON_REQUEST = 0, + IPCON_CONNECT_REASON_AUTO_RECONNECT = 1 +}; + +/** + * \ingroup IPConnection + * + * Possible values for disconnect_reason parameter of DisconnectedCallback. + */ +enum { + IPCON_DISCONNECT_REASON_REQUEST = 0, + IPCON_DISCONNECT_REASON_ERROR = 1, + IPCON_DISCONNECT_REASON_SHUTDOWN = 2 +}; + +/** + * \ingroup IPConnection + * + * Possible return values of ipcon_get_connection_state. + */ +enum { + IPCON_CONNECTION_STATE_DISCONNECTED = 0, + IPCON_CONNECTION_STATE_CONNECTED = 1, + IPCON_CONNECTION_STATE_PENDING = 2 // auto-reconnect in progress +}; + +/** + * \internal + */ +struct _IPConnection { + IPConnectionPrivate *p; +}; + +#ifdef IPCON_EXPOSE_INTERNALS + +#define IPCON_NUM_CALLBACK_IDS 256 +#define IPCON_MAX_SECRET_LENGTH 64 + +/** + * \internal + */ +typedef Device BrickDaemon; + +/** + * \internal + */ +struct _IPConnectionPrivate { +#ifdef _WIN32 + bool wsa_startup_done; // protected by socket_mutex +#endif + + char *host; + uint16_t port; + + uint32_t timeout; // in msec + + bool auto_reconnect; + bool auto_reconnect_allowed; + bool auto_reconnect_pending; + + Mutex sequence_number_mutex; + uint8_t next_sequence_number; // protected by sequence_number_mutex + + Mutex authentication_mutex; // protects authentication handshake + uint32_t next_authentication_nonce; // protected by authentication_mutex + + Mutex devices_ref_mutex; // protects DevicePrivate.ref_count + Table devices; + + void *registered_callbacks[IPCON_NUM_CALLBACK_IDS]; + void *registered_callback_user_data[IPCON_NUM_CALLBACK_IDS]; + + Mutex socket_mutex; + Socket *socket; // protected by socket_mutex + uint64_t socket_id; // protected by socket_mutex + + bool receive_flag; + Thread receive_thread; // protected by socket_mutex + + CallbackContext *callback; + + bool disconnect_probe_flag; + Thread disconnect_probe_thread; // protected by socket_mutex + Event disconnect_probe_event; + + Semaphore wait; + + BrickDaemon brickd; +}; + +#endif // IPCON_EXPOSE_INTERNALS + +/** + * \ingroup IPConnection + * + * Creates an IP Connection object that can be used to enumerate the available + * devices. It is also required for the constructor of Bricks and Bricklets. + */ +void ipcon_create(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Destroys the IP Connection object. Calls ipcon_disconnect internally. + * The connection to the Brick Daemon gets closed and the threads of the + * IP Connection are terminated. + */ +void ipcon_destroy(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Creates a TCP/IP connection to the given \c host and c\ port. The host and + * port can point to a Brick Daemon or to a WIFI/Ethernet Extension. + * + * Devices can only be controlled when the connection was established + * successfully. + * + * Blocks until the connection is established and returns an error code if + * there is no Brick Daemon or WIFI/Ethernet Extension listening at the given + * host and port. + */ +int ipcon_connect(IPConnection *ipcon, const char *host, uint16_t port); + +/** + * \ingroup IPConnection + * + * Disconnects the TCP/IP connection from the Brick Daemon or the WIFI/Ethernet + * Extension. + */ +int ipcon_disconnect(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Performs an authentication handshake with the connected Brick Daemon or + * WIFI/Ethernet Extension. If the handshake succeeds the connection switches + * from non-authenticated to authenticated state and communication can + * continue as normal. If the handshake fails then the connection gets closed. + * Authentication can fail if the wrong secret was used or if authentication + * is not enabled at all on the Brick Daemon or the WIFI/Ethernet Extension. + * + * For more information about authentication see + * http://www.tinkerforge.com/en/doc/Tutorials/Tutorial_Authentication/Tutorial.html + */ +int ipcon_authenticate(IPConnection *ipcon, const char secret[64]); + +/** + * \ingroup IPConnection + * + * Can return the following states: + * + * - IPCON_CONNECTION_STATE_DISCONNECTED: No connection is established. + * - IPCON_CONNECTION_STATE_CONNECTED: A connection to the Brick Daemon or + * the WIFI/Ethernet Extension is established. + * - IPCON_CONNECTION_STATE_PENDING: IP Connection is currently trying to + * connect. + */ +int ipcon_get_connection_state(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Enables or disables auto-reconnect. If auto-reconnect is enabled, + * the IP Connection will try to reconnect to the previously given + * host and port, if the connection is lost. + * + * Default value is *true*. + */ +void ipcon_set_auto_reconnect(IPConnection *ipcon, bool auto_reconnect); + +/** + * \ingroup IPConnection + * + * Returns *true* if auto-reconnect is enabled, *false* otherwise. + */ +bool ipcon_get_auto_reconnect(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Sets the timeout in milliseconds for getters and for setters for which the + * response expected flag is activated. + * + * Default timeout is 2500. + */ +void ipcon_set_timeout(IPConnection *ipcon, uint32_t timeout); + +/** + * \ingroup IPConnection + * + * Returns the timeout as set by ipcon_set_timeout. + */ +uint32_t ipcon_get_timeout(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Broadcasts an enumerate request. All devices will respond with an enumerate + * callback. + */ +int ipcon_enumerate(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Stops the current thread until ipcon_unwait is called. + * + * This is useful if you rely solely on callbacks for events, if you want + * to wait for a specific callback or if the IP Connection was created in + * a thread. + * + * ipcon_wait and ipcon_unwait act in the same way as "acquire" and "release" + * of a semaphore. + */ +void ipcon_wait(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Unwaits the thread previously stopped by ipcon_wait. + * + * ipcon_wait and ipcon_unwait act in the same way as "acquire" and "release" + * of a semaphore. + */ +void ipcon_unwait(IPConnection *ipcon); + +/** + * \ingroup IPConnection + * + * Registers the given \c function with the given \c callback_id. The + * \c user_data will be passed as the last parameter to the \c function. + */ +void ipcon_register_callback(IPConnection *ipcon, int16_t callback_id, + void *function, void *user_data); + +#ifdef IPCON_EXPOSE_INTERNALS + +/** + * \internal + */ +int packet_header_create(PacketHeader *header, uint8_t length, + uint8_t function_id, IPConnectionPrivate *ipcon_p, + DevicePrivate *device_p); + +/** + * \internal + */ +uint8_t packet_header_get_sequence_number(PacketHeader *header); + +/** + * \internal + */ +void packet_header_set_sequence_number(PacketHeader *header, + uint8_t sequence_number); + +/** + * \internal + */ +uint8_t packet_header_get_response_expected(PacketHeader *header); + +/** + * \internal + */ +void packet_header_set_response_expected(PacketHeader *header, + uint8_t response_expected); + +/** + * \internal + */ +uint8_t packet_header_get_error_code(PacketHeader *header); + +/** + * \internal + */ +int16_t leconvert_int16_to(int16_t native); + +/** + * \internal + */ +uint16_t leconvert_uint16_to(uint16_t native); + +/** + * \internal + */ +int32_t leconvert_int32_to(int32_t native); + +/** + * \internal + */ +uint32_t leconvert_uint32_to(uint32_t native); + +/** + * \internal + */ +int64_t leconvert_int64_to(int64_t native); + +/** + * \internal + */ +uint64_t leconvert_uint64_to(uint64_t native); + +/** + * \internal + */ +float leconvert_float_to(float native); + +/** + * \internal + */ +int16_t leconvert_int16_from(int16_t little); + +/** + * \internal + */ +uint16_t leconvert_uint16_from(uint16_t little); + +/** + * \internal + */ +int32_t leconvert_int32_from(int32_t little); + +/** + * \internal + */ +uint32_t leconvert_uint32_from(uint32_t little); + +/** + * \internal + */ +int64_t leconvert_int64_from(int64_t little); + +/** + * \internal + */ +uint64_t leconvert_uint64_from(uint64_t little); + +/** + * \internal + */ +float leconvert_float_from(float little); + +#endif // IPCON_EXPOSE_INTERNALS + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/license.txt b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/license.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e259d42c996742e9e3cba14c677129b2c1b6311 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/brick/license.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a new file mode 100644 index 0000000000000000000000000000000000000000..f5a7f9b432da53a1d1764d0dcce667f065b59afe Binary files /dev/null and b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a differ diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libbrick.a b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libbrick.a new file mode 100644 index 0000000000000000000000000000000000000000..97ddc32dfb636e34e360596feda478b18fafbdf2 Binary files /dev/null and b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libbrick.a differ diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/Makedefs b/org.fortiss.af3.platform.raspberry/trunk/lib/Makedefs deleted file mode 100644 index 30b33f53e6879dfb3c901b93552a261b7bd41bb1..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/Makedefs +++ /dev/null @@ -1,47 +0,0 @@ -# The default application name. -ifndef APPL - APPL=my_app -endif - -# The default build path. -ifndef BPATH - BPATH=build -endif - -# The compiler. -ifndef CROSSCC - CROSSCC=gcc -endif - -# The linker. -ifndef CROSSLD - CROSSLD=gcc -endif - -# The flags which are passed to the compiler and the linker. -CCFLAGS+=-std=gnu99 -Wall -pthread -lwiringPi -pedantic -c ${patsubst %,-I%,${subst :, ,${IPATH}}} -LDFLAGS+=-std=gnu99 -Wall -pthread -lpthread -lwiringPi -pedantic - -# The default rules, i.e. the entry point. -all: ${BPATH} -all: ${BPATH}/${APPL}.run - -# The target to clean the build directory. -clean: - @echo "cleaning up path '${BPATH}' ..." - @rm -rf ${BPATH} - -# The rule for creating the build directory. -${BPATH}: - @echo "creating path '${BPATH}' ..." - @mkdir ${BPATH} - -# The rule for building an object file from the corresponding C source file. -${BPATH}/%.o: %.c - @echo "compiling file '${<}' ..." - @${CROSSCC} ${CCFLAGS} -o ${@} ${<} - -# The rule for linking an application. -${BPATH}/%.run: - @echo "linking application '${@}' ..." - @${CROSSLD} ${LDFLAGS} -o ${@} $(filter %.o %.a, ${^}) \ No newline at end of file diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc-gen/data_dictionary.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc-gen/data_dictionary.h deleted file mode 100644 index b9570e1140355919215e9813bb997b102ddc9899..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc-gen/data_dictionary.h +++ /dev/null @@ -1,55 +0,0 @@ -/* generated by AutoFOCUS 3 (2.11.0) on Tue May 16 17:42:09 CEST 2017 */ -#ifndef __HEADER_data_dictionary_h -#define __HEADER_data_dictionary_h -#if defined(__cplusplus) -typedef bool GEN_TYPE_boolean; -#else -typedef enum Enum_TYPE_boolean { - false = 0, true = 1 -} GEN_TYPE_boolean; -#endif - -typedef int GEN_TYPE_int; - -typedef double GEN_TYPE_double; - -/*extern GEN_TYPE_double abs(GEN_TYPE_double _V); - -extern GEN_TYPE_double arctan(GEN_TYPE_double _V); - -extern GEN_TYPE_double cos(GEN_TYPE_double _V); - -extern GEN_TYPE_double cot(GEN_TYPE_double _V); - -extern GEN_TYPE_double e(); - -extern GEN_TYPE_double exp(GEN_TYPE_double _V); - -extern GEN_TYPE_double ln(GEN_TYPE_double _V); - -extern GEN_TYPE_double pi(); - -extern GEN_TYPE_double sgn(GEN_TYPE_double _V); - -extern GEN_TYPE_double sin(GEN_TYPE_double _V); - -extern GEN_TYPE_double sqrt(GEN_TYPE_double _V); - -extern GEN_TYPE_double tan(GEN_TYPE_double _V); - -extern GEN_TYPE_double _sqrt(GEN_TYPE_double _X,GEN_TYPE_double _V); - -extern GEN_TYPE_double pow(GEN_TYPE_double _V,GEN_TYPE_double _N); - -extern GEN_TYPE_double factorial(GEN_TYPE_double _V); - -extern GEN_TYPE_double min(GEN_TYPE_double _a,GEN_TYPE_double _b); - -extern GEN_TYPE_double max(GEN_TYPE_double _a,GEN_TYPE_double _b); - -extern GEN_TYPE_double rad2deg(GEN_TYPE_double _A); - -extern GEN_TYPE_double deg2rad(GEN_TYPE_double _A);*/ - -#endif // __HEADER_data_dictionary_h - diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/CanConnector.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/CanConnector.h deleted file mode 100644 index a75fa33e0743b97dc0581d91843497031ab8ef63..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/CanConnector.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __CANCONNECTOR_H -#define __CANCONNECTOR_H - -#include <stdio.h> - -#include "inc/libcansocket.h" -#include "inc-gen/data_dictionary.h" - -// types -typedef const char* CAN_MSG_T; -typedef unsigned long CAN_CLK_T; - -// constants -extern const char* CAN_DEVICE_NAME; - -// send and receive -void can_send(); -void can_send_clock(CAN_CLK_T counter); -void can_receive(); -CAN_CLK_T can_receive_clock(); - -// init, terminate, prepare -void can_init(); -void can_term(); - -void prepare_input_CanConnector(); -void finish_input_CanConnector(); - -void prepare_output_CanConnector(); -void finish_output_CanConnector(); - -// noval -GEN_TYPE_boolean can_is_noval(CAN_MSG_T msg); -GEN_TYPE_boolean can_set_noval(CAN_MSG_T msg); - -// readers -GEN_TYPE_boolean can_read_bool(CAN_MSG_T msg); -GEN_TYPE_double can_read_double(CAN_MSG_T msg); -GEN_TYPE_int can_read_int(CAN_MSG_T pomsgrt); - -// writers -void can_write_bool(CAN_MSG_T msg, GEN_TYPE_boolean value); -void can_write_double(CAN_MSG_T msg, GEN_TYPE_double value); -void can_write_int(CAN_MSG_T msg, GEN_TYPE_int value); - -#endif // __CANCONNECTOR_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/GPIO.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/GPIO.h deleted file mode 100644 index b725758a005747a1bf4f55705a51edf34f1ac46e..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/GPIO.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __GPIO_H -#define __GPIO_H - -#include <stdio.h> -#include <wiringPi.h> -#include "inc-gen/data_dictionary.h" - -// types -typedef int GPIO_PIN_T; - -// init, term -void gpio_init(GPIO_PIN_T pin); -void gpio_init_in(GPIO_PIN_T pin); -void gpio_init_out(GPIO_PIN_T pin); -void gpio_term(GPIO_PIN_T pin); - -// noval -GEN_TYPE_boolean gpio_is_noval(GPIO_PIN_T pin); -void gpio_set_noval(GPIO_PIN_T pin); - -// readers -GEN_TYPE_boolean gpio_read(GPIO_PIN_T pin); - -// writers -void gpio_write(GPIO_PIN_T pin, GEN_TYPE_boolean value); - -#endif // __GPIO_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/Gamepad.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/Gamepad.h deleted file mode 100644 index 0e818c4df747e47ea06f9fea9c5636bf67d04d55..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/Gamepad.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __GAMEPAD_H -#define __GAMEPAD_H - -#include <stdio.h> -#include <stdlib.h> -#include <inttypes.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h> -#include <unistd.h> - -#include "inc-gen/data_dictionary.h" - -// constants -#define JS_EVENT_BUTTON 0x01 -#define JS_EVENT_AXIS 0x02 -#define JS_EVENT_INIT 0x80 - -extern const char* GP_DEVICE_NAME; - -// types etc -union input_events { - struct input_btns { - int16_t js1_lr; // LX - int16_t js1_ud; // LY - int16_t js2_lr; // RX - int16_t js2_ud; // RY - int16_t gp_lr; // GPX - int16_t gp_ud; // GPY - int16_t bt_tri; // BTN1 - int16_t bt_cir; // BTN2 - int16_t bt_x; // BTN3 - int16_t bt_sqr; // BTN4 - int16_t bt_l1; // L1 - int16_t bt_r1; // R1 - int16_t bt_l2; // L2 - int16_t bt_r2; // R2 - int16_t bt_sel; // SELECT - int16_t bt_strt;// START - int16_t js1_bt; // LCLICK - int16_t js2_bt; // RCLICK - } btns; - int16_t inps[18]; -}; - -struct js_event { - uint32_t time; // event time stamp in millisecons - int16_t value; // value - uint8_t type; // event type - uint8_t number; // axis/button number -}; - -extern volatile union input_events ie; - -// worker -void* gp_worker(void* pt_args); - -// init, term -void gp_init(); -void gp_term(); - -// readers -GEN_TYPE_boolean gp_btn1_read(); -GEN_TYPE_boolean gp_btn2_read(); -GEN_TYPE_boolean gp_btn3_read(); -GEN_TYPE_boolean gp_btn4_read(); -GEN_TYPE_boolean gp_btnL1_read(); -GEN_TYPE_boolean gp_btnL2_read(); -GEN_TYPE_boolean gp_btnR1_read(); -GEN_TYPE_boolean gp_btnR2_read(); -GEN_TYPE_double gp_btnLX_read(); -GEN_TYPE_double gp_btnLY_read(); -GEN_TYPE_double gp_btnRX_read(); -GEN_TYPE_double gp_btnRY_read(); - -// noval -GEN_TYPE_boolean gp_btn1_is_noval(); -GEN_TYPE_boolean gp_btn2_is_noval(); -GEN_TYPE_boolean gp_btn3_is_noval(); -GEN_TYPE_boolean gp_btn4_is_noval(); -GEN_TYPE_boolean gp_btnL1_is_noval(); -GEN_TYPE_boolean gp_btnL2_is_noval(); -GEN_TYPE_boolean gp_btnR1_is_noval(); -GEN_TYPE_boolean gp_btnR2_is_noval(); -GEN_TYPE_boolean gp_btnLX_is_noval(); -GEN_TYPE_boolean gp_btnLY_is_noval(); -GEN_TYPE_boolean gp_btnRX_is_noval(); -GEN_TYPE_boolean gp_btnRY_is_noval(); - -#endif // __GAMEPAD_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/IMU.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/IMU.h deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/LaserRangeFinder.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/LaserRangeFinder.h deleted file mode 100644 index 75cab869e37abf5e33b9a9ee2b1b6e53dc0a1d5d..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/LaserRangeFinder.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __LASERRANGEFINDER_H -#define __LASERRANGEFINDER_H - -#include <stdlib.h> - -#include "inc-gen/data_dictionary.h" -#include "inc/libuart.h" - -// constants -const char* LRF_DEVICE_NAME; - -// init, terminate -void lrf_init(); -void lrf_term(); - -// getters -GEN_TYPE_boolean lrf_is_noval(); -GEN_TYPE_int lrf_read(); - -#endif // __LASERRANGEFINDER_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/LaserScanner.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/LaserScanner.h deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h deleted file mode 100644 index 8b72ff55c3c088674d84053c0a64b5e6fdfafdf2..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/PWM.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __PWM_H -#define __PWM_H - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <termios.h> -#include <fcntl.h> -#include <sys/stat.h> - -#include "inc-gen/data_dictionary.h" -#include "inc/libmaestro.h" - -// macros -// 6072 is the value for 0, max. value to motor is currently 7572 -// from AF3 you get a max. speed value in mm/s : 1471 -// Hence, add the constant 6072 and map values -1471-1471 to -1500-1500 -#define PWM_ADJUST_VALUE(x) (6072 + 1500 * x /1471) - -// types -typedef unsigned char PWM_CHANNEL_T; - -// constants -extern const int PWM_SLEEP_TIME; -extern const char* PWM_DEVICE_NAME; -extern const size_t PWM_MAX_NO_CHANNELS; - -// worker -void* pwm_worker(void* pt_args); - -// init, term -void pwm_init(PWM_CHANNEL_T channel); -void pwm_term(PWM_CHANNEL_T channel); - -// writers -void pwm_write(PWM_CHANNEL_T channel, GEN_TYPE_int value); -void pwm_set_noval(PWM_CHANNEL_T channel); - -#endif // __PWM_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/io.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/io.h deleted file mode 100644 index 12856441b6b1fd8ce25e71d700b7f775b6b2fd15..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/io.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __IO_H -#define __IO_H - -#include "inc-gen/data_dictionary.h" - -// init, terminate -void init_left_stick(); -void term_left_stick(); - -void init_right_stick(); -void term_right_stick(); - -// NOVAL -GEN_TYPE_boolean is_noval_left_stick(); -GEN_TYPE_boolean is_noval_right_stick(); - -// readers -GEN_TYPE_double read_left_stick(); -GEN_TYPE_double read_right_stick(); - -// writers -void write_left_stick(GEN_TYPE_double value); -void write_right_stick(GEN_TYPE_double value); - -#endif // __IO_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libcansocket.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libcansocket.h deleted file mode 100644 index a791bad054014c1e9057e1589a2d1bd093dbf3b2..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libcansocket.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __LIBCANSOCKET_H -#define __LIBCANSOCKET_H - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <net/if.h> -#include <sys/ioctl.h> - -#include <linux/can.h> -#include <linux/can/raw.h> - -#define SR_ERR -1 - -struct can_socket { - int s; - struct sockaddr_can addr; - struct ifreq ifr; -}; - -/** - * Opens a can socket on the given interface - */ -struct can_socket* can_socket_open(const char *if_name); - -/** - * Closes a given socket - */ -void can_socket_close(struct can_socket* sock); - -/** - * Sends a can frame on the specified socket - */ -ssize_t can_socket_send(struct can_socket* sock, struct can_frame* frame); - -/** - * - */ -ssize_t can_socket_receive(struct can_socket* sock, struct can_frame* frame); - -#endif // __LIBCANSOCKET_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libmaestro.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libmaestro.h deleted file mode 100644 index 22f83e053bbf26e8807b8013718a6a1f0b9c222d..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libmaestro.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __LIBMAESTRO_H -#define __LIBMAESTRO_H - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <termios.h> - -int maestroRead(int fd, unsigned char channel); -int maestroWrite(int fd, unsigned char channel, unsigned short target); - -#endif // __LIBMAESTRO_H diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libuart.h b/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libuart.h deleted file mode 100644 index 2861d5aaeede19c7975f346cce01dc605be6a942..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/inc/libuart.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file uart.h - * @author Bianca Forkel - */ - -#ifndef MBSE_UART_H -#define MBSE_UART_H - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <termios.h> -#include <errno.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/select.h> - -extern int uart_filestream; - -char port[13]; - -int uart_setup(const char*); - -int uart_send_byte(char, int); - -int uart_send_string(char*, int, int); - -int uart_receive(char*, int, int); - -void uart_close(); - -void uart_flush(); - -#endif diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src-gen/data_dictionary.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src-gen/data_dictionary.c deleted file mode 100644 index 1d778b9d9233731c34a467fd764387b7f3de61e6..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src-gen/data_dictionary.c +++ /dev/null @@ -1,170 +0,0 @@ -/* generated by AutoFOCUS 3 (2.11.0) on Tue May 16 17:42:09 CEST 2017 */ -#include "inc-gen/data_dictionary.h" - -/*GEN_TYPE_double abs(GEN_TYPE_double _V){ - return _V * sgn(_V); -} - -GEN_TYPE_double arctan(GEN_TYPE_double _V){ - if (abs(_V) <= 1.0) { - return _V / (1 + (0.28 * _V) * _V); - } - else { - if (_V > 1) { - return pi() / 2.0 - _V / (_V * _V + 0.28); - } - else { - return -(pi() / 2.0) - _V / (_V * _V + 0.28); - } - } -} - -GEN_TYPE_double cos(GEN_TYPE_double _V){ - return sin((_V + pi() / 2.0)); -} - -GEN_TYPE_double cot(GEN_TYPE_double _V){ - return cos(_V) / sin(_V); -} - -GEN_TYPE_double e(){ - return 2.718281828459; -} - -GEN_TYPE_double exp(GEN_TYPE_double _V){ - return ((((1 + _V) + (_V * _V) / 2) + ((_V * _V) * _V) / 6) + (((_V * _V) * _V) * _V) / 24) + ((((_V * _V) * _V) * _V) * _V) / 120; -} - -GEN_TYPE_double ln(GEN_TYPE_double _V){ - if (_V <= 0) { - return 0; - } - else { - return ((((_V - 1.0) - ((_V - 1.0) * (_V - 1.0)) / 2.0) + (((_V - 1) * (_V - 1)) * (_V - 1)) / 3.0) - ((((_V - 1) * (_V - 1)) * (_V - 1)) * (_V - 1)) / 4.0) + (((((_V - 1) * (_V - 1)) * (_V - 1)) * (_V - 1)) * (_V - 1)) / 5.0; - } -} - -GEN_TYPE_double pi(){ - return 3.14159265; -} - -GEN_TYPE_double sgn(GEN_TYPE_double _V){ - if (_V < 0) { - return -1; - } - else { - if (_V == 0) { - return 0; - } - else { - return 1; - } - } -} - -GEN_TYPE_double sin(GEN_TYPE_double _V){ - if (_V % (2 * pi()) < 0) { - return -sin((-_V)); - } - else { - if (_V % (2 * pi()) > pi()) { - return -sin((_V % (2 * pi()) - pi())); - } - else { - if (_V % (2 * pi()) < 0) { - if (1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi())) < 0) { - return 0.225 * ((1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) * -(1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) - (1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi())))) + (1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))); - } - else { - return 0.225 * ((1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) * (1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) - (1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi())))) + (1.27323954 * (_V % (2 * pi())) + (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))); - } - } - else { - if (1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi())) < 0) { - return 0.225 * ((1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) * -(1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) - (1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi())))) + (1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))); - } - else { - return 0.225 * ((1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) * (1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))) - (1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi())))) + (1.27323954 * (_V % (2 * pi())) - (0.405284735 * (_V % (2 * pi()))) * (_V % (2 * pi()))); - } - } - } - } -} - -GEN_TYPE_double sqrt(GEN_TYPE_double _V){ - if (_V <= 0) { - return 0; - } - else { - return _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, _sqrt(_V, ((_V + 1.0) / 2.0))))))))))); - } -} - -GEN_TYPE_double tan(GEN_TYPE_double _V){ - return sin(_V) / cos(_V); -} - -GEN_TYPE_double _sqrt(GEN_TYPE_double _X,GEN_TYPE_double _V){ - return 0.5 * (_V + _X / _V); -} - -GEN_TYPE_double pow(GEN_TYPE_double _V,GEN_TYPE_double _N){ - if (_N == 0) { - return 1; - } - else { - if (_N < 0) { - if (_V == 0) { - return 0; - } - else { - return 1.0 / pow(_V, (-_N)); - } - } - else { - if (_N == 1) { - return _V; - } - else { - return _V * pow(_V, (_N - 1)); - } - } - } -} - -GEN_TYPE_double factorial(GEN_TYPE_double _V){ - if (_V % 1 != 0) { - return factorial((_V - _V % 1)); - } - else { - if (_V == 0 || _V == 1) { - return 1; - } - else { - return factorial((_V - 1)) * _V; - } - } -} - -GEN_TYPE_double min(GEN_TYPE_double _a,GEN_TYPE_double _b){ - if (_a < _b) { - return _a; - } - return _b; -} - -GEN_TYPE_double max(GEN_TYPE_double _a,GEN_TYPE_double _b){ - if (_a > _b) { - return _a; - } - return _b; -} - -GEN_TYPE_double rad2deg(GEN_TYPE_double _A){ - return (_A / pi()) * 180.0; -} - -GEN_TYPE_double deg2rad(GEN_TYPE_double _A){ - return (_A / 180.0) * pi(); -}*/ - diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/CanConnector.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/CanConnector.c deleted file mode 100644 index 196072d4b2921e8b197e0b7c6560d100041c4439..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/CanConnector.c +++ /dev/null @@ -1,84 +0,0 @@ - -#include "inc/CanConnector.h" - -// constants -const char* CAN_DEVICE_NAME = "can0"; - -// variables -struct can_socket* can_sock; - -// send and receive -void can_send() { - // TODO send and empty buffer -} - -void can_send_clock(CAN_CLK_T counter) { - // TODO send clock message with clock counter -} - -void can_receive() { - // TODO fill buffer -} - -CAN_CLK_T can_receive_clock() { - // TODO receive clock message and return clock counter -} - -// init, terminate -void can_init() { - printf("initializing CAN\n"); - - can_sock = can_socket_open(CAN_DEVICE_NAME); - - // TODO init buffers -} - -void can_term() { - printf("terminating CAN\n"); - - can_socket_close(can_sock); -} - -void prepare_input_CanConnector() {} - -void finish_input_CanConnector() {} - -void prepare_output_CanConnector() {} - -void finish_output_CanConnector() {} - -// noval -GEN_TYPE_boolean can_is_noval(CAN_MSG_T msg) { - return false; -} - -GEN_TYPE_boolean can_set_noval(CAN_MSG_T msg) { - return false; -} - -// readers -GEN_TYPE_boolean can_read_bool(CAN_MSG_T msg) { - return false; // TODO -} - -GEN_TYPE_double can_read_double(CAN_MSG_T msg) { - return 0.0; // TODO -} - -GEN_TYPE_int can_read_int(CAN_MSG_T msg) { - return 0; // TODO -} - -// writers -void can_write_bool(CAN_MSG_T msg, GEN_TYPE_boolean value) { - // TODO -} - -void can_write_double(CAN_MSG_T msg, GEN_TYPE_double value) { - // TODO -} - -void can_write_int(CAN_MSG_T msg, GEN_TYPE_int value) { - // TODO -} - diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/GPIO.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/GPIO.c deleted file mode 100644 index 355932588b7fa1ae52cbd22965478b961988b4ea..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/GPIO.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "inc/GPIO.h" - -// init, term -GEN_TYPE_boolean gpio_initialized = false; -GEN_TYPE_boolean gpio_terminated = false; - -void gpio_init(GPIO_PIN_T pin) { - // important, since all pins are accessing the same method - if(gpio_initialized) return; - - if(wiringPiSetup() == -1) { - perror("cannot setup wiring pi\n"); - return; - } - - gpio_initialized = true; -} - -void gpio_init_in(GPIO_PIN_T pin) { - gpio_init(pin); - - pinMode(pin, INPUT); -} - -void gpio_init_out(GPIO_PIN_T pin) { - gpio_init(pin); - - pinMode(pin, OUTPUT); -} - -void gpio_term(GPIO_PIN_T pin) { - // important, since all pins are accessing the same method - if(gpio_terminated) return; - - gpio_terminated = false; -} - -// noval -GEN_TYPE_boolean gpio_is_noval(GPIO_PIN_T pin) { - return false; -} - -void gpio_set_noval(GPIO_PIN_T pin) { - // do nothing -} - -// readers -GEN_TYPE_boolean gpio_read(GPIO_PIN_T pin) { - return digitalRead(pin); -} - -// writers -void gpio_write(GPIO_PIN_T pin, GEN_TYPE_boolean value) { - digitalWrite(pin, value); -} - diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/Gamepad.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/Gamepad.c deleted file mode 100644 index c3134d4fd907563640d0671ff7f02575cf86db72..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/Gamepad.c +++ /dev/null @@ -1,276 +0,0 @@ - -#include "inc/Gamepad.h" - -// constants -const char* GP_DEVICE_NAME = "/dev/input/js0"; - -// variables -volatile union input_events ie; // stores the button values - -// worker -GEN_TYPE_boolean gp_is_running = true; - -void* gp_worker(void* pt_args) { - int fd; - fd = open(GP_DEVICE_NAME, O_RDONLY); - - if(fd <= 0) { - perror("Error while connecting to gamepad device. Aborting"); - return NULL; - } - - struct timeval timeout; - struct js_event jse; - fd_set read_fds, write_fds, except_fds; - - // loop until terminated... - while(gp_is_running) { - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - FD_ZERO(&except_fds); - FD_SET(fd, &read_fds); - - timeout.tv_sec = 0; - timeout.tv_usec = 25000; - - if (select(fd + 1, &read_fds, &write_fds, &except_fds, &timeout) == 1) { - if(read(fd,&jse,sizeof(jse)) == sizeof(jse)) { - jse.type &= ~JS_EVENT_INIT; - - if(jse.type == JS_EVENT_AXIS) { - ie.inps[jse.number] = jse.value; - - #ifdef DEBUG - printf("Axis %d %d\n", jse.number, jse.value); - #endif // DEBUG - } - - if(jse.type == JS_EVENT_BUTTON) { - ie.inps[jse.number + 6] = jse.value; - - #ifdef DEBUG - printf("Button %d %d\n",jse.number, jse.value); - #endif // DEBUG - } - } - } - } - - close(fd); - - return NULL; -} - -// init, term -GEN_TYPE_boolean gp_initialized = false; -GEN_TYPE_boolean gp_terminated = false; - -void gp_init() { - // important, since all btns are accessing the same method - if(gp_initialized) return; - - // Initialize Joystick Inputs to 0 - ie.btns.js1_ud = 0; - ie.btns.js2_lr = 0; - ie.btns.js2_ud = 0; - - // Initialize Button inputs to NoVal - ie.btns.bt_tri = 2; - ie.btns.bt_cir = 2; - ie.btns.bt_x = 2; - ie.btns.bt_sqr = 2; - ie.btns.bt_l1 = 2; - ie.btns.bt_l2 = 2; - ie.btns.bt_r1 = 2; - ie.btns.bt_r2 = 2; - - gp_initialized = true; -} - -void gp_term() { - // important, since all btns are accessing the same method - if(gp_terminated) return; - - gp_terminated = false; - gp_is_running = false; -} - -// readers: Return button values (1 is true, 0 is false, 2 is NoVal) -// important: Reset button values to NoVal after reading -GEN_TYPE_boolean gp_btn1_read() { - if (ie.btns.bt_tri == 1) - { - ie.btns.bt_tri = 2; - return 1; - } - else - { - ie.btns.bt_tri = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btn2_read() { - if (ie.btns.bt_cir == 1) - { - ie.btns.bt_cir = 2; - return 1; - } - else - { - ie.btns.bt_cir = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btn3_read() { - if (ie.btns.bt_x == 1) - { - ie.btns.bt_x = 2; - return 1; - } - else - { - ie.btns.bt_x = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btn4_read() { - if (ie.btns.bt_sqr == 1) - { - ie.btns.bt_sqr = 2; - return 1; - } - else - { - ie.btns.bt_sqr = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btnL1_read() { - if (ie.btns.bt_l1 == 1) - { - ie.btns.bt_l1 = 2; - return 1; - } - else - { - ie.btns.bt_l1 = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btnL2_read() { - if (ie.btns.bt_l2 == 1) - { - ie.btns.bt_l2 = 2; - return 1; - } - else - { - ie.btns.bt_l2 = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btnR1_read() { - if (ie.btns.bt_r1 == 1) - { - ie.btns.bt_r1 = 2; - return 1; - } - else - { - ie.btns.bt_r1 = 2; - return 0; - } -} - -GEN_TYPE_boolean gp_btnR2_read() { - if (ie.btns.bt_r2 == 1) - { - ie.btns.bt_r2 = 2; - return 1; - } - else - { - ie.btns.bt_r2 = 2; - return 0; - } -} - -GEN_TYPE_double gp_btnLX_read() { - return ie.btns.js1_lr; -} - -GEN_TYPE_double gp_btnLY_read() { - return -ie.btns.js1_ud; -} - -GEN_TYPE_double gp_btnRX_read() { - return ie.btns.js2_lr; -} - -GEN_TYPE_double gp_btnRY_read() { - return -ie.btns.js2_ud; -} - -// noval -GEN_TYPE_boolean gp_btn1_is_noval() { - if (ie.btns.bt_tri == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btn2_is_noval() { - if (ie.btns.bt_cir == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btn3_is_noval() { - if (ie.btns.bt_x == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btn4_is_noval() { - if (ie.btns.bt_sqr == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btnL1_is_noval() { - if (ie.btns.bt_l1 == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btnL2_is_noval() { - if (ie.btns.bt_l2 == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btnR1_is_noval() { - if (ie.btns.bt_r1 == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btnR2_is_noval() { - if (ie.btns.bt_r2 == 2) return 1; - return 0; -} - -GEN_TYPE_boolean gp_btnLX_is_noval() { - return false; -} - -GEN_TYPE_boolean gp_btnLY_is_noval() { - return false; -} - -GEN_TYPE_boolean gp_btnRX_is_noval() { - return false; -} - -GEN_TYPE_boolean gp_btnRY_is_noval() { - return false; -} - diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/IMU.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/IMU.c deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c deleted file mode 100644 index 6a73d303e18436265147521fc067d1d95f63237c..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c +++ /dev/null @@ -1,102 +0,0 @@ - -#include "inc/LaserRangeFinder.h" - -int timeout; - -/** Initialize the laser range finder. */ -void lrf_init() { - timeout = 0; - - char port[100]; - FILE* fp = popen("ls -d /dev/serial/by-id/* | grep \"Arduino_Micro\" | tr -d \"\n\"", "r"); - fgets(port, sizeof(port), fp); - - - printf("lrf port=%s\n", port); - pclose(fp); - - uart_setup(port); -} - -/** Terminate the session. */ -void lrf_term() { - uart_close(); -} - -/** Checking for noVal. */ -GEN_TYPE_boolean lrf_is_noval() { - return false; -} - -/** Get one distance measurement from the laser range finder. */ -GEN_TYPE_int lrf_read() { - - if(timeout>1000) - lrf_init(); - - if (uart_filestream == -1) { - timeout++; - printf("-1: no filestream\n"); - return -1; - } - - //empty buffer - uart_flush(); - - //initialize arrays - int sizeB = 10; - int sizeV = 4; - - int i; - char bytes[sizeB]; - for (i = 0; i < sizeB; i++) { - bytes[i] = 0; - } - int n_read = 0; - - char value[sizeV]; - for (i = 0; i < sizeV; i++) { - value[i] = 0; - } - - int n = 0; - int d; - - //receive values - while (1) { - n_read = uart_receive(bytes, sizeB, 0); - - if(n_read <= 0) { - timeout++; - printf("-1: n_read=%d\n",n_read); - return -1; - } - - for (i = 0; i < n_read; i++) { - if (bytes[i] != 0xd && bytes[i] != 0xa) { - if(n < sizeV) - value[n++] = bytes[i]; - else { - timeout++; - printf("-1: too many bytes\n"); - return -1; - } - } else { - d = atoi(value); - if (d == 0) { - timeout++; - printf("-1: zero value\n"); - return -1; - } else if(d == 1061) { //strange behaviour of one lrf - printf("-1: 1061\n"); - return -1; - } - else { - printf("%d\n", d); - timeout = 0; - return d; - } - } - } - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserScanner.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserScanner.c deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/PWM.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/PWM.c deleted file mode 100644 index d50d6985252aeb07bfbafdba0ad67b5c811ab127..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/PWM.c +++ /dev/null @@ -1,87 +0,0 @@ -#include "inc/PWM.h" - -// constants -const int PWM_SLEEP_TIME = 50000; -const char* PWM_DEVICE_NAME = "/dev/ttyACM0"; -const size_t PWM_MAX_NO_CHANNELS = 4; - -// worker -GEN_TYPE_boolean pwm_is_running = true; - -GEN_TYPE_int* pwm_channel_values; -GEN_TYPE_boolean* pwm_channel_enabled; - -void pwm_send(int fd) { - size_t i; - - for(i = 0; i < PWM_MAX_NO_CHANNELS; i++) { - if(pwm_channel_enabled[i]) { - maestroWrite(fd, i, pwm_channel_values[i]); - } - } -} - -void* pwm_worker(void* pt_args) { - int fd = open(PWM_DEVICE_NAME, O_RDWR | O_NOCTTY); - - if (fd == -1) { - perror("Error while connecting to pwm device"); - return NULL; - } - - struct termios options; - tcgetattr(fd, &options); - options.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); - options.c_oflag &= ~(ONLCR | OCRNL); - tcsetattr(fd, TCSANOW, &options); - - while(pwm_is_running) { - pwm_send(fd); - usleep(PWM_SLEEP_TIME); - } - - close(fd); - - return NULL; -} - -// init, term -GEN_TYPE_boolean pwm_initialized = false; -GEN_TYPE_boolean pwm_terminated = false; - -void pwm_init(PWM_CHANNEL_T channel) { - // important, since all pwms are accessing the same method - if(!pwm_initialized) { - pwm_channel_values = calloc(sizeof(GEN_TYPE_int), PWM_MAX_NO_CHANNELS); - pwm_channel_enabled = calloc(sizeof(GEN_TYPE_boolean), PWM_MAX_NO_CHANNELS); - - // start a pwm thread - //pthread_t pt_pwm; - //pthread_create(&pt_pwm, NULL, pwm_worker, NULL); - - pwm_initialized = true; - } - - pwm_channel_enabled[channel] = true; -} - -void pwm_term(PWM_CHANNEL_T channel) { - // important, since all pwms are accessing the same method - if(pwm_terminated) return; - - free(pwm_channel_values); - free(pwm_channel_enabled); - - pwm_is_running = false; - pwm_terminated = true; -} - -// writers -void pwm_write(PWM_CHANNEL_T channel, GEN_TYPE_int value) { - pwm_channel_values[channel] = PWM_ADJUST_VALUE(value); -} - -void pwm_set_noval(PWM_CHANNEL_T channel) { - // do nothing, not used -} - diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/io.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/io.c deleted file mode 100644 index 0e446a061228e145396990584ea232579c92c089..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/io.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "inc/io.h" - -// init, terminate -void init_left_stick() { - -} - -void term_left_stick() { - -} - -void init_right_stick() { - -} - -void term_right_stick() { - -} - -// NOVAL -GEN_TYPE_boolean is_noval_left_stick() { - return false; -} - -GEN_TYPE_boolean is_noval_right_stick() { - return false; -} - -// readers -GEN_TYPE_double read_left_stick() { - return 0.0; -} - -GEN_TYPE_double read_right_stick() { - return 0.0; -} - -// writers -void write_left_stick(GEN_TYPE_double value) { - -} - -void write_right_stick(GEN_TYPE_double value) { - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/libcansocket.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/libcansocket.c deleted file mode 100644 index b57cc6e8b4e33be281d3beec9e2ce293f79c1f30..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/libcansocket.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "inc/libcansocket.h" - -struct can_socket* can_socket_open(const char *if_name) { - struct can_socket* sock = malloc(sizeof(struct can_socket)); - - /* open socket */ - if ((sock->s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) { - perror("socket"); - return NULL; - } - - sock->addr.can_family = AF_CAN; - - /* map if name to interface index -> will fail if interface does not exist */ - strcpy(sock->ifr.ifr_name, if_name); - if (ioctl(sock->s, SIOCGIFINDEX, &sock->ifr) < 0) { - perror("SIOCGIFINDEX"); - return NULL; - } - sock->addr.can_ifindex = sock->ifr.ifr_ifindex; - - /* bind socket to interface -> will fail if interface is not up */ - if (bind(sock->s, (struct sockaddr *)&sock->addr, sizeof(sock->addr)) < 0) { - perror("bind"); - return NULL; - } - - return sock; -} - -void can_socket_close(struct can_socket* sock) { - close(sock->s); -} - -ssize_t can_socket_send(struct can_socket* sock, struct can_frame* frame) { - ssize_t nbytes; - - /* send frame */ - if ((nbytes = write(sock->s, &frame, sizeof(*frame))) != sizeof(*frame)) { - perror("write"); - return SR_ERR; - } - - return nbytes; -} - -ssize_t can_socket_receive(struct can_socket* sock, struct can_frame* frame) { - ssize_t nbytes; - - if ((nbytes = read(sock->s, frame, sizeof(struct can_frame))) != sizeof(*frame)) { - perror("read"); - return SR_ERR; - } - - return nbytes; -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/libmaestro.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/libmaestro.c deleted file mode 100644 index 356d569232905277d2da27f2bdc6e3f73eed9949..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/libmaestro.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "inc/libmaestro.h" - -// read from channel given a file descriptor -int maestroRead(int fd, unsigned char channel) { - unsigned char command[] = {0x90, channel}; - - if(write(fd, command, sizeof(command)) == -1) - { - perror("error writing"); - return -1; - } - - unsigned char response[2]; - - if(read(fd,response,2) != 2) - { - perror("Error reading from maestro"); - return -1; - } - - return response[0] + 256*response[1]; -} - -// write target to a channel given a file descriptor -// the units of 'target' are quarter-microseconds -int maestroWrite(int fd, unsigned char channel, unsigned short target) { - unsigned char command[] = {0x84, channel, (target & 0x7F), (target >> 7 & 0x7F)}; - - if (write(fd, command, sizeof(command)) == -1) - { - perror("Error writing to maestro"); - return -1; - } - - return 0; -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/libuart.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/libuart.c deleted file mode 100644 index ca027e83e084cd3fb81452785d970e0f06fcba1b..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/libuart.c +++ /dev/null @@ -1,119 +0,0 @@ -/** - * @file uart.c - * @author Bianca Forkel - */ - -#include "inc/libuart.h" - -int uart_filestream = -1; - -/** Initializing the UART connection. */ -int uart_setup(const char *porta) { - strcpy(port, porta); - uart_filestream = open(port, O_RDWR | O_NOCTTY | O_NDELAY); - if (uart_filestream < 0) { - fprintf(stderr, "[%s] Error opening port: %s\n", port, strerror(errno)); - } - - struct termios tty; - memset(&tty, 0, sizeof tty); - if (tcgetattr(uart_filestream, &tty) != 0) { - fprintf(stderr, "[%s] Error from tcgetattr: %s\n", port, strerror(errno)); - } - - // Baud Rate - cfsetospeed(&tty, (speed_t) B115200); - cfsetispeed(&tty, (speed_t) B115200); - - // TTY settings: 8N1 - tty.c_cflag &= ~PARENB; //no parity - tty.c_cflag &= ~CSTOPB; // 1 stop bit - tty.c_cflag &= ~CSIZE; - tty.c_cflag |= CS8; // 8 data bits - - tty.c_cflag &= ~CRTSCTS; - tty.c_cc[VMIN] = 1; - tty.c_cc[VTIME] = 5; - tty.c_cflag |= CREAD | CLOCAL; - - cfmakeraw(&tty); - - uart_flush(); - - if (tcsetattr(uart_filestream, TCSANOW, &tty) != 0) { - fprintf(stderr, "[%s] Error from tcsetattr: %s\n", port, strerror(errno)); - } - return uart_filestream; -} - -/** Sending one byte via UART. */ -int uart_send_byte(char data, int printt) { - if (uart_filestream != -1) { - int n_written = 0; - n_written = write(uart_filestream, &data, 1); - if (n_written < 0) { - if (printt) - fprintf(stderr, "[%s] Error sending byte: %s\n", port, strerror(errno)); - } else { - if (printt) - printf("[%s] Sent byte %#02x\n", port, data); - return 0; - } - } - return -1; -} - -/** Receive from the UART stream. */ -int uart_receive(char *c, int bufLen, int printt) { - fd_set set; - struct timeval timeout; - int rv; - int n_read = -1; - - if (uart_filestream != -1) { - FD_ZERO(&set); - FD_SET(uart_filestream, &set); - - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - - rv = select(uart_filestream + 1, &set, NULL, NULL, &timeout); - if (rv == -1) { - if (printt) - perror("select"); - } else if (rv == 0) { - if (printt) - perror("timeout"); - } else { - n_read = read(uart_filestream, (void *) c, bufLen); - } - - if (n_read < 0) { - if (printt) - fprintf(stderr, "[%s] Error receiving byte: %s\n", port, strerror(errno)); - n_read = 0; - } else if (n_read == 0) { - if (printt) - printf("[%s] No data to receive \n", port); - } else { - if (printt) { - printf("[%s] %i Bytes received: 0x", port, n_read); - int i; - for (i = 0; i < n_read; i++) - printf("%02x", c[i]); - printf("\n"); - } - } - } - return n_read; -} - -/** Close the UART connection. */ -void uart_close() { - close(uart_filestream); -} - -/** Flush the UART buffer. */ -void uart_flush() { - tcflush(uart_filestream, TCIFLUSH); -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/main.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/main.c deleted file mode 100644 index 60b5526585bcacf63fc90a7d2e4f2460e8fd622d..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/main.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The main function and everything related to starting the application - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <pthread.h> - -#include "inc-gen/system.h" -#include "inc/CanConnector.h" -#include "inc/Gamepad.h" -#include "inc/PWM.h" - -#define PARAM_MAXCMP 5 -#define PARAM_MASTER "master" -#define PARAM_SLAVE "slave" - -int main(int argc, char* argv[]) { - // init the system - initialize_system(); - - // start a gamepad thread - pthread_t pt_gamepad; - pthread_create(&pt_gamepad, NULL, gp_worker, NULL); - - // start a pwm thread - pthread_t pt_pwm; - pthread_create(&pt_pwm, NULL, pwm_worker, NULL); - - // MASTER MODE (master as parameter) - if(argc >= 2 && strncmp(argv[1], PARAM_MASTER, PARAM_MAXCMP) == 0) { - // TODO do master stuff - } - - // SLAVE MODE (slave as parameter) - else if(argc >= 2 && strncmp(argv[1], PARAM_SLAVE, PARAM_MAXCMP) == 0) { - // TODO do slave stuff - } - - // DEFAULT MODE (no parameter) - else { - // run endlessly - while(1) { - run_system(); - usleep(1000); - } - } - - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 7dbfc2b5fda7e3c40a28105d7b29248524532c1c..f7061a8c8b0a03229ed81834eabb1aac1b9f2976 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -2,33 +2,24 @@ <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http://www.fortiss.org/af3/platform/raspberry" nsPrefix="org-fortiss-af3-platform-raspberry"> - <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericExecutionUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="CanBus" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransmissionUnit"/> - <eClassifiers xsi:type="ecore:EClass" name="CanConnector" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="SensorConnector" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ActuatorConnector" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransmitter"/> - <eClassifiers xsi:type="ecore:EClass" name="SensorGamepad" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="SensorIMU" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="SensorLaserRangeFinder" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="SensorLaserScanner" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransmitter"/> - <eClassifiers xsi:type="ecore:EClass" name="GPI" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="GPO" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransmitter"/> - <eClassifiers xsi:type="ecore:EClass" name="WheelEncoder" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> + <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="CanBus" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//TransmissionUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="CanConnector" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transceiver"/> + <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter"/> <eSubpackages name="gamepad" nsURI="http://www.fortiss.org/af3/platform/raspberry/gamepad" nsPrefix="org-fortiss-af3-platform-raspberry-gamepad"> - <eClassifiers xsi:type="ecore:EClass" name="Button1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="Button2" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="Button3" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="Button4" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ButtonL1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ButtonR2" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ButtonL2" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ButtonR1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="Left_StickX_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="Left_StickY_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> - <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"/> + <eClassifiers xsi:type="ecore:EClass" name="Button1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Button2" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Button3" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Button4" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="ButtonL1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="ButtonR2" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="ButtonL2" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="ButtonR1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Left_StickX_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Left_StickY_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Right_StickX_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> + <eClassifiers xsi:type="ecore:EClass" name="Right_StickY_Position" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/> </eSubpackages> <eSubpackages name="annotation" nsURI="http://www.fortiss.org/af3/platform/raspberry/annotation" nsPrefix="org-fortiss-af3-platform-raspberry-annotation"> diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel index 156f41bfdfb5f44cb8dd69a67e717a9d72a7cb8a..e543e12fcf6e00dba643b75e8484ca64dd4b9c73 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel @@ -10,16 +10,7 @@ <genClasses ecoreClass="raspberry.ecore#//RaspberryPi"/> <genClasses ecoreClass="raspberry.ecore#//CanBus"/> <genClasses ecoreClass="raspberry.ecore#//CanConnector"/> - <genClasses ecoreClass="raspberry.ecore#//SensorConnector"/> - <genClasses ecoreClass="raspberry.ecore#//ActuatorConnector"/> - <genClasses ecoreClass="raspberry.ecore#//SensorGamepad"/> - <genClasses ecoreClass="raspberry.ecore#//SensorIMU"/> - <genClasses ecoreClass="raspberry.ecore#//SensorLaserRangeFinder"/> - <genClasses ecoreClass="raspberry.ecore#//SensorLaserScanner"/> <genClasses ecoreClass="raspberry.ecore#//ActuatorPWM"/> - <genClasses ecoreClass="raspberry.ecore#//GPI"/> - <genClasses ecoreClass="raspberry.ecore#//GPO"/> - <genClasses ecoreClass="raspberry.ecore#//WheelEncoder"/> <nestedGenPackages prefix="Gamepad" basePackage="org.fortiss.af3.platform.raspberry.model" disposableProviderFactory="true" ecorePackage="raspberry.ecore#//gamepad"> <genClasses ecoreClass="raspberry.ecore#//gamepad/Button1"/> diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index 397e4f326c2aa0faf9f151f6d5bd948362ef4586..70b7d7e3af9360b3049eb990155e2663359df6a2 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -38,7 +38,7 @@ <modelElementCompositor compositor="org.fortiss.af3.platform.raspberry.compose.RaspberryPiCompositor"> <modelElementClass - modelElementClass="org.fortiss.af3.platform.raspberry.model.RaspberryPi"> + modelElementClass="org.fortiss.af3.platform.model.IPlatformArchitectureElement"> </modelElementClass> </modelElementCompositor> <modelElementCompositor @@ -105,84 +105,6 @@ </objectClass> </target> </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.IMUSensorTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.SensorIMU"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.IMUSensorExecutable"> - </objectClass> - </target> - </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.LaserRangeFinderSensorTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.LaserRangeFinderSensorExecutable"> - </objectClass> - </target> - </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.LaserScannerSensorTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.SensorLaserScanner"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.LaserScannerSensorExecutable"> - </objectClass> - </target> - </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.PWMActuatorTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.ActuatorPWM"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.PWMActuatorExecutable"> - </objectClass> - </target> - </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CanBusTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.CanBus"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.CanBusExecutable"> - </objectClass> - </target> - </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.GamepadSensorTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.SensorGamepad"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.GamepadSensorExecutable"> - </objectClass> - </target> - </transformationProvider> <transformationProvider transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CanBusTransmissionCatalogTransformation"> <source> @@ -209,32 +131,6 @@ </objectClass> </target> </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.GPITransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.GPI"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.GPIExecutable"> - </objectClass> - </target> - </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.GPOTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.GPO"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.GPOExecutable"> - </objectClass> - </target> - </transformationProvider> <transformationProvider transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.gamepad.Button1Transformation"> <source> @@ -391,34 +287,9 @@ </objectClass> </target> </transformationProvider> - <transformationProvider - transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.WheelEncoderTransformation"> - <source> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.model.WheelEncoder"> - </objectClass> - </source> - <target> - <objectClass - objectClass="org.fortiss.af3.platform.raspberry.generator.executable.WheelEncoderExecutable"> - </objectClass> - </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> <annotation binding="org.fortiss.af3.platform.raspberry.annotation.PWMChannelNumberValueProvider"> <modelElementClass @@ -426,8 +297,4 @@ </modelElementClass> </annotation> </extension> - - - - </plugin> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java index 7a6d8b6ec32dd6641f197dc0366610f89ed0c292..3fd109ea6aecbadae1f74a6e2c9811c091da4b2a 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java @@ -22,17 +22,9 @@ import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny; import org.eclipse.emf.ecore.EObject; import org.fortiss.af3.platform.compose.PlatformArchitectureElementCompositorBase; import org.fortiss.af3.platform.model.IPlatformArchitectureElement; -import org.fortiss.af3.platform.raspberry.model.ActuatorConnector; import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; import org.fortiss.af3.platform.raspberry.model.CanConnector; -import org.fortiss.af3.platform.raspberry.model.GPI; -import org.fortiss.af3.platform.raspberry.model.GPO; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; -import org.fortiss.af3.platform.raspberry.model.SensorConnector; -import org.fortiss.af3.platform.raspberry.model.SensorIMU; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; -import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; -import org.fortiss.af3.platform.raspberry.model.WheelEncoder; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -45,6 +37,8 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickX_Position; import org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickY_Position; import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickX_Position; import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position; +import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext; +import org.fortiss.tooling.kernel.extension.data.Prototype; /** * @@ -56,19 +50,29 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position; public class RaspberryPiCompositor extends PlatformArchitectureElementCompositorBase<IPlatformArchitectureElement> { + /** {@inheritDoc} */ + @Override + public boolean canComposePrototype(Prototype prototype) { + return super.canComposePrototype(prototype); + } + + /** {@inheritDoc} */ + @Override + public boolean canCompose(IPlatformArchitectureElement container, EObject contained, + IElementCompositionContext context) { + return super.canCompose(container, contained, context); + } + /** {@inheritDoc} */ @Override protected boolean isCorrectElementClass(IPlatformArchitectureElement container, EObject contained) { - final boolean instanceOfAny2 = - isInstanceOfAny(contained, CanConnector.class, SensorConnector.class, - ActuatorConnector.class, ActuatorPWM.class, SensorLaserRangeFinder.class, - SensorLaserScanner.class, SensorIMU.class, GPI.class, GPO.class, - Button1.class, Button2.class, Button3.class, Button4.class, ButtonL1.class, + isInstanceOfAny(contained, CanConnector.class, ActuatorPWM.class, Button1.class, + Button2.class, Button3.class, Button4.class, ButtonL1.class, ButtonL2.class, ButtonR1.class, ButtonR2.class, Left_StickX_Position.class, Left_StickY_Position.class, Right_StickX_Position.class, - Right_StickY_Position.class, WheelEncoder.class); + Right_StickY_Position.class); if(container != null) { final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class); return instanceOfAny && instanceOfAny2; diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java index b69b60a7117378fd11e67304333074f5571d967b..0260fd555a3beddf75a57af5d1048399489f8bca 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java @@ -27,8 +27,7 @@ import org.fortiss.af3.expression.model.terms.RawString; import org.fortiss.af3.expression.model.types.TBool; import org.fortiss.af3.expression.model.types.TDouble; import org.fortiss.af3.expression.model.types.TInt; -import org.fortiss.af3.platform.generic.generator.executable.GenericTransceiverExecutable; -import org.fortiss.af3.platform.model.generic.GenericTransceiver; +import org.fortiss.af3.platform.language.executable.TransceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.CanConnector; /** @@ -39,36 +38,28 @@ import org.fortiss.af3.platform.raspberry.model.CanConnector; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class CanConnectorExecutable extends GenericTransceiverExecutable { +public class CanConnectorExecutable extends TransceiverExecutableBase<CanConnector> { /** Constructor. */ - public CanConnectorExecutable(GenericTransceiver modelElement) { + public CanConnectorExecutable(CanConnector modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { // init CAN bus on the given interface return funcCall("can_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { // check for NOVAL on the given signal port return funcCall("can_is_noval", literalString(logicalSignal.getName())); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValWriteAccessor(OutputPort logicalSignal) { // set NOVAL on the given signal port return funcCall("can_set_noval", literalString(logicalSignal.getName())); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { // terminate the bus on the given interface return funcCall("can_term"); 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 deleted file mode 100644 index 5d6b311db416fdc8b9cd6301069b8e526afe0058..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPIExecutable.java +++ /dev/null @@ -1,73 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.executable; - -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intConst; - -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}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class GPIExecutable extends GenericReceiverExecutable { - - /** Constructor. */ - public GPIExecutable(GenericReceiver modelElement) { - super(modelElement); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getInitialization() { - return funcCall("gpio_init_in", intConst(getPinFromModelElement(modelElement))); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("gpio_is_noval", intConst(getPinFromModelElement(modelElement))); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getTermination() { - return funcCall("gpio_term", intConst(getPinFromModelElement(modelElement))); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("gpio_read", intConst(getPinFromModelElement(modelElement))); - } - - private static int getPinFromModelElement(GenericReceiver modelElement) { - return AnnotationUtils.getAnnotation(modelElement, GPIOPin.class).getPinNumber(); - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPOExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPOExecutable.java deleted file mode 100644 index a64a68c0eecb5bae7c02ff61790f039bf3fb43ab..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GPOExecutable.java +++ /dev/null @@ -1,73 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.executable; - -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intConst; - -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.annotation.GPIOPin; -import org.fortiss.af3.platform.model.generic.GenericTransmitter; -import org.fortiss.af3.platform.raspberry.model.GPO; -import org.fortiss.tooling.base.utils.AnnotationUtils; - -/** - * Executable for {@link GPO}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class GPOExecutable extends GenericTransmitterExecutable { - - /** Constructor. */ - public GPOExecutable(GenericTransmitter modelElement) { - super(modelElement); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getInitialization() { - return funcCall("gpio_init_out", intConst(getPinFromModelElement(modelElement))); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getNoValWriteAccessor(OutputPort logicalSignal) { - return funcCall("gpio_set_noval", intConst(getPinFromModelElement(modelElement))); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getTermination() { - return funcCall("gpio_term", intConst(getPinFromModelElement(modelElement))); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getValueWriteAccessor(OutputPort logicalSignal, IExpressionTerm value) { - return funcCall("gpio_write", intConst(getPinFromModelElement(modelElement)), value); - } - - private static int getPinFromModelElement(GenericTransmitter modelElement) { - return AnnotationUtils.getAnnotation(modelElement, GPIOPin.class).getPinNumber(); - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GamepadSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GamepadSensorExecutable.java deleted file mode 100644 index f335e8ecb040d58a9ad647e719272a5b1ddf233c..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GamepadSensorExecutable.java +++ /dev/null @@ -1,64 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.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.generic.GenericReceiver; -import org.fortiss.af3.platform.raspberry.model.SensorIMU; - -/** - * Executable for {@link SensorIMU}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class GamepadSensorExecutable extends GenericReceiverExecutable { - - /** Constructor. */ - public GamepadSensorExecutable(GenericReceiver modelElement) { - super(modelElement); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getInitialization() { - return super.getInitialization(); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return super.getNoValGuardAccessor(logicalSignal); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getTermination() { - return super.getTermination(); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return super.getValueReadAccessor(logicalSignal); - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java deleted file mode 100644 index 6fa57e26dc2859e7d660b05abd535a97bafdea5c..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java +++ /dev/null @@ -1,66 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.executable; - -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -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.generic.GenericReceiver; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; - -/** - * Executable for {@link SensorLaserRangeFinder}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class LaserRangeFinderSensorExecutable extends GenericReceiverExecutable { - - /** Constructor. */ - public LaserRangeFinderSensorExecutable(GenericReceiver modelElement) { - super(modelElement); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getInitialization() { - return funcCall("lrf_init"); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("lrf_is_noval"); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getTermination() { - return funcCall("lrf_term"); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("lrf_read"); - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java deleted file mode 100644 index 5c64931b9e705d2d14f01895862a5f53b09e7f63..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java +++ /dev/null @@ -1,64 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.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.generic.GenericReceiver; -import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; - -/** - * Executable for {@link SensorLaserScanner}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class LaserScannerSensorExecutable extends GenericReceiverExecutable { - - /** Constructor. */ - public LaserScannerSensorExecutable(GenericReceiver modelElement) { - super(modelElement); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getInitialization() { - return super.getInitialization(); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return super.getNoValGuardAccessor(logicalSignal); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getTermination() { - return super.getTermination(); - } - - /** {@inheritDoc} */ - @Override - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return super.getValueReadAccessor(logicalSignal); - } -} 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 34c1cb46e514379b0880881adf8aca7dec9f53e1..e3d5da7e6ac2d0f34b7efb27f6bba3eaa79d3488 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 @@ -19,14 +19,13 @@ package org.fortiss.af3.platform.raspberry.generator.executable; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intConst; +import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation; 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.GenericTransmitter; +import org.fortiss.af3.platform.language.executable.TransmitterExecutableBase; 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}. @@ -36,27 +35,24 @@ import org.fortiss.tooling.base.utils.AnnotationUtils; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class PWMActuatorExecutable extends GenericTransmitterExecutable { +public class PWMActuatorExecutable extends TransmitterExecutableBase<ActuatorPWM> { /** Constructor. */ - public PWMActuatorExecutable(GenericTransmitter modelElement) { + public PWMActuatorExecutable(ActuatorPWM modelElement) { super(modelElement); } /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("pwm_init", intConst(getPWMChannelFromModelElement(modelElement))); } /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValWriteAccessor(OutputPort logicalSignal) { return funcCall("pwm_set_noval", intConst(getPWMChannelFromModelElement(modelElement))); } /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("pwm_term", intConst(getPWMChannelFromModelElement(modelElement))); } @@ -67,7 +63,7 @@ public class PWMActuatorExecutable extends GenericTransmitterExecutable { return funcCall("pwm_write", intConst(getPWMChannelFromModelElement(modelElement)), value); } - private int getPWMChannelFromModelElement(GenericTransmitter modelElement) { - return AnnotationUtils.getAnnotation(modelElement, Channel.class).getChannel(); + private int getPWMChannelFromModelElement(ActuatorPWM modelElement) { + return getAnnotation(modelElement, Channel.class).getChannel(); } } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java index 920e0922fd8cf136dea062f526d510c6555eb433..6417443a49a3248f014db31ab08bb25b646425b5 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java @@ -203,5 +203,4 @@ public class RaspberryPIExecutable extends GenericExecutionUnitExecutable { public IExpressionTerm getTermination() { return funcCall("term_raspberryPI_ecu"); } - } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button1Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button1Executable.java index bb21628552ba603d5143013292242b3601654490..a7e9f72c3cd7b161892572d9777bf693d2953e64 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button1Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button1Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; /** @@ -33,33 +32,29 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Button1Executable extends GenericReceiverExecutable { +public class Button1Executable extends ReceiverExecutableBase<Button1> { /** Constructor. */ - public Button1Executable(GenericReceiver modelElement) { + public Button1Executable(Button1 modelElement) { super(modelElement); } /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btn1_is_noval"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btn1_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button2Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button2Executable.java index 4926a0a5261be7ef9d326045a3d19e2cf0dea2f6..7b91f000cb5ea871f12e18e83c7d9e5f8603037f 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button2Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button2Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; /** @@ -33,33 +32,29 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Button2Executable extends GenericReceiverExecutable { +public class Button2Executable extends ReceiverExecutableBase<Button2> { /** Constructor. */ - public Button2Executable(GenericReceiver modelElement) { + public Button2Executable(Button2 modelElement) { super(modelElement); } /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btn2_is_noval"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btn2_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button3Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button3Executable.java index 75c8149eed510b25030a3c8b65b26bd3e745e9a1..60274cf39a91e099c2ea7a9cd780a2ff37dac736 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button3Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button3Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Button3Executable extends GenericReceiverExecutable { +public class Button3Executable extends ReceiverExecutableBase<Button3> { /** Constructor. */ - public Button3Executable(GenericReceiver modelElement) { + public Button3Executable(Button3 modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btn3_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btn3_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button4Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button4Executable.java index b8f99e8c97854392c86e163ab7022c3955386400..b93fff5dd09cd897e3da37eeaaa0c47d6f4b9ec6 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button4Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Button4Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Button4; /** @@ -33,33 +32,29 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Button4; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Button4Executable extends GenericReceiverExecutable { +public class Button4Executable extends ReceiverExecutableBase<Button4> { /** Constructor. */ - public Button4Executable(GenericReceiver modelElement) { + public Button4Executable(Button4 modelElement) { super(modelElement); } /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btn4_is_noval"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btn4_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL1Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL1Executable.java index 3fb2b780f892cf0abd866360e53615dc43e2f4f8..1424b48296566ffa37aed9b4f8e7d54aabb18695 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL1Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL1Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL1; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL1; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class ButtonL1Executable extends GenericReceiverExecutable { +public class ButtonL1Executable extends ReceiverExecutableBase<ButtonL1> { /** Constructor. */ - public ButtonL1Executable(GenericReceiver modelElement) { + public ButtonL1Executable(ButtonL1 modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnL1_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnL1_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL2Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL2Executable.java index 0e5a0645b4f233b6218c0877dc409b0b3d16a6bd..b62543f858a2b28446c735913787f9b5c7bff9aa 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL2Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonL2Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL2; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL2; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class ButtonL2Executable extends GenericReceiverExecutable { +public class ButtonL2Executable extends ReceiverExecutableBase<ButtonL2> { /** Constructor. */ - public ButtonL2Executable(GenericReceiver modelElement) { + public ButtonL2Executable(ButtonL2 modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnL2_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnL2_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR1Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR1Executable.java index 4761f1671eae32f2d010b03f2912f8bea10af049..841bc94328066f777542c6fa96e0b5b39be7bb45 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR1Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR1Executable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonR1; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonR1; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class ButtonR1Executable extends GenericReceiverExecutable { +public class ButtonR1Executable extends ReceiverExecutableBase<ButtonR1> { /** Constructor. */ - public ButtonR1Executable(GenericReceiver modelElement) { + public ButtonR1Executable(ButtonR1 modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnR1_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnR1_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR2Executable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR2Executable.java index 59d42182af0797c5d4352ec4b37f78c1a0655f30..5a0d5639e813799caa292cdda8ad6f606333566e 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR2Executable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonR2Executable.java @@ -21,45 +21,36 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; -import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL2; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; +import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonR2; /** - * Executable for {@link ButtonL2}. + * Executable for {@link ButtonR2}. * * @author eder * @author $Author: hoelzl $ * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class ButtonR2Executable extends GenericReceiverExecutable { +public class ButtonR2Executable extends ReceiverExecutableBase<ButtonR2> { /** Constructor. */ - public ButtonR2Executable(GenericReceiver modelElement) { + public ButtonR2Executable(ButtonR2 modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnR2_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnR2_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickXExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickXExecutable.java index c2d30bc1aa603fcb5e55253fb9146d68e6af3ccf..9c86424cce8ea3cb77ef20af63169c62bb3b8fae 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickXExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickXExecutable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickX_Position; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickX_Position; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Left_StickXExecutable extends GenericReceiverExecutable { +public class Left_StickXExecutable extends ReceiverExecutableBase<Left_StickX_Position> { /** Constructor. */ - public Left_StickXExecutable(GenericReceiver modelElement) { + public Left_StickXExecutable(Left_StickX_Position modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnLX_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnLX_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickYExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickYExecutable.java index 8516209ebb56777b00859bf38627decd0ac00fdd..3372b1b87cb51c85979fc3ada077f1578c8a8113 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickYExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Left_StickYExecutable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickY_Position; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Left_StickY_Position; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Left_StickYExecutable extends GenericReceiverExecutable { +public class Left_StickYExecutable extends ReceiverExecutableBase<Left_StickY_Position> { /** Constructor. */ - public Left_StickYExecutable(GenericReceiver modelElement) { + public Left_StickYExecutable(Left_StickY_Position modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnLY_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnLY_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickXExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickXExecutable.java index 5d684e9d3b8068f691c6bd70af4124e65ff56fdf..7858cb4ed095c8a38010bc524027059b01f4d304 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickXExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickXExecutable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickX_Position; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickX_Position; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Right_StickXExecutable extends GenericReceiverExecutable { +public class Right_StickXExecutable extends ReceiverExecutableBase<Right_StickX_Position> { /** Constructor. */ - public Right_StickXExecutable(GenericReceiver modelElement) { + public Right_StickXExecutable(Right_StickX_Position modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnRX_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnRX_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickYExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickYExecutable.java index afcb06d97f53c9737b738802381587240f0fb6f0..791746897396c034803b1d93a10976ba530ea3c1 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickYExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/Right_StickYExecutable.java @@ -21,8 +21,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.fun 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.generic.GenericReceiver; +import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position; /** @@ -33,33 +32,25 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position; * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -public class Right_StickYExecutable extends GenericReceiverExecutable { +public class Right_StickYExecutable extends ReceiverExecutableBase<Right_StickY_Position> { /** Constructor. */ - public Right_StickYExecutable(GenericReceiver modelElement) { + public Right_StickYExecutable(Right_StickY_Position modelElement) { super(modelElement); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getInitialization() { return funcCall("gp_init"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { return funcCall("gp_btnRY_is_noval"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getTermination() { return funcCall("gp_term"); } - /** {@inheritDoc} */ - @Override public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { return funcCall("gp_btnRY_read"); } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GPITransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GPITransformation.java deleted file mode 100644 index ab91a6147058b0d300100ac7070133f9bee3c02a..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GPITransformation.java +++ /dev/null @@ -1,60 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.GPIExecutable; -import org.fortiss.af3.platform.raspberry.model.GPI; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * Transformation for {@link GPI}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class GPITransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return GPIExecutable.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return GPI.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof GPI; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new GPIExecutable((GPI)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GPOTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GPOTransformation.java deleted file mode 100644 index 9a010deb5e9bc577bdc3a5a64dd943b3da53ac4d..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GPOTransformation.java +++ /dev/null @@ -1,60 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.GPOExecutable; -import org.fortiss.af3.platform.raspberry.model.GPO; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * Transformation for {@link GPO}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class GPOTransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return GPOExecutable.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return GPO.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof GPO; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new GPOExecutable((GPO)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GamepadSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GamepadSensorTransformation.java deleted file mode 100644 index 3e81e0263d2432fe872f1de4374c2b365ccc5d79..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GamepadSensorTransformation.java +++ /dev/null @@ -1,59 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.GamepadSensorExecutable; -import org.fortiss.af3.platform.raspberry.model.SensorGamepad; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class GamepadSensorTransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return GamepadSensorExecutable.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return SensorGamepad.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof SensorGamepad; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new GamepadSensorExecutable((SensorGamepad)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java deleted file mode 100644 index 6648dc620e5c317592d3429bd5417f3e1df4d801..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java +++ /dev/null @@ -1,60 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.IMUSensorExecutable; -import org.fortiss.af3.platform.raspberry.model.SensorIMU; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * Transformation for {@link SensorIMU}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class IMUSensorTransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return IMUSensorExecutable.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return SensorIMU.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof SensorIMU; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new IMUSensorExecutable((SensorIMU)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java deleted file mode 100644 index 68e2a36423d291c62f6048f0afcc3b8ae6353c48..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java +++ /dev/null @@ -1,60 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.LaserRangeFinderSensorExecutable; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * Transformation for {@link SensorLaserRangeFinder}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class LaserRangeFinderSensorTransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return LaserRangeFinderSensorExecutable.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return SensorLaserRangeFinder.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof SensorLaserRangeFinder; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new LaserRangeFinderSensorExecutable((SensorLaserRangeFinder)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java deleted file mode 100644 index e5c80421e47d0e63ef4e8fb14426ad47d7c9de7b..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java +++ /dev/null @@ -1,60 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.LaserScannerSensorExecutable; -import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * Transformation for {@link SensorLaserScanner}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class LaserScannerSensorTransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return LaserScannerSensorExecutable.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return SensorLaserScanner.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof SensorLaserScanner; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new LaserScannerSensorExecutable((SensorLaserScanner)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/WheelEncoderTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/WheelEncoderTransformation.java deleted file mode 100644 index 88dcfa11ac18d7acca87c62dfbc3d4b5a41df71f..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/WheelEncoderTransformation.java +++ /dev/null @@ -1,61 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ -| | -| Copyright 2017 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.generator.transform; - -import org.fortiss.af3.platform.raspberry.generator.executable.WheelEncoderExecutable; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; -import org.fortiss.af3.platform.raspberry.model.WheelEncoder; -import org.fortiss.tooling.kernel.extension.ITransformationProvider; -import org.fortiss.tooling.kernel.extension.data.ITransformationContext; - -/** - * Transformation for {@link SensorLaserRangeFinder}. - * - * @author eder - * @author $Author: hoelzl $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class WheelEncoderTransformation implements ITransformationProvider { - - /** {@inheritDoc} */ - @Override - public Class<?> getTargetClass() { - return WheelEncoder.class; - } - - /** {@inheritDoc} */ - @Override - public boolean - canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { - return WheelEncoder.class.isAssignableFrom(sourceClass); - } - - /** {@inheritDoc} */ - @Override - public boolean canTransform(Object source, ITransformationContext context) { - return source instanceof WheelEncoder; - } - - /** {@inheritDoc} */ - @Override - public Object transform(Object source, ITransformationContext context) { - return new WheelEncoderExecutable((WheelEncoder)source); - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java index 9d7c2d5f1493ab5879f03ce21766045754f50455..7af2fc7399e9f37178ed77392acee68383f961a6 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java @@ -19,20 +19,11 @@ package org.fortiss.af3.platform.raspberry.util; import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createConnectorLayout; -import org.fortiss.af3.platform.raspberry.model.ActuatorConnector; import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; import org.fortiss.af3.platform.raspberry.model.CanBus; import org.fortiss.af3.platform.raspberry.model.CanConnector; -import org.fortiss.af3.platform.raspberry.model.GPI; -import org.fortiss.af3.platform.raspberry.model.GPO; import org.fortiss.af3.platform.raspberry.model.ModelFactory; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; -import org.fortiss.af3.platform.raspberry.model.SensorConnector; -import org.fortiss.af3.platform.raspberry.model.SensorGamepad; -import org.fortiss.af3.platform.raspberry.model.SensorIMU; -import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; -import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; -import org.fortiss.af3.platform.raspberry.model.WheelEncoder; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -82,54 +73,6 @@ public class RaspberryModelElementFactory { return canConnector; } - /** Creates a {@link SensorConnector}. */ - public static SensorConnector createSensorConnector() { - SensorConnector connector = ModelFactory.eINSTANCE.createSensorConnector(); - connector.setName("Sensor"); - createConnectorLayout(connector); - return connector; - } - - /** Creates a {@link SensorGamepad} */ - public static SensorGamepad createGamepadSensor() { - SensorGamepad connector = ModelFactory.eINSTANCE.createSensorGamepad(); - connector.setName("Gamepad"); - createConnectorLayout(connector); - return connector; - } - - /** Creates a {@link SensorIMU}. */ - public static SensorIMU createSensorIMU() { - SensorIMU connector = ModelFactory.eINSTANCE.createSensorIMU(); - connector.setName("IMU"); - createConnectorLayout(connector); - return connector; - } - - /** Creates a {@link SensorLaserRangeFinder}. */ - public static SensorLaserRangeFinder createSensorLaserRangeFinder() { - SensorLaserRangeFinder connector = ModelFactory.eINSTANCE.createSensorLaserRangeFinder(); - connector.setName("LaserRangeFinder"); - createConnectorLayout(connector); - return connector; - } - - /** Creates a {@link SensorLaserScanner}. */ - public static SensorLaserScanner createSensorLaserScanner() { - SensorLaserScanner connector = ModelFactory.eINSTANCE.createSensorLaserScanner(); - connector.setName("LaserScanner"); - createConnectorLayout(connector); - return connector; - } - - /** Creates a {@link ActuatorConnector}. */ - public static ActuatorConnector createActuatorConnector() { - ActuatorConnector connector = ModelFactory.eINSTANCE.createActuatorConnector(); - connector.setName("Sensor"); - createConnectorLayout(connector); - return connector; - } - /** Creates a {@link ActuatorPWM}. */ public static ActuatorPWM createActuatorPWM() { ActuatorPWM connector = ModelFactory.eINSTANCE.createActuatorPWM(); @@ -138,22 +81,6 @@ public class RaspberryModelElementFactory { return connector; } - /** Creates a {@link GPI}. */ - public static GPI createGPI() { - GPI gpi = ModelFactory.eINSTANCE.createGPI(); - gpi.setName("GPI"); - createConnectorLayout(gpi); - return gpi; - } - - /** Creates a {@link GPI}. */ - public static GPO createGPO() { - GPO gpo = ModelFactory.eINSTANCE.createGPO(); - gpo.setName("GPO"); - createConnectorLayout(gpo); - return gpo; - } - /** Creates a {@link Button1}. */ public static Button1 createButton1() { Button1 button = GamepadFactory.eINSTANCE.createButton1(); @@ -249,13 +176,4 @@ public class RaspberryModelElementFactory { createConnectorLayout(button); return button; } - - /** Creates a {@link Right_StickY_Position}. */ - public static WheelEncoder createWheelEncoder() { - WheelEncoder wEncoder = ModelFactory.eINSTANCE.createWheelEncoder(); - wEncoder.setName("WheelEncoder"); - createConnectorLayout(wEncoder); - return wEncoder; - } - }