mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-09 12:30:41 +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
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int setup[MAX_LEDS];
|
||||
int map[MAX_LEDS];
|
||||
int setup[MAX_LEDS];
|
||||
int map[MAX_LEDS];
|
||||
} overlayled_t;
|
||||
|
||||
static overlayled_t curins;
|
||||
@ -19,19 +19,21 @@ static overlayled_t *cur = &curins;
|
||||
|
||||
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++) {
|
||||
cur->setup[i] = 0;
|
||||
cur->map[i] = settings->uints.led_map[i];
|
||||
RARCH_LOG("[LED]: overlay map[%d]=%d\n",i,cur->map[i]);
|
||||
int i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if(cur->map[i] >= 0)
|
||||
{
|
||||
input_overlay_set_visibility(cur->map[i],OVERLAY_VISIBILITY_HIDDEN);
|
||||
}
|
||||
}
|
||||
RARCH_LOG("[LED]: overlay LED driver init\n");
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void overlay_free(void)
|
||||
@ -41,19 +43,29 @@ static void overlay_free(void)
|
||||
|
||||
static void overlay_set(int led,int state)
|
||||
{
|
||||
int gpio = 0;
|
||||
if((led < 0) || (led >= MAX_LEDS))
|
||||
{
|
||||
RARCH_WARN("[LED]: invalid led %d\n",led);
|
||||
return;
|
||||
}
|
||||
int gpio = 0;
|
||||
if ((led < 0) || (led >= MAX_LEDS))
|
||||
{
|
||||
RARCH_WARN("[LED]: invalid led %d\n",led);
|
||||
return;
|
||||
}
|
||||
|
||||
gpio = cur->map[led];
|
||||
gpio = cur->map[led];
|
||||
|
||||
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);
|
||||
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…
Reference in New Issue
Block a user