#include <cafe/vpad.h>

void VPADSetBtnRepeat( s32 chan, f32 delay_sec, f32 pulse_sec );


chan Controller number. 0 for DRC1 and 1 for DRC2.
delay_sec Specifies the time for holding down the button before the VPAD_BUTTON_RPT flag is set.
pulse_sec If the VPAD_BUTTON_RPT flag is enabled delay_sec seconds after a button is pressed and held down, pulse_sec will specify the time interval (in seconds) at which the VPAD_BUTTON_RPT flag should be enabled thereafter. If you do not want this flag enabled, set pulse_sec to 0.

Return Values



Sets the repeat feature of the digital button (described in the VPADStatus structure). When a button is pressed and held, the VPAD_BUTTON_RPT flag can be periodically enabled in the hold member variable of VPADStatus. delay_sec seconds after a button is pressed, the VPAD_BUTTON_RPT flag gets set every pulse_sec seconds. In the example shown below, a program is created (using the flags) to perform an action periodically when a button is pressed and held down.

if ( (hold & (VPAD_BUTTON_RPT | VPAD_BUTTON_A) ) == (VPAD_BUTTON_RPT | VPAD_BUTTON_A) ) {Your routine}

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

Do Not Call From

Background Do not call this function from the background.
Multiple threads This function is not thread-safe.
Multiple Cores Do not call this function from more than one Core.

Revision History

2013/05/08 Automated cleanup pass.
2011/03/30 Initial version.