forked from kofal.net/zmk
feat(ble): Support perhipheral battery levels.
* Add ability to fetch and report peripheral battery levels on split centrals. * Add additional support for adding a new Battery Level service to split centrals that exposes fetched peripheral battery levels to connected hosts. Co-authored-by: Peter Johanson <peter@peterjohanson.com>
This commit is contained in:
committed by
Pete Johanson
parent
d35311af97
commit
0e2f94b73b
@@ -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,3 +16,9 @@ int zmk_split_bt_invoke_behavior(uint8_t source, struct zmk_behavior_binding *bi
|
||||
int zmk_split_bt_update_hid_indicator(zmk_hid_indicators_t indicators);
|
||||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS)
|
||||
|
||||
#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)
|
||||
Reference in New Issue
Block a user