zmk/app/boards/arm/nrfmicro/pinmux.c

28 lines
697 B
C
Raw Normal View History

/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/sys_io.h>
#include <zephyr/devicetree.h>
static int pinmux_nrfmicro_init(void) {
#if (CONFIG_BOARD_NRFMICRO_13 || CONFIG_BOARD_NRFMICRO_13_52833)
const struct device *p0 = DEVICE_DT_GET(DT_NODELABEL(gpio0));
#if CONFIG_BOARD_NRFMICRO_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
gpio_pin_set(p0, 5, 0);
2020-08-20 12:12:06 -07:00
#else
gpio_pin_configure(p0, 5, GPIO_INPUT);
2020-08-20 12:12:06 -07:00
#endif
#endif
return 0;
}
2020-08-20 03:59:41 -07:00
SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);