Skip to content

Commit

Permalink
Merge branch 'main' into detect-chg
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Oct 20, 2023
2 parents fd7a080 + 7fe9ecd commit b8a4137
Show file tree
Hide file tree
Showing 177 changed files with 2,946 additions and 572 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/build-user-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,27 @@ jobs:
run: west build -s zmk/app -b "${{ matrix.board }}" -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/${{ inputs.config_path }}" ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}

- name: ${{ env.display_name }} Kconfig file
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort
run: |
if [ -f build/zephyr/.config ]
then
grep -v -e "^#" -e "^$" build/zephyr/.config | sort
else
echo "No Kconfig output"
fi
if: ${{ !cancelled() }}

- name: ${{ env.display_name }} Devicetree file
run: |
if [ -f build/zephyr/zephyr.dts ]
then
cat build/zephyr/zephyr.dts
elif [ -f build/zephyr/zephyr.dts.pre ]
then
cat -s build/zephyr/zephyr.dts.pre
else
echo "No Devicetree output"
fi
if: ${{ !cancelled() }}

- name: Rename artifacts
shell: sh -x {0}
Expand Down
2 changes: 1 addition & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources(app PRIVATE src/behavior_queue.c)
target_sources(app PRIVATE src/conditional_layer.c)
target_sources(app PRIVATE src/endpoints.c)
target_sources(app PRIVATE src/events/endpoint_selection_changed.c)
target_sources(app PRIVATE src/events/endpoint_changed.c)
target_sources(app PRIVATE src/hid_listener.c)
target_sources(app PRIVATE src/keymap.c)
target_sources(app PRIVATE src/events/layer_state_changed.c)
Expand Down
35 changes: 15 additions & 20 deletions app/boards/arm/corneish_zen/widgets/output_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/display.h>
#include "output_status.h"
#include <zmk/event_manager.h>
#include <zmk/events/usb_conn_state_changed.h>
#include <zmk/events/ble_active_profile_changed.h>
#include <zmk/events/endpoint_selection_changed.h>
#include <zmk/events/endpoint_changed.h>
#include <zmk/usb.h>
#include <zmk/ble.h>
#include <zmk/endpoints.h>
Expand All @@ -39,31 +38,29 @@ LV_IMG_DECLARE(USB_connected);
static sys_slist_t widgets = SYS_SLIST_STATIC_INIT(&widgets);

struct output_status_state {
enum zmk_endpoint selected_endpoint;
struct zmk_endpoint_instance selected_endpoint;
bool active_profile_connected;
bool active_profile_bonded;
uint8_t active_profile_index;
};

static struct output_status_state get_state(const zmk_event_t *_eh) {
return (struct output_status_state){.selected_endpoint = zmk_endpoints_selected(),
.active_profile_connected =
zmk_ble_active_profile_is_connected(),
.active_profile_bonded = !zmk_ble_active_profile_is_open(),
.active_profile_index = zmk_ble_active_profile_index()};
;
return (struct output_status_state){
.selected_endpoint = zmk_endpoints_selected(),
.active_profile_connected = zmk_ble_active_profile_is_connected(),
.active_profile_bonded = !zmk_ble_active_profile_is_open(),
};
}

