drivers: sensor: dht20: implement new driver

The DHT20 sensor is a temperature and humidity sensor that uses I2C to
communicate with a microcontroller. The DHT20 sensor is Aosong.

use standard crc

update description to add reference to AHT20 and AM2301B

clean code, use defines and bit manipulation

add dht20 to i2c test suite for build tests

update bit manipulation

use more defines instead of raw numbers

add bindings to allow aht20 or am2301b to be used in devicetree

in all 3 cases, the same dht20.c driver is compiled

Signed-off-by: Nathan Olff <nathan@kickmaker.net>
This commit is contained in:
Nathan Olff 2024-01-07 17:29:18 +01:00 committed by Fabio Baltieri
commit 13deb0365c
9 changed files with 452 additions and 0 deletions

View file

@ -0,0 +1,14 @@
#
# Copyright (c) 2024 Nathan Olff
#
# SPDX-License-Identifier: Apache-2.0
description: |
Aosong AHT20 (Digital-output Humidity and Temperature Sensor)
The Asosong AHT20 sensor provides temperature and humidity
measurements through an I2C bus.
compatible: "aosong,aht20"
include: [sensor-device.yaml, i2c-device.yaml]

View file

@ -0,0 +1,14 @@
#
# Copyright (c) 2024 Nathan Olff
#
# SPDX-License-Identifier: Apache-2.0
description: |
Aosong AM2301B (Digital-output Humidity and Temperature Sensor)
The Asosong AM2301B sensor provides temperature and humidity
measurements through an I2C bus.
compatible: "aosong,am2301b"
include: [sensor-device.yaml, i2c-device.yaml]

View file

@ -0,0 +1,14 @@
#
# Copyright (c) 2024 Nathan Olff
#
# SPDX-License-Identifier: Apache-2.0
description: |
Aosong DHT20 (Digital-output Humidity and Temperature Sensor)
The Asosong DHT20 sensor provides temperature and humidity
measurements through an I2C bus.
compatible: "aosong,dht20"
include: [sensor-device.yaml, i2c-device.yaml]