Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Changing CapSense Widget Sensitivity/Finger Capacitance During Run Time - KBA222623

Changing CapSense Widget Sensitivity/Finger Capacitance During Run Time - KBA222623

Community-Team
Employee
Employee
50 questions asked 10 questions asked 5 questions asked

Version: **

Translation - Japanese: 実行時のCapSenseウィジェットの感度/指の静電容量の変更 - KBA222623 - Community Translated (JA)

Question:

How can I dynamically change the sensitivity or finger capacitance of a widget through firmware when SmartSense autotune mode is used in CapSense® Component version 3.0 and above?

Answer:

Follow these steps to dynamically change the sensitivity or finger capacitance of a widget through firmware:

1. Make sure SmartSense auto-tuning mode is enabled in the component. To do this, perform the following steps:

  1. Right-click the CapSense Component in the top design, and click Configure to open the CapSense component configuration window.
  2. Go to the Basic tab. Select SmartSense (Full Auto-Tune) from the CSD tuning mode drop-down list. This drop-down list will be enabled only if at least one widget is added.

pastedImage_7.png

2. In the main.c file, call the following API after the Component start API CapSense_Start ().

     CapSense_SetParam (uint32 paramId, uint32 value)

           Use the following parameters as arguments for this API:

      • paramId – CapSense_Button0_FINGER_CAP_PARAM_ID

                        Note the usage of the widget name Button0 in the paramId. CapSense component generates paramId for each widget.

      • value – New finger capacitance value, in multiples of 20

                       100 corresponds to 0.1 pF finger capacitance, 120 corresponds to 0.12 pF finger capacitance, and so on.

           The range of finger capacitance in SmartSense (Full Auto-Tune) mode is 0.1 pF to 1 pF

3. Start the component again so that the new Finger Capacitance value takes effect. Scan and process the CapSense widgets according to your end application.

Here is an example code for main.c:

#include "project.h"

#define BUTTON0_FINGER_CAPACITANCE  (100u) /* unit - femto farads */

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

  

CapSense_Start(); /* Start the CapSense component. */   

   

     /* API to change the value of finger capacitance. */

CapSense_SetParam (CapSense_BUTTON0_FINGER_CAP_PARAM_ID, BUTTON0_FINGER_CAPACITANCE);

CapSense_Start();

CapSense_ScanAllWidgets();

  

    for(;;)

    {

if (!CapSense_IsBusy())

{

CapSense_ProcessAllWidgets();

}

CapSense_ScanAllWidgets();

    }

}

0 Likes
656 Views
Contributors