Address feedback

This commit is contained in:
Elliot Pahl 2022-05-22 01:09:36 +10:00
parent 98e2146823
commit 996fb12c3e
6 changed files with 126 additions and 98 deletions

View file

@ -1,7 +1,7 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_DUMBPAD
if SHIELD_DUMBPAD || SHIELD_DUMBPAD_OLED_TOP
config ZMK_KEYBOARD_NAME
default "DumbPad"

View file

@ -2,4 +2,7 @@
# SPDX-License-Identifier: MIT
config SHIELD_DUMBPAD
def_bool $(shields_list_contains,dumbpad)
def_bool $(shields_list_contains,dumbpad)
config SHIELD_DUMBPAD_OLED_TOP
def_bool $(shields_list_contains,dumbpad_oled_top)

View file

@ -0,0 +1,102 @@
/*
* Copyright (c) 2022 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
= <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <4>;
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4)
RC(1,1) RC(1,2) RC(1,3) RC(1,4)
RC(2,1) RC(2,2) RC(2,3) RC(2,4)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4)
>;
};
oled_top_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <4>;
map = <
RC(3,0)
RC(3,1) RC(2,1) RC(1,1) RC(0,1)
RC(3,2) RC(2,2) RC(1,2) RC(0,2)
RC(3,3) RC(2,3) RC(1,3) RC(0,3)
RC(3,4) RC(2,4) RC(1,4) RC(0,4)
>;
};
left_encoder: encoder_left {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
};
right_encoder: encoder_right {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
a-gpios = <&pro_micro 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
};
};
&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>;
};
};

View file

@ -4,99 +4,4 @@
* 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
= <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <4>;
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4)
RC(1,1) RC(1,2) RC(1,3) RC(1,4)
RC(2,1) RC(2,2) RC(2,3) RC(2,4)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4)
>;
};
oled_top_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <4>;
map = <
RC(3,0)
RC(3,1) RC(2,1) RC(1,1) RC(0,1)
RC(3,2) RC(2,2) RC(1,2) RC(0,2)
RC(3,3) RC(2,3) RC(1,3) RC(0,3)
RC(3,4) RC(2,4) RC(1,4) RC(0,4)
>;
};
left_encoder: encoder_left {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
};
right_encoder: encoder_right {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
a-gpios = <&pro_micro 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
};
};
&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>;
};
};
#include "dumbpad.dtsi"

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "dumbpad.dtsi"

View file

@ -0,0 +1,11 @@
file_format: "1"
id: dumbpad_oled_top
name: DumbPad oled top
type: shield
url: https://github.com/imchipwood/dumbpad
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
- encoder