Skip to content

Commit

Permalink
Added right defs. Fixed split issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hlord2000 committed Dec 11, 2023
1 parent 57af244 commit e4f8303
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c)
target_sources(app PRIVATE src/behaviors/behavior_to_layer.c)
target_sources(app PRIVATE src/behaviors/behavior_transparent.c)
target_sources(app PRIVATE src/behaviors/behavior_battery_indicator.c)
target_sources(app PRIVATE src/behaviors/behavior_none.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SENSOR_ROTATE app PRIVATE src/behaviors/behavior_sensor_rotate.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_SENSOR_ROTATE_VAR app PRIVATE src/behaviors/behavior_sensor_rotate_var.c)
Expand All @@ -77,6 +76,7 @@ endif()

target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior_rgb_underglow.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/behaviors/behavior_backlight.c)
target_sources_ifdef(CONFIG_ZMK_BATTERY_INDICATOR app PRIVATE src/behaviors/behavior_battery_indicator.c)

target_sources_ifdef(CONFIG_ZMK_BATTERY_REPORTING app PRIVATE src/events/battery_state_changed.c)
target_sources_ifdef(CONFIG_ZMK_BATTERY_REPORTING app PRIVATE src/battery.c)
Expand Down
33 changes: 24 additions & 9 deletions app/boards/arm/angry_miao_hatsu/angry_miao_hatsu.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,35 @@
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/battery_indicator.h>

#define DEFAULT 0
#define FUNCTION 1

/ {
keymap {
compatible = "zmk,keymap";

layer_1 {
label = "base";
label = "default";
bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BACKSLASH
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMICOLON &kp APOSTROPHE
&mo FUNCTION &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp PERIOD &kp SLASH &mo FUNCTION
&kp CAPS &tog FUNCTION &kp LBKT &kp RBKT
&kp LSHIFT &kp SPACE &kp ENTER &kp BACKSPACE
&kp A&kp B &kp C &kp D
&kp E &kp F &kp G &kp H
>;
};

layer_2 {
label = "function";
bindings = <
&kp ESC &bat BAT_IND &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BACKSLASH
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMICOLON &kp APOSTROPHE
&kp A &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp PERIOD &kp SLASH &kp A
&kp A &kp A &kp LBKT &kp RBKT
&kp RSHIFT &kp SPACE &kp ENTER &kp BACKSPACE
&kp LALT &kp LCTRL &kp RCTRL &kp RALT
&bat BAT_IND &kp DEL &bt BT_CLR &out OUT_TOG
&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL
&trans &kp GRAVE &kp PSCRN &kp INS &kp HOME &kp END &kp PG_UP &kp PG_DN &kp K_APP &kp UP &kp RIGHT &trans
&trans &trans &kp LEFT &kp DOWN
&trans &trans &trans &trans
&trans &trans &trans &trans
&trans &trans &trans &trans
>;
};
};
Expand Down
1 change: 1 addition & 0 deletions app/boards/arm/angry_miao_hatsu/angry_miao_hatsu_left.dts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
zmk,battery = &cw2015;
zmk,battery-indicator = &aw2016s;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ CONFIG_ZMK_BACKLIGHT_MAP=y

CONFIG_I2C=y
CONFIG_ZMK_BATTERY=y
CONFIG_ZMK_BATTERY_INDICATOR=y
CONFIG_ZMK_BATTERY_INDICATOR=y
CONFIG_ZMK_BATTERY_INDICATOR_BAR=y
CONFIG_ZMK_BATTERY_INDICATOR_COLOR=0x0000FF
CONFIG_ZMK_BATTERY_INDICATOR_DEFAULT_COLOR=0xC70039
267 changes: 259 additions & 8 deletions app/boards/arm/angry_miao_hatsu/angry_miao_hatsu_right.dts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#include "angry_miao_hatsu.dtsi"

#define RED 00
#define GREEN 01
#define BLUE 02

/{
chosen {
zmk,backlight = &aw2016s;
zmk,backlight-map = &backlight_map;
zmk,battery-indicator-map = &battery_indicator_map;
zmk,battery = &cw2015;
zmk,battery-indicator = &aw2016s;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
Expand All @@ -21,25 +33,94 @@
, <&gpio0 31 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
};

backlight_map: backlight_map {
compatible = "zmk,backlight-map";
led-channels
= <&backlight_led_0>
, <&backlight_led_1>
, <&backlight_led_2>
, <&backlight_led_3>
, <&backlight_led_4>
, <&backlight_led_5>
, <&backlight_led_6>
, <&backlight_led_7>
, <&backlight_led_8>
, <&backlight_led_9>
, <&backlight_led_10>
, <&backlight_led_11>
, <&backlight_led_12>
, <&backlight_led_13>
, <&backlight_led_14>
, <&backlight_led_15>
, <&backlight_led_16>
, <&backlight_led_17>
, <&backlight_led_18>
, <&backlight_led_19>
, <&backlight_led_20>
, <&backlight_led_21>
, <&backlight_led_22>
, <&backlight_led_23>
, <&backlight_led_24>
, <&backlight_led_25>;

};

battery_indicator_map: battery_indicator_map {
compatible = "zmk,backlight-map";
led-channels
= <&rgb_led0_r>
, <&rgb_led0_g>
, <&rgb_led0_b>
, <&rgb_led1_r>
, <&rgb_led1_g>
, <&rgb_led1_b>
, <&rgb_led2_r>
, <&rgb_led2_g>
, <&rgb_led2_b>
, <&rgb_led3_r>
, <&rgb_led3_g>
, <&rgb_led3_b>;
colors = [ RED GREEN BLUE RED GREEN BLUE RED GREEN BLUE RED GREEN BLUE ];
};
};

&layout_grid_transform {
col-offset = < 4 >;
row-offset = < 8 >;
};

&pinctrl {
spi0_default: spi0_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 26)>,
<NRF_PSEL(SPIM_MISO, 0, 29)>;
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>,
<NRF_PSEL(SPIM_MOSI, 0, 24)>,
<NRF_PSEL(SPIM_MISO, 0, 23)>;
};
};

