boards: seagate: legend: Cleanup led-strip alias

The led-strip alias can be determined in the base dts file.
Remove from overlay files and aggregate to the base dts file.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2024-03-14 10:02:15 +09:00 committed by David Leach
parent ba9f49d7a0
commit f90c2b1122
5 changed files with 12 additions and 21 deletions

View file

@ -22,6 +22,7 @@
aliases {
watchdog0 = &iwdg;
spi-flash0 = &spi_nor;
led-strip = &led_strip_spi;
};
board_id: brd-id {

View file

@ -10,7 +10,6 @@
aliases {
pwm-led0 = &pwm_led0;
led-strip = &led_strip_spi;
};
led_pwm: pwmleds {

View file

@ -7,10 +7,6 @@
/ {
model = "Seagate Legend 2.5 SSD board";
compatible = "legend25_ssd", "seagate,legend25_ssd";
aliases {
led-strip = &led_strip_spi;
};
};
&clk_hse {

View file

@ -10,7 +10,6 @@
aliases {
pwm-led0 = &pwm_led0;
led-strip = &led_strip_spi;
};
led_pwm: pwmleds {

View file

@ -45,7 +45,7 @@ static const struct device *const strip = DEVICE_DT_GET(STRIP_NODE);
int main(void)
{
size_t cursor = 0, color = 0;
size_t color = 0;
int rc;
if (device_is_ready(strip)) {
@ -57,24 +57,20 @@ int main(void)
LOG_INF("Displaying pattern on strip");
while (1) {
memset(&pixels, 0x00, sizeof(pixels));
memcpy(&pixels[cursor], &colors[color], sizeof(struct led_rgb));
rc = led_strip_update_rgb(strip, pixels, STRIP_NUM_PIXELS);
for (size_t cursor = 0; cursor < ARRAY_SIZE(pixels); cursor++) {
memset(&pixels, 0x00, sizeof(pixels));
memcpy(&pixels[cursor], &colors[color], sizeof(struct led_rgb));
if (rc) {
LOG_ERR("couldn't update strip: %d", rc);
}
cursor++;
if (cursor >= STRIP_NUM_PIXELS) {
cursor = 0;
color++;
if (color == ARRAY_SIZE(colors)) {
color = 0;
rc = led_strip_update_rgb(strip, pixels, STRIP_NUM_PIXELS);
if (rc) {
LOG_ERR("couldn't update strip: %d", rc);
}
k_sleep(DELAY_TIME);
}
k_sleep(DELAY_TIME);
color = (color + 1) % ARRAY_SIZE(colors);
}
return 0;
}