Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into adv360-z3.2-beta3
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Jan 6, 2024
2 parents 7b5a8fd + 7652fbe commit 1a6c7e8
Show file tree
Hide file tree
Showing 66 changed files with 876 additions and 215 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
/zmk-config
/build
*.DS_Store
__pycache__
__pycache__
.python-version
.venv
3 changes: 1 addition & 2 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ if ZMK_BLE

config ZMK_BLE_EXPERIMENTAL_CONN
bool "Experimental BLE connection changes"
imply BT_GATT_AUTO_SEC_REQ
help
Enables a combination of settings that are planned to be default in future versions of ZMK
to improve connection stability. This includes changes to timing on BLE pairing initation,
Expand Down Expand Up @@ -222,7 +221,7 @@ config BT_GATT_NOTIFY_MULTIPLE
default n

config BT_GATT_AUTO_SEC_REQ
default n
default (ZMK_SPLIT_BLE && !ZMK_SPLIT_ROLE_CENTRAL)

config BT_DEVICE_APPEARANCE
default 961
Expand Down
2 changes: 1 addition & 1 deletion app/boards/arm/corneish_zen/widgets/battery_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void battery_status_update_cb(struct battery_status_state state) {

static struct battery_status_state battery_status_get_state(const zmk_event_t *eh) {
return (struct battery_status_state) {
.level = bt_bas_get_battery_level(),
.level = zmk_battery_state_of_charge(),
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
.usb_present = zmk_usb_is_powered(),
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
Expand Down
21 changes: 20 additions & 1 deletion app/boards/seeeduino_xiao_ble.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,24 @@
};

&qspi {
status = "disabled";
status = "okay";
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";
p25q16h: p25q16h@0 {
compatible = "nordic,qspi-nor";
reg = <0>;
sck-frequency = <104000000>;
quad-enable-requirements = "S2B1v1";
jedec-id = [85 60 15];
sfdp-bfp = [
e5 20 f1 ff ff ff ff 00 44 eb 08 6b 08 3b 80 bb
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
10 d8 08 81
];
size = <16777216>;
has-dpd;
t-enter-dpd = <3000>;
t-exit-dpd = <8000>;
};
};
14 changes: 0 additions & 14 deletions app/boards/shields/Kconfig.defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions app/boards/shields/Kconfig.shield

This file was deleted.

2 changes: 1 addition & 1 deletion app/boards/shields/nice_view/widgets/peripheral_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void battery_status_update_cb(struct battery_status_state state) {

static struct battery_status_state battery_status_get_state(const zmk_event_t *eh) {
return (struct battery_status_state) {
.level = bt_bas_get_battery_level(),
.level = zmk_battery_state_of_charge(),
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
.usb_present = zmk_usb_is_powered(),
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
Expand Down
2 changes: 1 addition & 1 deletion app/boards/shields/nice_view/widgets/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static void battery_status_update_cb(struct battery_status_state state) {

static struct battery_status_state battery_status_get_state(const zmk_event_t *eh) {
return (struct battery_status_state) {
.level = bt_bas_get_battery_level(),
.level = zmk_battery_state_of_charge(),
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
.usb_present = zmk_usb_is_powered(),
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
Expand Down
3 changes: 2 additions & 1 deletion app/include/dt-bindings/zmk/bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define BT_NXT_CMD 1
#define BT_PRV_CMD 2
#define BT_SEL_CMD 3
// #define BT_FULL_RESET_CMD 4
#define BT_CLR_ALL_CMD 4
#define BT_DISC_CMD 5

/*
Expand All @@ -20,4 +20,5 @@ defines these aliases up front.
#define BT_NXT BT_NXT_CMD 0
#define BT_PRV BT_PRV_CMD 0
#define BT_SEL BT_SEL_CMD
#define BT_CLR_ALL BT_CLR_ALL_CMD 0
#define BT_DISC BT_DISC_CMD
2 changes: 1 addition & 1 deletion app/include/zmk/activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

enum zmk_activity_state { ZMK_ACTIVITY_ACTIVE, ZMK_ACTIVITY_IDLE, ZMK_ACTIVITY_SLEEP };

enum zmk_activity_state zmk_activity_get_state();
enum zmk_activity_state zmk_activity_get_state(void);
12 changes: 6 additions & 6 deletions app/include/zmk/backlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ struct backlight_state {
bool on;
};

int zmk_backlight_on();
int zmk_backlight_off();
int zmk_backlight_toggle();
bool zmk_backlight_is_on();
int zmk_backlight_on(void);
int zmk_backlight_off(void);
int zmk_backlight_toggle(void);
bool zmk_backlight_is_on(void);

int zmk_backlight_update_vals(struct backlight_state new_state);
int zmk_backlight_set_brt(uint8_t brightness);
uint8_t zmk_backlight_get_brt();
uint8_t zmk_backlight_get_brt(void);
uint8_t zmk_backlight_calc_brt(int direction);
uint8_t zmk_backlight_calc_brt_cycle();
uint8_t zmk_backlight_calc_brt_cycle(void);
2 changes: 1 addition & 1 deletion app/include/zmk/battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

#pragma once

uint8_t zmk_battery_state_of_charge();
uint8_t zmk_battery_state_of_charge(void);
19 changes: 10 additions & 9 deletions app/include/zmk/ble.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@
#define ZMK_BLE_PROFILE_COUNT CONFIG_BT_MAX_PAIRED
#endif

int zmk_ble_clear_bonds();
int zmk_ble_prof_next();
int zmk_ble_prof_prev();
void zmk_ble_clear_bonds(void);
int zmk_ble_prof_next(void);
int zmk_ble_prof_prev(void);
int zmk_ble_prof_select(uint8_t index);
void zmk_ble_clear_all_bonds(void);
int zmk_ble_prof_disconnect(uint8_t index);

int zmk_ble_active_profile_index();
int zmk_ble_active_profile_index(void);
int zmk_ble_profile_index(const bt_addr_le_t *addr);
bt_addr_le_t *zmk_ble_active_profile_addr();
bool zmk_ble_active_profile_is_open();
bool zmk_ble_active_profile_is_connected();
char *zmk_ble_active_profile_name();
bt_addr_le_t *zmk_ble_active_profile_addr(void);
bool zmk_ble_active_profile_is_open(void);
bool zmk_ble_active_profile_is_connected(void);
char *zmk_ble_active_profile_name(void);

int zmk_ble_unpair_all();
int zmk_ble_unpair_all(void);

#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
int zmk_ble_put_peripheral_addr(const bt_addr_le_t *addr);
Expand Down
6 changes: 3 additions & 3 deletions app/include/zmk/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#pragma once

struct k_work_q *zmk_display_work_q();
struct k_work_q *zmk_display_work_q(void);

bool zmk_display_is_initialized();
int zmk_display_init();
bool zmk_display_is_initialized(void);
int zmk_display_init(void);

/**
* @brief Macro to define a ZMK event listener that handles the thread safety of fetching
Expand Down
10 changes: 9 additions & 1 deletion app/include/zmk/events/battery_state_changed.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ struct zmk_battery_state_changed {
uint8_t state_of_charge;
};

ZMK_EVENT_DECLARE(zmk_battery_state_changed);
ZMK_EVENT_DECLARE(zmk_battery_state_changed);

struct zmk_peripheral_battery_state_changed {
uint8_t source;
// TODO: Other battery channels
uint8_t state_of_charge;
};

ZMK_EVENT_DECLARE(zmk_peripheral_battery_state_changed);
16 changes: 8 additions & 8 deletions app/include/zmk/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,26 +252,26 @@ struct zmk_hid_mouse_report {

#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)

zmk_mod_flags_t zmk_hid_get_explicit_mods();
zmk_mod_flags_t zmk_hid_get_explicit_mods(void);
int zmk_hid_register_mod(zmk_mod_t modifier);
int zmk_hid_unregister_mod(zmk_mod_t modifier);
bool zmk_hid_mod_is_pressed(zmk_mod_t modifier);

int zmk_hid_register_mods(zmk_mod_flags_t explicit_modifiers);
int zmk_hid_unregister_mods(zmk_mod_flags_t explicit_modifiers);
int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers);
int zmk_hid_implicit_modifiers_release();
int zmk_hid_implicit_modifiers_release(void);
int zmk_hid_masked_modifiers_set(zmk_mod_flags_t masked_modifiers);
int zmk_hid_masked_modifiers_clear();
int zmk_hid_masked_modifiers_clear(void);

int zmk_hid_keyboard_press(zmk_key_t key);
int zmk_hid_keyboard_release(zmk_key_t key);
void zmk_hid_keyboard_clear();
void zmk_hid_keyboard_clear(void);
bool zmk_hid_keyboard_is_pressed(zmk_key_t key);

int zmk_hid_consumer_press(zmk_key_t key);
int zmk_hid_consumer_release(zmk_key_t key);
void zmk_hid_consumer_clear();
void zmk_hid_consumer_clear(void);
bool zmk_hid_consumer_is_pressed(zmk_key_t key);

int zmk_hid_press(uint32_t usage);
Expand All @@ -283,11 +283,11 @@ int zmk_hid_mouse_button_press(zmk_mouse_button_t button);
int zmk_hid_mouse_button_release(zmk_mouse_button_t button);
int zmk_hid_mouse_buttons_press(zmk_mouse_button_flags_t buttons);
int zmk_hid_mouse_buttons_release(zmk_mouse_button_flags_t buttons);
void zmk_hid_mouse_clear();
void zmk_hid_mouse_clear(void);
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)

struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report();
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report();
struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(void);
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(void);

#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
zmk_hid_boot_report_t *zmk_hid_get_boot_report();
Expand Down
2 changes: 1 addition & 1 deletion app/include/zmk/hog.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <zmk/keys.h>
#include <zmk/hid.h>

int zmk_hog_init();
int zmk_hog_init(const struct device *_arg);

int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body);
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
Expand Down
6 changes: 3 additions & 3 deletions app/include/zmk/keymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

typedef uint32_t zmk_keymap_layers_state_t;

uint8_t zmk_keymap_layer_default();
zmk_keymap_layers_state_t zmk_keymap_layer_state();
uint8_t zmk_keymap_layer_default(void);
zmk_keymap_layers_state_t zmk_keymap_layer_state(void);
bool zmk_keymap_layer_active(uint8_t layer);
uint8_t zmk_keymap_highest_layer_active();
uint8_t zmk_keymap_highest_layer_active(void);
int zmk_keymap_layer_activate(uint8_t layer);
int zmk_keymap_layer_deactivate(uint8_t layer);
int zmk_keymap_layer_toggle(uint8_t layer);
Expand Down
8 changes: 4 additions & 4 deletions app/include/zmk/rgb_underglow.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ struct zmk_periph_led {
zmk_hid_indicators_t indicators;
};

int zmk_rgb_underglow_toggle();
int zmk_rgb_underglow_toggle(void);
int zmk_rgb_underglow_get_state(bool *state);
int zmk_rgb_underglow_on();
int zmk_rgb_underglow_off();
int zmk_rgb_underglow_on(void);
int zmk_rgb_underglow_off(void);
int zmk_rgb_underglow_cycle_effect(int direction);
int zmk_rgb_underglow_calc_effect(int direction);
int zmk_rgb_underglow_select_effect(int effect);
Expand All @@ -38,4 +38,4 @@ int zmk_rgb_underglow_change_hue(int direction);
int zmk_rgb_underglow_change_sat(int direction);
int zmk_rgb_underglow_change_brt(int direction);
int zmk_rgb_underglow_change_spd(int direction);
int zmk_rgb_underglow_set_hsb(struct zmk_led_hsb color);
int zmk_rgb_underglow_set_hsb(struct zmk_led_hsb color);
6 changes: 6 additions & 0 deletions app/include/zmk/split/bluetooth/central.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ int zmk_split_bt_update_led(struct zmk_periph_led *periph);
#if IS_ENABLED(CONFIG_ZMK_BACKLIGHT)
int zmk_split_bt_update_bl(struct backlight_state *periph);
#endif

#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING)

int zmk_split_get_peripheral_battery_level(uint8_t source, uint8_t *level);

#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING)
12 changes: 8 additions & 4 deletions app/include/zmk/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ enum zmk_usb_conn_state {
ZMK_USB_CONN_HID,
};

enum usb_dc_status_code zmk_usb_get_status();
enum zmk_usb_conn_state zmk_usb_get_conn_state();
enum usb_dc_status_code zmk_usb_get_status(void);
enum zmk_usb_conn_state zmk_usb_get_conn_state(void);

static inline bool zmk_usb_is_powered() { return zmk_usb_get_conn_state() != ZMK_USB_CONN_NONE; }
static inline bool zmk_usb_is_hid_ready() { return zmk_usb_get_conn_state() == ZMK_USB_CONN_HID; }
static inline bool zmk_usb_is_powered(void) {
return zmk_usb_get_conn_state() != ZMK_USB_CONN_NONE;
}
static inline bool zmk_usb_is_hid_ready(void) {
return zmk_usb_get_conn_state() == ZMK_USB_CONN_HID;
}
6 changes: 3 additions & 3 deletions app/include/zmk/usb_hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include <stdint.h>

int zmk_usb_hid_send_keyboard_report();
int zmk_usb_hid_send_consumer_report();
int zmk_usb_hid_send_keyboard_report(void);
int zmk_usb_hid_send_consumer_report(void);
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
int zmk_usb_hid_send_mouse_report();
int zmk_usb_hid_send_mouse_report(void);
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
void zmk_usb_hid_set_protocol(uint8_t protocol);
2 changes: 1 addition & 1 deletion app/include/zmk/workqueue.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
struct k_work_q *zmk_workqueue_lowprio_work_q();
struct k_work_q *zmk_workqueue_lowprio_work_q(void);
1 change: 0 additions & 1 deletion app/keymap-module/modules/modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ foreach(root ${BOARD_ROOT})
if(DEFINED SHIELD)
foreach(s ${SHIELD_AS_LIST})
if(NOT ${s} IN_LIST SHIELD_LIST)
message(WARNING "Didn't find ${s}")
continue()
endif()
message(STATUS "Adding ${SHIELD_DIR_${s}}")
Expand Down
8 changes: 8 additions & 0 deletions app/run-ble-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ if [ -z "$BLE_TESTS_NO_CENTRAL_BUILD" ]; then
fi

cp build/tests/ble/private_central/zephyr/zephyr.exe "${BSIM_OUT_PATH}/bin/ble_test_private_central.exe"

if ! [ -e build/tests/ble/no_auto_sec_central ]; then
west build -d build/tests/ble/no_auto_sec_central -b nrf52_bsim tests/ble/central -- -DCONFIG_BT_ATT_RETRY_ON_SEC_ERR=n > /dev/null 2>&1
else
west build -d build/tests/ble/no_auto_sec_central
fi

cp build/tests/ble/no_auto_sec_central/zephyr/zephyr.exe "${BSIM_OUT_PATH}/bin/ble_test_no_auto_sec_central.exe"
fi

testcases=$(find $path -name nrf52_bsim.keymap -exec dirname \{\} \;)
Expand Down
Loading

0 comments on commit 1a6c7e8

Please sign in to comment.