The reference firmware is configured to use theGPIO pins as shown on the schematic in
appendix A. However, it may be more optimal foryou to use a different IO configuration to meet themechanical constraints of your particular PCB.The reference firmware is designed to be easilyconfigured to another set of pin connections.This is accomplished through changes in the IOdefinitions at the beginning of the combi.c listing.The following statements are the pin definitionsas they exist today. The firmware will use thesedefinitions to read and configure the GPIO pins,without any other modifications.#define OPTICS_PORTPORT0#define OPTICS_MASK
0x3f
#define GET_X_OPTICS(x) ((x >> 0)&0x3)#define GET_Y_OPTICS(x) ((x >> 2)&0x3)#define GET_Z_OPTICS(x) ((x >> 4)&0x3)#define LEFT_SWITCH_PORTPORT0#define LEFT_SWITCH_MASKBIT7#define RIGHT_SWITCH_PORTPORT1#define RIGHT_SWITCH_MASKBIT0#define MIDDLE_SWITCH_PORTPORT1#define MIDDLE_SWITCH_MASKBIT1#define PORT0_OPTICS_MASK0b00111111#define PORT1_OPTICS_MASK0b00000000#define PORT0_LED_MASK0b01000000#define PORT1_LED_MASK
0b00000000#define PORT0_SWITCH_MASK0b10000000#define PORT1_SWITCH_MASK
0b00000011
Mouse Optics
The standard way mouse optics are connectedare via two phototransistors connected in asource follower configuration. An infrared LEDshines, causing the phototransistors to turn on.In between the phototransistors and LED is apinwheel that turns on the mouse ball rollers.
The fan of this pinwheel is mechanically designedto block the infrared light such that thephototransistors are turned on and off in a
quadrature output pattern. Every change in thephototransistor outputs represents a count ofmouse movement. Comparing the last state ofthe optics to the current state derives directioninformation. As is shown in figure 2.0 below,travelling along the quadrature signal to the rightproduces a unique set of state transitions, andtravelling to the left produces another set of
unique state transitions. In this reference design,
InfraredPhoto-
Figure 2.0 Optics Quadrature Signal Generation
Mouse Buttons
Mouse buttons are connected as standardswitches. These switches are pulled up by thepull up resistors inside the microcontroller.
Normally the switches are debounced in firmwarefor 15-20ms. In this reference design there arethree switches: left, wheel, and right.
USB and PS/2 Connection
The CY7C63723 has a configuration register thatswitches control from the SIE to manual controlon the D+ and D- pins. This allows the firmwareto dynamically configure itself to operate on thebus you plug the mouse into. This way the
signaling lines for USB and PS/2 can be sharedwithout taking extra GPIO pins for PS/2
operation. The firmware for this reference designwill automatically detect the host topology (USBor PS/2) at plug-in and will configure itself foroperation on that bus.
If a USB host connection is detected then thefirmware will enable the VREG pin, such that the1.3k resistor connected to the D- line can bepulled up to 3.3V. It is this action that causes thehost to recognize that there is a low-speed USBperipheral attached.