spi0_sleep: spi0_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 26)>,
<NRF_PSEL(SPIM_MISO, 0, 29)>;
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>,
<NRF_PSEL(SPIM_MOSI, 0, 24)>,
<NRF_PSEL(SPIM_MISO, 0, 23)>;
low-power-enable;
};
};
i2c1_default: i2c1_default {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 11)>,
<NRF_PSEL(TWIM_SDA, 0, 12)>;
};
};

i2c1_sleep: i2c1_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 11)>,
<NRF_PSEL(TWIM_SDA, 0, 12)>;
low-power-enable;
};
};
};

&spi0 {
Expand All @@ -49,10 +130,180 @@
pinctrl-1 = <&spi0_sleep>;
pinctrl-names = "default", "sleep";

cs-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
aw20216s@0 {
cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
aw2016s: aw20216s@0 {
compatible = "awinic,aw20216s";
reg = <0>;
en-gpios = <&gpio1 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
spi-max-frequency = <1000000>;

rgb_led0_r: rgb_led0_r {
#led-channel-cells = <0>;
index = <17>;
};
rgb_led0_g: rgb_led0_g {
#led-channel-cells = <0>;
index = <16>;
};
rgb_led0_b: rgb_led0_b {
#led-channel-cells = <0>;
index = <15>;
};
rgb_led1_r: rgb_led1_r {
#led-channel-cells = <0>;
index = <125>;
};
rgb_led1_g: rgb_led1_g {
#led-channel-cells = <0>;
index = <124>;
};
rgb_led1_b: rgb_led1_b {
#led-channel-cells = <0>;
index = <123>;
};
rgb_led2_r: rgb_led2_r {
#led-channel-cells = <0>;
index = <161>;
};
rgb_led2_g: rgb_led2_g {
#led-channel-cells = <0>;
index = <160>;
};
rgb_led2_b: rgb_led2_b {
#led-channel-cells = <0>;
index = <159>;
};
rgb_led3_r: rgb_led3_r {
#led-channel-cells = <0>;
index = <197>;
};
rgb_led3_g: rgb_led3_g {
#led-channel-cells = <0>;
index = <196>;
};
rgb_led3_b: rgb_led3_b {
#led-channel-cells = <0>;
index = <195>;
};

backlight_led_0: backlight_led_0 {
#led-channel-cells = <0>;
index = <36>;
};
backlight_led_1: backlight_led_1 {
#led-channel-cells = <0>;
index = <37>;
};
backlight_led_2: backlight_led_2 {
#led-channel-cells = <0>;
index = <38>;
};
backlight_led_3: backlight_led_3 {
#led-channel-cells = <0>;
index = <39>;
};
backlight_led_4: backlight_led_4 {
#led-channel-cells = <0>;
index = <40>;
};
backlight_led_5: backlight_led_5 {
#led-channel-cells = <0>;
index = <41>;
};
backlight_led_6: backlight_led_6 {
#led-channel-cells = <0>;
index = <42>;
};
backlight_led_7: backlight_led_7 {
#led-channel-cells = <0>;
index = <46>;
};
backlight_led_8: backlight_led_8 {
#led-channel-cells = <0>;
index = <54>;
};
backlight_led_9: backlight_led_9 {
#led-channel-cells = <0>;
index = <55>;
};
backlight_led_10: backlight_led_10 {
#led-channel-cells = <0>;
index = <56>;
};
backlight_led_11: backlight_led_11 {
#led-channel-cells = <0>;
index = <57>;
};
backlight_led_12: backlight_led_12 {
#led-channel-cells = <0>;
index = <58>;
};
backlight_led_13: backlight_led_13 {
#led-channel-cells = <0>;
index = <59>;
};
backlight_led_14: backlight_led_14 {
#led-channel-cells = <0>;
index = <60>;
};
backlight_led_15: backlight_led_15 {
#led-channel-cells = <0>;
index = <64>;
};
backlight_led_16: backlight_led_16 {
#led-channel-cells = <0>;
index = <72>;
};
backlight_led_17: backlight_led_17 {
#led-channel-cells = <0>;
index = <73>;
};
backlight_led_18: backlight_led_18 {
#led-channel-cells = <0>;
index = <74>;
};
backlight_led_19: backlight_led_19 {
#led-channel-cells = <0>;
index = <75>;
};
backlight_led_20: backlight_led_20 {
#led-channel-cells = <0>;
index = <76>;
};
backlight_led_21: backlight_led_21 {
#led-channel-cells = <0>;
index = <77>;
};
backlight_led_22: backlight_led_22 {
#led-channel-cells = <0>;
index = <78>;
};
backlight_led_23: backlight_led_23 {
#led-channel-cells = <0>;
index = <82>;
};
backlight_led_24: backlight_led_24 {
#led-channel-cells = <0>;
index = <92>;
};
backlight_led_25: backlight_led_25 {
#led-channel-cells = <0>;
index = <93>;
};
};
};

&i2c1 {
status = "okay";
compatible = "nordic,nrf-twim";
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";

clock-frequency = <I2C_BITRATE_STANDARD>;

cw2015: cw2015@62 {
compatible = "cellwise,cw2015";
reg = <0x62>;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,11 @@ CONFIG_LOG_BUFFER_SIZE=20000

CONFIG_SPI=y
CONFIG_ZMK_BACKLIGHT=y
CONFIG_ZMK_BACKLIGHT_MAP=y
CONFIG_ZMK_BACKLIGHT_MAP=y

CONFIG_I2C=y
CONFIG_ZMK_BATTERY=y
CONFIG_ZMK_BATTERY_INDICATOR=y
CONFIG_ZMK_BATTERY_INDICATOR_BAR=y
CONFIG_ZMK_BATTERY_INDICATOR_COLOR=0x0000FF
CONFIG_ZMK_BATTERY_INDICATOR_DEFAULT_COLOR=0xC70039

0 comments on commit e4f8303

Please sign in to comment.