diff --git a/boards/st/steval_stwinbx1/doc/index.rst b/boards/st/steval_stwinbx1/doc/index.rst index 9027db10e5e82..0008f6d455dd3 100644 --- a/boards/st/steval_stwinbx1/doc/index.rst +++ b/boards/st/steval_stwinbx1/doc/index.rst @@ -361,10 +361,9 @@ You should see the following confirmation on your Linux host: usb 3-1: Manufacturer: STMicroelectronics usb 3-1: SerialNumber: 207136863530 -.. You can build and flash the provided sample application -.. (:ref:`sensortile_box_pro_sample_sensors`) that reads sensors data and outputs -.. values on the console. - +You can build and flash the provided sample application +(:ref:`steval_stwinbx1_sample_sensors`) that reads sensors data and outputs +values on the console. .. _STEVAL-STWINBX1 Development kit website: https://www.st.com/en/evaluation-tools/steval-stwinbx1.html diff --git a/boards/st/steval_stwinbx1/steval_stwinbx1.dts b/boards/st/steval_stwinbx1/steval_stwinbx1.dts index d8c3586320db9..040452e91b00e 100644 --- a/boards/st/steval_stwinbx1/steval_stwinbx1.dts +++ b/boards/st/steval_stwinbx1/steval_stwinbx1.dts @@ -149,6 +149,39 @@ stm32_lp_tick_source: &lptim1 { status = "okay"; }; +&spi2 { + pinctrl-0 = <&spi2_sck_pi1 &spi2_miso_pd3 &spi2_mosi_pi3>; + pinctrl-names = "default"; + status = "okay"; + + cs-gpios = <&gpioh 6 GPIO_ACTIVE_LOW>, + <&gpioh 15 GPIO_ACTIVE_LOW>, + <&gpioi 7 GPIO_ACTIVE_LOW>; + iis2dlpc: iis2dlpc@0 { + compatible = "st,iis2dlpc"; + spi-max-frequency = ; + reg = <0>; + drdy-gpios = <&gpiof 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + drdy-int = <1>; + }; + + ism330dhcx: ism330dhcx@1 { + compatible = "st,ism330dhcx"; + spi-max-frequency = ; + reg = <1>; + drdy-gpios = <&gpiob 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + int-pin = <1>; + }; + + iis2iclx: iis2iclx@2 { + compatible = "st,iis2iclx"; + spi-max-frequency = ; + reg = <2>; + drdy-gpios = <&gpiof 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + int-pin = <2>; + }; +}; + &spi3 { pinctrl-0 = <&spi3_sck_pg9 &spi3_miso_pb4 &spi3_mosi_pb5>; pinctrl-names = "default"; @@ -178,6 +211,13 @@ stm32_lp_tick_source: &lptim1 { int-gpios = <&gpiof 5 GPIO_ACTIVE_HIGH>; status = "okay"; }; + + iis2mdc@1e { + compatible = "st,iis2mdc"; + reg = <0x1e>; + drdy-gpios = <&gpiof 9 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; }; &timers5 { diff --git a/drivers/sensor/st/iis2iclx/iis2iclx.c b/drivers/sensor/st/iis2iclx/iis2iclx.c index 3cc34cd4a6462..d667bf9b07b4a 100644 --- a/drivers/sensor/st/iis2iclx/iis2iclx.c +++ b/drivers/sensor/st/iis2iclx/iis2iclx.c @@ -31,7 +31,7 @@ static int iis2iclx_freq_to_odr_val(uint16_t freq) size_t i; for (i = 0; i < ARRAY_SIZE(iis2iclx_odr_map); i++) { - if (freq == iis2iclx_odr_map[i]) { + if (freq <= iis2iclx_odr_map[i]) { return i; } } @@ -50,7 +50,7 @@ static int iis2iclx_odr_to_freq_val(uint16_t odr) return iis2iclx_odr_map[ARRAY_SIZE(iis2iclx_odr_map) - 1]; } -static const uint16_t iis2iclx_accel_fs_map[] = {500, 3000, 1000, 2000}; +static const uint16_t iis2iclx_accel_fs_map[] = {500, 3000, 1000, 2000}; /* fs in mg */ static const uint16_t iis2iclx_accel_fs_sens[] = {1, 8, 2, 4}; static int iis2iclx_accel_range_to_fs_val(int32_t range) @@ -130,7 +130,7 @@ static int iis2iclx_accel_range_set(const struct device *dev, int32_t range) int fs; struct iis2iclx_data *data = dev->data; - fs = iis2iclx_accel_range_to_fs_val(range); + fs = iis2iclx_accel_range_to_fs_val(range * 1000); /* pass range in mg */ if (fs < 0) { return fs; } diff --git a/samples/boards/steval_stwinbx1/sensors/CMakeLists.txt b/samples/boards/steval_stwinbx1/sensors/CMakeLists.txt new file mode 100644 index 0000000000000..b08f58072f47d --- /dev/null +++ b/samples/boards/steval_stwinbx1/sensors/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2024 STMicroelectronics +# +# SPDX-License-Identifier: Apache-2.0 +# +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(steval_stwinbx1) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/boards/steval_stwinbx1/sensors/README.rst b/samples/boards/steval_stwinbx1/sensors/README.rst new file mode 100644 index 0000000000000..810c5af41f55f --- /dev/null +++ b/samples/boards/steval_stwinbx1/sensors/README.rst @@ -0,0 +1,79 @@ +.. _steval_stwinbx1_sample_sensors: + +STWIN.box on-board sensors test +############################### + +Overview +******** +This sample provides an example of how to read sensors data +from the STWIN.box board. + +This sample enables all sensors of STWIN.box board, and then +periodically reads and displays data on the console from the following +sensors: + +- STTS22H: Digital temperature sensor +- IIS2MDC: 3-axis magnetometer +- ISM330DHCX: IMU, 3D accelerometer and 3D gyroscope with Machine Learning Core and Finite State Machine +- IIS2DLPC: high-performance ultra-low-power 3-axis accelerometer for industrial applications +- IIS2ICLX: high-accuracy, high-resolution, low-power, 2-axis digital inclinometer with Machine Learning Core + +Requirements +************ + +The application requires a STWIN.box board connected to the PC +through USB. The board shows up as a USB CDC class standard device. + +References +********** + +- :ref:`steval_stwinbx1_board` + +Building and Running +******************** + +Build and flash the sample in the following way: + +.. zephyr-app-commands:: + :zephyr-app: samples/boards/steval_stwinbx1/sensors + :board: steval_stwinbx1 + :goals: build flash + +Please note that flashing the board requires a few preliminary steps described +in :ref:`steval_stwinbx1_board`. + +Then, power cycle the board by disconnecting and reconnecting the USB cable. +Run your favorite terminal program to listen for output. + +.. code-block:: console + + $ minicom -D -b 115200 + +Replace :code:`` with the correct device path automatically created on +the host after the STWIN.box board gets connected to it, +usually :code:`/dev/ttyUSBx` or :code:`/dev/ttyACMx` (with x being 0, 1, 2, ...). +The ``-b`` option sets baud rate ignoring the value from config. + +Sample Output +============= + +The sample code outputs sensors data on the STWIN.box console. + + .. code-block:: console + + STWIN.box dashboard + + STTS22H: Temperature: 24.4 C + IIS2DLPC: Accel (m.s-2): x: -5.590, y: -0.536, z: 8.040 + IIS2MDC: Magn (gauss): x: 0.420, y: -0.116, z: -0.103 + IIS2MDC: Temperature: 21.0 C + ISM330DHCX: Accel (m.s-2): x: 0.000, y: 5.704, z: 7.982 + ISM330DHCX: Gyro (dps): x: 0.026, y: -0.006, z: -0.008 + IIS2ICLX: Accel (m.s-2): x: -0.157, y: 5.699 + 1:: iis2dlpc trig 2021 + 1:: iis2mdc trig 993 + 1:: ism330dhcx acc trig 4447 + 1:: ism330dhcx gyr trig 2223 + 1:: iis2iclx trig 2091 + + diff --git a/samples/boards/steval_stwinbx1/sensors/prj.conf b/samples/boards/steval_stwinbx1/sensors/prj.conf new file mode 100644 index 0000000000000..1b1258d0862a0 --- /dev/null +++ b/samples/boards/steval_stwinbx1/sensors/prj.conf @@ -0,0 +1,16 @@ +CONFIG_LOG=y +CONFIG_PRINTK=y +CONFIG_SPI=y +CONFIG_I2C=y +CONFIG_GPIO=y + +# config sensors +CONFIG_SENSOR=y +CONFIG_SENSOR_LOG_LEVEL_DBG=y +CONFIG_STTS22H_TRIGGER_NONE=y +CONFIG_IIS2MDC_TRIGGER_OWN_THREAD=y +CONFIG_IIS2DLPC_TRIGGER_OWN_THREAD=y +CONFIG_ISM330DHCX_TRIGGER_OWN_THREAD=y +CONFIG_IIS2ICLX_TRIGGER_OWN_THREAD=y + +CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/samples/boards/steval_stwinbx1/sensors/sample.yaml b/samples/boards/steval_stwinbx1/sensors/sample.yaml new file mode 100644 index 0000000000000..28d5692a3fe09 --- /dev/null +++ b/samples/boards/steval_stwinbx1/sensors/sample.yaml @@ -0,0 +1,12 @@ +sample: + description: STWIN.box board testing + name: STWIN.box board test +tests: + sample.board.steval_stwinbx1.sensors: + harness: sensor + platform_allow: steval_stwinbx1 + tags: sensors + depends_on: + - i2c + - spi + - gpio diff --git a/samples/boards/steval_stwinbx1/sensors/src/main.c b/samples/boards/steval_stwinbx1/sensors/src/main.c new file mode 100644 index 0000000000000..5e4131eff6da7 --- /dev/null +++ b/samples/boards/steval_stwinbx1/sensors/src/main.c @@ -0,0 +1,439 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#ifdef CONFIG_STTS22H_TRIGGER +static int stts22h_trig_cnt; + +static void stts22h_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + stts22h_trig_cnt++; +} +#endif + +#ifdef CONFIG_IIS2DLPC_TRIGGER +static int iis2dlpc_trig_cnt; + +static void iis2dlpc_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ); + iis2dlpc_trig_cnt++; +} +#endif + +#ifdef CONFIG_IIS2MDC_TRIGGER +static int iis2mdc_trig_cnt; + +static void iis2mdc_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + sensor_sample_fetch_chan(dev, SENSOR_CHAN_ALL); + iis2mdc_trig_cnt++; +} +#endif + +#ifdef CONFIG_ISM330DHCX_TRIGGER +static int ism330dhcx_acc_trig_cnt; +static int ism330dhcx_gyr_trig_cnt; + +static void ism330dhcx_acc_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ); + ism330dhcx_acc_trig_cnt++; +} + +static void ism330dhcx_gyr_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ); + ism330dhcx_gyr_trig_cnt++; +} +#endif + +#ifdef CONFIG_IIS2ICLX_TRIGGER +static int iis2iclx_trig_cnt; + +static void iis2iclx_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ); + iis2iclx_trig_cnt++; +} +#endif + +static void stts22h_config(const struct device *stts22h) +{ + struct sensor_value odr_attr; + + /* set STTS22H sampling frequency to 100 Hz */ + odr_attr.val1 = 100; + odr_attr.val2 = 0; + + if (sensor_attr_set(stts22h, SENSOR_CHAN_AMBIENT_TEMP, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for STTS22H\n"); + return; + } + +#ifdef CONFIG_STTS22H_TRIGGER + struct sensor_trigger trig; + + trig.type = SENSOR_TRIG_DATA_READY; + trig.chan = SENSOR_CHAN_AMBIENT_TEMP; + sensor_trigger_set(stts22h, &trig, stts22h_trigger_handler); +#endif +} + +static void iis2dlpc_config(const struct device *iis2dlpc) +{ + struct sensor_value odr_attr, fs_attr; + + /* set IIS2DLPC accel/gyro sampling frequency to 100 Hz */ + odr_attr.val1 = 200; + odr_attr.val2 = 0; + + if (sensor_attr_set(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for IIS2DLPC accel\n"); + return; + } + + sensor_g_to_ms2(16, &fs_attr); + + if (sensor_attr_set(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ, + SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) { + printk("Cannot set full scale for IIS2DLPC accel\n"); + return; + } + +#ifdef CONFIG_IIS2DLPC_TRIGGER + struct sensor_trigger trig; + + trig.type = SENSOR_TRIG_DATA_READY; + trig.chan = SENSOR_CHAN_ACCEL_XYZ; + sensor_trigger_set(iis2dlpc, &trig, iis2dlpc_trigger_handler); +#endif +} + +static void iis2iclx_config(const struct device *iis2iclx) +{ + struct sensor_value odr_attr, fs_attr; + + /* set IIS2ICLX accel/gyro sampling frequency to 200 Hz */ + odr_attr.val1 = 200; + odr_attr.val2 = 0; + + if (sensor_attr_set(iis2iclx, SENSOR_CHAN_ACCEL_XYZ, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for IIS2ICLX accel\n"); + return; + } + + sensor_g_to_ms2(2, &fs_attr); + + if (sensor_attr_set(iis2iclx, SENSOR_CHAN_ACCEL_XYZ, + SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) { + printk("Cannot set full scale for IIS2ICLX accel\n"); + return; + } + +#ifdef CONFIG_IIS2ICLX_TRIGGER + struct sensor_trigger trig; + + trig.type = SENSOR_TRIG_DATA_READY; + trig.chan = SENSOR_CHAN_ACCEL_XYZ; + sensor_trigger_set(iis2iclx, &trig, iis2iclx_trigger_handler); +#endif +} + +static void iis2mdc_config(const struct device *iis2mdc) +{ + struct sensor_value odr_attr; + + /* set IIS2MDC sampling frequency to 100 Hz */ + odr_attr.val1 = 100; + odr_attr.val2 = 0; + + if (sensor_attr_set(iis2mdc, SENSOR_CHAN_ALL, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for IIS2MDC\n"); + return; + } + +#ifdef CONFIG_IIS2MDC_TRIGGER + struct sensor_trigger trig; + + trig.type = SENSOR_TRIG_DATA_READY; + trig.chan = SENSOR_CHAN_MAGN_XYZ; + sensor_trigger_set(iis2mdc, &trig, iis2mdc_trigger_handler); +#endif +} + +static void ism330dhcx_config(const struct device *ism330dhcx) +{ + struct sensor_value odr_attr, fs_attr; + + /* set ISM330DHCX sampling frequency to 416 Hz */ + odr_attr.val1 = 416; + odr_attr.val2 = 0; + + if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for ISM330DHCX accel\n"); + return; + } + + sensor_g_to_ms2(16, &fs_attr); + + if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ, + SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) { + printk("Cannot set sampling frequency for ISM330DHCX accel\n"); + return; + } + + /* set ISM330DHCX gyro sampling frequency to 208 Hz */ + odr_attr.val1 = 208; + odr_attr.val2 = 0; + + if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_GYRO_XYZ, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for ISM330DHCX gyro\n"); + return; + } + + sensor_degrees_to_rad(250, &fs_attr); + + if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_GYRO_XYZ, + SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) { + printk("Cannot set fs for ISM330DHCX gyro\n"); + return; + } + +#ifdef CONFIG_ISM330DHCX_TRIGGER + struct sensor_trigger trig; + + trig.type = SENSOR_TRIG_DATA_READY; + trig.chan = SENSOR_CHAN_ACCEL_XYZ; + sensor_trigger_set(ism330dhcx, &trig, ism330dhcx_acc_trigger_handler); + + trig.type = SENSOR_TRIG_DATA_READY; + trig.chan = SENSOR_CHAN_GYRO_XYZ; + sensor_trigger_set(ism330dhcx, &trig, ism330dhcx_gyr_trigger_handler); +#endif +} + +static int led_pattern_out(void) +{ + const struct gpio_dt_spec led0_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); + const struct gpio_dt_spec led1_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(led1), gpios); + int i; + + /* led 0 */ + if (!gpio_is_ready_dt(&led0_gpio)) { + printk("%s: device not ready.\n", led0_gpio.port->name); + return -1; + } + gpio_pin_configure_dt(&led0_gpio, GPIO_OUTPUT_INACTIVE); + + /* led 1 */ + if (!gpio_is_ready_dt(&led1_gpio)) { + printk("%s: device not ready.\n", led1_gpio.port->name); + return -1; + } + gpio_pin_configure_dt(&led1_gpio, GPIO_OUTPUT_INACTIVE); + + /* output led alternate pattern */ + for (i = 0; i < 8; i++) { + gpio_pin_set_dt(&led0_gpio, ((i % 2) == 0) ? 1 : 0); + gpio_pin_set_dt(&led1_gpio, ((i % 2) == 1) ? 1 : 0); + k_msleep(100); + } + + /* output led in sync pattern */ + for (i = 0; i < 6; i++) { + gpio_pin_set_dt(&led0_gpio, ((i % 2) == 0) ? 1 : 0); + gpio_pin_set_dt(&led1_gpio, ((i % 2) == 0) ? 1 : 0); + k_msleep(250); + } + + /* turn all leds off */ + gpio_pin_set_dt(&led0_gpio, 0); + gpio_pin_set_dt(&led1_gpio, 0); + + return 0; +} + +int main(void) +{ + int cnt = 1; + + /* signal that sample is started */ + if (led_pattern_out() < 0) { + return -1; + } + + printk("STWIN.box board sensor test\n"); + + const struct device *const stts22h = DEVICE_DT_GET_ONE(st_stts22h); + const struct device *const iis2mdc = DEVICE_DT_GET_ONE(st_iis2mdc); + const struct device *const ism330dhcx = DEVICE_DT_GET_ONE(st_ism330dhcx); + const struct device *const iis2dlpc = DEVICE_DT_GET_ONE(st_iis2dlpc); + const struct device *const iis2iclx = DEVICE_DT_GET_ONE(st_iis2iclx); + + if (!device_is_ready(stts22h)) { + printk("%s: device not ready.\n", stts22h->name); + return 0; + } + if (!device_is_ready(iis2mdc)) { + printk("%s: device not ready.\n", iis2mdc->name); + return 0; + } + if (!device_is_ready(ism330dhcx)) { + printk("%s: device not ready.\n", ism330dhcx->name); + return 0; + } + if (!device_is_ready(iis2dlpc)) { + printk("%s: device not ready.\n", iis2dlpc->name); + return 0; + } + if (!device_is_ready(iis2iclx)) { + printk("%s: device not ready.\n", iis2iclx->name); + return 0; + } + + stts22h_config(stts22h); + iis2mdc_config(iis2mdc); + ism330dhcx_config(ism330dhcx); + iis2dlpc_config(iis2dlpc); + iis2iclx_config(iis2iclx); + + while (1) { + struct sensor_value stts22h_temp; + struct sensor_value iis2dlpc_accel[3]; + struct sensor_value iis2mdc_magn[3]; + struct sensor_value iis2mdc_temp; + struct sensor_value ism330dhcx_accel[3]; + struct sensor_value ism330dhcx_gyro[3]; + struct sensor_value iis2iclx_accel[2]; + +#ifndef CONFIG_STTS22H_TRIGGER + if (sensor_sample_fetch(stts22h) < 0) { + printf("STTS22H Sensor sample update error\n"); + return 0; + } +#endif +#ifndef CONFIG_IIS2MDC_TRIGGER + if (sensor_sample_fetch(iis2mdc) < 0) { + printf("IIS2MDC Magn Sensor sample update error\n"); + return 0; + } +#endif +#ifndef CONFIG_ISM330DHCX_TRIGGER + if (sensor_sample_fetch(ism330dhcx) < 0) { + printf("ISM330DHCX IMU Sensor sample update error\n"); + return 0; + } +#endif +#ifndef CONFIG_IIS2DLPC_TRIGGER + if (sensor_sample_fetch(iis2dlpc) < 0) { + printf("IIS2DLPC Sensor sample update error\n"); + return 0; + } +#endif +#ifndef CONFIG_IIS2ICLX_TRIGGER + if (sensor_sample_fetch(iis2iclx) < 0) { + printf("IIS2ICLX Sensor sample update error\n"); + return 0; + } +#endif + + sensor_channel_get(stts22h, SENSOR_CHAN_AMBIENT_TEMP, &stts22h_temp); + sensor_channel_get(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ, iis2dlpc_accel); + sensor_channel_get(iis2mdc, SENSOR_CHAN_MAGN_XYZ, iis2mdc_magn); + sensor_channel_get(iis2mdc, SENSOR_CHAN_DIE_TEMP, &iis2mdc_temp); + sensor_channel_get(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ, ism330dhcx_accel); + sensor_channel_get(ism330dhcx, SENSOR_CHAN_GYRO_XYZ, ism330dhcx_gyro); + sensor_channel_get(iis2iclx, SENSOR_CHAN_ACCEL_XYZ, iis2iclx_accel); + + /* Display sensor data */ + + /* Clear terminal (ANSI ESC-C) */ + printf("\0033\014"); + + printf("STWIN.box dashboard\n\n"); + + /* STTS22H temperature */ + printf("STTS22H: Temperature: %.1f C\n", + sensor_value_to_double(&stts22h_temp)); + + /* iis2dlpc */ + printf("IIS2DLPC: Accel (m.s-2): x: %.3f, y: %.3f, z: %.3f\n", + sensor_value_to_double(&iis2dlpc_accel[0]), + sensor_value_to_double(&iis2dlpc_accel[1]), + sensor_value_to_double(&iis2dlpc_accel[2])); + + /* iis2mdc */ + printf("IIS2MDC: Magn (gauss): x: %.3f, y: %.3f, z: %.3f\n", + sensor_value_to_double(&iis2mdc_magn[0]), + sensor_value_to_double(&iis2mdc_magn[1]), + sensor_value_to_double(&iis2mdc_magn[2])); + + printf("IIS2MDC: Temperature: %.1f C\n", + sensor_value_to_double(&iis2mdc_temp)); + + /* ism330dhcx */ + printf("ISM330DHCX: Accel (m.s-2): x: %.3f, y: %.3f, z: %.3f\n", + sensor_value_to_double(&ism330dhcx_accel[0]), + sensor_value_to_double(&ism330dhcx_accel[1]), + sensor_value_to_double(&ism330dhcx_accel[2])); + + printf("ISM330DHCX: Gyro (dps): x: %.3f, y: %.3f, z: %.3f\n", + sensor_value_to_double(&ism330dhcx_gyro[0]), + sensor_value_to_double(&ism330dhcx_gyro[1]), + sensor_value_to_double(&ism330dhcx_gyro[2])); + + /* iis2iclx */ + printf("IIS2ICLX: Accel (m.s-2): x: %.3f, y: %.3f\n", + sensor_value_to_double(&iis2iclx_accel[0]), + sensor_value_to_double(&iis2iclx_accel[1])); + +#ifdef CONFIG_STTS22H_TRIGGER + printk("%d:: stts22h trig %d\n", cnt, stts22h_trig_cnt); +#endif + +#ifdef CONFIG_IIS2DLPC_TRIGGER + printk("%d:: iis2dlpc trig %d\n", cnt, iis2dlpc_trig_cnt); +#endif + +#if defined(CONFIG_IIS2MDC_TRIGGER) + printk("%d:: iis2mdc trig %d\n", cnt, iis2mdc_trig_cnt); +#endif + +#ifdef CONFIG_ISM330DHCX_TRIGGER + printk("%d:: ism330dhcx acc trig %d\n", cnt, ism330dhcx_acc_trig_cnt); + printk("%d:: ism330dhcx gyr trig %d\n", cnt, ism330dhcx_gyr_trig_cnt); +#endif + +#ifdef CONFIG_IIS2ICLX_TRIGGER + printk("%d:: iis2iclx trig %d\n", cnt, iis2iclx_trig_cnt); +#endif + + k_msleep(2000); + } +}