Configure IR enable pin at initialization

This commit is contained in:
zhangyisong 2026-08-12 15:08:54 +08:00
parent 68bc52572a
commit 3b0c0c321f

View File

@ -1,9 +1,9 @@
#include <com.hpp>
#include <etl/utility.h>
#include <infrared.hpp>
#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
/* 1 = enable verbose diagnostics (per-second channel dump). */
#ifndef APP_DEBUG_PRINT
#define APP_DEBUG_PRINT 0
@ -63,7 +63,14 @@ static void OnSendTick(struct k_work *work) {
}
} // namespace
#define ZEPHYR_USER_NODE DT_PATH(zephyr_user)
auto InitEnblePins() {
const gpio_dt_spec en_pin = GPIO_DT_SPEC_GET(ZEPHYR_USER_NODE, en_ir_gpios);
gpio_pin_configure_dt(&en_pin, GPIO_OUTPUT_ACTIVE);
}
static auto Init() -> int {
InitEnblePins();
printk("[%s]temp init\n", MODULE);
if (auto r = Infrared::Init(); r.code_id() != zpp::error_code::k_ok) {
printk("[%s] Infrared::Init failed: %d\n", MODULE,