From 298bf49048ffc03a5b9ee233bbde98aaf1671835 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Tue, 2 Apr 2024 10:41:04 +0200 Subject: [PATCH] samples: sensor: dht_polling run sample on sensor present Add a fixture to run the sample only when the DHT sensor HX330x is present (shield) on the nucleo_f40re board 'fixture_i2c_hs300x' The stm32f401 Nucleo board itself has no sensor mounted Signed-off-by: Francois Ramu --- samples/sensor/dht_polling/README.rst | 12 +++++++++++- samples/sensor/dht_polling/sample.yaml | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/samples/sensor/dht_polling/README.rst b/samples/sensor/dht_polling/README.rst index 09550b255d0..b985c9e0a08 100644 --- a/samples/sensor/dht_polling/README.rst +++ b/samples/sensor/dht_polling/README.rst @@ -23,7 +23,17 @@ be aliased as ``dhtN`` where ``N`` goes from ``0`` to ``9``. For example: }; }; -Make sure the aliases are in devicetree, then build and run with: + +Make sure the aliases are in devicetree. + +It also requires a correct fixture setup when the sensor is present. +For the correct execution of that sample in twister, add into boards's +map-file next fixture settings:: + + - fixture: fixture_i2c_hs300x + + +Then build and run with: .. zephyr-app-commands:: :zephyr-app: samples/sensor/dht_polling diff --git a/samples/sensor/dht_polling/sample.yaml b/samples/sensor/dht_polling/sample.yaml index 8177e636d21..50cf2ef6d7c 100644 --- a/samples/sensor/dht_polling/sample.yaml +++ b/samples/sensor/dht_polling/sample.yaml @@ -15,6 +15,7 @@ tests: - nucleo_f401re harness: console harness_config: + fixture: fixture_i2c_hs300x type: one_line regex: - "[0-9A-Za-z_,+-.]*@[0-9A-Fa-f]*: temp is (.*) °C humidity is (.*) %RH"