1 /* 2 * Copyright (c) 2021 u-blox AG 3 * Copyright (c) 2021 Linumiz 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #include <device.h> 9 #include <drivers/gpio.h> 10 11 #define MODE_PIN 4 /* P1.04 */ 12 #define A_SEL_PIN 2 /* P1.02 */ 13 bmd345_fem_init(const struct device * dev)14static int bmd345_fem_init(const struct device *dev) 15 { 16 ARG_UNUSED(dev); 17 18 int ret; 19 const struct device *mode_asel_port_dev; 20 21 mode_asel_port_dev = device_get_binding(DT_LABEL(DT_NODELABEL(gpio1))); 22 23 if (!mode_asel_port_dev) { 24 return -ENODEV; 25 } 26 27 ret = gpio_pin_configure(mode_asel_port_dev, MODE_PIN, GPIO_OUTPUT_LOW); 28 if (ret < 0) { 29 return ret; 30 } 31 32 ret = gpio_pin_configure(mode_asel_port_dev, A_SEL_PIN, GPIO_OUTPUT_LOW); 33 if (ret < 0) { 34 return ret; 35 } 36 37 return 0; 38 } 39 40 SYS_INIT(bmd345_fem_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); 41