Skip to content

Commit

Permalink
feat: first revision of standalone config
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrommel committed Feb 7, 2024
1 parent 8e24471 commit 82e5b13
Show file tree
Hide file tree
Showing 16 changed files with 400 additions and 7 deletions.
7 changes: 7 additions & 0 deletions boards/arm/nightliner/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: MIT

config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_NIGHTLINER_LEFT || BOARD_NIGHTLINER_RIGHT
12 changes: 12 additions & 0 deletions boards/arm/nightliner/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

config BOARD_NIGHTLINER_LEFT
bool "nightliner_left"
depends on SOC_NRF52840_QIAA

config BOARD_NIGHTLINER_RIGHT
bool "nightliner_right"
depends on SOC_NRF52840_QIAA
45 changes: 45 additions & 0 deletions boards/arm/nightliner/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

if BOARD_NIGHTLINER_LEFT

config ZMK_KEYBOARD_NAME
default "nightliner"

config ZMK_SPLIT_ROLE_CENTRAL
default y

endif # BOARD_NIGHTLINER_LEFT

if BOARD_NIGHTLINER_RIGHT

config ZMK_KEYBOARD_NAME
default "nightliner right"

endif # BOARD_NIGHTLINER_RIGHT


if BOARD_NIGHTLINER_LEFT || BOARD_NIGHTLINER_RIGHT

config BOARD
default "nightliner"

config ZMK_SPLIT
default y

config BT_CTLR
default BT

if USB

config USB_NRFX
default y

config USB_DEVICE_STACK
default y

endif # USB

endif # BOARD_NIGHTLINER_LEFT || BOARD_NIGHTLINER_RIGHT
8 changes: 8 additions & 0 deletions boards/arm/nightliner/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")

include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
7 changes: 7 additions & 0 deletions boards/arm/nightliner/nightliner-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

&pinctrl {
};
110 changes: 110 additions & 0 deletions boards/arm/nightliner/nightliner.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*
*/

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

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

#include "nightliner-pinctrl.dtsi"

/ {
model = "nightliner";
compatible = "miro,nightliner";

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

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


map = <
RC(3,0) 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(3,9)
RC(3,1) 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(3,8)
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(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7)
>;
};

vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
io-channels = <&adc 7>;
output-ohms = <2000000>;
full-ohms = <(806000 + 2000000)>;
};

};

&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";
};
};

&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 {
reg = <0x00000000 0x00026000>;
};
code_partition: partition@26000 {
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 {
reg = <0x000ec000 0x00008000>;
};

boot_partition: partition@f4000 {
reg = <0x000f4000 0x0000c000>;
};
};
};
40 changes: 40 additions & 0 deletions boards/arm/nightliner/nightliner.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>

#define DEFAULT 0
#define NAVI 1
#define MISC 2

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

default_layer {
bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
&mo MISC &kp SPACE &kp SPACE &mo NAVI &kp RETURN &kp SPACE
>;
};

nav_layer {
bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
&kp SPACE &kp SPACE &kp SPACE &none &kp RETURN &kp SPACE
>;
};

misc_layer {
bindings = <
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
&kp SPACE &kp SPACE &kp SPACE &none &kp RETURN &kp SPACE
>;
};
};
};
16 changes: 16 additions & 0 deletions boards/arm/nightliner/nightliner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
identifier: nightliner
name: nightliner
type: keyboard
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- gpio
- counter
- usb_device
- nvs
- can
- kscan
- ble
14 changes: 14 additions & 0 deletions boards/arm/nightliner/nightliner.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
file_format: '1'
id: nightliner
name: nightliner
type: board
url: https://michaelrommel.com/create/2024-02-01_nightliner
arch: arm
features:
- keys
outputs:
- usb
- ble
siblings:
- nightliner_left
- nightliner_right
30 changes: 30 additions & 0 deletions boards/arm/nightliner/nightliner_left.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*
*/

#include "nightliner.dtsi"

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

diode-direction = "col2row";
row-gpios
= <&gpio0 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 5 (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>
;
};
};
38 changes: 38 additions & 0 deletions boards/arm/nightliner/nightliner_left_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_NIGHTLINER_LEFT=y

# Enable MPU
CONFIG_ARM_MPU=y

# enable GPIO
CONFIG_GPIO=y

# Enable writing to flash
CONFIG_USE_DT_CODE_PARTITION=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_150PPM=y

#Misc configuration
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
CONFIG_ZMK_HID_REPORT_TYPE_NKRO=y
CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
# Turn on logging, and set ZMK logging to debug output
#CONFIG_ZMK_USB_LOGGING=y

34 changes: 34 additions & 0 deletions boards/arm/nightliner/nightliner_right.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*
*/

#include "nightliner.dtsi"

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

diode-direction = "col2row";
row-gpios
= <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

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

&default_transform {
col-offset = <5>;
};
Loading

0 comments on commit 82e5b13

Please sign in to comment.