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".
This commit is contained in:
Joel Spadin
2023-09-05 17:52:18 -05:00
parent 179bdbc41a
commit 05925c72d7
17 changed files with 34 additions and 36 deletions

View File

@@ -67,7 +67,7 @@ static struct led_rgb pixels[STRIP_NUM_PIXELS];
static struct rgb_underglow_state state;
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER)
static const struct device *ext_power;
static const struct device *const ext_power = DEVICE_DT_GET(DT_INST(0, zmk_ext_power_generic));
#endif
static struct zmk_led_hsb hsb_scale_min_max(struct zmk_led_hsb hsb) {
@@ -243,9 +243,9 @@ static int zmk_rgb_underglow_init(const struct device *_arg) {
led_strip = DEVICE_DT_GET(STRIP_CHOSEN);
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER)
ext_power = device_get_binding("EXT_POWER");
if (ext_power == NULL) {
LOG_ERR("Unable to retrieve ext_power device: EXT_POWER");
if (!device_is_ready(ext_power)) {
LOG_ERR("External power device \"%s\" is not ready", ext_power->name);
return -ENODEV;
}
#endif