4d81b10ba7
This PR adds support to control the external power output from controllers like nice!nano, nRFMicro etc I have implemented based on my understanding of Pete suggestion on this feature. Testing done: Tested by enabling and disabling the ext_power from application and verified Verified the application does not crash with boards that does not have ext_power support Note: I did not test this in nice!nano since I don't have the boards. Will get help from others once the behavior PR is up Next Steps: Create a behavior PR to control enable/disable ext_power
29 lines
645 B
C
29 lines
645 B
C
/*
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
*
|
|
* 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>
|
|
|
|
static int pinmux_nrfmicro_init(struct device *port) {
|
|
ARG_UNUSED(port);
|
|
|
|
#if CONFIG_BOARD_NRFMICRO_13
|
|
struct device *p0 = device_get_binding("GPIO_0");
|
|
#if CONFIG_BOARD_NRFMICRO_CHARGER
|
|
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
|
|
gpio_pin_set(p0, 5, 0);
|
|
#else
|
|
gpio_pin_configure(p0, 5, GPIO_INPUT);
|
|
#endif
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|