gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS Misc > reading battery?

#135283 - spinal_cord - Sat Jul 21, 2007 8:19 pm

I know that the DS only knows good/bad battery power, not a percentage or anything, But I have tried to read it and TSC_MEASURE_BATTERY always returns 0, both when the battery is full and empty (red LED).

Can someone tell me the correct way to read the battery?

thankyou.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#135284 - LiraNuna - Sat Jul 21, 2007 8:57 pm

Reading power management register 1 returns a boolean of battery status.
_________________
Private property.
Violators will be shot, survivors will be shot again.

#135285 - spinal_cord - Sat Jul 21, 2007 9:11 pm

How do I go about doing that?
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#135286 - LiraNuna - Sat Jul 21, 2007 10:02 pm

from ARM7:

Code:

bool isBattWeak = readPowerManagement(1);


or if you like fancy defines
Code:

bool isBattWeak = readPowerManagement(PM_BATTERY_REG);

_________________
Private property.
Violators will be shot, survivors will be shot again.

#135289 - spinal_cord - Sat Jul 21, 2007 10:55 pm

excellent, thankyou.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage