├── .github
└── workflows
│ └── maven.yml
├── .mvn
└── extensions.xml
├── .travis.yml
├── LICENSE
├── README.md
├── features
├── org.yakindu.sct.arduino
│ ├── .gitignore
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ └── feature.xml
└── pom.xml
├── plugins
├── org.yakindu.sct.arduino.examples
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── org.eclipse.jdt.core.prefs
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── epl-v10.html
│ ├── icons
│ │ ├── yakindu16.png
│ │ └── yakindu48.png
│ ├── plugin.xml
│ └── projects
│ │ ├── Blink.zip
│ │ └── PedestrianCrossing.zip
├── org.yakindu.sct.arduino.generator.cpp
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ ├── org.eclipse.core.resources.prefs
│ │ ├── org.eclipse.jdt.core.prefs
│ │ ├── org.eclipse.jdt.ui.prefs
│ │ └── org.eclipse.xtend.shared.ui.prefs
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── epl-v10.html
│ ├── library
│ │ └── ArduinoFeatureTypeLibrary.xmi
│ ├── plugin.xml
│ ├── pom.xml
│ ├── schema
│ │ └── org.yakindu.sct.arduino.generator.cpp.architectures.exsd
│ └── src
│ │ └── org
│ │ └── yakindu
│ │ └── sct
│ │ └── arduino
│ │ └── generator
│ │ └── cpp
│ │ ├── ArduinoCPPNaming.xtend
│ │ ├── ArduinoCodeGenerator.xtend
│ │ ├── ArduinoCppCodeGenerator.java
│ │ ├── ArduinoCppCodeGeneratorModule.java
│ │ ├── ArduinoGeneratorPlugin.java
│ │ ├── ArduinoGenmodelEntries.xtend
│ │ ├── ArduinoMain.xtend
│ │ ├── ArduinoMainHeader.xtend
│ │ ├── HardwareConnectorHeader.xtend
│ │ ├── MaxParallelTimers.xtend
│ │ ├── StatemachineConnector.xtend
│ │ ├── StatemachineConnectorHeader.xtend
│ │ ├── TimeEventHeader.xtend
│ │ ├── extensions
│ │ ├── AbstractNamedElement.java
│ │ ├── ArchitectureElement.java
│ │ ├── ArchitecturesExtension.java
│ │ └── TimerElement.java
│ │ ├── features
│ │ ├── ArduinoDefaultFeatureValueProvider.java
│ │ ├── CoreDefaultFeatureValueProvider.java
│ │ ├── IArduinoFeatureConstants.java
│ │ ├── Messages.java
│ │ └── messages.properties
│ │ └── timers
│ │ ├── AbstractTimer.xtend
│ │ ├── SoftwareTimer_Millis.xtend
│ │ ├── avr
│ │ ├── ATmega_Timer0.xtend
│ │ ├── ATmega_Timer1.xtend
│ │ ├── ATmega_Timer2.xtend
│ │ ├── ATmega_Timer3.xtend
│ │ ├── ATmega_Timer4.xtend
│ │ ├── ATmega_Timer5.xtend
│ │ ├── ATmega_WDT.xtend
│ │ ├── ATtiny_Timer0.xtend
│ │ ├── ATtiny_Timer1.xtend
│ │ ├── ATtiny_WDT.xtend
│ │ ├── AbstractAVR16BitTimer.xtend
│ │ ├── AbstractAVR8BitTimer.xtend
│ │ └── AbstractAVRTimer.xtend
│ │ └── esp
│ │ └── ESP8266_Timer.xtend
├── org.yakindu.sct.arduino.help
│ ├── .gitignore
│ ├── .project
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── epl-v10.html
│ ├── md
│ │ ├── ArduinoToolchainSetup.md
│ │ ├── CreatingExamples.md
│ │ ├── Installation.md
│ │ ├── ProgrammingArduino.md
│ │ ├── ProjectSetup.md
│ │ └── screenshots
│ │ │ ├── AddRepository.png
│ │ │ ├── ArduinoDownloadsManager.png
│ │ │ ├── GenerateCodeArtifacts.png
│ │ │ ├── ImplementConnector.png
│ │ │ ├── InstallNewSoftware.png
│ │ │ ├── InstallSCTforArduino.png
│ │ │ ├── NewArduinoProjectWizardPage.png
│ │ │ ├── NewArduinoSCTProject.png
│ │ │ ├── NewArduinoTargetWizard.png
│ │ │ ├── NewLaunchTarget.png
│ │ │ ├── NewProjectContextMenu.png
│ │ │ ├── NewProjectWizard.png
│ │ │ ├── ProjectAfterCodeGeneration.png
│ │ │ ├── ProjectPropertiesWizardPage.png
│ │ │ ├── RunningSimulation.png
│ │ │ ├── SCModeling.png
│ │ │ ├── SGenMultiPageEditor.png
│ │ │ ├── StartSimulation.png
│ │ │ ├── UploadProgram.png
│ │ │ └── UploadingFinished.png
│ ├── plugin.xml
│ ├── pom.xml
│ └── toc.xml
├── org.yakindu.sct.arduino.ui
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ ├── org.eclipse.jdt.core.prefs
│ │ └── org.eclipse.jdt.ui.prefs
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── epl-v10.html
│ ├── icons
│ │ └── yakindu16.png
│ ├── plugin.xml
│ ├── src
│ │ └── org
│ │ │ └── yakindu
│ │ │ └── sct
│ │ │ └── arduino
│ │ │ └── ui
│ │ │ ├── SCTArduinoUIPlugin.java
│ │ │ ├── editors
│ │ │ ├── ArduinoFeatureConfigurationSection.java
│ │ │ ├── Messages.java
│ │ │ └── messages.properties
│ │ │ └── wizards
│ │ │ ├── ArduinoModelCreator.java
│ │ │ ├── ArduinoSCTProjectGenerator.java
│ │ │ ├── ArduinoSCTWizardPage.java
│ │ │ ├── CyclePeriodsProvider.java
│ │ │ ├── Messages.java
│ │ │ ├── NamedExtensionElementsProvider.java
│ │ │ ├── NewArduinoSCTProjectWizard.java
│ │ │ └── messages.properties
│ └── templates
│ │ └── arduino_sgen
│ │ ├── arduino_sgen.template
│ │ └── manifest.xml
├── org.yakindu.sct.editor.sgen
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ ├── org.eclipse.jdt.core.prefs
│ │ └── org.eclipse.jdt.ui.prefs
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── icons
│ │ └── GeneratorModel.gif
│ ├── plugin.xml
│ ├── schema
│ │ └── featureConfigurationSections.exsd
│ └── src
│ │ └── org
│ │ └── yakindu
│ │ └── sct
│ │ └── editor
│ │ └── sgen
│ │ ├── AbstractFeatureConfigurationSection.java
│ │ ├── GeneratorEntryFormPage.java
│ │ ├── GenericFeatureConfigurationSection.java
│ │ ├── Messages.java
│ │ ├── SGenEditorUIExecutableExtensionFactory.java
│ │ ├── SGenEditorUIImages.java
│ │ ├── SGenEditorUIPlugin.java
│ │ ├── SGenModelUtil.java
│ │ ├── SGenMultiPageEditor.java
│ │ ├── SGenMultiPageEditorContributor.java
│ │ ├── extensions
│ │ ├── FeatureConfigurationSectionsExtension.java
│ │ ├── IFeatureConfigurationSection.java
│ │ └── LicenseHeaderFeatureConfigurationSection.java
│ │ └── messages.properties
└── pom.xml
├── pom.xml
└── releng
├── org.yakindu.sct.arduino.config
├── .project
├── Build.launch
├── YAKINDU SCT for Arduino IDE.launch
└── pom.xml
├── org.yakindu.sct.arduino.ide.setup
├── .project
├── IoT-IDE.setup
├── SCTArduinoDevelopmentIDE.setup
└── SCTArduinoIDE.setup
├── org.yakindu.sct.arduino.p2repo
├── .gitignore
├── .project
├── category.xml
├── epl-v10.html
├── pom.xml
└── siteTemplate
│ └── index.html
├── org.yakindu.sct.arduino.target
├── .gitignore
├── .project
├── 2019-06.target
└── pom.xml
└── pom.xml
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | name: Yakindu SCT for Arduino
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - uses: actions/checkout@v1
12 | - name: Set up JDK 1.8
13 | uses: actions/setup-java@v1
14 | with:
15 | java-version: 1.8
16 | - name: Build with Maven
17 | run: mvn clean verify
18 |
--------------------------------------------------------------------------------
/.mvn/extensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.eclipse.tycho.extras
4 | tycho-pomless
5 | 1.5.1
6 |
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: trusty
2 | language: java
3 | jdk:
4 | - oraclejdk8
5 | script: mvn clean verify
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # YAKINDU SCT for Arduino
2 |
3 | This project brings you tooling to program your Arduino with statecharts. You will use the [YAKINDU Statechart Tools](http://statecharts.org) to create a statechart. With this statechart you model the intended behaviour of your Arduino. From the state chart C++ code is generated for your Arduino. You just need to fill two methods to connect the hardware to your statechart and deploy the code to your Arduino. Five minutes to program an Arduino with statecharts!
4 |
5 | YAKINDU SCT for Arduino does not only support the well-known Arduino Uno board but various other boards based on these microprocessors and their derivates: ATmega328, ATmega2560, ATmega32u4, ESP8266, and others. It even supports unknown microprocessors by a generic implementation.
6 |
7 | You will find further documentation here:
8 |
9 | * [Installation Guide](plugins/org.yakindu.sct.arduino.help/md/Installation.md)
10 | * [Arduino Toolchain Setup](plugins/org.yakindu.sct.arduino.help/md/ArduinoToolchainSetup.md)
11 | * [Arduino SCT Project Setup](plugins/org.yakindu.sct.arduino.help/md/ProjectSetup.md)
12 | * [Programming an Arduino with Statecharts](plugins/org.yakindu.sct.arduino.help/md/ProgrammingArduino.md)
13 | * [Creating an Example Project](plugins/org.yakindu.sct.arduino.help/md/CreatingExamples.md)
14 |
15 | [](https://travis-ci.org/wendehals/arduino_sct_tools)
16 |
--------------------------------------------------------------------------------
/features/org.yakindu.sct.arduino/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.polyglot.feature.xml*
3 |
--------------------------------------------------------------------------------
/features/org.yakindu.sct.arduino/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.pde.FeatureBuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.pde.FeatureNature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/features/org.yakindu.sct.arduino/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = feature.xml,\
2 | epl-v10.html
3 | src.includes = epl-v10.html,\
4 | pom.xml
5 |
--------------------------------------------------------------------------------
/features/org.yakindu.sct.arduino/feature.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 | YAKINDU Statechart Tools for Arduino
12 |
13 |
14 |
15 | Copyright 2018 by Lothar Wendehals
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
66 |
67 |
72 |
73 |
78 |
79 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/features/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 | org.yakindu.sct.arduino
7 | features
8 | 0.10.0-SNAPSHOT
9 |
10 | pom
11 |
12 |
13 | org.yakindu.sct.arduino
14 | root
15 | 0.10.0-SNAPSHOT
16 |
17 |
18 |
19 | org.yakindu.sct.arduino
20 |
21 |
22 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.META-INF_MANIFEST.MF
3 | /.polyglot..META-INF_MANIFEST.MF
4 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.examples
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.pde.ManifestBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.SchemaBuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.pde.PluginNature
21 |
22 |
23 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.source=1.8
8 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: YAKINDU Statechart Tools for Arduino Examples
4 | Bundle-SymbolicName: org.yakindu.sct.arduino.examples;singleton:=true
5 | Bundle-Version: 0.10.0.qualifier
6 | Bundle-Vendor: Lothar Wendehals
7 | Require-Bundle: org.eclipse.ui,
8 | org.eclipse.core.runtime,
9 | org.eclipse.emf.common.ui
10 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = plugin.xml,\
2 | META-INF/,\
3 | .,\
4 | icons/,\
5 | projects/,\
6 | epl-v10.html
7 | src.includes = projects/,\
8 | icons/,\
9 | epl-v10.html
10 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/icons/yakindu16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.examples/icons/yakindu16.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/icons/yakindu48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.examples/icons/yakindu48.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
19 |
20 | A pedestrian crossing traffic light running on an Arduino Uno.
21 |
22 |
23 |
32 |
33 | The typical Arduino "Hello World" example - a blinking LED - running on an Arduino Uno.
34 |
35 |
36 |
37 |
39 |
42 |
46 |
47 |
49 |
50 |
51 |
54 |
58 |
59 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/projects/Blink.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.examples/projects/Blink.zip
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.examples/projects/PedestrianCrossing.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.examples/projects/PedestrianCrossing.zip
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /xtend-gen/
3 | /target/
4 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.generator.cpp
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.xtend.shared.ui.xtendBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.jdt.core.javabuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.xtext.ui.shared.xtextBuilder
30 |
31 |
32 |
33 |
34 |
35 | org.eclipse.jdt.core.javanature
36 | org.eclipse.pde.PluginNature
37 | org.eclipse.xtext.ui.shared.xtextNature
38 |
39 |
40 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/.classpath=Cp1252
3 | encoding//.settings/org.eclipse.core.resources.prefs=Cp1252
4 | encoding//.settings/org.eclipse.xtend.shared.ui.prefs=Cp1252
5 | encoding//META-INF/MANIFEST.MF=Cp1252
6 | encoding//src/org/yakindu/sct/arduino/generator/cpp/ArduinoCodeGenerator.xtend=Cp1252
7 | encoding/=UTF-8
8 | encoding/build.properties=Cp1252
9 | encoding/plugin.xml=Cp1252
10 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
3 | formatter_profile=_arduino_cdt
4 | formatter_settings_version=12
5 | sp_cleanup.add_default_serial_version_id=true
6 | sp_cleanup.add_generated_serial_version_id=false
7 | sp_cleanup.add_missing_annotations=true
8 | sp_cleanup.add_missing_deprecated_annotations=true
9 | sp_cleanup.add_missing_methods=false
10 | sp_cleanup.add_missing_nls_tags=false
11 | sp_cleanup.add_missing_override_annotations=true
12 | sp_cleanup.add_missing_override_annotations_interface_methods=true
13 | sp_cleanup.add_serial_version_id=false
14 | sp_cleanup.always_use_blocks=true
15 | sp_cleanup.always_use_parentheses_in_expressions=true
16 | sp_cleanup.always_use_this_for_non_static_field_access=true
17 | sp_cleanup.always_use_this_for_non_static_method_access=false
18 | sp_cleanup.convert_functional_interfaces=false
19 | sp_cleanup.convert_to_enhanced_for_loop=false
20 | sp_cleanup.correct_indentation=true
21 | sp_cleanup.format_source_code=true
22 | sp_cleanup.format_source_code_changes_only=false
23 | sp_cleanup.insert_inferred_type_arguments=false
24 | sp_cleanup.make_local_variable_final=true
25 | sp_cleanup.make_parameters_final=true
26 | sp_cleanup.make_private_fields_final=true
27 | sp_cleanup.make_type_abstract_if_missing_method=false
28 | sp_cleanup.make_variable_declarations_final=true
29 | sp_cleanup.never_use_blocks=false
30 | sp_cleanup.never_use_parentheses_in_expressions=false
31 | sp_cleanup.on_save_use_additional_actions=true
32 | sp_cleanup.organize_imports=true
33 | sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
34 | sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
35 | sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
36 | sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
37 | sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
38 | sp_cleanup.remove_private_constructors=true
39 | sp_cleanup.remove_redundant_type_arguments=false
40 | sp_cleanup.remove_trailing_whitespaces=true
41 | sp_cleanup.remove_trailing_whitespaces_all=true
42 | sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
43 | sp_cleanup.remove_unnecessary_casts=true
44 | sp_cleanup.remove_unnecessary_nls_tags=true
45 | sp_cleanup.remove_unused_imports=true
46 | sp_cleanup.remove_unused_local_variables=false
47 | sp_cleanup.remove_unused_private_fields=true
48 | sp_cleanup.remove_unused_private_members=false
49 | sp_cleanup.remove_unused_private_methods=true
50 | sp_cleanup.remove_unused_private_types=true
51 | sp_cleanup.sort_members=false
52 | sp_cleanup.sort_members_all=false
53 | sp_cleanup.use_anonymous_class_creation=false
54 | sp_cleanup.use_blocks=true
55 | sp_cleanup.use_blocks_only_for_return_and_throw=false
56 | sp_cleanup.use_lambda=true
57 | sp_cleanup.use_parentheses_in_expressions=true
58 | sp_cleanup.use_this_for_non_static_field_access=true
59 | sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
60 | sp_cleanup.use_this_for_non_static_method_access=true
61 | sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
62 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/.settings/org.eclipse.xtend.shared.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | project.specific.metamodel=true
3 | metamodelContributor=org.eclipse.xtend.typesystem.emf.ui.EmfMetamodelContributor
4 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: YAKINDU Statechart Tools for Arduino C++ Code Generator
4 | Bundle-SymbolicName: org.yakindu.sct.arduino.generator.cpp;singleton:=true
5 | Bundle-Version: 0.10.0.qualifier
6 | Require-Bundle: org.yakindu.sct.model.sexec,
7 | org.yakindu.sct.model.stext,
8 | org.yakindu.sct.generator.core,
9 | org.yakindu.sct.generator.genmodel,
10 | org.yakindu.sct.generator.c,
11 | org.yakindu.sct.generator.cpp;bundle-version="[3.5.0,3.6.0)"
12 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8
13 | Bundle-Vendor: Lothar Wendehals
14 | Export-Package: org.yakindu.sct.arduino.generator.cpp,
15 | org.yakindu.sct.arduino.generator.cpp.extensions,
16 | org.yakindu.sct.arduino.generator.cpp.features,
17 | org.yakindu.sct.arduino.generator.cpp.timers
18 | Bundle-ActivationPolicy: lazy
19 | Bundle-Activator: org.yakindu.sct.arduino.generator.cpp.ArduinoGeneratorPlugin
20 | Automatic-Module-Name: org.yakindu.sct.arduino.generator.cpp
21 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src,\
2 | xtend-gen
3 | bin.includes = META-INF/,\
4 | .,\
5 | plugin.xml,\
6 | library/,\
7 | epl-v10.html,\
8 | schema/
9 | src.includes = epl-v10.html,\
10 | pom.xml,\
11 | library/,\
12 | schema/
13 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/library/ArduinoFeatureTypeLibrary.xmi:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
10 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 4.0.0
6 |
7 | org.yakindu.sct.arduino
8 | org.yakindu.sct.arduino.generator.cpp
9 | 0.10.0-SNAPSHOT
10 |
11 | eclipse-plugin
12 |
13 |
14 | org.yakindu.sct.arduino
15 | plugins
16 | 0.10.0-SNAPSHOT
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.xtend
23 | xtend-maven-plugin
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoCPPNaming.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import org.yakindu.sct.generator.cpp.CppNaming
12 |
13 | class ArduinoCPPNaming extends CppNaming {
14 |
15 | def String arduinoMain() {
16 | "ArduinoMain"
17 | }
18 |
19 | def String timeEvent() {
20 | "TimeEvent"
21 | }
22 |
23 | def String hardwareConnector() {
24 | "Hardware".connector
25 | }
26 |
27 | def String connector(String it) {
28 | it + "Connector"
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoCodeGenerator.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import com.google.inject.Injector
13 | import org.eclipse.xtext.generator.IFileSystemAccess
14 | import org.yakindu.sct.arduino.generator.cpp.features.IArduinoFeatureConstants
15 | import org.yakindu.sct.arduino.generator.cpp.timers.AbstractTimer
16 | import org.yakindu.sct.generator.c.IContentTemplate
17 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
18 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations.GenArtifactConfiguration
19 | import org.yakindu.sct.generator.core.IExecutionFlowGenerator
20 | import org.yakindu.sct.generator.core.filesystem.ISCTFileSystemAccess
21 | import org.yakindu.sct.generator.cpp.files.StatemachineHeader
22 | import org.yakindu.sct.generator.cpp.files.StatemachineImplementation
23 | import org.yakindu.sct.generator.cpp.files.StatemachineInterface
24 | import org.yakindu.sct.generator.cpp.files.TimedStatemachineInterface
25 | import org.yakindu.sct.generator.cpp.files.TimerInterface
26 | import org.yakindu.sct.generator.cpp.files.Types
27 | import org.yakindu.sct.model.sexec.ExecutionFlow
28 | import org.yakindu.sct.model.sexec.extensions.SExecExtensions
29 | import org.yakindu.sct.model.sgen.GeneratorEntry
30 |
31 | class ArduinoCodeGenerator implements IExecutionFlowGenerator {
32 |
33 | @Inject Injector injector;
34 | @Inject Types typesContent
35 | @Inject TimedStatemachineInterface timedStatemachineInterfaceContent
36 | @Inject TimerInterface timerInterfaceContent
37 | @Inject StatemachineInterface statemachineInterfaceContent
38 | @Inject StatemachineHeader statemachineHeaderContent
39 | @Inject StatemachineImplementation statemachineImplementationContent
40 |
41 | @Inject ArduinoMainHeader arduinoMainHeaderContent
42 | @Inject ArduinoMain arduinoMainContent
43 | @Inject TimeEventHeader timeEventHeaderContent
44 | @Inject HardwareConnectorHeader hardwareConnectorHeaderContent
45 | @Inject StatemachineConnectorHeader statemachineConnectorHeaderContent
46 | @Inject StatemachineConnector statemachineConnectorContent
47 |
48 | @Inject IGenArtifactConfigurations locations
49 |
50 | @Inject extension ArduinoCPPNaming
51 | @Inject extension ArduinoGenmodelEntries
52 | @Inject extension SExecExtensions
53 |
54 | override generate(ExecutionFlow it, GeneratorEntry entry, IFileSystemAccess fsa) {
55 | initGenerationArtifacts(locations, it, entry)
56 |
57 | for (GenArtifactConfiguration genArtifactConfig : locations.configurations) {
58 | fsa.generateFile(genArtifactConfig.getName, genArtifactConfig.getOutputName,
59 | genArtifactConfig.getContentTemplate.content(it, entry, locations))
60 | }
61 |
62 | injector.injectMembers(entry.timer.codeGenerator)
63 | generateTimer(entry, fsa, entry.timer.codeGenerator)
64 | }
65 |
66 | def private initGenerationArtifacts(IGenArtifactConfigurations it, ExecutionFlow flow, GeneratorEntry entry) {
67 | configure(flow.typesModule.h, typesContent)
68 | configure(statemachineInterface.h, statemachineInterfaceContent)
69 |
70 | if (flow.timed) {
71 | configure(timedStatemachineInterface.h, timedStatemachineInterfaceContent)
72 | configure(timerInterface.h, timerInterfaceContent)
73 | }
74 |
75 | configure(flow.module.h, statemachineHeaderContent)
76 | configure(flow.module.cpp, statemachineImplementationContent)
77 |
78 | // Arduino specific sources
79 | // output folder
80 | configure(arduinoMain.h, arduinoMainHeaderContent);
81 | configure(arduinoMain.cpp, arduinoMainContent);
82 | configure(hardwareConnector.h, hardwareConnectorHeaderContent);
83 |
84 | if (flow.timed) {
85 | configure(timeEvent.h, timeEventHeaderContent);
86 | }
87 |
88 | // userSrcFolder
89 | if (getUserSrcFolder(entry) !== null) {
90 | configure(flow.module.connector.h, IArduinoFeatureConstants::PARAM_USER_SRC_FOLDER,
91 | statemachineConnectorHeaderContent)
92 | configure(flow.module.connector.cpp, IArduinoFeatureConstants::PARAM_USER_SRC_FOLDER,
93 | statemachineConnectorContent)
94 | } else {
95 | configure(flow.module.connector.h, statemachineConnectorHeaderContent)
96 | configure(flow.module.connector.cpp, statemachineConnectorContent)
97 | }
98 | }
99 |
100 | def private configure(IGenArtifactConfigurations it, String artifactName, IContentTemplate contentTemplate) {
101 | configure(artifactName, ISCTFileSystemAccess.TARGET_FOLDER_OUTPUT, contentTemplate)
102 | }
103 |
104 | def private generateTimer(ExecutionFlow flow, GeneratorEntry entry, IFileSystemAccess fsa, AbstractTimer it) {
105 | fsa.generateFile(timerName.h, generateTimerHeader(entry, flow))
106 | fsa.generateFile(timerName.cpp, generateTimer(entry, flow))
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoCppCodeGenerator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp;
10 |
11 | import org.eclipse.core.runtime.IStatus;
12 | import org.eclipse.core.runtime.Status;
13 | import org.eclipse.xtext.generator.OutputConfiguration;
14 | import org.yakindu.sct.arduino.generator.cpp.features.IArduinoFeatureConstants;
15 | import org.yakindu.sct.generator.core.execution.SExecGeneratorEntryExecutor;
16 | import org.yakindu.sct.generator.core.filesystem.ISCTFileSystemAccess;
17 | import org.yakindu.sct.model.sgen.FeatureConfiguration;
18 | import org.yakindu.sct.model.sgen.GeneratorEntry;
19 |
20 | public class ArduinoCppCodeGenerator extends SExecGeneratorEntryExecutor {
21 |
22 | /**
23 | * @see org.yakindu.sct.generator.core.execution.AbstractGeneratorEntryExecutor#execute(org.yakindu.sct.model.sgen.GeneratorEntry)
24 | */
25 | @Override
26 | public IStatus execute(final GeneratorEntry entry) {
27 | execute(getFileSystemAccess(entry), entry);
28 | return Status.OK_STATUS;
29 | }
30 |
31 | private ISCTFileSystemAccess getFileSystemAccess(final GeneratorEntry entry) {
32 | final ISCTFileSystemAccess fileSystemAccess = this.factory.create(entry);
33 |
34 | final FeatureConfiguration featureConfiguration = entry
35 | .getFeatureConfiguration(IArduinoFeatureConstants.FEATURE_NAME);
36 | if (featureConfiguration != null) {
37 | final String userSrcFolder = featureConfiguration
38 | .getParameterValue(IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER).getStringValue();
39 | fileSystemAccess.setOutputPath(IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER, userSrcFolder);
40 |
41 | final OutputConfiguration outputConfiguration = fileSystemAccess.getOutputConfigurations()
42 | .get(IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER);
43 | outputConfiguration.setCreateOutputDirectory(true);
44 | outputConfiguration.setOverrideExistingResources(false);
45 | outputConfiguration.setSetDerivedProperty(false);
46 | }
47 |
48 | return fileSystemAccess;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoGeneratorPlugin.java:
--------------------------------------------------------------------------------
1 | package org.yakindu.sct.arduino.generator.cpp;
2 |
3 | import org.eclipse.core.runtime.IStatus;
4 | import org.eclipse.core.runtime.Plugin;
5 | import org.eclipse.core.runtime.Status;
6 | import org.osgi.framework.BundleContext;
7 |
8 | public class ArduinoGeneratorPlugin extends Plugin {
9 |
10 | /**
11 | * The shared instance
12 | */
13 | private static ArduinoGeneratorPlugin plugin;
14 |
15 | /**
16 | * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
17 | */
18 | @Override
19 | public void start(final BundleContext bundleContext) throws Exception {
20 | super.start(bundleContext);
21 | plugin = this;
22 | }
23 |
24 | /**
25 | * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
26 | */
27 | @Override
28 | public void stop(final BundleContext bundleContext) throws Exception {
29 | plugin = null;
30 | super.stop(bundleContext);
31 | }
32 |
33 | /**
34 | * Returns the shared instance
35 | *
36 | * @return the shared instance
37 | */
38 | public static ArduinoGeneratorPlugin getDefault() {
39 | return plugin;
40 | }
41 |
42 | /**
43 | * @return the plugin's id.
44 | */
45 | public static String getPluginId() {
46 | return plugin.getBundle().getSymbolicName();
47 | }
48 |
49 | /**
50 | * Logs an exception.
51 | *
52 | * @param exception
53 | * the exception that caused that error.
54 | * @return the {@link IStatus} that was logged.
55 | */
56 | public static IStatus logError(final Throwable exception) {
57 | final Status status = new Status(IStatus.ERROR, getPluginId(), exception.getLocalizedMessage(), exception);
58 | plugin.getLog().log(status);
59 |
60 | return status;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoGenmodelEntries.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.arduino.generator.cpp.extensions.ArchitecturesExtension
13 | import org.yakindu.sct.arduino.generator.cpp.extensions.TimerElement
14 | import org.yakindu.sct.arduino.generator.cpp.features.IArduinoFeatureConstants
15 | import org.yakindu.sct.model.sgen.GeneratorEntry
16 | import org.yakindu.sct.generator.core.library.ICoreLibraryHelper
17 |
18 | class ArduinoGenmodelEntries extends org.yakindu.sct.generator.c.extensions.GenmodelEntries {
19 |
20 | @Inject extension ICoreLibraryHelper coreLibraryHelper
21 |
22 | def private getGeneratorOptionsFeature(GeneratorEntry it) {
23 | getFeatureConfiguration(IArduinoFeatureConstants::FEATURE_NAME)
24 | }
25 |
26 | def String getUserSrcFolder(GeneratorEntry it) {
27 | generatorOptionsFeature?.getParameterValue(IArduinoFeatureConstants::PARAM_USER_SRC_FOLDER).stringValue
28 | }
29 |
30 | def String getSrcGenFolder(GeneratorEntry it) {
31 | coreLibraryHelper.getTargetFolderValue(it).stringValue
32 | }
33 |
34 | def TimerElement getTimer(GeneratorEntry it) {
35 | val timerId = generatorOptionsFeature?.getParameterValue(IArduinoFeatureConstants::PARAM_TIMER).stringValue
36 | ArchitecturesExtension.getTimer(timerId)
37 | }
38 |
39 | def int cyclePeriod(GeneratorEntry it) {
40 | val paramValue = generatorOptionsFeature?.getParameterValue(IArduinoFeatureConstants::PARAM_CYCLE_PERIOD)
41 | if (paramValue !== null) {
42 | try {
43 | return Integer.parseInt(paramValue.stringValue);
44 | } catch (NumberFormatException exception) {
45 | }
46 | }
47 |
48 | return IArduinoFeatureConstants::CYCLE_PERIOD_DEFAULT
49 | }
50 |
51 | def String srcGenFolderRelativeToUserSrc(GeneratorEntry it) {
52 | folderRelativeToOther(srcGenFolder, userSrcFolder)
53 | }
54 |
55 | def String userSrcFolderRelativeToSrcGen(GeneratorEntry it) {
56 | folderRelativeToOther(userSrcFolder, srcGenFolder)
57 | }
58 |
59 | def String folderRelativeToOther(String folder, String otherFolder) {
60 | if (otherFolder.equals(folder)) {
61 | ""
62 | } else if (otherFolder.empty) {
63 | folder + "/"
64 | } else if (folder.empty) {
65 | "../"
66 | } else {
67 | "../" + folder + "/"
68 | }
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoMain.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.generator.c.IContentTemplate
13 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
14 | import org.yakindu.sct.model.sexec.ExecutionFlow
15 | import org.yakindu.sct.model.sexec.extensions.SExecExtensions
16 | import org.yakindu.sct.model.sgen.GeneratorEntry
17 |
18 | class ArduinoMain implements IContentTemplate {
19 |
20 | @Inject extension ArduinoCPPNaming
21 | @Inject extension ArduinoGenmodelEntries
22 | @Inject extension SExecExtensions
23 |
24 | override content(ExecutionFlow it, GeneratorEntry entry, IGenArtifactConfigurations locations) '''
25 | «entry.licenseText»
26 |
27 | #include "«arduinoMain.h»"
28 | #include "«entry.timerClassName.h»"
29 | #include "«entry.userSrcFolderRelativeToSrcGen»«module.connector.h»"
30 |
31 | «module»* statemachine;
32 | «module.connector»* connector;
33 | «entry.timerClassName»* timer;
34 |
35 | «module»* getStatemachine() {
36 | return statemachine;
37 | }
38 |
39 | void setup() {
40 | statemachine = new «module»();
41 | connector = new «module.connector»(statemachine);
42 | timer = new «entry.timerClassName»(statemachine, connector);
43 |
44 | «IF timed»statemachine->setTimer(timer);«ENDIF»
45 | timer->start();
46 | }
47 |
48 | void loop() {
49 | timer->runCycle();
50 | }
51 | '''
52 |
53 | def String timerClassName(GeneratorEntry it) {
54 | timer.codeGenerator.timerName
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/ArduinoMainHeader.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.generator.c.IContentTemplate
13 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
14 | import org.yakindu.sct.model.sexec.ExecutionFlow
15 | import org.yakindu.sct.model.sgen.GeneratorEntry
16 |
17 | class ArduinoMainHeader implements IContentTemplate {
18 |
19 | @Inject extension ArduinoCPPNaming
20 | @Inject extension ArduinoGenmodelEntries
21 |
22 | override content(ExecutionFlow it, GeneratorEntry entry, IGenArtifactConfigurations locations) '''
23 | «entry.licenseText»
24 |
25 | #ifndef «arduinoMain.h.define»
26 | #define «arduinoMain.h.define»
27 |
28 | #include
29 | #include "«module.h»"
30 |
31 | «module»* getStatemachine();
32 |
33 | #endif /* «arduinoMain.h.define» */
34 | '''
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/HardwareConnectorHeader.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.generator.c.IContentTemplate
13 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
14 | import org.yakindu.sct.model.sexec.ExecutionFlow
15 | import org.yakindu.sct.model.sgen.GeneratorEntry
16 |
17 | class HardwareConnectorHeader implements IContentTemplate {
18 |
19 | @Inject extension ArduinoCPPNaming
20 | @Inject extension ArduinoGenmodelEntries
21 |
22 | override content(ExecutionFlow flow, GeneratorEntry it, IGenArtifactConfigurations locations) '''
23 | «licenseText»
24 |
25 | #ifndef «hardwareConnector.h.define»
26 | #define «hardwareConnector.h.define»
27 |
28 |
29 | class «hardwareConnector» {
30 | public:
31 | inline virtual ~«hardwareConnector»();
32 |
33 | /*
34 | * Initialize the hardware.
35 | */
36 | virtual void init() = 0;
37 |
38 | /*
39 | * Raise state machine events before processing them in the state machine's runCycle().
40 | */
41 | virtual void raiseEvents() = 0;
42 |
43 | /*
44 | * Update the hardware depending on the state machine's state.
45 | */
46 | virtual void syncState() = 0;
47 |
48 | /*
49 | * Optimize power consumption by turning off hardware modules that are not needed.
50 | * Return one of the following sleep states:
51 | * SLEEP_MODE_IDLE, SLEEP_MODE_ADC, SLEEP_MODE_PWR_DOWN, SLEEP_MODE_PWR_SAVE,
52 | * SLEEP_MODE_STANDBY, SLEEP_MODE_EXT_STANDBY
53 | * The returned sleep mode is just a recommendation, the actual timer implementation
54 | * may not support the given sleep mode.
55 | */
56 | virtual uint8_t prepareSleepMode() = 0;
57 | };
58 |
59 | «hardwareConnector»::~«hardwareConnector»() {
60 | }
61 |
62 | #endif /* «hardwareConnector.h.define» */
63 | '''
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/MaxParallelTimers.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import org.yakindu.sct.model.sgraph.Reaction
12 | import org.yakindu.sct.model.sgraph.Region
13 | import org.yakindu.sct.model.sgraph.State
14 | import org.yakindu.sct.model.sgraph.Statechart
15 | import org.yakindu.sct.model.sgraph.Transition
16 | import org.yakindu.sct.model.sgraph.Trigger
17 | import org.yakindu.sct.model.sgraph.Vertex
18 | import org.yakindu.sct.model.stext.stext.EventSpec
19 | import org.yakindu.sct.model.stext.stext.LocalReaction
20 | import org.yakindu.sct.model.stext.stext.ReactionTrigger
21 | import org.yakindu.sct.model.stext.stext.TimeEventSpec
22 |
23 | class MaxParallelTimers {
24 |
25 | def dispatch int maxParallelTimers(Statechart it) {
26 | var int maximum = 0
27 |
28 | for (region : regions) {
29 | maximum += maxParallelTimers(region)
30 | }
31 |
32 | maximum
33 | }
34 |
35 | def dispatch int maxParallelTimers(Region it) {
36 | var int maximum = 0
37 |
38 | for (vertex : vertices) {
39 | maximum = Math.max(maximum, maxParallelTimers(vertex))
40 | }
41 |
42 | maximum
43 | }
44 |
45 | def dispatch int maxParallelTimers(State it) {
46 | var int maximum = 0;
47 |
48 | for (region : regions) {
49 | maximum += maxParallelTimers(region)
50 | }
51 |
52 | for (reaction : localReactions) {
53 | maximum += maxParallelTimers(reaction)
54 | }
55 |
56 | for (transition : outgoingTransitions) {
57 | maximum += maxParallelTimers(transition)
58 | }
59 |
60 | maximum
61 | }
62 |
63 | def dispatch int maxParallelTimers(Vertex vertex) {
64 | 0
65 | }
66 |
67 | def dispatch int maxParallelTimers(Transition it) {
68 | if (trigger !== null) {
69 | maxParallelTimers(trigger)
70 | } else {
71 | 0
72 | }
73 | }
74 |
75 | def dispatch int maxParallelTimers(Reaction reaction) {
76 | 0
77 | }
78 |
79 | def dispatch int maxParallelTimers(LocalReaction it) {
80 | maxParallelTimers(trigger)
81 | }
82 |
83 | def dispatch int maxParallelTimers(Trigger it) {
84 | 0
85 | }
86 |
87 | def dispatch int maxParallelTimers(ReactionTrigger it) {
88 | var maximum = 0;
89 |
90 | for (eventSpec : triggers) {
91 | maximum += maxParallelTimers(eventSpec)
92 | }
93 |
94 | maximum
95 | }
96 |
97 | def dispatch int maxParallelTimers(EventSpec it) {
98 | 0
99 | }
100 |
101 | def dispatch int maxParallelTimers(TimeEventSpec it) {
102 | 1
103 | }
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/StatemachineConnector.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * O * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.generator.c.IContentTemplate
13 | import org.yakindu.sct.model.sexec.ExecutionFlow
14 | import org.yakindu.sct.model.sgen.GeneratorEntry
15 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
16 |
17 | class StatemachineConnector implements IContentTemplate {
18 |
19 | @Inject extension ArduinoCPPNaming
20 | @Inject extension ArduinoGenmodelEntries
21 |
22 | override content(ExecutionFlow it, GeneratorEntry entry, IGenArtifactConfigurations locations) '''
23 | «entry.licenseText»
24 |
25 | #include "«module.connector.h»"
26 | «IF entry.timer.architecture.kind.equals("atmega")»
27 | // #include
28 | «ENDIF»
29 |
30 | «module.connector»::«module.connector»(«module»* statemachine) {
31 | this->statemachine = statemachine;
32 | }
33 |
34 | /*
35 | * Initialize the hardware.
36 | */
37 | void «module.connector»::init() {
38 | // pinMode(LED_BUILTIN, OUTPUT);
39 |
40 | // The state machine has already been initialized and started before
41 | // this method is called. Until syncState() is called the first time
42 | // by the state machine, the hardware is not in sync with the state
43 | // machine. If the cycle period is very high (let's say >> 1s), it
44 | // might be better to call syncState() once manually, to get in sync
45 | // with the initial state of the state machine.
46 | // syncState();
47 | }
48 |
49 | /*
50 | * Raise state machine events before processing them in the state machine's runCycle().
51 | */
52 | void «module.connector»::raiseEvents() {
53 | // e.g.
54 | // if (buttonPressed) {
55 | // statemachine->raiseXYZEvent();
56 | // }
57 | }
58 |
59 | /*
60 | * Update the hardware depending on the state machine's state.
61 | */
62 | void «module.connector»::syncState() {
63 | // digitalWrite(LED_BUILTIN, statemachine->get_XYZ());
64 | }
65 |
66 | /*
67 | * Optimize power consumption by turning off hardware modules that are not needed.
68 | */
69 | uint8_t «module.connector»::prepareSleepMode() {
70 | «IF entry.timer.architecture.kind.equals("atmega")»
71 | // Some of the functions of may not be supported by the
72 | // actual microprocessor you are using.
73 | // This method is only called in case you are using an AVR hardware timer.
74 | // e.g.
75 | // power_adc_disable();
76 | // power_spi_disable();
77 | // power_timer0_disable();
78 | // power_timer1_disable() ;
79 | // power_timer2_disable() ;
80 | // power_timer3_disable() ;
81 | // power_twi_disable();
82 | // power_usart0_disable();
83 | // power_usb_disable();
84 |
85 | return SLEEP_MODE_IDLE;
86 | «ELSE»
87 | return 0;
88 | «ENDIF»
89 | }
90 | '''
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/StatemachineConnectorHeader.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.generator.c.IContentTemplate
13 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
14 | import org.yakindu.sct.model.sexec.ExecutionFlow
15 | import org.yakindu.sct.model.sgen.GeneratorEntry
16 |
17 | class StatemachineConnectorHeader implements IContentTemplate {
18 |
19 | @Inject extension ArduinoCPPNaming
20 | @Inject extension ArduinoGenmodelEntries
21 |
22 | override content(ExecutionFlow it, GeneratorEntry entry, IGenArtifactConfigurations locations) '''
23 | «entry.licenseText»
24 |
25 | #ifndef «module.connector.h.define»
26 | #define «module.connector.h.define»
27 |
28 | #include
29 | #include "«entry.srcGenFolderRelativeToUserSrc»«hardwareConnector.h»"
30 | #include "«entry.srcGenFolderRelativeToUserSrc»«module.h»"
31 |
32 | class «module.connector»: public «hardwareConnector» {
33 | public:
34 | «module.connector»(«module»* statemachine);
35 |
36 | inline ~«module.connector»();
37 |
38 | /*
39 | * Initialize the hardware.
40 | */
41 | void init();
42 |
43 | /*
44 | * Raise state machine events before processing them in the state machine's runCycle().
45 | */
46 | void raiseEvents();
47 |
48 | /*
49 | * Update the hardware depending on the state machine's state.
50 | */
51 | void syncState();
52 |
53 | /*
54 | * Optimize power consumption by turning off modules that are not needed.
55 | * Return one of the following sleep states:
56 | * SLEEP_MODE_IDLE, SLEEP_MODE_ADC, SLEEP_MODE_PWR_DOWN, SLEEP_MODE_PWR_SAVE,
57 | * SLEEP_MODE_STANDBY, SLEEP_MODE_EXT_STANDBY
58 | * The returned sleep mode is just a recommendation, the actual timer implementation
59 | * may not support the given sleep mode.
60 | */
61 | uint8_t prepareSleepMode();
62 |
63 | private:
64 | «module»* statemachine;
65 | };
66 |
67 | «module.connector»::~«module.connector»() {
68 | }
69 |
70 | #endif /* «module.connector.h.define» */
71 | '''
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/TimeEventHeader.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.generator.c.IContentTemplate
13 | import org.yakindu.sct.generator.c.IGenArtifactConfigurations
14 | import org.yakindu.sct.model.sexec.ExecutionFlow
15 | import org.yakindu.sct.model.sgen.GeneratorEntry
16 |
17 | class TimeEventHeader implements IContentTemplate {
18 |
19 | @Inject extension ArduinoCPPNaming
20 | @Inject extension ArduinoGenmodelEntries
21 |
22 | override content(ExecutionFlow it, GeneratorEntry entry, IGenArtifactConfigurations locations) '''
23 | «entry.licenseText»
24 |
25 | #ifndef «timeEvent.h.define»
26 | #define «timeEvent.h.define»
27 |
28 | #include "«timedStatemachineInterface.h»"
29 |
30 | class «timeEvent» {
31 |
32 | public:
33 | «timedStatemachineInterface» *timedStatemachine;
34 | sc_eventid eventId;
35 | sc_boolean periodic;
36 | unsigned int overflows;
37 | unsigned int overflowCounter;
38 | bool eventRaised;
39 | };
40 |
41 | #endif /* «timeEvent.h.define» */
42 | '''
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/extensions/AbstractNamedElement.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.extensions;
10 |
11 | public abstract class AbstractNamedElement {
12 |
13 | private final String id;
14 |
15 | private final String name;
16 |
17 | public AbstractNamedElement(String id, String name) {
18 | this.id = id;
19 | this.name = name;
20 | }
21 |
22 | public String getId() {
23 | return this.id;
24 | }
25 |
26 | public String getName() {
27 | return this.name;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/extensions/ArchitectureElement.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.extensions;
10 |
11 | import java.util.Collection;
12 | import java.util.Collections;
13 | import java.util.HashSet;
14 |
15 | public class ArchitectureElement extends AbstractNamedElement {
16 |
17 | private final String kind;
18 |
19 | final Collection timers = new HashSet<>();
20 |
21 | public ArchitectureElement(String id, String name, String kind) {
22 | super(id, name);
23 | this.kind = kind;
24 | }
25 |
26 | public String getKind() {
27 | return this.kind;
28 | }
29 |
30 | protected void addTimer(TimerElement timer) {
31 | this.timers.add(timer);
32 | }
33 |
34 | public Collection getTimers() {
35 | return Collections.unmodifiableCollection(this.timers);
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/extensions/ArchitecturesExtension.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.extensions;
10 |
11 | import java.util.ArrayList;
12 | import java.util.Collection;
13 | import java.util.Collections;
14 | import java.util.HashSet;
15 | import java.util.InputMismatchException;
16 | import java.util.List;
17 | import java.util.Scanner;
18 |
19 | import org.eclipse.core.runtime.CoreException;
20 | import org.eclipse.core.runtime.IConfigurationElement;
21 | import org.eclipse.core.runtime.IExtension;
22 | import org.eclipse.core.runtime.IExtensionPoint;
23 | import org.eclipse.core.runtime.Platform;
24 | import org.yakindu.sct.arduino.generator.cpp.ArduinoGeneratorPlugin;
25 | import org.yakindu.sct.arduino.generator.cpp.timers.AbstractTimer;
26 |
27 | public class ArchitecturesExtension {
28 |
29 | private static final String ARCHITECTURES_EXTENSION = "architectures"; //$NON-NLS-1$
30 |
31 | private static final String ARCHITECTURE_ELEMENT = "architecture"; //$NON-NLS-1$
32 |
33 | private static final String TIMER_ELEMENT = "timer"; //$NON-NLS-1$
34 |
35 | private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
36 |
37 | private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
38 |
39 | private static final String KIND_ATTRIBUTE = "kind"; //$NON-NLS-1$
40 |
41 | private static final String MIN_CYCLE_PERIOD_ATTRIBUTE = "minCyclePeriod"; //$NON-NLS-1$
42 |
43 | private static final String MAX_CYCLE_PERIOD_ATTRIBUTE = "maxCyclePeriod"; //$NON-NLS-1$
44 |
45 | private static final String PRE_DEFINED_CYCLE_PERIODS_ATTRIBUTE = "preDefinedCyclePeriods"; //$NON-NLS-1$
46 |
47 | private static final String CPP_CODE_GENERATOR_ATTRIBUTE = "cppCodeGenerator"; //$NON-NLS-1$
48 |
49 | private static final String DESCRIPTION_ATTRIBUTE = "description"; //$NON-NLS-1$
50 |
51 | private static List architectures;
52 |
53 | /**
54 | * @return a collection of {@link ArchitectureElement}s
55 | */
56 | public static Collection getArchitectures() {
57 | if (architectures == null) {
58 | architectures = new ArrayList<>();
59 |
60 | final IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
61 | .getExtensionPoint(ArduinoGeneratorPlugin.getPluginId(), ARCHITECTURES_EXTENSION);
62 | if (extensionPoint != null) {
63 | for (final IExtension extension : extensionPoint.getExtensions()) {
64 | for (final IConfigurationElement element : extension.getConfigurationElements()) {
65 | if (ARCHITECTURE_ELEMENT.equals(element.getName())) {
66 | final String id = element.getAttribute(ID_ATTRIBUTE);
67 | final String name = element.getAttribute(NAME_ATTRIBUTE);
68 | final String kind = element.getAttribute(KIND_ATTRIBUTE);
69 | final ArchitectureElement architecture = new ArchitectureElement(id, name, kind);
70 |
71 | for (final IConfigurationElement timerElement : element.getChildren(TIMER_ELEMENT)) {
72 | try {
73 | final String timerId = timerElement.getAttribute(ID_ATTRIBUTE);
74 | final String timerName = timerElement.getAttribute(NAME_ATTRIBUTE);
75 | final String timerDescription = timerElement.getAttribute(DESCRIPTION_ATTRIBUTE);
76 | final long minCyclePeriod = Long
77 | .parseLong(timerElement.getAttribute(MIN_CYCLE_PERIOD_ATTRIBUTE));
78 |
79 | long maxCyclePeriod = Long.MAX_VALUE;
80 | final String maxCyclePeriodString = timerElement
81 | .getAttribute(MAX_CYCLE_PERIOD_ATTRIBUTE);
82 | if (maxCyclePeriodString != null) {
83 | maxCyclePeriod = Long.parseLong(maxCyclePeriodString);
84 | }
85 |
86 | final String preDefinedCyclePeriodsString = timerElement
87 | .getAttribute(PRE_DEFINED_CYCLE_PERIODS_ATTRIBUTE);
88 | final HashSet preDefinedCyclePeriods = new HashSet<>();
89 | if (preDefinedCyclePeriodsString != null) {
90 | try (final Scanner scanner = new Scanner(preDefinedCyclePeriodsString)
91 | .useDelimiter("\\s*,\\s*")) {
92 | while (scanner.hasNextInt()) {
93 | preDefinedCyclePeriods.add(scanner.nextInt());
94 | }
95 | } catch (final InputMismatchException exception) {
96 | ArduinoGeneratorPlugin.logError(exception);
97 | }
98 | }
99 |
100 | final AbstractTimer codeGenerator = (AbstractTimer) timerElement
101 | .createExecutableExtension(CPP_CODE_GENERATOR_ATTRIBUTE);
102 |
103 | architecture.addTimer(new TimerElement(architecture, timerId, timerName,
104 | timerDescription, minCyclePeriod, maxCyclePeriod, codeGenerator,
105 | preDefinedCyclePeriods));
106 | } catch (final CoreException | NumberFormatException exception) {
107 | ArduinoGeneratorPlugin.logError(exception);
108 | }
109 | }
110 |
111 | architectures.add(architecture);
112 | }
113 | }
114 | }
115 | }
116 | }
117 |
118 | return Collections.unmodifiableCollection(architectures);
119 | }
120 |
121 | public static TimerElement getTimer(final String id) {
122 | for (final ArchitectureElement architecture : getArchitectures()) {
123 | for (final TimerElement timer : architecture.timers) {
124 | if (timer.getId().equals(id)) {
125 | return timer;
126 | }
127 | }
128 | }
129 |
130 | return null;
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/extensions/TimerElement.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.extensions;
10 |
11 | import java.util.Collection;
12 | import java.util.Collections;
13 | import java.util.TreeSet;
14 |
15 | import org.yakindu.sct.arduino.generator.cpp.timers.AbstractTimer;
16 |
17 | public class TimerElement extends AbstractNamedElement {
18 |
19 | private final ArchitectureElement architecture;
20 |
21 | private final String description;
22 |
23 | private final long minCyclePeriod;
24 |
25 | private final long maxCyclePeriod;
26 |
27 | private final Collection preDefinedCyclePeriods = new TreeSet<>();
28 |
29 | private final AbstractTimer codeGenerator;
30 |
31 | public TimerElement(ArchitectureElement architecture, String id, String name, String description,
32 | long minCyclePeriod, long maxCyclePeriod, AbstractTimer codeGenerator,
33 | Collection preDefinedCyclePeriods) {
34 | super(id, name);
35 | this.architecture = architecture;
36 | this.description = description;
37 | this.minCyclePeriod = minCyclePeriod;
38 | this.maxCyclePeriod = maxCyclePeriod;
39 | this.codeGenerator = codeGenerator;
40 | this.preDefinedCyclePeriods.addAll(preDefinedCyclePeriods);
41 | }
42 |
43 | public ArchitectureElement getArchitecture() {
44 | return this.architecture;
45 | }
46 |
47 | public String getDescription() {
48 | return this.description;
49 | }
50 |
51 | public long getMinCyclePeriod() {
52 | return this.minCyclePeriod;
53 | }
54 |
55 | public long getMaxCyclePeriod() {
56 | return this.maxCyclePeriod;
57 | }
58 |
59 | public AbstractTimer getCodeGenerator() {
60 | return this.codeGenerator;
61 | }
62 |
63 | public boolean isValidCyclePeriod(long cyclePeriod) {
64 | return (cyclePeriod >= this.minCyclePeriod) && (cyclePeriod <= this.maxCyclePeriod);
65 | }
66 |
67 | public Collection getPreDefinedCyclePeriods() {
68 | return Collections.unmodifiableCollection(this.preDefinedCyclePeriods);
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/features/ArduinoDefaultFeatureValueProvider.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.features;
10 |
11 | import org.eclipse.core.runtime.IStatus;
12 | import org.eclipse.core.runtime.Status;
13 | import org.eclipse.emf.ecore.EObject;
14 | import org.yakindu.sct.arduino.generator.cpp.extensions.ArchitecturesExtension;
15 | import org.yakindu.sct.arduino.generator.cpp.extensions.TimerElement;
16 | import org.yakindu.sct.generator.core.library.AbstractDefaultFeatureValueProvider;
17 | import org.yakindu.sct.model.sgen.FeatureParameterValue;
18 | import org.yakindu.sct.model.sgen.FeatureType;
19 | import org.yakindu.sct.model.sgen.FeatureTypeLibrary;
20 |
21 | public class ArduinoDefaultFeatureValueProvider extends AbstractDefaultFeatureValueProvider {
22 |
23 | /**
24 | * @see org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider#isProviderFor(org.yakindu.sct.model.sgen.FeatureTypeLibrary)
25 | */
26 | @Override
27 | public boolean isProviderFor(FeatureTypeLibrary library) {
28 | return IArduinoFeatureConstants.LIBRARY_NAME.equals(library.getName());
29 | }
30 |
31 | /**
32 | * @see org.yakindu.sct.generator.core.features.AbstractDefaultFeatureValueProvider#setDefaultValue(org.yakindu.sct.model.sgen.FeatureType,
33 | * org.yakindu.sct.model.sgen.FeatureParameterValue, org.eclipse.emf.ecore.EObject)
34 | */
35 | @Override
36 | protected void setDefaultValue(FeatureType featureType, FeatureParameterValue parameterValue,
37 | EObject contextElement) {
38 | final String parameterName = parameterValue.getParameter().getName();
39 | if (IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER.equals(parameterName)) {
40 | parameterValue.setValue(IArduinoFeatureConstants.USER_SRC_FOLDER_DEFAULT);
41 | } else if (IArduinoFeatureConstants.PARAM_TIMER.equals(parameterName)) {
42 | parameterValue.setValue("org.yakindu.sct.arduino.generator.cpp.architecture.software.counter");
43 | } else if (IArduinoFeatureConstants.PARAM_CYCLE_PERIOD.equals(parameterName)) {
44 | parameterValue.setValue(Integer.toString(IArduinoFeatureConstants.CYCLE_PERIOD_DEFAULT));
45 | }
46 | }
47 |
48 | /**
49 | * @see org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider#validateParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue)
50 | */
51 | @Override
52 | public IStatus validateParameterValue(FeatureParameterValue parameterValue) {
53 | final String parameterName = parameterValue.getParameter().getName();
54 |
55 | if (IArduinoFeatureConstants.PARAM_TIMER.equals(parameterName)) {
56 | if (ArchitecturesExtension.getTimer(parameterValue.getStringValue()) == null) {
57 | return error(String.format(Messages.ArduinoDefaultFeatureValueProvider_timerInvalid,
58 | parameterValue.getExpression()));
59 | }
60 | } else if (IArduinoFeatureConstants.PARAM_CYCLE_PERIOD.equals(parameterName)) {
61 | final FeatureParameterValue timerParamValue = parameterValue.getFeatureConfiguration()
62 | .getParameterValue(IArduinoFeatureConstants.PARAM_TIMER);
63 | final TimerElement timer = ArchitecturesExtension.getTimer(timerParamValue.getStringValue());
64 |
65 | try {
66 | final int cyclePeriod = Integer.parseInt(parameterValue.getStringValue());
67 | if ((timer != null) && !timer.isValidCyclePeriod(cyclePeriod)) {
68 | return error(String.format(Messages.ArduinoDefaultFeatureValueProvider_cyclePeriodNotInInterval,
69 | timer.getName(), timer.getMinCyclePeriod(), timer.getMaxCyclePeriod()));
70 | }
71 | } catch (final NumberFormatException exception) {
72 | return error(Messages.ArduinoDefaultFeatureValueProvider_cyclePeriodInvalid);
73 | }
74 | }
75 |
76 | return Status.OK_STATUS;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/features/CoreDefaultFeatureValueProvider.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.features;
10 |
11 | import org.eclipse.emf.ecore.EObject;
12 | import org.yakindu.sct.generator.core.library.ICoreLibraryConstants;
13 | import org.yakindu.sct.generator.core.library.impl.CoreLibraryDefaultFeatureValueProvider;
14 | import org.yakindu.sct.model.sgen.FeatureParameterValue;
15 | import org.yakindu.sct.model.sgen.FeatureType;
16 |
17 | public class CoreDefaultFeatureValueProvider extends CoreLibraryDefaultFeatureValueProvider {
18 |
19 | /**
20 | * @see org.yakindu.sct.generator.core.features.impl.CoreLibraryDefaultFeatureValueProvider#setDefaultValue(org.yakindu.sct.model.sgen.FeatureType,
21 | * org.yakindu.sct.model.sgen.FeatureParameterValue, org.eclipse.emf.ecore.EObject)
22 | */
23 | @Override
24 | protected void setDefaultValue(FeatureType featureType, FeatureParameterValue parameterValue,
25 | EObject contextElement) {
26 | super.setDefaultValue(featureType, parameterValue, contextElement);
27 |
28 | final String parameterName = parameterValue.getParameter().getName();
29 | if (ICoreLibraryConstants.OUTLET_FEATURE_TARGET_FOLDER.equals(parameterName)) {
30 | parameterValue.setValue("src-gen");
31 | } else if (ICoreLibraryConstants.OUTLET_FEATURE_LIBRARY_TARGET_FOLDER.equals(parameterName)) {
32 | parameterValue.setValue("");
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/features/IArduinoFeatureConstants.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.features;
10 |
11 | public interface IArduinoFeatureConstants {
12 | String LIBRARY_NAME = "Arduino C++ Generator"; //$NON-NLS-1$
13 | String FEATURE_NAME = "Arduino"; //$NON-NLS-1$
14 | String PARAM_USER_SRC_FOLDER = "userSrcFolder"; //$NON-NLS-1$
15 | String PARAM_TIMER = "timer"; //$NON-NLS-1$
16 | String PARAM_CYCLE_PERIOD = "cyclePeriod"; //$NON-NLS-1$
17 |
18 | String USER_SRC_FOLDER_DEFAULT = "src"; //$NON-NLS-1$
19 | int CYCLE_PERIOD_DEFAULT = 10000;
20 | }
21 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/features/Messages.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.features;
10 |
11 | import org.eclipse.osgi.util.NLS;
12 |
13 | public class Messages extends NLS {
14 |
15 | private static final String BUNDLE_NAME = "org.yakindu.sct.arduino.generator.cpp.features.messages"; //$NON-NLS-1$
16 |
17 | public static String ArduinoDefaultFeatureValueProvider_cyclePeriodInvalid;
18 |
19 | public static String ArduinoDefaultFeatureValueProvider_cyclePeriodNotInInterval;
20 | public static String ArduinoDefaultFeatureValueProvider_timerInvalid;
21 | public static String Timer_ATmega168328_description;
22 | public static String Timer_ATmega168328_title;
23 | public static String Timer_software_description;
24 | public static String Timer_software_title;
25 |
26 | static {
27 | // initialize resource bundle
28 | NLS.initializeMessages(BUNDLE_NAME, Messages.class);
29 | }
30 |
31 | private Messages() {
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/features/messages.properties:
--------------------------------------------------------------------------------
1 | ArduinoDefaultFeatureValueProvider_cyclePeriodInvalid=The cyclePeriod must be a natural number greater than 1.
2 | ArduinoDefaultFeatureValueProvider_cyclePeriodNotInInterval=The cyclePeriod for timer '%s' must be between %d and %d
3 | ArduinoDefaultFeatureValueProvider_timerInvalid=The timer %s does not exist.
4 | Timer_ATmega168328_description=Hardware timer of the ATmega 168/328 microcontroller, uses timer 1 of the microcontroller and puts it into sleep between cycles. Can handle cycle periods between 1 and 4194 milliseconds. Compatible to Arduino Uno, Arduino Nano, Arduino Pro, Arduino Pro Mini, and all other ATmega 168/328 based boards.
5 | Timer_ATmega168328_title=ATmega 168/328
6 | Timer_software_description=Software timer that uses millies() to run the cycle. Can handle cycle periods starting from 1 millisecond. Compatible to all Arduino boards.
7 | Timer_software_title=Software
8 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/SoftwareTimer_Millis.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 | import org.yakindu.sct.model.sexec.ExecutionFlow
13 |
14 | class SoftwareTimer_Millis extends AbstractTimer {
15 |
16 | override timerName() {
17 | "SoftwareTimer_Millis"
18 | }
19 |
20 | override protected privateHeaderPart(GeneratorEntry it, ExecutionFlow flow) '''
21 | «super.privateHeaderPart(it, flow)»
22 |
23 | unsigned long lastCycle;
24 | '''
25 |
26 | override protected constructorBody(GeneratorEntry it, ExecutionFlow flow) '''
27 | «super.constructorBody(it, flow)»
28 |
29 | lastCycle = 0;
30 | '''
31 |
32 | override protected initBody(GeneratorEntry it) '''
33 | lastCycle = millis();
34 | '''
35 |
36 | override protected runCycleBody(GeneratorEntry it, ExecutionFlow flow) '''
37 | unsigned long current = millis();
38 | if (current >= lastCycle + CYCLE_PERIOD){
39 | «super.runCycleBody(it, flow)»
40 | lastCycle = current;
41 | }
42 | '''
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_Timer0.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATmega_Timer0 extends AbstractAVR8BitTimer {
14 |
15 | override timerName() {
16 | "ATmega_Timer0"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER0_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR0A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR0A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer0
44 | noInterrupts();
45 | TCCR0A = 0; // set entire TCCR0A register to 0
46 | TCCR0B = 0; // same for TCCR0B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR0A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR0A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR0A |= (1 << WGM01);
61 |
62 | // Set CS02 and CS00 bits for 1024 prescaler
63 | TCCR0B |= (1 << CS02);
64 | TCCR0B |= (1 << CS00);
65 |
66 | // enable timer compare interrupt
67 | TIMSK0 |= (1 << OCIE0A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR0B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_Timer1.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATmega_Timer1 extends AbstractAVR16BitTimer {
14 |
15 | override timerName() {
16 | "ATmega_Timer1"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER1_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR1A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR1A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer1
44 | noInterrupts();
45 | TCCR1A = 0; // set entire TCCR1A register to 0
46 | TCCR1B = 0; // same for TCCR1B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR1A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR1A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR1B |= (1 << WGM12);
61 |
62 | // Set CS12 and CS10 bits for 1024 prescaler
63 | TCCR1B |= (1 << CS12);
64 | TCCR1B |= (1 << CS10);
65 |
66 | // enable timer compare interrupt
67 | TIMSK1 |= (1 << OCIE1A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR1B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_Timer2.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATmega_Timer2 extends AbstractAVR8BitTimer {
14 |
15 | override timerName() {
16 | "ATmega_Timer2"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER2_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR2A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR2A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer2
44 | noInterrupts();
45 | TCCR2A = 0; // set entire TCCR2A register to 0
46 | TCCR2B = 0; // same for TCCR2B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR2A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR2A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR2B |= (1 << WGM22);
61 |
62 | // Set CS22, CS21, and CS20 bits for 1024 prescaler
63 | TCCR2B |= (1 << CS22);
64 | TCCR2B |= (1 << CS21);
65 | TCCR2B |= (1 << CS20);
66 |
67 | // enable timer compare interrupt
68 | TIMSK2 |= (1 << OCIE2A);
69 |
70 | // enable global interrupts
71 | interrupts();
72 | '''
73 |
74 | override protected sleepBody(GeneratorEntry it) '''
75 | uint8_t sleepMode = hardware->prepareSleepMode();
76 |
77 | switch (sleepMode) {
78 | case SLEEP_MODE_IDLE:
79 | case SLEEP_MODE_ADC:
80 | set_sleep_mode(SLEEP_MODE_IDLE);
81 | break;
82 | case SLEEP_MODE_PWR_SAVE:
83 | case SLEEP_MODE_PWR_DOWN:
84 | case SLEEP_MODE_STANDBY:
85 | case SLEEP_MODE_EXT_STANDBY:
86 | set_sleep_mode(SLEEP_MODE_PWR_SAVE);
87 | break;
88 | }
89 |
90 | noInterrupts();
91 | sleep_enable();
92 | interrupts();
93 |
94 | if (sleepMode == SLEEP_MODE_PWR_DOWN || sleepMode == SLEEP_MODE_PWR_SAVE
95 | || sleepMode == SLEEP_MODE_STANDBY
96 | || sleepMode == SLEEP_MODE_EXT_STANDBY) {
97 | sleep_bod_disable();
98 | }
99 |
100 | sleep_cpu();
101 | sleep_disable();
102 | '''
103 |
104 | override protected cancelBody(GeneratorEntry it) '''
105 | TCCR2B = 0; // turn off the timer
106 | '''
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_Timer3.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATmega_Timer3 extends AbstractAVR16BitTimer {
14 |
15 | override timerName() {
16 | "ATmega_Timer3"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER3_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR3A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR3A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer3
44 | noInterrupts();
45 | TCCR3A = 0; // set entire TCCR3A register to 0
46 | TCCR3B = 0; // same for TCCR3B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR3A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR3A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR3B |= (1 << WGM32);
61 |
62 | // Set CS32 and CS30 bits for 1024 prescaler
63 | TCCR3B |= (1 << CS32);
64 | TCCR3B |= (1 << CS30);
65 |
66 | // enable timer compare interrupt
67 | TIMSK3 |= (1 << OCIE3A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR3B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_Timer4.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATmega_Timer4 extends AbstractAVR16BitTimer {
14 |
15 | override timerName() {
16 | "ATmega_Timer4"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER4_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR4A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR4A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer4
44 | noInterrupts();
45 | TCCR4A = 0; // set entire TCCR4A register to 0
46 | TCCR4B = 0; // same for TCCR4B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR4A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR4A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR4B |= (1 << WGM42);
61 |
62 | // Set CS42 and CS40 bits for 1024 prescaler
63 | TCCR4B |= (1 << CS42);
64 | TCCR4B |= (1 << CS40);
65 |
66 | // enable timer compare interrupt
67 | TIMSK4 |= (1 << OCIE4A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR4B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_Timer5.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATmega_Timer5 extends AbstractAVR16BitTimer {
14 |
15 | override timerName() {
16 | "ATmega_Timer5"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER5_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR5A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR5A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer5
44 | noInterrupts();
45 | TCCR5A = 0; // set entire TCCR5A register to 0
46 | TCCR5B = 0; // same for TCCR5B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR5A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR5A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR5B |= (1 << WGM52);
61 |
62 | // Set CS52 and CS50 bits for 1024 prescaler
63 | TCCR5B |= (1 << CS52);
64 | TCCR5B |= (1 << CS50);
65 |
66 | // enable timer compare interrupt
67 | TIMSK5 |= (1 << OCIE5A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR5B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATmega_WDT.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 | import com.google.inject.Inject
13 | import org.yakindu.sct.model.sexec.ExecutionFlow
14 | import org.yakindu.sct.arduino.generator.cpp.ArduinoGenmodelEntries
15 |
16 | class ATmega_WDT extends AbstractAVRTimer {
17 |
18 | @Inject extension ArduinoGenmodelEntries
19 |
20 | override timerName() {
21 | "ATmega_WDT"
22 | }
23 |
24 | override protected variableDeclarations(GeneratorEntry it, ExecutionFlow flow) '''
25 | «super.variableDeclarations(it, flow)»
26 |
27 | bool runCycleFlag = false;
28 | '''
29 |
30 | override protected ISR(GeneratorEntry it) '''
31 | ISR(WDT_vect) {
32 | runCycleFlag = true;
33 | }
34 | '''
35 |
36 | override protected initBody(GeneratorEntry it) '''
37 | // disable global interrupts
38 | noInterrupts();
39 |
40 | // Clear the reset flag
41 | MCUSR &= ~(1 << WDRF);
42 |
43 | «IF cyclePeriod == 16»
44 | // enable watchdog interrupt with 16ms period
45 | WDTCSR |= (1 << WDCE) | (1 << WDE);
46 | WDTCSR |= (1 << WDIE);
47 | «ELSEIF cyclePeriod == 32»
48 | // enable watchdog interrupt with 32ms period
49 | WDTCSR |= (1 << WDCE) | (1 << WDE);
50 | WDTCSR = (1 << WDP0);
51 | WDTCSR |= (1 << WDIE);
52 | «ELSEIF cyclePeriod == 64»
53 | // enable watchdog interrupt with 64ms period
54 | WDTCSR |= (1 << WDCE) | (1 << WDE);
55 | WDTCSR = (1 << WDP1);
56 | WDTCSR |= (1 << WDIE);
57 | «ELSEIF cyclePeriod == 125»
58 | // enable watchdog interrupt with 125ms period
59 | WDTCSR |= (1 << WDCE) | (1 << WDE);
60 | WDTCSR = (1 << WDP1) | (1 << WDP0);
61 | WDTCSR |= (1 << WDIE);
62 | «ELSEIF cyclePeriod == 250»
63 | // enable watchdog interrupt with 250ms period
64 | WDTCSR |= (1 << WDCE) | (1 << WDE);
65 | WDTCSR = (1 << WDP2);
66 | WDTCSR |= (1 << WDIE);
67 | «ELSEIF cyclePeriod == 500»
68 | // enable watchdog interrupt with 500ms period
69 | WDTCSR |= (1 << WDCE) | (1 << WDE);
70 | WDTCSR = (1 << WDP2) | (1 << WDP0);
71 | WDTCSR |= (1 << WDIE);
72 | «ELSEIF cyclePeriod == 1000»
73 | // enable watchdog interrupt with 1s period
74 | WDTCSR |= (1 << WDCE) | (1 << WDE);
75 | WDTCSR = (1 << WDP2) | (1 << WDP1);
76 | WDTCSR |= (1 << WDIE);
77 | «ELSEIF cyclePeriod == 2000»
78 | // enable watchdog interrupt with 2s period
79 | WDTCSR |= (1 << WDCE) | (1 << WDE);
80 | WDTCSR = (1 << WDP2) | (1 << WDP1) | (1 << WDP0);
81 | WDTCSR |= (1 << WDIE);
82 | «ELSEIF cyclePeriod == 4000»
83 | // enable watchdog interrupt with 4s period
84 | WDTCSR |= (1 << WDCE) | (1 << WDE);
85 | WDTCSR = (1 << WDP3);
86 | WDTCSR |= (1 << WDIE);
87 | «ELSE»
88 | // enable watchdog interrupt with 8s period
89 | WDTCSR |= (1 << WDCE) | (1 << WDE);
90 | WDTCSR = (1 << WDP3) | (1 << WDP0);
91 | WDTCSR |= (1 << WDIE);
92 | «ENDIF»
93 |
94 | // enable global interrupts
95 | interrupts();
96 | '''
97 |
98 | override CharSequence sleepBody(GeneratorEntry it) '''
99 | set_sleep_mode(hardware->prepareSleepMode());
100 | noInterrupts();
101 | sleep_enable();
102 | interrupts();
103 | sleep_cpu();
104 | sleep_disable();
105 | '''
106 |
107 | override protected maxPeriod() {
108 | 8000
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATtiny_Timer0.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATtiny_Timer0 extends AbstractAVR8BitTimer {
14 |
15 | override timerName() {
16 | "ATtiny_Timer0"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER0_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR0A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR0A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer0
44 | noInterrupts();
45 | TCCR0A = 0; // set entire TCCR0A register to 0
46 | TCCR0B = 0; // same for TCCR0B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR0A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR0A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR0A |= (1 << WGM01);
61 |
62 | // Set CS02 and CS00 bits for 1024 prescaler
63 | TCCR0B |= (1 << CS02);
64 | TCCR0B |= (1 << CS00);
65 |
66 | // enable timer compare interrupt
67 | TIMSK0 |= (1 << OCIE0A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR0B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATtiny_Timer1.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 |
13 | class ATtiny_Timer1 extends AbstractAVR8BitTimer {
14 |
15 | override timerName() {
16 | "ATtiny_Timer1"
17 | }
18 |
19 | override protected ISR(GeneratorEntry it) '''
20 | ISR(TIMER1_COMPA_vect) {
21 | «IF useOverflows»
22 | overflowCounter++;
23 |
24 | if (overflowCounter == overflows && moduloRest != 0) {
25 | noInterrupts();
26 | OCR1A = (moduloRest * 0.001f * (16000000 / 1024)) - 1;
27 | interrupts();
28 | } else if (overflowCounter >= overflows) {
29 | noInterrupts();
30 | OCR1A = OVERFLOW_COMPARE_VALUE;
31 | interrupts();
32 |
33 | runCycleFlag = true;
34 | overflowCounter = 0;
35 | }
36 | «ELSE»
37 | runCycleFlag = true;
38 | «ENDIF»
39 | }
40 | '''
41 |
42 | override protected initBody(GeneratorEntry it) '''
43 | // initialize Timer1
44 | noInterrupts();
45 | TCCR1A = 0; // set entire TCCR1A register to 0
46 | TCCR1B = 0; // same for TCCR1B
47 |
48 | «IF useOverflows»
49 | overflows = CYCLE_PERIOD / MAX_PERIOD;
50 | moduloRest = CYCLE_PERIOD % MAX_PERIOD;
51 |
52 | OCR1A = OVERFLOW_COMPARE_VALUE;
53 | «ELSE»
54 | // set compare match register to desired timer count
55 | // period in ms, Arduino runs at 16 MHz, prescaler at 1024
56 | OCR1A = (CYCLE_PERIOD * 0.001f * (16000000 / 1024)) - 1;
57 | «ENDIF»
58 |
59 | // turn on CTC mode
60 | TCCR1B |= (1 << WGM12);
61 |
62 | // Set CS12 and CS10 bits for 1024 prescaler
63 | TCCR1B |= (1 << CS12);
64 | TCCR1B |= (1 << CS10);
65 |
66 | // enable timer compare interrupt
67 | TIMSK1 |= (1 << OCIE1A);
68 |
69 | // enable global interrupts
70 | interrupts();
71 | '''
72 |
73 | override protected cancelBody(GeneratorEntry it) '''
74 | TCCR1B = 0; // turn off the timer
75 | '''
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/ATtiny_WDT.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sgen.GeneratorEntry
12 | import com.google.inject.Inject
13 | import org.yakindu.sct.model.sexec.ExecutionFlow
14 | import org.yakindu.sct.arduino.generator.cpp.ArduinoGenmodelEntries
15 |
16 | class ATtiny_WDT extends AbstractAVRTimer {
17 |
18 | @Inject extension ArduinoGenmodelEntries
19 |
20 | override timerName() {
21 | "ATtiny_WDT"
22 | }
23 |
24 | override protected variableDeclarations(GeneratorEntry it, ExecutionFlow flow) '''
25 | «super.variableDeclarations(it, flow)»
26 |
27 | bool runCycleFlag = false;
28 | '''
29 |
30 | override protected ISR(GeneratorEntry it) '''
31 | ISR(WDT_vect) {
32 | runCycleFlag = true;
33 | }
34 | '''
35 |
36 | override protected initBody(GeneratorEntry it) '''
37 | // disable global interrupts
38 | noInterrupts();
39 |
40 | // Clear the reset flag
41 | MCUSR &= ~(1 << WDRF);
42 |
43 | «IF cyclePeriod == 16»
44 | // enable watchdog interrupt with 16ms period
45 | WDTCR |= (1 << WDCE) | (1 << WDE);
46 | WDTCR |= (1 << WDIE);
47 | «ELSEIF cyclePeriod == 32»
48 | // enable watchdog interrupt with 32ms period
49 | WDTCR |= (1 << WDCE) | (1 << WDE);
50 | WDTCR = (1 << WDP0);
51 | WDTCR |= (1 << WDIE);
52 | «ELSEIF cyclePeriod == 64»
53 | // enable watchdog interrupt with 64ms period
54 | WDTCR |= (1 << WDCE) | (1 << WDE);
55 | WDTCR = (1 << WDP1);
56 | WDTCR |= (1 << WDIE);
57 | «ELSEIF cyclePeriod == 125»
58 | // enable watchdog interrupt with 125ms period
59 | WDTCR |= (1 << WDCE) | (1 << WDE);
60 | WDTCR = (1 << WDP1) | (1 << WDP0);
61 | WDTCR |= (1 << WDIE);
62 | «ELSEIF cyclePeriod == 250»
63 | // enable watchdog interrupt with 250ms period
64 | WDTCR |= (1 << WDCE) | (1 << WDE);
65 | WDTCR = (1 << WDP2);
66 | WDTCR |= (1 << WDIE);
67 | «ELSEIF cyclePeriod == 500»
68 | // enable watchdog interrupt with 500ms period
69 | WDTCR |= (1 << WDCE) | (1 << WDE);
70 | WDTCR = (1 << WDP2) | (1 << WDP0);
71 | WDTCR |= (1 << WDIE);
72 | «ELSEIF cyclePeriod == 1000»
73 | // enable watchdog interrupt with 1s period
74 | WDTCR |= (1 << WDCE) | (1 << WDE);
75 | WDTCR = (1 << WDP2) | (1 << WDP1);
76 | WDTCR |= (1 << WDIE);
77 | «ELSEIF cyclePeriod == 2000»
78 | // enable watchdog interrupt with 2s period
79 | WDTCR |= (1 << WDCE) | (1 << WDE);
80 | WDTCR = (1 << WDP2) | (1 << WDP1) | (1 << WDP0);
81 | WDTCR |= (1 << WDIE);
82 | «ELSEIF cyclePeriod == 4000»
83 | // enable watchdog interrupt with 4s period
84 | WDTCR |= (1 << WDCE) | (1 << WDE);
85 | WDTCR = (1 << WDP3);
86 | WDTCR |= (1 << WDIE);
87 | «ELSE»
88 | // enable watchdog interrupt with 8s period
89 | WDTCR |= (1 << WDCE) | (1 << WDE);
90 | WDTCR = (1 << WDP3) | (1 << WDP0);
91 | WDTCR |= (1 << WDIE);
92 | «ENDIF»
93 |
94 | // enable global interrupts
95 | interrupts();
96 | '''
97 |
98 | override CharSequence sleepBody(GeneratorEntry it) '''
99 | set_sleep_mode(hardware->prepareSleepMode());
100 | noInterrupts();
101 | sleep_enable();
102 | interrupts();
103 | sleep_cpu();
104 | sleep_disable();
105 | '''
106 |
107 | override protected maxPeriod() {
108 | 8000
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/AbstractAVR16BitTimer.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sexec.ExecutionFlow
12 | import org.yakindu.sct.model.sgen.GeneratorEntry
13 |
14 | abstract class AbstractAVR16BitTimer extends AbstractAVRTimer {
15 |
16 | protected final static int MAX_PERIOD = 4192;
17 |
18 | protected final static int OVERFLOW_COMPARE_VALUE = 65499;
19 |
20 | override protected variableDeclarations(GeneratorEntry it, ExecutionFlow flow) '''
21 | «super.variableDeclarations(it, flow)»
22 | «IF useOverflows»
23 | const unsigned int MAX_PERIOD = «MAX_PERIOD»;
24 | const unsigned int OVERFLOW_COMPARE_VALUE = «OVERFLOW_COMPARE_VALUE»;
25 |
26 | bool runCycleFlag = false;
27 | unsigned char overflows = 0;
28 | unsigned char overflowCounter = 0;
29 | unsigned int moduloRest = 0;
30 | «ELSE»
31 | bool runCycleFlag = false;
32 | «ENDIF»
33 | '''
34 |
35 | override protected maxPeriod() {
36 | MAX_PERIOD
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/AbstractAVR8BitTimer.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import org.yakindu.sct.model.sexec.ExecutionFlow
12 | import org.yakindu.sct.model.sgen.GeneratorEntry
13 |
14 | abstract class AbstractAVR8BitTimer extends AbstractAVRTimer {
15 |
16 | protected final static int MAX_PERIOD = 16;
17 |
18 | protected final static int OVERFLOW_COMPARE_VALUE = 249;
19 |
20 | override protected variableDeclarations(GeneratorEntry it, ExecutionFlow flow) '''
21 | «super.variableDeclarations(it, flow)»
22 | «IF useOverflows»
23 | const unsigned char MAX_PERIOD = «MAX_PERIOD»;
24 | const unsigned char OVERFLOW_COMPARE_VALUE = «OVERFLOW_COMPARE_VALUE»;
25 |
26 | bool runCycleFlag = false;
27 | unsigned int overflows = 0;
28 | unsigned int overflowCounter = 0;
29 | unsigned char moduloRest = 0;
30 | «ELSE»
31 | bool runCycleFlag = false;
32 | «ENDIF»
33 | '''
34 |
35 | override protected maxPeriod() {
36 | MAX_PERIOD
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/avr/AbstractAVRTimer.xtend:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.generator.cpp.timers.avr
10 |
11 | import com.google.inject.Inject
12 | import org.yakindu.sct.arduino.generator.cpp.timers.AbstractTimer
13 | import org.yakindu.sct.model.sexec.ExecutionFlow
14 | import org.yakindu.sct.model.sexec.extensions.SExecExtensions
15 | import org.yakindu.sct.model.sgen.GeneratorEntry
16 | import org.yakindu.sct.arduino.generator.cpp.ArduinoCPPNaming
17 | import org.yakindu.sct.arduino.generator.cpp.ArduinoGenmodelEntries
18 |
19 | abstract class AbstractAVRTimer extends AbstractTimer {
20 |
21 | @Inject extension ArduinoCPPNaming
22 | @Inject extension ArduinoGenmodelEntries
23 | @Inject extension SExecExtensions
24 |
25 | override generateTimer(GeneratorEntry it, ExecutionFlow flow) '''
26 | «licenseText»
27 |
28 | #include "«timerName.h»"
29 |
30 | «variableDeclarations(flow)»
31 |
32 | «ISR»
33 |
34 | «constructor(flow)»
35 |
36 | «start»
37 |
38 | «init»
39 |
40 | «IF flow.timed»
41 | «setTimer»
42 |
43 | «unsetTimer»
44 |
45 | «ENDIF»
46 | «runCycle(flow)»
47 |
48 | «IF flow.timed»
49 | «raiseTimeEvents»
50 | «ENDIF»
51 |
52 | «sleep»
53 |
54 | «cancel»
55 | '''
56 |
57 | override protected headerIncludes(GeneratorEntry it, ExecutionFlow flow) '''
58 | #include
59 | «super.headerIncludes(it, flow)»
60 | '''
61 |
62 | override protected privateHeaderPart(GeneratorEntry it, ExecutionFlow flow) '''
63 | «super.privateHeaderPart(it, flow)»
64 |
65 | void sleep();
66 | '''
67 |
68 | protected def CharSequence ISR(GeneratorEntry it)
69 |
70 | override protected runCycleBody(GeneratorEntry it, ExecutionFlow flow) '''
71 | if (runCycleFlag) {
72 | «super.runCycleBody(it, flow)»
73 | runCycleFlag = false;
74 | }
75 | sleep();
76 | '''
77 |
78 | protected def CharSequence sleep(GeneratorEntry it) '''
79 | void «timerName»::sleep() {
80 | «sleepBody»
81 | }
82 | '''
83 |
84 | protected def CharSequence sleepBody(GeneratorEntry it) '''
85 | hardware->prepareSleepMode();
86 |
87 | set_sleep_mode(SLEEP_MODE_IDLE);
88 | noInterrupts();
89 | sleep_enable();
90 | interrupts();
91 | sleep_cpu();
92 | sleep_disable();
93 | '''
94 |
95 | protected def int maxPeriod()
96 |
97 | protected def boolean useOverflows(GeneratorEntry entry) {
98 | entry.cyclePeriod > maxPeriod;
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.generator.cpp/src/org/yakindu/sct/arduino/generator/cpp/timers/esp/ESP8266_Timer.xtend:
--------------------------------------------------------------------------------
1 | package org.yakindu.sct.arduino.generator.cpp.timers.esp
2 |
3 | import com.google.inject.Inject
4 | import org.yakindu.sct.arduino.generator.cpp.timers.AbstractTimer
5 | import org.yakindu.sct.model.sexec.ExecutionFlow
6 | import org.yakindu.sct.model.sgen.GeneratorEntry
7 | import org.yakindu.sct.arduino.generator.cpp.ArduinoCPPNaming
8 | import org.yakindu.sct.arduino.generator.cpp.ArduinoGenmodelEntries
9 |
10 | class ESP8266_Timer extends AbstractTimer {
11 |
12 | @Inject extension ArduinoCPPNaming
13 | @Inject extension ArduinoGenmodelEntries
14 |
15 | override timerName() {
16 | "ESP8266_Timer"
17 | }
18 |
19 | override generateTimer(GeneratorEntry it, ExecutionFlow flow) '''
20 | «licenseText»
21 |
22 | #include "«timerName.h»"
23 |
24 | «variableDeclarations(flow)»
25 |
26 | «timerCallback»
27 |
28 | «constructor(flow)»
29 |
30 | «start»
31 |
32 | «init»
33 |
34 | «setTimer»
35 |
36 | «unsetTimer»
37 |
38 | «runCycle(flow)»
39 |
40 | «raiseTimeEvents»
41 |
42 | «cancel»
43 | '''
44 |
45 | override protected headerIncludes(GeneratorEntry it, ExecutionFlow flow) '''
46 | «super.headerIncludes(it, flow)»
47 | #include "user_interface.h"
48 | '''
49 |
50 | override protected CharSequence variableDeclarations(GeneratorEntry it, ExecutionFlow flow) '''
51 | «super.variableDeclarations(it, flow)»
52 |
53 | bool runCycleFlag = false;
54 |
55 | os_timer_t osTimer;
56 | '''
57 |
58 | protected def CharSequence timerCallback(GeneratorEntry it) '''
59 | void timerCallback(void *pArg) {
60 | runCycleFlag = true;
61 | }
62 | '''
63 |
64 | override protected initBody(GeneratorEntry it) '''
65 | os_timer_setfn(&osTimer, timerCallback, NULL);
66 | os_timer_arm(&osTimer, CYCLE_PERIOD, true);
67 | '''
68 |
69 | override protected runCycleBody(GeneratorEntry it, ExecutionFlow flow) '''
70 | if (runCycleFlag) {
71 | «super.runCycleBody(it, flow)»
72 | runCycleFlag = false;
73 | }
74 | yield();
75 | '''
76 |
77 | override protected cancelBody(GeneratorEntry it) '''
78 | os_timer_disarm (&osTimer);
79 | '''
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /html/
3 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.help
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.pde.ManifestBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.SchemaBuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.pde.PluginNature
21 |
22 |
23 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: YAKINDU Statechart Tools for Arduino Help
4 | Bundle-SymbolicName: org.yakindu.sct.arduino.help;singleton:=true
5 | Bundle-Version: 0.10.0.qualifier
6 | Bundle-Vendor: Lothar Wendehals
7 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = plugin.xml,\
2 | META-INF/,\
3 | html/,\
4 | *.xml,\
5 | epl-v10.html
6 | src.includes = pom.xml,\
7 | epl-v10.html,\
8 | toc.xml,\
9 | md/
10 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/ArduinoToolchainSetup.md:
--------------------------------------------------------------------------------
1 | # Arduino Toolchain Setup
2 |
3 | Before starting development for your Arduino you need to install and setup the Arduino toolchain and libraries in your freshly installed Eclipse environment. Open the Arduino Downloads Manager from the Help menu. In the Platforms tab add a new toolchain by clicking the "Add" button and choosing the target platform. In our case it's the Arduino AVR Boards package.
4 |
5 | 
6 |
7 | The Arduino toolchain and libraries are now installed. To upload the program to your Arduino you need to connect it to Eclipse. First, connect your Arduino via USB to your computer. If you have connected and used your Arduino with your computer before there should already be a driver installed. If not, make sure you have installed the Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software), you need it for the USB driver.
8 |
9 | There is a wizard that helps you to create a connection to your Arduino. You can open the wizard either by choosing "New Launch Target" from the toolbar or by clicking the "New Connection" button in the "Connections" view of the C/C++ perspective.
10 |
11 | 
12 |
13 | On the first wizard page select the Arduino list entry and click "Next>". On the second page provide a name for the connection, the serial port that, and the board type and press "Finish".
14 |
15 | 
16 |
17 | The environment is now ready to compile and upload programs to your Arduino.
18 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/CreatingExamples.md:
--------------------------------------------------------------------------------
1 | # Creating an Example Project
2 |
3 | There are also example projects shipped with YAKINDU Statechart Tools for Arduino. To create an example project open the context menu of the Project Explorer view in the upper left corner of the Eclipse Window and select "New">"Example...". In the wizard select one of the YAKINDU Statechart Tools for Arduino examples and click "Next>". On the next wizard page click "Finish". The example project will be created and the example statechart will be opened.
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/Installation.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | First you need to download the [YAKINDU Statechart Tools](http://www.statecharts.org/). Unzip the archive to an arbitrary directory and start SCT. Choose "Install New Software..." from the "Help" menu.
4 |
5 | 
6 |
7 | Select the "Add..." button in the upper right corner to add a new update site. Copy the following URL to the "Location" text field: [https://wendehals.github.io/arduino\_sct\_tools/releases/](https://wendehals.github.io/arduino_sct_tools/releases/). Use any value for the "Name" field and select "OK".
8 |
9 | 
10 |
11 | Select YAKINDU Statechart Tools for Arduino and press the "Next>" button to switch to the next page.
12 |
13 | 
14 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/ProgrammingArduino.md:
--------------------------------------------------------------------------------
1 | # Programming an Arduino with Statecharts
2 |
3 | ## Modeling the Statechart
4 |
5 | Now we are ready to model the statechart. We will use the "Hello World" example from the Arduino world, it's a blinking light. The Arduino Uno board has an LED built in that can be used for this purpose. In the "Blink" example, we will let the LED turn on and off every 500ms.
6 |
7 | Model your statechart in the way that is shown in the figure below. Create two states, On
and Off
. Then create transitions between both of them and add time triggers to the transitions. The time trigger after 500ms
lets the state automatically change after 500 milliseconds. Within the states, add an entry
action that sets the boolean variable on
to true or respectively to false. You need to declare the boolean variable on
within the interface.
8 |
9 | 
10 |
11 | You will find a more detailed documentation of the YAKINDU Statechart Tools and the statechart syntax in the Eclipse help or [online](https://www.itemis.com/en/yakindu/statechart-tools/documentation/tutorials/#oss_comprehensive-tutorial).
12 |
13 | ## Source code generation
14 |
15 | Our statechart model for the "Blink" example is now complete. Open the context menu on the "Blink.sgen" file in the Project Explorer and select "Generate Code Artifacts".
16 |
17 | 
18 |
19 | You might also open the SGen Multi Page Editor via the context menu on the "Blink.sgen" file in the Project Explorer. Choose "Open With" and select the Multi Page Editor. On the form page you can click on the gear-wheels in the upper right corner to generate the code artifacts.
20 |
21 | 
22 |
23 | Your Eclipse environment should now look like depicted in the figure below. There are two new folders, "src" and "src-gen". The "src-gen" folder contains the statemachine generated from the statechart, interfaces to the statemachine, a timer implementation, and everything else that is needed to execute the statemachine on your Arduino. The "src" folder is meant to be changed by the developer. We will go into detail later.
24 |
25 | 
26 |
27 | You don't have to care about the code that is put into the "src-gen" folder. It is completely generated and will be overwritten the next time when the statechart changes.
28 |
29 | ## Simulation
30 |
31 | This is a pretty simple statechart, you can easily check by hand whether it works as you expect. Once the statechart gets more complex, it's better to check its behavior by simulation. Switch to the SC Simulation perspective and start the simulation of the statechart by clicking on the "Run" button in the toolbar as depicted below.
32 |
33 | 
34 |
35 | Now the statechart will be simulated. The current state(s) of the statechart will be highlighted in red. On the right, variables and their values as well as events are shown in the Simulation view. You might even manipulate variables or send events manually in the Simulation view.
36 |
37 | 
38 |
39 | For more details about simulation refer to the YAKINDU Statechart Tools pages in the Eclipse help.
40 |
41 | ## Connecting the Statechart Model with the Hardware
42 |
43 | Once you are sure that your statechart works as expected you still need to do some programming. In the "src-gen" folder there is a file called "ArduinoMain.cpp". This file contains the setup
and loop
functions that have to be implemented in each Arduino sketch. These functions are already implemented and contain everything that is needed to run the statemachine on your Arduino.
44 |
45 | Unfortunately, you still need to program the code that connects the statemachine to the Arduino hardware. In the "src" folder you will find two other files, "BlinkConnector.h" and "BlinkConnector.cpp" (the prefixes may differ, the class is named after the statechart). In the "BlinkConnector.cpp" file you will find two methods, BlinkConnector::init()
and BlinkConnector::runCycle()
. They correspond to the setup
and loop
functions in ordinary Arduino sketches.
46 |
47 | Put everything that is needed to initialize your hardware into the BlinkConnector::init()
function and everything that is needed to be executed regularly into the BlinkConnector::runCycle()
method. In this example, you need to turn the built-in LED on the Arduino Uno board to on or off depending on the statechart's state. First of all you need to initialize the LED_BUILTIN
pin as an OUTPUT
pin. In the runCycle
loop you then need to update the pin's level depending on the statechart's on
variable to switch the LED on or off.
48 |
49 | 
50 |
51 | The Arduino hardware is now connected to the statemachine running on your Arduino. It's time to upload the program.
52 |
53 | ## Uploading the Program
54 |
55 | Click on the "Launch in 'Run' Mode" button to upload the code to your Arduino. Be sure to connect your Arduino to your computer and select the correct launch target in the toolbar.
56 |
57 | 
58 |
59 | If the upload was successfull the output should look like this:
60 |
61 | 
62 |
63 | Now it's your turn to model more complex statecharts and run them on your Arduino. Have fun!
64 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/ProjectSetup.md:
--------------------------------------------------------------------------------
1 | # Arduino SCT Project Setup
2 |
3 | To start programming your Arduino, you need to create a project. After closing the Welcome page open the context menu of the Project Explorer view in the upper left corner of the Eclipse Window and select "New">"Project...".
4 |
5 | 
6 |
7 | Select "Arduino Project with YAKINDU Statechart" from the list on the first page of the New Project wizard and click "Next>".
8 |
9 | 
10 |
11 | On the next page, choose a project name and click "Next>".
12 |
13 | 
14 |
15 | On the last page you can choose values for a set of properties of the Arduino SCT project. These are
16 |
17 | * a name for the statechart. The default is the project name. You can choose any valid C++ identifier, since it will be used as a class name.
18 | * a source code folder - it will contain the source code that will be edited by you. Initially, two files will be generated and put into this folder, <StatechartName>Connector.h and <StatechartName>Connector.cpp. After the first code generation these files will be kept untouched by the code generation.
19 | * a generated source code folder - it will contain all the rest of the source code generated by the tool that is necessary to run your statechart on the Arduino. The source code in this folder should not be changed by the user and will be overwritten by the code generator.
20 | * the timer implementation - there are several timer implementations to run the cycles of the statechart. You can choose between a generic software based timer that is compatible to most microcontrollers and hardware based timers for various microcontrollers.
21 |
22 | After setting the properties, click "Finish".
23 |
24 | 
25 |
26 | You might be asked whether the Xtext nature should be added to the project. Please confirm this question.
27 |
28 | Your Eclipse should look like this:
29 |
30 | 
31 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/AddRepository.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/AddRepository.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/ArduinoDownloadsManager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/ArduinoDownloadsManager.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/GenerateCodeArtifacts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/GenerateCodeArtifacts.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/ImplementConnector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/ImplementConnector.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/InstallNewSoftware.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/InstallNewSoftware.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/InstallSCTforArduino.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/InstallSCTforArduino.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewArduinoProjectWizardPage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewArduinoProjectWizardPage.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewArduinoSCTProject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewArduinoSCTProject.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewArduinoTargetWizard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewArduinoTargetWizard.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewLaunchTarget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewLaunchTarget.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewProjectContextMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewProjectContextMenu.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewProjectWizard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/NewProjectWizard.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/ProjectAfterCodeGeneration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/ProjectAfterCodeGeneration.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/ProjectPropertiesWizardPage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/ProjectPropertiesWizardPage.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/RunningSimulation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/RunningSimulation.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/SCModeling.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/SCModeling.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/SGenMultiPageEditor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/SGenMultiPageEditor.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/StartSimulation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/StartSimulation.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/UploadProgram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/UploadProgram.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/md/screenshots/UploadingFinished.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.help/md/screenshots/UploadingFinished.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 4.0.0
6 |
7 |
8 | org.yakindu.sct.arduino
9 | plugins
10 | 0.10.0-SNAPSHOT
11 |
12 |
13 | org.yakindu.sct.arduino.help
14 | eclipse-plugin
15 |
16 |
17 |
18 |
19 | maven-clean-plugin
20 |
21 |
22 |
23 | html
24 |
25 |
26 |
27 |
28 |
29 |
30 | com.ruleoftech
31 | markdown-page-generator-plugin
32 | 2.1.0
33 |
34 |
35 | process-sources
36 |
37 | generate
38 |
39 |
40 |
41 |
42 | ${project.basedir}/md
43 | screenshots
44 | ${project.basedir}/html
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.help/toc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /target/
3 | /.META-INF_MANIFEST.MF
4 | /.polyglot..META-INF_MANIFEST.MF
5 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.ui
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
3 | formatter_profile=_arduino_cdt
4 | formatter_settings_version=12
5 | sp_cleanup.add_default_serial_version_id=true
6 | sp_cleanup.add_generated_serial_version_id=false
7 | sp_cleanup.add_missing_annotations=true
8 | sp_cleanup.add_missing_deprecated_annotations=true
9 | sp_cleanup.add_missing_methods=false
10 | sp_cleanup.add_missing_nls_tags=false
11 | sp_cleanup.add_missing_override_annotations=true
12 | sp_cleanup.add_missing_override_annotations_interface_methods=true
13 | sp_cleanup.add_serial_version_id=false
14 | sp_cleanup.always_use_blocks=true
15 | sp_cleanup.always_use_parentheses_in_expressions=true
16 | sp_cleanup.always_use_this_for_non_static_field_access=true
17 | sp_cleanup.always_use_this_for_non_static_method_access=false
18 | sp_cleanup.convert_functional_interfaces=false
19 | sp_cleanup.convert_to_enhanced_for_loop=false
20 | sp_cleanup.correct_indentation=true
21 | sp_cleanup.format_source_code=true
22 | sp_cleanup.format_source_code_changes_only=false
23 | sp_cleanup.insert_inferred_type_arguments=false
24 | sp_cleanup.make_local_variable_final=true
25 | sp_cleanup.make_parameters_final=true
26 | sp_cleanup.make_private_fields_final=true
27 | sp_cleanup.make_type_abstract_if_missing_method=false
28 | sp_cleanup.make_variable_declarations_final=true
29 | sp_cleanup.never_use_blocks=false
30 | sp_cleanup.never_use_parentheses_in_expressions=false
31 | sp_cleanup.on_save_use_additional_actions=true
32 | sp_cleanup.organize_imports=true
33 | sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
34 | sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
35 | sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
36 | sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
37 | sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
38 | sp_cleanup.remove_private_constructors=true
39 | sp_cleanup.remove_redundant_type_arguments=false
40 | sp_cleanup.remove_trailing_whitespaces=true
41 | sp_cleanup.remove_trailing_whitespaces_all=true
42 | sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
43 | sp_cleanup.remove_unnecessary_casts=true
44 | sp_cleanup.remove_unnecessary_nls_tags=true
45 | sp_cleanup.remove_unused_imports=true
46 | sp_cleanup.remove_unused_local_variables=false
47 | sp_cleanup.remove_unused_private_fields=true
48 | sp_cleanup.remove_unused_private_members=false
49 | sp_cleanup.remove_unused_private_methods=true
50 | sp_cleanup.remove_unused_private_types=true
51 | sp_cleanup.sort_members=false
52 | sp_cleanup.sort_members_all=false
53 | sp_cleanup.use_anonymous_class_creation=false
54 | sp_cleanup.use_blocks=true
55 | sp_cleanup.use_blocks_only_for_return_and_throw=false
56 | sp_cleanup.use_lambda=true
57 | sp_cleanup.use_parentheses_in_expressions=true
58 | sp_cleanup.use_this_for_non_static_field_access=true
59 | sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
60 | sp_cleanup.use_this_for_non_static_method_access=true
61 | sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
62 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: YAKINDU Statechart Tools for Arduino UI
4 | Bundle-SymbolicName: org.yakindu.sct.arduino.ui;singleton:=true
5 | Bundle-Version: 0.10.0.qualifier
6 | Bundle-Activator: org.yakindu.sct.arduino.ui.SCTArduinoUIPlugin
7 | Bundle-Vendor: Lothar Wendehals
8 | Require-Bundle: org.eclipse.cdt.ui,
9 | org.eclipse.core.resources,
10 | org.eclipse.core.runtime,
11 | org.eclipse.cdt.core,
12 | org.eclipse.emf.transaction,
13 | org.eclipse.emf.workspace,
14 | org.eclipse.gmf.runtime.emf.commands.core,
15 | org.eclipse.tools.templates.freemarker,
16 | org.eclipse.tools.templates.ui,
17 | org.eclipse.ui,
18 | org.eclipse.ui.editors,
19 | org.eclipse.ui.forms,
20 | org.eclipse.ui.ide,
21 | org.eclipse.xtext.ui,
22 | org.yakindu.sct.ui,
23 | org.yakindu.sct.ui.editor,
24 | org.yakindu.sct.generator.builder,
25 | org.yakindu.sct.generator.genmodel.ui,
26 | org.yakindu.sct.model.stext.lib,
27 | org.yakindu.sct.arduino.generator.cpp,
28 | org.yakindu.sct.editor.sgen
29 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8
30 | Bundle-ActivationPolicy: lazy
31 | Import-Package: org.eclipse.xtext.ui.editor
32 | Automatic-Module-Name: org.yakindu.sct.arduino.ui
33 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = plugin.xml,\
4 | META-INF/,\
5 | .,\
6 | icons/,\
7 | epl-v10.html,\
8 | templates/
9 | src.includes = icons/,\
10 | epl-v10.html,\
11 | templates/
12 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/icons/yakindu16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.arduino.ui/icons/yakindu16.png
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
15 |
16 |
19 |
20 |
21 |
23 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/SCTArduinoUIPlugin.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.ui;
10 |
11 | import org.eclipse.core.runtime.IStatus;
12 | import org.eclipse.core.runtime.Status;
13 | import org.eclipse.ui.plugin.AbstractUIPlugin;
14 | import org.osgi.framework.BundleContext;
15 |
16 | /**
17 | * The activator class controls the plug-in life cycle
18 | */
19 | public class SCTArduinoUIPlugin extends AbstractUIPlugin {
20 |
21 | /**
22 | * The shared instance
23 | */
24 | private static SCTArduinoUIPlugin plugin;
25 |
26 | /**
27 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
28 | */
29 | @Override
30 | public void start(final BundleContext context) throws Exception {
31 | super.start(context);
32 | plugin = this;
33 | }
34 |
35 | /**
36 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
37 | */
38 | @Override
39 | public void stop(final BundleContext context) throws Exception {
40 | plugin = null;
41 | super.stop(context);
42 | }
43 |
44 | /**
45 | * Returns the shared instance
46 | *
47 | * @return the shared instance
48 | */
49 | public static SCTArduinoUIPlugin getDefault() {
50 | return plugin;
51 | }
52 |
53 | /**
54 | * @return the plugin's id.
55 | */
56 | public static String getPluginId() {
57 | return plugin.getBundle().getSymbolicName();
58 | }
59 |
60 | /**
61 | * Logs an exception.
62 | *
63 | * @param exception
64 | * the exception that caused that error.
65 | * @return the {@link IStatus} that was logged.
66 | */
67 | public static IStatus logError(final Throwable exception) {
68 | final Status status = new Status(IStatus.ERROR, getPluginId(), exception.getLocalizedMessage(), exception);
69 | plugin.getLog().log(status);
70 |
71 | return status;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/editors/Messages.java:
--------------------------------------------------------------------------------
1 | package org.yakindu.sct.arduino.ui.editors;
2 |
3 | import org.eclipse.osgi.util.NLS;
4 |
5 | public class Messages extends NLS {
6 |
7 | private static final String BUNDLE_NAME = "org.yakindu.sct.arduino.ui.editors.messages"; //$NON-NLS-1$
8 |
9 | public static String ArduinoFeatureConfigurationSection_architectureLabel;
10 | public static String ArduinoFeatureConfigurationSection_cyclePeriodLabel;
11 | public static String ArduinoFeatureConfigurationSection_cyclePeriodToolTip;
12 | public static String ArduinoFeatureConfigurationSection_timerLabel;
13 | public static String ArduinoFeatureConfigurationSection_userSrcFolderLabel;
14 |
15 | static {
16 | // initialize resource bundle
17 | NLS.initializeMessages(BUNDLE_NAME, Messages.class);
18 | }
19 |
20 | private Messages() {
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/editors/messages.properties:
--------------------------------------------------------------------------------
1 | ArduinoFeatureConfigurationSection_architectureLabel=Architecture
2 | ArduinoFeatureConfigurationSection_cyclePeriodLabel=Cycle Period (ms)
3 | ArduinoFeatureConfigurationSection_userSrcFolderLabel=User Source Folder
4 | ArduinoFeatureConfigurationSection_cyclePeriodToolTip=The period of the cycle the statechart runs with (given in milliseconds).
5 | ArduinoFeatureConfigurationSection_timerLabel=Timer
6 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/wizards/ArduinoModelCreator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2018 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.ui.wizards;
10 |
11 | import org.yakindu.sct.model.stext.lib.StatechartAnnotations;
12 | import org.yakindu.sct.ui.editor.wizards.DefaultModelCreator;
13 |
14 | public class ArduinoModelCreator extends DefaultModelCreator {
15 |
16 | private final int cyclePeriod;
17 |
18 | public ArduinoModelCreator(final int cyclePeriod) {
19 | this.cyclePeriod = cyclePeriod;
20 | }
21 |
22 | @Override
23 | protected String getInitialSpecification() {
24 | return "@" + StatechartAnnotations.CYCLE_BASED_ANNOTATION + "(" + this.cyclePeriod + ")\n" //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
25 | + "\n" //$NON-NLS-1$
26 | + "interface:\n" //$NON-NLS-1$
27 | + "// Define events and variables here. \n" //$NON-NLS-1$
28 | + "// Use CTRL+Space for content assist."; //$NON-NLS-1$
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/wizards/CyclePeriodsProvider.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.ui.wizards;
10 |
11 | import java.util.Collection;
12 | import java.util.TreeSet;
13 |
14 | import org.eclipse.jface.viewers.IStructuredContentProvider;
15 | import org.eclipse.jface.viewers.LabelProvider;
16 | import org.eclipse.jface.viewers.Viewer;
17 |
18 | public class CyclePeriodsProvider extends LabelProvider implements IStructuredContentProvider {
19 |
20 | private final Collection cyclePeriods = new TreeSet<>();
21 |
22 | /**
23 | * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object,
24 | * java.lang.Object)
25 | */
26 | @Override
27 | @SuppressWarnings("unchecked")
28 | public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
29 | this.cyclePeriods.clear();
30 | if (newInput != null) {
31 | this.cyclePeriods.addAll((Collection) newInput);
32 | }
33 | }
34 |
35 | /**
36 | * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
37 | */
38 | @Override
39 | public String getText(final Object element) {
40 | return ((Integer) element).toString();
41 | }
42 |
43 | /**
44 | * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
45 | */
46 | @Override
47 | public Object[] getElements(final Object inputElement) {
48 | return this.cyclePeriods.toArray();
49 | }
50 |
51 | public int getIndex(final String element) {
52 | final Object[] array = getElements(null);
53 | for (int index = 0; index < array.length; index++) {
54 | if (array[index].toString().equals(element)) {
55 | return index;
56 | }
57 | }
58 | return -1;
59 | }
60 |
61 | }
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/wizards/Messages.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.ui.wizards;
10 |
11 | import org.eclipse.osgi.util.NLS;
12 |
13 | public class Messages extends NLS {
14 |
15 | private static final String BUNDLE_NAME = "org.yakindu.sct.arduino.ui.wizards.messages"; //$NON-NLS-1$
16 |
17 | public static String ArduinoSCTProjectGenerator_creatingDiagram;
18 |
19 | public static String ArduinoSCTWizardPage_architectureLabel;
20 | public static String ArduinoSCTWizardPage_cyclePeriodLabel;
21 | public static String ArduinoSCTWizardPage_cyclePeriodNotInIntervalMessage;
22 | public static String ArduinoSCTWizardPage_cyclePeriodToolTip;
23 | public static String ArduinoSCTWizardPage_description;
24 | public static String ArduinoSCTWizardPage_genSrcFolderLabel;
25 | public static String ArduinoSCTWizardPage_invalidCyclePeriodMessage;
26 | public static String ArduinoSCTWizardPage_missingStatechartNameMessage;
27 | public static String ArduinoSCTWizardPage_srcFolderLabel;
28 | public static String ArduinoSCTWizardPage_statechartLabel;
29 | public static String ArduinoSCTWizardPage_timerImplLabel;
30 | public static String ArduinoSCTWizardPage_timerLabel;
31 |
32 | public static String NewArduinoSCTProjectWizard_description;
33 | public static String NewArduinoSCTProjectWizard_title;
34 |
35 | static {
36 | // initialize resource bundle
37 | NLS.initializeMessages(BUNDLE_NAME, Messages.class);
38 | }
39 |
40 | private Messages() {
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/wizards/NamedExtensionElementsProvider.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.ui.wizards;
10 |
11 | import java.util.Collection;
12 | import java.util.Comparator;
13 | import java.util.TreeSet;
14 |
15 | import org.eclipse.jface.viewers.IStructuredContentProvider;
16 | import org.eclipse.jface.viewers.LabelProvider;
17 | import org.eclipse.jface.viewers.Viewer;
18 | import org.yakindu.sct.arduino.generator.cpp.extensions.AbstractNamedElement;
19 |
20 | public class NamedExtensionElementsProvider extends LabelProvider implements IStructuredContentProvider {
21 |
22 | private final Collection namedExtensionElements = new TreeSet<>(
23 | new Comparator() {
24 |
25 | /**
26 | * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
27 | */
28 | @Override
29 | public int compare(AbstractNamedElement element1, AbstractNamedElement element2) {
30 | return element1.getName().compareTo(element2.getName());
31 | }
32 | });
33 |
34 | /**
35 | * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object,
36 | * java.lang.Object)
37 | */
38 | @Override
39 | @SuppressWarnings("unchecked")
40 | public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
41 | this.namedExtensionElements.clear();
42 | if (newInput != null) {
43 | this.namedExtensionElements.addAll((Collection) newInput);
44 | }
45 | }
46 |
47 | /**
48 | * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
49 | */
50 | @Override
51 | public String getText(Object element) {
52 | return ((AbstractNamedElement) element).getName();
53 | }
54 |
55 | /**
56 | * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
57 | */
58 | @Override
59 | public AbstractNamedElement[] getElements(Object inputElement) {
60 | return this.namedExtensionElements.toArray(new AbstractNamedElement[this.namedExtensionElements.size()]);
61 | }
62 |
63 | public int getIndex(String id) {
64 | final AbstractNamedElement[] elements = getElements(null);
65 | for (int i = 0; i < this.namedExtensionElements.size(); i++) {
66 | final AbstractNamedElement namedElement = elements[i];
67 | if (namedElement.getId().equals(id)) {
68 | return i;
69 | }
70 | }
71 |
72 | return -1;
73 | }
74 |
75 | }
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/wizards/NewArduinoSCTProjectWizard.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.arduino.ui.wizards;
10 |
11 | import org.eclipse.cdt.ui.CUIPlugin;
12 | import org.eclipse.core.resources.IFile;
13 | import org.eclipse.jface.dialogs.Dialog;
14 | import org.eclipse.swt.widgets.Composite;
15 | import org.eclipse.tools.templates.core.IGenerator;
16 | import org.eclipse.tools.templates.ui.TemplateWizard;
17 | import org.eclipse.ui.IEditorDescriptor;
18 | import org.eclipse.ui.IWorkbench;
19 | import org.eclipse.ui.IWorkbenchPage;
20 | import org.eclipse.ui.IWorkbenchWindow;
21 | import org.eclipse.ui.PartInitException;
22 | import org.eclipse.ui.WorkbenchException;
23 | import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
24 | import org.eclipse.ui.part.FileEditorInput;
25 | import org.yakindu.sct.arduino.ui.SCTArduinoUIPlugin;
26 | import org.yakindu.sct.ui.perspectives.IYakinduSctPerspectives;
27 |
28 | public class NewArduinoSCTProjectWizard extends TemplateWizard {
29 |
30 | private WizardNewProjectCreationPage projectCreationPage;
31 |
32 | private ArduinoSCTWizardPage arduinoSCTWizardPage;
33 |
34 | private ArduinoSCTProjectGenerator generator;
35 |
36 | /**
37 | * @see org.eclipse.jface.wizard.Wizard#addPages()
38 | */
39 | @Override
40 | public void addPages() {
41 | this.projectCreationPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
42 | @Override
43 | public void createControl(final Composite parent) {
44 | super.createControl(parent);
45 | createWorkingSetGroup((Composite) getControl(), getSelection(),
46 | new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
47 | Dialog.applyDialogFont(getControl());
48 | }
49 | };
50 | this.projectCreationPage.setTitle(Messages.NewArduinoSCTProjectWizard_title);
51 | this.projectCreationPage.setDescription(Messages.NewArduinoSCTProjectWizard_description);
52 |
53 | this.arduinoSCTWizardPage = new ArduinoSCTWizardPage();
54 | this.arduinoSCTWizardPage.setTitle(Messages.NewArduinoSCTProjectWizard_title);
55 |
56 | addPage(this.projectCreationPage);
57 | addPage(this.arduinoSCTWizardPage);
58 | }
59 |
60 | /**
61 | * @see org.eclipse.tools.templates.ui.TemplateWizard#getGenerator()
62 | */
63 | @Override
64 | protected IGenerator getGenerator() {
65 | this.generator = new ArduinoSCTProjectGenerator("templates/arduino_sgen/manifest.xml", //$NON-NLS-1$
66 | this.projectCreationPage.getProjectName());
67 | this.generator.setStatechartName(this.arduinoSCTWizardPage.getStatechartName());
68 | this.generator.setSrcFolder(this.arduinoSCTWizardPage.getSrcFolderName());
69 | this.generator.setSrcGenFolder(this.arduinoSCTWizardPage.getSrcGenFolderName());
70 | this.generator.setCyclePeriod(this.arduinoSCTWizardPage.getCyclePeriod());
71 | this.generator.setTimer(this.arduinoSCTWizardPage.getTimer());
72 |
73 | if (!this.projectCreationPage.useDefaults()) {
74 | this.generator.setLocationURI(this.projectCreationPage.getLocationURI());
75 | }
76 |
77 | return this.generator;
78 | }
79 |
80 | /**
81 | * @see org.eclipse.tools.templates.ui.TemplateWizard#performFinish()
82 | */
83 | @Override
84 | public boolean performFinish() {
85 | final boolean finished = super.performFinish();
86 |
87 | if (finished) {
88 | final IWorkbench workbench = getWorkbench();
89 | final IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
90 | final IWorkbenchPage page = workbenchWindow.getActivePage();
91 | final IFile file = this.generator.getDiagramFile();
92 | final IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
93 |
94 | try {
95 | page.openEditor(new FileEditorInput(file), desc.getId());
96 | } catch (final PartInitException exception) {
97 | SCTArduinoUIPlugin.logError(exception);
98 | }
99 |
100 | try {
101 | workbench.showPerspective(CUIPlugin.ID_CPERSPECTIVE, workbenchWindow);
102 | workbench.showPerspective(IYakinduSctPerspectives.ID_PERSPECTIVE_SCT_MODELING, workbenchWindow);
103 | } catch (final WorkbenchException exception) {
104 | SCTArduinoUIPlugin.logError(exception);
105 | }
106 | }
107 |
108 | return finished;
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/src/org/yakindu/sct/arduino/ui/wizards/messages.properties:
--------------------------------------------------------------------------------
1 | ArduinoSCTProjectGenerator_creatingDiagram=Creating diagram file ...
2 | ArduinoSCTWizardPage_architectureLabel=Architecture:
3 | ArduinoSCTWizardPage_cyclePeriodLabel=Cycle Period (ms):
4 | ArduinoSCTWizardPage_cyclePeriodNotInIntervalMessage=The cycle period must be between %d and %d
5 | ArduinoSCTWizardPage_cyclePeriodToolTip=The period of the cycle the statechart runs with (given in milliseconds).
6 | ArduinoSCTWizardPage_description=Specify the properties of the Arduino SCT project.
7 | ArduinoSCTWizardPage_genSrcFolderLabel=Generated Source Folder:
8 | ArduinoSCTWizardPage_invalidCyclePeriodMessage=The cycle period must be a valid natural number.
9 | ArduinoSCTWizardPage_missingStatechartNameMessage=Please provide a name for the statechart.
10 | ArduinoSCTWizardPage_srcFolderLabel=Source Folder:
11 | ArduinoSCTWizardPage_statechartLabel=Statechart Name:
12 | ArduinoSCTWizardPage_timerImplLabel=Timer Implementation:
13 | ArduinoSCTWizardPage_timerLabel=Timer:
14 | NewArduinoSCTProjectWizard_description=Specify name and working set of the new Arduino SCT project.
15 | NewArduinoSCTProjectWizard_title=New Arduino SCT Project
16 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/templates/arduino_sgen/arduino_sgen.template:
--------------------------------------------------------------------------------
1 | GeneratorModel for yakindu::arduino_cpp {
2 |
3 | statechart ${statechartName} {
4 |
5 | feature LicenseHeader {
6 | licenseText = "Generated by YAKINDU Statechart Tools for Arduino v0.9.0"
7 | }
8 |
9 | feature Outlet {
10 | targetProject = "${projectName}"
11 | targetFolder = "${srcGenFolder}"
12 | }
13 |
14 | feature Arduino {
15 | userSrcFolder = "${srcFolder}"
16 | timer = "${timer}"
17 | cyclePeriod = ${cyclePeriod}
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.arduino.ui/templates/arduino_sgen/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /target/
3 | /.META-INF_MANIFEST.MF
4 | /.polyglot..META-INF_MANIFEST.MF
5 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.editor.sgen
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
3 | formatter_profile=_arduino_cdt
4 | formatter_settings_version=12
5 | sp_cleanup.add_default_serial_version_id=true
6 | sp_cleanup.add_generated_serial_version_id=false
7 | sp_cleanup.add_missing_annotations=true
8 | sp_cleanup.add_missing_deprecated_annotations=true
9 | sp_cleanup.add_missing_methods=false
10 | sp_cleanup.add_missing_nls_tags=false
11 | sp_cleanup.add_missing_override_annotations=true
12 | sp_cleanup.add_missing_override_annotations_interface_methods=true
13 | sp_cleanup.add_serial_version_id=false
14 | sp_cleanup.always_use_blocks=true
15 | sp_cleanup.always_use_parentheses_in_expressions=true
16 | sp_cleanup.always_use_this_for_non_static_field_access=true
17 | sp_cleanup.always_use_this_for_non_static_method_access=false
18 | sp_cleanup.convert_functional_interfaces=false
19 | sp_cleanup.convert_to_enhanced_for_loop=false
20 | sp_cleanup.correct_indentation=true
21 | sp_cleanup.format_source_code=true
22 | sp_cleanup.format_source_code_changes_only=false
23 | sp_cleanup.insert_inferred_type_arguments=false
24 | sp_cleanup.make_local_variable_final=true
25 | sp_cleanup.make_parameters_final=true
26 | sp_cleanup.make_private_fields_final=true
27 | sp_cleanup.make_type_abstract_if_missing_method=false
28 | sp_cleanup.make_variable_declarations_final=true
29 | sp_cleanup.never_use_blocks=false
30 | sp_cleanup.never_use_parentheses_in_expressions=false
31 | sp_cleanup.on_save_use_additional_actions=true
32 | sp_cleanup.organize_imports=true
33 | sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
34 | sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
35 | sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
36 | sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
37 | sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
38 | sp_cleanup.remove_private_constructors=true
39 | sp_cleanup.remove_redundant_type_arguments=false
40 | sp_cleanup.remove_trailing_whitespaces=true
41 | sp_cleanup.remove_trailing_whitespaces_all=true
42 | sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
43 | sp_cleanup.remove_unnecessary_casts=true
44 | sp_cleanup.remove_unnecessary_nls_tags=true
45 | sp_cleanup.remove_unused_imports=true
46 | sp_cleanup.remove_unused_local_variables=false
47 | sp_cleanup.remove_unused_private_fields=true
48 | sp_cleanup.remove_unused_private_members=false
49 | sp_cleanup.remove_unused_private_methods=true
50 | sp_cleanup.remove_unused_private_types=true
51 | sp_cleanup.sort_members=false
52 | sp_cleanup.sort_members_all=false
53 | sp_cleanup.use_anonymous_class_creation=false
54 | sp_cleanup.use_blocks=true
55 | sp_cleanup.use_blocks_only_for_return_and_throw=false
56 | sp_cleanup.use_lambda=true
57 | sp_cleanup.use_parentheses_in_expressions=true
58 | sp_cleanup.use_this_for_non_static_field_access=true
59 | sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
60 | sp_cleanup.use_this_for_non_static_method_access=true
61 | sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
62 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: YAKINDU SCT SGen Multi Page Editor
4 | Bundle-SymbolicName: org.yakindu.sct.editor.sgen;singleton:=true
5 | Bundle-Version: 0.10.0.qualifier
6 | Bundle-Activator: org.yakindu.sct.editor.sgen.SGenEditorUIPlugin
7 | Bundle-Vendor: Lothar Wendehals
8 | Require-Bundle: org.eclipse.core.runtime,
9 | org.eclipse.ui,
10 | org.eclipse.ui.editors,
11 | org.eclipse.ui.forms,
12 | org.eclipse.ui.ide,
13 | org.yakindu.sct.model.sgen,
14 | org.eclipse.xtext.ui,
15 | org.yakindu.sct.generator.builder,
16 | org.yakindu.sct.generator.core,
17 | org.yakindu.sct.generator.genmodel.ui
18 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8
19 | Bundle-ActivationPolicy: lazy
20 | Export-Package: org.yakindu.sct.editor.sgen,
21 | org.yakindu.sct.editor.sgen.extensions
22 | Automatic-Module-Name: org.yakindu.sct.editor.sgen
23 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .,\
5 | icons/,\
6 | plugin.xml
7 | src.includes = icons/
8 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/icons/GeneratorModel.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wendehals/arduino_sct_tools/da3e10f022a13a910dbb660ab131a7cd085cd656/plugins/org.yakindu.sct.editor.sgen/icons/GeneratorModel.gif
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
14 |
15 |
16 |
18 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/schema/featureConfigurationSections.exsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | [Enter description of this extension point.]
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | [Enter the first release in which this extension point appears.]
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | [Enter extension point usage example here.]
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | [Enter API information here.]
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | [Enter information about supplied implementation of this extension point.]
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/AbstractFeatureConfigurationSection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen;
10 |
11 | import org.yakindu.sct.editor.sgen.extensions.IFeatureConfigurationSection;
12 | import org.yakindu.sct.model.sgen.FeatureType;
13 |
14 | public abstract class AbstractFeatureConfigurationSection implements IFeatureConfigurationSection {
15 |
16 | protected static final String CAMEL_CASE_PATTERN = "(? 1) {
54 | builder.append(splitName[0].substring(1));
55 | }
56 |
57 | for (int i = 1; i < splitName.length; i++) {
58 | builder.append(" ").append(splitName[i]); //$NON-NLS-1$
59 | }
60 |
61 | if (mandatory) {
62 | builder.append(ASTERISK);
63 | }
64 |
65 | return builder.toString();
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/Messages.java:
--------------------------------------------------------------------------------
1 | package org.yakindu.sct.editor.sgen;
2 |
3 | import org.eclipse.osgi.util.NLS;
4 |
5 | public class Messages extends NLS {
6 |
7 | private static final String BUNDLE_NAME = "org.yakindu.sct.editor.sgen.messages"; //$NON-NLS-1$
8 |
9 | public static String SGenMultiPageEditor_generateActionTooltip;
10 | public static String SGenMultiPageEditor_sourcePageText;
11 | public static String GeneratorEntryFormPage_formPageHeaderPrefix;
12 |
13 | static {
14 | // initialize resource bundle
15 | NLS.initializeMessages(BUNDLE_NAME, Messages.class);
16 | }
17 |
18 | private Messages() {
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/SGenEditorUIExecutableExtensionFactory.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen;
10 |
11 | import org.osgi.framework.Bundle;
12 | import org.yakindu.sct.generator.genmodel.ui.SGenExecutableExtensionFactory;
13 |
14 | public class SGenEditorUIExecutableExtensionFactory extends SGenExecutableExtensionFactory {
15 |
16 | /**
17 | * @see org.yakindu.sct.generator.genmodel.ui.SGenExecutableExtensionFactory#getBundle()
18 | */
19 | @Override
20 | protected Bundle getBundle() {
21 | return SGenEditorUIPlugin.getDefault().getBundle();
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/SGenEditorUIImages.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen;
10 |
11 | import org.eclipse.jface.resource.ImageDescriptor;
12 | import org.eclipse.jface.resource.ImageRegistry;
13 | import org.eclipse.swt.graphics.Image;
14 |
15 | /**
16 | * Image registry to provide shared images.
17 | *
18 | * @author Lothar Wendehals
19 | */
20 | public enum SGenEditorUIImages {
21 |
22 | GENERATOR_MODEL("icons/GeneratorModel.gif"); //$NON-NLS-1$
23 |
24 | private final String path;
25 |
26 | private SGenEditorUIImages(final String path) {
27 | this.path = path;
28 | }
29 |
30 | /**
31 | * Returns an image. Clients do not need to dispose the image, it will be disposed automatically.
32 | *
33 | * @return an {@link Image}
34 | */
35 | public Image image() {
36 | final ImageRegistry imageRegistry = SGenEditorUIPlugin.getDefault().getImageRegistry();
37 | Image image = imageRegistry.get(this.path);
38 | if (image == null) {
39 | addImageDescriptor();
40 | image = imageRegistry.get(this.path);
41 | }
42 |
43 | return image;
44 | }
45 |
46 | /**
47 | * Returns an image descriptor.
48 | *
49 | * @return an {@link ImageDescriptor}
50 | */
51 | public ImageDescriptor descriptor() {
52 | final ImageRegistry imageRegistry = SGenEditorUIPlugin.getDefault().getImageRegistry();
53 | ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(this.path);
54 | if (imageDescriptor == null) {
55 | addImageDescriptor();
56 | imageDescriptor = imageRegistry.getDescriptor(this.path);
57 | }
58 |
59 | return imageDescriptor;
60 | }
61 |
62 | private void addImageDescriptor() {
63 | final SGenEditorUIPlugin plugin = SGenEditorUIPlugin.getDefault();
64 | final ImageDescriptor id = ImageDescriptor.createFromURL(plugin.getBundle().getEntry(this.path));
65 | plugin.getImageRegistry().put(this.path, id);
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/SGenEditorUIPlugin.java:
--------------------------------------------------------------------------------
1 | package org.yakindu.sct.editor.sgen;
2 |
3 | import org.eclipse.core.runtime.IStatus;
4 | import org.eclipse.core.runtime.Status;
5 | import org.eclipse.ui.plugin.AbstractUIPlugin;
6 | import org.osgi.framework.BundleContext;
7 |
8 | /**
9 | * The activator class controls the plug-in life cycle
10 | */
11 | public class SGenEditorUIPlugin extends AbstractUIPlugin {
12 |
13 | /**
14 | * The shared instance
15 | */
16 | private static SGenEditorUIPlugin plugin;
17 |
18 | /**
19 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
20 | */
21 | @Override
22 | public void start(final BundleContext context) throws Exception {
23 | super.start(context);
24 | plugin = this;
25 | }
26 |
27 | /**
28 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
29 | */
30 | @Override
31 | public void stop(final BundleContext context) throws Exception {
32 | plugin = null;
33 | super.stop(context);
34 | }
35 |
36 | /**
37 | * Returns the shared instance
38 | *
39 | * @return the shared instance
40 | */
41 | public static SGenEditorUIPlugin getDefault() {
42 | return plugin;
43 | }
44 |
45 | /**
46 | * @return the plugin's id.
47 | */
48 | public static String getPluginId() {
49 | return plugin.getBundle().getSymbolicName();
50 | }
51 |
52 | /**
53 | * Logs an exception.
54 | *
55 | * @param exception
56 | * the exception that caused that error.
57 | * @return the {@link IStatus} that was logged.
58 | */
59 | public static IStatus logError(final Throwable exception) {
60 | final Status status = new Status(IStatus.ERROR, getPluginId(), exception.getLocalizedMessage(), exception);
61 | plugin.getLog().log(status);
62 |
63 | return status;
64 | }
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/SGenMultiPageEditorContributor.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen;
10 |
11 | import org.eclipse.jface.action.IAction;
12 | import org.eclipse.ui.IActionBars;
13 | import org.eclipse.ui.IEditorPart;
14 | import org.eclipse.ui.actions.ActionFactory;
15 | import org.eclipse.ui.ide.IDEActionFactory;
16 | import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
17 | import org.eclipse.ui.texteditor.ITextEditor;
18 | import org.eclipse.ui.texteditor.ITextEditorActionConstants;
19 |
20 | public class SGenMultiPageEditorContributor extends MultiPageEditorActionBarContributor {
21 |
22 | private IEditorPart activeEditorPart;
23 |
24 | /**
25 | * Creates a multi-page contributor.
26 | */
27 | public SGenMultiPageEditorContributor() {
28 | super();
29 | }
30 |
31 | /**
32 | * Returns the action registed with the given text editor.
33 | *
34 | * @return IAction or null if editor is null.
35 | */
36 | protected IAction getAction(ITextEditor editor, String actionID) {
37 | return (editor == null ? null : editor.getAction(actionID));
38 | }
39 |
40 | /**
41 | * @see org.eclipse.ui.part.MultiPageEditorActionBarContributor#setActivePage(org.eclipse.ui.IEditorPart)
42 | */
43 | @Override
44 | public void setActivePage(IEditorPart part) {
45 | if (this.activeEditorPart == part) {
46 | return;
47 | }
48 |
49 | this.activeEditorPart = part;
50 |
51 | final IActionBars actionBars = getActionBars();
52 | if (actionBars != null) {
53 | final ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
54 | actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
55 | getAction(editor, ITextEditorActionConstants.DELETE));
56 | actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
57 | getAction(editor, ITextEditorActionConstants.UNDO));
58 | actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
59 | getAction(editor, ITextEditorActionConstants.REDO));
60 | actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),
61 | getAction(editor, ITextEditorActionConstants.CUT));
62 | actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
63 | getAction(editor, ITextEditorActionConstants.COPY));
64 | actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
65 | getAction(editor, ITextEditorActionConstants.PASTE));
66 | actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
67 | getAction(editor, ITextEditorActionConstants.SELECT_ALL));
68 | actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(),
69 | getAction(editor, ITextEditorActionConstants.FIND));
70 | actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(),
71 | getAction(editor, IDEActionFactory.BOOKMARK.getId()));
72 | actionBars.updateActionBars();
73 | }
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/extensions/FeatureConfigurationSectionsExtension.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen.extensions;
10 |
11 | import java.util.Collections;
12 | import java.util.HashMap;
13 | import java.util.Map;
14 |
15 | import org.eclipse.core.runtime.CoreException;
16 | import org.eclipse.core.runtime.IConfigurationElement;
17 | import org.eclipse.core.runtime.IExtension;
18 | import org.eclipse.core.runtime.IExtensionPoint;
19 | import org.eclipse.core.runtime.Platform;
20 | import org.yakindu.sct.editor.sgen.SGenEditorUIPlugin;
21 | import org.yakindu.sct.model.sgen.FeatureType;
22 |
23 | public class FeatureConfigurationSectionsExtension {
24 |
25 | private static final String FEATURE_CONFIGURATION_SECTIONS_EXTENSION = "featureConfigurationSections"; //$NON-NLS-1$
26 |
27 | private static final String FEATURE_CONFIGURATION_SECTION_ELEMENT = "featureConfigurationSection"; //$NON-NLS-1$
28 |
29 | private static final String FEATURE_TYPE_ATTRIBUTE = "featureType"; //$NON-NLS-1$
30 |
31 | private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
32 |
33 | private static Map featureConfigurationSections;
34 |
35 | /**
36 | * @return a mapping of {@link FeatureType} names to {@link IFeatureConfigurationSection}s.
37 | */
38 | public static Map getFeatureConfigurationSections() {
39 | if (featureConfigurationSections == null) {
40 | featureConfigurationSections = new HashMap<>();
41 |
42 | final IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
43 | .getExtensionPoint(SGenEditorUIPlugin.getPluginId(), FEATURE_CONFIGURATION_SECTIONS_EXTENSION);
44 | if (extensionPoint != null) {
45 | for (final IExtension extension : extensionPoint.getExtensions()) {
46 | for (final IConfigurationElement element : extension.getConfigurationElements()) {
47 | if (FEATURE_CONFIGURATION_SECTION_ELEMENT.equals(element.getName())) {
48 | final String featureType = element.getAttribute(FEATURE_TYPE_ATTRIBUTE);
49 |
50 | try {
51 | final IFeatureConfigurationSection featureConfigurationSection = (IFeatureConfigurationSection) element
52 | .createExecutableExtension(CLASS_ATTRIBUTE);
53 | featureConfigurationSections.put(featureType, featureConfigurationSection);
54 | } catch (final CoreException exception) {
55 | SGenEditorUIPlugin.logError(exception);
56 | }
57 | }
58 | }
59 | }
60 | }
61 | }
62 |
63 | return Collections.unmodifiableMap(featureConfigurationSections);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/extensions/IFeatureConfigurationSection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen.extensions;
10 |
11 | import org.eclipse.swt.widgets.Composite;
12 | import org.eclipse.ui.forms.widgets.FormToolkit;
13 | import org.eclipse.ui.forms.widgets.Section;
14 | import org.eclipse.xtext.ui.editor.model.IXtextDocument;
15 | import org.yakindu.sct.editor.sgen.GeneratorEntryFormPage;
16 | import org.yakindu.sct.model.sgen.FeatureType;
17 |
18 | public interface IFeatureConfigurationSection {
19 |
20 | static final char ASTERISK = '\u002A';
21 |
22 | void initialize(GeneratorEntryFormPage formPage, FeatureType featureType);
23 |
24 | Section createSection(final FormToolkit toolkit, final Composite parent);
25 |
26 | void modelChanged(IXtextDocument xtextDocument);
27 |
28 | void dispose();
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/extensions/LicenseHeaderFeatureConfigurationSection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 by Lothar Wendehals.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License v1.0
6 | * which accompanies this distribution, and is available at
7 | * http://www.eclipse.org/legal/epl-v10.html
8 | */
9 | package org.yakindu.sct.editor.sgen.extensions;
10 |
11 | import org.eclipse.swt.SWT;
12 | import org.eclipse.swt.events.FocusEvent;
13 | import org.eclipse.swt.events.FocusListener;
14 | import org.eclipse.swt.widgets.Composite;
15 | import org.eclipse.swt.widgets.Label;
16 | import org.eclipse.swt.widgets.Text;
17 | import org.eclipse.ui.forms.widgets.ExpandableComposite;
18 | import org.eclipse.ui.forms.widgets.FormToolkit;
19 | import org.eclipse.ui.forms.widgets.Section;
20 | import org.eclipse.ui.forms.widgets.TableWrapData;
21 | import org.eclipse.ui.forms.widgets.TableWrapLayout;
22 | import org.eclipse.xtext.resource.XtextResource;
23 | import org.eclipse.xtext.ui.editor.model.IXtextDocument;
24 | import org.eclipse.xtext.util.concurrent.IUnitOfWork;
25 | import org.yakindu.sct.editor.sgen.AbstractFeatureConfigurationSection;
26 | import org.yakindu.sct.editor.sgen.SGenModelUtil;
27 | import org.yakindu.sct.model.sgen.FeatureConfiguration;
28 | import org.yakindu.sct.model.sgen.FeatureParameter;
29 | import org.yakindu.sct.model.sgen.FeatureType;
30 |
31 | public class LicenseHeaderFeatureConfigurationSection extends AbstractFeatureConfigurationSection
32 | implements FocusListener {
33 |
34 | protected Section section;
35 |
36 | protected Text licenseText;
37 |
38 | private boolean mutex;
39 |
40 | /**
41 | * @see org.yakindu.sct.editor.sgen.extensions.IFeatureConfigurationSection#createSection(org.eclipse.ui.forms.widgets.FormToolkit,
42 | * org.eclipse.swt.widgets.Composite)
43 | */
44 | @Override
45 | public Section createSection(final FormToolkit toolkit, final Composite parent) {
46 | this.section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
47 | this.section.setText(convertCamelCaseName(getFeatureType().getName(), !getFeatureType().isOptional()));
48 | this.section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB));
49 |
50 | final Composite composite = toolkit.createComposite(this.section);
51 | final TableWrapLayout layout = new TableWrapLayout();
52 | layout.numColumns = 2;
53 | composite.setLayout(layout);
54 |
55 | final FeatureParameter parameter = SGenModelUtil.getFeatureParameter(getFeatureType(), "licenseText"); //$NON-NLS-1$
56 |
57 | final Label label = toolkit.createLabel(composite,
58 | convertCamelCaseName(parameter.getName(), !parameter.isOptional()) + ':');
59 | label.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.FILL));
60 |
61 | this.licenseText = toolkit.createText(composite, "", SWT.SINGLE | SWT.MULTI | SWT.WRAP | SWT.BORDER); //$NON-NLS-1$
62 | final TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL);
63 | layoutData.heightHint = 5 * this.licenseText.getLineHeight();
64 | this.licenseText.setLayoutData(layoutData);
65 | this.licenseText.addFocusListener(this);
66 | this.licenseText.setData(parameter);
67 |
68 | this.section.setClient(composite);
69 |
70 | return this.section;
71 | }
72 |
73 | /**
74 | * @see org.yakindu.sct.editor.sgen.extensions.IFeatureConfigurationSection#modelChanged(org.eclipse.xtext.ui.editor.model.IXtextDocument)
75 | */
76 | @Override
77 | public void modelChanged(final IXtextDocument xtextDocument) {
78 | if (!this.mutex) {
79 | this.mutex = true;
80 |
81 | final String statechartName = getFormPage().getStatechartName();
82 | final FeatureType featureType = getFeatureType();
83 |
84 | xtextDocument.readOnly(new IUnitOfWork.Void() {
85 | /**
86 | * @see org.eclipse.xtext.util.concurrent.IUnitOfWork.Void#process(java.lang.Object)
87 | */
88 | @Override
89 | public void process(final XtextResource resource) throws Exception {
90 | final FeatureConfiguration featureConfiguration = SGenModelUtil.getFeatureConfiguration(resource,
91 | statechartName, featureType);
92 | if (featureConfiguration == null) {
93 | LicenseHeaderFeatureConfigurationSection.this.section.setExpanded(false);
94 |
95 | LicenseHeaderFeatureConfigurationSection.this.licenseText.setText(""); //$NON-NLS-1$
96 | } else {
97 | LicenseHeaderFeatureConfigurationSection.this.section.setExpanded(true);
98 |
99 | final String value = SGenModelUtil.getStringParameterValue(resource, statechartName,
100 | (FeatureParameter) LicenseHeaderFeatureConfigurationSection.this.licenseText.getData());
101 | LicenseHeaderFeatureConfigurationSection.this.licenseText.setText(value);
102 | }
103 | }
104 | });
105 |
106 | this.mutex = false;
107 | }
108 | }
109 |
110 | /**
111 | * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
112 | */
113 | @Override
114 | public void focusGained(final FocusEvent e) {
115 | // nothing to do
116 | }
117 |
118 | /**
119 | * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
120 | */
121 | @Override
122 | public void focusLost(final FocusEvent event) {
123 | if (!this.mutex) {
124 | this.mutex = true;
125 |
126 | final Text text = (Text) event.getSource();
127 | final FeatureParameter parameter = (FeatureParameter) text.getData();
128 | getFormPage().updateModel(parameter, text.getText());
129 |
130 | this.mutex = false;
131 | }
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/plugins/org.yakindu.sct.editor.sgen/src/org/yakindu/sct/editor/sgen/messages.properties:
--------------------------------------------------------------------------------
1 | SGenMultiPageEditor_generateActionTooltip=Generate Code Artifacts
2 | SGenMultiPageEditor_sourcePageText=Generator Model
3 | GeneratorEntryFormPage_formPageHeaderPrefix=Generator Model for Statechart
4 |
--------------------------------------------------------------------------------
/plugins/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 | org.yakindu.sct.arduino
7 | plugins
8 | 0.10.0-SNAPSHOT
9 |
10 | pom
11 |
12 |
13 | org.yakindu.sct.arduino
14 | root
15 | 0.10.0-SNAPSHOT
16 |
17 |
18 |
19 | org.yakindu.sct.arduino.examples
20 | org.yakindu.sct.arduino.generator.cpp
21 | org.yakindu.sct.arduino.help
22 | org.yakindu.sct.arduino.ui
23 | org.yakindu.sct.editor.sgen
24 |
25 |
26 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 | org.yakindu.sct.arduino
7 | root
8 | 0.10.0-SNAPSHOT
9 |
10 | pom
11 |
12 |
13 | org.yakindu.sct.arduino
14 | org.yakindu.sct.arduino.config
15 | 0.10.0-SNAPSHOT
16 | ./releng/org.yakindu.sct.arduino.config
17 |
18 |
19 |
20 | features
21 | plugins
22 | releng
23 |
24 |
25 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.config/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.releng
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.config/Build.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.config/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 4.0.0
6 |
7 | org.yakindu.sct.arduino
8 | org.yakindu.sct.arduino.config
9 | 0.10.0-SNAPSHOT
10 |
11 | pom
12 |
13 | https://github.com/wendehals/arduino_sct_tools
14 | YAKINDU Statechart Tools for Arduino
15 |
16 |
17 | 1.5.1
18 | 3.0.0
19 | 1.4.0
20 | 2.19.0
21 | 3.1.0
22 |
23 | UTF-8
24 | UTF-8
25 |
26 |
27 |
28 |
29 | jboss-public-repository-group
30 | JBoss Public Repository Group
31 | http://repository.jboss.org/nexus/content/groups/public/
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | org.eclipse.tycho
40 | tycho-packaging-plugin
41 | ${tycho.version}
42 |
43 |
44 |
45 | org.eclipse.tycho.extras
46 | tycho-buildtimestamp-jgit
47 | ${tycho.version}
48 |
49 |
50 |
51 |
52 | jgit
53 | pom.xml
54 | ignore
55 |
56 |
57 |
58 |
59 | org.apache.maven.plugins
60 | maven-clean-plugin
61 | ${maven-clean-plugin.version}
62 |
63 |
64 |
65 |
66 | ${basedir}/xtend-gen
67 |
68 | **/*
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | org.eclipse.xtend
77 | xtend-maven-plugin
78 | ${xtextVersion}
79 |
80 |
81 |
82 |
83 | compile
84 | testCompile
85 |
86 |
87 |
88 |
89 |
90 | ${basedir}/xtend-gen
91 | ${basedir}/xtend-gen
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | org.eclipse.tycho
101 | tycho-maven-plugin
102 | ${tycho.version}
103 |
104 | true
105 |
106 |
107 |
108 | org.eclipse.tycho
109 | target-platform-configuration
110 | ${tycho.version}
111 |
112 |
113 |
114 |
115 | org.yakindu.sct.arduino
116 | org.yakindu.sct.arduino.target
117 | 0.10.0-SNAPSHOT
118 | 2019-06
119 |
120 |
121 |
122 |
123 |
124 | win32
125 | win32
126 | x86_64
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.ide.setup/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.ide.setup
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.ide.setup/IoT-IDE.setup:
--------------------------------------------------------------------------------
1 |
2 |
10 |
12 |
14 | http://www.eclipse.org/downloads/images/oomph-42x42.png
15 |
16 |
18 | eclipse
19 |
20 |
22 | Eclipse
23 |
24 |
26 | https://wendehals.github.io/arduino_sct_tools/
27 |
28 |
29 |
33 |
38 |
43 |
46 |
49 |
51 |
54 |
56 |
58 |
60 |
62 |
64 |
67 |
70 |
73 |
75 |
77 |
79 |
81 |
83 |
85 |
87 |
89 |
91 |
93 |
94 | YAKINDU Statechart Tools for Arduino
95 |
96 | YAKINDU Statechart Tools for Arduino lets you program your Arduino with statecharts.
97 |
98 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.ide.setup/SCTArduinoIDE.setup:
--------------------------------------------------------------------------------
1 |
2 |
10 |
12 |
14 | http://www.eclipse.org/downloads/images/oomph-42x42.png
15 |
16 |
18 | eclipse
19 |
20 |
22 | Eclipse
23 |
24 |
26 | https://wendehals.github.io/arduino_sct_tools/
27 |
28 |
29 |
33 |
38 |
43 |
46 |
49 |
51 |
54 |
56 |
58 |
60 |
63 |
66 |
69 |
72 |
75 |
78 |
80 |
82 |
84 |
86 |
88 |
89 | YAKINDU Statechart Tools for Arduino
90 |
91 | YAKINDU Statechart Tools for Arduino lets you program your Arduino with statecharts.
92 |
93 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.p2repo/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.p2repo/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.p2repo
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.pde.UpdateSiteBuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.pde.UpdateSiteNature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.p2repo/category.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Here you can find Arduino support for the YAKINDU Statechart Tools.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.p2repo/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 4.0.0
6 |
7 | org.yakindu.sct.arduino
8 | org.yakindu.sct.arduino.p2repo
9 | 0.10.0-SNAPSHOT
10 |
11 | eclipse-repository
12 |
13 |
14 | org.yakindu.sct.arduino
15 | releng
16 | 0.10.0-SNAPSHOT
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.tycho
23 | tycho-p2-repository-plugin
24 | ${tycho.version}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | org.eclipse.tycho
33 | tycho-p2-director-plugin
34 | ${tycho.version}
35 |
36 |
37 |
38 | materialize-products
39 |
40 | materialize-products
41 |
42 |
43 |
44 |
45 | archive-products
46 |
47 | archive-products
48 |
49 |
50 |
51 |
52 |
53 |
54 | org.jboss.tools.tycho-plugins
55 | repository-utils
56 | ${org.jboss.tools.tycho-plugins.version}
57 |
58 |
59 |
60 | generate-facade
61 | package
62 |
63 |
64 | generate-repository-facade
65 |
66 |
67 |
68 | siteTemplate
69 |
70 |
71 |
72 | ${project.parent.name}
73 | 2019-06 (4.12)
74 |
75 |
76 |
77 | http://download.eclipse.org/releases/2019-06
78 | http://download.eclipse.org/eclipse/updates/4.12
79 | http://download.eclipse.org/cbi/updates/license
80 | http://download.eclipse.org/tools/cdt/releases/9.8
81 | http://updates.yakindu.org/sct/releases
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.p2repo/siteTemplate/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${update.site.name} Update Site
4 |
5 |
6 |
7 |
8 | ${update.site.name} - Use this URL in Eclipse to install ${update.site.name}
9 |
10 | This is the Update Site for ${update.site.name}.
11 |
12 | - To install ${update.site.name} from this site, start up Eclipse ${target.eclipse.version}, then do:
13 |
Help > Install New Software... >
14 |
15 | - Copy this site's URL into Eclipse, and hit Enter.
16 | - When the site loads, select the features to install, or click the
Select All
button.
17 | - To properly resolve all dependencies, check
18 |
[x] Contact all update sites during install to find required software
19 | - Click
Next
, agree to the license terms, and install.
20 |
21 |
22 |
23 | ${site.contents}
24 |
25 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.target/.gitignore:
--------------------------------------------------------------------------------
1 | *generated.target
2 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.target/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.yakindu.sct.arduino.target
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.target/2019-06.target:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/releng/org.yakindu.sct.arduino.target/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 4.0.0
6 |
7 | org.yakindu.sct.arduino
8 | org.yakindu.sct.arduino.target
9 | 0.10.0-SNAPSHOT
10 |
11 | pom
12 |
13 |
14 | org.yakindu.sct.arduino
15 | releng
16 | 0.10.0-SNAPSHOT
17 |
18 |
19 |
20 |
21 |
22 |
23 | org.codehaus.mojo
24 | build-helper-maven-plugin
25 | ${build-helper.version}
26 |
27 |
28 |
29 | attach-artifacts
30 | package
31 |
32 | attach-artifact
33 |
34 |
35 |
36 |
37 | 2019-06.target
38 | target
39 | 2019-06
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/releng/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 | org.yakindu.sct.arduino
7 | releng
8 | 0.10.0-SNAPSHOT
9 |
10 | pom
11 |
12 |
13 | org.yakindu.sct.arduino
14 | root
15 | 0.10.0-SNAPSHOT
16 |
17 |
18 |
19 | org.yakindu.sct.arduino.p2repo
20 | org.yakindu.sct.arduino.target
21 |
22 |
23 |
--------------------------------------------------------------------------------