nn::applet::CTR::SetHomeButtonCallback Function

Syntax

void SetHomeButtonCallback(
     AppletHomeButtonCallback callback,
     uptr arg = 0
);

Parameters

Name Description
in callback Callback.
in arg Callback arguments.

Return Values

None.

Description

Sets the callback invoked when HOME is pressed.

The callback is called when a HOME Button press is detected.

A number of applet functions will not end until the process has left the callback, so promptly end the callback to reduce the risk of deadlock.

 Example

  bool myHomeButtonCallback( uptr arg, bool isActive, applet::HomeButtonState state )
  {
      NN_UNUSED_VAR(arg);

      if ( isActive )
      {
          if ( state == applet::HOME_BUTTON_SINGLE_PRESSED )
          {
             NN_LOG("HOME BUTTON is clicked.\n");
          }
          else
          {
             NN_LOG("HOME BUTTON is double-clicked.\n");
          }
          return true;
      }
      else
      {
          return false;
      }
  }

  nnMain()
  {
      applet::SetHomeButtonCallback( myHomeButtonCallback, 0 );
         …
  }

Note:

In CTR-SDK 4.0 and later versions, the double-click is no longer returned as a state parameter for the callback. The process does not enter the portion of the sample code that displays "HOME BUTTON is double-clicked." The definition for the double-click itself remains for purposes of compatibility, but in the future it might be deleted.

Revision History

2012/02/01
Noted that the double-click is no longer returned in CTR-SDK 4.0 and later versions.
2011/02/17
Added a note about the callback.
2010/11/10
Initial version.

CONFIDENTIAL