Skip to content

Commit

Permalink
feat(boards): Add Corne-ish Zen v1
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar authored and petejohanson committed Apr 26, 2023
1 parent 39d7f86 commit 0239f18
Show file tree
Hide file tree
Showing 9 changed files with 455 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/boards/arm/corneish_zen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if(CONFIG_ZMK_DISPLAY)
zephyr_library_sources(widgets/icons/layers.c)
zephyr_library_sources(widgets/icons/layers2.c)
endif()
if(CONFIG_BOARD_CORNEISH_ZEN_V2_RIGHT)
if(NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
zephyr_library_sources(widgets/icons/zenlogo.c)
endif()
endif()
Expand Down
10 changes: 10 additions & 0 deletions app/boards/arm/corneish_zen/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

config BOARD_CORNEISH_ZEN_LEFT
bool

config BOARD_CORNEISH_ZEN_RIGHT
bool
14 changes: 13 additions & 1 deletion app/boards/arm/corneish_zen/Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@
# SPDX-License-Identifier: MIT
#

config BOARD_CORNEISH_ZEN_V1_LEFT
bool "corneish zen left v1"
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_LEFT

config BOARD_CORNEISH_ZEN_V1_RIGHT
bool "corneish zen right v1"
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_RIGHT

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

config BOARD_CORNEISH_ZEN_V2_RIGHT
bool "corneish zen right v2"
depends on SOC_NRF52840_QIAA
depends on SOC_NRF52840_QIAA
select BOARD_CORNEISH_ZEN_RIGHT
15 changes: 11 additions & 4 deletions app/boards/arm/corneish_zen/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# SPDX-License-Identifier: MIT
#

if BOARD_CORNEISH_ZEN_V2_LEFT
if BOARD_CORNEISH_ZEN_LEFT

config ZMK_KEYBOARD_NAME
default "Corne-ish Zen"

config ZMK_SPLIT_ROLE_CENTRAL
default y

endif # BOARD_CORNEISH_ZEN_V2_LEFT
endif # BOARD_CORNEISH_ZEN_LEFT


if BOARD_CORNEISH_ZEN_V2_LEFT || BOARD_CORNEISH_ZEN_V2_RIGHT
if BOARD_CORNEISH_ZEN_LEFT || BOARD_CORNEISH_ZEN_RIGHT

config BOARD
default "corneish_zen"
Expand Down Expand Up @@ -77,4 +77,11 @@ menuconfig CUSTOM_WIDGET_LAYER_STATUS
menuconfig CUSTOM_WIDGET_PERIPHERAL_STATUS
bool "custom peripheral status widget"

endif # BOARD_CORNEISH_ZEN_V2_LEFT || BOARD_CORNEISH_ZEN_V2_RIGHT
endif # BOARD_CORNEISH_ZEN_LEFT || BOARD_CORNEISH_ZEN_RIGHT

if BOARD_CORNEISH_ZEN_V1_LEFT || BOARD_CORNEISH_ZEN_V1_RIGHT

config BQ274XX
default y

endif # BOARD_CORNEISH_ZEN_V1_LEFT || BOARD_CORNEISH_ZEN_V1_RIGHT
15 changes: 15 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
file_format: "1"
id: corneish_zen_v1
name: Corneish Zen v1
url: https://lowprokb.ca/collections/keyboards/products/corne-ish-zen
type: board
arch: arm
features:
- keys
- display
outputs:
- usb
- ble
siblings:
- corneish_zen_v1_left
- corneish_zen_v1_right
123 changes: 123 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_left.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
*
* Copyright (c) 2021 Darryl deHaan
* SPDX-License-Identifier: MIT
*
*/

#include "corneish_zen.dtsi"

/{
chosen {
zephyr,display = &epd;
zmk,battery = &fuelgauge;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";

diode-direction = "col2row";
row-gpios
= <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 31 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

col-gpios
= <&gpio0 21 GPIO_ACTIVE_HIGH>
, <&gpio0 23 GPIO_ACTIVE_HIGH>
, <&gpio0 12 GPIO_ACTIVE_HIGH>
, <&gpio1 9 GPIO_ACTIVE_HIGH>
, <&gpio0 7 GPIO_ACTIVE_HIGH>
, <&gpio0 5 GPIO_ACTIVE_HIGH>
;
};

leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
};

&pinctrl {
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 8)>,
<NRF_PSEL(SPIM_MISO, 0, 22)>;
};
};

spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 8)>,
<NRF_PSEL(SPIM_MISO, 0, 22)>;
low-power-enable;
};
};

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

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 6)>,
<NRF_PSEL(TWIM_SCL, 0, 26)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
compatible = "nordic,nrf-twim";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
clock-frequency = <100000>;

fuelgauge: bq274xx@55 {
compatible = "ti,bq274xx";
label = "BATTERY";
reg = <0x55>;
design-voltage = <3700>; //Battery Design Volatge in mV
design-capacity = <180>; //Battery Design Capacity in mAh
taper-current = <2>; //Battery Taper current in mAh
terminate-voltage = <2750>; //Battery Terminate Voltage in mV
int-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
};
};

&spi2 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;

epd: il0323@0 {
compatible = "gooddisplay,il0323";
reg = <0>;
label = "DISPLAY";
width = <80>;
height = <128>;
spi-max-frequency = <4000000>;
dc-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
busy-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
pwr = [03 00 26 26];
cdi = <0xd2>;
tcon = <0x22>;
};
};
76 changes: 76 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_left_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# Copyright (c) 2022 Darryl deHaan
# SPDX-License-Identifier: MIT
#

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_CORNEISH_ZEN_V1_LEFT=y
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_DISPLAY=y

# Enable MPU
CONFIG_ARM_MPU=y

# enable pinctrl
CONFIG_PINCTRL=y

# enable GPIO
CONFIG_GPIO=y

# Enable I2C
CONFIG_I2C=y
CONFIG_I2C_NRFX=y

# Enable SPI
CONFIG_SPI_NRFX=y

# Enable writing to flash
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Enable 32kHz crystal
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_LV_Z_BITS_PER_PIXEL=1
CONFIG_LV_COLOR_DEPTH_1=y
CONFIG_LV_DPI_DEF=145
CONFIG_LV_Z_VDB_SIZE=100
CONFIG_LV_USE_THEME_MONO=y
CONFIG_LV_COLOR_CHROMA_KEY_HEX=0x00FF00
CONFIG_ZMK_LV_FONT_DEFAULT_SMALL_MONTSERRAT_16=y
CONFIG_LV_FONT_MONTSERRAT_26=y
CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26=y

# custom status screens
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=n
CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=n
CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_OUTPUT_STATUS=n
CONFIG_CUSTOM_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=n

# Turn on logging, and set ZMK logging to debug output
#CONFIG_LOG=y
#CONFIG_ZMK_USB_LOGGING=y
#CONFIG_ZMK_LOG_LEVEL_DBG=y
#CONFIG_LOG_BUFFER_SIZE=65536
#CONFIG_LOG_STRDUP_BUF_COUNT=160
#CONFIG_I2C_LOG_LEVEL_DBG=y
#CONFIG_SPI_LOG_LEVEL_DBG=y
#CONFIG_DISPLAY_LOG_LEVEL_DBG=y
#CONFIG_LVGL_LOG_LEVEL_DBG=y
#CONFIG_LVGL_USE_DEBUG=y
#CONFIG_SENSOR_LOG_LEVEL_DBG=y
Loading

0 comments on commit 0239f18

Please sign in to comment.