Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into advantage360
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Nov 13, 2023
2 parents 40d9cf1 + afe65ea commit 21938b7
Show file tree
Hide file tree
Showing 262 changed files with 3,579 additions and 803 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
9 changes: 8 additions & 1 deletion app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ menu "Output Types"

config ZMK_USB
bool "USB"
depends on (!ZMK_SPLIT || (ZMK_SPLIT && ZMK_SPLIT_ROLE_CENTRAL))
select USB
select USB_DEVICE_STACK
select USB_DEVICE_HID

config ZMK_USB_BOOT
bool "USB Boot Protocol Support"
default y
depends on ZMK_USB
select USB_HID_BOOT_PROTOCOL
select USB_DEVICE_SOF

if ZMK_USB

config USB_NUMOF_EP_WRITE_RETRIES
Expand Down Expand Up @@ -575,4 +583,3 @@ osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.shield"


source "Kconfig.zephyr"

3 changes: 0 additions & 3 deletions app/boards/arm/bdn9/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ config BOARD
config ZMK_KEYBOARD_NAME
default "BDN9 Rev2"

config ZMK_USB
default y

config ZMK_RGB_UNDERGLOW
select SPI
select WS2812_STRIP
Expand Down
7 changes: 4 additions & 3 deletions app/boards/arm/bdn9/bdn9_rev2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,31 @@
label = "LEFT_ENCODER";
a-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpioa 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "disabled";
};
mid_encoder: encoder_mid {
compatible = "alps,ec11";
label = "MID_ENCODER";
a-gpios = <&gpioa 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpioa 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "disabled";
};
right_encoder: encoder_right {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
a-gpios = <&gpioa 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpiob 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "disabled";
};

sensors: sensors {
compatible = "zmk,keymap-sensors";
status = "disabled";
sensors = <>;
triggers-per-rotation = <20>;
};
};

Expand Down
1 change: 1 addition & 0 deletions app/boards/arm/bdn9/bdn9_rev2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ CONFIG_HEAP_MEM_POOL_SIZE=1024
# clock configuration
CONFIG_CLOCK_CONTROL=y

CONFIG_ZMK_USB=y
6 changes: 0 additions & 6 deletions app/boards/arm/bluemicro840/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_BLUEMICRO840_V1
3 changes: 3 additions & 0 deletions app/boards/arm/bluemicro840/bluemicro840_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/bt60/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ endif # USB
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

config ZMK_KEYBOARD_NAME
default "BT60"

Expand Down
5 changes: 3 additions & 2 deletions app/boards/arm/bt60/bt60.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
zmk,matrix_transform = &default_transform;
};

sensors {
sensors: sensors {
compatible = "zmk,keymap-sensors";
sensors = <&left_encoder>;
triggers-per-rotation = <20>;
};


Expand All @@ -34,7 +35,7 @@
label = "LEFT_ENCODER";
a-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "okay";
};

Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/bt60/bt60_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/bt60/bt60_v1_hs_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/ckp/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,4 @@ endif # USB
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_BT60_V2 || BOARD_BT65_V1 || BOARD_BT75_V1
3 changes: 3 additions & 0 deletions app/boards/arm/ckp/bt60_v2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ CONFIG_WS2812_STRIP=y
CONFIG_SPI=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/ckp/bt65_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ CONFIG_WS2812_STRIP=y
CONFIG_SPI=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/ckp/bt75_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ CONFIG_WS2812_STRIP=y
CONFIG_SPI=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
9 changes: 5 additions & 4 deletions app/boards/arm/ckp/ckp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
zmk,battery = &vbatt;
};

sensors {
sensors: sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1>;
triggers-per-rotation = <20>;
};

kscan0: kscan_0 {
Expand Down Expand Up @@ -76,7 +77,7 @@
label = "ENCODER_ONE";
a-gpios = <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "okay";
};

Expand All @@ -85,7 +86,7 @@
label = "ENCODER_TWO";
a-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "okay";
};

Expand All @@ -94,7 +95,7 @@
label = "encoder_3";
a-gpios = <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <80>;
status = "okay";
};

Expand Down
6 changes: 0 additions & 6 deletions app/boards/arm/corneish_zen/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ config ZMK_SPLIT
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

if USB

config USB_NRFX
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_right_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v2_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v2_right_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
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
3 changes: 0 additions & 3 deletions app/boards/arm/dz60rgb/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ if BOARD_DZ60RGB_REV1
config ZMK_KEYBOARD_NAME
default "DZ60RGB Rev 1"

config ZMK_USB
default y

endif # BOARD_DZ60RGB_REV1
2 changes: 2 additions & 0 deletions app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=2
CONFIG_CLOCK_STM32_APB2_PRESCALER=1

CONFIG_ZMK_USB=y
Loading

0 comments on commit 21938b7

Please sign in to comment.