Sensors¶
IMU¶
Interface for the inertial measurement unit (LSM6DSO32). Provides orientation and acceleration data.
-
int imu_poll(const struct device *dev, float *orientation_deg, float *acc)¶
Poll the IMU for orientation and acceleration data.
- Parameters:
dev – Pointer to the IMU device.
orientation_deg – Output for orientation angle in degrees, or NULL.
acc – Output for acceleration magnitude in m/s^2, or NULL.
- Return values:
0 – on success.
-errno – Negative errno on failure.
-
int imu_set_sampling_freq(const struct device *dev, int sampling_rate_hz)¶
Set the IMU accelerometer and gyroscope sampling frequency.
- Parameters:
dev – Pointer to the IMU device.
sampling_rate_hz – Desired sampling rate in Hertz.
- Return values:
0 – on success.
-errno – Negative errno on failure.
-
int imu_init(const struct device *dev)¶
Initialize the IMU device.
Checks device readiness and configures the sampling frequency.
- Parameters:
dev – Pointer to the IMU device.
- Return values:
0 – on success.
-ENODEV – if the device is not ready.
Barometer¶
Interface for the barometric pressure sensor (MS5607). Computes altitude from pressure readings.
-
int baro_measure(const struct device *dev, struct sensor_value *temp, struct sensor_value *press)¶
Measure temperature and pressure from the barometric sensor.
- Parameters:
dev – Pointer to the barometric sensor device.
temp – Output for temperature, or NULL to skip.
press – Output for pressure, or NULL to skip.
- Return values:
0 – on success.
-EINVAL – if
devis NULL and both outputs are NULL.-errno – Other negative errno on failure.
-
int baro_init(const struct device *dev)¶
Initialize the barometric pressure sensor.
Checks device readiness and configures the oversampling rate.
- Parameters:
dev – Pointer to the barometric sensor device.
- Return values:
0 – on success.
-ETIMEDOUT – if the device is not ready.
-EIO – if oversampling configuration fails.