which function can I use to get the DiffCounts like in CapSense Tuner?

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello,

I have implemented the CapSense CE210311 successful respectively I can touch a button and see the result with CapSense Tuner.
Now I need to read the DiffCounts like showed in Tuner see attached Picture and finally depending on the number of Counts I want switch on or off a LED.

But now I have really difficult to find the functions which gives me the DiffCounts?

thank you very much

0 Likes
1 Solution
Anonymous
Not applicable

yes, project.h is already included,

as I use CapSense with ADC, I think I should change as follow:

counts = CapSense_ADC_BUTTON0_SNS0_DIFF_VALUE; //

Edit: just tried out => that works :-), thank you very much!

View solution in original post

0 Likes
7 Replies
allenk_26
Employee
Employee
5 replies posted Welcome! First solution authored

What I know so far is that there is no specific API to access the diff-count for each buttons.

But you can get the diff-count by directly accessing the each variables.

For example, the diff-count of button0[0] is saved in CapSense_dsRam.snsList.button0[0u].diff variable and you can read it directly. Or there is a definition of CapSense_BUTTON0_SNS0_DIFF_VALUE for pointing out the same variable.

If I found the better way, I will let you know.

Thank you.

You can also access as follows:

    const CapSense_FLASH_STRUCT *ptrSnsFlash;

   

    ptrSnsFlash = &CapSense_dsFlash;

    uint32 widgetId = 0 ;

    uint32 sensorId = 0 ;

    uint32 diff;

   

    for(widgetId = 0; widgetId < CapSense_TOTAL_WIDGETS; widgetId++)

    {

        for(sensorId = 0; sensorId < ptrSnsFlash->wdgtArray[widgetId].totalNumSns; sensorId++)

        {

           diff = ptrSnsFlash->wdgtArray[widgetId].ptr2SnsRam->raw[sensorId];

        }

    }

0 Likes
allenk_26
Employee
Employee
5 replies posted Welcome! First solution authored

The definition 'CapSense_BUTTON0_SNS0_DIFF_VALUE' is defined in 'CapSense_RegisterMap.h' and CapSense_dsRam is in 'CapSense_Structure.h' and 'CapSense_Structure.c'.

To use that, you may include 'project.h'.

Please try to include that header file.

#include "project.h"

Thank you.

Allen Kim.

0 Likes
Anonymous
Not applicable

yes, project.h is already included,

as I use CapSense with ADC, I think I should change as follow:

counts = CapSense_ADC_BUTTON0_SNS0_DIFF_VALUE; //

Edit: just tried out => that works :-), thank you very much!

0 Likes

Hello,

Please upload your project. I will try with your project.

Thank you.

Allen Kim.

0 Likes
Anonymous
Not applicable

see above, it works now 🙂 - thank you for your support

0 Likes