samples: sensor: Extend magn_polling to support additional drivers
Extends the magn_polling sample application to support additional
magnetometer drivers. This is a first step towards reducing the number
of driver-specific sensor sample applications.
Integration platforms were selected to exercise different magnetometer
drivers.
Tested on hardware with the following configurations:
- fxos8700 driver with the on-board sensor on the frdm_k64f board
- lis2mdl driver with a x_nucleo_iks01a3 shield attached to a frdm_k64f
board
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
diff --git a/samples/sensor/magn_polling/prj.conf b/samples/sensor/magn_polling/prj.conf
index 508a312..fb14ccb 100644
--- a/samples/sensor/magn_polling/prj.conf
+++ b/samples/sensor/magn_polling/prj.conf
@@ -1,5 +1,3 @@
CONFIG_STDOUT_CONSOLE=y
-CONFIG_I2C=y
CONFIG_SENSOR=y
-CONFIG_BMC150_MAGN=y
CONFIG_CBPRINTF_FP_SUPPORT=y
diff --git a/samples/sensor/magn_polling/sample.yaml b/samples/sensor/magn_polling/sample.yaml
index 93f0738..97aa174 100644
--- a/samples/sensor/magn_polling/sample.yaml
+++ b/samples/sensor/magn_polling/sample.yaml
@@ -1,8 +1,13 @@
sample:
- name: BMC150 Magnetometer Sample
+ name: Magnetometer Polling Sample
tests:
sample.sensor.magn_polling:
harness: sensor
tags: sensors
- depends_on: i2c
- filter: dt_compat_enabled("bosch,bmc150_magn")
+ filter: dt_alias_exists("magn0")
+ integration_platforms:
+ - frdm_k64f # fxos8700
+ - thingy53_nrf5340_cpuapp # bmm150
+ - sensortile_box # lis2mdl
+ - stm32f411e_disco # lsm303agr_magn
+ - stm32f3_disco # lsm303dlhc_magn
diff --git a/samples/sensor/magn_polling/src/main.c b/samples/sensor/magn_polling/src/main.c
index bdd5678..162d37c 100644
--- a/samples/sensor/magn_polling/src/main.c
+++ b/samples/sensor/magn_polling/src/main.c
@@ -12,7 +12,7 @@
void main(void)
{
- const struct device *dev = DEVICE_DT_GET_ONE(bosch_bmc150_magn);
+ const struct device *dev = DEVICE_DT_GET(DT_ALIAS(magn0));
struct sensor_value value_x, value_y, value_z;
int ret;
@@ -21,6 +21,8 @@
return;
}
+ printk("Polling magnetometer data from %s.\n", dev->name);
+
while (1) {
ret = sensor_sample_fetch(dev);
if (ret) {