Skip to content

Commit

Permalink
feat(boards): Implement altar_i_us and altar_i_uk
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtis-lew committed Nov 28, 2023
1 parent 69f7bfb commit 46e21be
Show file tree
Hide file tree
Showing 23 changed files with 1,015 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,14 @@ config ZMK_KEYMAP_SENSORS_DEFAULT_TRIGGERS_PER_ROTATION
detents per rotation of the encoder.
default 20

config ZMK_EC11_AUTO_OFF_IDLE
bool "Turn off rotary encoders when keyboard goes into idle state"
default n

config ZMK_EC11_AUTO_OFF_SLEEP
bool "Turn off rotary encoders when keyboard goes into sleep state"
default n

endif # ZMK_KEYMAP_SENSORS

choice CBPRINTF_IMPLEMENTATION
Expand Down
6 changes: 6 additions & 0 deletions app/boards/arm/altar_i_uk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

zephyr_library()
zephyr_library_include_directories(${CMAKE_SOURCE_DIR}/include)
zephyr_library_sources(encoder_sleep.c)
6 changes: 6 additions & 0 deletions app/boards/arm/altar_i_uk/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

config BOARD_ALTAR_I_UK
bool "Altar I Keyboard"
depends on SOC_NRF52840_QIAA
28 changes: 28 additions & 0 deletions app/boards/arm/altar_i_uk/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

if BOARD_ALTAR_I_UK

config ZMK_KEYBOARD_NAME
default "Altar I"

if USB

config USB_NRFX
default y

config USB_DEVICE_STACK
default y

endif # USB

config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_ALTAR_I_UK
18 changes: 18 additions & 0 deletions app/boards/arm/altar_i_uk/altar_i_uk-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

&pinctrl {
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 19)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 19)>;
low-power-enable;
};
};
};
172 changes: 172 additions & 0 deletions app/boards/arm/altar_i_uk/altar_i_uk.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>

#include "altar_i_uk-pinctrl.dtsi"

/ {
model = "Altar I UK, Rev 1";
compatible = "altariuk,rev1";

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

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <12>;
map = <
RC(0,0) RC(1,0) RC(0,1) RC(1,1) RC(0,2) RC(1,2) RC(0,3) RC(1,3) RC(0,4) RC(1,4) RC(0,5) RC(1,5) RC(0,6) RC(1,6) RC(7,6)
RC(2,0) RC(3,0) RC(2,1) RC(3,1) RC(2,2) RC(3,2) RC(2,3) RC(3,3) RC(2,4) RC(3,4) RC(2,5) RC(3,5) RC(2,6) RC(3,6) RC(0,7)
RC(4,0) RC(5,0) RC(4,1) RC(5,1) RC(4,2) RC(5,2) RC(4,3) RC(5,3) RC(4,4) RC(5,4) RC(4,5) RC(5,5) RC(4,6) RC(5,6) RC(0,8)
RC(6,0) RC(7,0) RC(6,1) RC(7,1) RC(6,2) RC(7,2) RC(6,3) RC(7,3) RC(6,4) RC(7,4) RC(6,5) RC(7,5) RC(6,6) RC(0,9)
RC(8,0) RC(9,0) RC(8,1) RC(9,1) RC(8,2) RC(9,2) RC(8,3) RC(9,3) RC(8,4) RC(9,4) RC(8,5) RC(9,5) RC(8,6) RC(9,6)
RC(10,0) RC(11,0) RC(10,1) RC(11,1) RC(10,4) RC(11,4) RC(10,5) RC(11,5) RC(10,6) RC(11,6)
>;
};


kscan: kscan_composite {
compatible = "zmk,kscan-composite";
rows = <12>;
columns = <10>;

toggle {
kscan = <&kscan_toggle>;
column-offset = <7>;
};

main {
kscan = <&kscan_main>;
};
};

kscan_toggle: kscan_toggle {
compatible = "zmk,kscan-gpio-direct";
toggle-mode;
input-gpios
= <&gpio1 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpio1 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpio1 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
};

kscan_main: kscan_main {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "row2col";
row-gpios
= <&gpio1 1 GPIO_ACTIVE_HIGH>
, <&gpio1 3 GPIO_ACTIVE_HIGH>
, <&gpio1 4 GPIO_ACTIVE_HIGH>
, <&gpio1 6 GPIO_ACTIVE_HIGH>
, <&gpio0 9 GPIO_ACTIVE_HIGH>
, <&gpio0 10 GPIO_ACTIVE_HIGH>
, <&gpio0 31 GPIO_ACTIVE_HIGH>
, <&gpio0 30 GPIO_ACTIVE_HIGH>
, <&gpio0 29 GPIO_ACTIVE_HIGH>
, <&gpio0 28 GPIO_ACTIVE_HIGH>
, <&gpio0 2 GPIO_ACTIVE_HIGH>
, <&gpio1 15 GPIO_ACTIVE_HIGH>
;
col-gpios
= <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 23 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&left_encoder>;
};

left_encoder: encoder_left {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&gpio1 00 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <2>;
};

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

&adc {
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 {
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>;
};
};
};
114 changes: 114 additions & 0 deletions app/boards/arm/altar_i_uk/altar_i_uk.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2023 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

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

/ {
macros {
tog_bt0: tog_bt0 {
label = "tog_bt0";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
wait-ms = <40>;
tap-ms = <40>;
bindings
= <&out OUT_BLE &bt BT_SEL 0>
;
};
tog_bt1: tog_bt1 {
label = "tog_bt1";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
wait-ms = <40>;
tap-ms = <40>;
bindings
= <&out OUT_BLE &bt BT_SEL 1>
;
};

zoom_in: zoom_in {
label = "zoom_in";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_press &kp LSHIFT &kp LGUI>
, <&macro_tap &kp EQUAL>
, <&macro_release &kp LSHIFT &kp LGUI>
;
};
};
};

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

default_layer {
// -----------------------------------------------------------------------------------------
// | ESC | BRI_DN| BRI_UP| F3 | F4 | F5 | F6 | F7 | F8 | PREV | P/P | NEXT | MUTE | P/P | PAIR |
// | ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BSPC | BT2 |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | ENTER | BT1 |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | NUHS | | USB |
// | SHIFT | NUBS | Z | X | C | V | B | N | M | , | . | / | SHFT | UP |
// | FN1 | CTRL | ALT | WIN | SPACE | WIN | ALT | LFT | DWN | RGT |

bindings = <
&kp ESC &kp C_BRI_DN &kp C_BRI_UP &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp C_PREV &kp C_PLAY_PAUSE &kp C_NEXT &kp K_MUTE &kp C_PLAY_PAUSE &bt BT_CLR
&kp NON_US_BSLH &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &tog_bt1
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp RET &tog_bt0
&kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp NON_US_HASH &out OUT_USB
&kp LSHIFT &kp GRAVE &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHIFT &kp UP
&mo 1 &kp LCTRL &kp LALT &kp LGUI &kp SPACE &kp RGUI &kp RALT &kp LEFT &kp DOWN &kp RIGHT
>;

sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};

fn_layer {
// -----------------------------------------------------------------------------------------
// | | F1 | F2 | | | | | | | F9 | F10 | F11 | F12 | |
// | | | | | | | | | | | | | | |
// | | | | | | | | | | | | | | |
// | | | | | | | | | | | | | | | RESET |
// | | | | | | | | | | | | | | |
// | | FN2 | | | | | | | | |

bindings = <
&trans &kp F1 &kp F2 &trans &trans &trans &trans &trans &trans &kp F9 &kp F10 &kp F11 &kp F12 &trans &sys_reset
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &mo 2 &trans &trans &trans &trans &trans &trans &trans &trans
>;

sensor-bindings = <&inc_dec_kp &zoom_in MINUS>;
};

sys_layer {
// -----------------------------------------------------------------------------------------
// | | | | | | | | | | | | | | |
// | | | | | | | | | | | | | | |
// | | | | | | | | | | | | | | |
// | | | | | | | | | | | | | | | BOOTLOADER |
// | | | | | | | | | | | | | | |
// | | | | | | | | | | |

bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bootloader
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &sys_reset
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &sys_reset
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &sys_reset
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &mo 2 &trans &trans &trans &trans &trans &trans &trans &trans
>;

sensor-bindings =<&inc_dec_kp C_PREV C_NEXT>;
};
};
};
14 changes: 14 additions & 0 deletions app/boards/arm/altar_i_uk/altar_i_uk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
identifier: ALTAR_I_UK
name: ALTAR I - UK
type: keyboard
arch: arm
toolchain:
- zephyr
- gnuarmemb
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog
12 changes: 12 additions & 0 deletions app/boards/arm/altar_i_uk/altar_i_uk.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
file_format: "1"
id: altar_i_uk
name: ALTAR I - UK
type: board
arch: arm
features:
- keys
- encoder
outputs:
- usb
- ble
url: https://electronicmaterialsoffice.com/
Loading

0 comments on commit 46e21be

Please sign in to comment.