Cypress CapSense Middleware Library
Cypress CapSense Middleware Library

CapSense is a Cypress capacitive sensing solution. Capacitive sensing can be used in a variety of applications and products where conventional mechanical buttons can be replaced with sleek human interfaces to transform the way users interact with electronic systems. These include home appliances, and automotive, IoT, and industrial applications. CapSense supports multiple interfaces (widgets) using both CSX and CSD sensing methods with robust performance.

CapSense has become a popular technology to replace conventional mechanical- and optical-based user interfaces. There are fewer parts involved, which saves cost and increases reliability with no wear-and-tear. The main advantages of CapSense compared with other solutions are: robust performance in harsh environmental conditions and rejection of a wide range of external noise sources.

Use CapSense for:

  • Touch and gesture detection for various interfaces
  • Proximity detection for innovative user experiences and low-power optimization
  • Contactless liquid-level sensing in a variety of applications
  • Touch-free operations in hazardous materials

General Description

The CSD HW block enables multiple sensing capabilities on PSoC devices including self-cap and mutual-cap capacitive touch sensing solution, a 10-bit ADC, IDAC, and Comparator. The CSD driver is a low-level peripheral driver, a wrapper to manage access to the CSD HW block. Each middleware access to the CSD HW block is through the CSD Driver.

The CSD HW block can support only one function at a time. However, all supported functionality (like CapSense, ADC, etc.) can be time-multiplexed in a design. I.e. you can save the existing state of the CapSense middleware, restore the state of the ADC middleware, perform ADC measurements, and then switch back to the CapSense functionality. For more details and code examples refer to the description of the Cy_CapSense_Save() and Cy_CapSense_Restore() functions.

capsense_solution.png
CapSense Solution

This section describes only CapSense middleware. Refer to the corresponding sections for documentation of other middleware supported by the CSD HW block.

A CapSense solution includes:

  • The CapSense Configurator tool, which is a configuration wizard to create and configure CapSense widgets. It could be launched in ModusToolbox from the CSD personality as well as in standalone mode. It contains a separate document about how to create and configure widgets, parameters and algorithm descriptions.
  • API to control the design from the application program. This documentation describes API with code snippets of how to use them.
  • The CapSense Tuner tool for real-time tuning, testing, and debugging, for easy and smooth designing of human interfaces on customer products. The Tuner tool communicates with a device through a HW bridge and communication drivers (EzI2C, UART, etc.) and allows to monitor widget statuses, sensor signals, detected touch positions, gestures, etc. The application program does not need to interact with the CSD driver and/or other drivers such as GPIO, SysClk directly. All of that is configured and managed by middleware.

Include cy_capsense.h to get access to all functions and other declarations in this library. If you are using the ModusToolbox CapSense Configurator tool, you can include cycfg_capsense.h only.

Features

  • Offers best-in-class signal-to-noise ratio (SNR)
  • Supports Self-Capacitance (CSD) and Mutual-Capacitance (CSX) sensing methods
  • Features SmartSense auto-tuning technology for CSD sensing to avoid complex manual tuning process
  • Supports various Widgets, such as Buttons, Matrix Buttons, Sliders, Touchpads, and Proximity Sensors
  • Provides ultra-low power consumption and liquid-tolerant capacitive sensing technology
  • Contains the integrated graphical CapSense Tuner tool for real-time tuning, testing, and debugging
  • Provides superior immunity against external noise and low-radiated emission
  • Offers best-in-class liquid tolerance
  • Supports one-finger and two-finger gestures

Summary of Application Programming Interface (API)

The CapSense operates on the top of the CapSense Sigma Delta (CSD) driver. Refer to the PDL API Reference Manual.

This document provides descriptions of the functions in the CapSense middleware library, and descriptions of the data structures (register map) used by the middleware library.

The Application Programming Interface (API) routines allow controlling and executing specific tasks using the CapSense middleware. The CapSense API is described in the following sections:

MISRA-C Compliance

MISRA Rule Rule Class (Required/Advisory) Rule Description Description of Deviation(s)
11.4 A A conversion should not be performed between a pointer to object and an integer type. Such conversion is performed with CapSense context in two cases: interrupt handler and DeepSleepCallback function. Both cases are verified on correct operation.
12.13 A The increment (++) and decrement (–) operators should not be mixed with other operators in an expression. These violations are reported for the GCC ARM optimized form of the "for" loop that have the following syntax: for(index = COUNT; index –> 0u;) It is used to improve performance.
1.2 R Constant: Dereference of NULL pointer. These violations are reported as a result of using of offset macros of CSD Driver with corresponding documented violation 20.6. Refer to CSD Driver API Ref Guide.
20.3

More Information

Important information about the CapSense-technology overview, appropriate Cypress device for the design, CapSense system and sensor design guidelines, different interfaces and tuning guidelines necessary for a successful design of a CapSense system is available in the Getting Started with CapSense document and the product-specific CapSense design guide. Cypress highly recommends starting with these documents. They can be found on the Cypress web site at www.cypress.com. For details about application notes, code examples, and kits, see the References section in this datasheet.

For more information, refer to the following documents:

Changelog

VersionChangesReason for Change
1.20 Added ARMC6 compiler support Feature enhancement
Changed the hierarchy of the binary files folders MBED OS compatibility
1.1

The following functions made obsolete:

Two simple functions introduced to replace the listed above functions:

User experience improvement
Fixed the shield operation when Csh is disabled Defect fixing
Fixed the implementation of the position filtering for the Radial Slider widget Defect fixing
Added restoring hardware to its default state in the Cy_CapSense_DeInit() implementation Defect fixing
Added the capability to enable the shield electrode without dedicated electrodes Feature enhancement
Added support of a protocol-agnostic tuner interface (UART, SPI, etc.) Feature enhancement
1.0 The initial version