int input_event( const input_event_t *event ) { switch( event->type ) { case INPUT_EVENT_KEYPRESS: return keypress( &( event->types.key ) ); case INPUT_EVENT_KEYRELEASE: return keyrelease( &( event->types.key ) ); case INPUT_EVENT_JOYSTICK_PRESS: return do_joystick( &( event->types.joystick ), 1 ); case INPUT_EVENT_JOYSTICK_RELEASE: return do_joystick( &( event->types.joystick ), 0 ); } ui_error( UI_ERROR_ERROR, "unknown input event type %d", event->type ); return 1; }
/****************************************************************** * This is the main code where everything should go, * All program function is directed by this code *****************************************************************/ void main(void) { char key1; systemInitialize(); //Run system initialization updateDisplay(); //Print out the display TIMER_COUNT = 0; // INITIALIZE TIMER_COUNT TO 0 while(1) // this is and infinite while loop { /* OK. 1ms gone by. Let's see if user pressed the A key or the B key. */ key1 = getkey(); // go check for keypress if(key1 < 0x1f) // did we get a key? If so, do the next three statements { keyrelease(); //check for keyrelease delay(); //short delay while((PORTTi & 0x08)); // if column 3 is HIGH wait here until LOW if(key1 >= 10) //Did user press anything above 9? { if(key1==10) // If user pressed A do the following { PAUSE=~PAUSE; // Compliment the Start/Stop flag. //IF COUNT VALUE IS 0, AND WE'RE STARTING TO COUNT DOWN, SET IT TO 99 if (COUNT_VALUE==99) COUNT_VALUE = 0;/ updateDisplay(); //Print out the display } if(key1==11) // If user pressed B do the following { DIRECTION=~DIRECTION; // Compliment the Up/Down flag. //IF COUNT VALUE IS 0, AND WE'RE STARTING TO COUNT DOWN, SET IT TO 99 if (COUNT_VALUE==0) COUNT_VALUE = 99; updateDisplay(); //Print out the display } }