diff --git a/app/include/zmk/events/hid_indicators_changed.h b/app/include/zmk/events/hid_indicators_changed.h index 2c3ba088269..b1fba797559 100644 --- a/app/include/zmk/events/hid_indicators_changed.h +++ b/app/include/zmk/events/hid_indicators_changed.h @@ -10,7 +10,7 @@ #include struct zmk_hid_indicators_changed { - zmk_hid_indicators indicators; + zmk_hid_indicators_t indicators; }; ZMK_EVENT_DECLARE(zmk_hid_indicators_changed); diff --git a/app/include/zmk/hid_indicators.h b/app/include/zmk/hid_indicators.h index 69cee13dba2..7c7b89f53ce 100644 --- a/app/include/zmk/hid_indicators.h +++ b/app/include/zmk/hid_indicators.h @@ -10,9 +10,9 @@ #include #include -zmk_hid_indicators zmk_hid_indicators_get_current_profile(void); -zmk_hid_indicators zmk_hid_indicators_get_profile(struct zmk_endpoint_instance endpoint); -void zmk_hid_indicators_set_profile(zmk_hid_indicators indicators, +zmk_hid_indicators_t zmk_hid_indicators_get_current_profile(void); +zmk_hid_indicators_t zmk_hid_indicators_get_profile(struct zmk_endpoint_instance endpoint); +void zmk_hid_indicators_set_profile(zmk_hid_indicators_t indicators, struct zmk_endpoint_instance endpoint); void zmk_hid_indicators_process_report(struct zmk_hid_led_report_body *report, diff --git a/app/include/zmk/hid_indicators_types.h b/app/include/zmk/hid_indicators_types.h index aa1504f6bdb..43bcf3c5bb2 100644 --- a/app/include/zmk/hid_indicators_types.h +++ b/app/include/zmk/hid_indicators_types.h @@ -6,4 +6,4 @@ #pragma once -typedef uint8_t zmk_hid_indicators; +typedef uint8_t zmk_hid_indicators_t; diff --git a/app/include/zmk/split/bluetooth/central.h b/app/include/zmk/split/bluetooth/central.h index d38b51e88cd..4706b3aa831 100644 --- a/app/include/zmk/split/bluetooth/central.h +++ b/app/include/zmk/split/bluetooth/central.h @@ -13,6 +13,6 @@ int zmk_split_bt_invoke_behavior(uint8_t source, struct zmk_behavior_binding *bi #if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) -int zmk_split_bt_update_hid_indicator(zmk_hid_indicators indicators); +int zmk_split_bt_update_hid_indicator(zmk_hid_indicators_t indicators); #endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) diff --git a/app/src/hid_indicators.c b/app/src/hid_indicators.c index 45cac96a04c..50b2fbcc9ba 100644 --- a/app/src/hid_indicators.c +++ b/app/src/hid_indicators.c @@ -16,19 +16,19 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -static zmk_hid_indicators hid_indicators[ZMK_ENDPOINT_COUNT]; +static zmk_hid_indicators_t hid_indicators[ZMK_ENDPOINT_COUNT]; -zmk_hid_indicators zmk_hid_indicators_get_current_profile(void) { +zmk_hid_indicators_t zmk_hid_indicators_get_current_profile(void) { return zmk_hid_indicators_get_profile(zmk_endpoints_selected()); } -zmk_hid_indicators zmk_hid_indicators_get_profile(struct zmk_endpoint_instance endpoint) { - int profile = zmk_endpoint_instance_to_index(endpoint); +zmk_hid_indicators_t zmk_hid_indicators_get_profile(struct zmk_endpoint_instance endpoint) { + const int profile = zmk_endpoint_instance_to_index(endpoint); return hid_indicators[profile]; } static void raise_led_changed_event(struct k_work *_work) { - zmk_hid_indicators indicators = zmk_hid_indicators_get_current_profile(); + const zmk_hid_indicators_t indicators = zmk_hid_indicators_get_current_profile(); ZMK_EVENT_RAISE(new_zmk_hid_indicators_changed( (struct zmk_hid_indicators_changed){.indicators = indicators})); @@ -40,7 +40,7 @@ static void raise_led_changed_event(struct k_work *_work) { static K_WORK_DEFINE(led_changed_work, raise_led_changed_event); -void zmk_hid_indicators_set_profile(zmk_hid_indicators indicators, +void zmk_hid_indicators_set_profile(zmk_hid_indicators_t indicators, struct zmk_endpoint_instance endpoint) { int profile = zmk_endpoint_instance_to_index(endpoint); @@ -54,7 +54,7 @@ void zmk_hid_indicators_set_profile(zmk_hid_indicators indicators, void zmk_hid_indicators_process_report(struct zmk_hid_led_report_body *report, struct zmk_endpoint_instance endpoint) { - uint8_t indicators = report->leds; + const zmk_hid_indicators_t indicators = (zmk_hid_indicators_t)report->leds; zmk_hid_indicators_set_profile(indicators, endpoint); LOG_DBG("Update HID indicators: endpoint=%d, indicators=%x", endpoint.transport, indicators); diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index d39309d2f76..6f3b78ab883 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -704,10 +704,10 @@ int zmk_split_bt_invoke_behavior(uint8_t source, struct zmk_behavior_binding *bi #if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) -static zmk_hid_indicators hid_indicators = 0; +static zmk_hid_indicators_t hid_indicators = 0; static void split_central_update_indicators_callback(struct k_work *work) { - zmk_hid_indicators indicators = hid_indicators; + zmk_hid_indicators_t indicators = hid_indicators; for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) { if (peripherals[i].state != PERIPHERAL_SLOT_STATE_CONNECTED) { continue; @@ -732,7 +732,7 @@ static void split_central_update_indicators_callback(struct k_work *work) { static K_WORK_DEFINE(split_central_update_indicators, split_central_update_indicators_callback); -int zmk_split_bt_update_hid_indicator(zmk_hid_indicators indicators) { +int zmk_split_bt_update_hid_indicator(zmk_hid_indicators_t indicators) { hid_indicators = indicators; return k_work_submit_to_queue(&split_central_split_run_q, &split_central_update_indicators); } diff --git a/app/src/split/bluetooth/service.c b/app/src/split/bluetooth/service.c index f9d8bab0de4..0072cf8c835 100644 --- a/app/src/split/bluetooth/service.c +++ b/app/src/split/bluetooth/service.c @@ -112,7 +112,7 @@ static void split_svc_pos_state_ccc(const struct bt_gatt_attr *attr, uint16_t va #if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) -static zmk_hid_indicators hid_indicators = 0; +static zmk_hid_indicators_t hid_indicators = 0; static void split_svc_update_indicators_callback(struct k_work *work) { LOG_DBG("Raising HID indicators changed event: %x", hid_indicators); @@ -125,7 +125,7 @@ static K_WORK_DEFINE(split_svc_update_indicators_work, split_svc_update_indicato static ssize_t split_svc_update_indicators(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) { - if (offset + len > sizeof(zmk_hid_indicators)) { + if (offset + len > sizeof(zmk_hid_indicators_t)) { return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); }