// HEL Library \\

 
Main Page | Modules | Related Pages

Pad Functions

The Pad-System is intended to indicate if a button is pressed or held. It supports two behaviours for the so called 'pressed state', which is either set when the button is pushed or released. More...

Functions

Variables


Detailed Description

The Pad-System is intended to indicate if a button is pressed or held. It supports two behaviours for the so called 'pressed state', which is either set when the button is pushed or released.


Function Documentation

void hel_PadInit void   ) 
 

Initialize the pad system.

Call this once at the beginning, to initialize the pad system. The pad behaviour is set to PAD_BEHAVIOUR_PRESSED_ON_BUTTON_UP.

See also:
hel_PadReset, hel_PadReadState

void hel_PadReadState void   ) 
 

Read pad state.

The hel_PadReadState function should be called once per frame only.

After calling the hel_PadReadState function, the global variable hel_Pad holds the current states.

See also:
hel_PadInit, hel_PadReset

void hel_PadReset void   ) 
 

Reset the pad system.

Call this to clear the pad states in the global variable hel_Pad

See also:
hel_PadInit, hel_PadReadState

void hel_PadSetBehaviour u32  NewBehaviour  ) 
 

Set Pad behaviour.

The Pad-Behaviour has only impact on the 'Pressed' state. It can be specified if a padbutton is pressed when it is pushed (button down) or released (button up).

Parameters:
NewBehaviour Specifies the new behaviour. This must be one of these defines:
  • PAD_BEHAVIOUR_PRESSED_ON_BUTTON_UP
  • PAD_BEHAVIOUR_PRESSED_ON_BUTTON_DOWN
See also:
hel_PadReadState


Variable Documentation

TPad hel_Pad
 

Variable which holds the Pad states.

After hel_PadReadState has been called, the variable hel_Pad holds the current pad states.

Here is a tiny example program:

void main()
{
    // Initialize pad system
    hel_PadInit();

    // Set pad behaviour
    hel_PadSetBehaviour(PAD_BEHAVIOUR_PRESSED_ON_BUTTON_DOWN);
    
    
    // Infinite loop
    while(TRUE)
    {
        // Make sure its a new frame
        if(IsNewFrame)
        {
            // Read pad states
            hel_PadReadState();

            // Access pad variable
            // Check if button down has been pressed
            if(hel_Pad.Pressed.Down)
            {
                Go_One_Menu_Item_Down();
            }
            else
            if(hel_Pad.Pressed.Up)
            {
                Go_One_Menu_Item_Up();
            }

            IsNewFrame = FALSE;
        }
    }

    // reset pad system
    hel_PadReset();
}


Generated on Sun May 22 18:53:56 2005 by DoxyGen 1.3.9.1