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 committed Mar 13, 2023
1 parent e93dbbd commit b830e63
Show file tree
Hide file tree
Showing 9 changed files with 420 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
23 changes: 19 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,19 @@ 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 I2C
bool
default y

menuconfig SENSOR
bool "Sensor Drivers"

config BQ274XX
bool "BQ274xx Fuel Gauge"
depends on I2C && SENSOR

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
88 changes: 88 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,88 @@
/*
*
* 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";
};
};
};

&i2c0 {
status = "okay";
compatible = "nordic,nrf-twim";
sda-pin = <6>;
scl-pin = <26>;
clock-frequency = <100000>;

fuelgauge: bq27xx@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";
sck-pin = <27>;
mosi-pin = <8>;
miso-pin = <22>;
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>;
};
};
92 changes: 92 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,92 @@
#
# 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 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 TI BQ27421 Fuel Gauge
CONFIG_BQ274XX=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_LVGL_BITS_PER_PIXEL=1
CONFIG_LVGL_COLOR_DEPTH_1=y
CONFIG_LVGL_DPI=145
CONFIG_LVGL_VDB_SIZE=100
CONFIG_LVGL_USE_THEME_MONO=y
CONFIG_LVGL_THEME_DEFAULT_COLOR_PRIMARY_RED=n
CONFIG_LVGL_THEME_DEFAULT_COLOR_SECONDARY_RED=n
CONFIG_LVGL_THEME_DEFAULT_COLOR_PRIMARY_BLACK=y
CONFIG_LVGL_THEME_DEFAULT_COLOR_SECONDARY_WHITE=y
CONFIG_LVGL_THEME_DEFAULT_FONT_SMALL_MONTSERRAT_16=y
CONFIG_LVGL_THEME_DEFAULT_FONT_NORMAL_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

# Turn on USB CDC ACM device
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_CDC_ACM=y
CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024

# Enable serial console
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y

# Enable USB UART
CONFIG_UART_CONSOLE=y
96 changes: 96 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_right.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
*
* 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 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

col-gpios
= <&gpio0 19 GPIO_ACTIVE_HIGH>
, <&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>
;
};

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

&default_transform {
col-offset = <6>;
};

&five_column_transform {
col-offset = <6>;
};

&i2c0 {
status = "ok";
compatible = "nordic,nrf-twim";
sda-pin = <16>;
scl-pin = <13>;
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 2.1
terminate-voltage = <2750>; //Battery Terminate Voltage in mV
int-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
};
};

&spi2 {
status = "okay";
compatible = "nordic,nrf-spim";
sck-pin = <20>;
mosi-pin = <24>;
miso-pin = <27>;
cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;

epd: il0323@0 {
compatible = "gooddisplay,il0323";
reg = <0>;
label = "DISPLAY";
width = <80>;
height = <128>;
spi-max-frequency = <4000000>;
dc-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
busy-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
pwr = [03 00 26 26];
cdi = <0xd2>;
tcon = <0x22>;
};
};
Loading

0 comments on commit b830e63

Please sign in to comment.