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:
parent
179bdbc41a
commit
05925c72d7
17 changed files with 34 additions and 36 deletions
|
@ -29,9 +29,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
init-delay-ms = <20>;
|
init-delay-ms = <20>;
|
||||||
control-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; /* WS2812_CE */
|
control-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; /* WS2812_CE */
|
||||||
init-delay-ms = <100>;
|
init-delay-ms = <100>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; /* WS2812_CE */
|
control-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; /* WS2812_CE */
|
||||||
init-delay-ms = <100>;
|
init-delay-ms = <100>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
||||||
init-delay-ms = <50>;
|
init-delay-ms = <50>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,9 +78,9 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) R
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
zmk,battery = &vbatt;
|
zmk,battery = &vbatt;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
zmk,battery = &vbatt;
|
zmk,battery = &vbatt;
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
||||||
init-delay-ms = <50>;
|
init-delay-ms = <50>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
|
||||||
init-delay-ms = <50>;
|
init-delay-ms = <50>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ext-power {
|
// Node name must match original "EXT_POWER" label to preserve user settings.
|
||||||
|
EXT_POWER {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,15 +49,12 @@ nice_view_spi: &arduino_spi {
|
||||||
// Commented out until we add more powerful power domain support
|
// Commented out until we add more powerful power domain support
|
||||||
// external_power {
|
// external_power {
|
||||||
// compatible = "zmk,ext-power-generic";
|
// compatible = "zmk,ext-power-generic";
|
||||||
// label = "EXT_POWER";
|
|
||||||
// init-delay-ms = <200>;
|
// init-delay-ms = <200>;
|
||||||
// control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
|
// control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
|
||||||
// };
|
// };
|
||||||
|
|
||||||
rgb_power {
|
rgb_power {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
|
||||||
// label = "RGB_POWER";
|
|
||||||
init-delay-ms = <200>;
|
init-delay-ms = <200>;
|
||||||
control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
|
control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,8 @@ properties:
|
||||||
required: true
|
required: true
|
||||||
label:
|
label:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: false
|
||||||
|
deprecated: true
|
||||||
init-delay-ms:
|
init-delay-ms:
|
||||||
type: int
|
type: int
|
||||||
description: Number of milliseconds to delay after initializing driver
|
description: Number of milliseconds to delay after initializing driver
|
||||||
|
|
|
@ -67,7 +67,7 @@ static struct led_rgb pixels[STRIP_NUM_PIXELS];
|
||||||
static struct rgb_underglow_state state;
|
static struct rgb_underglow_state state;
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER)
|
#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
|
#endif
|
||||||
|
|
||||||
static struct zmk_led_hsb hsb_scale_min_max(struct zmk_led_hsb hsb) {
|
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);
|
led_strip = DEVICE_DT_GET(STRIP_CHOSEN);
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER)
|
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER)
|
||||||
ext_power = device_get_binding("EXT_POWER");
|
if (!device_is_ready(ext_power)) {
|
||||||
if (ext_power == NULL) {
|
LOG_ERR("External power device \"%s\" is not ready", ext_power->name);
|
||||||
LOG_ERR("Unable to retrieve ext_power device: EXT_POWER");
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue