Add KNX DALI Gateway Module and Message Queue Implementation

- Introduced KnxDaliModule class for handling DALI message queuing, commissioning, and KNX group-object dispatch.
- Implemented Message and MessageQueue classes for managing message operations.
- Removed obsolete OpenKNX IDF component files and CMake configurations.
- Updated submodule reference for KNX.

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-05-15 12:34:13 +08:00
parent 3f15cd7f3f
commit 449a3a801a
41 changed files with 2279 additions and 918 deletions
@@ -0,0 +1,61 @@
#pragma once
// Internal header shared between gateway_knx.cpp and gateway_knx_router.cpp.
#include "driver/uart.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "soc/uart_periph.h"
#include <cstdint>
#include <string>
namespace gateway {
namespace knx_internal {
constexpr const char* kTag = "gateway_knx";
// RAII semaphore guard.
class SemaphoreGuard {
public:
explicit SemaphoreGuard(SemaphoreHandle_t semaphore) : semaphore_(semaphore) {
if (semaphore_ != nullptr) {
xSemaphoreTake(semaphore_, portMAX_DELAY);
locked_ = true;
}
}
~SemaphoreGuard() {
if (locked_) {
xSemaphoreGive(semaphore_);
}
}
private:
SemaphoreHandle_t semaphore_{nullptr};
bool locked_{false};
};
// Resolve a UART IO pin from config or SoC defaults.
inline bool ResolveUartIoPin(uart_port_t uart_port, int configured_pin,
uint32_t pin_index, int* resolved_pin) {
if (resolved_pin == nullptr) return false;
if (configured_pin >= 0) {
*resolved_pin = configured_pin;
return true;
}
if (uart_port < 0 || uart_port >= SOC_UART_NUM ||
pin_index >= SOC_UART_PINS_COUNT) {
*resolved_pin = UART_PIN_NO_CHANGE;
return false;
}
const int default_pin =
uart_periph_signal[uart_port].pins[pin_index].default_gpio;
if (default_pin < 0) {
*resolved_pin = UART_PIN_NO_CHANGE;
return false;
}
*resolved_pin = default_pin;
return true;
}
} // namespace knx_internal
} // namespace gateway