Is there any way to read the DS battery level?
If so, how is this done?
I notice the deprecated IPC stucture has a battery value and assume this was previously used for the battery levell, how is it now replaced?
Thanks
Battery Level
Re: Battery Level
At the moment the battery level consists of 3 states that I can think of:
0 - Off
1 - On Battery
2 - On AC Power.
There might be a 4th level - low battery, but I'm not sure as it's not something that I would normally attempt to use, I did look into it a while back and the DS's Power reports are not very specific.
I think this is why the battery level is not a part of the new IPC system.
Warning Assumption alert - You have been warned:
On the DSi's official SDK there's a way to read the battery level but that's only on DSi(a)Ware titles, since the battery indicator has been in a couple of the DSiWare titles I've downloaded, and I do not know if it's on any of the DSi-aware games out there.
End of Assumption alert..
0 - Off
1 - On Battery
2 - On AC Power.
There might be a 4th level - low battery, but I'm not sure as it's not something that I would normally attempt to use, I did look into it a while back and the DS's Power reports are not very specific.
I think this is why the battery level is not a part of the new IPC system.
Warning Assumption alert - You have been warned:
On the DSi's official SDK there's a way to read the battery level but that's only on DSi(a)Ware titles, since the battery indicator has been in a couple of the DSiWare titles I've downloaded, and I do not know if it's on any of the DSi-aware games out there.
End of Assumption alert..
Re: Battery Level
Thanks for the reply.
Even if I can get those 4 levels only would be helpful for my purpose.
How can they be read now if not through IPC?
Even if I can get those 4 levels only would be helpful for my purpose.
How can they be read now if not through IPC?
Re: Battery Level
Can anyone tell me how to read the states
Battery OK
Battery Bad
Charger connected
These seem to be the only one available and would be useful for my purpose but there is no real documentation on how to read them
Have seen some reference to register 4 bit 3 but not how to read it
touchRead(TSC_MEASURE_BATTERY) on arm7 always returns 0, so this is obviously not what I need to do.
Battery OK
Battery Bad
Charger connected
These seem to be the only one available and would be useful for my purpose but there is no real documentation on how to read them
Have seen some reference to register 4 bit 3 but not how to read it
touchRead(TSC_MEASURE_BATTERY) on arm7 always returns 0, so this is obviously not what I need to do.
Re: Battery Level
After a quick look at the sourcs code for the default arm7 this is what I worked out, it might be wrong as I only had a quick glance.
The only way to read those values would be to write your own arm7 code, including the fifo handling code. To give you an idea of what you need to do I've pasted below the code I used to work out what DS model I was running the nds on:
You would need to change the code above to read the different parts of the battery indicators, and add in a call to set up the fifo handler. Hopefully this will help you out with your problem.
Actually looking at the docs on the nocash site you will need to read 2 power registers:
Register 1 - Battery Status (R)
Register 4 - DS-Lite Only - Backlight Levels/Power Source (R/W)
So your results will be limited to the DS that you are running on:
DSPhat - You get a Good (0) or low power (1) indicator
DSLite - You get the DSPhat's OK/low power indicator and gain a power source indicator - Battery(0) or Wall socket(1) on BIT 3.
The only way to read those values would be to write your own arm7 code, including the fifo handling code. To give you an idea of what you need to do I've pasted below the code I used to work out what DS model I was running the nds on:
Code: Select all
void testHandler(u32 command, void* userdata)
{
u8 ret1, ret2;
u8 dsGen = 0;
ret1 = readPowerManagement(4);
ret2 = readPowerManagement(5);
if( ret1 & BIT(6) )
dsGen++;
if( ret1 == ret2 )
dsGen++;
fifoSendValue32( FIFO_USER_01, dsGen );
}
Actually looking at the docs on the nocash site you will need to read 2 power registers:
Register 1 - Battery Status (R)
Register 4 - DS-Lite Only - Backlight Levels/Power Source (R/W)
So your results will be limited to the DS that you are running on:
DSPhat - You get a Good (0) or low power (1) indicator
DSLite - You get the DSPhat's OK/low power indicator and gain a power source indicator - Battery(0) or Wall socket(1) on BIT 3.
Re: Battery Level
Thanks heaps
I already had a FIFO in place for brighness, so easy to add in another command on that one.
Do you have the URL that has the registers / bits for the power managment.
I already had a FIFO in place for brighness, so easy to add in another command on that one.
Do you have the URL that has the registers / bits for the power managment.
Re: Battery Level
http://nocash.emubase.de/gbatek.htm#dspowermanagement is the one I used for the information.
Who is online
Users browsing this forum: No registered users and 0 guests