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 > Turn off one screen and backlight?

#49787 - wizardy - Tue Aug 02, 2005 2:17 pm

I'm using just one screen, and want to turn the other off to don't waste battery, but haven't been able to find out how. Does anyone know how to do this?

Thanks.

#49789 - LiraNuna - Tue Aug 02, 2005 2:24 pm

if i'm not mistake, it's the 6the and 7th bits on POWER_CR, one for each screen.

#49912 - dafer - Wed Aug 03, 2005 4:56 pm

Bit 0 in POWER_CR is for turning on both screens and bit 1/9 is for enabling 2D for Main/Sub.
So to enable 2D for just one screen write:

POWER_CR = 0x0003; //Enable main 2D
POWER_CR = 0x0201; //Enable Sub 2D

Anyway the code below generat different behavior for Main and Sub screen. If both screens are just turned on (POWER_CR = 0x0001) the sub screen is white and the main is black. Anyone who knows why?

Code:

int main(){
   vramSetMainBanks(VRAM_A_MAIN_BG, VRAM_B_MAIN_SPRITE, VRAM_C_SUB_BG,   VRAM_D_SUB_SPRITE);
   videoSetMode(MODE_0_2D);
   videoSetModeSub(MODE_0_2D);
   irqInitHandler(irqDefaultHandler);
   irqSet(IRQ_VBLANK, irqVBlank);
   while(1){
      uint16 sc = 0x0000;
      if((~(*(volatile uint16*)0x04000130)) & 0x0001){ //Press A to...
         sc = 0x0001; //...turn on both screens.
      }
      if((~(*(volatile uint16*)0x04000130)) & 0x0002){ //Press B to...
         sc |= 0x0002; //...enable Main 2D
      }
      if((~(*(volatile uint16*)0x04000130)) & 0x0004){ //Press Select to...
         sc |= 0x0200; //...enable Sub 2D
      }
      POWER_CR = sc;
      swiWaitForVBlank();
   }
}

_________________
/As meningful to you as words written in water.

#49970 - wintermute - Thu Aug 04, 2005 2:05 am

the backlight is controlled by the arm7, POWER_CR only controls the 2d & 3d engines and power to the displays.

All will be revealed later