Changing CapSense Scan Resolution Dynamically – KBA228336

Author: RyanZ_36          Version: **

Changing the scan resolution is a way to optimize sensitivity at run time. The scan resolution will be stored in RAM data structure of CapSense® after system initialization. The resolution for each widget will be documented in CapSense_Cofiguration.h. After changing the scan resolution, CapSense_Start() execution is not mandatory. Cypress recomends that you execute the following code to make sure raw counts and baselines are at the new correct location after changing the scan resolution.

For example, change the scan resolution of Widget Button0 from 12-bit to 13-bit:

            /* change resolution to 13u from 12u */

           CapSense_dsRam.wdgtList.button0.resolution = 13u;

            /* Execute below code to re-initialize baseline */

            CapSense_ScanAllWidgets();

            while(CapSense_NOT_BUSY != CapSense_IsBusy())

            {}

            CapSense_ProcessAllWidgets();

            CapSense_FtInitialize();

            CapSense_InitializeAllBaselines();

             /* Execute above code to re-initialize baseline */

Re-calibration is also not mandatory. After changing the scan resolution, CapSense will generate more or less raw count through double-increasing or half-decreasing the scanning time. In this procedure, IDAC doesn’t make contributions for resolution changing.

Reference Document:

PSoC 4 Capacitive Sensing (CapSense® CSD) Component Datasheet
AN85951 - PSoC® 4 and PSoC® 6 MCU CapSense® Design Guide