7 Replies Latest reply on Jun 25, 2019 5:20 AM by BragadeeshV_41

    Restarting CapSense_Start()

    YoIs_1298666

      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

        • 1. Re: Restarting CapSense_Start()
          BragadeeshV_41

          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

          • 2. Re: Restarting CapSense_Start()
            YoIs_1298666

            Hello, Bragadeesh-san,

             

            Thank you for your reply.

            For example, a refrigerator.

            It does not power off.

             

            Best regards,

            Yocchi

            • 3. Re: Restarting CapSense_Start()
              YoIs_1298666

              Hello, Bragadeesh-san,

               

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

              I want to calibrate the iDAC.

               

              Best regards,

              Yocchi

              • 4. Re: Restarting CapSense_Start()
                BragadeeshV_41

                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

                • 5. Re: Restarting CapSense_Start()
                  YoIs_1298666

                  Hello, Bragadeesh-san,

                   

                  Thank you very much for your reply.

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

                   

                  Best regards,

                  Yocchi

                  • 6. Re: Restarting CapSense_Start()
                    YoIs_1298666

                    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

                     

                     

                    • 7. Re: Restarting CapSense_Start()
                      BragadeeshV_41

                      Hi YoIs_1298666,

                       

                      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