Restarting CapSense_Start()

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

cross mob
YoIs_1298666
Level 5
Level 5
250 sign-ins 100 replies posted 100 sign-ins

Hello,

If the PSoC4000S for CapSense can not powered off, we would like to restart CapSense on a regular basis.

If CapSens_Start() function is restarted, where should we insert it?

I think that this is the absolute best, right?

    for(;;)

    {

        /* Process data for previous scan and initiate new scan only when

         * the CapSense hardware is idle */

        if(CapSense_NOT_BUSY == CapSense_IsBusy())

        {  

            CapSense_ProcessAllWidgets();      /* Process data for all widgets */

           

            /* Check if the button sensor is active. */

            buttonState  = (bool)CapSense_IsSensorActive(

                                                      CapSense_BUTTON0_WDGT_ID,

                                                      CapSense_BUTTON0_SNS0_ID

                                                        );           

            /* Control LED based on state of the button sensor */

            if(buttonState)

            {

                Pin_LED_Write(LED_ON);      /* Turn ON Active-Low LED */

            }

            else

            {

                Pin_LED_Write(LED_OFF);      /* Turn OFF Active-Low LED */  

            }

            if (..........)

                {         

                     CapSense_Start();                  /* Initialize CapSense Component  on a regular basis*/       

                }

            /* Sync CapSense parameters with those set via CapSense tuner before  * the beginning of new CapSense scan */

            CapSense_RunTuner();

            /* Initiate new scan for all widgets */

            CapSense_ScanAllWidgets();

        }

    }

Best regards,

Yocchi

0 Likes
1 Solution

Hello, Bragadeesh-san,

We want to use  CapSense_Start(). Or if CapSense_CSDCalibrateWidget API is used to calibrate the arbitarary percentage,

We should program like below because re-initialize baselines and all the firmware filter history.

Is this correct?

                    CapSense_CSDCalibrateWidget(

                                                CapSense_BUTTON0_WDGT_ID,

                                                CALIBRATION_TARGET_60_PERCENT

                                                );

                    CapSense_ScanAllWidgets();

                    /* Wait for scan to finish. */

                    while(CapSense_NOT_BUSY != CapSense_IsBusy())

                    {           

                    }

                    CapSense_FtInitialize();

                    CapSense_InitializeAllBaselines();

Best regards,

Yocchi

View solution in original post

0 Likes
7 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Dear Yocchi-san,

Can you please let me know more about your application so that we can suggest you the best option? When and why do you want to restart the Capsense component?

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hello, Bragadeesh-san,

Thank you for your reply.

For example, a refrigerator.

It does not power off.

Best regards,

Yocchi

0 Likes

Hello, Bragadeesh-san,

In case of increasing the parasitic capacitance of flexible PCB sensor.

I want to calibrate the iDAC.

Best regards,

Yocchi

0 Likes

Dear Yoshi-san,

Do you need to re-calibrate the sensors when there is a Cp change in the buttons due to environmental changes? If that is the case, you can turn on IDAC auto-calibration and use CapSense_CSDCalibrateWidget() to dynamically change calibration percent.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hello, Bragadeesh-san,

Thank you very much for your reply.

Why don't you want to execute CapSense_Start()?

Best regards,

Yocchi

0 Likes

Hello, Bragadeesh-san,

We want to use  CapSense_Start(). Or if CapSense_CSDCalibrateWidget API is used to calibrate the arbitarary percentage,

We should program like below because re-initialize baselines and all the firmware filter history.

Is this correct?

                    CapSense_CSDCalibrateWidget(

                                                CapSense_BUTTON0_WDGT_ID,

                                                CALIBRATION_TARGET_60_PERCENT

                                                );

                    CapSense_ScanAllWidgets();

                    /* Wait for scan to finish. */

                    while(CapSense_NOT_BUSY != CapSense_IsBusy())

                    {           

                    }

                    CapSense_FtInitialize();

                    CapSense_InitializeAllBaselines();

Best regards,

Yocchi

0 Likes

Hi user_483038750​,

Yes, your implementation is correct. But I still don't understand your requirement. Please let me know if I have understood your problem correctly.

Your system is in a always ON state. In that case you wish to reinitialize CapSense component because you might have a Cp change due to environment condition? Please explain why you want to re-initialize CapSense component.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes