Skip to content

Commit

Permalink
feat(boards): Add Corne-ish zen v2
Browse files Browse the repository at this point in the history
Co-authored-by: Pete Johanson <peter@peterjohanson.com>
  • Loading branch information
LOWPROKB and petejohanson committed Dec 16, 2022
1 parent 984b16e commit 4a3e783
Show file tree
Hide file tree
Showing 56 changed files with 2,611 additions and 10 deletions.
60 changes: 60 additions & 0 deletions app/boards/arm/corneish_zen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
if(CONFIG_ZMK_DISPLAY)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_BATTERY_STATUS app PRIVATE widgets/battery_status.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS app PRIVATE widgets/output_status.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_LAYER_STATUS app PRIVATE widgets/layer_status.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS app PRIVATE widgets/peripheral_status.c)

add_subdirectory_ifdef(CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM widgets/icons)
endif()

zephyr_library()

if(CONFIG_ZMK_DISPLAY)
if(CONFIG_CUSTOM_WIDGET_BATTERY_STATUS)
zephyr_library_sources(widgets/icons/batt_100.c)
zephyr_library_sources(widgets/icons/batt_100_chg.c)
zephyr_library_sources(widgets/icons/batt_75.c)
zephyr_library_sources(widgets/icons/batt_75_chg.c)
zephyr_library_sources(widgets/icons/batt_50.c)
zephyr_library_sources(widgets/icons/batt_50_chg.c)
zephyr_library_sources(widgets/icons/batt_25.c)
zephyr_library_sources(widgets/icons/batt_25_chg.c)
zephyr_library_sources(widgets/icons/batt_5.c)
zephyr_library_sources(widgets/icons/batt_5_chg.c)
zephyr_library_sources(widgets/icons/batt_0.c)
zephyr_library_sources(widgets/icons/batt_0_chg.c)
endif()
if(CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS)
zephyr_library_sources(widgets/icons/bluetooth_advertising.c)
zephyr_library_sources(widgets/icons/bluetooth_connected_right.c)
zephyr_library_sources(widgets/icons/bluetooth_disconnected_right.c)
endif()
if(CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS)
zephyr_library_sources(widgets/icons/USB_connected.c)
zephyr_library_sources(widgets/icons/bluetooth_connected_1.c)
zephyr_library_sources(widgets/icons/bluetooth_connected_2.c)
zephyr_library_sources(widgets/icons/bluetooth_connected_3.c)
zephyr_library_sources(widgets/icons/bluetooth_connected_4.c)
zephyr_library_sources(widgets/icons/bluetooth_connected_5.c)
zephyr_library_sources(widgets/icons/bluetooth_advertising_1.c)
zephyr_library_sources(widgets/icons/bluetooth_advertising_2.c)
zephyr_library_sources(widgets/icons/bluetooth_advertising_3.c)
zephyr_library_sources(widgets/icons/bluetooth_advertising_4.c)
zephyr_library_sources(widgets/icons/bluetooth_advertising_5.c)
zephyr_library_sources(widgets/icons/bluetooth_disconnected_right.c)
endif()
if(CONFIG_CUSTOM_WIDGET_LAYER_STATUS)
zephyr_library_sources(widgets/icons/layers.c)
zephyr_library_sources(widgets/icons/layers2.c)
endif()
if(CONFIG_BOARD_CORNEISH_ZEN_V2_RIGHT)
zephyr_library_sources(widgets/icons/zenlogo.c)
endif()
endif()

zephyr_library_include_directories(${ZEPHYR_LVGL_MODULE_DIR})
zephyr_library_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl/)
zephyr_library_sources_ifdef(CONFIG_ZMK_DISPLAY custom_status_screen.c)
zephyr_library_sources(${ZEPHYR_BASE}/misc/empty_file.c)
zephyr_library_include_directories(${CMAKE_SOURCE_DIR}/include)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
12 changes: 12 additions & 0 deletions app/boards/arm/corneish_zen/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2022 Darryl deHaan
# SPDX-License-Identifier: MIT
#

config BOARD_CORNEISH_ZEN_V2_LEFT
bool "corneish zen left v2"
depends on SOC_NRF52840_QIAA

config BOARD_CORNEISH_ZEN_V2_RIGHT
bool "corneish zen right v2"
depends on SOC_NRF52840_QIAA
81 changes: 81 additions & 0 deletions app/boards/arm/corneish_zen/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# Copyright (c) 2022 Darryl deHaan
# SPDX-License-Identifier: MIT
#

if BOARD_CORNEISH_ZEN_V2_LEFT

config ZMK_KEYBOARD_NAME
default "Corne-ish Zen"

