Skip to content

Commit 7c11e85

Browse files
committed
Readme with notes to the connecty stuff to be refined and edited and appease linter
1 parent f5fbe3d commit 7c11e85

File tree

7 files changed

+94
-3
lines changed

7 files changed

+94
-3
lines changed

FprimeZephyrReference/Components/Burnwire/Burnwire.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@ void Burnwire ::START_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
3535
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::ON);
3636
// confirm response
3737
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
38+
39+
this->gpioSet_out(0, Fw::Logic::HIGH);
40+
this->gpioSet_out(1, Fw::Logic::HIGH);
3841
}
3942

4043
void Burnwire ::STOP_BURNWIRE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
4144
this->m_state = Fw::On::OFF;
4245
this->log_ACTIVITY_HI_SetBurnwireState(Fw::On::OFF);
4346
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
47+
this->gpioSet_out(0, Fw::Logic::LOW);
48+
this->gpioSet_out(1, Fw::Logic::LOW);
4449
}
4550

4651
} // namespace Components

FprimeZephyrReference/Components/Burnwire/Burnwire.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ module Components {
2525
# @ Example port: receiving calls from the rate group
2626
# sync input port run: Svc.Sched
2727

28-
@ Port to start and stop the burnwire
28+
@ Input Port to start and stop the burnwire
2929
sync input port stop: Fw.Signal
3030

31-
@ Port sending calls to the GPIO driver
32-
output port gpioSet: Drv.GpioWrite
31+
@ Port sending calls to the GPIO driver to stop and start the burnwire
32+
output port gpioSet: [2] Drv.GpioWrite
3333

3434
# @ Example parameter
3535
# param PARAMETER_NAME: U32

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
#include <zephyr/drivers/gpio.h>
1515

1616
static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
17+
static const struct gpio_dt_spec burnwire0Gpio = {
18+
.port = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
19+
.pin = 28,
20+
.dt_flags = GPIO_ACTIVE_HIGH,
21+
};
22+
static const struct gpio_dt_spec burnwire1Gpio = {
23+
.port = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
24+
.pin = 29,
25+
.dt_flags = GPIO_ACTIVE_HIGH,
26+
};
1727

1828
// Allows easy reference to objects in FPP/autocoder required namespaces
1929
using namespace ReferenceDeployment;
@@ -55,6 +65,8 @@ void configureTopology() {
5565
rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext));
5666

5767
gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
68+
gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
69+
gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
5870
}
5971

6072
// Public functions for use in main program are namespaced with deployment name ReferenceDeployment

FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ module ReferenceDeployment {
6363

6464
instance gpioDriver: Zephyr.ZephyrGpioDriver base id 0x10015000
6565

66+
instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10015100
67+
68+
instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10015200
69+
6670
instance watchdog: Components.Watchdog base id 0x10016000
6771

6872
instance burnwire: Components.Burnwire base id 0x10017000

FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ module ReferenceDeployment {
2727
instance timer
2828
instance comDriver
2929
instance gpioDriver
30+
instance gpioBurnwire0
31+
instance gpioBurnwire1
3032
instance watchdog
3133
instance prmDb
3234
instance burnwire
@@ -95,10 +97,17 @@ module ReferenceDeployment {
9597
rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run
9698
}
9799

100+
98101
connections Watchdog {
99102
watchdog.gpioSet -> gpioDriver.gpioWrite
100103
}
101104

105+
connections BurnwireGpio {
106+
burnwire.gpioSet[0] -> gpioBurnwire0.gpioWrite
107+
burnwire.gpioSet[1] -> gpioBurnwire1.gpioWrite
108+
}
109+
110+
102111
connections ReferenceDeployment {
103112

104113
}

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,54 @@ Finally, run the fprime-gds.
6767
```shell
6868
make gds
6969
```
70+
71+
# How to add a component
72+
73+
1. Overlay
74+
75+
76+
you also want to add aliases
77+
78+
aliases {
79+
burnwire0 = &burnwire0;
80+
burnwire1 = &burnwire1;
81+
};
82+
83+
84+
2.
85+
86+
In RefereneceDeploymentTopology.cpp
87+
static const struct gpio_dt_spec burnwireGpio = GPIO_DT_SPEC_GET(DT_ALIAS(burnwire0), gpios);
88+
89+
gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
90+
gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
91+
92+
93+
and
94+
95+
gpioDriver.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
96+
97+
in topology.fpp
98+
99+
connections burnwire1 {
100+
burnwire1.gpioSet -> gpioDriver.gpioWrite
101+
}
102+
103+
104+
105+
106+
in instances.fpp
107+
instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10015100
108+
109+
instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10015200
110+
111+
112+
in topology.fpp
113+
114+
instance gpioBurnwire0
115+
instance gpioBurnwire1
116+
117+
3. Make a new component in the components folder
118+
4. Add the component to the instances and topology folder
119+
120+
in topology.fpp also instance burnwire

boards/rpi_pico2_rp2350a_m33.overlay

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
1414
label = "Burnwire 0, 28";
1515
};
16+
17+
burnwire1: burnwire1 {
18+
gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
19+
label = "Burnwire 1, 29";
20+
};
21+
22+
aliases {
23+
burnwire0 = &burnwire0;
24+
burnwire1 = &burnwire1;
25+
};
1626
};
1727

1828
/* Override the default LED definition to use GPIO 24 instead of GPIO 25 for PROVES FC board*/

0 commit comments

Comments
 (0)