Update 2026-09-15: not a thin wrapper, precise HAL work filed at PyMCU/PyMCU#450
Checked what a wrapper would actually call. Neither is one:
bitstream()'s timing argument is a runtime 4-tuple, not compile-time constants, so it
needs a genuinely runtime-parameterized pulse primitive. pulse_delay_us (already in
lib/src/pymcu/hal/avr/pulse/atmega328p.py) is the missing piece, but it is microsecond
granularity: fine for most one-wire protocols, not for WS2812-class sub-microsecond timing
(pymcu.hal.avr.ws2812 hardcodes counted-NOP timing per protocol instead, for that reason).
dht_readinto()'s actual bit-bang routine already exists, but in pymcu-lib-dht
(src/pymcu_lib_dht/mcu/_dht/avr.py), a separate PyPI package, not PyMCU/PyMCU -- and it
is hardcoded to PD2-PD7 only. Wrapping a downstream sensor package from this compat
layer would invert how this project's layering works everywhere else.
Both need real HAL additions, not wrappers: named precisely, with the exact function
signatures to add, at PyMCU/PyMCU#450 (milestone Peripherals).
Original report
machine.bitstream(pin, encoding, timing, data) and machine.dht_readinto(pin, buf) are
MicroPython's generic, precisely-timed single-pin bit-banging primitives (used to drive
WS2812-style LEDs and to read DHT11/22 humidity sensors without a dedicated peripheral).
Neither is exported by src/pymcu_micropython/machine.py.
Repo choice
PyMCU/PyMCU#450 (HAL). src/pymcu_micropython/machine.py needs only thin @inline wrappers
once either lands.
Update 2026-09-15: not a thin wrapper, precise HAL work filed at PyMCU/PyMCU#450
Checked what a wrapper would actually call. Neither is one:
bitstream()'stimingargument is a runtime 4-tuple, not compile-time constants, so itneeds a genuinely runtime-parameterized pulse primitive.
pulse_delay_us(already inlib/src/pymcu/hal/avr/pulse/atmega328p.py) is the missing piece, but it is microsecondgranularity: fine for most one-wire protocols, not for WS2812-class sub-microsecond timing
(
pymcu.hal.avr.ws2812hardcodes counted-NOP timing per protocol instead, for that reason).dht_readinto()'s actual bit-bang routine already exists, but inpymcu-lib-dht(
src/pymcu_lib_dht/mcu/_dht/avr.py), a separate PyPI package, notPyMCU/PyMCU-- and itis hardcoded to
PD2-PD7only. Wrapping a downstream sensor package from this compatlayer would invert how this project's layering works everywhere else.
Both need real HAL additions, not wrappers: named precisely, with the exact function
signatures to add, at PyMCU/PyMCU#450 (milestone Peripherals).
Original report
machine.bitstream(pin, encoding, timing, data)andmachine.dht_readinto(pin, buf)areMicroPython's generic, precisely-timed single-pin bit-banging primitives (used to drive
WS2812-style LEDs and to read DHT11/22 humidity sensors without a dedicated peripheral).
Neither is exported by
src/pymcu_micropython/machine.py.Repo choice
PyMCU/PyMCU#450 (HAL).
src/pymcu_micropython/machine.pyneeds only thin@inlinewrappersonce either lands.