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 development > New Battery Information discovered! (demo version 2)

#99062 - Lick - Sat Aug 19, 2006 11:02 am

Hey everyone, if you haven't seen my brightness demo: you really should!
It's a FIFO-based demo that demonstrates useful information gathering from the ARM7-access-only registers.

I was messing with version 1 of the demo as I found out that when the charger was plugged in, the brightness value increased by 8. So I figured that bit(3) would be the 'is battery charging' bit. As I'm not sure if this is DS Lite specific (probably not), I hereby declare that SPI DATA REG 4 is -NOT- DS Lite specific anymore, but is also containing other information.
In my src I call it PM_HARDWARE_REG (perhaps it should be called EXTRA).

Anyway, I updated on several spots. Read below.

Code:

` 19-08-06 ` Found a powerful useful bit. The is-battery-recharging bit.
             It's the 4th bit (BIT(3)) of SPI DATA REG 4, that was at first
             though to be a DS Lite specific register.
             
             - Added feature to see if battery is recharging.
             - Instead of substracting 64, the brightness bit is masked.
             - Renamed some of the #defines and functions.
             - Made GET_BRIGHTNESS on Phatty return 0 or 1. (not 0 or 2)
             - Added the sun icon, I pixelled (hehe), to the package.

http://lick.huuf.net/brightness_test_v2.zip (Play with it, plug the charger in and out etc.)

Hope the code will help you develop a strong application!
- Lick

P.S. Thanks Huuf for hosting!
_________________
http://licklick.wordpress.com

#99065 - chrisis - Sat Aug 19, 2006 12:29 pm

Hi,
I've got both, a Phat (Japanese black model) and a Lite (European black model), both flashed with Flashme Stealth V7 (the Phat's original firmware was v4 - yellow), and one Super Card CF.

So, the charging message works right on the Lite, as intended.
However, on the Phat, nothing changes when charging/not charging, it always shows charging - at least as long as the backlight is on. But as soon as the backlight is turned off, it shows "not charging", no matter if that's the case or not.

So I assume on the Phat this register only shows if background is turned on or off.

Oh, and please excuse my non programmer speach, I'm not really a programmer at all, just love trying out all that great homebrew!

#99076 - Lick - Sat Aug 19, 2006 1:21 pm

Thank you thank you!

So perhaps it -is- a DSLite specific register after all. Problem is, I can't code for Phatty if I don't have his hardware.

Thanks for your input, I will figure some things out.
_________________
http://licklick.wordpress.com

#99100 - Liter - Sat Aug 19, 2006 3:36 pm

Thanks for this, nice little util. :)

Would it be possible to display exactly how fully charged the battery is in terms of percentage please?

#99104 - Lick - Sat Aug 19, 2006 3:45 pm

Unfortunately the location of that information is still unclear. We don't even know if that information exists at all! But if it does, I'll be (one of.. =/) the first to tell ya!
_________________
http://licklick.wordpress.com

#99106 - Liter - Sat Aug 19, 2006 4:01 pm

Thanks.

Presumably there must be some indication somewhere though?

#99110 - Lick - Sat Aug 19, 2006 4:22 pm

Not sure, since the start up screens don't display that kind of information, we're not sure. There also isn't a commercial game/application that proved it can be done.

So nada?
_________________
http://licklick.wordpress.com

#99138 - kinvig - Sat Aug 19, 2006 7:24 pm

forgive me if this is obvious or not helping but

on my DSLite

Animal crossing must look at something to do with battery level as when power led turns from green to red animal crossing wild world suggests saving the game as battery level is low.

Regards

Kinvig

#99140 - tepples - Sat Aug 19, 2006 7:27 pm

The CPU can read whether the battery is red or green (that is, good enough for ACWW). It may not be capable of a more precise reading than that (that is, not good enough for Liter's request).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#99157 - JaJa - Sat Aug 19, 2006 9:03 pm

I think the DS just uses a voltage drop to estimate the amount left in the battery.

This is why it can be red, but turning down the volume, turning off wifi or removing the supercard (which is a battery killer) makes it green again.
_________________
LAWL HOOGE
My Blog

#99261 - LiraNuna - Sun Aug 20, 2006 10:35 am

Quote:
I hereby declare that SPI DATA REG 4 is -NOT- DS Lite specific anymore


That's so wrong...

Writing to PM4 on a phat DS will mirror it to PM0. Try to write 0x3 to it, and the DS will shut down. That's why my demo was at first DS Lite version only - Phat DSs shutted down on startup.
_________________
Private property.
Violators will be shot, survivors will be shot again.

#99289 - Lick - Sun Aug 20, 2006 2:42 pm

Lick wrote:
So perhaps it -is- a DSLite specific register after all. Problem is, I can't code for Phatty if I don't have his hardware.


Yeah I figured that out already Liran..
_________________
http://licklick.wordpress.com