CARD_SetPulledOutCallback

C Specification

#include <nitro/card.h>
void CARD_SetPulledOutCallback( CARDPulledOutCallback callback );
  

Arguments

callback The callback function called when Game Card removal has been detected. It is called from within the interrupt handler or the CARD_CheckPulledOut function.

Return Values

None

Description

This function sets the callback function that is called when a Game Card removal is detected.

To use this function, you must first call the CARD_Init function.

CARDPulledOutCallback is the type of callback function callback, and is defined as

typedef BOOL ( *CARDPulledOutCallback )( void );

This function does not call the callback if a NULL value is specified in the callback argument.




About Callbacks

Specify TRUE in the callback return value if the program will stop after it exits from the callback (or when the power is turned off when the cover is closed). If a value of FALSE is specified in the callback return value, the function will not stop after it exits from the callback. When you stop the function after necessary processing, call CARD_TerminateForPulledOut afterward. However, the stop process notifies the ARM7 processor using PXI. You cannot call this function from inside the callback while interrupts are disabled.

For example, use the following statements to display the "DON'T PULL OUT CARD" message and to stop the program when a Game Card removal is detected.

Example:

void NitroMain( void )
{
initializeRoutine();
CARD_SetPulledOutCallback( myCallback ); // set callback

while(1)
{
usualGameProcedure();
if ( CARD_IsPulledOut() ) // check whether card is pulled out
{
drawMessageRoutine( "DON'T PULL OUT CARD" );
CARD_TerminateForPulledOut(); // terminate
// program halted.
}
}
}

//---- callback for pulled-out card
BOOL myCallback( void )
{
return FALSE; // does not terminate
}

See Also

CARD_Init, CARD_TerminateForPulledOut, CARD_IsPulledOut, CARD_CheckPulledOut

Revision History

06/01/2005 Added information stating the callback is called from the interrupt handler.
12/16/2004 Fixed so the sample code uses CARD_IsPulledOut() .
11/10/2004 Added statement about ending processing after returning from the callback.
09/16/2004 Initial version.