static void set_status_symbol(lv_obj_t *icon, struct output_status_state state) {
switch (state.selected_endpoint) {
case ZMK_ENDPOINT_USB:
switch (state.selected_endpoint.transport) {
case ZMK_TRANSPORT_USB:
lv_img_set_src(icon, &USB_connected);
break;
case ZMK_ENDPOINT_BLE:
case ZMK_TRANSPORT_BLE:
if (state.active_profile_bonded) {
if (state.active_profile_connected) {
// sprintf(text, LV_SYMBOL_BLUETOOTH "%i " LV_SYMBOL_OK, active_profile_index);
switch (state.active_profile_index) {
switch (state.selected_endpoint.ble.profile_index) {
case 0:
lv_img_set_src(icon, &bluetooth_connected_1);
break;
Expand All @@ -84,7 +81,7 @@ static void set_status_symbol(lv_obj_t *icon, struct output_status_state state)
lv_img_set_src(icon, &bluetooth_disconnected_right);
}
} else {
switch (state.active_profile_index) {
switch (state.selected_endpoint.ble.profile_index) {
case 0:
lv_img_set_src(icon, &bluetooth_advertising_1);
break;
Expand Down Expand Up @@ -113,11 +110,9 @@ static void output_status_update_cb(struct output_status_state state) {

ZMK_DISPLAY_WIDGET_LISTENER(widget_output_status, struct output_status_state,
output_status_update_cb, get_state)
ZMK_SUBSCRIPTION(widget_output_status, zmk_endpoint_selection_changed);

#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
ZMK_SUBSCRIPTION(widget_output_status, zmk_usb_conn_state_changed);
#endif
ZMK_SUBSCRIPTION(widget_output_status, zmk_endpoint_changed);
// We don't get an endpoint changed event when the active profile connects/disconnects
// but there wasn't another endpoint to switch from/to, so update on BLE events too.
#if defined(CONFIG_ZMK_BLE)
ZMK_SUBSCRIPTION(widget_output_status, zmk_ble_active_profile_changed);
#endif
Expand Down
2 changes: 1 addition & 1 deletion app/boards/shields/cradio/cradio.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
flavor = "tap-preferred";
tapping-term-ms = <220>;
quick-tap-ms = <150>;
global-quick-tap;
require-prior-idle-ms = <100>;
bindings = <&kp>, <&kp>;
};
};
Expand Down
6 changes: 4 additions & 2 deletions app/boards/shields/leeloo_micro/leeloo_micro.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(3,4) RC(3,5) RC(2,5) RC(2,6) RC(2,7)
label = "LEFT_ENCODER";
a-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
steps = <120>;
status = "disabled";
steps = <60>;
};

right_encoder: right_encoder {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
steps = <120>;
status = "disabled";
steps = <60>;
};

sensors {
Expand Down
4 changes: 2 additions & 2 deletions app/boards/shields/microdox/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_MICRODOX_LEFT
if SHIELD_MICRODOX_LEFT || SHIELD_MICRODOX_V2_LEFT

config ZMK_KEYBOARD_NAME
default "Microdox"
Expand All @@ -11,7 +11,7 @@ config ZMK_SPLIT_ROLE_CENTRAL

endif

if SHIELD_MICRODOX_LEFT || SHIELD_MICRODOX_RIGHT
if SHIELD_MICRODOX_LEFT || SHIELD_MICRODOX_RIGHT || SHIELD_MICRODOX_V2_LEFT || SHIELD_MICRODOX_V2_RIGHT

config ZMK_SPLIT
default y
Expand Down
6 changes: 6 additions & 0 deletions app/boards/shields/microdox/Kconfig.shield
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ config SHIELD_MICRODOX_LEFT

config SHIELD_MICRODOX_RIGHT
def_bool $(shields_list_contains,microdox_right)

config SHIELD_MICRODOX_V2_LEFT
def_bool $(shields_list_contains,microdox_v2_left)

config SHIELD_MICRODOX_V2_RIGHT
def_bool $(shields_list_contains,microdox_v2_right)
8 changes: 8 additions & 0 deletions app/boards/shields/microdox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Microdox

Microdox is a 36 key split keyboard by Boardsource.

Two variants are defined for this shield – V1 and V2. The layout is exactly the same between the
two. Per [help documentation](https://www.boardsource.xyz/help/6129be4a9c85c6050be190d2), if you
purchased your PCB before April 2022, use `microdox_left`/`microdox_right`. Otherwise, use
`microdox_v2_left`/`microdox_v2_right`.
46 changes: 1 addition & 45 deletions app/boards/shields/microdox/microdox.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,18 @@
* SPDX-License-Identifier: MIT
*/

#include <dt-bindings/zmk/matrix_transform.h>
#include "microdox_common.dtsi"

/ {
chosen {
zephyr,display = &oled;
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 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 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>;
com-sequential;
prechargep = <0x22>;
};
};
51 changes: 51 additions & 0 deletions app/boards/shields/microdox/microdox_common.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <dt-bindings/zmk/matrix_transform.h>

/ {
chosen {
zephyr,display = &oled;
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)
>;
};

// 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>;
com-sequential;
prechargep = <0x22>;
};
};
6 changes: 6 additions & 0 deletions app/boards/shields/microdox/microdox_v2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Uncomment the following lines to enable the Microdox RGB Underglow
# CONFIG_ZMK_RGB_UNDERGLOW=y
# CONFIG_WS2812_STRIP=y

# Uncomment the following line to enable the Microdox OLED Display
# CONFIG_ZMK_DISPLAY=y
15 changes: 15 additions & 0 deletions app/boards/shields/microdox/microdox_v2.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "microdox_common.dtsi"

/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
};
};
13 changes: 13 additions & 0 deletions app/boards/shields/microdox/microdox_v2.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
file_format: "1"
id: microdox_v2
name: Microdox V2
type: shield
url: https://boardsource.xyz/store/5f2e7e4a2902de7151494f92
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
siblings:
- microdox_v2_left
- microdox_v2_right
Empty file.
23 changes: 23 additions & 0 deletions app/boards/shields/microdox/microdox_v2_left.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "microdox_v2.dtsi"

&kscan0 {
col-gpios
= <&pro_micro 4 GPIO_ACTIVE_HIGH>
, <&pro_micro 6 GPIO_ACTIVE_HIGH>
, <&pro_micro 14 GPIO_ACTIVE_HIGH>
, <&pro_micro 18 GPIO_ACTIVE_HIGH>
, <&pro_micro 19 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
Empty file.
32 changes: 32 additions & 0 deletions app/boards/shields/microdox/microdox_v2_right.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "microdox.dtsi"

&default_transform {
col-offset = <5>;
};

&oled {
segment-remap;
com-invdir;
};

&kscan0 {
col-gpios
= <&pro_micro 14 GPIO_ACTIVE_HIGH>
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
, <&pro_micro 6 GPIO_ACTIVE_HIGH>
, <&pro_micro 15 GPIO_ACTIVE_HIGH>
, <&pro_micro 21 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
Loading

0 comments on commit b8a4137

Please sign in to comment.