Skip to content
Snippets Groups Projects
Commit 2e5c40a9 authored by Martin Eisenmann's avatar Martin Eisenmann
Browse files

Implemented LCD support

parent 6f3bbe3b
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,10 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.modelsconference.generator;
import static java.util.Arrays.asList;
import java.util.List;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.platform.modelsconference.model.LCD;
import org.fortiss.af3.platform.raspberry.generator.framework.IWriteableGeneratorExtension;
......@@ -31,15 +35,46 @@ public final class LCDGeneratorExtension extends WiringPiLibraryGeneratorExtensi
super(modelElement);
}
/** {@inheritDoc} */
@Override
public List<String> getHeaderIncludes() {
return asList("OLED_Display.h");
}
/** {@inheritDoc} */
@Override
public String getSingletonIdentifier() {
return "OLED_Display.h";
}
/** {@inheritDoc} */
@Override
public void setSingletonPostfix(String singletonPostfix) {
this.singletonPostfix = singletonPostfix == null ? "" : singletonPostfix;
}
/** {@inheritDoc} */
@Override
public String getSingletonVariableDeclarationCode() {
return "char oled_text[50];\n";
}
/** {@inheritDoc} */
@Override
public String getSingletonInitializationCode() {
return "initDisplay();\n";
}
/** {@inheritDoc} */
@Override
public String getWriteCode(OutputPort logicalSignal, String value) {
return "// FIXME: LCD support not implemented yet.\n";
return "clearDisplay();\nsprintf(oled_text, \"Speed: %G km/h\", " + value +
");\nprintTextPos(oled_text, 0, 0);\nshowDisplay();\n";
}
/** {@inheritDoc} */
@Override
public String getNoValWriteCode(OutputPort logicalSignal) {
return null;
return "clearDisplay();\nsprintf(oled_text, \"Speed: 0.0 km/h\");\nprintTextPos(oled_text, 0, 0);\nshowDisplay();\n";
}
}
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