Skip to content
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a563640
Add load switch component
kevinthegreat1 Oct 9, 2025
5d5648f
Fix tables
kevinthegreat1 Oct 23, 2025
8f00e03
Sarah Kevin MoMata Squad Load Switch
hyuncat Oct 23, 2025
628fcbe
Sarah Kevin and MoMata fixed a bug
hyuncat Oct 23, 2025
91b25fe
Commit farming
hyuncat Oct 23, 2025
076bf65
Added mcp23017 to v5 dtsi
moisesmata Oct 23, 2025
24a2e97
Rough initial implementation + add to topology
moisesmata Oct 23, 2025
3761180
Ion even know any mane
moisesmata Oct 23, 2025
bcb6f24
Merged in Main
Mikefly123 Nov 3, 2025
3fec032
Working Device Tree (But F Prime Crash)
Mikefly123 Nov 3, 2025
09c61fd
Update CommandDispatcherImplCfg.hpp
Mikefly123 Nov 3, 2025
b5544e7
Update Submodules
moisesmata Nov 4, 2025
5351c58
Revert "Update Submodules"
Mikefly123 Nov 5, 2025
9132297
Initial plan
Copilot Nov 5, 2025
72c314d
Reset m_totalAttempts in resetDeploymentState to fix integration test…
Copilot Nov 5, 2025
55f96f5
Fix integration test failures - final status
Copilot Nov 5, 2025
e5afec1
Remove CodeQL artifact and update gitignore
Copilot Nov 5, 2025
46e6604
Add Reset port functionality
moisesmata Nov 6, 2025
98326f2
Add remaining load switch instances
kevinthegreat1 Nov 6, 2025
9c72d7a
Small updates to extra loadSwitch instances, update max packets
moisesmata Nov 6, 2025
d7fce15
Remove output read port, add output write port
moisesmata Nov 6, 2025
4dff326
Modify LoadSwitch to use ZephyrGpioDriver Component
moisesmata Nov 7, 2025
3d91f1e
Modify gpioDriver name for watchdog for clarity
moisesmata Nov 7, 2025
6095153
Instances of GPIO Drivers, connected to load switches in topology
moisesmata Nov 7, 2025
2b9f0a9
First implementation load_switch_test
Hufamily Nov 7, 2025
b65806b
Labels for devicetree gpios fixed
moisesmata Nov 7, 2025
6f76ed3
Update sdd
moisesmata Nov 8, 2025
6d010cb
Moises made them active lmao
RobertPendergrast Nov 11, 2025
6b300c4
Merge branch 'main' of github.com:Open-Source-Space-Foundation/proves…
ineskhou Nov 11, 2025
58d2293
corrected merge errors
ineskhou Nov 11, 2025
1664683
appease linter
ineskhou Nov 11, 2025
a6a6e0c
fixed the queue build error bc of linter
ineskhou Nov 11, 2025
009516d
fixed burnwire incremnentation
ineskhou Nov 11, 2025
4629c30
changed increments
ineskhou Nov 11, 2025
4708db9
move invrement
ineskhou Nov 11, 2025
d37d7b3
ading inclused
ineskhou Nov 11, 2025
c72137d
remove the degugs
ineskhou Nov 11, 2025
6e58bb9
formal burnwire timer
ineskhou Nov 11, 2025
c55dd30
switched the order of the rate grounps
ineskhou Nov 11, 2025
4afa777
reverted timer debugdding code
ineskhou Nov 11, 2025
3e2a959
linter
ineskhou Nov 11, 2025
adac017
remove the reset of the count for now
ineskhou Nov 11, 2025
3a24746
Merge branch 'copilot/fix-integration-test-failures' of github.com:Op…
ineskhou Nov 11, 2025
583a7a4
refer to the right load switch in the tests
ineskhou Nov 11, 2025
bcfbae8
checking a differnt conversion for the tests
ineskhou Nov 11, 2025
7a0233a
fix clang linter
ineskhou Nov 11, 2025
3d0759d
missed some binary
ineskhou Nov 11, 2025
3345383
switched the telem packets
ineskhou Nov 12, 2025
453990c
switched the correct onces back
ineskhou Nov 12, 2025
5d33eb5
Very important commit
moisesmata Nov 12, 2025
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
1 change: 1 addition & 0 deletions FprimeZephyrReference/Components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PowerMonitor/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/")
36 changes: 36 additions & 0 deletions FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}/LoadSwitch.fpp"
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.cpp"
# DEPENDS
# MyPackage_MyOtherModule
)

### Unit Tests ###
# register_fprime_ut(
# AUTOCODER_INPUTS
# "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp"
# SOURCES
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTestMain.cpp"
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTester.cpp"
# DEPENDS
# STest # For rules-based testing
# UT_AUTO_HELPERS
# )
53 changes: 53 additions & 0 deletions FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// ======================================================================
// \title LoadSwitch.cpp
// \author sarah
// \brief cpp file for LoadSwitch component implementation class
// ======================================================================

#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp"

#include <zephyr/drivers/gpio.h>

namespace Components {

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

LoadSwitch ::LoadSwitch(const char* const compName) : LoadSwitchComponentBase(compName) {}

LoadSwitch ::~LoadSwitch() {}

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

void LoadSwitch ::Reset_handler(FwIndexType portNum) {
this->gpioSet_out(0, Fw::Logic::LOW);
this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF);
this->tlmWrite_IsOn(Fw::On::OFF);
k_sleep(K_MSEC(100));
this->gpioSet_out(0, Fw::Logic::HIGH);
this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON);
this->tlmWrite_IsOn(Fw::On::ON);
}

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

