Complete rewrite. All public symbols are renamed — this release is a hard break with v1.
Portfolio project, no backward-compatibility shims.
See the migration plan §8.4 for the full rename table.
| v1 | v2 |
|---|---|
DHT_Setup() |
dht_init() |
DHT_Read(double *T, double *H) |
dht_read(dht_reading *reading) (integer-only) |
DHT_GetTemperature(), DHT_GetHumidity() |
removed — use dht_read() |
DHT_ReadRaw(uint8_t data[4]) |
dht_read_raw(uint8_t frame[5]) (full 5-byte frame) |
DHT_GetStatus() |
removed — status is the function’s return value |
DHT_CelsiusToFahrenheit, DHT_CelsiusToKelvin |
removed — one line of user code (see README) |
enum DHT_Status_t { DHT_Ok, ... } |
typedef enum { DHT_OK, DHT_ERROR_TIMEOUT, DHT_ERROR_CHECKSUM, DHT_ERROR_OUT_OF_RANGE } dht_status |
DHT_Type, DHT_Pin |
DHT_TYPE, DHT_PIN |
DHT11, DHT22 |
DHT_TYPE_DHT11, DHT_TYPE_DHT22 |
Demo.c called DHT_Status() (no such function —
it was DHT_GetStatus()), so the shipped example did not compile. Rewritten
against the new API with a working UART loop.DHT_GetTemperature() and DHT_GetHumidity() were
implemented by calling DHT_Read(ptr, NULL) / DHT_Read(NULL, ptr), which
then dereferenced the NULL pointer and wrote through it (on AVR this
silently stores to register r0). Fixed by removing both wrappers; the new
single-struct API cannot be misused this way, and all pointers are checked._delay_us(2) plus
loop overhead per iteration, which added up to tens of extra microseconds
per phase. Timeouts are now expressed as a microsecond budget with a 1 µs
quantum, so the effective window matches the datasheet number.DHT_INIT_DELAY_MS config macro; set to 0 to skip entirely.AVR-DHT-Library;
updated to the current repo and moved under docs/images/.int16_t temperature_celsius_x10,
uint16_t humidity_percent_x10). Dropping double removes the libm
dependency and the pull-in of ~1.5 kB of soft-float on small AVRs.static helper
(wait_while_level).DHT_ATOMIC config wraps the time-critical bit-reading phase in
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) so a user ISR cannot stretch the bit
windows.dht_decode_frame_dht11,
dht_decode_frame_dht22), declared in src/dht_internal.h so host-side
tests can exercise both without recompiling the library twice.AVR-DHT → avr-dht.src/ examples/ tests/ sim/ docs/ scripts/ (see migration
plan §4).Build.ps1, Simulate.ps1, scripts/Common.psm1 for Windows + Linux
build/test automation. Shared byte-identical with sibling repos.tests/ with fake AVR
registers; covers both DHT11 and DHT22 frame layouts, sign-bit handling,
checksum, range validation, and NULL guards.docs/datasheets/ and renamed lowercase
(dht11.pdf, am2302-dht22.pdf)._t suffix (dht_status not dht_status_t);
comments use // form in sentence case.Original Arduino-style API (DHT_Setup, DHT_Read(double*, double*), DHT_GetStatus).