66
CY4636 WirelessUSB™ LP Keyboard Mouse Reference Design Kit User Guide, Doc. # 001-70355 Rev. *A
Code Examples
5.2.2.2
SPI Master User Module
The SPI Master User Module is used to communicate with both the radio and the optical sensor.
Both devices support leading edge data latching, non inverted clock, and MSB first transmission as
defaults. This module uses the VC2 clock resource of 2 MHz which is divided by two for a 1 MHz SPI
clock. For reliable operation it is not recommended to increase the SPI clock frequency. The interrupt
API to this module is not used. See the spi code module description for how this module is used to
implement communication with multiple devices on the SPI bus.
5.2.2.3
PWM User Module
The PWM User Module is configured to use the ILO oscillator (CPU 32-kHz clock). This module is
used to provide a periodic interrupt to the timer code module in order to maintain a power saving mil-
lisecond sleep routine. The period of the timer is calibrated to the system clock at power on in order
to provide a period of about 250 µs. This calibration is performed to account for variations in temper-
ature and ILO variances from part to part. The module must be configured to generate a terminal
count interrupt. The period parameter is ignored since it is programmed at run time based upon the
calibration results. See the timer code module for more details on calibration.
5.2.2.4
ADC User Module
The ADC User Module is only powered on when needed to make a battery voltage measurement.
The VC1/VC3 global clock resources are used to control the measurement timing. The PWM High
parameter must be set to 8 VC3 periods and the PWM Low parameter must be set to 1 VC3 periods.
The interrupt API must be enabled for the module to make a measurement. The battery voltage is fil-
tered and then connected to a microcontroller pin that is routed to the AnalogMUXBus, which in turn
is routed to the ADC.
5.2.2.5
Flash Security
The PSoC Designer mouse project has a file called FlashSecurity.txt. This file specifies access rules
to blocks of the Flash ROM. Refer to the documentation at the top of the file for definitions. This file
is shipped with a single change from its default configuration. The block starting at hex address
1FC0 has been changed from W: Full (Write protected) to U: Unprotected. This location of flash has
been dedicated to saving non-volatile configuration values for the protocol code module.
Note:
When building the mouse firmware, make certain to check that the text image size does not
occupy this block.