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:
parent
ba9f49d7a0
commit
f90c2b1122
|
@ -22,6 +22,7 @@
|
|||
aliases {
|
||||
watchdog0 = &iwdg;
|
||||
spi-flash0 = &spi_nor;
|
||||
led-strip = &led_strip_spi;
|
||||
};
|
||||
|
||||
board_id: brd-id {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
aliases {
|
||||
pwm-led0 = &pwm_led0;
|
||||
led-strip = &led_strip_spi;
|
||||
};
|
||||
|
||||
led_pwm: pwmleds {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
aliases {
|
||||
pwm-led0 = &pwm_led0;
|
||||
led-strip = &led_strip_spi;
|
||||
};
|
||||
|
||||
led_pwm: pwmleds {
|
||||
|
|
|
@ -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) {
|
||||
for (size_t cursor = 0; cursor < ARRAY_SIZE(pixels); cursor++) {
|
||||
memset(&pixels, 0x00, sizeof(pixels));
|
||||
memcpy(&pixels[cursor], &colors[color], sizeof(struct led_rgb));
|
||||
rc = led_strip_update_rgb(strip, pixels, STRIP_NUM_PIXELS);
|
||||
|
||||
rc = led_strip_update_rgb(strip, pixels, STRIP_NUM_PIXELS);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
k_sleep(DELAY_TIME);
|
||||
}
|
||||
|
||||
color = (color + 1) % ARRAY_SIZE(colors);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue