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
15<H2>C Specification</H2>
16<DL>
17  <DD>
18<PRE><code>#include &lt;revolution/wpad.h&gt;
19
20#define WPAD_CHAN0               0
21#define WPAD_CHAN1               1
22#define WPAD_CHAN2               2
23#define WPAD_CHAN3               3
24
25typedef void (* WPADSamplingCallback )( s32 chan );
26
27WPADSamplingCallback WPADSetSamplingCallback( s32 chan, WPADSamplingCallback callback );</code></PRE>
28</DL>
29<H2>Arguments</H2>
30<TABLE border="1">
31  <TBODY>
32    <TR>
33<TD width="120" bgcolor="#ffffe8"><code><b><i>chan</i></b></code></TD>
34<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
35    </TR>
36    <TR>
37<TD width="120" bgcolor="#ffffe8"><CODE><b><i>callback</i></b></CODE></TD>
38<TD>The callback function that indicates receipt of data from the Wii Remote.</TD>
39    </TR>
40  </TBODY>
41</TABLE>
42<H2>Return Values</H2>
43<P>Pointer to the most recently registered callback function.</P>
44<H2>Description</H2>
45<p>
46Registers the callback function that notifies the receipt of data by the Wii Remote Control at the specified channel. If NULL is specified, no notifications are made until reset.
47</p>
48<p>
49Although 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 electromagnetic conditions.
50</p>
51<p>
52Please 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.
53</p>
54<p>
55Note that the registered callback function is cleared in the following cases.
56</p>
57<ul>
58<li>Controller is connected</li>
59<li>Communication with the controller is lost</li>
60</ul>
61
62
63<H2>See Also</H2>
64<p>
65<A href="./toc.html" target="contents">WPAD Function></A><br> <a href="./WPADStartFastSyncDevice.html"><code>WPADStartFastSyncDevice</code></a>, <a href="./WPADStartFastSimpleSync.html"><code>WPADStartFastSimpleSync</code></a><br>
66</p>
67
68<H2>Revision History</H2>
69<p>
702006/10/06 Mentioned that the callback function is cleared when a controller is connected.<br>2006/09/18 Added notes for calling the <a href="./WPADStartFastSyncDevice.html"><code>WPADStartFastSyncDevice</code></a> or <a href="./WPADStartFastSimpleSync.html"><code>WPADStartFastSimpleSync</code></a> functions.<br>2006/08/15 Added descriptions regarding callback function call intervals. Removed mention of callback function being cleared at insertion/removal of External Extension Controller.<br>2006/06/19 Changed the name of the game remote. Changed the description to match the product specification.<br>2005/11/01 Added <code>WPAD_CHAN<i>n</i></code> macro. Revised the sampling cycle to one of the approximately 4ms.<BR>2005/08/01 Initial version.<br>
71</p>
72<hr>
73<P>CONFIDENTIAL</p>
74</BODY>
75</HTML>