Skip to content

Commit 7b2fae4

Browse files
committed
add MagnetorquerManager scaffold and add DRV2605 to dtsi
1 parent f1ca87d commit 7b2fae4

File tree

8 files changed

+248
-0
lines changed

8 files changed

+248
-0
lines changed

FprimeZephyrReference/Components/Drv/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/")
44
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RtcManager")
55
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/")
66
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BDotDetumble/")
7+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager/")
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}/MagnetorquerManager.fpp"
20+
SOURCES
21+
"${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.cpp"
22+
# DEPENDS
23+
# MyPackage_MyOtherModule
24+
)
25+
26+
### Unit Tests ###
27+
# register_fprime_ut(
28+
# AUTOCODER_INPUTS
29+
# "${CMAKE_CURRENT_LIST_DIR}/MagnetorquerManager.fpp"
30+
# SOURCES
31+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/MagnetorquerManagerTestMain.cpp"
32+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/MagnetorquerManagerTester.cpp"
33+
# DEPENDS
34+
# STest # For rules-based testing
35+
# UT_AUTO_HELPERS
36+
# )
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// ======================================================================
2+
// \title MagnetorquerManager.cpp
3+
// \author aychar
4+
// \brief cpp file for MagnetorquerManager component implementation class
5+
// ======================================================================
6+
7+
#include "FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManager.hpp"
8+
9+
#include <zephyr/kernel.h>
10+
11+
namespace Drv {
12+
13+
// ----------------------------------------------------------------------
14+
// Component construction and destruction
15+
// ----------------------------------------------------------------------
16+
17+
MagnetorquerManager ::MagnetorquerManager(const char* const compName) : MagnetorquerManagerComponentBase(compName) {
18+
dev = device_get_binding("DRV2605");
19+
}
20+
21+
MagnetorquerManager ::~MagnetorquerManager() {}
22+
23+
} // namespace Drv
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module Drv {
2+
@ Component for F Prime FSW framework.
3+
passive component MagnetorquerManager {
4+
5+
##############################################################################
6+
#### Uncomment the following examples to start customizing your component ####
7+
##############################################################################
8+
9+
# @ Example async command
10+
# async command COMMAND_NAME(param_name: U32)
11+
12+
# @ Example telemetry counter
13+
# telemetry ExampleCounter: U64
14+
15+
# @ Example event
16+
# event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}"
17+
18+
# @ Example port: receiving calls from the rate group
19+
# sync input port run: Svc.Sched
20+
21+
# @ Example parameter
22+
# param PARAMETER_NAME: U32
23+
24+
###############################################################################
25+
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
26+
###############################################################################
27+
@ Port for requesting the current time
28+
time get port timeCaller
29+
30+
@ Port for sending command registrations
31+
command reg port cmdRegOut
32+
33+
@ Port for receiving commands
34+
command recv port cmdIn
35+
36+
@ Port for sending command responses
37+
command resp port cmdResponseOut
38+
39+
@ Port for sending textual representation of events
40+
text event port logTextOut
41+
42+
@ Port for sending events to downlink
43+
event port logOut
44+
45+
@ Port for sending telemetry channels to downlink
46+
telemetry port tlmOut
47+
48+
@ Port to return the value of a parameter
49+
param get port prmGetOut
50+
51+
@Port to set the value of a parameter
52+
param set port prmSetOut
53+
54+
}
55+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// ======================================================================
2+
// \title MagnetorquerManager.hpp
3+
// \author aychar
4+
// \brief hpp file for MagnetorquerManager component implementation class
5+
// ======================================================================
6+
7+
#ifndef Drv_MagnetorquerManager_HPP
8+
#define Drv_MagnetorquerManager_HPP
9+
10+
#include "FprimeZephyrReference/Components/Drv/MagnetorquerManager/MagnetorquerManagerComponentAc.hpp"
11+
12+
#include <zephyr/device.h>
13+
#include <zephyr/drivers/sensor.h>
14+
#include <zephyr/kernel.h>
15+
16+
namespace Drv {
17+
18+
class MagnetorquerManager final : public MagnetorquerManagerComponentBase {
19+
public:
20+
// ----------------------------------------------------------------------
21+
// Component construction and destruction
22+
// ----------------------------------------------------------------------
23+
24+
//! Construct MagnetorquerManager object
25+
MagnetorquerManager(const char* const compName //!< The component name
26+
);
27+
28+
//! Destroy MagnetorquerManager object
29+
~MagnetorquerManager();
30+
31+
private:
32+
//! Zephyr device to store initialized DRV2605
33+
const struct device* dev;
34+
};
35+
36+
} // namespace Drv
37+
38+
#endif
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Drv::MagnetorquerManager
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 |

boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,30 @@ zephyr_udc0: &usbd {
166166
lsb-microamp = <100>;
167167
label = "INA219";
168168
};
169+
170+
tca9548a: tca9548a@70 {
171+
compatible = "ti,tca9548a";
172+
reg = <0x70>;
173+
#address-cells = <1>;
174+
#size-cells = <0>;
175+
label = "TCA9548A";
176+
177+
tca_channel0: channel@0 {
178+
compatible = "ti,tca9548a-channel";
179+
reg = <0>;
180+
#address-cells = <1>;
181+
#size-cells = <0>;
182+
183+
drv2605: drv2605@5a {
184+
compatible = "ti,drv2605";
185+
status = "okay";
186+
reg = <0x5a>;
187+
label = "DRV2605";
188+
189+
actuator-mode = "LRA";
190+
loop-gain = "HIGH";
191+
feedback-brake-factor = "2X";
192+
};
193+
};
194+
};
169195
};

prj.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ CONFIG_GPIO=y
2828
CONFIG_LED=y
2929
CONFIG_PWM=n
3030
CONFIG_I2C=y
31+
# I2C multiplexer (TCA9548A) priority configuration
32+
CONFIG_I2C_TCA954X_ROOT_INIT_PRIO=70
33+
CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO=71
3134
CONFIG_SPI=y
3235
CONFIG_PINCTRL=y
3336
CONFIG_ASSERT=y

0 commit comments

Comments
 (0)