boards: arduino_nano_33_ble: Pull user LED low during board init

Pull user LED low during board init since the Arduino bootloader
leaves it high.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
This commit is contained in:
Benjamin Björnsson 2022-04-21 17:25:29 +02:00 committed by Maureen Helm
parent d4731daaf6
commit 4db3b0c0d4

View file

@ -9,16 +9,28 @@
static int board_init(const struct device *dev)
{
const struct gpio_dt_spec pull_up =
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), pull_up_gpios);
ARG_UNUSED(dev);
int res;
static const struct gpio_dt_spec pull_up =
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), pull_up_gpios);
static const struct gpio_dt_spec user_led =
GPIO_DT_SPEC_GET(DT_ALIAS(led4), gpios);
if (!device_is_ready(pull_up.port)) {
return -ENODEV;
}
return gpio_pin_configure_dt(&pull_up, GPIO_OUTPUT_HIGH);
if (!device_is_ready(user_led.port)) {
return -ENODEV;
}
res = gpio_pin_configure_dt(&pull_up, GPIO_OUTPUT_HIGH);
if (res) {
return res;
}
return gpio_pin_configure_dt(&user_led, GPIO_OUTPUT_INACTIVE);
}
SYS_INIT(board_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);