mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-24 20:26:52 +00:00
Add overlay_led_driver
This commit is contained in:
parent
751c0fe58c
commit
a516a0a3a3
@ -498,6 +498,7 @@ INPUT
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
#include "../input/input_overlay.c"
|
||||
#include "../led/overlay_led_driver.c"
|
||||
#include "../tasks/task_overlay.c"
|
||||
#endif
|
||||
|
||||
|
@ -21,16 +21,18 @@ static void overlay_init(void)
|
||||
{
|
||||
int i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
RARCH_LOG("[LED]: overlay LED driver init\n");
|
||||
for(i=0;i<MAX_LEDS;i++) {
|
||||
|
||||
for (i = 0; i < MAX_LEDS; i++)
|
||||
{
|
||||
cur->setup[i] = 0;
|
||||
cur->map[i] = settings->uints.led_map[i];
|
||||
RARCH_LOG("[LED]: overlay map[%d]=%d\n",i,cur->map[i]);
|
||||
|
||||
if(cur->map[i] >= 0)
|
||||
{
|
||||
input_overlay_set_visibility(cur->map[i],OVERLAY_VISIBILITY_HIDDEN);
|
||||
}
|
||||
if (cur->map[i] >= 0)
|
||||
input_overlay_set_visibility(cur->map[i],
|
||||
OVERLAY_VISIBILITY_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +44,7 @@ static void overlay_free(void)
|
||||
static void overlay_set(int led,int state)
|
||||
{
|
||||
int gpio = 0;
|
||||
if((led < 0) || (led >= MAX_LEDS))
|
||||
if ((led < 0) || (led >= MAX_LEDS))
|
||||
{
|
||||
RARCH_WARN("[LED]: invalid led %d\n",led);
|
||||
return;
|
||||
@ -50,10 +52,20 @@ static void overlay_set(int led,int state)
|
||||
|
||||
gpio = cur->map[led];
|
||||
|
||||
if(gpio < 0) return;
|
||||
input_overlay_set_visibility(gpio,state?OVERLAY_VISIBILITY_VISIBLE:OVERLAY_VISIBILITY_HIDDEN);
|
||||
if (gpio < 0)
|
||||
return;
|
||||
|
||||
input_overlay_set_visibility(gpio,
|
||||
state ? OVERLAY_VISIBILITY_VISIBLE
|
||||
: OVERLAY_VISIBILITY_HIDDEN);
|
||||
|
||||
RARCH_LOG("[LED]: set visibility %d %d\n",gpio,state);
|
||||
}
|
||||
|
||||
static led_driver_t overlay_led_driver_ins = { overlay_init, overlay_free, overlay_set };
|
||||
static led_driver_t overlay_led_driver_ins = {
|
||||
overlay_init,
|
||||
overlay_free,
|
||||
overlay_set
|
||||
};
|
||||
|
||||
led_driver_t *overlay_led_driver = &overlay_led_driver_ins;
|
||||
|
Loading…
x
Reference in New Issue
Block a user