Skip to content

Commit 74bf7a6

Browse files
hrfarmernateinaction
authored andcommitted
Initial IMU component generation
lastFile:FprimeZephyrReference/Components/Imu/Imu.fpp
1 parent 5cfb45d commit 74bf7a6

File tree

10 files changed

+222
-1
lines changed

10 files changed

+222
-1
lines changed

FprimeZephyrReference/Components/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler")
44
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog")
5+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Imu/")
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}/Imu.fpp"
20+
SOURCES
21+
"${CMAKE_CURRENT_LIST_DIR}/Imu.cpp"
22+
# DEPENDS
23+
# MyPackage_MyOtherModule
24+
)
25+
26+
### Unit Tests ###
27+
# register_fprime_ut(
28+
# AUTOCODER_INPUTS
29+
# "${CMAKE_CURRENT_LIST_DIR}/Imu.fpp"
30+
# SOURCES
31+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/ImuTestMain.cpp"
32+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/ImuTester.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 Imu.cpp
3+
// \author aychar
4+
// \brief cpp file for Imu component implementation class
5+
// ======================================================================
6+
7+
#include "FprimeZephyrReference/Components/Imu/Imu.hpp"
8+
9+
namespace Components {
10+
11+
// ----------------------------------------------------------------------
12+
// Component construction and destruction
13+
// ----------------------------------------------------------------------
14+
15+
Imu ::Imu(const char* const compName) : ImuComponentBase(compName) {}
16+
17+
Imu ::~Imu() {}
18+
19+
// ----------------------------------------------------------------------
20+
// Handler implementations for typed input ports
21+
// ----------------------------------------------------------------------
22+
23+
void Imu ::run_handler(FwIndexType portNum, U32 context) {
24+
this->imuCallCount++;
25+
this->tlmWrite_ImuCalls(this->imuCallCount);
26+
this->log_ACTIVITY_HI_ImuTestEvent();
27+
}
28+
29+
} // namespace Components
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module Components {
2+
@ Component for F Prime FSW framework.
3+
passive component Imu {
4+
sync input port run: Svc.Sched
5+
6+
telemetry ImuCalls: U64
7+
8+
event ImuTestEvent() \
9+
severity activity high \
10+
format "WOAH WHATS HAPPENING IS THIS WORKING HELLO"
11+
12+
###############################################################################
13+
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
14+
###############################################################################
15+
@ Port for requesting the current time
16+
time get port timeCaller
17+
18+
@ Port for sending textual representation of events
19+
text event port logTextOut
20+
21+
@ Port for sending events to downlink
22+
event port logOut
23+
24+
@ Port for sending telemetry channels to downlink
25+
telemetry port tlmOut
26+
27+
@ Port to return the value of a parameter
28+
param get port prmGetOut
29+
30+
@Port to set the value of a parameter
31+
param set port prmSetOut
32+
33+
}
34+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// ======================================================================
2+
// \title Imu.hpp
3+
// \author aychar
4+
// \brief hpp file for Imu component implementation class
5+
// ======================================================================
6+
7+
#ifndef Components_Imu_HPP
8+
#define Components_Imu_HPP
9+
10+
#include "FprimeZephyrReference/Components/Imu/ImuComponentAc.hpp"
11+
12+
namespace Components {
13+
14+
class Imu final : public ImuComponentBase {
15+
public:
16+
// ----------------------------------------------------------------------
17+
// Component construction and destruction
18+
// ----------------------------------------------------------------------
19+
20+
//! Construct Imu object
21+
Imu(const char* const compName //!< The component name
22+
);
23+
24+
//! Destroy Imu object
25+
~Imu();
26+
27+
private:
28+
// ----------------------------------------------------------------------
29+
// Handler implementations for typed input ports
30+
// ----------------------------------------------------------------------
31+
32+
//! Handler implementation for TODO
33+
//!
34+
//! TODO
35+
U64 imuCallCount;
36+
void run_handler(FwIndexType portNum, //!< The port number
37+
U32 context //!< The call order
38+
) override;
39+
};
40+
41+
} // namespace Components
42+
43+
#endif
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Components::Imu
2+
3+
Component for F Prime FSW framework.
4+
5+
## Usage Examples
6+
Add usage examples here
7+
8+
### Diagrams
9+
Add diagrams here
10+
11+
### Typical Usage
12+
And the typical usage of the component here
13+
14+
## Class Diagram
15+
Add a class diagram here
16+
17+
## Port Descriptions
18+
| Name | Description |
19+
|---|---|
20+
|---|---|
21+
22+
## Component States
23+
Add component states in the chart below
24+
| Name | Description |
25+
|---|---|
26+
|---|---|
27+
28+
## Sequence Diagrams
29+
Add sequence diagrams here
30+
31+
## Parameters
32+
| Name | Description |
33+
|---|---|
34+
|---|---|
35+
36+
## Commands
37+
| Name | Description |
38+
|---|---|
39+
|---|---|
40+
41+
## Events
42+
| Name | Description |
43+
|---|---|
44+
|---|---|
45+
46+
## Telemetry
47+
| Name | Description |
48+
|---|---|
49+
|---|---|
50+
51+
## Unit Tests
52+
Add unit test descriptions in the chart below
53+
| Name | Description | Output | Coverage |
54+
|---|---|---|---|
55+
|---|---|---|---|
56+
57+
## Requirements
58+
Add requirements in the chart below
59+
| Name | Description | Validation |
60+
|---|---|---|
61+
|---|---|---|
62+
63+
## Change Log
64+
| Date | Description |
65+
|---|---|
66+
|---| Initial Draft |

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ telemetry packets ReferenceDeploymentPackets {
3333
packet Led id 5 group 4 {
3434
ReferenceDeployment.watchdog.WatchdogTransitions
3535
}
36+
37+
packet Imu id 6 group 4 {
38+
ReferenceDeployment.imu.ImuCalls
39+
}
3640

3741

3842
} omit {

FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ module ReferenceDeployment {
6363
instance gpioDriver: Zephyr.ZephyrGpioDriver base id 0x10015000
6464

6565
instance watchdog: Components.Watchdog base id 0x10016000
66+
67+
instance imu: Components.Imu base id 0x10017000
6668
}

FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module ReferenceDeployment {
2929
instance gpioDriver
3030
instance watchdog
3131
instance prmDb
32+
instance imu
3233

3334
# ----------------------------------------------------------------------
3435
# Pattern graph specifiers
@@ -92,12 +93,17 @@ module ReferenceDeployment {
9293
rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn
9394
rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run
9495
rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run
96+
rateGroup1Hz.RateGroupMemberOut[5] -> imu.run
9597
}
9698

9799
connections Watchdog {
98100
watchdog.gpioSet -> gpioDriver.gpioWrite
99101
}
100102

103+
# connections Imu {
104+
105+
# }
106+
101107
connections ReferenceDeployment {
102108

103109
}

FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <Fw/FPrimeBasicTypes.hpp>
1717

1818
namespace Svc {
19-
static const FwChanIdType MAX_PACKETIZER_PACKETS = 5;
19+
static const FwChanIdType MAX_PACKETIZER_PACKETS = 6;
2020
static const FwChanIdType TLMPACKETIZER_NUM_TLM_HASH_SLOTS =
2121
15; // !< Number of slots in the hash table.
2222
// Works best when set to about twice the number of components producing telemetry

0 commit comments

Comments
 (0)