 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
mirzab14
Joined: 21 Jan 2008 Posts: 8
|
Posted: Mon Mar 17, 2008 2:11 pm Post subject: Turn off charging LED? |
|
|
I've been wondering if this is possible. I know its possible to turn off the WLAN, MS, and POWER LED's but is it possible to turn off the orange "charge" LED when A/C adapter is plugged in?
I've searched but couldn't find anything.
This is the code for the LEDControl plugin.
| Code: |
#include <pspkernel.h>
#include <pspctrl.h>
#define MS_LED 0
#define WLAN_LED 1
#define POWER_LED 2
#define STATE_ON 1
#define STATE_OFF 0
PSP_MODULE_INFO("LEDControl", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int currentState = STATE_ON;
int main_thread(SceSize args, void *argp)
{
SceCtrlData pad;
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_LTRIGGER) {
if(pad.Buttons & PSP_CTRL_VOLDOWN)
{
if(currentState == STATE_ON)
{
sceSysconCtrlLED(MS_LED, STATE_OFF);
sceSysconCtrlLED(WLAN_LED, STATE_OFF);
sceSysconCtrlLED(POWER_LED, STATE_OFF);
currentState = STATE_OFF;
}
else
{
sceSysconCtrlLED(MS_LED, STATE_ON);
sceSysconCtrlLED(WLAN_LED, STATE_ON);
sceSysconCtrlLED(POWER_LED, STATE_ON);
currentState = STATE_ON;
}
}
}
sceKernelDelayThreadCB(100000);
}
return 0;
}
int module_start(SceSize args, void *argp)
{
// Create a thread
int thid = sceKernelCreateThread("LEDControl", main_thread, 0x30, 0x1000, 0, NULL);
if(thid >= 0) sceKernelStartThread(thid, args, argp);
return 0;
}
|
Maybe its a hardware thing and it can't be controlled by software? |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Mon Mar 17, 2008 3:06 pm Post subject: |
|
|
Yes it can be done.
Have a look at Road Dog source.
I got the sample from this forum.
It might be just a matter of defining the next LED:
| Code: |
#define CHARGE_LED 3
|
or maybe not, but Road Dog definitely turns it off.
Art. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
mirzab14
Joined: 21 Jan 2008 Posts: 8
|
Posted: Mon Mar 17, 2008 4:37 pm Post subject: |
|
|
I tried | Code: | | #define CHARGE_LED 3 | and it doesn't work.
I looked at main.c of Road Dog but couldn't really tell why it does work and why mine doesn't. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Mon Mar 17, 2008 10:12 pm Post subject: |
|
|
Maybe it's a 1.50 kernel mode thing?
I can't say for sure why, just know it does turn it off for me.
It could also be because my toolchain is a very old version.
I can still adjust LCD brightness, yet others here have had
problems with the same sample code to do that. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|