Files
gateway/components/dali
2026-04-29 18:53:26 +08:00
..
2026-04-29 18:53:26 +08:00
2026-04-29 18:53:26 +08:00
2026-04-29 18:53:26 +08:00
2026-04-29 18:53:26 +08:00
2026-04-29 18:53:26 +08:00
2026-04-29 18:53:26 +08:00

DALI ESP-IDF Component

This component provides a DALI (IEC 62386) protocol stack and ESP-IDF HAL implementation that can be used directly in native FreeRTOS/ESP-IDF projects.

Features

  • DALI forward and backward frame support.
  • Multi-bus support (DALI_PHY_COUNT, default 16).
  • Runtime baudrate control (400..2400, default 1200).
  • ESP-IDF GPTimer + GPIO interrupt driven HAL.

Public Headers

  • dali.h: high-level DALI helpers.
  • dali_hal.h: HAL API and queue access.
  • dali_define.h: DALI command definitions.

Quick Start

  1. Add this component to your project.
  2. Configure TX/RX pins and initialize at least one bus.
  3. Send a DALI frame.
#include "dali.h"
#include "dali_define.h"
#include "dali_hal.h"

void app_main(void) {
    ESP_ERROR_CHECK(dali_hal_set_baudrate(1200));
    ESP_ERROR_CHECK(dali_hal_init(0, 4, 5));

    Dali_msg_t msg = dali_msg_new(0xFF, DALI_CMD_ON); // broadcast ON command
    msg.id = 0;
    dali_send(&msg);
}

Kconfig Options

Use menuconfig under DALI Component to configure:

  • Bus count and default baudrate.
  • Queue sizes.
  • Task stack sizes and priorities.
  • Optional debug task.

API Note

The global TX response queue symbol was renamed:

  • old: dali_send_replay_queue
  • new: dali_send_reply_queue

See MIGRATION.md for compatibility notes.

Examples

  • examples/dali_basic
  • examples/dali_multi_bus