Skip to content

Commit 4949f90

Browse files
Initial Component Design
1 parent 86238b2 commit 4949f90

File tree

6 files changed

+252
-0
lines changed

6 files changed

+252
-0
lines changed

FprimeZephyrReference/Components/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/")
1010
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/")
1111
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/AntennaDeployer/")
1212
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FsSpace/")
13+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/CameraManager/")
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}/CameraManager.fpp"
20+
SOURCES
21+
"${CMAKE_CURRENT_LIST_DIR}/CameraManager.cpp"
22+
# DEPENDS
23+
# MyPackage_MyOtherModule
24+
)
25+
26+
### Unit Tests ###
27+
# register_fprime_ut(
28+
# AUTOCODER_INPUTS
29+
# "${CMAKE_CURRENT_LIST_DIR}/CameraManager.fpp"
30+
# SOURCES
31+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/CameraManagerTestMain.cpp"
32+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/CameraManagerTester.cpp"
33+
# DEPENDS
34+
# STest # For rules-based testing
35+
# UT_AUTO_HELPERS
36+
# )
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ======================================================================
2+
// \title CameraManager.cpp
3+
// \author robertpendergrast
4+
// \brief cpp file for CameraManager component implementation class
5+
// ======================================================================
6+
7+
#include "FprimeZephyrReference/Components/CameraManager/CameraManager.hpp"
8+
9+
namespace FprimeZephyrReference {
10+
11+
// ----------------------------------------------------------------------
12+
// Component construction and destruction
13+
// ----------------------------------------------------------------------
14+
15+
CameraManager ::CameraManager(const char* const compName) : CameraManagerComponentBase(compName) {}
16+
17+
CameraManager ::~CameraManager() {}
18+
19+
// ----------------------------------------------------------------------
20+
// Handler implementations for commands
21+
// ----------------------------------------------------------------------
22+
23+
void CameraManager ::TAKE_IMAGE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
24+
// Prepare the "snap" command to send over UART via out_port
25+
Fw::Buffer snapBuffer(0, reinterpret_cast<U64>(snap_cmd), sizeof(snap_cmd) - 1); // exclude null terminator
26+
// Send the buffer via out_port, check/send status if needed
27+
Drv::ByteStreamStatus sendStatus = this->out_port_out(0, snapBuffer);
28+
if (sendStatus != Drv::ByteStreamStatus::OP_OK) {
29+
this->log_WARNING_HI_TakeImageError();
30+
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
31+
return;
32+
}
33+
else {
34+
this->log_ACTIVITY_HI_PictureTaken();
35+
}
36+
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
37+
}
38+
39+
} // namespace FprimeZephyrReference
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
module FprimeZephyrReference {
2+
@ Manager for Nicla Vision
3+
active component CameraManager {
4+
5+
# One async command/port is required for active components
6+
# This should be overridden by the developers with a useful command/port
7+
@ TODO
8+
async command TAKE_IMAGE
9+
10+
event TakeImageError() severity warning high format "Failed to take picture"
11+
12+
event PictureTaken() severity activity high format "Picture Taken"
13+
14+
output port out_port: Drv.ByteStreamSend
15+
16+
##############################################################################
17+
#### Uncomment the following examples to start customizing your component ####
18+
##############################################################################
19+
20+
# @ Example async command
21+
# async command COMMAND_NAME(param_name: U32)
22+
23+
# @ Example telemetry counter
24+
# telemetry ExampleCounter: U64
25+
26+
# @ Example event
27+
# event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}"
28+
29+
# @ Example port: receiving calls from the rate group
30+
# sync input port run: Svc.Sched
31+
32+
# @ Example parameter
33+
# param PARAMETER_NAME: U32
34+
35+
###############################################################################
36+
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
37+
###############################################################################
38+
@ Port for requesting the current time
39+
time get port timeCaller
40+
41+
@ Port for sending command registrations
42+
command reg port cmdRegOut
43+
44+
@ Port for receiving commands
45+
command recv port cmdIn
46+
47+
@ Port for sending command responses
48+
command resp port cmdResponseOut
49+
50+
@ Port for sending textual representation of events
51+
text event port logTextOut
52+
53+
@ Port for sending events to downlink
54+
event port logOut
55+
56+
@ Port for sending telemetry channels to downlink
57+
telemetry port tlmOut
58+
59+
@ Port to return the value of a parameter
60+
param get port prmGetOut
61+
62+
@Port to set the value of a parameter
63+
param set port prmSetOut
64+
65+
}
66+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// ======================================================================
2+
// \title CameraManager.hpp
3+
// \author robertpendergrast
4+
// \brief hpp file for CameraManager component implementation class
5+
// ======================================================================
6+
7+
#ifndef FprimeZephyrReference_CameraManager_HPP
8+
#define FprimeZephyrReference_CameraManager_HPP
9+
10+
#include "FprimeZephyrReference/Components/CameraManager/CameraManagerComponentAc.hpp"
11+
12+
namespace FprimeZephyrReference {
13+
14+
class CameraManager final : public CameraManagerComponentBase {
15+
public:
16+
// ----------------------------------------------------------------------
17+
// Component construction and destruction
18+
// ----------------------------------------------------------------------
19+
20+
//! Construct CameraManager object
21+
CameraManager(const char* const compName //!< The component name
22+
);
23+
24+
//! Destroy CameraManager object
25+
~CameraManager();
26+
27+
const char snap_cmd[4] = {'s', 'n', 'a', 'p'};
28+
29+
private:
30+
// ----------------------------------------------------------------------
31+
// Handler implementations for commands
32+
// ----------------------------------------------------------------------
33+
34+
//! Handler implementation for command TAKE_IMAGE
35+
//!
36+
//! TODO
37+
void TAKE_IMAGE_cmdHandler(FwOpcodeType opCode, //!< The opcode
38+
U32 cmdSeq //!< The command sequence number
39+
) override;
40+
};
41+
42+
} // namespace FprimeZephyrReference
43+
44+
#endif
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# FprimeZephyrReference::CameraManager
2+
3+
Manager for Nicla Vision
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 |

0 commit comments

Comments
 (0)