CY4636 WirelessUSB™ LP Keyboard Mouse Reference Design Kit User Guide, Doc. # 001-70355 Rev. *A
81
Code Examples
The keyboard firmware is partitioned into two logical groups. The common group is a collection of
code modules that provide the underlying support for the application. This group provides services
such as, radio protocol, radio driver, timing, flash access, and interrupts.
The application group implements the core functionality and features of RDK wireless keyboard.
This includes power management, encryption, packet formatting and reporting, various test modes,
and battery level sensing. The code modules for each of these groups are described below in further
detail.
All of the following module descriptions have corresponding
<module name>.c,
<module
name>.asm,
and
<module name>.h
source code files. The module API and definitions are exported
in the header file while the module implementation and local definitions are contained in the C/
assembly file.
5.3.3.1
Common Code
The modules in the common code group are a combination of two sources. The first is PSoC
Designer generated files in the lib directory that have been modified to support the application. The
second group is modules that are generally used by the application.
Generated Library Code.
There are currently no files generated by PSoC Designer that are modi-
fied for the use of the application.
Radio Driver.
The radio driver module is a low level module providing basic radio communication
and configuration. Its general application is such that it is likely not to be changed by the firmware
developer. It provides an interface for reading/writing radio registers, setting PN codes and initializa-
tion of the radio and transmitting or receiving packets. See the Radio Driver documentation for
details.
Protocol Module.
The protocol module defines and implements the layer used to deliver packets
from the device to the bridge. It manages the binding of devices to a bridge as well as the connection
and interference immunity by channel hopping. This module has a dependency on the radio driver
for sending and receiving formatted packets and the flash module for storing the manufacturing ID of
the bridge the device is bound to.
Flash Module.
The flash module is a smaller version of the E2PROM module provided in PSoC
Designer. It is limited in functionality and only implements the read/write routines required by the
device. Modify the flashsecurity.txt file so that the block being modified by this module is given read/
write privilege, i.e. unprotected. Currently the two very top most blocks in flash are used by this mod-
ule. One block is used for storing the encryption key if encryption is enabled. The other block is used
to store the bind parameters.
ISR Module.
This module provides an interface to initialize the interrupt.
Timer Module.
The timer module provides a one-millisecond tick for the system. The tick resolution
can be changed, but is set for one millisecond for the keyboard. This module requires the use of a
12-bit Programmable Interval Timer user module of the enCoRe II LV. The delay function used for
millisecond timing provides at least the delay requested with no more than one additional millisecond
of delay. The millisecond delay function will sleep the PSoC for the duration of the requested delay.
The microprocessor wakes just long enough to update the tick every millisecond and check if the
delay has been met and then returns to sleep state if it has not. See the documentation in the mod-
ule for requirements on configuring the enCoRe II LV block.