forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8a1348
commit eb62b61
Showing
5 changed files
with
212 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,58 @@ | ||
/* RetroArch - A frontend for libretro. | ||
* | ||
* RetroArch is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU General Public License as published by the Free Software Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
* PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with RetroArch. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <string/stdstring.h> | ||
|
||
#include "led_driver.h" | ||
#include "configuration.h" | ||
#include "verbosity.h" | ||
#include "../configuration.h" | ||
#include "../verbosity.h" | ||
|
||
extern led_driver_t *null_led_driver; | ||
#if HAVE_RPILED | ||
extern led_driver_t *rpi_led_driver; | ||
#endif | ||
led_driver_t *current_led_driver = NULL; | ||
static led_driver_t *current_led_driver = NULL; | ||
|
||
bool led_driver_init(void) | ||
{ | ||
char *drivername = NULL; | ||
settings_t *settings = config_get_ptr(); | ||
drivername = settings->arrays.led_driver; | ||
|
||
if(drivername == NULL) | ||
drivername = "null"; | ||
settings_t *settings = config_get_ptr(); | ||
char *drivername = settings ? settings->arrays.led_driver : NULL; | ||
|
||
if(!drivername) | ||
drivername = "null"; | ||
|
||
current_led_driver = null_led_driver; | ||
|
||
#if HAVE_RPILED | ||
if(!strcmp("rpi",drivername)) | ||
{ | ||
current_led_driver = rpi_led_driver; | ||
} | ||
else | ||
if(string_is_equal("rpi", drivername)) | ||
current_led_driver = rpi_led_driver; | ||
#endif | ||
{ | ||
current_led_driver = null_led_driver; | ||
} | ||
|
||
RARCH_LOG("[LED]: LED driver = '%s' %p\n",drivername,current_led_driver); | ||
|
||
if(current_led_driver != NULL) | ||
{ | ||
(*current_led_driver->init)(); | ||
} | ||
|
||
return true; | ||
|
||
RARCH_LOG("[LED]: LED driver = '%s' %p\n", | ||
drivername,current_led_driver); | ||
|
||
if(current_led_driver) | ||
(*current_led_driver->init)(); | ||
|
||
return true; | ||
} | ||
|
||
void led_driver_free(void) | ||
{ | ||
if(current_led_driver != NULL) | ||
{ | ||
(*current_led_driver->free)(); | ||
} | ||
if(current_led_driver) | ||
(*current_led_driver->free)(); | ||
} | ||
|
||
void led_driver_set_led(int led,int value) | ||
{ | ||
if(current_led_driver != NULL) | ||
{ | ||
(*current_led_driver->set_led)(led,value); | ||
} | ||
if(current_led_driver) | ||
(*current_led_driver->set_led)(led,value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
/* RetroArch - A frontend for libretro. | ||
* | ||
* RetroArch is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU General Public License as published by the Free Software Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
* PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with RetroArch. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "led_driver.h" | ||
#include "verbosity.h" | ||
#include "../verbosity.h" | ||
|
||
static void null_init(void) { } | ||
static void null_free(void) { } | ||
static void null_set(int led,int state) { } | ||
|
||
static void null_init(void) | ||
{ | ||
RARCH_LOG("[LED]: using null LED driver\n"); | ||
} | ||
static void null_free(void) {} | ||
static void null_set(int led,int state) {} | ||
static led_driver_t null_led_driver_ins = { | ||
null_init, | ||
null_free, | ||
null_set | ||
}; | ||
|
||
static led_driver_t null_led_driver_ins = { null_init, null_free, null_set }; | ||
led_driver_t *null_led_driver = &null_led_driver_ins; | ||
|
Oops, something went wrong.