From bc282a0a4f1af4f6f78a0dd63e5b022eb76a603c Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 2 Aug 2020 10:29:07 -0500 Subject: [PATCH 1/4] WIP DZ60RGB board definition --- app/boards/arm/dz60rgb/CMakeLists.txt | 9 ++ app/boards/arm/dz60rgb/Kconfig.board | 6 ++ app/boards/arm/dz60rgb/Kconfig.defconfig | 14 +++ app/boards/arm/dz60rgb/board.cmake | 6 ++ app/boards/arm/dz60rgb/dz60rgb_rev1.dts | 87 +++++++++++++++++++ app/boards/arm/dz60rgb/dz60rgb_rev1.yaml | 19 ++++ app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig | 30 +++++++ app/boards/arm/dz60rgb/keymap/keymap.overlay | 37 ++++++++ app/boards/arm/dz60rgb/pinmux.c | 69 +++++++++++++++ 9 files changed, 277 insertions(+) create mode 100644 app/boards/arm/dz60rgb/CMakeLists.txt create mode 100644 app/boards/arm/dz60rgb/Kconfig.board create mode 100644 app/boards/arm/dz60rgb/Kconfig.defconfig create mode 100644 app/boards/arm/dz60rgb/board.cmake create mode 100644 app/boards/arm/dz60rgb/dz60rgb_rev1.dts create mode 100644 app/boards/arm/dz60rgb/dz60rgb_rev1.yaml create mode 100644 app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig create mode 100644 app/boards/arm/dz60rgb/keymap/keymap.overlay create mode 100644 app/boards/arm/dz60rgb/pinmux.c diff --git a/app/boards/arm/dz60rgb/CMakeLists.txt b/app/boards/arm/dz60rgb/CMakeLists.txt new file mode 100644 index 00000000..6a0ec73e --- /dev/null +++ b/app/boards/arm/dz60rgb/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: MIT + +list(APPEND EXTRA_DTC_FLAGS "-qq") + +if(CONFIG_PINMUX) +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) +endif() diff --git a/app/boards/arm/dz60rgb/Kconfig.board b/app/boards/arm/dz60rgb/Kconfig.board new file mode 100644 index 00000000..a96271f0 --- /dev/null +++ b/app/boards/arm/dz60rgb/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2020 Nick Winans +# SPDX-License-Identifier: MIT + +config BOARD_DZ60RGB_REV1 + bool "DZ60RGB Keyboard" + depends on SOC_STM32F303XC diff --git a/app/boards/arm/dz60rgb/Kconfig.defconfig b/app/boards/arm/dz60rgb/Kconfig.defconfig new file mode 100644 index 00000000..cfa71d3f --- /dev/null +++ b/app/boards/arm/dz60rgb/Kconfig.defconfig @@ -0,0 +1,14 @@ +# Planck keyboard configuration + +# Copyright (c) 2020 Nick Winans +# SPDX-License-Identifier: MIT + +if BOARD_DZ60RGB_REV1 + +config ZMK_KEYBOARD_NAME + default "DZ60RGB Rev 1" + +config ZMK_USB + default y + +endif # BOARD_DZ60RGB_REV1 diff --git a/app/boards/arm/dz60rgb/board.cmake b/app/boards/arm/dz60rgb/board.cmake new file mode 100644 index 00000000..4843c415 --- /dev/null +++ b/app/boards/arm/dz60rgb/board.cmake @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT + +board_runner_args(jlink "--device=STM32F303VC" "--speed=4000") + +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts new file mode 100644 index 00000000..8066b5ad --- /dev/null +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2020 Nick Winans + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include + +#include + +/ { + model = "DZ60RGB, Rev 1"; + compatible = "dz60rgb,rev1", "st,stm32f303"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan0; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <14>; + rows = <5>; + map = < +RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11) RC(0,12) RC(0,13) +RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13) +RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,13) +RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) +RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,13) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&gpioa 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpiob 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpiob 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpiob 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpiob 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&gpioa 6 GPIO_ACTIVE_HIGH> + , <&gpioa 7 GPIO_ACTIVE_HIGH> + , <&gpiob 0 GPIO_ACTIVE_HIGH> + , <&gpiob 13 GPIO_ACTIVE_HIGH> + , <&gpiob 15 GPIO_ACTIVE_HIGH> + , <&gpioa 8 GPIO_ACTIVE_HIGH> + , <&gpioa 15 GPIO_ACTIVE_HIGH> + , <&gpiob 3 GPIO_ACTIVE_HIGH> + , <&gpiob 4 GPIO_ACTIVE_HIGH> + , <&gpiob 5 GPIO_ACTIVE_HIGH> + , <&gpiob 6 GPIO_ACTIVE_HIGH> + , <&gpiob 9 GPIO_ACTIVE_HIGH> + , <&gpioc 13 GPIO_ACTIVE_HIGH> + , <&gpioc 14 GPIO_ACTIVE_HIGH> + ; + }; + +}; + +&usb { + status = "okay"; +}; + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Set 6Kb of storage at the end of the 256Kb of flash */ + storage_partition: partition@3e800 { + label = "storage"; + reg = <0x0003e800 0x00001800>; + }; + }; +}; diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1.yaml b/app/boards/arm/dz60rgb/dz60rgb_rev1.yaml new file mode 100644 index 00000000..d2836218 --- /dev/null +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1.yaml @@ -0,0 +1,19 @@ +identifier: DZ60RGB_rev1 +name: DZ60RGBREV1 +type: keyboard +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 40 +supported: + - gpio + - i2c + - counter + - spi + - usb_device + - lsm303dlhc + - nvs + - can + - kscan diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig b/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig new file mode 100644 index 00000000..5a4c0995 --- /dev/null +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_STM32F3X=y +CONFIG_SOC_STM32F303XC=y +# 72MHz system clock +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 + +# enable pinmux +CONFIG_PINMUX=y + +# enable GPIO +CONFIG_GPIO=y + +# clock configuration +CONFIG_CLOCK_CONTROL=y + +# Clock configuration for Cube Clock control driver +CONFIG_CLOCK_STM32_HSE_CLOCK=8000000 +CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y +# use HSE as PLL input +CONFIG_CLOCK_STM32_PLL_SRC_HSE=y +# however, the board does not have an external oscillator, so just use +# the 8MHz clock signal coming from integrated STLink +CONFIG_CLOCK_STM32_HSE_BYPASS=y +# produce 72MHz clock at PLL output +CONFIG_CLOCK_STM32_PLL_PREDIV=1 +CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9 +CONFIG_CLOCK_STM32_AHB_PRESCALER=1 +CONFIG_CLOCK_STM32_APB1_PRESCALER=2 +CONFIG_CLOCK_STM32_APB2_PRESCALER=1 diff --git a/app/boards/arm/dz60rgb/keymap/keymap.overlay b/app/boards/arm/dz60rgb/keymap/keymap.overlay new file mode 100644 index 00000000..9d83adcf --- /dev/null +++ b/app/boards/arm/dz60rgb/keymap/keymap.overlay @@ -0,0 +1,37 @@ +#include +#include +#include + +/ { + chosen { + zmk,keymap = &keymap0; + }; + + keymap0: keymap { + compatible = "zmk,keymap"; + label ="Default DZ60RGB Keymap"; + layers = <&default>; + }; + + layers { + compatible = "zmk,layers"; + + default: layer_0 { + label = "DEFAULT"; +// ------------------------------------------------------------------------------------------ +// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | +// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | "|" | +// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | +// | SHIFT | Z | X | C | V | B | N | M | , | . | SHIFT(/) | ^ | DEL | +// | CTL | WIN | ALT | SPACE | ALT | MO(1) | <- | v | -> | +// ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS &kp EQL &kp BKSP + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH + &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT &kp RET + &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &mt MOD_RSFT FSLH &kp UARW &kp DEL + &kp LCTL &kp LGUI &kp LALT &kp SPC &kp RALT &mo 1 &kp LARW &kp DARW &kp RARW + >; + }; + }; +}; diff --git a/app/boards/arm/dz60rgb/pinmux.c b/app/boards/arm/dz60rgb/pinmux.c new file mode 100644 index 00000000..5df5c90e --- /dev/null +++ b/app/boards/arm/dz60rgb/pinmux.c @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2017 I-SENSE group of ICCS + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include + +#include + +/* pin assignments for STM32F3DISCOVERY board */ +static const struct pin_config pinconf[] = { +#ifdef CONFIG_UART_1 + {STM32_PIN_PC4, STM32F3_PINMUX_FUNC_PC4_USART1_TX}, + {STM32_PIN_PC5, STM32F3_PINMUX_FUNC_PC5_USART1_RX}, +#endif /* CONFIG_UART_1 */ +#ifdef CONFIG_UART_2 + {STM32_PIN_PA2, STM32F3_PINMUX_FUNC_PA2_USART2_TX}, + {STM32_PIN_PA3, STM32F3_PINMUX_FUNC_PA3_USART2_RX}, +#endif /* CONFIG_UART_2 */ +#ifdef CONFIG_I2C_1 + {STM32_PIN_PB6, STM32F3_PINMUX_FUNC_PB6_I2C1_SCL}, + {STM32_PIN_PB7, STM32F3_PINMUX_FUNC_PB7_I2C1_SDA}, +#endif /* CONFIG_I2C_1 */ +#ifdef CONFIG_I2C_2 + {STM32_PIN_PA9, STM32F3_PINMUX_FUNC_PA9_I2C2_SCL}, + {STM32_PIN_PA10, STM32F3_PINMUX_FUNC_PA10_I2C2_SDA}, +#endif /* CONFIG_I2C_2 */ +#ifdef CONFIG_SPI_1 +#ifdef CONFIG_SPI_STM32_USE_HW_SS + {STM32_PIN_PA4, STM32F3_PINMUX_FUNC_PA4_SPI1_NSS}, +#endif /* CONFIG_SPI_STM32_USE_HW_SS */ + {STM32_PIN_PA5, STM32F3_PINMUX_FUNC_PA5_SPI1_SCK}, + {STM32_PIN_PA6, STM32F3_PINMUX_FUNC_PA6_SPI1_MISO}, + {STM32_PIN_PA7, STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI}, +#endif /* CONFIG_SPI_1 */ +#ifdef CONFIG_SPI_2 +#ifdef CONFIG_SPI_STM32_USE_HW_SS + {STM32_PIN_PB12, STM32F3_PINMUX_FUNC_PB12_SPI2_NSS}, +#endif /* CONFIG_SPI_STM32_USE_HW_SS */ + {STM32_PIN_PB13, STM32F3_PINMUX_FUNC_PB13_SPI2_SCK}, + {STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO}, + {STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI}, +#endif /* CONFIG_SPI_2 */ +#ifdef CONFIG_USB_DC_STM32 + {STM32_PIN_PA11, STM32F3_PINMUX_FUNC_PA11_USB_DM}, + {STM32_PIN_PA12, STM32F3_PINMUX_FUNC_PA12_USB_DP}, +#endif /* CONFIG_USB_DC_STM32 */ +#ifdef CONFIG_CAN_1 + {STM32_PIN_PD0, STM32F3_PINMUX_FUNC_PD0_CAN1_RX}, + {STM32_PIN_PD1, STM32F3_PINMUX_FUNC_PD1_CAN1_TX}, +#endif /* CONFIG_CAN_1 */ +}; + +static int pinmux_stm32_init(struct device *port) +{ + ARG_UNUSED(port); + + stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf)); + + return 0; +} + +SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, + CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY); From 6b433fdefd0793e836574f528445b7d4b6d781bc Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 7 Sep 2020 12:24:47 -0500 Subject: [PATCH 2/4] Finish DZ60RGB board definition --- app/boards/arm/dz60rgb/CMakeLists.txt | 2 -- app/boards/arm/dz60rgb/board.cmake | 3 +- app/boards/arm/dz60rgb/dz60rgb_rev1.dts | 5 +-- .../keymap.overlay => dz60rgb_rev1.keymap} | 18 ++--------- app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig | 3 -- app/boards/arm/dz60rgb/pinmux.c | 32 +++++++++---------- 6 files changed, 24 insertions(+), 39 deletions(-) rename app/boards/arm/dz60rgb/{keymap/keymap.overlay => dz60rgb_rev1.keymap} (85%) diff --git a/app/boards/arm/dz60rgb/CMakeLists.txt b/app/boards/arm/dz60rgb/CMakeLists.txt index 6a0ec73e..940af1fe 100644 --- a/app/boards/arm/dz60rgb/CMakeLists.txt +++ b/app/boards/arm/dz60rgb/CMakeLists.txt @@ -1,7 +1,5 @@ # SPDX-License-Identifier: MIT -list(APPEND EXTRA_DTC_FLAGS "-qq") - if(CONFIG_PINMUX) zephyr_library() zephyr_library_sources(pinmux.c) diff --git a/app/boards/arm/dz60rgb/board.cmake b/app/boards/arm/dz60rgb/board.cmake index 4843c415..10f6e291 100644 --- a/app/boards/arm/dz60rgb/board.cmake +++ b/app/boards/arm/dz60rgb/board.cmake @@ -1,6 +1,7 @@ # SPDX-License-Identifier: MIT -board_runner_args(jlink "--device=STM32F303VC" "--speed=4000") +board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") +board_runner_args(jlink "--device=STM32F303CC" "--speed=4000") include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts index 8066b5ad..dc1b6ea5 100644 --- a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts @@ -17,6 +17,7 @@ zephyr,sram = &sram0; zephyr,flash = &flash0; zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; }; default_transform: keymap_transform_0 { @@ -28,7 +29,7 @@ RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13) RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,13) RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,13) -RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,13) +RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,13) >; }; @@ -55,7 +56,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(4 , <&gpiob 3 GPIO_ACTIVE_HIGH> , <&gpiob 4 GPIO_ACTIVE_HIGH> , <&gpiob 5 GPIO_ACTIVE_HIGH> - , <&gpiob 6 GPIO_ACTIVE_HIGH> + , <&gpiob 8 GPIO_ACTIVE_HIGH> , <&gpiob 9 GPIO_ACTIVE_HIGH> , <&gpioc 13 GPIO_ACTIVE_HIGH> , <&gpioc 14 GPIO_ACTIVE_HIGH> diff --git a/app/boards/arm/dz60rgb/keymap/keymap.overlay b/app/boards/arm/dz60rgb/dz60rgb_rev1.keymap similarity index 85% rename from app/boards/arm/dz60rgb/keymap/keymap.overlay rename to app/boards/arm/dz60rgb/dz60rgb_rev1.keymap index 9d83adcf..8de01c17 100644 --- a/app/boards/arm/dz60rgb/keymap/keymap.overlay +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1.keymap @@ -1,23 +1,11 @@ #include #include -#include / { - chosen { - zmk,keymap = &keymap0; - }; - - keymap0: keymap { + keymap { compatible = "zmk,keymap"; - label ="Default DZ60RGB Keymap"; - layers = <&default>; - }; - layers { - compatible = "zmk,layers"; - - default: layer_0 { - label = "DEFAULT"; + default_layer { // ------------------------------------------------------------------------------------------ // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | "|" | @@ -34,4 +22,4 @@ >; }; }; -}; +}; \ No newline at end of file diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig b/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig index 5a4c0995..33840f96 100644 --- a/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig @@ -19,9 +19,6 @@ CONFIG_CLOCK_STM32_HSE_CLOCK=8000000 CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y # use HSE as PLL input CONFIG_CLOCK_STM32_PLL_SRC_HSE=y -# however, the board does not have an external oscillator, so just use -# the 8MHz clock signal coming from integrated STLink -CONFIG_CLOCK_STM32_HSE_BYPASS=y # produce 72MHz clock at PLL output CONFIG_CLOCK_STM32_PLL_PREDIV=1 CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9 diff --git a/app/boards/arm/dz60rgb/pinmux.c b/app/boards/arm/dz60rgb/pinmux.c index 5df5c90e..60e231b6 100644 --- a/app/boards/arm/dz60rgb/pinmux.c +++ b/app/boards/arm/dz60rgb/pinmux.c @@ -14,46 +14,46 @@ /* pin assignments for STM32F3DISCOVERY board */ static const struct pin_config pinconf[] = { -#ifdef CONFIG_UART_1 +#if DT_NODE_HAS_STATUS(DT_NODELABEL(usart1), okay) && CONFIG_SERIAL {STM32_PIN_PC4, STM32F3_PINMUX_FUNC_PC4_USART1_TX}, {STM32_PIN_PC5, STM32F3_PINMUX_FUNC_PC5_USART1_RX}, -#endif /* CONFIG_UART_1 */ -#ifdef CONFIG_UART_2 +#endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(usart2), okay) && CONFIG_SERIAL {STM32_PIN_PA2, STM32F3_PINMUX_FUNC_PA2_USART2_TX}, {STM32_PIN_PA3, STM32F3_PINMUX_FUNC_PA3_USART2_RX}, -#endif /* CONFIG_UART_2 */ -#ifdef CONFIG_I2C_1 +#endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C {STM32_PIN_PB6, STM32F3_PINMUX_FUNC_PB6_I2C1_SCL}, {STM32_PIN_PB7, STM32F3_PINMUX_FUNC_PB7_I2C1_SDA}, -#endif /* CONFIG_I2C_1 */ -#ifdef CONFIG_I2C_2 +#endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) && CONFIG_I2C {STM32_PIN_PA9, STM32F3_PINMUX_FUNC_PA9_I2C2_SCL}, {STM32_PIN_PA10, STM32F3_PINMUX_FUNC_PA10_I2C2_SDA}, -#endif /* CONFIG_I2C_2 */ -#ifdef CONFIG_SPI_1 +#endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi1), okay) && CONFIG_SPI #ifdef CONFIG_SPI_STM32_USE_HW_SS {STM32_PIN_PA4, STM32F3_PINMUX_FUNC_PA4_SPI1_NSS}, #endif /* CONFIG_SPI_STM32_USE_HW_SS */ {STM32_PIN_PA5, STM32F3_PINMUX_FUNC_PA5_SPI1_SCK}, {STM32_PIN_PA6, STM32F3_PINMUX_FUNC_PA6_SPI1_MISO}, {STM32_PIN_PA7, STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI}, -#endif /* CONFIG_SPI_1 */ -#ifdef CONFIG_SPI_2 +#endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi2), okay) && CONFIG_SPI #ifdef CONFIG_SPI_STM32_USE_HW_SS {STM32_PIN_PB12, STM32F3_PINMUX_FUNC_PB12_SPI2_NSS}, #endif /* CONFIG_SPI_STM32_USE_HW_SS */ {STM32_PIN_PB13, STM32F3_PINMUX_FUNC_PB13_SPI2_SCK}, {STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO}, {STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI}, -#endif /* CONFIG_SPI_2 */ +#endif #ifdef CONFIG_USB_DC_STM32 {STM32_PIN_PA11, STM32F3_PINMUX_FUNC_PA11_USB_DM}, {STM32_PIN_PA12, STM32F3_PINMUX_FUNC_PA12_USB_DP}, -#endif /* CONFIG_USB_DC_STM32 */ -#ifdef CONFIG_CAN_1 +#endif /* CONFIG_USB_DC_STM32 */ +#if DT_NODE_HAS_STATUS(DT_NODELABEL(can1), okay) && CONFIG_CAN {STM32_PIN_PD0, STM32F3_PINMUX_FUNC_PD0_CAN1_RX}, {STM32_PIN_PD1, STM32F3_PINMUX_FUNC_PD1_CAN1_TX}, -#endif /* CONFIG_CAN_1 */ +#endif }; static int pinmux_stm32_init(struct device *port) @@ -66,4 +66,4 @@ static int pinmux_stm32_init(struct device *port) } SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, - CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY); + CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY); \ No newline at end of file From e845995c2d5ea90327e68495569f7d1a25242ee2 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 7 Sep 2020 12:25:11 -0500 Subject: [PATCH 3/4] Fix Planck defconfig --- app/boards/arm/planck/planck_rev6_defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/boards/arm/planck/planck_rev6_defconfig b/app/boards/arm/planck/planck_rev6_defconfig index a440ff17..e34ce002 100644 --- a/app/boards/arm/planck/planck_rev6_defconfig +++ b/app/boards/arm/planck/planck_rev6_defconfig @@ -20,9 +20,6 @@ CONFIG_CLOCK_STM32_HSE_CLOCK=8000000 CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y # use HSE as PLL input CONFIG_CLOCK_STM32_PLL_SRC_HSE=y -# however, the board does not have an external oscillator, so just use -# the 8MHz clock signal coming from integrated STLink -CONFIG_CLOCK_STM32_HSE_BYPASS=y # produce 72MHz clock at PLL output CONFIG_CLOCK_STM32_PLL_PREDIV=1 CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9 From ceda57ddfd7b49dd61e8795c37cd678b69a4a76f Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 7 Sep 2020 12:32:25 -0500 Subject: [PATCH 4/4] Fix comment name of keyboard --- app/boards/arm/dz60rgb/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/arm/dz60rgb/Kconfig.defconfig b/app/boards/arm/dz60rgb/Kconfig.defconfig index cfa71d3f..c97a3085 100644 --- a/app/boards/arm/dz60rgb/Kconfig.defconfig +++ b/app/boards/arm/dz60rgb/Kconfig.defconfig @@ -1,4 +1,4 @@ -# Planck keyboard configuration +# DZ60RGB keyboard configuration # Copyright (c) 2020 Nick Winans # SPDX-License-Identifier: MIT