Skip to content

Commit bb1be34

Browse files
committed
add channel retrieval during sensor data
1 parent 29bffee commit bb1be34

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

FprimeZephyrReference/Components/Imu/Imu.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,10 @@ class Imu final : public ImuComponentBase {
4747
// IMU access methods
4848
// ----------------------------------------------------------------------
4949

50-
//! Get the acceleration reading from the IMU
51-
Components::Imu_Acceleration get_acceleration();
52-
53-
//! Get the angular velocity reading from the IMU
54-
Components::Imu_AngularVelocity get_angular_velocity();
55-
50+
5651
//! Get the magnetic field reading from the IMU
5752
Components::Imu_MagneticField get_magnetic_field();
5853

59-
//! Get the temperature reading from the IMU
60-
F64 get_temperature();
6154

6255
// ----------------------------------------------------------------------
6356
// Member variables
@@ -66,8 +59,7 @@ class Imu final : public ImuComponentBase {
6659
//! Zephyr device stores the initialized LIS2MDL sensor
6760
const struct device* lis2mdl;
6861

69-
//! Zephyr device stores the initialized LSM6DSO sensor
70-
const struct device* lsm6dso;
62+
7163
};
7264

7365
} // namespace Components

FprimeZephyrReference/Components/lms6dsoDriver/lms6dsoDriver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Components::Acceleration lms6dsoDriver::getAcceleration_handler(FwIndexType port
3232
struct sensor_value x;
3333
struct sensor_value y;
3434
struct sensor_value z;
35+
sensor_sample_fetch_chan(lsm6dso, SENSOR_CHAN_ACCEL_XYZ);
3536

3637
sensor_channel_get(lsm6dso, SENSOR_CHAN_ACCEL_X, &x);
3738
sensor_channel_get(lsm6dso, SENSOR_CHAN_ACCEL_Y, &y);
@@ -44,6 +45,7 @@ Components::AngularVelocity lms6dsoDriver::getAngularVelocity_handler(FwIndexTyp
4445
struct sensor_value x;
4546
struct sensor_value y;
4647
struct sensor_value z;
48+
sensor_sample_fetch_chan(lsm6dso, SENSOR_CHAN_GYRO_XYZ);
4749

4850
sensor_channel_get(lsm6dso, SENSOR_CHAN_GYRO_X, &x);
4951
sensor_channel_get(lsm6dso, SENSOR_CHAN_GYRO_Y, &y);
@@ -56,6 +58,7 @@ Components::AngularVelocity lms6dsoDriver::getAngularVelocity_handler(FwIndexTyp
5658
F64 lms6dsoDriver::getTemperature_handler(FwIndexType portNum) {
5759
struct sensor_value temp;
5860

61+
sensor_sample_fetch_chan(lsm6dso, SENSOR_CHAN_DIE_TEMP);
5962
sensor_channel_get(lsm6dso, SENSOR_CHAN_DIE_TEMP, &temp);
6063

6164
return this->sensor_value_to_f64(temp);

FprimeZephyrReference/Components/lms6dsoDriver/lms6dsoDriver.fpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
module Components {
2-
# @ Extern type to define zepyhr sensor_value
3-
# struct SensorValue {
4-
# val1: I32
5-
# val2: I32
6-
# }
2+
73
@ Acceleration Reading in m/s^2
84
struct Acceleration {
95
x: F64

FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module ReferenceDeployment {
3030
instance watchdog
3131
instance prmDb
3232
instance imu
33-
# instance lms6dsoDriver
33+
instance lms6dsoDriver
3434

3535
# ----------------------------------------------------------------------
3636
# Pattern graph specifiers

0 commit comments

Comments
 (0)