add polilla keyboard

This commit is contained in:
elagil 2022-01-22 20:20:28 +01:00
parent 2666bd622c
commit af1aa43f8f
8 changed files with 363 additions and 0 deletions

View file

@ -0,0 +1,13 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py
-c
-b 0x26000
-f 0xADA52840
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
)

View file

@ -0,0 +1,20 @@
# Polilla wireless board configuration
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_POLILLA_W
bool "Polilla"
depends on SOC_NRF52840_QIAA
config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_POLILLA_W
config BOARD_POLILLA_CHARGER
bool "Enable battery charger"
default y
depends on BOARD_POLILLA_W

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
if BOARD_POLILLA_W
config ZMK_KEYBOARD_NAME
default "Polilla"
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
config BOARD_POLILLA_CHARGER
default y
config ZMK_BATTERY_VOLTAGE_DIVIDER
default y
endif # BOARD_POLILLA_W

View file

@ -0,0 +1,8 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)

View file

@ -0,0 +1,140 @@
/*
* Copyright (c) 2020 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>
/ {
model = "Polilla";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <5>;
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(4,5) RC(4,6) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11)
>;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "row2col";
row-gpios
= <&gpio0 10 GPIO_ACTIVE_HIGH>
, <&gpio1 6 GPIO_ACTIVE_HIGH>
, <&gpio1 4 GPIO_ACTIVE_HIGH>
, <&gpio1 2 GPIO_ACTIVE_HIGH>
, <&gpio0 9 GPIO_ACTIVE_HIGH>
;
col-gpios
= <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 17 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <820000>;
full-ohms = <(2000000 + 820000)>;
};
};
&adc {
status = "okay";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
tx-pin = <19>;
rx-pin = <21>;
rts-pin = <23>;
cts-pin = <25>;
};
&usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};
&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>;
};
};
};

View file

@ -0,0 +1,107 @@
/*
* Copyright (c) 2020 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>
#define LOWER 1
#define UPPER 2
#define BLE 3
#define SYS 4
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
// ,-----------------------------------, ,-----------------------------------,
// | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - |
// | [ | Q | W | E | R | T | | Y | U | I | O | P | ] |
// | TAB | A | S | D | F | G |-----, ,-----| H | J | K | L | ; | ' |
// | SFT | Z | X | C | V | B | ESC | | \ | N | M | , | . | / | SFT |
// '-----------| LA | GUI |LOWER| BSP | CTL | | RA* | RA_ |UPPER| GUI | BLE |-----------'
// '-----------------------------' '-----------------------------'
bindings = <
&kp EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS
&kp LBKT &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp RBKT
&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 LSHFT &kp Z &kp X &kp C &kp V &kp B &kp ESC &kp BSLH &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&kp LALT &kp LGUI &mo LOWER &kp BSPC &kp LCTL &mt RALT RET &kp SPACE &mo UPPER &kp RGUI &to BLE
>;
};
lower_layer {
// ,-----------------------------------, ,-----------------------------------,
// | --- | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
// | --- | --- | --- | --- | --- | --- | | --- | 7 | 8 | 9 | --- | F12 |
// |S-TAB| --- |PRETB| DEL |NXTTB| --- |-----, ,-----| + | 4 | 5 | 6 | * | --- |
// | T | --- | --- | --- | --- | --- | --- | |KPENT| - | 1 | 2 | 3 | / | T |
// '-----------| --- | --- | T | --- | --- | | --- | 0 | --- | --- | NLK |-----------'
// '-----------------------------' '-----------------------------'
bindings = <
&none &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11
&none &none &none &none &none &none &none &kp KP_N7 &kp KP_N8 &kp KP_N9 &none &kp F12
&kp LS(TAB) &none &kp LC(PG_UP) &kp DEL &kp LC(PG_DN) &none &kp KP_PLUS &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_MULTIPLY &none
&trans &none &none &none &none &none &none &kp KP_ENTER &kp KP_MINUS &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_DIVIDE &trans
&none &none &trans &none &none &none &kp KP_N0 &none &none &kp KP_NLCK
>;
};
upper_layer {
// ,-----------------------------------, ,-----------------------------------,
// | --- | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
// | --- | --- | BRID| --- | BRIU| --- | | --- | PREV| UP | NEXT| PGUP| F12 |
// | --- | --- | PREV| PLAY| NEXT| --- |-----, ,-----| HOME| LEFT| DOWN|RIGHT| END | --- |
// | T | --- | VOLD| MUTE| VOLU| --- | T | | T | --- | DELP| INS | DELN| PGDN| T |
// '-----------| T | --- | --- | T | T | | --- | --- | T | --- | --- |-----------'
// '-----------------------------' '-----------------------------'
bindings = <
&none &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11
&none &none &kp C_BRI_DEC &none &kp C_BRI_UP &none &none &kp LC(LEFT) &kp UP &kp LC(RIGHT) &kp PGUP &kp F12
&kp CAPS &none &kp C_PREV &kp C_PP &kp C_NEXT &none &kp HOME &kp LEFT &kp DOWN &kp RIGHT &kp END &none
&trans &none &kp C_VOL_DN &kp C_MUTE &kp C_VOL_UP &none &trans &trans &none &kp LC(BSPC) &kp INS &kp LC(DEL) &kp PGDN &trans
&trans &none &none &trans &trans &none &none &trans &none &none
>;
};
bluetooth_layer {
// ,-----------------------------------, ,-----------------------------------,
// |BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | | --- | --- | --- | --- | --- | --- |
// | --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
// | --- | --- | SYS | --- | --- | --- |-----, ,-----| --- | --- | --- | --- | --- | --- |
// | --- | --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- | --- |
// '-----------| --- | --- | --- | --- | --- | | --- | --- | --- | --- | T |-----------'
// '-----------------------------' '-----------------------------'
bindings = <
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none
&none &none &mo SYS &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &trans
>;
};
system_layer {
// ,-----------------------------------, ,-----------------------------------,
// | --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
// | --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
// | --- | --- | T | --- | --- | --- |-----, ,-----| --- | --- | --- | --- | --- | --- |
// | --- | --- | --- | --- | --- | --- |BOOT | | RST | --- | --- | --- | --- | --- | --- |
// '-----------| --- | --- | --- | --- | --- | | --- | --- | --- | --- | T |-----------'
// '-----------------------------' '-----------------------------'
bindings = <
&none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none
&none &none &trans &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &bootloader &reset &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &trans
>;
};
};
};

View file

@ -0,0 +1,15 @@
identifier: polilla_w
name: Polilla
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View file

@ -0,0 +1,24 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
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
CONFIG_CLOCK_CONTROL_NRF_K32SRC_250PPM=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y