⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipod remote control protocol.mht

📁 ipodourdev_176702.rar IPOD接口资料IPODSOCKET 需要
💻 MHT
📖 第 1 页 / 共 5 页
字号:
    <TD style=3D"FONT-WEIGHT: bold; VERTICAL-ALIGN: top; TEXT-ALIGN: =
center">G3=20
      Seven Byte Code<BR></TD></TR>
  <TR>
    <TD style=3D"VERTICAL-ALIGN: top">PLAY/PAUSE<BR></TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0xFD 0xF1<BR></TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0x55 0x03 0x02 0x00 0x01 0xFA</TD></TR>
  <TR>
    <TD vAlign=3Dtop width=3D130>VOL+</TD>
    <TD style=3D"FONT-FAMILY: monospace; TEXT-ALIGN: center" =
vAlign=3Dtop>0xFF=20
      0xFD 0xF2</TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0x55 0x03 0x02 0x00 0x02 0xF9</TD></TR>
  <TR>
    <TD vAlign=3Dtop width=3D130>VOL-</TD>
    <TD style=3D"FONT-FAMILY: monospace; TEXT-ALIGN: center" =
vAlign=3Dtop>0xFF=20
      0xFD 0xF3</TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0x55 0x03 0x02 0x00 0x04 0xF7</TD></TR>
  <TR>
    <TD vAlign=3Dtop width=3D130>SKIP&gt;&gt;</TD>
    <TD style=3D"FONT-FAMILY: monospace; TEXT-ALIGN: center" =
vAlign=3Dtop>0xFF=20
      0xFD 0xF4</TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0x55 0x03 0x02 0x00 0x08 0xF3</TD></TR>
  <TR>
    <TD vAlign=3Dtop width=3D130>&lt;&lt;SKIP</TD>
    <TD style=3D"FONT-FAMILY: monospace; TEXT-ALIGN: center" =
vAlign=3Dtop>0xFF=20
      0xFD 0xF5</TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0x55 0x03 0x02 0x00 0x10 0xEB</TD></TR>
  <TR>
    <TD vAlign=3Dtop>(button release)</TD>
    <TD style=3D"FONT-FAMILY: monospace; TEXT-ALIGN: center" =
vAlign=3Dtop>0xFF=20
      0xFD 0xF0</TD>
    <TD=20
      style=3D"VERTICAL-ALIGN: top; FONT-FAMILY: monospace; TEXT-ALIGN: =
center">0xFF=20
      0x55 0x03 0x02 0x00 0x00 0xFB </TD></TR></TBODY></TABLE></P>
<P><I><FONT size=3D+3><BR>Example G2 Microcontroller Code</FONT></I> =
<BR>I made a=20
remote emulator using an Atmel AVR microcontroller. I know that doesn't =
sound=20
like a reasonable thing to do -- after all, the iPod comes with a =
perfectly=20
suitable microcontroller -- but it's a good start at the design of a =
protocol=20
translator. This only implements two buttons - forward and reverse - but =
it's=20
easily expandable. </P>
<P>The chip I picked is the Atmel ATtiny12-8PI. This is a small 8-pin =
device=20
with 6 usable I/O pins, built-in 1.2 MHz RC oscillator (factory =
calibrated to=20
=B11% accuracy), 1K of flash memory, 32 bytes of RAM, and 64 bytes of =
EEPROM. You=20
probably noticed the lack of UART - instead I'm just bit-banging the =
output.=20
It's ok for this single use, but when I eventually try to simultaneously =
receive=20
data from my car's bus, I'll have to rewrite this code. This version =
also runs=20
off of 5 volts and won't run at 3.3v, so it requires some interface =
circuitry -=20
you may want to use the 3.3v version, especially if you want to use the =
iPod's=20
power, or it's power output as a "connected" signal. </P>
<P>The schematic is pretty simple; I'll just describe how the 8 pins of =
the=20
microcontroller connect: </P>
<UL>
  <LI>pin 1 - Reset - pull up to +5v with a 50K ohm resistor&nbsp; (you =
can=20
  remove the resistor if you program this as an input, but I haven't =
done that=20
  yet)=20
  <LI>pin 2 - PB3 - reverse button. Connect with a normally-open =
pushbutton to=20
  ground. No pullup needed.=20
  <LI>pin 3 - PB4 - forward button. Connect with a normally-open =
pushbutton to=20
  ground. No pullup needed.=20
  <LI>pin 4 - ground. Besides the power supply, connecting this to the =
metal=20
  back of the iPod worked (instead of connecting to the digital ground =
in the=20
  remote connector).=20
  <LI>pin 5 - PB0 - not used=20
  <LI>pin 6 - PB1 - not used=20
  <LI>pin 7 - PB2 - output. This needs to be reduced to 3.3 volts, so I =
used a=20
  series divider - this connects to a 220 ohm resistor, which goes to =
the center=20
  of the divider, which connects through a 330 ohm resistor to ground. I =
used a=20
  10k ohm resistor from the center to the actual ipod input. This =
divider is far=20
  from optimal - it draws waay too much current (9 milliamps!), which is =
almost=20
  enough to pull the output down to 3.7 volts, almost eliminating the =
need for a=20
  divider -- but those were the spare parts I had laying around.=20
  <LI>pin 8 - +5 volts </LI></UL><A=20
