Skip to content

Commit 488b01c

Browse files
committed
added rate group
1 parent 7c11e85 commit 488b01c

File tree

6 files changed

+45
-12
lines changed

6 files changed

+45
-12
lines changed

FprimeZephyrReference/Components/Burnwire/Burnwire.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,27 @@ Burnwire ::~Burnwire() {}
2020
// Handler implementations for typed input ports
2121
// ----------------------------------------------------------------------
2222

23-
void Burnwire ::stop_handler(FwIndexType portNum) {
24-
// TODO
23+
// void Burnwire ::stop_handler(FwIndexType portNum) {
24+
// //TODO
25+
// }
26+
27+
void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) {
28+
if (this->m_state == Fw::On::ON) {
29+
this->m_safetyCounter++;
30+
if (this->m_safetyCounter == 1) {
31+
this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::ON);
32+
}
33+
34+
if (this->m_safetyCounter >= m_safetyMaxCount) {
35+
// 30 seconds reached → turn OFF
36+
this->gpioSet_out(0, Fw::Logic::LOW);
37+
this->gpioSet_out(1, Fw::Logic::LOW);
38+
39+
this->m_state = Fw::On::OFF;
40+
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF);
41+
this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::OFF);
42+
}
43+
}
2544
}
2645

2746
// ----------------------------------------------------------------------
@@ -36,6 +55,9 @@ void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
3655
// confirm response
3756
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
3857

58+
// reset count to 0
59+
this->m_safetyCounter = 0;
60+
3961
this->gpioSet_out(0, Fw::Logic::HIGH);
4062
this->gpioSet_out(1, Fw::Logic::HIGH);
4163
}

FprimeZephyrReference/Components/Burnwire/Burnwire.fpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ module Components {
2222
severity activity high \
2323
format "Burnwire State: {}"
2424

25+
event SafetyTimerStatus(burnwire_state: Fw.On) \
26+
severity activity high\
27+
format "Safety Timer State: {} "
28+
2529
# @ Example port: receiving calls from the rate group
2630
# sync input port run: Svc.Sched
2731

28-
@ Input Port to start and stop the burnwire
29-
sync input port stop: Fw.Signal
32+
@ Input Port to get the rate group
33+
sync input port schedIn: Svc.Sched
3034

3135
@ Port sending calls to the GPIO driver to stop and start the burnwire
3236
output port gpioSet: [2] Drv.GpioWrite

FprimeZephyrReference/Components/Burnwire/Burnwire.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ class Burnwire final : public BurnwireComponentBase {
3232
//! Handler implementation for stop
3333
//!
3434
//! Port to start and stop the burnwire
35-
void stop_handler(FwIndexType portNum //!< The port number
36-
) override;
35+
36+
void schedIn_handler(FwIndexType portNum, //!< The port number
37+
U32 context //!< The call order
38+
) override;
3739

3840
private:
3941
// ----------------------------------------------------------------------
@@ -47,6 +49,8 @@ class Burnwire final : public BurnwireComponentBase {
4749
void STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) override;
4850

4951
Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off
52+
U32 m_safetyCounter = 0; // keeps track of the safety number of seconds
53+
U32 m_safetyMaxCount = 5;
5054
};
5155

5256
} // namespace Components

FprimeZephyrReference/Components/Burnwire/docs/sdd.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Add requirements in the chart below
99
|BW-002|The burnwire component shall turn off when commanded to |Hardware Test|
1010
|BW-003|The burnwire component shall provide an Event when it is turned on and off |Integration Test|
1111
|BW-004|The burnwire component shall activate by turning the GPIO pins on one at a time |Integration Test|
12+
|BW-005|The burnwire component shall be controlled by a safety timeout that can be changed within the code |Integration Test|
1213

1314

1415
## Port Descriptions
@@ -33,8 +34,8 @@ Add requirements in the chart below
3334
## Component States
3435
Add component states in the chart below
3536
| Name | Description |
36-
|---|---|
37-
|---|---|
37+
|----|---|
38+
|m_state|Keeps track if the burnwire is on or off|
3839

3940
## Sequence Diagrams
4041
Add sequence diagrams here
@@ -56,8 +57,9 @@ Add sequence diagrams here
5657
## Unit Tests
5758
Add unit test descriptions in the chart below
5859
| Name | Description | Output | Coverage |
59-
|---|---|---|---|
60-
|---|---|---|---|
60+
|TestSafety|Tests Burnwire turns off after X seconds|---|---|
61+
|TestOn|Tests right GPIO pins turn on |---|---|
62+
|TestOn|Tests right GPIO pins turn off, same as on |---|---|
6163

6264
## Change Log
6365
| Date | Description |

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
1717
static const struct gpio_dt_spec burnwire0Gpio = {
1818
.port = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
19-
.pin = 28,
19+
.pin = 28, // 28
2020
.dt_flags = GPIO_ACTIVE_HIGH,
2121
};
2222
static const struct gpio_dt_spec burnwire1Gpio = {
2323
.port = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
24-
.pin = 29,
24+
.pin = 29, // 29
2525
.dt_flags = GPIO_ACTIVE_HIGH,
2626
};
2727

FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ module ReferenceDeployment {
9595
rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn
9696
rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run
9797
rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run
98+
rateGroup1Hz.RateGroupMemberOut[5] -> burnwire.schedIn
9899
}
99100

100101

0 commit comments

Comments
 (0)