diff --git a/samples/sensor/dht/CMakeLists.txt b/samples/sensor/dht/CMakeLists.txt deleted file mode 100644 index 3a4d689c082..00000000000 --- a/samples/sensor/dht/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# -# Copyright (c) 2019 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(dht) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/dht/README.rst b/samples/sensor/dht/README.rst deleted file mode 100644 index d99a7278e9c..00000000000 --- a/samples/sensor/dht/README.rst +++ /dev/null @@ -1,45 +0,0 @@ -.. _dht: - -DHT: Aosong DHT Digital-output Humidity and Temperature Sensor -############################################################## - -Description -*********** - -This sample application periodically (0.5 Hz) measures the ambient -temperature and humidity. The result is written to the console. - -Wiring -******* - -This sample uses an external breakout for the sensor. A devicetree -overlay must be provided to identify the sensor variant and the GPIO -used to control the sensor. - -Building and Running -******************** - -After providing a devicetree overlay that specifies the sensor location, -build this sample app using: - -.. zephyr-app-commands:: - :zephyr-app: samples/sensor/dht - :board: nrf52dk/nrf52832 - :goals: build flash - -Sample Output -============= - -.. code-block:: console - - *** Booting Zephyr OS build zephyr-v2.1.0-329-g38418b26c4cc *** - [0:00:00.027]: 20.0 Cel ; 48.7 %RH - [0:00:02.053]: 19.8 Cel ; 48.7 %RH - [0:00:04.079]: 20.0 Cel ; 48.7 %RH - [0:00:06.105]: 19.8 Cel ; 48.7 %RH - [0:00:08.130]: 20.0 Cel ; 48.8 %RH - [0:00:10.156]: 20.1 Cel ; 48.8 %RH - [0:00:12.182]: 19.7 Cel ; 48.7 %RH - [0:00:14.207]: 20.0 Cel ; 48.8 %RH - - diff --git a/samples/sensor/dht/boards/longan_nano.overlay b/samples/sensor/dht/boards/longan_nano.overlay deleted file mode 100644 index a50cd9b9404..00000000000 --- a/samples/sensor/dht/boards/longan_nano.overlay +++ /dev/null @@ -1,11 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - dht22 { - compatible = "aosong,dht"; - status = "okay"; - dio-gpios = <&gpiob 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - }; -}; diff --git a/samples/sensor/dht/boards/nrf52dk_nrf52832.overlay b/samples/sensor/dht/boards/nrf52dk_nrf52832.overlay deleted file mode 100644 index 9ad27845b4f..00000000000 --- a/samples/sensor/dht/boards/nrf52dk_nrf52832.overlay +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2019 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - dht22 { - compatible = "aosong,dht"; - status = "okay"; - dio-gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - dht22; - }; -}; diff --git a/samples/sensor/dht/prj.conf b/samples/sensor/dht/prj.conf deleted file mode 100644 index 33811ecb171..00000000000 --- a/samples/sensor/dht/prj.conf +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2019 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -CONFIG_SENSOR=y -CONFIG_GPIO=y - -# Need float format support -CONFIG_REQUIRES_FULL_LIBC=y -CONFIG_REQUIRES_FLOAT_PRINTF=y -CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/samples/sensor/dht/sample.yaml b/samples/sensor/dht/sample.yaml deleted file mode 100644 index bf73aeedd11..00000000000 --- a/samples/sensor/dht/sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2019 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -common: - filter: CONFIG_FULL_LIBC_SUPPORTED -sample: - name: DHT Sensor Sample -tests: - sample.sensor.dht: - build_only: true - platform_allow: nrf52dk/nrf52832 - integration_platforms: - - nrf52dk/nrf52832 - tags: sensors diff --git a/samples/sensor/dht/src/main.c b/samples/sensor/dht/src/main.c deleted file mode 100644 index e6c0d433274..00000000000 --- a/samples/sensor/dht/src/main.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2019 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -static const char *now_str(void) -{ - static char buf[16]; /* ...HH:MM:SS.MMM */ - uint32_t now = k_uptime_get_32(); - unsigned int ms = now % MSEC_PER_SEC; - unsigned int s; - unsigned int min; - unsigned int h; - - now /= MSEC_PER_SEC; - s = now % 60U; - now /= 60U; - min = now % 60U; - now /= 60U; - h = now; - - snprintf(buf, sizeof(buf), "%u:%02u:%02u.%03u", - h, min, s, ms); - return buf; -} - -int main(void) -{ - const struct device *const dht22 = DEVICE_DT_GET_ONE(aosong_dht); - - if (!device_is_ready(dht22)) { - printf("Device %s is not ready\n", dht22->name); - return 0; - } - - while (true) { - int rc = sensor_sample_fetch(dht22); - - if (rc != 0) { - printf("Sensor fetch failed: %d\n", rc); - break; - } - - struct sensor_value temperature; - struct sensor_value humidity; - - rc = sensor_channel_get(dht22, SENSOR_CHAN_AMBIENT_TEMP, - &temperature); - if (rc == 0) { - rc = sensor_channel_get(dht22, SENSOR_CHAN_HUMIDITY, - &humidity); - } - if (rc != 0) { - printf("get failed: %d\n", rc); - break; - } - - printf("[%s]: %.1f Cel ; %.1f %%RH\n", - now_str(), - sensor_value_to_double(&temperature), - sensor_value_to_double(&humidity)); - k_sleep(K_SECONDS(2)); - } - return 0; -}