Added support for passkey display and passkey confirmation when pairing. Passkey display is enabled automatically when a display is enabled. Passkey confirm can be manually enabled if the keyboard has an Enter key. Updated the passkey entry code to require all 6 digits have been entered before confirming and to support backspace to remove a digit. Added a pairing screen for displays and refactored the display code to allow for switching between multiple screens. The screens are now initialized immediately instead of on the display work queue, because widgets will read state from other files when they are initialized, and this can only be done safely from the system queue. Blank on idle and theme initialization are pulled out to separate files to simplify the main file. The pairing screen supports all three passkey modes: - Passkey display just shows the passkey. - Passkey confirm shows the passkey and an icon indicating that you must press Enter to confirm. - Passkey entry shows the current passkey entry state and shows an icon indicating that you must press Enter to confirm once all 6 digits have been entered. (If passkey display or confirm are supported, it seems that Windows will always choose those over passkey entry, but the pairing screen still supports this in case other OSes work differently.) Added configs for normal and large font sizes. The large font is used for the passkey on the pairing screen on larger displays. CONFIG_LV_FONT_DEFAULT is no longer used for the normal font size, because setting a default value for it in display/Kconfig prevented display shields from picking a more appropriate default.
39 lines
1.2 KiB
C
39 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <zmk/keys.h>
|
|
#include <zmk/ble/auth.h>
|
|
#include <zmk/ble/profile.h>
|
|
|
|
#define ZMK_BLE_IS_CENTRAL \
|
|
(IS_ENABLED(CONFIG_ZMK_SPLIT) && IS_ENABLED(CONFIG_ZMK_BLE) && \
|
|
IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL))
|
|
|
|
#if ZMK_BLE_IS_CENTRAL
|
|
#define ZMK_BLE_PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS)
|
|
#define ZMK_SPLIT_BLE_PERIPHERAL_COUNT CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS
|
|
#else
|
|
#define ZMK_BLE_PROFILE_COUNT CONFIG_BT_MAX_PAIRED
|
|
#endif
|
|
|
|
int 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);
|
|
|
|
int zmk_ble_active_profile_index(void);
|
|
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);
|
|
|
|
struct zmk_ble_auth_state zmk_ble_get_auth_state(void);
|
|
|
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
|
int zmk_ble_put_peripheral_addr(const bt_addr_le_t *addr);
|
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|