Skip to content

Commit ed82463

Browse files
committed
Updated Led Component to use no parameters, modified led_0 in pico2_overlay
1 parent 9d4ebf8 commit ed82463

File tree

5 files changed

+34
-67
lines changed

5 files changed

+34
-67
lines changed

FprimeZephyrReference/Components/Led/Led.cpp

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,13 @@ Led ::Led(const char* const compName) : LedComponentBase(compName) {}
1717

1818
Led ::~Led() {}
1919

20-
void Led ::parameterUpdated(FwPrmIdType id) {
21-
Fw::ParamValid isValid = Fw::ParamValid::INVALID;
22-
switch (id) {
23-
case PARAMID_BLINK_INTERVAL: {
24-
// Read back the parameter value
25-
const U32 interval = this->paramGet_BLINK_INTERVAL(isValid);
26-
// NOTE: isValid is always VALID in parameterUpdated as it was just properly set
27-
FW_ASSERT(isValid == Fw::ParamValid::VALID, static_cast<FwAssertArgType>(isValid));
28-
29-
// Emit the blink interval set event
30-
this->log_ACTIVITY_HI_BlinkIntervalSet(interval);
31-
break;
32-
}
33-
default:
34-
FW_ASSERT(0, static_cast<FwAssertArgType>(id));
35-
break;
36-
}
37-
}
38-
3920
// ----------------------------------------------------------------------
4021
// Handler implementations for user-defined typed input ports
4122
// ----------------------------------------------------------------------
4223

4324
void Led ::run_handler(FwIndexType portNum, U32 context) {
44-
// Read back the parameter value
45-
Fw::ParamValid isValid = Fw::ParamValid::INVALID;
46-
U32 interval = this->paramGet_BLINK_INTERVAL(isValid);
47-
FW_ASSERT((isValid != Fw::ParamValid::INVALID) && (isValid != Fw::ParamValid::UNINIT),
48-
static_cast<FwAssertArgType>(isValid));
25+
26+
U32 interval = this->m_blinkInterval; // Get the blink interval from the member variable
4927

5028
// Only perform actions when set to blinking
5129
if (this->m_blinking && (interval != 0)) {
@@ -96,4 +74,15 @@ void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On on
9674
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
9775
}
9876

77+
void Led ::SET_BLINK_INTERVAL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 interval) {
78+
// Update the member variable
79+
this->m_blinkInterval = interval;
80+
81+
// Log the event
82+
this->log_ACTIVITY_HI_BlinkIntervalSet(interval);
83+
84+
// Provide command response
85+
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
86+
}
87+
9988
} // namespace Components

FprimeZephyrReference/Components/Led/Led.fpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ module Components {
77
onOff: Fw.On @< Indicates whether the blinking should be on or off
88
)
99

10+
@ Command to set the LED blink interval
11+
async command SET_BLINK_INTERVAL(
12+
interval: U32 @< Blink interval in rate group ticks
13+
)
14+
1015
@ Telemetry channel to report blinking state.
1116
telemetry BlinkingState: Fw.On
1217

@@ -28,9 +33,6 @@ module Components {
2833
severity activity high \
2934
format "LED blink interval set to {}"
3035

31-
@ Blinking interval in rate group ticks
32-
param BLINK_INTERVAL: U32 default 1
33-
3436
@ Port receiving calls from the rate group
3537
async input port run: Svc.Sched
3638

@@ -61,11 +63,5 @@ module Components {
6163
@ Port for sending telemetry channels to downlink
6264
telemetry port tlmOut
6365

64-
@ Port to return the value of a parameter
65-
param get port prmGetOut
66-
67-
@Port to set the value of a parameter
68-
param set port prmSetOut
69-
7066
}
7167
}

FprimeZephyrReference/Components/Led/Led.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ class Led : public LedComponentBase {
2424
//! Destroy Led object
2525
~Led();
2626

27-
private :
28-
//! Emit parameter updated EVR
29-
//!
30-
void
31-
parameterUpdated(FwPrmIdType id //!< The parameter ID
32-
) override;
33-
3427
private :
3528

3629
// ----------------------------------------------------------------------
@@ -58,13 +51,23 @@ class Led : public LedComponentBase {
5851
U32 cmdSeq, //!< The command sequence number
5952
Fw::On onOff //!< Indicates whether the blinking should be on or off
6053
) override;
54+
55+
//! Handler implementation for command SET_BLINK_INTERVAL
56+
//!
57+
//! Command to set the LED blink interval
58+
void
59+
SET_BLINK_INTERVAL_cmdHandler(FwOpcodeType opCode, //!< The opcode
60+
U32 cmdSeq, //!< The command sequence number
61+
U32 interval //!< Blink interval in rate group ticks
62+
) override;
6163

6264
Fw::On m_state = Fw::On::OFF; //! Keeps track if LED is on or off
6365
U64 m_transitions = 0; //! The number of on/off transitions that have occurred
6466
//! from FSW boot up
6567
U32 m_toggleCounter = 0; //! Keeps track of how many ticks the LED has been on for
6668
bool m_blinking = false; //! Flag: if true then LED blinking will occur else
6769
//! no blinking will happen
70+
U32 m_blinkInterval = 10; //! Blink interval in rate group ticks (FIX FOR ZEPHYR)
6871
};
6972

7073
} // namespace Components

boards/proves_fc_v5c.overlay

Lines changed: 0 additions & 27 deletions
This file was deleted.

boards/rpi_pico2_rp2350a_m33.overlay

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
zephyr,console = &cdc_acm_uart0;
1010
};
1111
};
12+
13+
/* Override the default LED definition to use GPIO 24 instead of GPIO 25 for PROVES FC board*/
14+
&led0 {
15+
gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
16+
label = "User LED GPIO24";
17+
};

0 commit comments

Comments
 (0)