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>
This commit is contained in:
parent
e0208be634
commit
0e917af9e3
|
@ -1,5 +1,3 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_SENSOR=y
|
||||
CONFIG_BMC150_MAGN=y
|
||||
CONFIG_CBPRINTF_FP_SUPPORT=y
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
printk("Polling magnetometer data from %s.\n", dev->name);
|
||||
|
||||
while (1) {
|
||||
ret = sensor_sample_fetch(dev);
|
||||
if (ret) {
|
||||
|
|
Loading…
Reference in a new issue