Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Remove deprecated label property #2028

Merged
merged 10 commits into from
Dec 5, 2023

Commits on Dec 5, 2023

  1. refactor(behaviors): Make label property optional

    Changed all code (except for layer names) which used the label property
    to use DEVICE_DT_NAME() instead, which uses the label if set or falls
    back to the full node name. This matches how Zephyr determines the node
    names used with device_get_binding() and allows us to start removing the
    deprecated label property from things.
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    16fa8e9 View commit details
    Browse the repository at this point in the history
  2. refactor(ext_power): Remove label property

    Changed the label property on zmk,ext-power-generic to be optional and
    removed it from existing uses. Renamed the nodes for all non-development
    boards to "EXT_POWER" to preserve user settings.
    
    rgb_underglow.c now finds the correct device by finding the first
    instance of zmk,ext-power-generic instead of looking for a node named
    "EXT_POWER".
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    55b2554 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    47f71b9 View commit details
    Browse the repository at this point in the history
  4. refactor: Remove unimportant labels

    Removed "label" properties which no longer have any function.
    
    Labels are still used as layer names and as identifiers for sending
    behaviors between sides of a split keyboard, so those have been left
    alone for now.
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    fe0def3 View commit details
    Browse the repository at this point in the history
  5. refactor(keymaps): Rename layer label to "display-name"

    Changed the property used to define a layer name for displays from
    "label" (which affects other things in Zephyr and is deprecated) to
    "display-name". (It cannot be named simply "name", because that has
    special meaning in newer versions of the devicetree compiler.)
    
    "label" is still supported as a fallback, so no changes need to be made
    to existing keymaps.
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    0dd7e03 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4089546 View commit details
    Browse the repository at this point in the history
  7. refactor(behaviors): Create a list to lookup behaviors

    Added BEHAVIOR_DT_DEFINE() and BEHAVIOR_DT_INST_DEFINE(), which work
    exactly like the DEVICE_*_DEFINE() macros, except they also register the
    device as a behavior by adding a pointer to it to a memory section.
    
    Added zmk_behavior_get_binding(), which works like device_get_binding()
    except that it only searches the devices that have been registered as
    behaviors. This ensures that behaviors cannot have name collisions with
    other devices defined by the SoC, which will be important when we remove
    the label property from behaviors so they are given their node names.
    
    As an added benefit, this is faster since it searches a smaller list.
    Some basic benchmark code I wrote indicates it takes 30-70% as long,
    depending on where the behavior is in the list and whether the name
    string is an exact pointer match.
    
    From now on, behaviors should use BEHAVIOR_*_DEFINe() instead of
    DEVICE_*_DEFINE(), and any code that looks up a behavior by name should
    use zmk_behavior_get_binding() instead of device_get_binding().
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    e7a7b61 View commit details
    Browse the repository at this point in the history
  8. refactor(behaviors)!: Remove labels from behaviors

    Removed the label property from built-in behaviors, custom behaviors
    defined in a few keymaps, and macros generated with ZMK_MACRO().
    
    Now that node names are used to identify behaviors, and names only need
    to be unique within the set of behaviors, the names of all behaviors
    have been shortened to be similar to their original labels.
    
    This means that any keymaps which reference behavior nodes by name
    instead of by label will need to be updated. Keymaps typically use the
    labels though, so most keymaps should be unaffected by this change.
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    ff206ac View commit details
    Browse the repository at this point in the history
  9. docs: Document behavior name length limit

    Added a section to the new behavior guide to document that the names of
    behaviors invoked on the peripheral side of a split must be at most 8
    characters long.
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    bec41db View commit details
    Browse the repository at this point in the history
  10. refactor: Remove new uses of label property

    Removed new uses of the "label" property which were introduced after
    the previous commits on this branch were written.
    joelspadin committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    076fa0a View commit details
    Browse the repository at this point in the history