Skip to content

Commit

Permalink
Add checks for alias definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar committed Dec 22, 2023
1 parent 6223fec commit 8cbc47d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);

#define LED_GPIO_NODE_ID DT_COMPAT_GET_ANY_STATUS_OKAY(gpio_leds)

BUILD_ASSERT(DT_NODE_EXISTS(DT_ALIAS(led_red)), "An alias for a red LED is not found for RGBLED_WIDGET");
BUILD_ASSERT(DT_NODE_EXISTS(DT_ALIAS(led_green)), "An alias for a green LED is not found for RGBLED_WIDGET");
BUILD_ASSERT(DT_NODE_EXISTS(DT_ALIAS(led_blue)), "An alias for a blue LED is not found for RGBLED_WIDGET");

// GPIO-based LED device and indices of red/green/blue LEDs inside its DT node
static const struct device *led_dev = DEVICE_DT_GET(LED_GPIO_NODE_ID);
static const uint8_t rgb_idx[] = {DT_NODE_CHILD_IDX(DT_ALIAS(led_red)),
Expand Down

0 comments on commit 8cbc47d

Please sign in to comment.