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<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
8<TITLE>WPADSetSamplingCallback</TITLE>
9</HEAD>
10<BODY>
11
12<H1>WPADSetSamplingCallback</H1>
13
14<H2>Syntax</H2>
15<dl><dd><pre class="construction">
16#include &lt;revolution/wpad.h&gt;
17
18#define WPAD_CHAN0               0
19#define WPAD_CHAN1               1
20#define WPAD_CHAN2               2
21#define WPAD_CHAN3               3
22
23typedef void (* WPADSamplingCallback )( s32 chan );
24
25WPADSamplingCallback WPADSetSamplingCallback( s32 chan, WPADSamplingCallback callback );
26</pre></dd></dl>
27
28<H2>Arguments</H2>
29<TABLE class="arguments" border="1" >
30  <TBODY>
31    <TR>
32<TH>chan</TH>
33<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
34    </TR>
35    <TR>
36<TH>callback</TH>
37<TD>The callback function that indicates receipt of data from the Wii Remote.</TD>
38    </TR>
39  </TBODY>
40</TABLE>
41
42<H2>Return Values</H2>
43<P>Pointer to the most recently registered callback function.</P>
44
45<H2>Description</H2>
46<p>
47Registers the callback function that notifies the receipt of data by the Wii Remote at the specified channel. If <CODE>NULL</CODE> is specified, no notifications are made until reset.
48</p>
49<p>
50Although the Wii Remote sends data to the Wii console approximately every five milliseconds, be sure to note that due to Wii hardware specifications, the registered callback function is not called at even intervals every 5 milliseconds, but rather is called at an interval of four milliseconds, then six milliseconds, then four milliseconds, then six milliseconds, and so on. Further note that the registered callback function is not always called at this interval due to the fact that the data frame from the Wii Remote may not be received by the Wii console depending on ambient radio signal conditions.
51</p>
52<p>
53Please note that when the <a href="./WPADStartFastSyncDevice.html"><code>WPADStartFastSyncDevice</code></a> or <a href="./WPADStartFastSimpleSync.html"><code>WPADStartFastSimpleSync</code></a> function is called, the data transfer with the Wii Remote will change from a fixed-interval communication to a best-effort communication. The registered callback function will not be called at fixed intervals.
54</p>
55<p>
56Note that the registered callback function is cleared in the following cases.
57</p>
58<ul>
59<li>Controller is connected</li>
60<li>Communication with the controller is lost</li>
61</ul>
62
63<H2>See Also</H2>
64<p class="reference">
65<a href="./WPADStartFastSyncDevice.html">WPADStartFastSyncDevice</a>,
66<a href="./WPADStartFastSimpleSync.html">WPADStartFastSimpleSync</a>
67</p>
68
69<H2>Revision History</H2>
70<p>
712006/10/05 Added mention that the buffer is cleared when a controller is connected.<br>2006/09/18 Added notes for calling the <a href="./WPADStartFastSyncDevice.html"><code>WPADStartFastSyncDevice</code></a> and <a href="./WPADStartFastSimpleSync.html"><code>WPADStartFastSimpleSync</code></a> functions.<br>2006/08/15 Added descriptions regarding callback function call intervals. Removed mention of the callback function being cleared when the external extension controller is inserted or removed.<br>2006/06/19 Changed the name of the game remote control; changed explanations to product specifications.<br> 2005/11/01 Added the <CODE>WPAD_CHAN<i>n</i></CODE> macro. Revised the sampling cycle to be a 4ms cycle.<br>2005/08/01 Initial version.<br>
72</p>
73
74<hr><p>CONFIDENTIAL</p></body>
75</HTML>