From 3b44eb037a5f0a817c2260ecbbebe97ab64cfaad Mon Sep 17 00:00:00 2001 From: ineskhou Date: Thu, 4 Sep 2025 13:36:56 -0700 Subject: [PATCH 1/8] added burnwire component (2) --- .../Components/Burnwire/Burnwire.cpp | 19 ++++++ .../Components/Burnwire/Burnwire.fpp | 55 ++++++++++++++++ .../Components/Burnwire/Burnwire.hpp | 30 +++++++++ .../Components/Burnwire/CMakeLists.txt | 36 ++++++++++ .../Components/Burnwire/docs/sdd.md | 65 +++++++++++++++++++ .../Components/CMakeLists.txt | 1 + 6 files changed, 206 insertions(+) create mode 100644 FprimeZephyrReference/Components/Burnwire/Burnwire.cpp create mode 100644 FprimeZephyrReference/Components/Burnwire/Burnwire.fpp create mode 100644 FprimeZephyrReference/Components/Burnwire/Burnwire.hpp create mode 100644 FprimeZephyrReference/Components/Burnwire/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/Burnwire/docs/sdd.md diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp new file mode 100644 index 00000000..0623c23f --- /dev/null +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -0,0 +1,19 @@ +// ====================================================================== +// \title Burnwire.cpp +// \author aldjia +// \brief cpp file for Burnwire component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/Burnwire/Burnwire.hpp" + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +Burnwire ::Burnwire(const char* const compName) : BurnwireComponentBase(compName) {} + +Burnwire ::~Burnwire() {} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp new file mode 100644 index 00000000..31d3415a --- /dev/null +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp @@ -0,0 +1,55 @@ +module Components { + @ Turns Burnwire on and off + passive component Burnwire { + + ############################################################################## + #### Uncomment the following examples to start customizing your component #### + ############################################################################## + + # @ Example async command + # async command COMMAND_NAME(param_name: U32) + + # @ Example telemetry counter + # telemetry ExampleCounter: U64 + + # @ Example event + # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + + # @ Example port: receiving calls from the rate group + # sync input port run: Svc.Sched + + # @ Example parameter + # param PARAMETER_NAME: U32 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending command registrations + command reg port cmdRegOut + + @ Port for receiving commands + command recv port cmdIn + + @ Port for sending command responses + command resp port cmdResponseOut + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + @ Port to return the value of a parameter + param get port prmGetOut + + @Port to set the value of a parameter + param set port prmSetOut + + } +} \ No newline at end of file diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp new file mode 100644 index 00000000..9ce066ef --- /dev/null +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -0,0 +1,30 @@ +// ====================================================================== +// \title Burnwire.hpp +// \author aldjia +// \brief hpp file for Burnwire component implementation class +// ====================================================================== + +#ifndef Components_Burnwire_HPP +#define Components_Burnwire_HPP + +#include "FprimeZephyrReference/Components/Burnwire/BurnwireComponentAc.hpp" + +namespace Components { + +class Burnwire final : public BurnwireComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct Burnwire object + Burnwire(const char* const compName //!< The component name + ); + + //! Destroy Burnwire object + ~Burnwire(); +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/Burnwire/CMakeLists.txt b/FprimeZephyrReference/Components/Burnwire/CMakeLists.txt new file mode 100644 index 00000000..5e68dc91 --- /dev/null +++ b/FprimeZephyrReference/Components/Burnwire/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/Burnwire.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/Burnwire.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/Burnwire.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/BurnwireTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/BurnwireTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md new file mode 100644 index 00000000..102db871 --- /dev/null +++ b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md @@ -0,0 +1,65 @@ +# Components::Burnwire + +Turns Burnwire on and off + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|BW-001|The burnwire component shall turn on when commanded to |Hardware Test| +|BW-002|The burnwire component shall turn off when commanded to |Hardware Test| +|BW-003|The burnwire component shall provide an Event when it is turned on and off |Integration Test| +|BW-004|The burnwire component shall activate by turning the GPIO pins on one at a time |Integration Test| + + +## Port Descriptions +| Name | Description | +|---|---| +|Fw::Signal|Receive stop signal to stop and start burnwire| +|Drv::GpioWrite|Control GPIO state to driver| + +## Commands +| Name | Description | +| ---- | ----------- | +|START_BURNWIRE|Starts the Burn| +|STOP_BURNWIRE|Stops the Burn| + +## Events +| Name | Description | +|---|---| +|Burnwire_Start|Emitted once the burnwire has started| +|Burnwire_Stop|Emitted once the burnwire has ended| + + +## Component States +Add component states in the chart below +| Name | Description | +|---|---| +|---|---| + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|---|---| +|---|---| + + + + + +## Telemetry +| Name | Description | +|---|---| +|---|---| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + +## Change Log +| Date | Description | +|---|---| +|---| Initial Draft | \ No newline at end of file diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index 10c9dad2..411a0622 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -2,3 +2,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/") From 112d6b48cf5883dab04c015a42ebd27f74affc8e Mon Sep 17 00:00:00 2001 From: ineskhou Date: Thu, 4 Sep 2025 14:06:04 -0700 Subject: [PATCH 2/8] impl from sdd --- .../Components/Burnwire/Burnwire.cpp | 22 ++++++++++++++++ .../Components/Burnwire/Burnwire.fpp | 20 +++++++++++--- .../Components/Burnwire/Burnwire.hpp | 26 +++++++++++++++++++ .../Components/Burnwire/docs/sdd.md | 2 +- boards/rpi_pico2_rp2350a_m33.overlay | 5 ++++ 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 0623c23f..671f432c 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -16,4 +16,26 @@ Burnwire ::Burnwire(const char* const compName) : BurnwireComponentBase(compName Burnwire ::~Burnwire() {} +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +void Burnwire ::stop_handler(FwIndexType portNum) { + // TODO +} + +// ---------------------------------------------------------------------- +// Handler implementations for commands +// ---------------------------------------------------------------------- + +void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On burnwire_state) { + // TODO + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); +} + +void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On burnwire_state) { + // TODO + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); +} + } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp index 31d3415a..4ec3f6dd 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp @@ -6,18 +6,32 @@ module Components { #### Uncomment the following examples to start customizing your component #### ############################################################################## - # @ Example async command - # async command COMMAND_NAME(param_name: U32) + # @ Examplesync command + sync command START_BURNWIRE( + burnwire_state: Fw.On + ) + sync command STOP_BURNWIRE( + burnwire_state: Fw.On + ) # @ Example telemetry counter # telemetry ExampleCounter: U64 # @ Example event # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + event SetBlinkingState(burnwire_state: Fw.On) \ + severity activity high \ + format "Burnwire State: {}" # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched + @ Port to start and stop the burnwire + sync input port stop: Fw.Signal + + @ Port sending calls to the GPIO driver + output port gpioSet: Drv.GpioWrite + # @ Example parameter # param PARAMETER_NAME: U32 @@ -52,4 +66,4 @@ module Components { param set port prmSetOut } -} \ No newline at end of file +} diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index 9ce066ef..176cb9e9 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -23,6 +23,32 @@ class Burnwire final : public BurnwireComponentBase { //! Destroy Burnwire object ~Burnwire(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for stop + //! + //! Port to start and stop the burnwire + void stop_handler(FwIndexType portNum //!< The port number + ) override; + + private: + // ---------------------------------------------------------------------- + // Handler implementations for commands + // ---------------------------------------------------------------------- + + //! Handler implementation for command START_BURNWIRE + void START_BURNWIRE_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq, //!< The command sequence number + Fw::On burnwire_state) override; + + //! Handler implementation for command STOP_BURNWIRE + void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq, //!< The command sequence number + Fw::On burnwire_state) override; }; } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md index 102db871..0b8a7b7b 100644 --- a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md +++ b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md @@ -62,4 +62,4 @@ Add unit test descriptions in the chart below ## Change Log | Date | Description | |---|---| -|---| Initial Draft | \ No newline at end of file +|---| Initial Draft | diff --git a/boards/rpi_pico2_rp2350a_m33.overlay b/boards/rpi_pico2_rp2350a_m33.overlay index ea7ecb55..d1940461 100644 --- a/boards/rpi_pico2_rp2350a_m33.overlay +++ b/boards/rpi_pico2_rp2350a_m33.overlay @@ -8,6 +8,11 @@ chosen { zephyr,console = &cdc_acm_uart0; }; + + burnwire0: burnwire0 { + gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; + label = "Burnwire 0, 28"; + }; }; /* Override the default LED definition to use GPIO 24 instead of GPIO 25 for PROVES FC board*/ From f5fbe3d6f116141853b003f0b63741898f08589c Mon Sep 17 00:00:00 2001 From: ineskhou Date: Thu, 4 Sep 2025 15:50:35 -0700 Subject: [PATCH 3/8] appease linter --- .../Components/Burnwire/Burnwire.cpp | 13 +++++++++---- .../Components/Burnwire/Burnwire.fpp | 5 ++--- .../Components/Burnwire/Burnwire.hpp | 10 ++++------ .../ReferenceDeployment/Top/instances.fpp | 4 ++++ .../ReferenceDeployment/Top/topology.fpp | 1 + 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 671f432c..f85eac11 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -28,13 +28,18 @@ void Burnwire ::stop_handler(FwIndexType portNum) { // Handler implementations for commands // ---------------------------------------------------------------------- -void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On burnwire_state) { - // TODO +void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + // update private member variable + this->m_state = Fw::On::ON; + // send event + this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON); + // confirm response this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } -void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On burnwire_state) { - // TODO +void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + this->m_state = Fw::On::OFF; + this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF); this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp index 4ec3f6dd..43caa078 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp @@ -8,10 +8,9 @@ module Components { # @ Examplesync command sync command START_BURNWIRE( - burnwire_state: Fw.On ) + sync command STOP_BURNWIRE( - burnwire_state: Fw.On ) # @ Example telemetry counter @@ -19,7 +18,7 @@ module Components { # @ Example event # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" - event SetBlinkingState(burnwire_state: Fw.On) \ + event SetBurnwireState(burnwire_state: Fw.On) \ severity activity high \ format "Burnwire State: {}" diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index 176cb9e9..9de9770c 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -41,14 +41,12 @@ class Burnwire final : public BurnwireComponentBase { // ---------------------------------------------------------------------- //! Handler implementation for command START_BURNWIRE - void START_BURNWIRE_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq, //!< The command sequence number - Fw::On burnwire_state) override; + void START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; //! Handler implementation for command STOP_BURNWIRE - void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq, //!< The command sequence number - Fw::On burnwire_state) override; + void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; + + Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off }; } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index d3bce3e6..eee87310 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -1,5 +1,6 @@ module ReferenceDeployment { + # ---------------------------------------------------------------------- # Base ID Convention # ---------------------------------------------------------------------- @@ -63,4 +64,7 @@ module ReferenceDeployment { instance gpioDriver: Zephyr.ZephyrGpioDriver base id 0x10015000 instance watchdog: Components.Watchdog base id 0x10016000 + + instance burnwire: Components.Burnwire base id 0x10017000 + } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index f1946b87..8292fc49 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -29,6 +29,7 @@ module ReferenceDeployment { instance gpioDriver instance watchdog instance prmDb + instance burnwire # ---------------------------------------------------------------------- # Pattern graph specifiers From 7c11e85c166523180ae1f752e827bb3a9ba195ef Mon Sep 17 00:00:00 2001 From: ineskhou Date: Thu, 4 Sep 2025 18:12:03 -0700 Subject: [PATCH 4/8] Readme with notes to the connecty stuff to be refined and edited and appease linter --- .../Components/Burnwire/Burnwire.cpp | 5 ++ .../Components/Burnwire/Burnwire.fpp | 6 +-- .../Top/ReferenceDeploymentTopology.cpp | 12 +++++ .../ReferenceDeployment/Top/instances.fpp | 4 ++ .../ReferenceDeployment/Top/topology.fpp | 9 ++++ README.md | 51 +++++++++++++++++++ boards/rpi_pico2_rp2350a_m33.overlay | 10 ++++ 7 files changed, 94 insertions(+), 3 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index f85eac11..1b164831 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -35,12 +35,17 @@ void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON); // confirm response this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); + + this->gpioSet_out(0, Fw::Logic::HIGH); + this->gpioSet_out(1, Fw::Logic::HIGH); } void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { this->m_state = Fw::On::OFF; this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF); this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); + this->gpioSet_out(0, Fw::Logic::LOW); + this->gpioSet_out(1, Fw::Logic::LOW); } } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp index 43caa078..996fb9c9 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp @@ -25,11 +25,11 @@ module Components { # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched - @ Port to start and stop the burnwire + @ Input Port to start and stop the burnwire sync input port stop: Fw.Signal - @ Port sending calls to the GPIO driver - output port gpioSet: Drv.GpioWrite + @ Port sending calls to the GPIO driver to stop and start the burnwire + output port gpioSet: [2] Drv.GpioWrite # @ Example parameter # param PARAMETER_NAME: U32 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index e9bfd734..01d450d3 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -14,6 +14,16 @@ #include static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); +static const struct gpio_dt_spec burnwire0Gpio = { + .port = DEVICE_DT_GET(DT_NODELABEL(gpio0)), + .pin = 28, + .dt_flags = GPIO_ACTIVE_HIGH, +}; +static const struct gpio_dt_spec burnwire1Gpio = { + .port = DEVICE_DT_GET(DT_NODELABEL(gpio0)), + .pin = 29, + .dt_flags = GPIO_ACTIVE_HIGH, +}; // Allows easy reference to objects in FPP/autocoder required namespaces using namespace ReferenceDeployment; @@ -55,6 +65,8 @@ void configureTopology() { rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index eee87310..468f2df6 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -63,6 +63,10 @@ module ReferenceDeployment { instance gpioDriver: Zephyr.ZephyrGpioDriver base id 0x10015000 + instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10015100 + + instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10015200 + instance watchdog: Components.Watchdog base id 0x10016000 instance burnwire: Components.Burnwire base id 0x10017000 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 8292fc49..e9a86d26 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -27,6 +27,8 @@ module ReferenceDeployment { instance timer instance comDriver instance gpioDriver + instance gpioBurnwire0 + instance gpioBurnwire1 instance watchdog instance prmDb instance burnwire @@ -95,10 +97,17 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run } + connections Watchdog { watchdog.gpioSet -> gpioDriver.gpioWrite } + connections BurnwireGpio { + burnwire.gpioSet[0] -> gpioBurnwire0.gpioWrite + burnwire.gpioSet[1] -> gpioBurnwire1.gpioWrite + } + + connections ReferenceDeployment { } diff --git a/README.md b/README.md index 74d41fb3..9a8f6299 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,54 @@ Finally, run the fprime-gds. ```shell make gds ``` + +# How to add a component + +1. Overlay + + +you also want to add aliases + + aliases { + burnwire0 = &burnwire0; + burnwire1 = &burnwire1; + }; + + +2. + +In RefereneceDeploymentTopology.cpp +static const struct gpio_dt_spec burnwireGpio = GPIO_DT_SPEC_GET(DT_ALIAS(burnwire0), gpios); + + gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + + +and + +gpioDriver.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + +in topology.fpp + +connections burnwire1 { + burnwire1.gpioSet -> gpioDriver.gpioWrite + } + + + + +in instances.fpp +instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10015100 + + instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10015200 + + +in topology.fpp + + instance gpioBurnwire0 + instance gpioBurnwire1 + +3. Make a new component in the components folder +4. Add the component to the instances and topology folder + +in topology.fpp also instance burnwire diff --git a/boards/rpi_pico2_rp2350a_m33.overlay b/boards/rpi_pico2_rp2350a_m33.overlay index d1940461..1128e6e2 100644 --- a/boards/rpi_pico2_rp2350a_m33.overlay +++ b/boards/rpi_pico2_rp2350a_m33.overlay @@ -13,6 +13,16 @@ gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; label = "Burnwire 0, 28"; }; + + burnwire1: burnwire1 { + gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; + label = "Burnwire 1, 29"; + }; + + aliases { + burnwire0 = &burnwire0; + burnwire1 = &burnwire1; + }; }; /* Override the default LED definition to use GPIO 24 instead of GPIO 25 for PROVES FC board*/ From 488b01c96535e61a3fe8ffa44dc838c9630251a0 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Thu, 4 Sep 2025 22:41:21 -0700 Subject: [PATCH 5/8] added rate group --- .../Components/Burnwire/Burnwire.cpp | 26 +++++++++++++++++-- .../Components/Burnwire/Burnwire.fpp | 8 ++++-- .../Components/Burnwire/Burnwire.hpp | 8 ++++-- .../Components/Burnwire/docs/sdd.md | 10 ++++--- .../Top/ReferenceDeploymentTopology.cpp | 4 +-- .../ReferenceDeployment/Top/topology.fpp | 1 + 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 1b164831..1c90453d 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -20,8 +20,27 @@ Burnwire ::~Burnwire() {} // Handler implementations for typed input ports // ---------------------------------------------------------------------- -void Burnwire ::stop_handler(FwIndexType portNum) { - // TODO +// void Burnwire ::stop_handler(FwIndexType portNum) { +// //TODO +// } + +void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { + if (this->m_state == Fw::On::ON) { + this->m_safetyCounter++; + if (this->m_safetyCounter == 1) { + this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::ON); + } + + if (this->m_safetyCounter >= m_safetyMaxCount) { + // 30 seconds reached → turn OFF + this->gpioSet_out(0, Fw::Logic::LOW); + this->gpioSet_out(1, Fw::Logic::LOW); + + this->m_state = Fw::On::OFF; + this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF); + this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::OFF); + } + } } // ---------------------------------------------------------------------- @@ -36,6 +55,9 @@ void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { // confirm response this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); + // reset count to 0 + this->m_safetyCounter = 0; + this->gpioSet_out(0, Fw::Logic::HIGH); this->gpioSet_out(1, Fw::Logic::HIGH); } diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp index 996fb9c9..1b7e786d 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp @@ -22,11 +22,15 @@ module Components { severity activity high \ format "Burnwire State: {}" + event SafetyTimerStatus(burnwire_state: Fw.On) \ + severity activity high\ + format "Safety Timer State: {} " + # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched - @ Input Port to start and stop the burnwire - sync input port stop: Fw.Signal + @ Input Port to get the rate group + sync input port schedIn: Svc.Sched @ Port sending calls to the GPIO driver to stop and start the burnwire output port gpioSet: [2] Drv.GpioWrite diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index 9de9770c..0cbc0c9b 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -32,8 +32,10 @@ class Burnwire final : public BurnwireComponentBase { //! Handler implementation for stop //! //! Port to start and stop the burnwire - void stop_handler(FwIndexType portNum //!< The port number - ) override; + + void schedIn_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; private: // ---------------------------------------------------------------------- @@ -47,6 +49,8 @@ class Burnwire final : public BurnwireComponentBase { void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off + U32 m_safetyCounter = 0; // keeps track of the safety number of seconds + U32 m_safetyMaxCount = 5; }; } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md index 0b8a7b7b..a973b9d7 100644 --- a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md +++ b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md @@ -9,6 +9,7 @@ Add requirements in the chart below |BW-002|The burnwire component shall turn off when commanded to |Hardware Test| |BW-003|The burnwire component shall provide an Event when it is turned on and off |Integration Test| |BW-004|The burnwire component shall activate by turning the GPIO pins on one at a time |Integration Test| +|BW-005|The burnwire component shall be controlled by a safety timeout that can be changed within the code |Integration Test| ## Port Descriptions @@ -33,8 +34,8 @@ Add requirements in the chart below ## Component States Add component states in the chart below | Name | Description | -|---|---| -|---|---| +|----|---| +|m_state|Keeps track if the burnwire is on or off| ## Sequence Diagrams Add sequence diagrams here @@ -56,8 +57,9 @@ Add sequence diagrams here ## Unit Tests Add unit test descriptions in the chart below | Name | Description | Output | Coverage | -|---|---|---|---| -|---|---|---|---| +|TestSafety|Tests Burnwire turns off after X seconds|---|---| +|TestOn|Tests right GPIO pins turn on |---|---| +|TestOn|Tests right GPIO pins turn off, same as on |---|---| ## Change Log | Date | Description | diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 01d450d3..18fcc2d0 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -16,12 +16,12 @@ static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); static const struct gpio_dt_spec burnwire0Gpio = { .port = DEVICE_DT_GET(DT_NODELABEL(gpio0)), - .pin = 28, + .pin = 28, // 28 .dt_flags = GPIO_ACTIVE_HIGH, }; static const struct gpio_dt_spec burnwire1Gpio = { .port = DEVICE_DT_GET(DT_NODELABEL(gpio0)), - .pin = 29, + .pin = 29, // 29 .dt_flags = GPIO_ACTIVE_HIGH, }; diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index e9a86d26..3b76aac8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -95,6 +95,7 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run + rateGroup1Hz.RateGroupMemberOut[5] -> burnwire.schedIn } From a96b54832506f93afb55a88b3523ed1884292ceb Mon Sep 17 00:00:00 2001 From: ineskhou Date: Fri, 5 Sep 2025 12:01:58 -0700 Subject: [PATCH 6/8] feedback from deign review --- .../Components/Burnwire/Burnwire.cpp | 10 ++-- .../Components/Burnwire/Burnwire.hpp | 6 +- .../Components/Burnwire/docs/sdd.md | 56 +++++++++---------- .../Top/ReferenceDeploymentTopology.cpp | 2 + boards/rpi_pico2_rp2350a_m33.overlay | 9 +-- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 1c90453d..9dbcdc04 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -28,6 +28,8 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { if (this->m_state == Fw::On::ON) { this->m_safetyCounter++; if (this->m_safetyCounter == 1) { + this->gpioSet_out(0, Fw::Logic::HIGH); + this->gpioSet_out(1, Fw::Logic::HIGH); this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::ON); } @@ -48,18 +50,14 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { // ---------------------------------------------------------------------- void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + // reset count to 0 + this->m_safetyCounter = 0; // update private member variable this->m_state = Fw::On::ON; // send event this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON); // confirm response this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); - - // reset count to 0 - this->m_safetyCounter = 0; - - this->gpioSet_out(0, Fw::Logic::HIGH); - this->gpioSet_out(1, Fw::Logic::HIGH); } void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index 0cbc0c9b..b30f6b95 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -49,8 +49,10 @@ class Burnwire final : public BurnwireComponentBase { void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off - U32 m_safetyCounter = 0; // keeps track of the safety number of seconds - U32 m_safetyMaxCount = 5; + std::atomic + m_safetyCounter; // makes this an atomic variable (so its set only in one comnmdn), so you won't have smth so + // you read and write half the value bc a corrupted read could be dangerouts + U32 m_safetyMaxCount = 5; // make this a aparamater }; } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md index a973b9d7..c26b9d86 100644 --- a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md +++ b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md @@ -1,22 +1,36 @@ # Components::Burnwire -Turns Burnwire on and off +Driving the Burnwire on and off. The deployment will be handled by the Antenna Deployment component TODO ADD details + +## Sequence Diagrams +Add sequence diagrams here ## Requirements Add requirements in the chart below | Name | Description | Validation | -|BW-001|The burnwire component shall turn on when commanded to |Hardware Test| -|BW-002|The burnwire component shall turn off when commanded to |Hardware Test| +| ---- | ----------- | ------ | +|BW-001|The burnwire shall turn on in response to a port call |Hardware Test| +|BW-002|The burnwire shall turn off in response to a port call |Hardware Test| |BW-003|The burnwire component shall provide an Event when it is turned on and off |Integration Test| |BW-004|The burnwire component shall activate by turning the GPIO pins on one at a time |Integration Test| -|BW-005|The burnwire component shall be controlled by a safety timeout that can be changed within the code |Integration Test| +|BW-005|The burnwire component shall be controlled by a safety timeout attached to a 1Hz rate group that can be changed within the code |Integration Test| +|BW-006|The burnwire safety time shall emit an event when it starts and stops |Integration Test| + + +Use the Zephyr GPIO driver --> so that the GPIO driver can be changed instead of being hardcoded +checking is it calling that set port, break the two layers out +Write, read get interrupt from GPIO +single port of type driver.gPIO write that is a port on your FPP ## Port Descriptions -| Name | Description | -|---|---| -|Fw::Signal|Receive stop signal to stop and start burnwire| -|Drv::GpioWrite|Control GPIO state to driver| +Name | Type | Description | +|----|---|---| +|----|`Fw::Signal`|Receive stop signal to stop the burnwire| +|----|`Fw::Signal`|Receive start signal to start burnwire| +|----|`Drv::GpioWrite`|Control GPIO state to driver| +|schedIn|[`Svc::Sched`]| run | Input | Synchronous | Receive periodic calls from rate group + ## Commands | Name | Description | @@ -37,31 +51,15 @@ Add component states in the chart below |----|---| |m_state|Keeps track if the burnwire is on or off| -## Sequence Diagrams -Add sequence diagrams here - -## Parameters -| Name | Description | -|---|---| -|---|---| - - - - - -## Telemetry -| Name | Description | -|---|---| -|---|---| ## Unit Tests Add unit test descriptions in the chart below | Name | Description | Output | Coverage | |TestSafety|Tests Burnwire turns off after X seconds|---|---| |TestOn|Tests right GPIO pins turn on |---|---| -|TestOn|Tests right GPIO pins turn off, same as on |---|---| +|TestOn|Tests right GPIO pins turn off, same as |---|---| -## Change Log -| Date | Description | -|---|---| -|---| Initial Draft | + +## Parameter +| Name | Description | +| ---- | ----------- | diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 18fcc2d0..d753dc2e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -14,6 +14,8 @@ #include static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); +// static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(burnwire0), gpios); + static const struct gpio_dt_spec burnwire0Gpio = { .port = DEVICE_DT_GET(DT_NODELABEL(gpio0)), .pin = 28, // 28 diff --git a/boards/rpi_pico2_rp2350a_m33.overlay b/boards/rpi_pico2_rp2350a_m33.overlay index 1128e6e2..f0a9d78d 100644 --- a/boards/rpi_pico2_rp2350a_m33.overlay +++ b/boards/rpi_pico2_rp2350a_m33.overlay @@ -9,6 +9,11 @@ zephyr,console = &cdc_acm_uart0; }; + aliases { + burnwire0 = &burnwire0; + burnwire1 = &burnwire1; + }; + burnwire0: burnwire0 { gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; label = "Burnwire 0, 28"; @@ -19,10 +24,6 @@ label = "Burnwire 1, 29"; }; - aliases { - burnwire0 = &burnwire0; - burnwire1 = &burnwire1; - }; }; /* Override the default LED definition to use GPIO 24 instead of GPIO 25 for PROVES FC board*/ From afefe1db3bec46cbd0e02490e63f9f4b689e33c7 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Fri, 5 Sep 2025 12:15:50 -0700 Subject: [PATCH 7/8] added input ports --- .../Components/Burnwire/Burnwire.fpp | 6 ++++++ .../Components/Burnwire/Burnwire.hpp | 10 +++++----- .../Components/Burnwire/docs/sdd.md | 15 ++++----------- .../Top/ReferenceDeploymentTopology.cpp | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp index 1b7e786d..25d36d87 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.fpp @@ -29,6 +29,12 @@ module Components { # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched + @ Port getting start signal + sync input port burnStart: Fw.Signal + + @ Port getting stop signal + sync input port burnStop: Fw.Signal + @ Input Port to get the rate group sync input port schedIn: Svc.Sched diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index b30f6b95..bbe83087 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -7,6 +7,7 @@ #ifndef Components_Burnwire_HPP #define Components_Burnwire_HPP +#include #include "FprimeZephyrReference/Components/Burnwire/BurnwireComponentAc.hpp" namespace Components { @@ -48,11 +49,10 @@ class Burnwire final : public BurnwireComponentBase { //! Handler implementation for command STOP_BURNWIRE void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override; - Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off - std::atomic - m_safetyCounter; // makes this an atomic variable (so its set only in one comnmdn), so you won't have smth so - // you read and write half the value bc a corrupted read could be dangerouts - U32 m_safetyMaxCount = 5; // make this a aparamater + Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off + std::atomic m_safetyCounter; // makes this an atomic variable (so its set only in one command), + // you read and write half the value bc a corrupted read could be dangerouts + U32 m_safetyMaxCount = 5; // make this a aparamater }; } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md index c26b9d86..9b237cd9 100644 --- a/FprimeZephyrReference/Components/Burnwire/docs/sdd.md +++ b/FprimeZephyrReference/Components/Burnwire/docs/sdd.md @@ -16,19 +16,12 @@ Add requirements in the chart below |BW-005|The burnwire component shall be controlled by a safety timeout attached to a 1Hz rate group that can be changed within the code |Integration Test| |BW-006|The burnwire safety time shall emit an event when it starts and stops |Integration Test| - -Use the Zephyr GPIO driver --> so that the GPIO driver can be changed instead of being hardcoded -checking is it calling that set port, break the two layers out -Write, read get interrupt from GPIO -single port of type driver.gPIO write that is a port on your FPP - - ## Port Descriptions Name | Type | Description | |----|---|---| -|----|`Fw::Signal`|Receive stop signal to stop the burnwire| -|----|`Fw::Signal`|Receive start signal to start burnwire| -|----|`Drv::GpioWrite`|Control GPIO state to driver| +|burnStop|`Fw::Signal`|Receive stop signal to stop the burnwire| +|burnStart|`Fw::Signal`|Receive start signal to start burnwire| +|gpioSet|`Drv::GpioWrite`|Control GPIO state to driver| |schedIn|[`Svc::Sched`]| run | Input | Synchronous | Receive periodic calls from rate group @@ -62,4 +55,4 @@ Add unit test descriptions in the chart below ## Parameter | Name | Description | -| ---- | ----------- | +| m_safetyMaxCount | The maximum amount that the burnwire will burn before stopping itself for safety | diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index d753dc2e..e081edc7 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -14,7 +14,7 @@ #include static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); -// static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(burnwire0), gpios); +// static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_ALIAS(burnwire0), gpios); static const struct gpio_dt_spec burnwire0Gpio = { .port = DEVICE_DT_GET(DT_NODELABEL(gpio0)), From ebce0e890758c0515146859ba03c0b234061f718 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Mon, 8 Sep 2025 13:09:40 -0700 Subject: [PATCH 8/8] appease linter --- .../Components/CMakeLists.txt | 1 + .../Components/DistanceSensor/CMakeLists.txt | 36 +++++++++++ .../DistanceSensor/DistanceSensor.cpp | 19 ++++++ .../DistanceSensor/DistanceSensor.fpp | 55 +++++++++++++++++ .../DistanceSensor/DistanceSensor.hpp | 30 ++++++++++ .../Components/DistanceSensor/docs/sdd.md | 59 +++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 FprimeZephyrReference/Components/DistanceSensor/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.cpp create mode 100644 FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.fpp create mode 100644 FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.hpp create mode 100644 FprimeZephyrReference/Components/DistanceSensor/docs/sdd.md diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index 411a0622..186f471a 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -3,3 +3,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/DistanceSensor/") diff --git a/FprimeZephyrReference/Components/DistanceSensor/CMakeLists.txt b/FprimeZephyrReference/Components/DistanceSensor/CMakeLists.txt new file mode 100644 index 00000000..67e94965 --- /dev/null +++ b/FprimeZephyrReference/Components/DistanceSensor/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/DistanceSensor.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/DistanceSensor.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/DistanceSensor.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/DistanceSensorTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/DistanceSensorTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.cpp b/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.cpp new file mode 100644 index 00000000..891773e2 --- /dev/null +++ b/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.cpp @@ -0,0 +1,19 @@ +// ====================================================================== +// \title DistanceSensor.cpp +// \author aldjia +// \brief cpp file for DistanceSensor component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.hpp" + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +DistanceSensor ::DistanceSensor(const char* const compName) : DistanceSensorComponentBase(compName) {} + +DistanceSensor ::~DistanceSensor() {} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.fpp b/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.fpp new file mode 100644 index 00000000..f0a72b86 --- /dev/null +++ b/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.fpp @@ -0,0 +1,55 @@ +module Components { + @ Sensor that detects the distance of the antenna from the satellite. Used by Antenna Deployment component to know if the antennas are deployed yet + passive component DistanceSensor { + + ############################################################################## + #### Uncomment the following examples to start customizing your component #### + ############################################################################## + + # @ Example async command + # async command COMMAND_NAME(param_name: U32) + + # @ Example telemetry counter + # telemetry ExampleCounter: U64 + + # @ Example event + # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + + # @ Example port: receiving calls from the rate group + # sync input port run: Svc.Sched + + # @ Example parameter + # param PARAMETER_NAME: U32 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending command registrations + command reg port cmdRegOut + + @ Port for receiving commands + command recv port cmdIn + + @ Port for sending command responses + command resp port cmdResponseOut + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + @ Port to return the value of a parameter + param get port prmGetOut + + @Port to set the value of a parameter + param set port prmSetOut + + } +} diff --git a/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.hpp b/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.hpp new file mode 100644 index 00000000..5ad3fdc2 --- /dev/null +++ b/FprimeZephyrReference/Components/DistanceSensor/DistanceSensor.hpp @@ -0,0 +1,30 @@ +// ====================================================================== +// \title DistanceSensor.hpp +// \author aldjia +// \brief hpp file for DistanceSensor component implementation class +// ====================================================================== + +#ifndef Components_DistanceSensor_HPP +#define Components_DistanceSensor_HPP + +#include "FprimeZephyrReference/Components/DistanceSensor/DistanceSensorComponentAc.hpp" + +namespace Components { + +class DistanceSensor final : public DistanceSensorComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct DistanceSensor object + DistanceSensor(const char* const compName //!< The component name + ); + + //! Destroy DistanceSensor object + ~DistanceSensor(); +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/DistanceSensor/docs/sdd.md b/FprimeZephyrReference/Components/DistanceSensor/docs/sdd.md new file mode 100644 index 00000000..cbdce206 --- /dev/null +++ b/FprimeZephyrReference/Components/DistanceSensor/docs/sdd.md @@ -0,0 +1,59 @@ +# Components::DistanceSensor + +Sensor that detects the distance of the antenna from the satellite. Used by Antenna Deployment component to know if the antennas are deployed yet + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|DS-001|The distance sensor shall measure its distance from a command input|---| +|DS-002|The distance sensor shall measure its distance from a port input GPIO pin|---| + +### Diagrams +Add diagrams here + +## Port Descriptions +| Name | Type | Description | +|---|---|----| +|get_data|`Fw::Signal`|Receive signal to send distance information| +|gpioSet|`Drv::GpioWrite`|Control GPIO state to driver| +|schedIn|[`Svc::Sched`]| run | Input | Synchronous | Receive periodic calls from rate group + +## Component States +Add component states in the chart below +| Name | Description | +|---|---| + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|RngSclFactor| Range scaling factor of the sensoe| +|---|---| + +## Commands +| Name | Description | +|---|---| +|GET_DISTANCE|Sends Distance as an event| + +## Events +| Name | Description | +|---|---| +|Current_Distance|Sends the current distance sensot| + +## Telemetry +| Name | Description | +|---|---| +|Distance|The Distance from the distance sensor| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + + +## Change Log +| Date | Description | +|---|---| +|Sep 8| Initial Draft |