2020-08-18 12:27:19 -07:00
|
|
|
/*
|
2020-09-09 20:57:44 -07:00
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
2020-08-18 12:27:19 -07:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
2022-10-07 21:46:08 -07:00
|
|
|
#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>
|
2020-08-18 12:27:19 -07:00
|
|
|
|
2020-12-10 11:31:51 -08:00
|
|
|
static int pinmux_nrfmicro_init(const struct device *port) {
|
2020-09-13 19:53:24 -07:00
|
|
|
ARG_UNUSED(port);
|
2020-08-18 12:27:19 -07:00
|
|
|
|
2022-10-02 19:01:55 -07:00
|
|
|
#if (CONFIG_BOARD_NRFMICRO_13 || CONFIG_BOARD_NRFMICRO_13_52833)
|
2023-01-17 17:40:44 -08:00
|
|
|
const struct device *p0 = DEVICE_DT_GET(DT_NODELABEL(gpio0));
|
2020-08-22 21:59:39 -07:00
|
|
|
#if CONFIG_BOARD_NRFMICRO_CHARGER
|
2020-09-13 19:53:24 -07:00
|
|
|
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
|
|
|
|
gpio_pin_set(p0, 5, 0);
|
2020-08-20 12:12:06 -07:00
|
|
|
#else
|
2020-09-13 19:53:24 -07:00
|
|
|
gpio_pin_configure(p0, 5, GPIO_INPUT);
|
2020-08-20 12:12:06 -07:00
|
|
|
#endif
|
2020-08-18 12:27:19 -07:00
|
|
|
#endif
|
2020-09-13 19:53:24 -07:00
|
|
|
return 0;
|
2020-08-18 12:27:19 -07:00
|
|
|
}
|
|
|
|
|
2020-08-20 03:59:41 -07:00
|
|
|
SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|