Browse Source

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>
pull/76795/head
Konrad Sikora 11 months ago committed by Anas Nashif
parent
commit
f3af39b4d7
  1. 2
      drivers/sensor/aosong/dht20/dht20.c
  2. 1
      tests/drivers/build_all/sensor/prj.conf

2
drivers/sensor/aosong/dht20/dht20.c

@ -190,7 +190,7 @@ static int dht20_read_sample(const struct device *dev, uint32_t *t_sample, uint3 @@ -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;

1
tests/drivers/build_all/sensor/prj.conf

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

Loading…
Cancel
Save