Skip to content
Snippets Groups Projects
Commit 867ff2c1 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Switch unique identifier generation support from prefix to postfix.

parent 396b2555
No related branches found
No related tags found
No related merge requests found
Showing
with 220 additions and 77 deletions
CanBusExecutable.java a6d7a7767a1eae9770007e98115ead912f8a6e47 RED
CanConnectorExecutable.java ed13a0d5b71eae473ddec911cb572780660c85a4 RED
CanTransmissionCatalog.java ec4637eda80234429a9f382a37713588a0fbb83a RED
ConsoleOutputExecutable.java b44f1802331d7795949e939366864fcf0edc0696 YELLOW
ConsoleOutputExecutable.java 599295ac093cbc5f2913be9c92094588c7276543 YELLOW
HeaderCopyGenerator.java 18239a3adae35256e32dad19df9d8f38acbf7e66 RED
MultiUnitMainGenerator.java 458754b89c2d79db3fee08baa444424772e40fb7 RED
PWMActuatorExecutable.java dbcd7dbf46f7778cce7b52e659646d59ae7a2b3e YELLOW
PWMActuatorExecutable.java 9731e9a117563e9278b7677414362a37bb9e471c YELLOW
RaspberryPIExecutable.java cafff8199da9cc59688289c9c26097e6872e9702 RED
SingleUnitMainGenerator.java 6f019af498453ff3c7a615f03ceb46b593e9ff93 RED
SingleUnitMainGenerator.java fe13cbffac938bb7d93b3eece4ff7884c3878075 YELLOW
......@@ -32,7 +32,7 @@ public class ConsoleOutputExecutable extends ExecutableBase<ConsoleOutput> imple
/** {@inheritDoc} */
@Override
public String getWriteCode(String prefix, String singletonPrefix, OutputPort logicalSignal,
public String getWriteCode(String postfix, String singletonPostfix, OutputPort logicalSignal,
String value) {
String typeFormat = getTypeFormat(logicalSignal.getVariableType());
String name = logicalSignal.getName();
......@@ -49,8 +49,8 @@ public class ConsoleOutputExecutable extends ExecutableBase<ConsoleOutput> imple
/** {@inheritDoc} */
@Override
public String
getNoValWriteCode(String prefix, String singletonPrefix, OutputPort logicalSignal) {
public String getNoValWriteCode(String postfix, String singletonPostfix,
OutputPort logicalSignal) {
return "printf(\"" + logicalSignal.getName() + " = NoVal\\n\");\n";
}
}
......@@ -45,14 +45,15 @@ public class PWMActuatorExecutable extends PiHALLibraryExecutableBase<ActuatorPW
/** {@inheritDoc} */
@Override
public String getSingletonVariableDeclarationCode(String singletonPrefix) {
return "static int " + singletonPrefix + "_actuator_pwm = -1;\n";
public String getSingletonVariableDeclarationCode(String singletonPostfix) {
return "static int actuator_pwm_" + singletonPostfix + " = -1;\n";
}
/** {@inheritDoc} */
@Override
public String getSingletonInitializationCode(String singletonPrefix) {
return singletonPrefix + "_actuator_pwm = temp_actuator_initialize(\"/dev/ttyACM0\");\n";
public String getSingletonInitializationCode(String singletonPostfix) {
return "actuator_pwm_" + singletonPostfix +
" = temp_actuator_initialize(\"/dev/ttyACM0\");\n";
}
/** {@inheritDoc} */
......@@ -63,16 +64,16 @@ public class PWMActuatorExecutable extends PiHALLibraryExecutableBase<ActuatorPW
/** {@inheritDoc} */
@Override
public String getWriteCode(String prefix, String singletonPrefix, OutputPort logicalSignal,
public String getWriteCode(String postfix, String singletonPostfix, OutputPort logicalSignal,
String value) {
return "temp_actuator_device_set_target(" + singletonPrefix + "_actuator_pwm, " +
return "temp_actuator_device_set_target(actuator_pwm_" + singletonPostfix + ", " +
modelElement.getChannelID() + ", " + value + ");\n";
}
/** {@inheritDoc} */
@Override
public String
getNoValWriteCode(String prefix, String singletonPrefix, OutputPort logicalSignal) {
public String getNoValWriteCode(String postfix, String singletonPostfix,
OutputPort logicalSignal) {
return null;
}
}
......@@ -61,9 +61,9 @@ class SingleUnitMainGenerator {
private Map<PlatformConnectorUnit, ExecutableBase<?>> platformConnector2ExecutableBase =
new HashMap<>();
/** The map from singleton identifiers to singleton prefixes. */
private Map<String, String> singletonPrefixMap = new HashMap<>();
private Map<String, String> singletonPostfixMap = new HashMap<>();
/** The map from executables to instance prefixes. */
private Map<ExecutableBase<?>, String> instancePrefixMap = new HashMap<>();
private Map<ExecutableBase<?>, String> instancePostfixMap = new HashMap<>();
/** Constructor. */
public SingleUnitMainGenerator(RaspberryPi executionUnit,
......@@ -77,7 +77,7 @@ class SingleUnitMainGenerator {
this.headers = headers;
this.context = context;
this.platformConnector2ExecutableBase.putAll(platformConnector2ExecutableBase);
computePrefixes();
computePostfixes();
}
/** Creates the main.c file for deployments with a single execution units. */
......@@ -143,7 +143,7 @@ class SingleUnitMainGenerator {
(ISingletonInitializationExecutable)exec;
// check if variable declaration was already included
String ident = singletonExec.getSingletonIdentifier();
sPrefix = singletonPrefixMap.get(ident);
sPrefix = singletonPostfixMap.get(ident);
if(!singletonInitDone.contains(ident)) {
singletonInitDone.add(ident);
sb.append(singletonExec.getSingletonVariableDeclarationCode(sPrefix));
......@@ -153,7 +153,7 @@ class SingleUnitMainGenerator {
if(exec instanceof IInstanceInitializationExecutable) {
IInstanceInitializationExecutable initExec =
(IInstanceInitializationExecutable)exec;
String iPrefix = instancePrefixMap.get(initExec);
String iPrefix = instancePostfixMap.get(initExec);
sb.append(initExec.getVariableDeclaration(iPrefix, sPrefix));
}
}
......@@ -298,9 +298,10 @@ class SingleUnitMainGenerator {
ExecutableBase<?> exec = platformConnector2ExecutableBase.get(transmitter);
String sPrefix = null;
if(exec instanceof ISingletonExecutable) {
sPrefix = singletonPrefixMap.get(((ISingletonExecutable)exec).getSingletonIdentifier());
sPrefix =
singletonPostfixMap.get(((ISingletonExecutable)exec).getSingletonIdentifier());
}
String iPrefix = instancePrefixMap.get(exec);
String iPrefix = instancePostfixMap.get(exec);
if(exec instanceof IWriteableExecutable) {
IWriteableExecutable wexec = (IWriteableExecutable)exec;
String sourceVariable = getPortIdentifier(outport);
......@@ -322,9 +323,10 @@ class SingleUnitMainGenerator {
ExecutableBase<?> exec = platformConnector2ExecutableBase.get(receiver);
String sPrefix = null;
if(exec instanceof ISingletonExecutable) {
sPrefix = singletonPrefixMap.get(((ISingletonExecutable)exec).getSingletonIdentifier());
sPrefix =
singletonPostfixMap.get(((ISingletonExecutable)exec).getSingletonIdentifier());
}
String iPrefix = instancePrefixMap.get(exec);
String iPrefix = instancePostfixMap.get(exec);
if(exec instanceof IReadableExecutable) {
IReadableExecutable rexec = (IReadableExecutable)exec;
String targetVariable = getPortIdentifier(inport);
......@@ -350,7 +352,7 @@ class SingleUnitMainGenerator {
ISingletonInitializationExecutable singletonExec =
(ISingletonInitializationExecutable)exec;
String ident = singletonExec.getSingletonIdentifier();
sPrefix = singletonPrefixMap.get(ident);
sPrefix = singletonPostfixMap.get(ident);
if(!singletonInitDone.contains(ident)) {
singletonInitDone.add(ident);
sb.append(singletonExec.getSingletonInitializationCode(sPrefix));
......@@ -360,7 +362,7 @@ class SingleUnitMainGenerator {
if(exec instanceof IInstanceInitializationExecutable) {
IInstanceInitializationExecutable initExec =
(IInstanceInitializationExecutable)exec;
String iPrefix = instancePrefixMap.get(initExec);
String iPrefix = instancePostfixMap.get(initExec);
sb.append(initExec.getInitializationCode(iPrefix, sPrefix));
}
}
......@@ -368,23 +370,23 @@ class SingleUnitMainGenerator {
}
/** A counter to produce unique identifiers. */
private int prefixCounter = 1;
private int postfixCounter = 1;
/** Computes the singleton and instance prefixes for all executables. */
private void computePrefixes() {
private void computePostfixes() {
for(PlatformConnectorUnit pcu : platformConnector2ExecutableBase.keySet()) {
ExecutableBase<?> exec = platformConnector2ExecutableBase.get(pcu);
if(exec instanceof ISingletonExecutable) {
String id = ((ISingletonExecutable)exec).getSingletonIdentifier();
if(!singletonPrefixMap.containsKey(id)) {
String sPrefix = "singleton_" + (prefixCounter++);
singletonPrefixMap.put(id, sPrefix);
if(!singletonPostfixMap.containsKey(id)) {
String sPostfix = "singleton_" + (postfixCounter++);
singletonPostfixMap.put(id, sPostfix);
}
}
if(exec instanceof IInstanceExecutable) {
if(!instancePrefixMap.containsKey(exec)) {
String iPrefix = "instance_" + (prefixCounter++);
instancePrefixMap.put(exec, iPrefix);
if(!instancePostfixMap.containsKey(exec)) {
String iPostfix = "instance_" + (postfixCounter++);
instancePostfixMap.put(exec, iPostfix);
}
}
}
......
BrickExecutableBase.java 2d30dde26cfc0b5be177e925d8aa958ce755d297 RED
UltraSonicSensorExecutable.java 843640ab30327abc8be23fed819bf642437b5a5d RED
/*-------------------------------------------------------------------------+
| Copyright 2018 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.brick;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.platform.language.executable.ExecutableBase;
import org.fortiss.af3.platform.raspberry.generator.executable.framework.ISingletonInitializationExecutable;
import org.fortiss.af3.platform.raspberry.generator.executable.library.BrickLibraryExecutableBase;
/**
* Base class for {@link ExecutableBase executables} for the Brick and Bricklets hardware.
*
* @author hoelzl
*/
abstract class BrickExecutableBase<T extends EObject> extends BrickLibraryExecutableBase<T>
implements ISingletonInitializationExecutable {
/** Constructor. */
public BrickExecutableBase(T modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public String getSingletonIdentifier() {
return "ip_connection.h";
}
/** {@inheritDoc} */
@Override
public String getSingletonVariableDeclarationCode(String singletonPostfix) {
return "IPConnection " + getConnectionVariable(singletonPostfix) + ";\n";
}
/** {@inheritDoc} */
@Override
public String getSingletonInitializationCode(String singletonPostfix) {
StringBuilder sb = new StringBuilder();
String connectionVariable = getConnectionVariable(singletonPostfix);
sb.append("ipcon_create(&" + connectionVariable + ");\n");
sb.append("if(ipcon_connect(&" + connectionVariable + ", BRICK_HOST, BRICK_PORT) < 0) {\n");
sb.append("perror(\"Failed to connect to brick sub-system.\");\n");
sb.append("return 1;\n");
sb.append("}\n\n");
return sb.toString();
}
/** Returns the connection variable name. */
protected final String getConnectionVariable(String postfix) {
return "brick_connection" + postfix;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2018 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.brick;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.platform.language.executable.ExecutableBase;
import org.fortiss.af3.platform.raspberry.generator.executable.framework.IInstanceInitializationExecutable;
import org.fortiss.af3.platform.raspberry.generator.executable.framework.IReadableExecutable;
import org.fortiss.af3.platform.raspberry.model.brick.UltraSonicSensor;
/**
* {@link ExecutableBase} for {@link UltraSonicSensor}s.
*
* @author hoelzl
*/
public class UltraSonicSensorExecutable extends BrickExecutableBase<UltraSonicSensor> implements
IReadableExecutable, IInstanceInitializationExecutable {
/** Constructor. */
public UltraSonicSensorExecutable(UltraSonicSensor modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public String getHeaderFileName() {
return "bricklet_distance_us.h";
}
/** {@inheritDoc} */
@Override
public String getVariableDeclaration(String postfix, String singletonPostfix) {
return null;
}
/** {@inheritDoc} */
@Override
public String getInitializationCode(String postfix, String singletonPostfix) {
// TODO Auto-generated method stub
return null;
}
/** {@inheritDoc} */
@Override
public String getReadCode(String prefix, String singletonPrefix, InputPort logicalSignal,
String targetVariable) {
// sb.append("DistanceUS DistanceUS_A;\n");
// sb.append("uid_us_A = \"" + sensor.getUniqueBrickletID() + "\";\n");
// sb.append("distance_us_create(&DistanceUS_A, \"" +
// sensor.getUniqueBrickletID() + "\", &brick_connection);\n");
// sb.append("distance_us_register_callback(&DistanceUS_A, DISTANCE_US_CALLBACK_DISTANCE, (void*)us_A_callback, NULL);\n");
// sb.append("distance_us_set_distance_callback_period(&DistanceUS_A, 10);\n");
return null;
}
/** {@inheritDoc} */
@Override
public String getNoValReadCode(String prefix, String singletonPrefix, InputPort logicalSignal) {
return null;
}
}
IInstanceExecutable.java 3affc638b5802896ff7bfae6f9185fc0dfa8c8d2 YELLOW
IInstanceInitializationExecutable.java 692ea1d3245101e6871b610b6b2acbf09ac5b16f YELLOW
IInstanceTerminationExecutable.java 7be0257c229e85e223e72a19d21fd4c7c5db1750 YELLOW
IInstanceInitializationExecutable.java 6adb384fcfbba6aeb6e04c62249deb48fa64cc1e YELLOW
IInstanceTerminationExecutable.java 2663162a843e8954a11083d78e16b17659df0d27 YELLOW
IRasPiHeaderExecutable.java f14b5714e7b982e097f6ac6e95eb91223a30d048 YELLOW
IRasPiLibraryBasedExecutable.java cf3548f22185e666fdcf6d4658b783734c0e5e8e YELLOW
IRasPiSourceBasedExecutable.java 79646213964346ace17013f5c8df5de13dafb1f0 YELLOW
IReadableExecutable.java 68e8decd7568587e5b1951a1b3fed1237643d604 YELLOW
IReadableExecutable.java b50e2e1b3dc6d3557a3c923765b65b769960a95e YELLOW
ISingletonExecutable.java d7a794f50cf4746fa9378ffaa89283130b5273b1 YELLOW
ISingletonInitializationExecutable.java fe042d336b3f9c618051d6598dfad882292b554f YELLOW
ISingletonTerminationExecutable.java 2bd04ac893bedfd44ca4e73a27dd636873d8b64a YELLOW
IWriteableExecutable.java 94296a1c47dec576443faf93bbcf7f8d668b834b YELLOW
ISingletonInitializationExecutable.java 620e5e92e1750cce7e96b8a529a3d800e270ed9c YELLOW
ISingletonTerminationExecutable.java a55e86fc68c083eaa7a81b4d08bafacd72c701b2 YELLOW
IWriteableExecutable.java 43b0b80631fdd6e9f13cdc6fe3e63bbb98c62647 YELLOW
......@@ -26,17 +26,17 @@ import org.fortiss.af3.platform.language.executable.ExecutableBase;
*/
public interface IInstanceInitializationExecutable extends IInstanceExecutable {
/**
* Returns the variable declarations needed by this executable. The prefix is given by the code
* Returns the variable declarations needed by this executable. The postfix is given by the code
* generator to ensure uniqueness of variables for platform elements of the same type. If the
* implementing class also implements {@link ISingletonInitializationExecutable} the
* {@code singletonPrefix} is non-null and the same as supplied to the methods of the latter
* {@code singletonPostfix} is non-null and the same as supplied to the methods of the latter
* interface.
*/
String getVariableDeclaration(String prefix, String singletonPrefix);
String getVariableDeclaration(String postfix, String singletonPostfix);
/**
* Returns the initialization code for the given {@code prefix} and, optionally,
* {@code singletonPrefix}.
* Returns the initialization code for the given {@code postfix} and, optionally,
* {@code singletonPostfix}.
*/
String getInitializationCode(String prefix, String singletonPrefix);
String getInitializationCode(String postfix, String singletonPostfix);
}
......@@ -19,12 +19,12 @@ import org.fortiss.af3.platform.language.executable.ExecutableBase;
/**
* Interface for {@link ExecutableBase}s, which require to be terminated during program shutdown.
* The termination code is included for every executable instance with the {@code prefix} provided
* The termination code is included for every executable instance with the {@code postfix} provided
* by the code generator.
*
* @author hoelzl
*/
public interface IInstanceTerminationExecutable extends IInstanceExecutable {
/** Returns an termination code for the given {@code prefix}. */
String getInstanceTerminationCode(String prefix);
/** Returns an termination code for the given {@code postfix}. */
String getInstanceTerminationCode(String postfix);
}
......@@ -26,12 +26,12 @@ import org.fortiss.af3.component.model.InputPort;
*/
public interface IReadableExecutable {
/** Returns the read code for the given port and target variable. */
String getReadCode(String prefix, String singletonPrefix, InputPort logicalSignal,
String getReadCode(String postfix, String singletonPostfix, InputPort logicalSignal,
String targetVariable);
/**
* Returns the read code to determine whether the value of the platform element is NoVal. May
* return {@code null}, to indicate that NoVal is not supported.
*/
String getNoValReadCode(String prefix, String singletonPrefix, InputPort logicalSignal);
String getNoValReadCode(String postfix, String singletonPostfix, InputPort logicalSignal);
}
......@@ -29,10 +29,10 @@ package org.fortiss.af3.platform.raspberry.generator.executable.framework;
public interface ISingletonInitializationExecutable extends ISingletonExecutable {
/**
* Returns the code to initialize local variables used by the code. Implementors may use the
* provided {@code singletonPrefix} to create unique variable names.
* provided {@code singletonPostfix} to create unique variable names.
*/
String getSingletonVariableDeclarationCode(String singletonPrefix);
String getSingletonVariableDeclarationCode(String singletonPostfix);
/** Returns the common initialization code. */
String getSingletonInitializationCode(String singletonPrefix);
String getSingletonInitializationCode(String singletonPostfix);
}
......@@ -21,11 +21,11 @@ import org.fortiss.af3.platform.language.executable.ExecutableBase;
* Interface for singleton {@link ExecutableBase}s, which require to be terminated during program
* shutdown. The termination code is only executed once for all executables, which return the same
* identifier with {@link #getSingletonIdentifier()}. The executable is provided a
* {@code singletonPrefix} to ensure uniqueness of identifiers.
* {@code singletonPostfix} to ensure uniqueness of identifiers.
*
* @author hoelzl
*/
public interface ISingletonTerminationExecutable extends ISingletonExecutable {
/** Returns an termination code for the given {@code singletonPrefix}. */
String getSingletonTerminationCode(String singletonPrefix);
/** Returns an termination code for the given {@code singletonPostfix}. */
String getSingletonTerminationCode(String singletonPostfix);
}
......@@ -24,12 +24,12 @@ import org.fortiss.af3.component.model.OutputPort;
*/
public interface IWriteableExecutable {
/** Returns the write code for the given port. */
String getWriteCode(String prefix, String singletonPrefix, OutputPort logicalSignal,
String getWriteCode(String postfix, String singletonPostfix, OutputPort logicalSignal,
String value);
/**
* Returns the write code for the given port if the value to be written is NoVal. May return
* {@code null}, to indicate that NoVal is not supported.
*/
String getNoValWriteCode(String prefix, String singletonPrefix, OutputPort logicalSignal);
String getNoValWriteCode(String postfix, String singletonPostfix, OutputPort logicalSignal);
}
......@@ -2,14 +2,14 @@ Button1Executable.java 4419314d71af50239cf6933a83a0f652614cf368 YELLOW
Button2Executable.java 3af03ceea3aa09178fe88fe630c94282de0b72f2 YELLOW
Button3Executable.java 964fbe4e0b5282ab617c4be2bed31afa8b4f394f YELLOW
Button4Executable.java 53db1cce9e3dfface4027f883586bf90638cd4ff YELLOW
ButtonExecutableBase.java c088da46cb2cef538948e5cb1794e55b13ab7cba YELLOW
ButtonExecutableBase.java 00be5129edbdc2a3a973b15921b74c7ac11f944e YELLOW
ButtonL1Executable.java ab68cddae1d323ff0ecd7956133c44d1ef0f9168 YELLOW
ButtonL2Executable.java 336b9d8d26a682b701f7a2ca078369c9cc621fbb YELLOW
ButtonR1Executable.java 700ef701ed77a0d3f8141166fe647ac5cd4ad570 YELLOW
ButtonR2Executable.java 9b4acdc37505f41c60d8216c92bcbd3f43a2ccec YELLOW
GamepadExecutableBase.java ec5dc44fcb2547990f01dc088da49683e126d1c0 YELLOW
GamepadExecutableBase.java cd8d005beb92a52298af719b335dff5861ae98fa YELLOW
Left_StickXExecutable.java c3e7f28f44fa27bd79e14ed7e60f44be2dc5a9ab YELLOW
Left_StickYExecutable.java f81cc1e3124eb712507825bc54e7d0f633fde640 YELLOW
Right_StickXExecutable.java ade165c88d0c6758efa167e5ba445eff87a0fd79 YELLOW
Right_StickYExecutable.java 891ea877d8c3f4bab6072a02b17bb92a6caa055d YELLOW
StickExecutableBase.java 28de7e3d22652f548545e4cbdedbb5298fc56905 YELLOW
StickExecutableBase.java 561a77c160dc27f13d6d6959a2285a0bf07d5096 YELLOW
......@@ -33,14 +33,14 @@ abstract class ButtonExecutableBase<T extends EObject> extends GamepadExecutable
/** {@inheritDoc} */
@Override
public final String getReadCode(String prefix, String singletonPrefix, InputPort logicalSignal,
String targetVariable) {
public final String getReadCode(String postfix, String singletonPostfix,
InputPort logicalSignal, String targetVariable) {
return targetVariable + " = gamepad_get_button_state(" + getButtonIdentifier() + ");\n";
}
/** {@inheritDoc} */
@Override
public final String getNoValReadCode(String prefix, String singletonPrefix,
public final String getNoValReadCode(String postfix, String singletonPostfix,
InputPort logicalSignal) {
return null;
}
......
......@@ -34,14 +34,14 @@ abstract class GamepadExecutableBase<T extends EObject> extends PiHALLibraryExec
/** {@inheritDoc} */
@Override
public final String getSingletonVariableDeclarationCode(String singletonPrefix) {
return "static gamepad_configuration_t* " + singletonPrefix + "_gamepad_config;\n";
public final String getSingletonVariableDeclarationCode(String singletonPostfix) {
return "static gamepad_configuration_t* gamepad_config" + singletonPostfix + ";\n";
}
/** {@inheritDoc} */
@Override
public final String getSingletonInitializationCode(String singletonPrefix) {
String prefixedVar = singletonPrefix + "_gamepad_config";
public final String getSingletonInitializationCode(String singletonPostfix) {
String prefixedVar = "gamepad_config_" + singletonPostfix;
StringBuilder sb = new StringBuilder();
sb.append("// initialize the gamepad configuration\n");
sb.append(prefixedVar + " = malloc(sizeof(gamepad_configuration_t));\n");
......
......@@ -33,14 +33,15 @@ abstract class StickExecutableBase<T extends EObject> extends GamepadExecutableB
/** {@inheritDoc} */
@Override
public final String getReadCode(String prefix, String singletonPrefix, InputPort logicalSignal,
String targetVariable) {
public final String getReadCode(String postfix, String singletonPostfix,
InputPort logicalSignal, String targetVariable) {
return targetVariable + " = gamepad_get_axis_position(" + getAxisIdentifier() + ");\n";
}
/** {@inheritDoc} */
@Override
public String getNoValReadCode(String prefix, String singletonPrefix, InputPort logicalSignal) {
public String
getNoValReadCode(String postfix, String singletonPostfix, InputPort logicalSignal) {
return null;
}
......
ButtonAExecutable.java bbcb151d851b1b3d3e97b7e11b790fa13559fd96 YELLOW
ButtonBExecutable.java d659e04dc60cba0808bd2fceae22fcbc1bd203a9 YELLOW
ButtonExecutableBase.java 92a0dcba935028925c1b2af6d3d68152380189fe YELLOW
ButtonExecutableBase.java 578104b5b572ee49ddcc142d165e10eec07e1738 YELLOW
ButtonHomeExecutable.java e3a19a82d2cafd3bc75b6a7fc1a75df5656df48c YELLOW
ButtonL1Executable.java 68fac6c2abc7ea40eb7cc16839677a4cdc24111a YELLOW
ButtonL3Executable.java 2d04b51ee7ab822419140cf69821bbcbcfded359 YELLOW
......@@ -20,6 +20,6 @@ Left_StickYExecutable.java cc2b36f9bca913dc1956f34495cf9c77acb13c88 YELLOW
R2PositionExecutable.java 19f778392841d02d281fd856564b75e1333dffaa YELLOW
Right_StickXExecutable.java 97656a2ae56a70eac88153b123f2cd9c584af967 YELLOW
Right_StickYExecutable.java f3d942123ca47d0ddbf32f4f46bfaf2b21732653 YELLOW
RumblepadExecutableBase.java d5af8e370cab04e7c37e645055a4268d026995fd YELLOW
RumblepadExecutableBase.java 3162f971885e5d85967f8eb732731632f9a1e9e6 YELLOW
SimpleRumbleFeatureExecutable.java 413b6fb3f5847f0d09f52341c98b95f74c352016 YELLOW
StickExecutableBase.java a9ae46291b6090ea090a3adc4ec45160a274b149 YELLOW
StickExecutableBase.java 4e1188b3e3a3b6d53a6387d2cf472c89c27b7449 YELLOW
......@@ -33,14 +33,14 @@ abstract class ButtonExecutableBase<T extends EObject> extends RumblepadExecutab
/** {@inheritDoc} */
@Override
public final String getReadCode(String prefix, String singletonPrefix, InputPort logicalSignal,
String targetVariable) {
public final String getReadCode(String postfix, String singletonPostfix,
InputPort logicalSignal, String targetVariable) {
return targetVariable + " = rumblepad_get_button_state(" + getButtonIdentifier() + ");\n";
}
/** {@inheritDoc} */
@Override
public final String getNoValReadCode(String prefix, String singletonPrefix,
public final String getNoValReadCode(String postfix, String singletonPostfix,
InputPort logicalSignal) {
return null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment