/*---------------------------------------------------------------------------* Project: Revolution alarm demo File: alarm.c Programmer: HIRATSU Daisuke Copyright 2006 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Log: alarm.c,v $ Revision 1.1 07/04/2006 08:55:21 hiratsu This demo tells how to use OSSet/GetAlarmUserData(). $NoKeywords: $ *---------------------------------------------------------------------------*/ #include #define ALARMS 3 static void handler(OSAlarm* alarm, OSContext*) { char *msg = (char*)OSGetAlarmUserData( alarm ); OSReport( "Message: %s\n", msg ); } int main(void) { int i = 0; OSAlarm alarm[ALARMS]; const char* MSG[ALARMS] = { "1st alarm", "2nd alarm", "last alarm" }; for(i = 0; i < ALARMS; ++i) { OSCreateAlarm( &alarm[i] ); OSSetAlarmUserData( &alarm[i], (void*)MSG[i] ); OSSetAlarm( &alarm[i], OSSecondsToTicks( i+1 ), handler ); } while(1) ; return 0; // Never reach here. }