2020-08-19 05:27:19 +10:00
|
|
|
/*
|
2020-09-10 13:57:44 +10:00
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
2020-08-19 05:27:19 +10:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <device.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <drivers/gpio.h>
|
|
|
|
#include <sys/sys_io.h>
|
|
|
|
#include <devicetree.h>
|
|
|
|
|
2020-09-14 12:53:24 +10:00
|
|
|
static int pinmux_nrfmicro_init(struct device *port) {
|
|
|
|
ARG_UNUSED(port);
|
2020-08-19 05:27:19 +10:00
|
|
|
|
2020-08-20 20:59:41 +10:00
|
|
|
#if CONFIG_BOARD_NRFMICRO_13
|
2020-09-14 12:53:24 +10:00
|
|
|
struct device *p0 = device_get_binding("GPIO_0");
|
2020-08-23 14:59:39 +10:00
|
|
|
#if CONFIG_BOARD_NRFMICRO_CHARGER
|
2020-09-14 12:53:24 +10:00
|
|
|
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
|
|
|
|
gpio_pin_set(p0, 5, 0);
|
2020-08-21 05:12:06 +10:00
|
|
|
#else
|
2020-09-14 12:53:24 +10:00
|
|
|
gpio_pin_configure(p0, 5, GPIO_INPUT);
|
2020-08-21 05:12:06 +10:00
|
|
|
#endif
|
2020-08-19 05:27:19 +10:00
|
|
|
#endif
|
2020-09-14 12:53:24 +10:00
|
|
|
return 0;
|
2020-08-19 05:27:19 +10:00
|
|
|
}
|
|
|
|
|
2020-08-20 20:59:41 +10:00
|
|
|
SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|