config ZMK_SPLIT_ROLE_CENTRAL
default y

endif # BOARD_CORNEISH_ZEN_V2_LEFT


if BOARD_CORNEISH_ZEN_V2_LEFT || BOARD_CORNEISH_ZEN_V2_RIGHT

config BOARD
default "corneish_zen"

config ZMK_SPLIT
default y

config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

if USB

config USB_NRFX
default y

config USB_DEVICE_STACK
default y

endif # USB

config ZMK_DISPLAY
select LVGL_USE_CONT
select LVGL_FONT_MONTSERRAT_26
select LVGL_FONT_MONTSERRAT_20
select LVGL_FONT_MONTSERRAT_16
select LVGL_USE_LABEL
select LVGL_USE_IMG

choice ZMK_DISPLAY_STATUS_SCREEN
default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
endchoice

if ZMK_DISPLAY

config SPI
default y

config IL0323
default y

config ZMK_DISPLAY_BLANK_ON_IDLE
default n

endif # ZMK_DISPLAY

menuconfig CUSTOM_WIDGET_BATTERY_STATUS
bool "custom battery status widget"

menuconfig CUSTOM_WIDGET_OUTPUT_STATUS
bool "custom output status widget"

menuconfig CUSTOM_WIDGET_LAYER_STATUS
bool "custom layer status widget"

menuconfig CUSTOM_WIDGET_PERIPHERAL_STATUS
bool "custom peripheral status widget"

endif # BOARD_CORNEISH_ZEN_V2_LEFT || BOARD_CORNEISH_ZEN_V2_RIGHT
5 changes: 5 additions & 0 deletions app/boards/arm/corneish_zen/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: MIT

board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
126 changes: 126 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
*
* Copyright (c) 2021 Darryl deHaan
* SPDX-License-Identifier: MIT
*
*/

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>

#include <dt-bindings/zmk/matrix_transform.h>

/ {
model = "corneish_zen_v2";
compatible = "corneish_zen_v2";

chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,display = &epd;
zmk,battery = &vbatt;
zephyr,console = &cdc_acm_uart;
};

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <4>;

// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 |
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
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(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(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(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

five_column_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <4>;

// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 |
// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 |
// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 |
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
map = <
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(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(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(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

};


&adc {
status = "okay";
};

&gpiote {
status = "okay";
};

&gpio0 {
status = "okay";
};

&gpio1 {
status = "okay";
};

&usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};

&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

sd_partition: partition@0 {
label = "softdevice";
reg = <0x00000000 0x00026000>;
};
code_partition: partition@26000 {
label = "code_partition";
reg = <0x00026000 0x000c6000>;
};

/*
* The flash starting at 0x000ec000 and ending at
* 0x000f3fff is reserved for use by the application.
*/

/*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@ec000 {
label = "storage";
reg = <0x000ec000 0x00008000>;
};

boot_partition: partition@f4000 {
label = "adafruit_boot";
reg = <0x000f4000 0x0000c000>;
};
};
};
67 changes: 67 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
*
* Copyright (c) 2021 Darryl deHaan
* SPDX-License-Identifier: MIT
*
*/

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>

/ {
chosen {
zmk,matrix_transform = &default_transform;
//zmk,matrix_transform = &five_column_transform;
};
};

/ {
keymap {
compatible = "zmk,keymap";

default_layer {
label = "QWERTY";
// -----------------------------------------------------------------------------------------
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BKSP |
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHFT | Z | X | C | V | B | | N | M | , | . | / | ESC |
// | GUI | LWR | SPC | | ENT | RSE | ALT |
bindings = <
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ESC
&kp LGUI &mo 1 &kp SPACE &kp RET &mo 2 &kp RALT
>;
};
lower_layer {
label = "NUMBER";
// -----------------------------------------------------------------------------------------
// | TAB | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP |
// | BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | | LFT | DWN | UP | RGT | | |
// | SHFT | | | | | | | | | | | | |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp TAB &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans &trans
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};

raise_layer {
label = "SYMBOL";
// -----------------------------------------------------------------------------------------
// | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP |
// | CTRL | | | | | | | - | = | [ | ] | \ | ` |
// | SHFT | | | | | | | _ | + | { | } | "|" | ~ |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp TAB &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp BSPC
&kp LCTRL &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE
&kp LSHFT &trans &trans &trans &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};
};
};
20 changes: 20 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
identifier: corne-ish_zen_v2
name: Corne-ish Zen v2
url: https://lowprokb.ca/collections/keyboards/products/corne-ish-zen
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 40
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog
- gpio
- i2c
- spi
Loading

0 comments on commit 4a3e783

Please sign in to comment.