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<h1>KPADSetBtnRepeat</h1>
13
14<h2>Syntax</h2>
15<dl><dd><pre class="construction">
16#include &lt;revolution/kpad.h&gt;
17
18void KPADSetBtnRepeat( s32 chan, f32 delay_sec, f32 pulse_sec );
19</pre></dd></dl>
20
21<h2>Arguments</h2>
22<TABLE class="arguments" border="1" >
23  <TBODY>
24    <TR>
25<TH>chan</TH>
26<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
27    </TR>
28    <TR>
29<TH>delay_sec</TH>
30<TD>Specifies the time for holding down the button before the <code>KPAD_BUTTON_RPT</code> flag is set.  </TD>
31    </TR>
32    <TR>
33<TH>pulse_sec</TH>
34<TD>If the <CODE>KPAD_BUTTON_RPT</CODE> flag is enabled <SPAN class="argument">delay_sec</SPAN> seconds after a button is pressed and held down, <SPAN class="argument">pulse_sec</SPAN> will specify the time interval (in seconds) at which the <code>KPAD_BUTTON_RPT</code> flag should be enabled thereafter.  If you do not want this flag enabled at all, set <SPAN class="argument">pulse_sec</SPAN> to 0.</TD>
35    </TR>
36  </TBODY>
37</TABLE>
38
39<h2>Return Values</h2>
40<p>None.</p>
41
42<H2>Description</H2>
43<p>
44Sets 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 <SPAN class="argument">hold</SPAN> member variable of <a href="./KPADStatus.html"><CODE>KPADStatus</CODE></a>. <SPAN class="argument">delay_sec</SPAN> seconds after a button is pressed, the <CODE>KPAD_BUTTON_RPT</CODE> flag gets set every <SPAN class="argument">pulse_sec</SPAN> 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.
45</p>
46<p>
47<code>if ( (hold &amp; (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) == (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) {Your routine}</code>
48</p>
49<p>
50Note 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. On the Wii Menu, <SPAN class="argument">delay_sec</SPAN> is set to <code>0.5</code>, and <SPAN class="argument">pulse_sec</SPAN> is set to <code>0.1</code>. Set these values to match Wii Menu behavior.
51</p>
52
53<h3>Nunchuk and Classic Controller</h3>
54<p>
55A repeat feature is available for both the Nunchuk and Classic Controller buttons. The Nunchuk as well as Wii Remote buttons are included in the <a href="./KPADStatus.html"><CODE>KPADStatus</CODE></a> structure's <SPAN class="argument">hold</SPAN> member variable; repeat management is common between the two.
56</p>
57<p>
58The Classic Controller buttons, which are included in the <a href="./KPADEXStatus.html"><CODE>KPADEXStatus</CODE></a> structure's <SPAN class="argument">hold</SPAN> member variable, can set the <CODE>KPAD_BUTTON_RPT</CODE> flag. The repeat management for the Wii Remote buttons is independent of that for the Classic Controller buttons.
59</p>
60
61<h2>See Also</h2>
62<p>None.</p>
63
64<H2>Revision History</H2>
65<P>
662008/07/08 Added information on settings in the Wii Menu.<br>2006/10/25 Revised the description to match KPAD version 2.<br>2006/03/01 Initial version.<br>
67</P>
68
69<hr><p>CONFIDENTIAL</p></body>
70</html>