nn::applet::CTR::IsExpectedToProcessPowerButton Function

Syntax

bool IsExpectedToProcessPowerButton(
     void
);

Arguments

None.

Return Values

A value of true indicates that the POWER Button was pressed and a value of false indicates that it was not.

Description

Finds the state of the POWER Button.

A return value of true indicates that the POWER Button was pressed. In this case, the application must immediately call the nn::applet::CTR::ProcessPowerButton function and then wait with the nn::applet::CTR::WaitForStarting function.

A value of false indicates that a POWER Button press was not detected. In this case, do nothing.

Call this function periodically (usually every frame).

Example

  if ( applet::IsExpectedToProcessPowerButton() )
  {
    applet::DisableSleep();

    // POWER Button processing (transition to HOME Menu)
    applet::ProcessPowerButton();

    // Wait
    applet::WaitForStarting();
    if ( applet::IsExpectedToCloseApplication() )  // Probably 'true'
    {
       _close_application();
    }

    // Control is unlikely to reach this point, so the lines below here can be omitted
    applet::EnableSleep();
  }

Although this function was planned to be removed in SDK 0.14.9, it was determined to be necessary upon further review of the shutdown sequence for the POWER Button. Though this is inconvenient, it is required to implement POWER Button handling.

Revision History

2011/01/24
Added mention of the DisableSleep and EnableSleep functions.
2010/12/09
This function was deemed necessary following a review of the shutdown sequence for the POWER Button.
2010/11/10
Initial version.

CONFIDENTIAL