diff options
author | Nick <nick.win999@gmail.com> | 2020-09-15 14:41:59 -0500 |
---|---|---|
committer | Nick <nick.win999@gmail.com> | 2020-09-15 14:41:59 -0500 |
commit | 18d21b0362c5c09902836ed4791bd13e1efd9a9a (patch) | |
tree | 3f78a0ef43fc23e93195e1205a31f77154af7e76 /app/boards/arm/nrfmicro/pinmux.c | |
parent | 81bc157f539235ad032fde78b6f6cec7a16d2c39 (diff) | |
parent | c0806d27f1d048db335ecc854eab61b59e23ea7a (diff) |
Merge remote-tracking branch 'upstream/main' into underglow/state-persistence
Diffstat (limited to 'app/boards/arm/nrfmicro/pinmux.c')
-rw-r--r-- | app/boards/arm/nrfmicro/pinmux.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/app/boards/arm/nrfmicro/pinmux.c b/app/boards/arm/nrfmicro/pinmux.c index 803d20d..4e330b6 100644 --- a/app/boards/arm/nrfmicro/pinmux.c +++ b/app/boards/arm/nrfmicro/pinmux.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Okke Formsma, joric + * Copyright (c) 2020 The ZMK Contributors * * SPDX-License-Identifier: MIT */ @@ -11,27 +11,30 @@ #include <sys/sys_io.h> #include <devicetree.h> -static int pinmux_nrfmicro_init(struct device *port) -{ - ARG_UNUSED(port); +static int pinmux_nrfmicro_init(struct device *port) { + ARG_UNUSED(port); - struct device *p1 = device_get_binding("GPIO_1"); + struct device *p1 = device_get_binding("GPIO_1"); -#if defined(BOARD_NRFMICRO_13) - struct device *p0 = device_get_binding("GPIO_0"); - // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1) - gpio_pin_configure(p1, 9, GPIO_OUTPUT); - gpio_pin_set(p1, 9, 0); +#if CONFIG_BOARD_NRFMICRO_13 + struct device *p0 = device_get_binding("GPIO_0"); + // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1) + gpio_pin_configure(p1, 9, GPIO_OUTPUT); + gpio_pin_set(p1, 9, 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 - // enable charger (nRFMicro 1.3 only) - gpio_pin_configure(p0, 5, GPIO_OUTPUT); - gpio_pin_set(p0, 5, 0); #else // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1) - gpio_pin_configure(p1, 9, GPIO_OUTPUT); - gpio_pin_set(p1, 9, 1); + gpio_pin_configure(p1, 9, GPIO_OUTPUT); + gpio_pin_set(p1, 9, 1); #endif - return 0; + return 0; } -SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
\ No newline at end of file +SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); |