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 > Turning off screens

#70873 - HyperHacker - Thu Feb 09, 2006 6:07 am

How exactly do you turn off one of the LCD screens entirely? I can turn the backlight off, but things still display on the screen.

#70877 - LiraNuna - Thu Feb 09, 2006 6:31 am

videoSetMode(DISPLAY_SCREEN_OFF);

or

videoSetModeSub(DISPLAY_SCREEN_OFF);

#70885 - HyperHacker - Thu Feb 09, 2006 8:06 am

Thanks. Is there a way to get rid of the flicker though? What I mean is when I have one screen (and its backlight) on, and the other off, and I swap the screens, they both flash white for a second.

ARM9 code:
Code:
lcdSwap();
TopScreen = !TopScreen;
if(EnableBacklight)
{
   IPC->arm7data = PM_BACKLIGHT_TOP | PM_BACKLIGHT_BOTTOM; //Swap backlights
   IPC->arm7desc = A7_POWERTOGGLE;
   while(IPC->arm9desc != A9_ACK); //Wait for ARM7 to respond
   IPC->arm9desc = 0;
}


ARM7 code, in vblank handler:
Code:
TransferRegion T;
memcpy((uint8*)&T,(uint8*)IPC,sizeof(T));
if(T.arm7desc) IPC->arm7desc = 0;

switch(T.arm7desc)
{
   [...]

   case A7_POWERTOGGLE: //Toggle device power
   SerialWaitBusy();
   REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
   REG_SPIDATA = 0x80;
   SerialWaitBusy();
   REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz;
   REG_SPIDATA = 0;
   SerialWaitBusy();
   B = REG_SPIDATA & 0xFF;

   SerialWaitBusy();
   REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
   REG_SPIDATA = 0;
   SerialWaitBusy();
   REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz;
   REG_SPIDATA = B ^ T.arm7data;
   T.arm9desc = A9_ACK;
   break;
   [...]
}
[...]
IPC->arm9desc = T.arm9desc;
IPC->arm9data = T.arm9data;

(Using a customized IPC struct. armXdata = data sent to ARMX, armXdesc = description of data.)

The flicker is even worse if I call lcdSwap() after swapping the backlights. :-/

#70931 - CubeGuy - Thu Feb 09, 2006 4:22 pm

The commercial games all flash white as well.
_________________
It's 'CubeGuy.' One word. No space.

#71049 - HyperHacker - Fri Feb 10, 2006 3:27 am

Ah, guess it can't be avoided then. No big deal.

#146178 - tepples - Fri Nov 30, 2007 2:44 am

You could always make sure to change the lighting state only on a screen that's set to black. For example, when turning off a screen, put it in these states in this order:
  1. Picture + light
  2. Black screen + light
  3. Black screen + no light
  4. No picture + no light
  5. Core turned off + no light (if necessary)

And reverse the steps to turn on a screen.


(This bump brought to you by the Search button.)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.