1 /* 2 * Copyright (c) 2024 Daikin Comfort Technologies North America, Inc. 3 * Copyright (c) 2021 Sateesh Kotapati 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #include <zephyr/init.h> 9 #include <zephyr/drivers/gpio.h> 10 #include <zephyr/sys/printk.h> 11 #include <zephyr/logging/log.h> 12 13 LOG_MODULE_REGISTER(sparkfun_thing_plus_mgm240p, 14 CONFIG_BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P_LOG_LEVEL); 15 sparkfun_thing_plus_mgm240p_init(void)16static int sparkfun_thing_plus_mgm240p_init(void) 17 { 18 int ret; 19 20 static struct gpio_dt_spec wake_up_gpio_dev = 21 GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios); 22 23 24 if (!gpio_is_ready_dt(&wake_up_gpio_dev)) { 25 LOG_ERR("Wake-up GPIO device was not found!\n"); 26 return -ENODEV; 27 } 28 ret = gpio_pin_configure_dt(&wake_up_gpio_dev, GPIO_OUTPUT_ACTIVE); 29 if (ret < 0) { 30 return ret; 31 } 32 33 return 0; 34 } 35 36 /* needs to be done after GPIO driver init */ 37 SYS_INIT(sparkfun_thing_plus_mgm240p_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); 38