From 7fc90d514ac4970a373bd772527020fa23efc138 Mon Sep 17 00:00:00 2001 From: Sterling Peet Date: Tue, 8 Sep 2020 16:05:53 -0400 Subject: [PATCH] Significant update to get docs in a usable state, pull in updates from the component template, and fix a handful of bugs. * Full revamp of documentation. * Pull in updates from the component template. * Fix active component definition. * Add selectable multi-platform support for the exerciser component. * Numerous spelling fixes. * Move from ``assembly`` to ``slug`` for deployment name. * Update template to use ``cookiecutter`` plugin ``slugify``. * Add ``.cookiecutterrc`` file to make regeneration of the template easier. * Fix bug where compiling without ``FW_OBJECT_NAMES == 1`` fails to provide a valid constructor, instead calling the Base component. * Fix component path definition to F Prime root. Closes #3, closes #4, and closes #5. --- CHANGELOG.rst | 2 +- README.rst | 117 ++++++++++++++---- cookiecutter.json | 19 +-- hooks/post_gen_project.py | 33 +++-- .../.cookiecutterrc | 20 +++ .../CMakeLists.txt | 2 +- .../Top/CMakeLists.txt | 16 +-- .../Top/Components.hpp | 19 ++- .../Top/Topology.cpp | 12 +- ...cutter.deployment_slug}}SchedContexts.hpp} | 16 +-- ...cutter.deployment_slug}}TopologyAppAi.xml} | 57 +++++---- .../CMakeLists.txt | 27 ++-- .../Makefile | 2 +- .../docs/sdd.md | 26 ++-- .../docs/{{cookiecutter.component_slug}}.md | 22 ++++ .../mod.mk | 18 +-- ...mon}}{{cookiecutter.component_suffix}}.cpp | 49 -------- ...kiecutter.component_slug}}ComponentAi.xml} | 11 +- ...{cookiecutter.component_impl_suffix}}.cpp} | 10 +- ...{{cookiecutter.component_impl_suffix}}.cpp | 27 ++++ ...{cookiecutter.component_impl_suffix}}.cpp} | 13 +- ...{{cookiecutter.component_impl_suffix}}.cpp | 63 ++++++++++ ...{cookiecutter.component_impl_suffix}}.hpp} | 24 ++-- 23 files changed, 377 insertions(+), 228 deletions(-) create mode 100644 {{cookiecutter.deployment_dir_name}}/.cookiecutterrc rename {{cookiecutter.deployment_dir_name}}/Top/{{{cookiecutter.deployment_assembly}}SchedContexts.hpp => {{cookiecutter.deployment_slug}}SchedContexts.hpp} (51%) rename {{cookiecutter.deployment_dir_name}}/Top/{{{cookiecutter.deployment_assembly}}TopologyAppAi.xml => {{cookiecutter.deployment_slug}}TopologyAppAi.xml} (57%) create mode 100644 {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/{{cookiecutter.component_slug}}.md delete mode 100644 {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp rename {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{{cookiecutter.component_name}}ComponentAi.xml => {{cookiecutter.component_slug}}ComponentAi.xml} (61%) rename {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp => {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}AVR{{cookiecutter.component_impl_suffix}}.cpp} (53%) create mode 100644 {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Arduino{{cookiecutter.component_impl_suffix}}.cpp rename {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp => {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp} (51%) create mode 100644 {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp rename {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp => {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp} (55%) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 924ddf1..8d6cba9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,7 +3,7 @@ Changelog Use cookiecutter's ``--checkout`` options to use a specific version. -v1.0 (2020-08-15) +v1.0 (2020-10-06) ----------------- * Initial Release diff --git a/README.rst b/README.rst index 1d44791..fe552e1 100644 --- a/README.rst +++ b/README.rst @@ -4,8 +4,6 @@ Cookiecutter: F Prime Component **WARNING:** The template is currently intended to support ATmega specific deployments, so if that is not your goal, the results may be somewhat unexpected. -**WARNING:** Beta version, the documentation is not up to date yet (working on it, but needed to crank out some test deployments internally. Sorry!). - Cookiecutter_ template for a `F Prime`_ deployment, to help with reducing the copy-pasta effect while creating new deployments. There are just enough pieces to remember to change/fix, that it is rather challenging to do without a template. So here is a template to fill in all the major adjustments, so you can spend time develping a deployment or writing a component instead of scratching your head over why you get weird errors. @@ -67,23 +65,71 @@ You will be asked for these fields: Can be set in your ``~/.cookiecutterrc`` config file. - * - ``component_name`` + * - ``deployment_display_name`` - .. code:: python "My Example" - - The printed name of this component for documentation and strings. It should be concise and convey the purpose of the component. + - The printed name of this deployment for documentation and strings. It should be concise and convey the purpose of the deployment. + + * - ``deployment_short_description`` + - .. code:: python + + "An example deployment [...]" + - One line description of the deployment's purpose (used in headers and comments). + + * - ``deployment_slug`` + - .. code:: python + + "MyExample" + - A slug_ is a simplified version of the ``deployment_name``, which will be used for the topology assembly name and file names within the deployment folder structure. It should be ``TitleCase`` with no spaces or special characters. + + * - ``deployment_dir_name`` + - .. code:: python + + "MyExample" + - This is the name of the deployment's main directory. The obvious choice is to use your ``deployment_slug`` for this field. + + * - ``deployment_path`` + - .. code:: python + + "example/path" + - This is the path from the F Prime root to the current directory, not including the deployment's folder. Do not add a ``/`` to the front or back of the path. + + * - ``path_to_fprime_root`` + - .. code:: python + + "../.." + - This is the path from the current directory to the F Prime root, not including the deployment's folder. Do not add a ``/`` to the front or back of the path. + + * - ``component_name`` + - .. code:: python + + "Led Blinker" + - The printed name of this exerciser component for documentation and strings. It should be concise and convey the purpose of the component. - * - ``short_description`` + * - ``component_short_description`` - .. code:: python "An example component [...]" - - One line description of the project (used in headers and comments). + - One line description of the project (used in headers and comments). This should describe the purpose of the component in the Imperetive Voice, not the context where the component is used. - * - ``component_class_name`` + * - ``component_slug`` - .. code:: python - "MyExampleComponent" - - The name of this component's class in the code. It should be ``CamelCase``. The autocoder requires the suffix ``Component`` to function properly. + "LedBlinker" + - A slug_ is a simplified version of the ``component_name``, which will be used for the class name and file names within the component folder structure. It should be ``TitleCase`` with no spaces or special characters. + + * - ``component_dir_name`` + - .. code:: python + + "LedBlinker" + - This is the name of the component's main directory. The obvious choice is to use your ``deployment_slug`` for this field. + + * - ``component_explicit_component_suffix`` + - .. code:: python + + "Component" + - The general convention is for F Prime components to have the ``Component`` suffix for file names and class names. While it is not required, the Autocoder will assume this format, and Autocoder provided templates may be more difficult to adapt if this is not selected. * - ``component_explicit_common`` - .. code:: python @@ -91,17 +137,17 @@ You will be asked for these fields: "" - If preferred, the cpp file with the common implementation code can be appended with the suffix ``Common``. - * - ``component_suffix`` + * - ``component_impl_suffix`` - .. code:: python - "" - - If preferred, the files and classes can be appended with the suffix ``Impl``. + "Impl" + - The general convention is for F Prime components to have the ``Impl`` suffix for file names and class names. While it is not required, the Autocoder will assume this format, and Autocoder provided templates may be more difficult to adapt if this is not selected. - * - ``component_path`` + * - ``component_path_to_fprime_root`` - .. code:: python - "Prjct/Grp" - - This is the path from the F Prime root to the current directory, not including the component's folder. + "../../.." + - This is the path from the current directory to the F Prime root, not including the components's folder. Do not add a ``/`` to the front or back of the path (this should auto-populate from the deployment path). * - ``component_namespace`` - .. code:: python @@ -112,8 +158,32 @@ You will be asked for these fields: * - ``component_kind`` - .. code:: python - "active" - - You can choose and active or passive component type. If you change your mind, is it set in the Autocoder input file. + "passive" + - You can choose and active or passive component type. If you change your mind, is it set in the Autocoder input file (and some of the component's port kinds may also affected). + + * - ``component_multiplatform_support`` + - .. code:: python + + "no" + - If you need different implementations of your component based on the target platform, choose ``yes`` to get additional support file templates. + + * - ``component_instance_name`` + - .. code:: python + + "ledblinker" + - This is the variable name given to the instantiation of your component in the topology. + + * - ``startup_arduino_delay_msec`` + - .. code:: python + + "2000" + - Startup delay during the deployment startup, so you can tell if you got the deployment into a boot loop. This is only available on the ``Arduino`` platform. + + * - ``startup_arduino_log_stream`` + - .. code:: python + + "Serial" + - This is the ``Arduino`` stream where the debug statements for the main deployment will print. * - ``license`` - .. code:: python @@ -127,9 +197,9 @@ You will be asked for these fields: What license to pick? https://choosealicense.com/ -You will still need to run ``fprime-util`` to generate the templates from your autocoder input file. +You should now have a basic deployment that can be compiled and run. -This requires your component to be included in a deployment. +If you want to add components to the deployment, you can do that next. This can be done by adding a line like this, near the bottom of the deployment's ``CMakeLists.txt`` file:: add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../Prjct/Grp/MyExample") @@ -137,14 +207,9 @@ This can be done by adding a line like this, near the bottom of the deployment's Then you need to (possibly purge) and generate the new cmake config in that deployment:: fprime-util generate + fprime-util build -Now you can edit your ``MyExampleComponentAi.xml`` file define the component to your liking, and generate the implementation boilerplate:: - - cd MyExample - fprime-util impl -b {path/to/your/deployment} - -Next, copy the ``-template`` code contents into your ``.hpp`` and ``.cpp`` files. -Try not to overwrite the freshly generated comments at the top! +Now you should be able to run the executable from the build folder. Changelog diff --git a/cookiecutter.json b/cookiecutter.json index 4516904..2a5c9e3 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -3,19 +3,22 @@ "email": "noreply@nospam.com", "deployment_display_name": "My Example", "dep_short_description": "Example deployment for F Prime FSW framework.", - "deployment_assembly": "{{ cookiecutter.deployment_display_name|replace(' ','')|replace('-','')|replace('_','') }}", - "deployment_dir_name": "{{ cookiecutter.deployment_assembly }}", + "deployment_slug": "{{ cookiecutter.deployment_display_name|slugify(separator='', lowercase=False) }}", + "deployment_dir_name": "{{ cookiecutter.deployment_slug }}", "deployment_path": "example/path", "path_to_fprime_root": "../..", - "component_display_name": "Led Blinker", + "component_name": "Led Blinker", "component_short_description": "Example component to support {{ cookiecutter.deployment_display_name }} deployment.", - "component_name": "{{ cookiecutter.component_display_name|replace(' ','')|replace('-','')|replace('_','') }}", - "component_dir_name": "{{ cookiecutter.component_name }}", + "component_slug": "{{ cookiecutter.component_name|slugify(separator='', lowercase=False) }}", + "component_dir_name": "{{ cookiecutter.component_slug }}", + "component_explicit_component_suffix": ["Component", ""], "component_explicit_common": ["", "Common"], - "component_suffix": ["", "Impl"], + "component_impl_suffix": ["", "Impl"], + "component_path_to_fprime_root": "{{ cookiecutter.path_to_fprime_root }}/..", "component_namespace": "{{ cookiecutter.deployment_path|replace('/','::')|replace('\\\\','::') }}", - "component_kind": ["active", "passive"], - "component_instance_name": "{{ cookiecutter.component_name|replace(' ','_')|replace('-','_') }}", + "component_kind": ["passive", "active"], + "component_multiplatform_support": ["no", "yes"], + "component_instance_name": "{{ cookiecutter.component_slug|lower }}", "startup_delay_msec": ["2000", "1000", "500", "0"], "startup_arduino_led_flash": ["yes", "no"], "arduino_log_stream": ["Serial", "Serial1", "Serial2", "Serial3"], diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 7f04b65..8e5c9c1 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,7 +1,7 @@ from __future__ import print_function import datetime -# import os +import os # import shutil # import subprocess # import sys @@ -29,6 +29,13 @@ def replace_contents(filename, what, replacement): replace_contents(join('{{ cookiecutter.component_dir_name }}', 'docs', 'sdd.md'), '', today.strftime("%m/%d/%Y")) replace_contents('README.md', '', today.strftime("%m/%d/%Y")) +{% if cookiecutter.component_multiplatform_support == "no" %} + mp_str = '{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{}{{cookiecutter.component_impl_suffix}}.cpp' + rm_list = ['Arduino', 'AVR', 'Linux'] + for i in rm_list: + os.unlink(mp_str.format(i)) +{% endif %} + # /{/% if cookiecutter.sphinx_docs == "no" %} # shutil.rmtree('docs') # /{/% endif %} @@ -53,29 +60,21 @@ def replace_contents(filename, what, replacement): ################################################################################ - You will still need to run `fprime-util` to generate the templates - from your autocoder input file. + You should now have a basic deployment that can be compiled and run. - This requires your component to be included in a deployment. This - can be done by adding a line like this, near the bottom of the - deployment's CMakeLists.txt file: + If you want to add components to the deployment, you can do that + next. This can be done by adding a line like this, near the bottom + of the deployment's CMakeLists.txt file: - add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../{{ cookiecutter.deployment_path }}/{{ cookiecutter.component_dir_name }}/{{ cookiecutter.component_dir_name }}") + add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../{{ cookiecutter.deployment_path }}/{{ cookiecutter.component_dir_name }}") Then you need to (possibly purge) and generate the new cmake config - in that deployment: + in the deployment: fprime-util generate + fprime-util build - Now you can edit your {{ cookiecutter.component_name }}ComponentAi.xml file - define the component to your liking, and generate the implementation - boilerplate: - - cd {{ cookiecutter.component_dir_name }} - fprime-util impl -b {path/to/your/deployment} - - Next, copy the `-template` code contents into your .hpp and .cpp files. - Try not to overwrite the freshly generated comments at the top! + Now you should be able to run the executable from the build folder. """) diff --git a/{{cookiecutter.deployment_dir_name}}/.cookiecutterrc b/{{cookiecutter.deployment_dir_name}}/.cookiecutterrc new file mode 100644 index 0000000..37b3660 --- /dev/null +++ b/{{cookiecutter.deployment_dir_name}}/.cookiecutterrc @@ -0,0 +1,20 @@ +# This file exists so you can easily regenerate your project. +# +# `cookiepatcher` is a convenient shim around `cookiecutter` +# for regenerating projects (it will generate a .cookiecutterrc +# automatically for any template). To use it: +# +# pip install cookiepatcher +# cookiepatcher gh:sterlingpeet/cookiecutter-fprime-deployment {{cookiecutter.deployment_dir_name}} +# +# See: +# https://pypi.org/project/cookiepatcher +# +# Alternatively, you can run: +# +# cookiecutter --overwrite-if-exists --config-file={{cookiecutter.deployment_dir_name}}/.cookiecutterrc gh:sterlingpeet/cookiecutter-fprime-deployment + +default_context: +{% for key, value in cookiecutter.items()|sort %} + {{ "{0:26}".format(key + ":") }} {{ "{0!r}".format(value).strip("u") }} +{%- endfor %} diff --git a/{{cookiecutter.deployment_dir_name}}/CMakeLists.txt b/{{cookiecutter.deployment_dir_name}}/CMakeLists.txt index 832ee09..2232ac3 100644 --- a/{{cookiecutter.deployment_dir_name}}/CMakeLists.txt +++ b/{{cookiecutter.deployment_dir_name}}/CMakeLists.txt @@ -1,7 +1,7 @@ #### # {{cookiecutter.deployment_display_name}} Deployment: # -# This sets up the {{cookiecutter.deployment_display_name}} deployment using CMake +# This sets up the {{cookiecutter.deployment_display_name}} deployment using CMake # for use with F prime. # # This file has several sections. diff --git a/{{cookiecutter.deployment_dir_name}}/Top/CMakeLists.txt b/{{cookiecutter.deployment_dir_name}}/Top/CMakeLists.txt index 6e2012c..3053ab5 100644 --- a/{{cookiecutter.deployment_dir_name}}/Top/CMakeLists.txt +++ b/{{cookiecutter.deployment_dir_name}}/Top/CMakeLists.txt @@ -7,17 +7,17 @@ # Note: using PROJECT_NAME as EXECUTABLE_NAME #### set(SOURCE_FILES - "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.deployment_assembly}}TopologyAppAi.xml" - "${CMAKE_CURRENT_LIST_DIR}/Main.cpp" - "${CMAKE_CURRENT_LIST_DIR}/Topology.cpp" + "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.deployment_slug}}TopologyAppAi.xml" + "${CMAKE_CURRENT_LIST_DIR}/Main.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Topology.cpp" ) # Note: supply non-explicit dependencies here set(MOD_DEPS - Fw/Logger - # Svc/GroundInterface - Svc/LinuxTime - Os - Os/Baremetal/TaskRunner + Fw/Logger + # Svc/GroundInterface + Svc/LinuxTime + Os + Os/Baremetal/TaskRunner ) register_fprime_executable() diff --git a/{{cookiecutter.deployment_dir_name}}/Top/Components.hpp b/{{cookiecutter.deployment_dir_name}}/Top/Components.hpp index bce982f..bf29e88 100644 --- a/{{cookiecutter.deployment_dir_name}}/Top/Components.hpp +++ b/{{cookiecutter.deployment_dir_name}}/Top/Components.hpp @@ -1,9 +1,7 @@ -#ifndef __{{cookiecutter.deployment_assembly|upper}}_COMPONENTS_HEADER__ -#define __{{cookiecutter.deployment_assembly|upper}}_COMPONENTS_HEADER__ +#ifndef __{{cookiecutter.deployment_slug|upper}}_COMPONENTS_HEADER__ +#define __{{cookiecutter.deployment_slug|upper}}_COMPONENTS_HEADER__ -#define COMM_SERIAL - -void construct{{cookiecutter.deployment_assembly}}Architecture(void); +void construct{{cookiecutter.deployment_slug}}Architecture(void); void exitTasks(void); void constructApp(); @@ -13,17 +11,14 @@ void constructApp(); #include #include -#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp> +#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp> // Core components extern Drv::ATmegaGpioDriverComponentImpl ledGpio; extern Svc::RateGroupDriverImpl rateGroupDriverComp; +// extern Svc::ActiveRateGroupImpl rateGroup1HzComp; extern Svc::ActiveRateGroupImpl rateGroup10HzComp; extern Arduino::HardwareRateDriver hardwareRateDriver; -extern {{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}} {{cookiecutter.component_instance_name}}; - -// #ifdef COMM_SERIAL -// extern Arduino::SerialDriverComponentImpl comm; -// #endif +extern {{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} {{cookiecutter.component_instance_name}}; -#endif // end __{{cookiecutter.deployment_assembly|upper}}_COMPONENTS_HEADER__ +#endif // end __{{cookiecutter.deployment_slug|upper}}_COMPONENTS_HEADER__ diff --git a/{{cookiecutter.deployment_dir_name}}/Top/Topology.cpp b/{{cookiecutter.deployment_dir_name}}/Top/Topology.cpp index d010aeb..117f25a 100644 --- a/{{cookiecutter.deployment_dir_name}}/Top/Topology.cpp +++ b/{{cookiecutter.deployment_dir_name}}/Top/Topology.cpp @@ -5,7 +5,7 @@ #include #include #include -#include "{{cookiecutter.deployment_assembly}}SchedContexts.hpp" +#include "{{cookiecutter.deployment_slug}}SchedContexts.hpp" #include "Components.hpp" #ifdef ARDUINO #include @@ -29,15 +29,15 @@ Svc::RateGroupDriverImpl rateGroupDriverComp("RGDRV", rate_divisors, FW_NUM_ARRA // Context array variables are passed to rate group members if needed to distinguish one call from another // These context must match the rate group members connected in ArduinoTopologyAi.xml -static NATIVE_UINT_TYPE rg10HzContext[] = { {{cookiecutter.deployment_assembly}}::CONTEXT_{{cookiecutter.deployment_assembly|upper}}_10Hz, 0, 0, 0}; +static NATIVE_UINT_TYPE rg10HzContext[] = { {{cookiecutter.deployment_slug}}::CONTEXT_{{cookiecutter.deployment_slug|upper}}_10Hz, 0, 0, 0}; Svc::ActiveRateGroupImpl rateGroup10HzComp("RG10Hz",rg10HzContext,FW_NUM_ARRAY_ELEMENTS(rg10HzContext)); -// static NATIVE_UINT_TYPE rg1HzContext[] = {0, 0, {{cookiecutter.deployment_assembly}}::CONTEXT_{{cookiecutter.deployment_assembly|upper}}_1Hz, 0}; +// static NATIVE_UINT_TYPE rg1HzContext[] = {0, 0, {{cookiecutter.deployment_slug}}::CONTEXT_{{cookiecutter.deployment_slug|upper}}_1Hz, 0}; // Svc::ActiveRateGroupImpl rateGroup1HzComp("RG1Hz",rg1HzContext,FW_NUM_ARRAY_ELEMENTS(rg1HzContext)); // Standard system components // Arduino specific components -{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}} {{cookiecutter.component_instance_name}}("{{cookiecutter.component_instance_name}}"); +{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} {{cookiecutter.component_instance_name}}("{{cookiecutter.component_instance_name}}"); Arduino::HardwareRateDriver hardwareRateDriver("RateDr", 100); Drv::ATmegaGpioDriverComponentImpl ledGpio("ledGpio"); @@ -68,9 +68,9 @@ void constructApp() { #endif // Callback to initialize architecture, connect ports, etc. // The contents of the function are autocoded from the - // {{cookiecutter.deployment_assembly}}TopologyAppAi.xml, and + // {{cookiecutter.deployment_slug}}TopologyAppAi.xml, and // incorporates the assembly name. - construct{{cookiecutter.deployment_assembly}}Architecture(); + construct{{cookiecutter.deployment_slug}}Architecture(); // configure things ledGpio.setup(DDRB, PORTB, PB5, Drv::ATmegaGpioDriverComponentImpl::GPIO_OUT); diff --git a/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_assembly}}SchedContexts.hpp b/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_slug}}SchedContexts.hpp similarity index 51% rename from {{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_assembly}}SchedContexts.hpp rename to {{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_slug}}SchedContexts.hpp index 4d6c2ca..6758b8b 100644 --- a/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_assembly}}SchedContexts.hpp +++ b/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_slug}}SchedContexts.hpp @@ -1,19 +1,19 @@ // ====================================================================== -// \title {{cookiecutter.deployment_assembly}}SchedContexts.hpp +// \title {{cookiecutter.deployment_slug}}SchedContexts.hpp // \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> // \brief {{cookiecutter.dep_short_description}} // ====================================================================== -#ifndef {{cookiecutter.deployment_dir_name|upper}}_TOP_{{cookiecutter.deployment_assembly|upper}}SCHEDCONTEXTS_HPP_ -#define {{cookiecutter.deployment_dir_name|upper}}_TOP_{{cookiecutter.deployment_assembly|upper}}SCHEDCONTEXTS_HPP_ +#ifndef {{cookiecutter.deployment_dir_name|upper}}_TOP_{{cookiecutter.deployment_slug|upper}}SCHEDCONTEXTS_HPP_ +#define {{cookiecutter.deployment_dir_name|upper}}_TOP_{{cookiecutter.deployment_slug|upper}}SCHEDCONTEXTS_HPP_ -namespace {{cookiecutter.deployment_assembly}} { +namespace {{cookiecutter.deployment_slug}} { // A list of contexts for the rate groups enum { - // CONTEXT_{{cookiecutter.deployment_assembly|upper}}_1Hz = 10, // 10Hz cycle - CONTEXT_{{cookiecutter.deployment_assembly|upper}}_10Hz = 11 // 1 Hz cycle + // CONTEXT_{{cookiecutter.deployment_slug|upper}}_1Hz = 10, // 1 Hz cycle + CONTEXT_{{cookiecutter.deployment_slug|upper}}_10Hz = 11 // 10 Hz cycle }; -} // end {{cookiecutter.deployment_assembly}} +} // end {{cookiecutter.deployment_slug}} -#endif /* {{cookiecutter.deployment_dir_name|upper}}_TOP_{{cookiecutter.deployment_assembly|upper}}SCHEDCONTEXTS_HPP_ */ +#endif /* {{cookiecutter.deployment_dir_name|upper}}_TOP_{{cookiecutter.deployment_slug|upper}}SCHEDCONTEXTS_HPP_ */ diff --git a/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_assembly}}TopologyAppAi.xml b/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_slug}}TopologyAppAi.xml similarity index 57% rename from {{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_assembly}}TopologyAppAi.xml rename to {{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_slug}}TopologyAppAi.xml index bdc2e7d..758321f 100644 --- a/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_assembly}}TopologyAppAi.xml +++ b/{{cookiecutter.deployment_dir_name}}/Top/{{cookiecutter.deployment_slug}}TopologyAppAi.xml @@ -1,7 +1,6 @@ - - + @@ -9,24 +8,24 @@ Svc/RateGroupDriver/RateGroupDriverComponentAi.xml ATmega/HardwareRateDriver/HardwareRateDriverComponentAi.xml Drv/ATmegaGpioDriver/ATmegaGpioDriverComponentAi.xml - {{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAi.xml + {{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}ComponentAi.xml - + - + - + - + - + - + - + @@ -47,39 +46,39 @@ - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -91,6 +90,6 @@ - + diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/CMakeLists.txt b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/CMakeLists.txt index f9e4686..de32023 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/CMakeLists.txt +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/CMakeLists.txt @@ -6,45 +6,47 @@ # #### set(SOURCE_FILES - "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentAi.xml" - "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp" + "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}ComponentAi.xml" + "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp" ) - +{% if cookiecutter.component_multiplatform_support == "yes" %} # Determine the platform specific source files to append: string(TOLOWER "${CMAKE_SYSTEM_NAME}" CMAKE_SYSTEM_NAME_LOWER) # Arduino additions if(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "arduino") - list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp") + list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Arduino{{cookiecutter.component_impl_suffix}}.cpp") # AVR platform additions elseif(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "avr") - list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp") + list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}AVR{{cookiecutter.component_impl_suffix}}.cpp") # # CygWin platform additions # elseif(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "cygwin") -# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentCygWin{{cookiecutter.component_suffix}}.cpp") +# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}CygWin{{cookiecutter.component_impl_suffix}}.cpp") # # Darwin platform additions # elseif(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "darwin") -# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentDarwin{{cookiecutter.component_suffix}}.cpp") +# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Darwin{{cookiecutter.component_impl_suffix}}.cpp") # # Raspberry Pi platform additions # elseif(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "arm-linux-gnueabihf") -# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentRPi{{cookiecutter.component_suffix}}.cpp") +# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}RPi{{cookiecutter.component_impl_suffix}}.cpp") # # VxWorks platform additions # elseif(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "vxworks") -# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentVxWorks{{cookiecutter.component_suffix}}.cpp") -# # Otherwise, assume Linux-compatible build +# list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}VxWorks{{cookiecutter.component_impl_suffix}}.cpp") +# Otherwise, assume Linux-compatible build else() - list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp") + list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp") endif() +{% endif %} # Uncomment and add any modules that this component depends on, else # they might not be available when cmake tries to build this component. # set(MOD_DEPS -# Fw/Logger +# Fw/Logger # ) register_fprime_module() +{% if cookiecutter.component_multiplatform_support == "yes" %} # Add Arduino dependency if(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "arduino") get_module_name(${CMAKE_CURRENT_LIST_DIR}) @@ -56,3 +58,4 @@ if(${CMAKE_SYSTEM_NAME_LOWER} STREQUAL "avr") get_module_name(${CMAKE_CURRENT_LIST_DIR}) add_avr_dependency("${MODULE_NAME}") endif() +{% endif %} diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/Makefile b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/Makefile index 1340ca6..698eb0e 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/Makefile +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/Makefile @@ -5,7 +5,7 @@ # derive module name from directory -MODULE_DIR = {{cookiecutter.deployment_path}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_dir_name}} +MODULE_DIR = {{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}} MODULE = $(subst /,,$(MODULE_DIR)) BUILD_ROOT ?= $(subst /$(MODULE_DIR),,$(CURDIR)) diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/sdd.md b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/sdd.md index 6efb5b7..a35b003 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/sdd.md +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/sdd.md @@ -6,14 +6,14 @@ ## 2. Requirements -The requirements for `{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` are as follows: +The requirements for `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` are as follows: *Note:* Requirements are usually labelled with the initials of the component class, e.g. `CookieCutter -> CC-001`. Requirement | Description | Verification Method ----------- | ----------- | ------------------- -CC-001 | The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` component acknowledge ping requests | Unit Test -CC-002 | The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` component shall save the widgets | Unit Test +CC-001 | The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` component acknowledge ping requests | Unit Test +CC-002 | The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` component shall save the widgets | Unit Test ## 3. Design @@ -21,13 +21,13 @@ CC-002 | The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_nam #### 3.1.1 Component Diagram -The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` component has the following component diagram: +The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` component has the following component diagram: -![`{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` Diagram](img/{{cookiecutter.component_name}}ComponentBDD.jpg "{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component") +![`{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` Diagram](img/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}BDD.jpg "{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}") #### 3.1.2 Ports -The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` component uses the following port types: +The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` component uses the following port types: Port Data Type | Name | Direction | Kind | Usage -------------- | ---- | --------- | ---- | ----- @@ -41,21 +41,21 @@ Port Data Type | Name | Direction | Kind | Usage #### 3.3.1 FATAL Notification -The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` handles FATAL notifications: +The `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` handles FATAL notifications: ![FATAL Notification](img/FatalNotification.jpg) ### 3.4 State -`{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` has no state machines (or does it?). +`{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` has no state machines (or does it?). ### 3.5 Algorithms -`{{cookiecutter.component_namespace}}::{{cookiecutter.component_name}}Component` has no significant algorithms. +`{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}` has no significant algorithms. ## 4. Dictionary -Dictionaries: [HTML]({{cookiecutter.component_name}}Component.html) [MD]({{cookiecutter.component_name}}Component.md) +Dictionaries: [HTML]({{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.html) [MD]({{cookiecutter.component_slug}}.md) ## 4. Module Checklists @@ -69,11 +69,11 @@ Unit Test Checklist | [Link](Checklist_Unit_Test.xls) [Unit Test Output](../test/ut/output/test.txt) -[Coverage Summary](../test/ut/output/{{cookiecutter.component_namespace}}{{cookiecutter.component_name}}Component_gcov.txt) +[Coverage Summary](../test/ut/output/{{cookiecutter.component_namespace}}{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}_gcov.txt) -[Coverage Output - `{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp`](../test/ut/output/{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp.gcov) +[Coverage Output - `{{cookiecutter.component_namespace}}::{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.cpp`](../test/ut/output/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.cpp.gcov) -[Coverage Output - `{{cookiecutter.component_name}}ComponentComponentAc.cpp`](../test/ut/output/{{cookiecutter.component_name}}ComponentComponentAc.cpp.gcov) +[Coverage Output - `{{cookiecutter.component_slug}}ComponentAc.cpp`](../test/ut/output/{{cookiecutter.component_slug}}ComponentAc.cpp.gcov) ## 6. Change Log diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/{{cookiecutter.component_slug}}.md b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/{{cookiecutter.component_slug}}.md new file mode 100644 index 0000000..5f74d79 --- /dev/null +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/docs/{{cookiecutter.component_slug}}.md @@ -0,0 +1,22 @@ +# {{cookiecutter.component_slug}} Component Dictionary + + +## Command List + +|Mnemonic|ID|Description|Arg Name|Arg Type|Comment +|---|---|---|---|---|---| +|PR_StopPings|0 (0x0)|Command to disable ping response| | | + +## Telemetry Channel List + +|Channel Name|ID|Type|Description| +|---|---|---|---| +|PR_NumPings|0 (0x0)|U32|Number of pings received| + +## Event List + +|Event Name|ID|Description|Arg Name|Arg Type|Arg Size|Description +|---|---|---|---|---|---|---| +|PR_PingsDisabled|0 (0x0)|Disabled ping responses| | | | | +|PR_PingReceived|1 (0x1)|Got ping| | | | | +| | | |code|U32||Ping code| diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/mod.mk b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/mod.mk index 1184294..eda33bb 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/mod.mk +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/mod.mk @@ -7,17 +7,17 @@ # There are some standard files that are included for reference -SRC = {{cookiecutter.component_name}}ComponentAi.xml \ - {{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.cpp +SRC = {{cookiecutter.component_slug}}ComponentAi.xml \ + {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp +{% if cookiecutter.component_multiplatform_support == "yes" %} +SRC_LINUX = {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp -SRC_LINUX = {{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp +SRC_CYGWIN = {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}CygWin{{cookiecutter.component_impl_suffix}}.cpp -SRC_CYGWIN = {{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp +SRC_DARWIN = {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Darwin{{cookiecutter.component_impl_suffix}}.cpp -SRC_DARWIN = {{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp - -SRC_RASPIAN = {{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp - -HDR = {{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp +SRC_RASPIAN = {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp +{% endif %} +HDR = {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp SUBDIRS = diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp deleted file mode 100644 index 3f390c3..0000000 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// ====================================================================== -// \title {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}.cpp -// \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> -// \brief {{cookiecutter.component_short_description}} -// ====================================================================== - - -#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp> -#include "Fw/Types/BasicTypes.hpp" - -namespace {{cookiecutter.component_namespace}} { - - // ---------------------------------------------------------------------- - // Construction, initialization, and destruction - // ---------------------------------------------------------------------- - - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: -#if FW_OBJECT_NAMES == 1 - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}( - const char *const compName - ) : - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}Base(compName), -#else - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}Base(void), -#endif - m_state(false) - {} - - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: - ~{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}(void) - { - - } - - // ---------------------------------------------------------------------- - // Handler implementations for user-defined typed input ports - // ---------------------------------------------------------------------- - - void {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: - schedIn_handler( - const NATIVE_INT_TYPE portNum, - NATIVE_UINT_TYPE context - ) - { - blink(); - m_state = !m_state; - } - -} // end namespace {{cookiecutter.component_namespace}} diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAi.xml b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}ComponentAi.xml similarity index 61% rename from {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAi.xml rename to {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}ComponentAi.xml index c7c5b38..856e033 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAi.xml +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}ComponentAi.xml @@ -1,17 +1,20 @@ - - + + Svc/Sched/SchedPortAi.xml Drv/GpioDriverPorts/GpioWritePortAi.xml {{cookiecutter.component_short_description}} - + +{%- if cookiecutter.component_kind == 'active' %} + +{%- else %} +{%- endif %} - diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}AVR{{cookiecutter.component_impl_suffix}}.cpp similarity index 53% rename from {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp rename to {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}AVR{{cookiecutter.component_impl_suffix}}.cpp index be66614..ee1fb1d 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}AVR{{cookiecutter.component_impl_suffix}}.cpp @@ -1,24 +1,24 @@ // ====================================================================== -// \title {{cookiecutter.component_name}}ComponentAVR{{cookiecutter.component_suffix}}.cpp +// \title {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}AVR{{cookiecutter.component_impl_suffix}} // \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> // \brief {{cookiecutter.component_short_description}} // ====================================================================== -#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp> +#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp> #include "Fw/Types/BasicTypes.hpp" // #include namespace {{cookiecutter.component_namespace}} { - void {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: init( const NATIVE_INT_TYPE instance ) { - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}Base::init(instance); + {{cookiecutter.component_slug}}ComponentBase::init(instance); } - void {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: blink() { this->gpio_out(0, m_state); diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Arduino{{cookiecutter.component_impl_suffix}}.cpp b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Arduino{{cookiecutter.component_impl_suffix}}.cpp new file mode 100644 index 0000000..e100732 --- /dev/null +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Arduino{{cookiecutter.component_impl_suffix}}.cpp @@ -0,0 +1,27 @@ +// ====================================================================== +// \title {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Arduino{{cookiecutter.component_impl_suffix}}.cpp +// \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> +// \brief {{cookiecutter.component_short_description}} +// ====================================================================== + +#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp> +#include "Fw/Types/BasicTypes.hpp" + +// #include +namespace {{cookiecutter.component_namespace}} { + + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: + init( + const NATIVE_INT_TYPE instance + ) + { + {{cookiecutter.component_slug}}ComponentBase::init(instance); + } + + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: + blink() + { + this->gpio_out(0, m_state); + } + +} // end namespace {{cookiecutter.component_namespace}} diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp similarity index 51% rename from {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp rename to {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp index 6ee0012..4583054 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp @@ -1,25 +1,24 @@ // ====================================================================== -// \title {{cookiecutter.component_name}}ComponentLinux{{cookiecutter.component_suffix}}.cpp +// \title {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}Linux{{cookiecutter.component_impl_suffix}}.cpp // \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> // \brief {{cookiecutter.component_short_description}} // ====================================================================== -#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp> +#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp> #include "Fw/Types/BasicTypes.hpp" -#include - +// #include namespace {{cookiecutter.component_namespace}} { - void {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: init( const NATIVE_INT_TYPE instance ) { - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}Base::init(instance); + {{cookiecutter.component_slug}}ComponentBase::init(instance); } - void {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} :: + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: blink() { this->gpio_out(0, m_state); diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp new file mode 100644 index 0000000..ef0d0a7 --- /dev/null +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp @@ -0,0 +1,63 @@ +// ====================================================================== +// \title {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_explicit_common}}{{cookiecutter.component_impl_suffix}}.cpp +// \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> +// \brief {{cookiecutter.component_short_description}} +// ====================================================================== + + +#include <{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp> +#include "Fw/Types/BasicTypes.hpp" + +namespace {{cookiecutter.component_namespace}} { + + // ---------------------------------------------------------------------- + // Construction, initialization, and destruction + // ---------------------------------------------------------------------- + + {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: +#if FW_OBJECT_NAMES == 1 + {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}( + const char *const compName + ) : + {{cookiecutter.component_slug}}ComponentBase(compName), +#else + {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}(void), +#endif + m_state(false) + {} +{% if cookiecutter.component_multiplatform_support != 'yes' %} + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: + init( + const NATIVE_INT_TYPE instance + ) + { + {{cookiecutter.component_slug}}ComponentBase::init(instance); + } + + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: + blink() + { + this->gpio_out(0, m_state); + } +{% endif %} + {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: + ~{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}(void) + { + + } + + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + void {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} :: + schedIn_handler( + const NATIVE_INT_TYPE portNum, + NATIVE_UINT_TYPE context + ) + { + blink(); + m_state = !m_state; + } + +} // end namespace {{cookiecutter.component_namespace}} diff --git a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp similarity index 55% rename from {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp rename to {{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp index 4dcd138..2a58d54 100644 --- a/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp +++ b/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp @@ -1,18 +1,18 @@ // ====================================================================== -// \title {{cookiecutter.component_name}}Component{{cookiecutter.component_suffix}}.hpp +// \title {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}.hpp // \author {{cookiecutter.full_name}} <{{cookiecutter.email}}> // \brief {{cookiecutter.component_short_description}} // ====================================================================== -#ifndef {{cookiecutter.component_name}}Component_HPP -#define {{cookiecutter.component_name}}Component_HPP +#ifndef {{cookiecutter.component_slug}}Component_HPP +#define {{cookiecutter.component_slug}}Component_HPP -#include "{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_name}}ComponentAc.hpp" +#include "{{cookiecutter.deployment_path}}/{{cookiecutter.deployment_dir_name}}/{{cookiecutter.component_dir_name}}/{{cookiecutter.component_slug}}ComponentAc.hpp" namespace {{cookiecutter.component_namespace}} { - class {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} : - public {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}Base + class {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} : + public {{cookiecutter.component_slug}}ComponentBase { public: @@ -21,9 +21,9 @@ namespace {{cookiecutter.component_namespace}} { // Construction, initialization, and destruction // ---------------------------------------------------------------------- - //! Construct object {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} + //! Construct object {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} //! - {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}( + {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}( #if FW_OBJECT_NAMES == 1 const char *const compName /*!< The component name*/ #else @@ -31,15 +31,15 @@ namespace {{cookiecutter.component_namespace}} { #endif ); - //! Initialize object {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} + //! Initialize object {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} //! void init( const NATIVE_INT_TYPE instance = 0 /*!< The instance number*/ ); - //! Destroy object {{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}} + //! Destroy object {{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}} //! - ~{{cookiecutter.component_name}}Component{{cookiecutter.component_explicit_common}}{{cookiecutter.component_suffix}}(void); + ~{{cookiecutter.component_slug}}{{cookiecutter.component_explicit_component_suffix}}{{cookiecutter.component_impl_suffix}}(void); PRIVATE: //! Blink a given pin @@ -59,4 +59,4 @@ namespace {{cookiecutter.component_namespace}} { } // end namespace {{cookiecutter.component_namespace}} -#endif +#endif // end {{cookiecutter.component_slug}}Component_HPP