void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
this->gpioSet_out(0, Fw::Logic::HIGH);
this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON);
this->tlmWrite_IsOn(Fw::On::ON);
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}

void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
this->gpioSet_out(0, Fw::Logic::LOW);
this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF);
this->tlmWrite_IsOn(Fw::On::OFF);
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}

} // namespace Components
72 changes: 72 additions & 0 deletions FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
module Components {
@ A generic load switch for controlling power to components
passive component LoadSwitch {

# One async command/port is required for active components
# This should be overridden by the developers with a useful command/port

##############################################################################
#### Uncomment the following examples to start customizing your component ####
##############################################################################

# @ Example async command
# async command COMMAND_NAME(param_name: U32)
sync command TURN_ON()
sync command TURN_OFF()

# @ Example telemetry counter
# telemetry ExampleCounter: U64
telemetry IsOn: Fw.On

# @ Example event
# event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}"
event StatusChanged($state: Fw.On) severity activity high id 1 format "Load switch state changed to {}"

# @ Example port: receiving calls from the rate group
# sync input port run: Svc.Sched
#output port Status: Drv.GpioRead
#We will not be putting a Drv.GpioRead port here, we are using the Gpio Driver component which has this already!

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


# Input that will be used by other components if they want to force a reset
# (off and on again) of the load switch
sync input port Reset: Fw.Signal

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

}
}
57 changes: 57 additions & 0 deletions FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// ======================================================================
// \title LoadSwitch.hpp
// \author sarah
// \brief hpp file for LoadSwitch component implementation class
// ======================================================================

#ifndef Components_LoadSwitch_HPP
#define Components_LoadSwitch_HPP

#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp"
#include <zephyr/kernel.h>

// Forward declare Zephyr types to avoid header conflicts
struct device;

namespace Components {

class LoadSwitch final : public LoadSwitchComponentBase {
public:
// ----------------------------------------------------------------------
// Component construction and destruction
// ----------------------------------------------------------------------

//! Construct LoadSwitch object
LoadSwitch(const char* const compName //!< The component name
);

//! Destroy LoadSwitch object
~LoadSwitch();

private:
// ----------------------------------------------------------------------
// Handler implementations for commands
// ----------------------------------------------------------------------

//! Handler implementation for command TURN_ON
void TURN_ON_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq //!< The command sequence number
) override;

//! Handler implementation for command TURN_OFF
void TURN_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq //!< The command sequence number
) override;

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

//! Handler implementation for Reset
void Reset_handler(FwIndexType portNum //!< The port number
) override;
};

} // namespace Components

#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Components::LoadSwitch

![LoadSwitch](LoadSwitch.svg)

## Overview

The `LoadSwitch` component is an active F' component that controls a single load switch output
through the `gpioSet` output port (connected to the platform's GPIO driver). It exposes two
async commands to turn the switch on and off, telemetry reporting the current state, and an
async `Reset` input which toggles the switch (off, short delay, on).

## Responsibility

- Control the power rail for a connected peripheral by asserting/deasserting a GPIO.
- Report state changes via an event and telemetry channel.

## External interface

### Commands

| Name | Description | Implementation notes |
|---|---|---|
| TURN_ON | Turn on the associated power rail | `TURN_ON_cmdHandler` sets the gpio via `gpioSet_out(0, Fw::Logic::HIGH)`, emits `StatusChanged` (ON), updates `IsOn` telemetry, replies OK. |
| TURN_OFF | Turn off the associated power rail | `TURN_OFF_cmdHandler` sets the gpio via `gpioSet_out(0, Fw::Logic::LOW)`, emits `StatusChanged` (OFF), updates `IsOn` telemetry, replies OK. |

### Telemetry

| Name | Type | Description |
|---|---:|---|
| IsOn | Fw.On | Current power state; written after commands and on Reset handling. |

### Events

| Name | Severity | ID | Format |
|---|---|---:|---|
| StatusChanged | activity high | 1 | "Load switch state changed to {}" |

The component logs the `StatusChanged` event whenever the switch transitions due to a command or a Reset.

### Ports

| Port name | Direction | Port type | Notes |
|---|---|---|---|
| gpioSet | output | Drv.GpioWrite | Used to write the physical GPIO. Implementation always uses index 0 (`gpioSet_out(0, ...)`). |
| Reset | input (async) | Fw.Signal | Causes the component to perform a hardware reset sequence: LOW -> wait 100ms -> HIGH. |


## Change Log

| Date | Description |
|---|---|
| 10-22-2025 | Sarah, Kevin, and MoMata's first commit |
| 11-07-2025 | Updated SDD to match implementation in `LoadSwitch.cpp/.hpp/.fpp` (commands, telemetry, event, ports, reset behavior). |
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,18 @@ telemetry packets ReferenceDeploymentPackets {
ReferenceDeployment.antennaDeployer.LastDistance
}

packet PowerMonitor id 9 group 4 {
packet LoadSwitches id 9 group 4 {
ReferenceDeployment.face4LoadSwitch.IsOn
ReferenceDeployment.face0LoadSwitch.IsOn
ReferenceDeployment.face1LoadSwitch.IsOn
ReferenceDeployment.face2LoadSwitch.IsOn
ReferenceDeployment.face3LoadSwitch.IsOn
ReferenceDeployment.face5LoadSwitch.IsOn
ReferenceDeployment.payloadPowerLoadSwitch.IsOn
ReferenceDeployment.payloadBatteryLoadSwitch.IsOn
}

packet PowerMonitor id 10 group 4 {
ReferenceDeployment.ina219SysManager.Voltage
ReferenceDeployment.ina219SysManager.Current
ReferenceDeployment.ina219SysManager.Power
Expand Down
Loading