#include <unistd.h>
#include "headless_server.h"
-#include "HL_UI_LED.h"
#include "output_internal.h"
+#define NUM_LED 12
+#define LED_BRIGHTNESS 0x1
+
led_output_t *
headless_output_create(struct wl_display *display)
{
- led_output_t *output = (led_output_t*)calloc(sizeof(led_output_t), 1);
+ led_output_t *output;
HS_TRACE("Output Init\n");
+ output = calloc(1, sizeof(led_output_t));
if (!output) {
- HS_ERROR("Failed to allocate memory in %s\n", __FUNCTION__);
+ HS_ERROR("Failed to allocate memory\n");
return false;
}
output->display = display;
- // FIXME Should we create wl_global for wl_output?
-
- output->num_led = NUM_LED;
- output->ui_led = HL_UI_LED_Init(output->num_led);
- if (output->ui_led) HL_UI_LED_Change_Brightness(output->ui_led, 0x1);
-
- if (!output->ui_led)
- HS_ERROR("HL_UI_LED_Init() failed.\n");
+ output->ui_led = HL_UI_LED_Init(NUM_LED);
+ if (output->ui_led)
+ HL_UI_LED_Change_Brightness(output->ui_led, LED_BRIGHTNESS);
+ else
+ HS_ERROR("HL_UI_LED_Init() failed.");
return output;
}
int i;
uint8_t *ptr = (uint8_t *)data;
- if (data == NULL) {
+ if (!ptr) {
HS_TRACE("[OUTPUT] update LED to empty\n");
HL_UI_LED_Clear_All(output->ui_led);
return;
}
- for(i=0; i<output->num_led; i++) {
+ for (i = 0; i < NUM_LED; i++) {
HL_UI_LED_Set_Pixel_RGB(output->ui_led, i, ptr[R_OFF_SET],
ptr[G_OFF_SET], ptr[B_OFF_SET]);
ptr += 4;