74
CY4636 WirelessUSB™ LP Keyboard Mouse Reference Design Kit User Guide, Doc. # 001-70355 Rev. *A
Code Examples
MFG_TX_MODES.
When the MFG_TEST_CODE is defined, then the definition of this name adds
in a carrier and random data TX test option. See the mfgtest module for more information on these
TX modes.
DEVICE_TYPE.
This definition is used by the protocol module when filling out the packet header.
The value must be set to three for a mouse.
APP_TX_PACKET_SIZE.
This is the application payload size of the data packet. It must be set to a
value large enough to hold the largest mouse data packet. Care must be taken when setting the
value, since larger values affect memory usage. This value is used in a union with other packet types
that are used for the protocol, so the overall memory usage may be larger than what is specified
here.
APP_RX_PACKET_SIZE.
This is currently not used by the mouse, but must be set to at least one
for compilation. This value is used in a union with other packet types, so the resulting receive packet
will likely be larger than one. 3.3.7 Platform and Architecture Portability
The mouse firmware was designed to be easily ported from one hardware platform to another plat-
form with a simple re-mapping of pins on the enCoRe III LV. The file pdc9302.h maintains the pin
mapping definitions that are used throughout the code and is included in about every file by using
the macro PLATFORM_H that is defined in config.h.
Porting the code to another microprocessor architecture requires modification or leverage of the
existing code for processor specific features, along with pin definitions.
5.2.3.4
Initialization
Initialization of the enCoRe III LV chip is done by code that is generated in boot.asm by the PSoC
Designer software. The module boot.asm calls main() in the mouse module once the enCoRe III LV
has been configured and initialized.
5.2.3.5
Wireless Protocol Data Payload
The mouse protocol has been optimized to reduce the 'on-time' of the radio, which equates to
reduced power consumption. This optimization relies upon the RDK requirement of a three-button
mouse. With this requirement, it is possible to combine the z-wheel and the button report into a sin-
gle byte, allowing five bits of information for the z-wheel and three bits for the buttons.
The protocol code module offers the ability to send variable length packets, thereby allowing a
reduced number of bytes to be transmitted over the air, in order to extend battery life.
Since mouse usage data demonstrates that X, Y optical sensor data is more frequent than z-wheel
or button presses, the following transmission packet formats are implemented in this RDK. The
packet formats only show the application payload and do not show the protocol packet format.
Packet Format 1.
When there is only X, Y delta data, the transmitted packet is two bytes.
Table 5-8. Packet Format 1
Byte 1
Byte 2
X Delta (8 bits)
Y Delta (8 bits)