Skip to content

Commit

Permalink
refactor(boards): Move to pinctrl.
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Nov 6, 2022
1 parent 405f45c commit 355d908
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 6 deletions.
39 changes: 39 additions & 0 deletions app/boards/arm/nice_nano/nice_nano-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_RX, 0, 8)>;
bias-pull-up;
};
group2 {
psels = <NRF_PSEL(UART_TX, 0, 6)>;
};
};

uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_RX, 0, 8)>,
<NRF_PSEL(UART_TX, 0, 6)>;
low-power-enable;
};
};

i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 17)>,
<NRF_PSEL(TWIM_SCL, 0, 20)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 17)>,
<NRF_PSEL(TWIM_SCL, 0, 20)>;
low-power-enable;
};
};
};
12 changes: 8 additions & 4 deletions app/boards/arm/nice_nano/nice_nano.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <nordic/nrf52840_qiaa.dtsi>
#include "nice_nano-pinctrl.dtsi"
#include "arduino_pro_micro_pins.dtsi"

/ {
Expand Down Expand Up @@ -45,14 +46,17 @@

&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <17>;
scl-pin = <20>;
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};

&uart0 {
compatible = "nordic,nrf-uarte";
tx-pin = <6>;
rx-pin = <8>;
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};

&usbd {
Expand Down
5 changes: 4 additions & 1 deletion app/boards/arm/nice_nano/nice_nano_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y

# Use pinctrl
CONFIG_PINCTRL=y

CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y

Expand All @@ -18,4 +21,4 @@ CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_MAP=y
5 changes: 4 additions & 1 deletion app/boards/arm/nice_nano/nice_nano_v2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ CONFIG_BOARD_NICE_NANO_V2=y
# Enable MPU
CONFIG_ARM_MPU=y

# Use pinctrl
CONFIG_PINCTRL=y

# enable GPIO
CONFIG_GPIO=y

Expand All @@ -18,4 +21,4 @@ CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_MAP=y

0 comments on commit 355d908

Please sign in to comment.