#include <nitro/card.h>
void CARD_SetPulledOutCallback( CARDPulledOutCallback callback );
This function sets the callback function that is called when a Game Card removal is detected.
To use this function, the CARD_Init must first be called.
CARDPulledOutCallback is type of callback function callback that is defined as:
typedef BOOL ( *CARDPulledOutCallback )( void );
The callback function is not called if a value of NULL is specified in callback.
If a value of TRUE is specified in the callback return value, the function will stop after it exits from the callback (or when the power is turned off with the cover 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 prohibited.
For example, enter the following statements to display the "DON'T PULL OUT CARD" message and to stop the function when a Game Card removal is detected.
Example:
BOOL isPulledOut = FALSE;
void NitroMain( void )
{
initializeRoutine();
CARD_SetPulledOutCallback( myCallback ); // set callback
while(1)
{
usualGameProcedure();
if ( isPulledOut == TRUE ) // check if card is pulled out
{
drawMessageRoutine( "DON'T PULL OUT CARD" );
CARD_TerminateForPulledOut(); // termination
// program halted. never reached.
}
}
}
//---- callback for card pulled out
BOOL myCallback( void )
{
isPulledOut = TRUE; // remember that card is pulled out
return FALSE; // means that not terminate
}
| callback | The callback function that is called when Game Card removal detected |
None.
CARD_Init,
CARD_TerminateForPulledOut
11/10/2004 Clarified that a callback return shuts off the power if the cover is closed.
09/16/2004 Initial version.