Merge 5047340a78
into b74cd39ab5
This commit is contained in:
commit
f5d3f1691e
4 changed files with 28 additions and 1 deletions
|
@ -41,4 +41,5 @@ int zmk_ble_unpair_all(void);
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
int zmk_ble_put_peripheral_addr(const bt_addr_le_t *addr);
|
int zmk_ble_put_peripheral_addr(const bt_addr_le_t *addr);
|
||||||
|
bt_addr_le_t *zmk_ble_get_peripheral_addr(uint8_t index);
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
||||||
|
|
|
@ -22,3 +22,5 @@ int zmk_split_bt_update_hid_indicator(zmk_hid_indicators_t indicators);
|
||||||
int zmk_split_get_peripheral_battery_level(uint8_t source, uint8_t *level);
|
int zmk_split_get_peripheral_battery_level(uint8_t source, uint8_t *level);
|
||||||
|
|
||||||
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING)
|
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING)
|
||||||
|
bool zmk_split_bt_central_peripheral_is_connected(uint8_t index);
|
||||||
|
bool zmk_split_bt_central_peripheral_is_bonded(uint8_t index);
|
||||||
|
|
|
@ -372,6 +372,14 @@ int zmk_ble_put_peripheral_addr(const bt_addr_le_t *addr) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bt_addr_le_t *zmk_ble_get_peripheral_addr(uint8_t index) {
|
||||||
|
if (index < ZMK_SPLIT_BLE_PERIPHERAL_COUNT) {
|
||||||
|
return &peripheral_addrs[index];
|
||||||
|
}
|
||||||
|
// Peripheral index out of range
|
||||||
|
return (bt_addr_le_t *)BT_ADDR_LE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_SETTINGS)
|
#if IS_ENABLED(CONFIG_SETTINGS)
|
||||||
|
|
|
@ -744,6 +744,22 @@ static struct bt_conn_cb conn_callbacks = {
|
||||||
.disconnected = split_central_disconnected,
|
.disconnected = split_central_disconnected,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool zmk_split_bt_central_peripheral_is_connected(uint8_t index) {
|
||||||
|
// If index is out of range always not connected
|
||||||
|
if (index >= ZMK_SPLIT_BLE_PERIPHERAL_COUNT)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return (peripherals[index].state == PERIPHERAL_SLOT_STATE_CONNECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool zmk_split_bt_central_peripheral_is_bonded(uint8_t index) {
|
||||||
|
// If index is out of range always not bonded
|
||||||
|
if (index >= ZMK_SPLIT_BLE_PERIPHERAL_COUNT)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return (bt_addr_le_cmp(zmk_ble_get_peripheral_addr(index), BT_ADDR_LE_ANY) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
K_THREAD_STACK_DEFINE(split_central_split_run_q_stack,
|
K_THREAD_STACK_DEFINE(split_central_split_run_q_stack,
|
||||||
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE);
|
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue