-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(boards): Add preonic_rev3 board.
- Loading branch information
1 parent
4faf6eb
commit 984b16e
Showing
9 changed files
with
284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
list(APPEND EXTRA_DTC_FLAGS "-qq") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Preonic V3 board configuration | ||
|
||
# Copyright (c) 2022 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
config BOARD_PREONIC_REV3 | ||
bool "Preonic V3 Keyboard" | ||
depends on SOC_STM32F303XC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Preonic keyboard configuration | ||
|
||
# Copyright (c) 2022 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
if BOARD_PREONIC_REV3 | ||
|
||
config ZMK_KEYBOARD_NAME | ||
default "Preonic V3" | ||
|
||
config ZMK_USB | ||
default y | ||
|
||
config ZMK_KSCAN_MATRIX_POLLING | ||
default y | ||
|
||
endif # BOARD_PREONIC_REV3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") | ||
board_runner_args(jlink "--device=STM32F303VC" "--speed=4000") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright (c) 2022 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/dts-v1/; | ||
#include <st/f3/stm32f303Xc.dtsi> | ||
#include <st/f3/stm32f303c(b-c)tx-pinctrl.dtsi> | ||
#include <dt-bindings/zmk/matrix_transform.h> | ||
|
||
|
||
/ { | ||
model = "Preonic PCD, rev3"; | ||
compatible = "preonic,rev3", "st,stm32f303"; | ||
|
||
chosen { | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zmk,kscan = &kscan0; | ||
zmk,matrix_transform = &layout_grid_transform; | ||
}; | ||
|
||
kscan0: kscan_0 { | ||
compatible = "zmk,kscan-gpio-matrix"; | ||
label = "KSCAN"; | ||
diode-direction = "col2row"; | ||
row-gpios | ||
= <&gpioa 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioa 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioa 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpiob 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioc 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioc 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioc 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioa 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioa 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&gpioa 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
; | ||
col-gpios | ||
= <&gpiob 11 GPIO_ACTIVE_HIGH> | ||
, <&gpiob 10 GPIO_ACTIVE_HIGH> | ||
, <&gpiob 2 GPIO_ACTIVE_HIGH> | ||
, <&gpiob 1 GPIO_ACTIVE_HIGH> | ||
, <&gpioa 7 GPIO_ACTIVE_HIGH> | ||
, <&gpiob 0 GPIO_ACTIVE_HIGH> | ||
; | ||
}; | ||
|
||
layout_grid_transform: | ||
keymap_transform_0 { | ||
compatible = "zmk,matrix-transform"; | ||
columns = <6>; | ||
rows = <10>; | ||
map = < | ||
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) | ||
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) | ||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5) | ||
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) RC(7,5) | ||
RC(8,0) RC(8,1) RC(8,2) RC(9,3) RC(9,4) RC(9,5) RC(9,0) RC(9,1) RC(9,2) RC(8,3) RC(8,4) RC(8,5) | ||
>; | ||
}; | ||
|
||
layout_mit_transform: | ||
keymap_transform_1 { | ||
compatible = "zmk,matrix-transform"; | ||
columns = <6>; | ||
rows = <10>; | ||
map = < | ||
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) | ||
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) | ||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5) | ||
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) RC(7,5) | ||
RC(8,0) RC(8,1) RC(8,2) RC(9,3) RC(9,4) RC(9,0) RC(9,1) RC(9,2) RC(8,3) RC(8,4) RC(8,5) | ||
>; | ||
}; | ||
|
||
layout_2x2u_transform: | ||
keymap_transform_2 { | ||
compatible = "zmk,matrix-transform"; | ||
columns = <6>; | ||
rows = <10>; | ||
map = < | ||
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) | ||
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) | ||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5) | ||
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) RC(7,5) | ||
RC(8,0) RC(8,1) RC(8,2) RC(9,3) RC(9,5) RC(9,1) RC(9,2) RC(8,3) RC(8,4) RC(8,5) | ||
>; | ||
}; | ||
}; | ||
|
||
&usb { | ||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; | ||
pinctrl-names = "default"; | ||
status = "okay"; | ||
cdc_acm_uart: cdc_acm_uart { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
label = "CDC_ACM_0"; | ||
}; | ||
}; | ||
|
||
&clk_hse { | ||
status = "okay"; | ||
clock-frequency = <DT_FREQ_M(8)>; | ||
}; | ||
|
||
&pll { | ||
prediv = <1>; | ||
mul = <9>; | ||
clocks = <&clk_hse>; | ||
status = "okay"; | ||
}; | ||
|
||
&rcc { | ||
clocks = <&pll>; | ||
clock-frequency = <DT_FREQ_M(72)>; | ||
ahb-prescaler = <1>; | ||
apb1-prescaler = <2>; | ||
apb2-prescaler = <1>; | ||
}; | ||
|
||
&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>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2022 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <behaviors.dtsi> | ||
#include <dt-bindings/zmk/keys.h> | ||
#include <dt-bindings/zmk/bt.h> | ||
|
||
#define DEFAULT 0 | ||
#define LOWER 1 | ||
#define RAISE 2 | ||
|
||
/ { | ||
chosen { zmk,matrix_transform = &layout_grid_transform; }; | ||
keymap { | ||
compatible = "zmk,keymap"; | ||
default_layer { | ||
// ------------------------------------------------------------------------------------------------- | ||
// | GRAV | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BSPC | | ||
// | TAB | Q | W | E | R | T | Y | U | I | O | P | DEL | | ||
// | ESC | A | S | D | F | G | H | J | K | L | ; | ' | | ||
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | RET | | ||
// | | LGUI | LALT | LCTL | LOWER | SPACE | SPACE | RAISE | LEFT | DOWN | UP | RIGHT | | ||
bindings = < | ||
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC | ||
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp DEL | ||
&kp ESC &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT | ||
&kp LSHIFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH &kp RET | ||
&none &kp LCTRL &kp LALT &kp LGUI &mo LOWER &kp SPACE &kp SPACE &mo RAISE &kp LEFT &kp DOWN &kp UP &kp RIGHT | ||
>; | ||
}; | ||
lower { | ||
// ------------------------------------------------------------------------------------------ | ||
// | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | BSPC | | ||
// | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | DEL | | ||
// | DEL | F1 | F2 | F3 | F4 | F5 | F6 | - | + | [ | ] | | | | ||
// | | F7 | F8 | F9 | F10 | F11 | F12 | | LCTL | HOME | END | | | ||
// | LALT | | | | | | | | NEXT | VOL- | VOL+ | PLAY | | ||
bindings = < | ||
&kp LS(GRAVE) &kp LS(N1) &kp LS(N2) &kp LS(N3) &kp LS(N4) &kp LS(N5) &kp LS(N6) &kp LS(N7) &kp LS(N8) &kp LS(N9) &kp LS(N0) &kp BSPC | ||
&kp LS(GRAVE) &kp LS(N1) &kp LS(N2) &kp LS(N3) &kp LS(N4) &kp LS(N5) &kp LS(N6) &kp LS(N7) &kp LS(N8) &kp LS(N9) &kp LS(N0) &kp DEL | ||
&kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp PLUS &kp LEFT_BRACKET &kp RIGHT_BRACKET &kp PIPE | ||
&none &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &none &kp LCTRL &kp HOME &kp END &none | ||
&kp LALT &none &none &none &trans &none &none &none &kp C_NEXT &kp C_VOL_UP &kp C_VOL_UP &kp C_PLAY | ||
>; | ||
}; | ||
raise { | ||
// ------------------------------------------------------------------------------------------- | ||
// | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BSPC | | ||
// | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | DEL | | ||
// | DEL | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
// | | F7 | F8 | F9 | F10 | F11 | F12 | # | \ | PGUP | PGDN | | | ||
// | | | | | | SHIFT | | | NEXT | VOL- | VOL+ | PLAY | | ||
bindings = < | ||
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC | ||
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp DEL | ||
&kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp KP_EQUAL &kp LEFT_BRACKET &kp RIGHT_BRACKET &kp BSLH | ||
&none &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp HASH &kp BSLH &kp PG_UP &kp PG_DN &none | ||
&none &none &none &none &none &kp LSHIFT &none &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PLAY | ||
>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
identifier: preonic_rev3 | ||
name: PREONICREV3 | ||
type: keyboard | ||
arch: arm | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
ram: 40 | ||
supported: | ||
- gpio | ||
- i2c | ||
- counter | ||
- spi | ||
- usb_device | ||
- lsm303dlhc | ||
- nvs | ||
- can | ||
- kscan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
file_format: "1" | ||
id: preonic_rev3 | ||
name: Preonic Rev3 | ||
type: board | ||
arch: arm | ||
features: | ||
- keys | ||
outputs: | ||
- usb | ||
url: https://olkb.com/collections/preonic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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 pinctrl | ||
CONFIG_PINCTRL=y | ||
|
||
# enable GPIO | ||
CONFIG_GPIO=y | ||
|
||
# clock configuration | ||
CONFIG_CLOCK_CONTROL=y |