Mubeen Khan
4 years ago
committed by
GitHub
82 changed files with 1387 additions and 152 deletions
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
export LS_OPTIONS='-F --color=auto' |
||||
eval "`dircolors`" |
||||
alias ls='ls $LS_OPTIONS' |
||||
if [ -f "$WORKSPACE_DIR/zephyr/zephyr-env.sh" ]; then |
||||
source "$WORKSPACE_DIR/zephyr/zephyr-env.sh" |
||||
fi |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
FROM zmkfirmware/zephyr-west-action-arm |
||||
|
||||
RUN apt-get -y update && \ |
||||
apt-get -y upgrade && \ |
||||
apt-get install --no-install-recommends -y \ |
||||
ssh \ |
||||
gpg && \ |
||||
rm -rf /var/lib/apt/lists/* |
||||
|
||||
COPY .bashrc tmp |
||||
RUN mv /tmp/.bashrc ~/.bashrc |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
{ |
||||
"name": "ZMK Development", |
||||
"dockerFile": "Dockerfile", |
||||
"extensions": ["ms-vscode.cpptools"], |
||||
"runArgs": ["--security-opt", "label=disable"], |
||||
"containerEnv": {"WORKSPACE_DIR": "${containerWorkspaceFolder}"} |
||||
} |
||||
|
@ -0,0 +1,13 @@
@@ -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 |
||||
) |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
config BOARD_ENABLE_DCDC |
||||
bool "Enable DCDC mode" |
||||
select SOC_DCDC_NRF52X |
||||
default y |
||||
depends on BOARD_NRF52840_M2 |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
# Maker Diary nrf52840 M.2 board configuration |
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
config BOARD_NRF52840_M2 |
||||
bool "nrf52480_m2" |
||||
depends on SOC_NRF52840_QIAA |
||||
|
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
if BOARD_NRF52840_M2 |
||||
|
||||
config BOARD |
||||
default "nrf52480_m2" |
||||
|
||||
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_NRF52840_M2 |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") |
||||
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) |
||||
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) |
@ -0,0 +1,97 @@
@@ -0,0 +1,97 @@
|
||||
/* |
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
/dts-v1/; |
||||
#include <nordic/nrf52840_qiaa.dtsi> |
||||
|
||||
/ { |
||||
model = "Makerdiary nRF52840 M.2 module"; |
||||
compatible = "makerdiary,nrf52840_m2"; |
||||
|
||||
chosen { |
||||
zephyr,code-partition = &code_partition; |
||||
//zephyr,console = &uart0; |
||||
//zephyr,bt-mon-uart = &uart0; |
||||
//zephyr,bt-c2h-uart = &uart0; |
||||
zephyr,sram = &sram0; |
||||
zephyr,flash = &flash0; |
||||
}; |
||||
|
||||
leds { |
||||
compatible = "gpio-leds"; |
||||
red_led: led_0 { |
||||
gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; |
||||
label = "Red LED"; |
||||
}; |
||||
green_led: led_1 { |
||||
gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; |
||||
label = "Green LED"; |
||||
}; |
||||
blue_led: led_2 { |
||||
gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; |
||||
label = "Blue LED"; |
||||
}; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
&gpio0 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&gpio1 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&uart0 { |
||||
compatible = "nordic,nrf-uart"; |
||||
status = "okay"; |
||||
current-speed = <115200>; |
||||
tx-pin = <16>; |
||||
rx-pin = <15>; |
||||
rts-pin = <14>; |
||||
cts-pin = <13>; |
||||
}; |
||||
|
||||
&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>; |
||||
|
||||
boot_partition: partition@0 { |
||||
label = "adafruit_boot"; |
||||
reg = <0x000000000 0x0000C000>; |
||||
}; |
||||
code_partition: partition@26000 { |
||||
label = "code_partition"; |
||||
reg = <0x00026000 0x000d2000>; |
||||
}; |
||||
|
||||
/* |
||||
* The flash starting at 0x000f8000 and ending at |
||||
* 0x000fffff is reserved for use by the application. |
||||
*/ |
||||
|
||||
/* |
||||
* Storage partition will be used by FCB/LittleFS/NVS |
||||
* if enabled. |
||||
*/ |
||||
storage_partition: partition@f8000 { |
||||
label = "storage"; |
||||
reg = <0x000f8000 0x00008000>; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
identifier: nrf52840_m2 |
||||
name: Makerdiary nRF52840 M.2 module |
||||
type: mcu |
||||
arch: arm |
||||
toolchain: |
||||
- zephyr |
||||
- gnuarmemb |
||||
- xtools |
||||
supported: |
||||
- adc |
||||
- usb_device |
||||
- ble |
||||
- ieee802154 |
||||
- pwm |
||||
- watchdog |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
CONFIG_SOC_SERIES_NRF52X=y |
||||
CONFIG_SOC_NRF52840_QIAA=y |
||||
CONFIG_BOARD_NRF52840_M2=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 |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
if SHIELD_M60 |
||||
|
||||
config ZMK_KEYBOARD_NAME |
||||
default "m60" |
||||
|
||||
endif |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
# |
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
config SHIELD_M60 |
||||
def_bool $(shields_list_contains,m60) |
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
/* |
||||
* 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> |
||||
|
||||
/ { |
||||
keymap0: keymap { |
||||
compatible = "zmk,keymap"; |
||||
|
||||
default_layer { |
||||
// ------------------------------------------------------------------------------------------ |
||||
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | |
||||
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | |
||||
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | |
||||
// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | |
||||
// | CTL | WIN | ALT | SPACE | ALT | MO(1) | WIN | CTRL | |
||||
// ------------------------------------------------------------------------------------------ |
||||
bindings = < |
||||
&kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS &kp EQL &kp BKSP |
||||
&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 BSLH |
||||
&kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT &kp RET |
||||
&kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT |
||||
&kp LCTL &kp LGUI &kp LALT &kp SPC &kp RALT &mo 1 &kp RGUI &kp RCTL |
||||
>; |
||||
}; |
||||
|
||||
fn_layer { |
||||
bindings = < |
||||
&kp GRAV &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bootloader |
||||
&trans &bt BT_CLR &none &none &none &none &none &none &none &none &none &none &none &reset |
||||
&trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LARW &kp DARW &kp UARW &kp RARW &none &none &trans |
||||
&trans &none &none &none &none &none &none &none &none &none &none &trans |
||||
&trans &trans &trans &trans &trans &trans &trans &trans |
||||
>; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
/* |
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#include <dt-bindings/zmk/matrix-transform.h> |
||||
|
||||
/ { |
||||
chosen { |
||||
zmk,kscan = &kscan0; |
||||
zmk,matrix_transform = &default_transform; |
||||
}; |
||||
|
||||
kscan0: kscan { |
||||
compatible = "zmk,kscan-gpio-matrix"; |
||||
label = "KSCAN"; |
||||
|
||||
diode-direction = "col2row"; |
||||
row-gpios |
||||
= <&gpio0 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio1 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&gpio0 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
; |
||||
col-gpios |
||||
= <&gpio0 19 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 20 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 21 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 22 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 23 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 24 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 25 GPIO_ACTIVE_HIGH> |
||||
, <&gpio0 26 GPIO_ACTIVE_HIGH> |
||||
; |
||||
}; |
||||
|
||||
default_transform: keymap_transform_0 { |
||||
compatible = "zmk,matrix-transform"; |
||||
columns = <8>; |
||||
rows = <8>; |
||||
// | MX1 | MX2 | MX3 | MX4 | MX5 | MX6 | MX7 | MX8 | MX9 | MX10 | MX11 | MX12 | MX13 | MX14 | |
||||
// | MX15 | MX16 | MX17 | MX18 | MX19 | MX20 | MX21 | MX22 | MX23 | MX24 | MX25 | MX26 | MX27 | MX28 | |
||||
// | MX29 | MX30 | MX31 | MX32 | MX33 | MX34 | MX35 | MX36 | MX37 | MX38 | MX39 | MX40 | MX41 | |
||||
// | MX42 | MX43 | MX44 | MX45 | MX46 | MX47 | MX48 | MX49 | MX50 | MX51 | MX52 | MX53 | |
||||
// | MX54 | MX55 | MX56 | MX57 | MX58 | MX59 | MX60 | MX61 | |
||||
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(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) |
||||
RC(3,3) RC(3,2) RC(3,1) RC(3,0) RC(2,7) RC(2,6) RC(2,5) RC(2,4) RC(2,3) RC(2,2) RC(2,1) RC(2,0) RC(1,7) RC(1,6) |
||||
RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(5,0) |
||||
RC(6,4) RC(6,3) RC(6,2) RC(6,1) RC(6,0) RC(5,7) RC(5,6) RC(5,5) RC(5,4) RC(5,3) RC(5,2) RC(5,1) |
||||
RC(6,5) RC(6,6) RC(6,7) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) |
||||
>; |
||||
}; |
||||
|
||||
bt_unpair_combo: bt_unpair_combo { |
||||
compatible = "zmk,bt-unpair-combo"; |
||||
key-positions = <0 53>; |
||||
}; |
||||
|
||||
}; |
||||
|
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
# [Makerdiary M60](https://wiki.makerdiary.com/m60) |
||||
|
||||
A 60% ANSI keyboard designed and manufactured by Makerdiary. |
||||
http://makerdiary.com |
||||
|
||||
## Features |
||||
|
||||
- Per key RGB LED. |
||||
- Uses makerdiary M.2 nRF52840 module |
||||
- Matrix wiring |
||||
|
||||
## Hardware Notes |
||||
|
||||
https://wiki.makerdiary.com/m60/developer_guide/hardware/ |
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
|
||||
if SHIELD_MICRODOX_LEFT |
||||
|
||||
config ZMK_KEYBOARD_NAME |
||||
default "Microdox Left" |
||||
|
||||
endif |
||||
|
||||
|
||||
if SHIELD_MICRODOX_RIGHT |
||||
|
||||
config ZMK_KEYBOARD_NAME |
||||
default "Microdox Right" |
||||
|
||||
endif |
||||
|
||||
if SHIELD_MICRODOX_LEFT || SHIELD_MICRODOX_RIGHT |
||||
|
||||
config ZMK_SPLIT |
||||
default y |
||||
|
||||
if ZMK_DISPLAY |
||||
|
||||
config I2C |
||||
default y |
||||
|
||||
config SSD1306 |
||||
default y |
||||
|
||||
config SSD1306_REVERSE_MODE |
||||
default y |
||||
|
||||
endif # ZMK_DISPLAY |
||||
|
||||
if LVGL |
||||
|
||||
config LVGL_HOR_RES |
||||
default 128 |
||||
|
||||
config LVGL_VER_RES |
||||
default 32 |
||||
|
||||
config LVGL_VDB_SIZE |
||||
default 64 |
||||
|
||||
config LVGL_DPI |
||||
default 148 |
||||
|
||||
config LVGL_BITS_PER_PIXEL |
||||
default 1 |
||||
|
||||
choice LVGL_COLOR_DEPTH |
||||
default LVGL_COLOR_DEPTH_1 |
||||
endchoice |
||||
|
||||
endif # LVGL |
||||
|
||||
endif |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2020 The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
|
||||
config SHIELD_MICRODOX_LEFT |
||||
def_bool $(shields_list_contains,microdox_left) |
||||
|
||||
config SHIELD_MICRODOX_RIGHT |
||||
def_bool $(shields_list_contains,microdox_right) |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
/* |
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
&spi1 { |
||||
compatible = "nordic,nrf-spi"; |
||||
/* Cannot be used together with i2c0. */ |
||||
status = "okay"; |
||||
mosi-pin = <6>; |
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. |
||||
sck-pin = <5>; |
||||
miso-pin = <7>; |
||||
|
||||
led_strip: ws2812@0 { |
||||
compatible = "worldsemi,ws2812-spi"; |
||||
label = "SK6812mini"; |
||||
|
||||
/* SPI */ |
||||
reg = <0>; /* ignored, but necessary for SPI bindings */ |
||||
spi-max-frequency = <4000000>; |
||||
|
||||
/* WS2812 */ |
||||
chain-length = <6>; /* There are per-key RGB, but the first 6 are underglow */ |
||||
spi-one-frame = <0x70>; |
||||
spi-zero-frame = <0x40>; |
||||
}; |
||||
}; |
||||
|
||||
/ { |
||||
chosen { |
||||
zmk,underglow = &led_strip; |
||||
}; |
||||
}; |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
# Uncomment the following lines to enable the Corne RGB Underglow |
||||
# ZMK_RGB_UNDERGLOW=y |
||||
# CONFIG_WS2812_STRIP=y |
||||
|
||||
# Uncomment the following line to enable the Corne OLED Display |
||||
# CONFIG_ZMK_DISPLAY=y |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
/* |
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#include <dt-bindings/zmk/matrix-transform.h> |
||||
|
||||
/ { |
||||
chosen { |
||||
zmk,kscan = &kscan0; |
||||
zmk,matrix_transform = &default_transform; |
||||
}; |
||||
|
||||
default_transform: keymap_transform_0 { |
||||
compatible = "zmk,matrix-transform"; |
||||
columns = <10>; |
||||
rows = <4>; |
||||
// | SW1 | SW2 | SW3 | SW4 | SW5 | | SW5 | SW4 | SW3 | SW2 | SW1 | |
||||
// | SW6 | SW7 | SW8 | SW9 | SW10 | | SW10 | SW9 | SW8 | SW7 | SW6 | |
||||
// | SW11 | SW12 | SW13 | SW14 | SW15 | | SW15 | SW14 | SW13 | SW12 | SW11 | |
||||
// | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | |
||||
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(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(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) |
||||
>; |
||||
}; |
||||
|
||||
kscan0: kscan { |
||||
compatible = "zmk,kscan-gpio-matrix"; |
||||
label = "KSCAN"; |
||||
|
||||
diode-direction = "col2row"; |
||||
row-gpios |
||||
= <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
||||
; |
||||
|
||||
}; |
||||
|
||||
// TODO: per-key RGB node(s)? |
||||
}; |
||||
|
||||
&pro_micro_i2c { |
||||
status = "okay"; |
||||
|
||||
oled: ssd1306@3c { |
||||
compatible = "solomon,ssd1306fb"; |
||||
reg = <0x3c>; |
||||
label = "DISPLAY"; |
||||
width = <128>; |
||||
height = <32>; |
||||
segment-offset = <0>; |
||||
page-offset = <0>; |
||||
display-offset = <0>; |
||||
multiplex-ratio = <31>; |
||||
segment-remap; |
||||
com-invdir; |
||||
com-sequential; |
||||
prechargep = <0x22>; |
||||
}; |
||||
}; |
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
/* |
||||
* 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> |
||||
|
||||
/ { |
||||
keymap { |
||||
compatible = "zmk,keymap"; |
||||
|
||||
default_layer { |
||||
// ----------------------------------------------------------------------------------------- |
||||
// | Q | W | E | R | T | | Y | U | I | O | P | |
||||
// | A | S | D | F | G | | H | J | K | L | ; | |
||||
// | Z | X | C | V | B | | N | M | , | . | / | |
||||
// | GUI | NAV | SHFT | | SPC | SYM | ALT | |
||||
bindings = < |
||||
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P |
||||
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN |
||||
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH |
||||
&kp LGUI &mo 1 &kp LSFT &kp SPC &mo 2 &kp RALT |
||||
>; |
||||
}; |
||||
nav_layer { |
||||
// ----------------------------------------------------------------------------------------- |
||||
// |BTCLR| | ESC | ~ | | | TAB | HOME | UP | END | DEL | |
||||
// | BT1 | GUI | ALT | CTRL | NUM | | / | LEFT | DOWN | RGT | BKSP | |
||||
// | BT2 | | | | | | \ | ENT | | | | |
||||
// | | | | | | | | |
||||
bindings = < |
||||
&bt BT_CLR &trans &kp ESC &kp TILD &trans &kp TAB &kp HOME &kp UARW &kp END &kp DEL |
||||
&bt BT_SEL 0 &kp GUI &kp RALT &kp LCTL &mo 3 &kp FSLH &kp LARW &kp DARW &kp RARW &kp BKSP |
||||
&bt BT_SEL 1 &trans &trans &trans &trans &kp BSLH &kp RET &trans &trans &trans |
||||
&trans &trans &trans &trans &trans &trans |
||||
>; |
||||
}; |
||||
|
||||
sym_layer { |
||||
// ----------------------------------------------------------------------------------------- |
||||
// | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
||||
// | | | | | | | - | = | { | } | "|" | |
||||
// | | | | | | | _ | + | [ | ] | \ | |
||||
// | GUI | | SPC | | ENT | | ALT | |
||||
bindings = < |
||||
&kp BANG &kp ATSN &kp HASH &kp CURU &kp PRCT &kp CRRT &kp AMPS &kp KMLT &kp LPRN &kp RPRN |
||||
&trans &trans &trans &trans &trans &kp MINUS &kp EQL &kp LBKT &kp RBKT &kp PIPE |
||||
&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp BSLH |
||||
&kp LGUI &trans &kp SPC &kp RET &trans &kp RALT |
||||
>; |
||||
}; |
||||
|
||||
// This layer is unreachable until "tri layer state" is sorted out. |
||||
// Leaving it here for completeness. |
||||
num_layer { |
||||
// ----------------------------------------------------------------------------------------- |
||||
// | | | | | | | A | 7 | 8 | 9 | D | |
||||
// | | | | | | | B | 4 | 5 | 6 | E | |
||||
// | | | | | | | C | 1 | 2 | 3 | F | |
||||
// | | | | | 0 | . | | |
||||
bindings = < |
||||
&trans &trans &trans &trans &trans &kp A &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp D |
||||
&trans &trans &trans &trans &trans &kp B &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp E |
||||
&trans &trans &trans &trans &trans &kp C &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp F |
||||
&trans &trans &trans &kp NUM_0 &kp DOT &trans |
||||
>; |
||||
}; |
||||
}; |
||||
}; |
||||
|
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
CONFIG_ZMK_SPLIT=y |
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
/* |
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#include "microdox.dtsi" |
||||
|
||||
&kscan0 { |
||||
col-gpios |
||||
= <&pro_micro_a 3 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH> |
||||
; |
||||
}; |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
CONFIG_ZMK_SPLIT=y |
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
/* |
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#include "microdox.dtsi" |
||||
|
||||
&default_transform { |
||||
col-offset = <5>; |
||||
}; |
||||
|
||||
&kscan0 { |
||||
col-gpios |
||||
= <&pro_micro_d 15 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH> |
||||
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH> |
||||
; |
||||
}; |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
# |
||||
# Copyright (c) 2020, The ZMK Contributors |
||||
# SPDX-License-Identifier: MIT |
||||
# |
||||
|
||||
description: | |
||||
Generic driver for controlling the external power output |
||||
by toggling the control-gpio pin status |
||||
(Only in supported hardware) |
||||
|
||||
compatible: "zmk,ext-power-generic" |
||||
|
||||
properties: |
||||
control-gpios: |
||||
type: phandle-array |
||||
required: true |
||||
label: |
||||
type: string |
||||
required: true |
||||
|
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <zephyr/types.h> |
||||
#include <stddef.h> |
||||
#include <device.h> |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/**
|
||||
* @cond INTERNAL_HIDDEN |
||||
* |
||||
* Behavior driver API definition and system call entry points. |
||||
* |
||||
* (Internal use only.) |
||||
*/ |
||||
|
||||
typedef int (*ext_power_enable_t)(struct device *dev); |
||||
typedef int (*ext_power_disable_t)(struct device *dev); |
||||
typedef int (*ext_power_get_t)(struct device *dev); |
||||
|
||||
__subsystem struct ext_power_api { |
||||
ext_power_enable_t enable; |
||||
ext_power_disable_t disable; |
||||
ext_power_get_t get; |
||||
}; |
||||
/**
|
||||
* @endcond |
||||
*/ |
||||
|
||||
/**
|
||||
* @brief Enable the external power output |
||||
* @param dev Pointer to the device structure for the driver instance. |
||||
* |
||||
* @retval 0 If successful. |
||||
* @retval Negative errno code if failure. |
||||
*/ |
||||
__syscall int ext_power_enable(struct device *dev); |
||||
|
||||
static inline int z_impl_ext_power_enable(struct device *dev) { |
||||
const struct ext_power_api *api = (const struct ext_power_api *)dev->driver_api; |
||||
|
||||
if (api->enable == NULL) { |
||||
return -ENOTSUP; |
||||
} |
||||
|
||||
return api->enable(dev); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Disable the external power output |
||||
* @param dev Pointer to the device structure for the driver instance. |
||||
* |
||||
* @retval 0 If successful. |
||||
* @retval Negative errno code if failure. |
||||
*/ |
||||
__syscall int ext_power_disable(struct device *dev); |
||||
|
||||
static inline int z_impl_ext_power_disable(struct device *dev) { |
||||
const struct ext_power_api *api = (const struct ext_power_api *)dev->driver_api; |
||||
|
||||
if (api->disable == NULL) { |
||||
return -ENOTSUP; |
||||
} |
||||
|
||||
return api->disable(dev); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Get the current status of the external power output |
||||
* @param dev Pointer to the device structure for the driver instance. |
||||
* |
||||
* @retval 0 If ext power is disabled. |
||||
* @retval 1 if ext power is enabled. |
||||
* @retval Negative errno code if failure. |
||||
*/ |
||||
__syscall int ext_power_get(struct device *dev); |
||||
|
||||
static inline int z_impl_ext_power_get(struct device *dev) { |
||||
const struct ext_power_api *api = (const struct ext_power_api *)dev->driver_api; |
||||
|
||||
if (api->get == NULL) { |
||||
return -ENOTSUP; |
||||
} |
||||
|
||||
return api->get(dev); |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
/**
|
||||
* @} |
||||
*/ |
||||
|
||||
#include <syscalls/ext_power.h> |
@ -1,3 +1,9 @@
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
int zmk_split_bt_position_pressed(u8_t position); |
||||
|
@ -0,0 +1,91 @@
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#define DT_DRV_COMPAT zmk_ext_power_generic |
||||
|
||||
#include <device.h> |
||||
#include <init.h> |
||||
#include <drivers/gpio.h> |
||||
#include <drivers/ext_power.h> |
||||
|
||||
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) |
||||
|
||||
#include <logging/log.h> |
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); |
||||
|
||||
struct ext_power_generic_config { |
||||
const char *label; |
||||
const u8_t pin; |
||||
const u8_t flags; |
||||
}; |
||||
|
||||
struct ext_power_generic_data { |
||||
struct device *gpio; |
||||
bool status; |
||||
}; |
||||
|
||||
static int ext_power_generic_enable(struct device *dev) { |
||||
struct ext_power_generic_data *data = dev->driver_data; |
||||
const struct ext_power_generic_config *config = dev->config_info; |
||||
|
||||
if (gpio_pin_set(data->gpio, config->pin, 1)) { |
||||
LOG_WRN("Failed to set ext-power control pin"); |
||||
return -EIO; |
||||
} |
||||
data->status = true; |
||||
return 0; |
||||
} |
||||
|
||||
static int ext_power_generic_disable(struct device *dev) { |
||||
struct ext_power_generic_data *data = dev->driver_data; |
||||
const struct ext_power_generic_config *config = dev->config_info; |
||||
|
||||
if (gpio_pin_set(data->gpio, config->pin, 0)) { |
||||
LOG_WRN("Failed to clear ext-power control pin"); |
||||
return -EIO; |
||||
} |
||||
data->status = false; |
||||
return 0; |
||||
} |
||||
|
||||
static int ext_power_generic_get(struct device *dev) { |
||||
struct ext_power_generic_data *data = dev->driver_data; |
||||
return data->status; |
||||
} |
||||
|
||||
static int ext_power_generic_init(struct device *dev) { |
||||
struct ext_power_generic_data *data = dev->driver_data; |
||||
const struct ext_power_generic_config *config = dev->config_info; |
||||
|
||||
data->gpio = device_get_binding(config->label); |
||||
if (data->gpio == NULL) { |
||||
LOG_ERR("Failed to get ext-power control device"); |
||||
return -EINVAL; |
||||
} |
||||
|
||||
if (gpio_pin_configure(data->gpio, config->pin, config->flags | GPIO_OUTPUT)) { |
||||
LOG_ERR("Failed to configure ext-power control pin"); |
||||
return -EIO; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
static const struct ext_power_generic_config config = { |
||||
.label = DT_INST_GPIO_LABEL(0, control_gpios), |
||||
.pin = DT_INST_GPIO_PIN(0, control_gpios), |
||||
.flags = DT_INST_GPIO_FLAGS(0, control_gpios)}; |
||||
|
||||
static struct ext_power_generic_data data = {.status = false}; |
||||
|
||||
static const struct ext_power_api api = {.enable = ext_power_generic_enable, |
||||
.disable = ext_power_generic_disable, |
||||
.get = ext_power_generic_get}; |
||||
|
||||
DEVICE_AND_API_INIT(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init, &data, &config, |
||||
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &api); |
||||
|
||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors |
||||
* |
||||
* SPDX-License-Identifier: MIT |
||||
*/ |
||||
|
||||
#include <zephyr.h> |
||||
#include <kernel.h> |
||||
#include <power/power.h> |
||||
|
||||
#include <logging/log.h> |
||||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); |
||||
|
||||
#include <zmk/usb.h> |
||||
#include <zmk/event-manager.h> |
||||
#include <zmk/events/position-state-changed.h> |
||||
#include <zmk/events/sensor-event.h> |
||||
|
||||
static u32_t power_last_uptime; |
||||
|
||||
#define MAX_IDLE_MS CONFIG_ZMK_IDLE_SLEEP_TIMEOUT |
||||
|
||||
bool is_usb_power_present() { |
||||
#ifdef CONFIG_USB |
||||
enum usb_dc_status_code usb_status = zmk_usb_get_status(); |
||||
switch (usb_status) { |
||||
case USB_DC_DISCONNECTED: |
||||
case USB_DC_UNKNOWN: |
||||
return false; |
||||
default: |
||||
return true; |
||||
} |
||||
#else |
||||
return false; |
||||
#endif /* CONFIG_USB */ |
||||
} |
||||
|
||||
enum power_states sys_pm_policy_next_state(s32_t ticks) { |
||||
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES |
||||
#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 |
||||
s32_t current = k_uptime_get(); |
||||
if (power_last_uptime > 0 && !is_usb_power_present() && |
||||
current - power_last_uptime > MAX_IDLE_MS) { |
||||
return SYS_POWER_STATE_DEEP_SLEEP_1; |
||||
} |
||||
#endif /* CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 */ |
||||
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */ |
||||
|
||||
return SYS_POWER_STATE_ACTIVE; |
||||
} |
||||
|
||||
int power_event_listener(const struct zmk_event_header *eh) { |
||||
power_last_uptime = k_uptime_get(); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int power_init() { |
||||
power_last_uptime = k_uptime_get(); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
ZMK_LISTENER(power, power_event_listener); |
||||
ZMK_SUBSCRIPTION(power, position_state_changed); |
||||
ZMK_SUBSCRIPTION(power, sensor_event); |
||||
|
||||
SYS_INIT(power_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 26 KiB |
Loading…
Reference in new issue