Skip to content
php-baremetal REGISTRY
Publish a package

php-baremetal/esp32-ledstrip-hal

bm-hal MIT

ESP32 implementation of the neutral LED-strip HAL (bm_ledstrip_hal.h) over Espressif's led_strip component (RMT).

platform: ESP32

The ESP32 side of ext-led: it implements the neutral LED-strip HAL (bm_ledstrip_hal.h) over Espressif's led_strip component on the RMT peripheral. It creates the strips behind the Baremetal\Led\Driver\* classes, writes their pixels and sends the frames.

Field Value
Type bm-hal
Platform esp32 (extra.baremetal.platform)
Provides php-baremetal/ledstrip-hal
ESP-IDF registry components espressif/led_strip ==3.1.0~1 (idf-dependencies)

Install

Projects do not require it. A project requires a chip package (led-ws2812, led-sk6812), which requires ext-led, which requires the virtual php-baremetal/ledstrip-hal; conductor reads the platform from extra.baremetal.sdk (esp32@^2.0) and adds this package while Composer resolves:

bash
composer require php-baremetal/led-ws2812

The first build downloads espressif/led_strip through the ESP-IDF component manager, so it needs network access.

Behaviour

  • One RMT channel per strip. Each strip is a led_strip RMT device: one RMT transmit channel, default clock source, 10 MHz resolution (0.1 microsecond per tick), no DMA, output not inverted. ESP32-S3 and ESP32-P4 have 4 transmit channels; when none is free the constructor throws cannot init NAME on GPIO N.
  • Models. BM_LED_MODEL_SK6812 selects led_strip's SK6812 timing; every other value selects WS2812.
  • Colour order. LED_ORDER_RGB, LED_ORDER_GRBW and LED_ORDER_RGBW map to the matching led_strip component formats; anything else is GRB.
  • Frames. Pixel writes go to led_strip's buffer; show() calls led_strip_refresh(), which waits until the frame is out, on the calling PHP task. Deleting a strip releases its channel without clearing the LEDs.
  • Errors. The functions return the esp_err_t of led_strip; ext-led checks only strip creation.

License

MIT.