Skip to content

Commit

Permalink
Restructure project and support dongle mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgroenwoldt committed Feb 16, 2024
1 parent 5ef950e commit b26f0bb
Show file tree
Hide file tree
Showing 16 changed files with 417 additions and 14 deletions.
20 changes: 6 additions & 14 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
# This file generates the GitHub Actions matrix
# For simple board + shield combinations, add them
# to the top level board and shield arrays, for more
# control, add individual board + shield combinations to
# the `include` property, e.g:
#
# board: [ "nice_nano_v2" ]
# shield: [ "corne_left", "corne_right" ]
# include:
# - board: bdn9_rev2
# - board: nice_nano_v2
# shield: reviung41
#
---
include:
- board: nice_nano_v2
shield: corne_left nice_view_adapter nice_view
- board: nice_nano_v2
shield: corne_right nice_view_adapter nice_view
- board: nice_nano_v2
shield: settings_reset

# Add custom dongle and a peripheral left corne
- board: seeeduino_xiao_ble
shield: corne_dongle
- board: nice_nano_v2
shield: corne_peripheral_left nice_view_adapter nice_view
43 changes: 43 additions & 0 deletions config/boards/shields/corne/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
if SHIELD_CORNE_LEFT || SHIELD_CORNE_DONGLE

config ZMK_KEYBOARD_NAME
default "Corne"

config ZMK_SPLIT_ROLE_CENTRAL
default y

endif

if SHIELD_CORNE_LEFT || SHIELD_CORNE_RIGHT || SHIELD_CORNE_DONGLE || SHIELD_CORNE_PERIPHERAL_LEFT

config ZMK_SPLIT
default y

if ZMK_DISPLAY

config I2C
default y

config SSD1306
default y

endif # ZMK_DISPLAY

if LVGL

config LV_Z_VDB_SIZE
default 64

config LV_DPI_DEF
default 148

config LV_Z_BITS_PER_PIXEL
default 1

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice

endif # LVGL

endif
14 changes: 14 additions & 0 deletions config/boards/shields/corne/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2020 Pete Johanson
# SPDX-License-Identifier: MIT

config SHIELD_CORNE_LEFT
def_bool $(shields_list_contains,corne_left)

config SHIELD_CORNE_RIGHT
def_bool $(shields_list_contains,corne_right)

config SHIELD_CORNE_DONGLE
def_bool $(shields_list_contains,corne_dongle)

config SHIELD_CORNE_PERIPHERAL_LEFT
def_bool $(shields_list_contains,corne_peripheral_left)
46 changes: 46 additions & 0 deletions config/boards/shields/corne/boards/nice_nano.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <dt-bindings/led/led.h>

&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
};
};

spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
low-power-enable;
};
};
};

&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";

pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";

led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;

/* WS2812 */
chain-length = <10>; /* arbitrary; change at will */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;

color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
46 changes: 46 additions & 0 deletions config/boards/shields/corne/boards/nice_nano_v2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <dt-bindings/led/led.h>

&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
};
};

spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
low-power-enable;
};
};
};

&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";

pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";

led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;

/* WS2812 */
chain-length = <10>; /* arbitrary; change at will */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;

color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
6 changes: 6 additions & 0 deletions config/boards/shields/corne/corne.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Uncomment the following lines to enable the Corne RGB Underglow
# CONFIG_ZMK_RGB_UNDERGLOW=y
# CONFIG_WS2812_STRIP=y

# Uncomment the following line to enable the Corne OLED Display
# CONFIG_ZMK_DISPLAY=y
82 changes: 82 additions & 0 deletions config/boards/shields/corne/corne.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/

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

/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};

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)
>;
};

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

diode-direction = "col2row";
row-gpios
= <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

};

// TODO: per-key RGB node(s)?
};

&pro_micro_i2c {
status = "okay";

oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};
File renamed without changes.
14 changes: 14 additions & 0 deletions config/boards/shields/corne/corne.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
file_format: "1"
id: corne
name: Corne
type: shield
url: https://github.com/foostan/crkbd/
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
- underglow
siblings:
- corne_left
- corne_right
4 changes: 4 additions & 0 deletions config/boards/shields/corne/corne_dongle.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

# Allow multiple peripherals
CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS=2
80 changes: 80 additions & 0 deletions config/boards/shields/corne/corne_dongle.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/

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

/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};

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)
>;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-direct";

input-gpios
= <&xiao_d 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&xiao_d 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&xiao_d 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&xiao_d 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
};

// TODO: per-key RGB node(s)?
};

&pro_micro_i2c {
status = "okay";

oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};
File renamed without changes.
18 changes: 18 additions & 0 deletions config/boards/shields/corne/corne_left.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/

#include "corne.dtsi"

&kscan0 {
col-gpios
= <&pro_micro 21 GPIO_ACTIVE_HIGH>
, <&pro_micro 20 GPIO_ACTIVE_HIGH>
, <&pro_micro 19 GPIO_ACTIVE_HIGH>
, <&pro_micro 18 GPIO_ACTIVE_HIGH>
, <&pro_micro 15 GPIO_ACTIVE_HIGH>
, <&pro_micro 14 GPIO_ACTIVE_HIGH>
;
};
Loading

0 comments on commit b26f0bb

Please sign in to comment.