Skip to content

Commit 15d6d7a

Browse files
committed
Initial radio addition
1 parent 36fe485 commit 15d6d7a

20 files changed

+244
-23
lines changed

FprimeZephyrReference/Components/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Drv/")
44
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler")
55
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/")
6+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/")
67
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog")
78
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/")
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
####
2+
# F Prime CMakeLists.txt:
3+
#
4+
# SOURCES: list of source files (to be compiled)
5+
# AUTOCODER_INPUTS: list of files to be passed to the autocoders
6+
# DEPENDS: list of libraries that this module depends on
7+
#
8+
# More information in the F´ CMake API documentation:
9+
# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/
10+
#
11+
####
12+
13+
# Module names are derived from the path from the nearest project/library/framework
14+
# root when not specifically overridden by the developer. i.e. The module defined by
15+
# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`.
16+
17+
register_fprime_library(
18+
AUTOCODER_INPUTS
19+
"${CMAKE_CURRENT_LIST_DIR}/NullPrmDb.fpp"
20+
SOURCES
21+
"${CMAKE_CURRENT_LIST_DIR}/NullPrmDb.cpp"
22+
# DEPENDS
23+
# MyPackage_MyOtherModule
24+
)
25+
26+
### Unit Tests ###
27+
# register_fprime_ut(
28+
# AUTOCODER_INPUTS
29+
# "${CMAKE_CURRENT_LIST_DIR}/NullPrmDb.fpp"
30+
# SOURCES
31+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/NullPrmDbTestMain.cpp"
32+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/NullPrmDbTester.cpp"
33+
# DEPENDS
34+
# STest # For rules-based testing
35+
# UT_AUTO_HELPERS
36+
# )
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ======================================================================
2+
// \title NullPrmDb.cpp
3+
// \author starchmd
4+
// \brief cpp file for NullPrmDb component implementation class
5+
// ======================================================================
6+
7+
#include "FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.hpp"
8+
9+
namespace Components {
10+
11+
// ----------------------------------------------------------------------
12+
// Component construction and destruction
13+
// ----------------------------------------------------------------------
14+
15+
NullPrmDb ::NullPrmDb(const char* const compName) : NullPrmDbComponentBase(compName) {}
16+
17+
NullPrmDb ::~NullPrmDb() {}
18+
19+
// ----------------------------------------------------------------------
20+
// Handler implementations for typed input ports
21+
// ----------------------------------------------------------------------
22+
23+
Fw::ParamValid NullPrmDb ::getPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer& val) {
24+
return Fw::ParamValid::INVALID;
25+
}
26+
27+
void NullPrmDb ::setPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer& val) {}
28+
29+
} // namespace Components
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Components {
2+
@ Null parameter database
3+
passive component NullPrmDb {
4+
@ Port to get parameter values
5+
sync input port getPrm: Fw.PrmGet
6+
7+
@ Port to update parameters
8+
sync input port setPrm: Fw.PrmSet
9+
}
10+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// ======================================================================
2+
// \title NullPrmDb.hpp
3+
// \author starchmd
4+
// \brief hpp file for NullPrmDb component implementation class
5+
// ======================================================================
6+
7+
#ifndef Components_NullPrmDb_HPP
8+
#define Components_NullPrmDb_HPP
9+
10+
#include "FprimeZephyrReference/Components/NullPrmDb/NullPrmDbComponentAc.hpp"
11+
12+
namespace Components {
13+
14+
class NullPrmDb final : public NullPrmDbComponentBase {
15+
public:
16+
// ----------------------------------------------------------------------
17+
// Component construction and destruction
18+
// ----------------------------------------------------------------------
19+
20+
//! Construct NullPrmDb object
21+
NullPrmDb(const char* const compName //!< The component name
22+
);
23+
24+
//! Destroy NullPrmDb object
25+
~NullPrmDb();
26+
27+
private:
28+
// ----------------------------------------------------------------------
29+
// Handler implementations for typed input ports
30+
// ----------------------------------------------------------------------
31+
32+
//! Handler implementation for getPrm
33+
//!
34+
//! Port to get parameter values
35+
Fw::ParamValid getPrm_handler(FwIndexType portNum, //!< The port number
36+
FwPrmIdType id, //!< Parameter ID
37+
Fw::ParamBuffer& val //!< Buffer containing serialized parameter value.
38+
//!< Unmodified if param not found.
39+
) override;
40+
41+
//! Handler implementation for setPrm
42+
//!
43+
//! Port to update parameters
44+
void setPrm_handler(FwIndexType portNum, //!< The port number
45+
FwPrmIdType id, //!< Parameter ID
46+
Fw::ParamBuffer& val //!< Buffer containing serialized parameter value
47+
) override;
48+
};
49+
50+
} // namespace Components
51+
52+
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Components::NullPrmDb
2+
3+
Null parameter database. Returns error status on any call.
4+
5+
## Requirements
6+
7+
| Name | Description | Validation |
8+
|---|---|---|
9+
|NULL-PRM-DB-001| Return error on any port call | Inspection|
10+
11+
## Usage Examples
12+
13+
Add the instance to a topology:
14+
15+
```
16+
param connections instance nullPrmDb
17+
```
18+
19+
20+
## Port Descriptions
21+
| Name | Description |
22+
|---|---|
23+
| getPrm | Get parameter, returns `Fw::ParamValid::INVALID` |
24+
| setPrm | No-op |

FprimeZephyrReference/ReferenceDeployment/Main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <zephyr/sys/printk.h>
1212

1313
const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0));
14+
const struct device* lora = DEVICE_DT_GET(DT_NODELABEL(lora0));
1415

1516
int main(int argc, char* argv[]) {
1617
// ** DO NOT REMOVE **//
@@ -22,6 +23,7 @@ int main(int argc, char* argv[]) {
2223
Os::init();
2324
// Object for communicating state to the topology
2425
ReferenceDeployment::TopologyState inputs;
26+
inputs.loraDevice = lora;
2527
inputs.uartDevice = serial;
2628
inputs.baudRate = 115200;
2729

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ telemetry packets ReferenceDeploymentPackets {
22

33
packet Health id 1 group 1 {
44
CdhCore.cmdDisp.CommandsDispatched
5+
CdhCore.cmdDisp.CommandsDropped
56
ComCcsds.comQueue.comQueueDepth
67
ComCcsds.commsBufferManager.HiBuffs
78
ReferenceDeployment.rateGroup10Hz.RgMaxTime
@@ -41,6 +42,10 @@ telemetry packets ReferenceDeploymentPackets {
4142
ReferenceDeployment.lis2mdlManager.MagneticField
4243
}
4344

45+
packet LoRa id 7 group 4 {
46+
lora.LastRssi
47+
lora.LastSnr
48+
}
4449

4550

4651
} omit {

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ void setupTopology(const TopologyState& state) {
7878
startTasks(state);
7979

8080
// Uplink is configured for receive so a socket task is started
81-
comDriver.configure(state.uartDevice, state.baudRate);
81+
// We dont need UART, as we are sending coms directly to lora
82+
//comDriver.configure(state.uartDevice, state.baudRate);
83+
lora.start(state.loraDevice);
8284
}
8385

8486
void startRateGroups() {

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ namespace ReferenceDeployment {
7070
*/
7171
struct TopologyState {
7272
const device* uartDevice; //!< UART device path for communication
73+
const device* loraDevice; //!< LoRa device path for communication
7374
U32 baudRate; //!< Baud rate for UART communication
7475
CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore
7576
ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds

0 commit comments

Comments
 (0)