-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add watchdog component * poke2 * Remove docs dir
- Loading branch information
1 parent
cd4eec6
commit f2b4fe1
Showing
10 changed files
with
147 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#### | ||
# F prime CMakeLists.txt: | ||
# | ||
# SOURCE_FILES: combined list of source and autocoding files | ||
# MOD_DEPS: (optional) module dependencies | ||
# UT_SOURCE_FILES: list of source files for unit tests | ||
# | ||
#### | ||
set(SOURCE_FILES | ||
"${CMAKE_CURRENT_LIST_DIR}/Watchdog.fpp" | ||
"${CMAKE_CURRENT_LIST_DIR}/Watchdog.cpp" | ||
) | ||
|
||
register_fprime_module() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// ====================================================================== | ||
// \title Watchdog.cpp | ||
// \author nateinaction | ||
// \brief cpp file for Watchdog component implementation class | ||
// ====================================================================== | ||
|
||
#include "Components/Watchdog/Watchdog.hpp" | ||
#include "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(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) { | ||
// TODO (nateinaction): Convet this to use the gpio output port when it works... | ||
digitalWrite(21, (this->cycle_count % 2) == 0 ? HIGH : LOW); | ||
|
||
this->pet_count += (this->cycle_count % 2) == 0 ? 1 : 0; | ||
this->tlmWrite_WatchdogPets(pet_count); | ||
|
||
this->cycle_count += 1; | ||
} | ||
|
||
} // namespace Components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Components { | ||
@ Petting the Watch Dog to keep the satellite alive. | ||
active component Watchdog { | ||
|
||
@ Port receiving calls from the rate group | ||
async input port run: Svc.Sched | ||
|
||
@ Port sending calls to the GPIO driver | ||
output port gpioSet: Drv.GpioWrite | ||
|
||
@ Telemetry channel to report watchdog pet count. | ||
telemetry WatchdogPets: U64 | ||
|
||
############################################################################### | ||
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters # | ||
############################################################################### | ||
@ Port for requesting the current time | ||
time get port timeCaller | ||
|
||
@ 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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ====================================================================== | ||
// \title Watchdog.hpp | ||
// \author nate | ||
// \brief hpp file for Watchdog component implementation class | ||
// ====================================================================== | ||
|
||
#ifndef Components_Watchdog_HPP | ||
#define Components_Watchdog_HPP | ||
|
||
#include "Components/Watchdog/WatchdogComponentAc.hpp" | ||
#include <Arduino.h> | ||
|
||
namespace Components { | ||
|
||
class Watchdog : public WatchdogComponentBase { | ||
public: | ||
// ---------------------------------------------------------------------- | ||
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
||
//! Construct Watchdog object | ||
Watchdog(const char* const compName //!< The component name | ||
); | ||
|
||
//! Destroy Watchdog object | ||
~Watchdog(); | ||
|
||
PRIVATE: | ||
// ---------------------------------------------------------------------- | ||
// Handler implementations for user-defined typed input ports | ||
// ---------------------------------------------------------------------- | ||
|
||
//! Handler implementation for run | ||
//! | ||
//! Port receiving calls from the rate group | ||
void run_handler(NATIVE_INT_TYPE portNum, //!< The port number | ||
NATIVE_UINT_TYPE context //!< The call order | ||
) override; | ||
|
||
PRIVATE: | ||
U64 pet_count = 0; | ||
U64 cycle_count = 0; | ||
}; | ||
|
||
} // namespace Components | ||
|
||
#endif |