1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META http-equiv="Content-Style-Type" content="text/css"> 6<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 7<title>KPADSetBtnRepeat</title> 8</head> 9 10<body> 11 12 13 14<h1>KPADSetBtnRepeat</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20<dd><pre><code>#include <revolution/kpad.h></code></pre> 21 </dd> 22<dd><pre><CODE>void KPADSetBtnRepeat( s32 chan, f32 delay_sec, f32 pulse_sec ) ;</CODE></pre> 23 </dd> 24</dl> 25 26<h2>Arguments</h2> 27<p> 28<TABLE border="1"> 29 <TBODY> 30 <TR> 31<TD><code><b><i>chan</i></b></code></TD> 32<TD>One of <code>WPAD_CHAN<i>n</i></code> values.</TD> 33 </TR> 34 <TR> 35<TD><CODE><b><i>delay_sec</i></b></CODE></TD> 36<TD>Specifies how long the button must remain pressed in order to enable the <CODE>KPAD_BUTTON_RPT</CODE> flag. The units are seconds.</TD> 37 </TR> 38 <TR> 39<TD><CODE><b><i>pulse_sec</i></b></CODE></TD> 40<TD>When the <CODE>KPAD_BUTTON_RPT</CODE> flag is enabled <code><EM><STRONG>delay_sec</STRONG></EM></code> seconds after a button is pressed and held down, <code><EM><STRONG>pulse_sec</STRONG></EM></code> specifies at what time interval thereafter the <CODE>KPAD_BUTTON_RPT</CODE> flag should be enabled. The units are seconds. If you do not want the flag raised at all, set <code><EM><STRONG>pulse_sec</STRONG></EM></code> to 0.</TD> 41 </TR> 42 </TBODY> 43</TABLE> 44</p> 45 46<h2>Return Values</h2> 47<p>None.</p> 48 49<H2>Description</H2> 50<p> 51Sets the repeat feature of the digital button (described in the <a href="./KPADStatus.html"><CODE>KPADStatus</CODE></a> structure). When a button is pressed and held, the <CODE>KPAD_BUTTON_RPT</CODE> flag can be periodically enabled in the <CODE>hold</CODE> member variable of the <a href="./KPADStatus.html"><CODE>KPADStatus</CODE></a> structure. After <code><EM><STRONG>delay_sec</STRONG></EM></code> seconds pass once a button is pressed, the <CODE>KPAD_BUTTON_RPT</CODE> flag is enabled every <code><EM><STRONG>pulse_sec</STRONG></EM></code> 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: 52</p> 53<p> 54<code>if ( (hold & (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) == (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) {Your routine}</code> 55</p> 56<p> 57Note that 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. 58</p> 59 60<h3>Nunchuk and Classic Controller</h3> 61<p> 62A repeat feature is similarly available for the Nunchuk and Classic Controller buttons. The Nunchuk button is included in the <a href="./KPADStatus.html">KPADStatus</a> structure 'hold' member variable just like the Wii Remote, and the repeat management will be common with the Wii Remote. 63</p> 64<p> 65The Classic Controller button is included in the <a href="./KPADEXStatus.html">KPADEXStatus</a> structure 'hold' member variable, and is able to set the <CODE>KPAD_BUTTON_RPT</CODE> flag. The repeat management of the Wii Remote buttons and the Classic Controller buttons are independent of each other. 66</p> 67 68<h2>See Also</h2> 69 70<H2>Revision History</H2> 71<P> 722006/10/25 Revised description to match KPAD version 2.<br>2006/03/01 Initial version.<br> 73</P> 74 75</body> 76</html>