Skip to content

Commit f1e5405

Browse files
authored
Merge pull request #27 from Open-Source-Space-Foundation/imu2_PR_changes_saidi
Imu Driver Manager Updates
2 parents d66c949 + ac7fd7b commit f1e5405

File tree

26 files changed

+191
-133
lines changed

26 files changed

+191
-133
lines changed

.github/pull_request_template.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Pull Request Title (e.g., Feature: Add user authentication)
2+
3+
## Description
4+
5+
<!-- Provide a clear and concise description of the changes being introduced in this pull request. Explain the "why" behind the changes, not just the "what." -->
6+
7+
## Related Issues/Tickets
8+
9+
<!-- Link any relevant issues, tasks, or user stories (e.g., Closes #123, Fixes #456). -->
10+
11+
## How Has This Been Tested?
12+
13+
<!-- Describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. -->
14+
15+
- [ ] Unit tests
16+
- [ ] Integration tests
17+
- [ ] Z Tests
18+
- [ ] Manual testing (describe steps)
19+
20+
## Screenshots / Recordings (if applicable)
21+
22+
<!-- Provide screenshots or screen recordings that demonstrate the changes, especially for UI-related updates. -->
23+
24+
## Checklist
25+
26+
- [ ] Written detailed sdd with requirements, channels, ports, commands, telemetry defined and correctly formatted and spelled
27+
- [ ] Have written relevant integration tests and have documented them in the sdd
28+
- [ ] Have done a code review with
29+
- [ ] Have tested this PR on every supported board with correct board definitions
30+
31+
## Further Notes / Considerations

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ lib/zephyr-workspace/*
1818
.DS_Store
1919
*.gcov
2020
build
21+
settings.ini
2122

2223
**/__pycache__/
2324
**/*.egg-info/
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Include project-wide components here
2-
32
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Helpers/")
4-
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lis2mdlDriver/")
5-
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoDriver/")
3+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lis2mdlManager/")
4+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoManager/")
65
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Types/")

FprimeZephyrReference/Components/Drv/Helpers/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`.
1616

1717
register_fprime_library(
18-
AUTOCODER_INPUTS
19-
"${CMAKE_CURRENT_LIST_DIR}/Helpers.fpp"
2018
SOURCES
2119
"${CMAKE_CURRENT_LIST_DIR}/Helpers.cpp"
22-
# DEPENDS
23-
# MyPackage_MyOtherModule
20+
DEPENDS
21+
Fw_Types
2422
)
2523

2624
### Unit Tests ###

FprimeZephyrReference/Components/Drv/Helpers/Helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace Drv {
1111

1212
F64 sensor_value_to_f64(const struct sensor_value& val) {
13-
return val.val1 + val.val2 / 1000000.0f;
13+
return val.val1 + (val.val2 / 1000000.0f);
1414
}
1515

1616
} // namespace Drv

FprimeZephyrReference/Components/Drv/Helpers/Helpers.fpp

Whitespace-only changes.

FprimeZephyrReference/Components/Drv/Lsm6dsoDriver/CMakeLists.txt renamed to FprimeZephyrReference/Components/Drv/Lis2mdlManager/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616

1717
register_fprime_library(
1818
AUTOCODER_INPUTS
19-
"${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoDriver.fpp"
19+
"${CMAKE_CURRENT_LIST_DIR}/Lis2mdlManager.fpp"
2020
SOURCES
21-
"${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoDriver.cpp"
21+
"${CMAKE_CURRENT_LIST_DIR}/Lis2mdlManager.cpp"
2222
DEPENDS
2323
FprimeZephyrReference_Components_Drv_Helpers
2424
)
2525

2626
### Unit Tests ###
2727
# register_fprime_ut(
2828
# AUTOCODER_INPUTS
29-
# "${CMAKE_CURRENT_LIST_DIR}/Lsm6dsoDriver.fpp"
29+
# "${CMAKE_CURRENT_LIST_DIR}/Lis2mdlManager.fpp"
3030
# SOURCES
31-
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Lsm6dsoDriverTestMain.cpp"
32-
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Lsm6dsoDriverTester.cpp"
31+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Lis2mdlManagerTestMain.cpp"
32+
# "${CMAKE_CURRENT_LIST_DIR}/test/ut/Lis2mdlManagerTester.cpp"
3333
# DEPENDS
3434
# STest # For rules-based testing
3535
# UT_AUTO_HELPERS
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// ======================================================================
2-
// \title Lis2mdlDriver.cpp
3-
// \brief cpp file for Lis2mdlDriver component implementation class
2+
// \title Lis2mdlManager.cpp
3+
// \brief cpp file for Lis2mdlManager component implementation class
44
// ======================================================================
55

6-
#include "FprimeZephyrReference/Components/Drv/Lis2mdlDriver/Lis2mdlDriver.hpp"
6+
#include "FprimeZephyrReference/Components/Drv/Lis2mdlManager/Lis2mdlManager.hpp"
77

88
#include <Fw/Types/Assert.hpp>
99

@@ -13,23 +13,23 @@ namespace Drv {
1313
// Component construction and destruction
1414
// ----------------------------------------------------------------------
1515

16-
Lis2mdlDriver ::Lis2mdlDriver(const char* const compName) : Lis2mdlDriverComponentBase(compName) {
16+
Lis2mdlManager ::Lis2mdlManager(const char* const compName) : Lis2mdlManagerComponentBase(compName) {
1717
// Initialize the lis2mdl sensor
1818
lis2mdl = device_get_binding("LIS2MDL");
19-
FW_ASSERT(device_is_ready(lis2mdl));
2019
}
2120

22-
Lis2mdlDriver ::~Lis2mdlDriver() {}
21+
Lis2mdlManager ::~Lis2mdlManager() {}
2322

2423
// ----------------------------------------------------------------------
2524
// Handler implementations for typed input ports
2625
// ----------------------------------------------------------------------
2726

28-
Drv::MagneticField Lis2mdlDriver ::magneticFieldRead_handler(FwIndexType portNum) {
27+
Drv::MagneticField Lis2mdlManager ::magneticFieldRead_handler(FwIndexType portNum) {
2928
if (!device_is_ready(lis2mdl)) {
3029
this->log_WARNING_HI_DeviceNotReady();
3130
return Drv::MagneticField(0.0, 0.0, 0.0);
3231
}
32+
this->log_WARNING_HI_DeviceNotReady_ThrottleClear();
3333

3434
struct sensor_value x;
3535
struct sensor_value y;
@@ -41,7 +41,12 @@ Drv::MagneticField Lis2mdlDriver ::magneticFieldRead_handler(FwIndexType portNum
4141
sensor_channel_get(lis2mdl, SENSOR_CHAN_MAGN_Y, &y);
4242
sensor_channel_get(lis2mdl, SENSOR_CHAN_MAGN_Z, &z);
4343

44-
return Drv::MagneticField(Drv::sensor_value_to_f64(x), Drv::sensor_value_to_f64(y), Drv::sensor_value_to_f64(z));
44+
Drv::MagneticField magnetic_readings =
45+
Drv::MagneticField(Drv::sensor_value_to_f64(x), Drv::sensor_value_to_f64(y), Drv::sensor_value_to_f64(z));
46+
47+
this->tlmWrite_MagneticField(magnetic_readings);
48+
49+
return magnetic_readings;
4550
}
4651

4752
} // namespace Drv

FprimeZephyrReference/Components/Drv/Lis2mdlDriver/Lis2mdlDriver.fpp renamed to FprimeZephyrReference/Components/Drv/Lis2mdlManager/Lis2mdlManager.fpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ module Drv {
55

66
# Component definition
77
module Drv {
8-
@ LIS2MDL Driver Component for F Prime FSW framework.
9-
passive component Lis2mdlDriver {
8+
@ LIS2MDL Manager Component for F Prime FSW framework.
9+
passive component Lis2mdlManager {
1010
@ Port to read the current magnetic field in gauss.
1111
sync input port magneticFieldRead: MagneticFieldRead
1212

1313
@ Event for reporting LSM6DSO not ready error
1414
event DeviceNotReady() severity warning high format "LIS2MDL device not ready" throttle 5
1515

16+
@ Telemetry channel for magnetic field in gauss
17+
telemetry MagneticField: MagneticField
18+
19+
1620
###############################################################################
1721
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
1822
###############################################################################
@@ -24,5 +28,8 @@ module Drv {
2428

2529
@ Port for sending events to downlink
2630
event port logOut
31+
32+
@ Port for sending telemetry channels to downlink
33+
telemetry port tlmOut
2734
}
2835
}

FprimeZephyrReference/Components/Drv/Lis2mdlDriver/Lis2mdlDriver.hpp renamed to FprimeZephyrReference/Components/Drv/Lis2mdlManager/Lis2mdlManager.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// ======================================================================
2-
// \title Lis2mdlDriver.hpp
3-
// \brief hpp file for Lis2mdlDriver component implementation class
2+
// \title Lis2mdlManager.hpp
3+
// \brief hpp file for Lis2mdlManager component implementation class
44
// ======================================================================
55

6-
#ifndef Components_Lis2mdlDriver_HPP
7-
#define Components_Lis2mdlDriver_HPP
6+
#ifndef Components_Lis2mdlManager_HPP
7+
#define Components_Lis2mdlManager_HPP
88

99
// clang-format off
1010
// Keep the includes in this order
11-
#include "FprimeZephyrReference/Components/Drv/Lis2mdlDriver/Lis2mdlDriverComponentAc.hpp"
11+
#include "FprimeZephyrReference/Components/Drv/Lis2mdlManager/Lis2mdlManagerComponentAc.hpp"
1212
#include "FprimeZephyrReference/Components/Drv/Helpers/Helpers.hpp"
1313
// clang-format on
1414

@@ -18,17 +18,17 @@
1818

1919
namespace Drv {
2020

21-
class Lis2mdlDriver final : public Lis2mdlDriverComponentBase {
21+
class Lis2mdlManager final : public Lis2mdlManagerComponentBase {
2222
public:
2323
// ----------------------------------------------------------------------
2424
// Component construction and destruction
2525
// ----------------------------------------------------------------------
2626

27-
//! Construct Lis2mdlDriver object
28-
Lis2mdlDriver(const char* const compName);
27+
//! Construct Lis2mdlManager object
28+
Lis2mdlManager(const char* const compName);
2929

30-
//! Destroy Lis2mdlDriver object
31-
~Lis2mdlDriver();
30+
//! Destroy Lis2mdlManager object
31+
~Lis2mdlManager();
3232

3333
private:
3434
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)