17.11.2014 Views

Designing a Low-Cost USB Mouse with the Cypress Semiconductor ...

Designing a Low-Cost USB Mouse with the Cypress Semiconductor ...

Designing a Low-Cost USB Mouse with the Cypress Semiconductor ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Designing</strong> a <strong>Low</strong>-<strong>Cost</strong> <strong>USB</strong> <strong>Mouse</strong><br />

bmrequest type<br />

host to dev<br />

dev recip<br />

0x00<br />

host to dev<br />

inter recip<br />

0x01<br />

host to dev<br />

endp recip<br />

0x02<br />

dev to host<br />

dev recip<br />

0x80<br />

dev to host<br />

inter recip<br />

0x81<br />

dev to host<br />

endp recip<br />

0x82<br />

get status<br />

0x00<br />

clr feature<br />

0x01<br />

set feature<br />

0x3<br />

set addr<br />

0x05<br />

get desc<br />

0x06<br />

set desc<br />

0x07<br />

get config<br />

0x08<br />

set config<br />

0x09<br />

get inter<br />

0x0A<br />

set inter<br />

0x0B<br />

synch<br />

0x0C<br />

brequest<br />

Figure 10. <strong>USB</strong> Standard Request Parsing Structure<br />

bmrequest type<br />

host to dev<br />

inter recip<br />

0x21<br />

dev to host<br />

inter recip<br />

0xA1<br />

get_reportl<br />

0x01<br />

get_idle<br />

0x02<br />

get_protocol<br />

0x03<br />

set_reportl<br />

0x09<br />

set_idle<br />

0x0A<br />

set_protocol<br />

0x0B<br />

brequest<br />

Figure 11. <strong>USB</strong> HID Class Request Parsing Structure<br />

Data Acquisition/Transfer<br />

The firmware polls <strong>the</strong> mouse buttons and <strong>the</strong> photo transistors.<br />

The status of <strong>the</strong> buttons as well as <strong>the</strong> horizontal and<br />

vertical displacements are sent to <strong>the</strong> host using endpoint 1.<br />

When <strong>the</strong> host issues IN packets to retrieve data from <strong>the</strong><br />

device, <strong>the</strong> device returns three bytes of data as shown in<br />

Figure 12. Figure 13 illustrates response to an e14, and 15.)<br />

Bit 7 Bit 0<br />

N/A N/A N/A N/A N/A Mid Right Left Byte 0 - buttons<br />

Bit 7 Bit 0<br />

HD7 HD6 HD5 HD4 HD3 HD2 HD1 HD0 Byte 1 - Horizontal<br />

displacement<br />

Bit 7 Bit 0<br />

VD7 VD6 VD5 VD4 VD3 VD2 VD1 VD0 Byte 2 - Vertical<br />

displacement<br />

Figure 12. Data Organization for <strong>USB</strong> <strong>Mouse</strong><br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!