nn::applet::CTR::SetHomeButtonCallback Function

Syntax

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

Arguments

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 );
         …
  }

Revision History

2011/02/17
Added a note about the callback.
2010/11/10
Initial version.

CONFIDENTIAL