Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FprimeZephyrReference/Components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Include project-wide components here

add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Led")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog")
87 changes: 0 additions & 87 deletions FprimeZephyrReference/Components/Led/Led.cpp

This file was deleted.

67 changes: 0 additions & 67 deletions FprimeZephyrReference/Components/Led/Led.fpp

This file was deleted.

71 changes: 0 additions & 71 deletions FprimeZephyrReference/Components/Led/Led.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

register_fprime_library(
AUTOCODER_INPUTS
"${CMAKE_CURRENT_LIST_DIR}/Led.fpp"
"${CMAKE_CURRENT_LIST_DIR}/Watchdog.fpp"
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/Led.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Watchdog.cpp"
# DEPENDS
# MyPackage_MyOtherModule
)
54 changes: 54 additions & 0 deletions FprimeZephyrReference/Components/Watchdog/Watchdog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// ======================================================================
// \title Watchdog.cpp
// \author moisesmata
// \brief cpp file for Watchdog component implementation class
// ======================================================================

#include "FprimeZephyrReference/Components/Watchdog/Watchdog.hpp"
#include "config/FpConfig.hpp"

namespace Components {

// ----------------------------------------------------------------------
// Component construction and destruction
// ----------------------------------------------------------------------

Watchdog ::Watchdog(const char* const compName) : WatchdogComponentBase(compName) {}

Watchdog ::~Watchdog() {}

// ----------------------------------------------------------------------
// Handler implementations for user-defined typed input ports
// ----------------------------------------------------------------------

void Watchdog ::run_handler(FwIndexType portNum, U32 context) {
// Only perform actions when stop not requested
if (!this->m_stopRequested) {
// Toggle state every rate group call
this->m_state = (this->m_state == Fw::On::ON) ? Fw::On::OFF : Fw::On::ON;
this->m_transitions++;
this->tlmWrite_WatchdogTransitions(this->m_transitions);

this->gpioSet_out(0, (Fw::On::ON == this->m_state) ? Fw::Logic::HIGH : Fw::Logic::LOW);
}
}

void Watchdog ::stop_handler(FwIndexType portNum) {
// Set the stop flag to stop watchdog petting
this->m_stopRequested = true;
this->log_ACTIVITY_HI_WatchdogStop();
}

// ----------------------------------------------------------------------
// Handler implementations for commands
// ----------------------------------------------------------------------

void Watchdog ::TEST_STOP_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
// call stop handler
this->stop_handler(0);

// Provide command response
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}

} // namespace Components
51 changes: 51 additions & 0 deletions FprimeZephyrReference/Components/Watchdog/Watchdog.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module Components {
@ Component to blink an LED as a watchdog petter, driven by a rate group
passive component Watchdog {

@ Command to stop the watchdog petter
sync command TEST_STOP_WATCHDOG(
)

@ Telemetry channel counting watchdog petter transitions
telemetry WatchdogTransitions: U32

@ Event logged when the watchdog petter LED turns on or off
event WatchdogStop() \
severity activity high \
format "Watchdog no longer being pet!"

@ Port receiving calls from the rate group
sync input port run: Svc.Sched

@ Port to stop the watchdog petting
sync input port stop: Fw.Signal

@ Port sending calls to the GPIO driver
output port gpioSet: Drv.GpioWrite

###############################################################################
# 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

}
}
Loading