forked from EmbeddedTeam/app_photomagnetic
Configure IR enable pin at initialization
This commit is contained in:
parent
68bc52572a
commit
3b0c0c321f
@ -1,9 +1,9 @@
|
|||||||
#include <com.hpp>
|
#include <com.hpp>
|
||||||
#include <etl/utility.h>
|
#include <etl/utility.h>
|
||||||
#include <infrared.hpp>
|
#include <infrared.hpp>
|
||||||
|
#include <zephyr/drivers/gpio.h>
|
||||||
#include <zephyr/init.h>
|
#include <zephyr/init.h>
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
|
||||||
/* 1 = enable verbose diagnostics (per-second channel dump). */
|
/* 1 = enable verbose diagnostics (per-second channel dump). */
|
||||||
#ifndef APP_DEBUG_PRINT
|
#ifndef APP_DEBUG_PRINT
|
||||||
#define APP_DEBUG_PRINT 0
|
#define APP_DEBUG_PRINT 0
|
||||||
@ -63,7 +63,14 @@ static void OnSendTick(struct k_work *work) {
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // 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 {
|
static auto Init() -> int {
|
||||||
|
InitEnblePins();
|
||||||
printk("[%s]temp init\n", MODULE);
|
printk("[%s]temp init\n", MODULE);
|
||||||
if (auto r = Infrared::Init(); r.code_id() != zpp::error_code::k_ok) {
|
if (auto r = Infrared::Init(); r.code_id() != zpp::error_code::k_ok) {
|
||||||
printk("[%s] Infrared::Init failed: %d\n", MODULE,
|
printk("[%s] Infrared::Init failed: %d\n", MODULE,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user