href=3D"http://www.maushammer.com/systems/ipod-remote/ipodtest.asm">G2 =
source code=20
is here.</A> Read the notes in the code describing how to program the =
chip so=20
that the RC oscillator is calibrated.<BR><I><FONT size=3D+3><BR>Example =
G3=20
Microcontroller Code</FONT></I><BR>This is really similar to the G2 code =
using=20
the same microcontroller. It's got some good comments describing how it =
works=20
&amp; pinout. <A=20
href=3D"http://www.maushammer.com/systems/ipod-remote/ipodtest-g3.asm">G3=
 source=20
code here.</A><I><FONT size=3D+3><BR><BR>Others' Work</FONT></I> =
<BR>Here is <A=20
href=3D"http://stud3.tuwien.ac.at/~e0026607/ipod_remote/ipod_ap_new.html"=
>some=20
excellent work documenting the Advanced iPod Remote protocol</A> that =
allows you=20
to fetch the currently-playing data from G3 ipods.<BR><BR>Peter Tyser =
made an <A=20
href=3D"http://homepages.cae.wisc.edu/~tyser/ipod_remote.htm">awesome=20
motion-controlled ipod remote</A>! By waving his arm around he can =
control all=20
the functions - no need to remove his gloves or jacket.<BR><BR>Bernard =
Leach has=20
been tackling the iPod side of the remote interface.&nbsp; His <A=20
href=3D"http://ipodlinux.sourceforge.net/index.shtml">ipod port of =
linux</A>=20
includes a driver for the remote, where he controls a UART.&nbsp; He =
sees 4=20
interrupts, one for each byte including the messed-up 0x00 =
terminator.&nbsp;=20
When four bytes are accumulated (there seems to be no synchronization =
rule in=20
software that specifies which byte is the first; hopefully the iPod =
firmware=20
does this), the bytes are passed to this translation code:&nbsp;&nbsp; =
(version=20
0.3 shown)=20
<BLOCKQUOTE><SMALL><TT></TT></SMALL>
  <P><SMALL><TT>static int ipod_remote_buttons[] =3D {KEY_1, KEY_2, =
KEY_3, KEY_4,=20
  KEY_5};</TT> <BR><TT>static void ipod_remote_process_input(struct =
ipod_remote=20
  *ipod)</TT> <BR><TT>{</TT> =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static=20
  int last_button =3D=20
  =
0;<BR></TT>&nbsp;<BR></SMALL><SMALL><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;=20
  if ( ipod-&gt;data[2] =3D=3D 0xf0 ) {</TT>=20
  =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
  input_report_key(&amp;ipod-&gt;dev, last_button, 0);</TT>=20
  <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</TT>&nbsp; <TT>else =
{</TT>=20
  =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
  int pos =3D ipod-&gt;data[2] - 0xf1;</TT>=20
  =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
  if ( pos &gt;=3D 0&nbsp; &amp;&amp; pos &lt; 5 ) {</TT>=20
  =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  last_button =3D ipod_remote_buttons[pos];</TT>=20
  =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  input_report_key(&amp;ipod-&gt;dev, last_button, 1);</TT>=20
  =
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
  }</TT> <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</TT>=20
  <BR><TT>}</TT></SMALL></P><SMALL></SMALL></BLOCKQUOTE>He uses the =
defines KEY_1=20
... KEY_5, arbitrarily from the HP-HIL protocol rather than defining his =
own=20
incompatible values.<BR><BR><A =
href=3D"http://web.media.mit.edu/~bwhitman">Brian=20
Whitman</A> actually <A=20
href=3D"http://ipodlinux.sourceforge.net/forums/viewtopic.php?t=3D187&amp=
;start=3D16">discovered</A>=20
that pin 2 of the G3 remote was the serial port output before the =
official=20
bmw-ipod adapter (presumably) made use of it.&nbsp; <BR><BR>Christof =
Edler <A=20
href=3D"http://stud3.tuwien.ac.at/~e0026607/aap/ipod_aap.html">has been=20
experimenting</A> with the<A=20
href=3D"http://catalog.belkin.com/IWCatProductPage.process?Merchant_Id=3D=
&amp;Section_Id=3D201526&amp;pcount=3D&amp;Product_Id=3D158384">=20
Belkin voice recorder</A> and documented the serial-port handshaking =
necessary=20
to make it work.&nbsp; He has also figured out some of the more =
important pins=20
in the <A=20
href=3D"http://stud3.tuwien.ac.at/~e0026607/ipod_remote/ipod_dock_pinout.=
html">dock=20
connector</A>.&nbsp; Here's his <A=20
href=3D"http://stud3.tuwien.ac.at/~e0026607/ipod_remote/ipod_ap_new.html"=
>new=20
page</A> on the Apple protocol.<BR><BR><BR><I><FONT=20
size=3D+3><BR>Next...</FONT></I><BR>Interfacing it to my car! (current =
state of=20
that project: I wrote software to read the BMW I-BUS, but I haven't =
tested it=20
long-term to ensure that it handles noise and packet collisions =
gracefully.)<BR>
<P><BR></P>
<TABLE style=3D"MARGIN-LEFT: auto; MARGIN-RIGHT: auto; TEXT-ALIGN: left" =

cellSpacing=3D2 cellPadding=3D2 border=3D0>
  <TBODY>
  <TR>
    <TD style=3D"VERTICAL-ALIGN: top"><A=20
      =
href=3D"http://www.oreilly.com/catalog/ipodtuneshks/index.html"><IMG=20
      style=3D"BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; =
BORDER-LEFT: 0px solid; WIDTH: 127px; BORDER-BOTTOM: 0px solid; HEIGHT: =
190px"=20
      alt=3D"book picture"=20
      =
src=3D"http://www.maushammer.com/systems/ipod-remote/ipodtuneshks.gif"></=
A></TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -