CY8CKIT-031 PSoC® CapSense® Expansion Board Kit Guide, Doc. # 001-66474 Rev. *H
28
Code Examples
4.5
Code Example 4: SLM_I2C_Tuner
This code example can be executed in 2 ways: With Capsense Tuning (requires I2C interface using
MiniProg3) and Without Capsense Tuning (no additional requirements) i.e., the same project can be
used to demonstrate the capsense functionality as well as Capsense tuning using Tuner Helper GUI
in PSoC Creator. This is done by commenting/uncommenting the line #define ENABLE_TUNING in
the main.c file of the code example. PSoC creator does not compile the code under #ifdef (if defined)
statement when #define statement is commented (/*…… */ or //). Similarly, when the #define
statement is removed from comments, the code required for working with Tuner GUI gets compiled.
By default, the project is set to work without Capsense tuning by commenting the #define.
4.5.1
SLM_I2C_Tuning example (Without Tuning)
4.5.1.1
Project Description
This code example provides a platform to build CapSense-based projects. This project
demonstrates the use of CapSense Slider Module using Capsense_CSD component in PSoC
Creator.
When a Capsense button is touched, the corresponding LED is turned ON. If a finger is placed on
the slider, the nearest LED turns ON and the finger position is displayed on LCD. The project uses
the auto-tuning feature, which sets all CapSense parameters to the best values automatically. The
parameter settings can be monitored in the GUI but cannot be altered because they are set by auto-
tuning.
4.5.1.2
Hardware Connections
■
Connect the CapSense Linear Slider Module to connector J2 of the PSoC CapSense Expansion
Board.
■
For the PSoC Development Kit, connect J1 of the PSoC CapSense Expansion Board Kit to port A
of the development kit.
■
For the PSoC 3/5LP Development Kit, connect J1 of the PSoC CapSense Expansion Board Kit to
port E of the development kit.
■
Connect the LCD to connector P8.
■
Connect jumper J2 on the CapSense Matrix Button Slider Module to short SHIELD and SHLD.
■
Remove the SAR Bypass jumpers SAR1_BYP (J43) and SAR2_BYP (J44).
■
Build and program the code example and reset the device.
Note
See Shielding Electrode on page 31 for more details.
4.5.1.3
Verify Output
Touch any button and observe the corresponding LED turn on. Place a finger on the slider; the
nearest LED turns on and the finger position is displayed on the LCD.