drivers: sensor: Fix DHT20 build failure with CRC configured

Fixes the build error: 'crc' undeclared for
DHT20 sensor with CONFIG_DHT20_CRC option enabled.

Signed-off-by: Konrad Sikora <kontakt@konradsikora.pl>
This commit is contained in:
Konrad Sikora 2024-08-04 21:21:22 +02:00 committed by Anas Nashif
commit f3af39b4d7
2 changed files with 2 additions and 1 deletions

View file

@ -190,7 +190,7 @@ static int dht20_read_sample(const struct device *dev, uint32_t *t_sample, uint3
#if defined(CONFIG_DHT20_CRC)
/* Compute and check CRC with last byte of measurement data */
crc = crc8(rx_buf, 6, DHT20_CRC_POLYNOM, 0xFF, false);
uint8_t crc = crc8(rx_buf, 6, DHT20_CRC_POLYNOM, 0xFF, false);
if (crc != rx_buf[6]) {
rc = -EIO;

View file

@ -16,3 +16,4 @@ CONFIG_W1=y
CONFIG_SENSOR=y
CONFIG_ICM42605_TRIGGER_NONE=y
CONFIG_EMUL=y
CONFIG_DHT20_CRC=y