samples: sensor: wsen_hids: remove example for wsen_hids
Remove example for wsen_hids to switch to generic sensor driver examples. Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
This commit is contained in:
parent
56b70bddcc
commit
e5351b0d10
|
@ -173,6 +173,7 @@ REDIRECTS = [
|
|||
('reference/util/index', 'kernel/util/index'),
|
||||
('samples/drivers/kscan_touch', 'samples/subsys/input/input'),
|
||||
('samples/net/cloud/google_iot_mqtt', 'samples/net/cloud'),
|
||||
('samples/sensor/wsen_hids/README', 'samples/sensor/sensor'),
|
||||
('samples/sensor/wsen_itds/README', 'samples/sensor/sensor'),
|
||||
('services/portability/posix', 'services/portability/posix/index'),
|
||||
# zephyr-keep-sorted-stop
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(wsen_hids)
|
||||
|
||||
FILE(GLOB app_sources src/*.c)
|
||||
target_sources(app PRIVATE ${app_sources})
|
|
@ -1,56 +0,0 @@
|
|||
.. _wsen-hids:
|
||||
|
||||
WSEN-HIDS: Humidity and Temperature Sensor
|
||||
##########################################
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
This sample uses the Zephyr :ref:`sensor_api` API driver to periodically
|
||||
read humidity and temperature from the Würth Elektronik WSEN-HIDS
|
||||
humidity & temperature sensor and displays it on the console.
|
||||
|
||||
By default, samples are read in polling mode. If desired, the data-ready
|
||||
interrupt of the sensor can be used to trigger reading of samples.
|
||||
|
||||
Requirements
|
||||
************
|
||||
|
||||
This sample requires a WSEN-HIDS sensor connected via the I2C or SPI interface.
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
- WSEN-HIDS: https://www.we-online.com/catalog/en/WSEN-HIDS
|
||||
|
||||
Building and Running
|
||||
********************
|
||||
|
||||
This sample can be configured to support WSEN-HIDS sensors connected via
|
||||
either I2C or SPI. Configuration is done via the :ref:`devicetree <dt-guide>`.
|
||||
The devicetree must have an enabled node with ``compatible = "we,wsen-hids";``.
|
||||
See :dtcompatible:`we,wsen-hids` for the devicetree binding.
|
||||
|
||||
The sample reads from the sensor and outputs sensor data to the console at
|
||||
regular intervals. If you want to test the sensor's trigger mode, specify
|
||||
the trigger configuration in the prj.conf file and connect the interrupt
|
||||
output from the sensor to your board.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: samples/sensor/wsen_hids/
|
||||
:goals: build flash
|
||||
|
||||
Sample Output
|
||||
=============
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
[00:00:00.383,209] <inf> MAIN: HIDS device initialized.
|
||||
[00:00:00.384,063] <inf> MAIN: Sample #1
|
||||
[00:00:00.384,063] <inf> MAIN: Humidity: 29.8 %
|
||||
[00:00:00.384,063] <inf> MAIN: Temperature: 24.9 C
|
||||
[00:00:02.384,979] <inf> MAIN: Sample #2
|
||||
[00:00:02.385,009] <inf> MAIN: Humidity: 29.7 %
|
||||
[00:00:02.385,009] <inf> MAIN: Temperature: 24.9 C
|
||||
|
||||
<repeats endlessly every 2 seconds>
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
&i2c0 {
|
||||
hids@5f {
|
||||
compatible = "we,wsen-hids";
|
||||
reg = <0x5f>;
|
||||
drdy-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
|
||||
odr = "1";
|
||||
};
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
CONFIG_I2C=y
|
||||
CONFIG_SENSOR=y
|
||||
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_CBPRINTF_FP_SUPPORT=y
|
||||
CONFIG_LOG_MODE_DEFERRED=y
|
|
@ -1,8 +0,0 @@
|
|||
sample:
|
||||
name: WSEN-HIDS Sensor Sample
|
||||
tests:
|
||||
sample.sensor.wsen-hids:
|
||||
harness: sensor
|
||||
tags: sensors
|
||||
depends_on: i2c
|
||||
filter: dt_compat_enabled("we,wsen-hids")
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/sensor.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
LOG_MODULE_REGISTER(MAIN);
|
||||
|
||||
static void process_sample(const struct device *dev)
|
||||
{
|
||||
static unsigned int sample_count;
|
||||
struct sensor_value humidity, temperature;
|
||||
|
||||
if (sensor_sample_fetch(dev) < 0) {
|
||||
LOG_ERR("Failed to fetch HIDS sensor sample.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &humidity) < 0) {
|
||||
LOG_ERR("Failed to read HIDS humidity channel.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &temperature) < 0) {
|
||||
LOG_ERR("Failed to read HIDS temperature channel.");
|
||||
return;
|
||||
}
|
||||
|
||||
++sample_count;
|
||||
LOG_INF("Sample #%u", sample_count);
|
||||
|
||||
/* Display humidity */
|
||||
LOG_INF("Humidity: %.1f %%", sensor_value_to_double(&humidity));
|
||||
|
||||
/* Display temperature */
|
||||
LOG_INF("Temperature: %.1f C", sensor_value_to_double(&temperature));
|
||||
}
|
||||
|
||||
static void hids_drdy_interrupt_handler(const struct device *dev, const struct sensor_trigger *trig)
|
||||
{
|
||||
process_sample(dev);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const struct device *dev = DEVICE_DT_GET_ONE(we_wsen_hids);
|
||||
|
||||
if (!device_is_ready(dev)) {
|
||||
LOG_ERR("sensor: device not ready.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_INF("HIDS device initialized.");
|
||||
|
||||
if (IS_ENABLED(CONFIG_WSEN_HIDS_TRIGGER)) {
|
||||
struct sensor_trigger trig = {
|
||||
.type = SENSOR_TRIG_DATA_READY,
|
||||
.chan = SENSOR_CHAN_ALL,
|
||||
};
|
||||
if (sensor_trigger_set(dev, &trig, hids_drdy_interrupt_handler) < 0) {
|
||||
LOG_ERR("Failed to configure trigger.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
while (!IS_ENABLED(CONFIG_WSEN_HIDS_TRIGGER)) {
|
||||
process_sample(dev);
|
||||
k_msleep(2000);
|
||||
}
|
||||
|
||||
k_sleep(K_FOREVER);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue