KPADSetBtnRepeat

C Specification

#include <revolution/kpad.h>
void KPADSetBtnRepeat( s32 chan, f32 delay_sec, f32 pulse_sec ) ;

Arguments

chan One of WPAD_CHANn values.
delay_sec Specifies how long the button must remain pressed in order to enable the KPAD_BUTTON_RPT flag. The units are seconds.
pulse_sec When the KPAD_BUTTON_RPT flag is enabled delay_sec seconds after a button is pressed and held down, pulse_sec specifies at what time interval thereafter the KPAD_BUTTON_RPT flag should be enabled. The units are seconds. If you do not want the flag raised at all, set pulse_sec to 0.

Return Values

None.

Description

Sets the repeat feature of the digital button (described in the KPADStatus structure). When a button is pressed and held, the KPAD_BUTTON_RPT flag can be periodically enabled in the hold member variable of the KPADStatus structure. After delay_sec seconds pass once a button is pressed, the KPAD_BUTTON_RPT flag is enabled every pulse_sec seconds. For example, a program can be created to perform an action periodically when a button is pressed and held down by using the flags, as shown below.

if ( (hold & (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) == (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) {Your routine}

Note that repeat settings are not maintained for each button. In this example, if another button were pressed while the A Button is held, the repeat status would be completely reset.

See Also

Revision History

03/01/2006 Initial version.