Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/gpio/gpioths.c
Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | gpioths_dht_readbytes(struct gpioths_softc *sc) | ||||
calc = 0; | calc = 0; | ||||
for (i = 0; i < sizeof(value); i++) | for (i = 0; i < sizeof(value); i++) | ||||
calc += (value >> (8*i)) & GPIOTHS_DHT_ONEBYTEMASK; | calc += (value >> (8*i)) & GPIOTHS_DHT_ONEBYTEMASK; | ||||
#ifdef GPIOTHS_DEBUG | #ifdef GPIOTHS_DEBUG | ||||
/* Debug bits */ | /* Debug bits */ | ||||
for (i = 0; i < GPIOTHS_DHT_CYCLES; i++) | for (i = 0; i < GPIOTHS_DHT_CYCLES; i++) | ||||
device_printf(dev, "%d: %d %d\n", i, calibrations[i], | device_printf(sc->dev, "%d: %d %d\n", i, calibrations[i], | ||||
intervals[i]); | intervals[i]); | ||||
device_printf(dev, "len=%d, data=%x, crc=%x/%x\n", avglen, value, crc, | device_printf(sc->dev, "len=%d, data=%x, crc=%x/%x\n", avglen, value, crc, | ||||
calc); | calc); | ||||
#endif /* GPIOTHS_DEBUG */ | #endif /* GPIOTHS_DEBUG */ | ||||
/* CRC check */ | /* CRC check */ | ||||
if (calc != crc) { | if (calc != crc) { | ||||
err = -1; | err = -1; | ||||
goto error; | goto error; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines |