diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27e3468..3c46d96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,10 @@ jobs: shield: corne_5_col_artsey_left - board: nice_nano shield: corne_5_col_artsey_right + - board: bluemicro840_v1 + shield: bluehand_left + - board: bluemicro840_v1 + shield: bluehand_right steps: - name: Checkout uses: actions/checkout@v2 diff --git a/config/boards/shields/bluehand/CMakeLists.txt b/config/boards/shields/bluehand/CMakeLists.txt new file mode 100644 index 0000000..7d8ba32 --- /dev/null +++ b/config/boards/shields/bluehand/CMakeLists.txt @@ -0,0 +1,6 @@ +# +# Copyright (c) 2021 Mike "KemoNine" Crosson +# SPDX-License-Identifier: MIT +# + +target_sources_ifdef(CONFIG_SHIELD_BLUEHAND_LEFT || CONFIG_SHIELD_BLUEHAND_RIGHT app PRIVATE pwr_led.c) diff --git a/config/boards/shields/bluehand/Kconfig.defconfig b/config/boards/shields/bluehand/Kconfig.defconfig new file mode 100644 index 0000000..5c81618 --- /dev/null +++ b/config/boards/shields/bluehand/Kconfig.defconfig @@ -0,0 +1,6 @@ +if SHIELD_BLUEHAND_LEFT || SHIELD_BLUEHAND_RIGHT + +config ZMK_KEYBOARD_NAME + default "BlueHand" + +endif diff --git a/config/boards/shields/bluehand/Kconfig.shield b/config/boards/shields/bluehand/Kconfig.shield new file mode 100755 index 0000000..9f6467a --- /dev/null +++ b/config/boards/shields/bluehand/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2021 Mike "KemoNine" Crosson +# SPDX-License-Identifier: MIT + +config SHIELD_BLUEHAND_LEFT + def_bool $(shields_list_contains,bluehand_left) + +config SHIELD_BLUEHAND_RIGHT + def_bool $(shields_list_contains,bluehand_right) diff --git a/config/boards/shields/bluehand/README.md b/config/boards/shields/bluehand/README.md new file mode 100644 index 0000000..ba9527d --- /dev/null +++ b/config/boards/shields/bluehand/README.md @@ -0,0 +1,3 @@ +# BlueHand + +This directory contains the ARTSEY implementation for `BlueHand` hardware being developed by Pierre Constantineau (jpconstantineau). diff --git a/config/boards/shields/bluehand/bluehand_left.conf b/config/boards/shields/bluehand/bluehand_left.conf new file mode 100755 index 0000000..bc7c98a --- /dev/null +++ b/config/boards/shields/bluehand/bluehand_left.conf @@ -0,0 +1,11 @@ +# Copyright (c) 2021 Mike "KemoNine" Crosson +# SPDX-License-Identifier: MIT + +# Tune combos to allow proper ARTSEY support +CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=16 +CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO=8 +CONFIG_ZMK_COMBO_MAX_PRESSED_COMBOS=8 + +# Turn on deep sleep +CONFIG_ZMK_SLEEP=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 diff --git a/config/boards/shields/bluehand/bluehand_left.keymap b/config/boards/shields/bluehand/bluehand_left.keymap new file mode 100644 index 0000000..6e4a844 --- /dev/null +++ b/config/boards/shields/bluehand/bluehand_left.keymap @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 Mike "KemoNine" Crosson + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include + +// THE BOARD IS FLIPPED FOR LEFT BUT STILL WIRED RIGHT! +#define ARTSEY_LEFT 1 + +// ARTS Row +#define KEY_A 7 +#define KEY_R 6 +#define KEY_T 5 +#define KEY_S 4 +// EYIO Row +#define KEY_E 3 +#define KEY_Y 2 +#define KEY_I 1 +#define KEY_O 0 + +// Define Offsets +#define LEADING_NONES NONE(0, 0, 0) +#define MIDDLE_NONES NONE(0, 0, 0) +#define TRAILING_NONES NONE(0, 0, 0) + +// Include main artsey.io keymap +#include "../../../artsey.dtsi" + +/ { + combos { + compatible = "zmk,combos"; + combo_bt_nxt { key-positions = ; bindings = <&bt BT_NXT>; }; + combo_bt_clr { key-positions = ; bindings = <&bt BT_CLR>; }; + }; +}; \ No newline at end of file diff --git a/config/boards/shields/bluehand/bluehand_left.overlay b/config/boards/shields/bluehand/bluehand_left.overlay new file mode 100644 index 0000000..59025e3 --- /dev/null +++ b/config/boards/shields/bluehand/bluehand_left.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 Mike "KemoNine" Crosson + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + }; + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-direct"; + + label = "KSCAN"; + + input-gpios + = <&gpio0 29 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 28 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 24 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + ; + + }; + + leds { + compatible = "gpio-leds"; + actled: led_a { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "ACT LED"; + }; + powerled: led_p { + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + label = "PWR LED"; + }; + }; +}; diff --git a/config/boards/shields/bluehand/bluehand_right.conf b/config/boards/shields/bluehand/bluehand_right.conf new file mode 100755 index 0000000..bc7c98a --- /dev/null +++ b/config/boards/shields/bluehand/bluehand_right.conf @@ -0,0 +1,11 @@ +# Copyright (c) 2021 Mike "KemoNine" Crosson +# SPDX-License-Identifier: MIT + +# Tune combos to allow proper ARTSEY support +CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=16 +CONFIG_ZMK_COMBO_MAX_KEYS_PER_COMBO=8 +CONFIG_ZMK_COMBO_MAX_PRESSED_COMBOS=8 + +# Turn on deep sleep +CONFIG_ZMK_SLEEP=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 diff --git a/config/boards/shields/bluehand/bluehand_right.keymap b/config/boards/shields/bluehand/bluehand_right.keymap new file mode 100644 index 0000000..267fa97 --- /dev/null +++ b/config/boards/shields/bluehand/bluehand_right.keymap @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 Mike "KemoNine" Crosson + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include + +// THE BOARD IS FLIPPED FOR LEFT BUT STILL WIRED RIGHT! +#define ARTSEY_RIGHT 1 + +// ARTS Row +#define KEY_A 0 +#define KEY_R 1 +#define KEY_T 2 +#define KEY_S 3 +// EYIO Row +#define KEY_E 4 +#define KEY_Y 5 +#define KEY_I 6 +#define KEY_O 7 + +// Define Offsets +#define LEADING_NONES NONE(0, 0, 0) +#define MIDDLE_NONES NONE(0, 0, 0) +#define TRAILING_NONES NONE(0, 0, 0) + +// Include main artsey.io keymap +#include "../../../artsey.dtsi" + +/ { + combos { + compatible = "zmk,combos"; + combo_bt_nxt { key-positions = ; bindings = <&bt BT_NXT>; }; + combo_bt_clr { key-positions = ; bindings = <&bt BT_CLR>; }; + }; +}; \ No newline at end of file diff --git a/config/boards/shields/bluehand/bluehand_right.overlay b/config/boards/shields/bluehand/bluehand_right.overlay new file mode 100644 index 0000000..59025e3 --- /dev/null +++ b/config/boards/shields/bluehand/bluehand_right.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 Mike "KemoNine" Crosson + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + }; + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-direct"; + + label = "KSCAN"; + + input-gpios + = <&gpio0 29 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 28 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 24 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + ; + + }; + + leds { + compatible = "gpio-leds"; + actled: led_a { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "ACT LED"; + }; + powerled: led_p { + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + label = "PWR LED"; + }; + }; +}; diff --git a/config/boards/shields/bluehand/pwr_led.c b/config/boards/shields/bluehand/pwr_led.c new file mode 100644 index 0000000..c44cd0e --- /dev/null +++ b/config/boards/shields/bluehand/pwr_led.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Mike "KemoNine" Crosson + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +#define PWR_LED_NODE DT_ALIAS(powerled) + +#if DT_NODE_HAS_STATUS(PWR_LED_NODE, okay) +#define PWR_LED DT_GPIO_LABEL(PWR_LED_NODE, gpios) +#define PWR_LED_PIN DT_GPIO_PIN(PWR_LED_NODE, gpios) +#else +/* A build error here means your board isn't set up to blink an LED. */ +#error "Unsupported board: pwr_led devicetree alias is not defined" +#define PWR_LED "" +#define PIN 0 +#define FLAGS 0 +#endif + +static int pwr_led_init(const struct device *dev) { + dev = device_get_binding(PWR_LED); + if (dev == NULL) { + return -EIO; + } + + if (gpio_pin_configure(dev, PWR_LED_PIN, GPIO_OUTPUT) < 0) { + return -EIO; + } + + return gpio_pin_set(dev, PIN, (int)true); +} + +SYS_INIT(pwr_led_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);