forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Turn off charging LED?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
mirzab14



Joined: 21 Jan 2008
Posts: 8

PostPosted: Mon Mar 17, 2008 2:11 pm    Post subject: Turn off charging LED? Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon Mar 17, 2008 3:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
mirzab14



Joined: 21 Jan 2008
Posts: 8

PostPosted: Mon Mar 17, 2008 4:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon Mar 17, 2008 10:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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