Skip to content

indicator_leds.c doesn't compile on a split peripheral #3307

Description

@joelspadin

indicator_leds.c calls zmk_endpoint_is_connected(), which isn't compiled on split peripherals. We need to do one of two things to allow indicator LEDs to be used on peripherals:

  1. Compile a subset of the endpoints code for split peripherals and have the central send its current endpoint state to the peripherals so they can use it.
  2. Change indicator_leds.c to ignore the endpoint state on peripherals. It will then not be able to match the same behavior as a central, since it won't know when it should change LED brightness because the keyboard is disconnected.

Option 1 would be preferred, however not all functions can or should be implemented.

The following are pure functions, so they will work as-is:

  • zmk_endpoint_instance_eq
  • zmk_endpoint_instance_to_str

The following functions could be implemented if current_instance and preferred_transport were mirrored from the central to the peripherals:

  • zmk_endpoint_get_preferred_transport
  • zmk_endpoint_get_preferred
  • zmk_endpoint_get_selected
  • zmk_endpoint_is_connected

zmk_endpoint_instance_to_index and ZMK_ENDPOINT_COUNT cannot be accurately implemented on peripherals, as they depend on the local CONFIG_ZMK_USB, CONFIG_ZMK_BLE, and ZMK_BLE_PROFILE_COUNT values, which may differ from the ones on the central.

zmk_endpoint_set_preferred_transport and zmk_endpoint_toggle_preferred_transport could theoretically be implemented on peripherals, but I don't see a reason that a peripheral would need to send a message to the central to directly change its preferred transport.

The following functions don't make sense to implement on a peripheral, since only the central sends HID data:

  • zmk_endpoint_send_report
  • zmk_endpoint_send_mouse_report
  • zmk_endpoint_clear_reports

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions