diff --git a/app/boards/shields/pockettype/CMakeLists.txt b/app/boards/shields/pockettype/CMakeLists.txt new file mode 100644 index 00000000..c2ad4258 --- /dev/null +++ b/app/boards/shields/pockettype/CMakeLists.txt @@ -0,0 +1,6 @@ +# +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT +# + +target_sources_ifdef(CONFIG_SHIELD_POCKETTYPE app PRIVATE pockettype_pwr_led.c) diff --git a/app/boards/shields/pockettype/Kconfig.defconfig b/app/boards/shields/pockettype/Kconfig.defconfig new file mode 100644 index 00000000..62013e04 --- /dev/null +++ b/app/boards/shields/pockettype/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_POCKETTYPE + +config ZMK_KEYBOARD_NAME + default "Pockettype" + +endif diff --git a/app/boards/shields/pockettype/Kconfig.shield b/app/boards/shields/pockettype/Kconfig.shield new file mode 100644 index 00000000..51aca213 --- /dev/null +++ b/app/boards/shields/pockettype/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_POCKETTYPE + def_bool $(shields_list_contains,pockettype) diff --git a/app/boards/shields/pockettype/README.md b/app/boards/shields/pockettype/README.md new file mode 100644 index 00000000..274a8455 --- /dev/null +++ b/app/boards/shields/pockettype/README.md @@ -0,0 +1,3 @@ +# PocketType! + +Standard setup for the [PocketType!](https://mechboards.co.uk/shop/kits/pockettype/) mini keyboard. diff --git a/app/boards/shields/pockettype/pockettype.conf b/app/boards/shields/pockettype/pockettype.conf new file mode 100644 index 00000000..e69de29b diff --git a/app/boards/shields/pockettype/pockettype.keymap b/app/boards/shields/pockettype/pockettype.keymap new file mode 100644 index 00000000..2d1ee013 --- /dev/null +++ b/app/boards/shields/pockettype/pockettype.keymap @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp ESCAPE &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 ENTER + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SQT &kp RSHFT + &kp LCTRL &kp LGUI &kp LALT &kp CAPS &mo 1 &kp DEL &kp SPACE &mo 2 &kp LEFT &kp DOWN &kp UP &kp RIGHT + >; + }; + + lower_layer { + bindings = < + &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 EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp SLASH &kp BSLH + &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 + &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp PIPE &kp LBKT &kp RBKT + >; + }; + + raise_layer { + bindings = < + &trans &trans &kp PG_UP &kp UP &kp PG_DN &trans &trans &trans &trans &trans &trans &kp DEL + &trans &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp INSERT + &trans &trans &kp HOME &trans &kp END &trans &trans &trans &trans &bootloader &reset &kp PSCRN + &bt BT_CLR &bt BT_NXT &bt BT_PRV &trans &trans &trans &trans &trans &kp C_PLAY_PAUSE &kp C_VOL_UP &kp C_VOL_DN &kp C_MUTE + >; + }; + }; +}; diff --git a/app/boards/shields/pockettype/pockettype.overlay b/app/boards/shields/pockettype/pockettype.overlay new file mode 100644 index 00000000..a00f9f47 --- /dev/null +++ b/app/boards/shields/pockettype/pockettype.overlay @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + leds { + compatible = "gpio-leds"; + actled: led_a { + gpios = <&pro_micro_a 3 GPIO_ACTIVE_HIGH>; + label = "ACT LED"; + }; + powerled: led_p { + gpios = <&pro_micro_a 2 GPIO_ACTIVE_HIGH>; + label = "PWR LED"; + }; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + + col-gpios + = <&pro_micro_a 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 15 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 16 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 10 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 8 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 7 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 5 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 4 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 3 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 0 GPIO_ACTIVE_HIGH> + ; + + row-gpios + = <&pro_micro_d 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <12>; + rows = <4>; + + 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,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) + >; + }; + + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; +}; diff --git a/app/boards/shields/pockettype/pockettype_pwr_led.c b/app/boards/shields/pockettype/pockettype_pwr_led.c new file mode 100644 index 00000000..c7d0c5ae --- /dev/null +++ b/app/boards/shields/pockettype/pockettype_pwr_led.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * 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);