forked from kofal.net/zmk
refactor: Move to zmk_hid_indicators_t type.
This commit is contained in:
committed by
Pete Johanson
parent
d9bb0d7d0e
commit
817ce8764f
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user