fbd-dev-led: Allow to lookup color

This allows us to make the led structure into an opaque in
the next commit
This commit is contained in:
Guido Günther
2023-02-10 15:15:12 +00:00
committed by Guido Gunther
parent 8ad1c43ff1
commit 5d8b2e5fe4
3 changed files with 9 additions and 1 deletions
+7
View File
@@ -165,3 +165,10 @@ fbd_dev_led_start_periodic (FbdDevLed *led,
return success;
}
gboolean
fbd_dev_led_has_color (FbdDevLed *led, FbdFeedbackLedColor color)
{
return (led->color == FBD_FEEDBACK_LED_COLOR_RGB || led->color == color);
}
+1
View File
@@ -33,5 +33,6 @@ gboolean fbd_dev_led_start_periodic (FbdDevLed *led,
FbdFeedbackLedColor color,
guint max_brightness_percentage,
guint freq);
gboolean fbd_dev_led_has_color (FbdDevLed *led, FbdFeedbackLedColor color);
G_END_DECLS
+1 -1
View File
@@ -46,7 +46,7 @@ find_led_by_color (FbdDevLeds *self, FbdFeedbackLedColor color)
for (GSList *l = self->leds; l != NULL; l = l->next) {
FbdDevLed *led = l->data;
if (led->color == FBD_FEEDBACK_LED_COLOR_RGB || led->color == color)
if (fbd_dev_led_has_color (led, color))
return led;
}