refactor: Move away from deprecated label usages.

* Move away from DT_LABEL.
* Move to DEVICE_DT_GET for non-behavior device access.
* Move various drivers to `gpio_spec_dt` and `DT` related macros.
* Remove mcp23017 while at it, since better upstream driver is
  available.
This commit is contained in:
Peter Johanson
2023-01-17 20:40:44 -05:00
committed by Pete Johanson
parent 062f94d014
commit 09ed79a867
41 changed files with 199 additions and 828 deletions

View File

@@ -27,8 +27,14 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#define STRIP_LABEL DT_LABEL(DT_CHOSEN(zmk_underglow))
#define STRIP_NUM_PIXELS DT_PROP(DT_CHOSEN(zmk_underglow), chain_length)
#if !DT_CHOSEN(zmk_underglow)
#error "A zmk,underglow chosen node must be declared"
#endif
#define STRIP_CHOSEN DT_CHOSEN(zmk_underglow)
#define STRIP_NUM_PIXELS DT_PROP(STRIP_CHOSEN, chain_length)
#define HUE_MAX 360
#define SAT_MAX 100
@@ -230,13 +236,7 @@ static struct k_work_delayable underglow_save_work;
#endif
static int zmk_rgb_underglow_init(const struct device *_arg) {
led_strip = device_get_binding(STRIP_LABEL);
if (led_strip) {
LOG_INF("Found LED strip device %s", STRIP_LABEL);
} else {
LOG_ERR("LED strip device %s not found", STRIP_LABEL);
return -EINVAL;
}
led_strip = DEVICE_DT_GET(STRIP_CHOSEN);
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER)
ext_power = device_get_binding("EXT_POWER");