refactor: Move to USB_DEVICE_STACK symbol.
See: https://docs.zephyrproject.org/latest/releases/release-notes-2.7.html#changes-in-this-release
This commit is contained in:
parent
3528e1b497
commit
6287819fcc
10 changed files with 24 additions and 39 deletions
|
@ -42,7 +42,7 @@ target_sources(app PRIVATE src/events/sensor_event.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c)
|
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c)
|
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c)
|
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c)
|
||||||
target_sources_ifdef(CONFIG_USB app PRIVATE src/events/usb_conn_state_changed.c)
|
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
|
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
|
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
|
||||||
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
||||||
|
@ -78,7 +78,7 @@ endif()
|
||||||
if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/split/bluetooth/central.c)
|
target_sources(app PRIVATE src/split/bluetooth/central.c)
|
||||||
endif()
|
endif()
|
||||||
target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c)
|
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/usb.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)
|
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
|
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c)
|
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c)
|
||||||
|
|
|
@ -422,7 +422,7 @@ menu "Advanced"
|
||||||
|
|
||||||
menu "Initialization Priorities"
|
menu "Initialization Priorities"
|
||||||
|
|
||||||
if USB
|
if USB_DEVICE_STACK
|
||||||
|
|
||||||
config ZMK_USB_INIT_PRIORITY
|
config ZMK_USB_INIT_PRIORITY
|
||||||
int "USB Init Priority"
|
int "USB Init Priority"
|
||||||
|
@ -526,7 +526,7 @@ config KERNEL_BIN_NAME
|
||||||
config REBOOT
|
config REBOOT
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config USB
|
config USB_DEVICE_STACK
|
||||||
default y if HAS_HW_NRF_USBD
|
default y if HAS_HW_NRF_USBD
|
||||||
|
|
||||||
config ZMK_WPM
|
config ZMK_WPM
|
||||||
|
|
|
@ -8,15 +8,12 @@ if BOARD_BLUEMICRO840_V1
|
||||||
config BOARD
|
config BOARD
|
||||||
default "bluemicro840_v1"
|
default "bluemicro840_v1"
|
||||||
|
|
||||||
if USB
|
if USB_DEVICE_STACK
|
||||||
|
|
||||||
config USB_NRFX
|
config USB_NRFX
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config USB_DEVICE_STACK
|
endif # USB_DEVICE_STACK
|
||||||
default y
|
|
||||||
|
|
||||||
endif # USB
|
|
||||||
|
|
||||||
config BT_CTLR
|
config BT_CTLR
|
||||||
default BT
|
default BT
|
||||||
|
|
|
@ -6,15 +6,12 @@ if BOARD_NICE60
|
||||||
config ZMK_KEYBOARD_NAME
|
config ZMK_KEYBOARD_NAME
|
||||||
default "nice!60"
|
default "nice!60"
|
||||||
|
|
||||||
if USB
|
if USB_DEVICE_STACK
|
||||||
|
|
||||||
config USB_NRFX
|
config USB_NRFX
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config USB_DEVICE_STACK
|
endif # USB_DEVICE_STACK
|
||||||
default y
|
|
||||||
|
|
||||||
endif # USB
|
|
||||||
|
|
||||||
config BT_CTLR
|
config BT_CTLR
|
||||||
default BT
|
default BT
|
||||||
|
|
|
@ -6,15 +6,12 @@ if BOARD_NICE_NANO || BOARD_NICE_NANO_V2
|
||||||
config BOARD
|
config BOARD
|
||||||
default "nice_nano"
|
default "nice_nano"
|
||||||
|
|
||||||
if USB
|
if USB_DEVICE_STACK
|
||||||
|
|
||||||
config USB_NRFX
|
config USB_NRFX
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config USB_DEVICE_STACK
|
endif # USB_DEVICE_STACK
|
||||||
default y
|
|
||||||
|
|
||||||
endif # USB
|
|
||||||
|
|
||||||
config BT_CTLR
|
config BT_CTLR
|
||||||
default BT
|
default BT
|
||||||
|
|
|
@ -6,15 +6,12 @@ if BOARD_NRF52840_M2
|
||||||
config BOARD
|
config BOARD
|
||||||
default "nrf52480_m2"
|
default "nrf52480_m2"
|
||||||
|
|
||||||
if USB
|
if USB_DEVICE_STACK
|
||||||
|
|
||||||
config USB_NRFX
|
config USB_NRFX
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config USB_DEVICE_STACK
|
endif # USB_DEVICE_STACK
|
||||||
default y
|
|
||||||
|
|
||||||
endif # USB
|
|
||||||
|
|
||||||
config BT_CTLR
|
config BT_CTLR
|
||||||
default BT
|
default BT
|
||||||
|
|
|
@ -8,15 +8,12 @@ if BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13
|
||||||
config BOARD
|
config BOARD
|
||||||
default "nrfmicro"
|
default "nrfmicro"
|
||||||
|
|
||||||
if USB
|
if USB_DEVICE_STACK
|
||||||
|
|
||||||
config USB_NRFX
|
config USB_NRFX
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config USB_DEVICE_STACK
|
endif # USB_DEVICE_STACK
|
||||||
default y
|
|
||||||
|
|
||||||
endif # USB
|
|
||||||
|
|
||||||
config BT_CTLR
|
config BT_CTLR
|
||||||
default BT
|
default BT
|
||||||
|
|
|
@ -21,7 +21,7 @@ static sys_slist_t widgets = SYS_SLIST_STATIC_INIT(&widgets);
|
||||||
|
|
||||||
struct battery_status_state {
|
struct battery_status_state {
|
||||||
uint8_t level;
|
uint8_t level;
|
||||||
#if IS_ENABLED(CONFIG_USB)
|
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||||
bool usb_present;
|
bool usb_present;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -31,11 +31,11 @@ static void set_battery_symbol(lv_obj_t *label, struct battery_status_state stat
|
||||||
|
|
||||||
uint8_t level = state.level;
|
uint8_t level = state.level;
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_USB)
|
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||||
if (state.usb_present) {
|
if (state.usb_present) {
|
||||||
strcpy(text, LV_SYMBOL_CHARGE);
|
strcpy(text, LV_SYMBOL_CHARGE);
|
||||||
}
|
}
|
||||||
#endif /* IS_ENABLED(CONFIG_USB) */
|
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
|
||||||
|
|
||||||
if (level > 95) {
|
if (level > 95) {
|
||||||
strcat(text, LV_SYMBOL_BATTERY_FULL);
|
strcat(text, LV_SYMBOL_BATTERY_FULL);
|
||||||
|
@ -59,9 +59,9 @@ void battery_status_update_cb(struct battery_status_state state) {
|
||||||
static struct battery_status_state battery_status_get_state(const zmk_event_t *eh) {
|
static struct battery_status_state battery_status_get_state(const zmk_event_t *eh) {
|
||||||
return (struct battery_status_state) {
|
return (struct battery_status_state) {
|
||||||
.level = bt_bas_get_battery_level(),
|
.level = bt_bas_get_battery_level(),
|
||||||
#if IS_ENABLED(CONFIG_USB)
|
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||||
.usb_present = zmk_usb_is_powered(),
|
.usb_present = zmk_usb_is_powered(),
|
||||||
#endif /* IS_ENABLED(CONFIG_USB) */
|
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ ZMK_DISPLAY_WIDGET_LISTENER(widget_battery_status, struct battery_status_state,
|
||||||
battery_status_update_cb, battery_status_get_state)
|
battery_status_update_cb, battery_status_get_state)
|
||||||
|
|
||||||
ZMK_SUBSCRIPTION(widget_battery_status, zmk_battery_state_changed);
|
ZMK_SUBSCRIPTION(widget_battery_status, zmk_battery_state_changed);
|
||||||
#if IS_ENABLED(CONFIG_USB)
|
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||||
ZMK_SUBSCRIPTION(widget_battery_status, zmk_usb_conn_state_changed);
|
ZMK_SUBSCRIPTION(widget_battery_status, zmk_usb_conn_state_changed);
|
||||||
#endif /* IS_ENABLED(CONFIG_USB) */
|
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
|
||||||
|
|
||||||
int zmk_widget_battery_status_init(struct zmk_widget_battery_status *widget, lv_obj_t *parent) {
|
int zmk_widget_battery_status_init(struct zmk_widget_battery_status *widget, lv_obj_t *parent) {
|
||||||
widget->obj = lv_label_create(parent, NULL);
|
widget->obj = lv_label_create(parent, NULL);
|
||||||
|
|
|
@ -73,7 +73,7 @@ ZMK_DISPLAY_WIDGET_LISTENER(widget_output_status, struct output_status_state,
|
||||||
output_status_update_cb, get_state)
|
output_status_update_cb, get_state)
|
||||||
ZMK_SUBSCRIPTION(widget_output_status, zmk_endpoint_selection_changed);
|
ZMK_SUBSCRIPTION(widget_output_status, zmk_endpoint_selection_changed);
|
||||||
|
|
||||||
#if defined(CONFIG_USB)
|
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||||
ZMK_SUBSCRIPTION(widget_output_status, zmk_usb_conn_state_changed);
|
ZMK_SUBSCRIPTION(widget_output_status, zmk_usb_conn_state_changed);
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_ZMK_BLE)
|
#if defined(CONFIG_ZMK_BLE)
|
||||||
|
|
|
@ -16,11 +16,11 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
#include <zmk/activity.h>
|
#include <zmk/activity.h>
|
||||||
|
|
||||||
bool is_usb_power_present() {
|
bool is_usb_power_present() {
|
||||||
#ifdef CONFIG_USB
|
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
|
||||||
return zmk_usb_is_powered();
|
return zmk_usb_is_powered();
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif /* CONFIG_USB */
|
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pm_state_info pm_policy_next_state(int32_t ticks) {
|
struct pm_state_info pm_policy_next_state(int32_t ticks) {
|
||||||
|
|
Loading…
Reference in a new issue