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

cross mob
David_Zhang
Level 5
Level 5
Distributor - Arrow(GC)
First like received 50 sign-ins 25 sign-ins

hi  infineon:

    we can find Guard Sensor configration in Capsens V2.6 , but we can't find it Capsense V7.0,  so how to add the Guard Sensor in CapsenseV7.0 ,  if shield can replace Guard sensor in Creator V4.4? Shield In Capsen V7.0.jpgGuardSensor in V2.6.jpg

0 Likes
1 Solution
PandaS
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi David,

Please refer to the code snippet below. Treat guard sensor like just another sensor. The LED only Blinks when the Guard sensor is not active. But you have to keep scanning and processing all widgets in the code even if the Guard Sensor is active.

 

for (;;)
{
            if(CY_CAPSENSE_NOT_BUSY == Cy_CapSense_IsBusy(&cy_capsense_context))
            {
    			if(Cy_CapSense_IsWidgetActive(CY_CAPSENSE_GUARDSENSOR_WDGT_ID,  &cy_capsense_context))
    			{
    				Cy_CapSense_ProcessAllWidgets(&cy_capsense_context);
    				Cy_CapSense_RunTuner(&cy_capsense_context);
    				Cy_CapSense_ScanAllSlots(&cy_capsense_context);
    			}

    			else
    			{
                /* Process all widgets */
                Cy_CapSense_ProcessAllWidgets(&cy_capsense_context);

                /* Turns LED ON/OFF based on Touchpad status */
                led_control();

                /* Establishes synchronized communication with the CapSense Tuner tool */
                Cy_CapSense_RunTuner(&cy_capsense_context);

                /* Start the next scan */
                Cy_CapSense_ScanAllSlots(&cy_capsense_context);

    			}
            }
}

 

Thanks and regards

Sobhit 

View solution in original post

0 Likes
3 Replies
PandaS
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @David_Zhang ,

In PSoC Creator 4.4 you wont find direct implementation of Guard Sensor in Configurator. You need to implement this in firmware. You need to have a separate Widget Button as "Guard Sensor" and assign it to the respective pin to which the guard sensor trace is connected. 

In main: After you perform Scan and Process on all the Widgets. Check if the Guard Sensor is active: If yes do not perform any action. Else, proceed with the responses.

Please let me know, if you need any help to implement this.

Thanks and regards

Sobhit

0 Likes
David_Zhang
Level 5
Level 5
Distributor - Arrow(GC)
First like received 50 sign-ins 25 sign-ins

Hi  sobhit:

   can you proivde the code example project to explain how to do it?

0 Likes
PandaS
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi David,

Please refer to the code snippet below. Treat guard sensor like just another sensor. The LED only Blinks when the Guard sensor is not active. But you have to keep scanning and processing all widgets in the code even if the Guard Sensor is active.

 

for (;;)
{
            if(CY_CAPSENSE_NOT_BUSY == Cy_CapSense_IsBusy(&cy_capsense_context))
            {
    			if(Cy_CapSense_IsWidgetActive(CY_CAPSENSE_GUARDSENSOR_WDGT_ID,  &cy_capsense_context))
    			{
    				Cy_CapSense_ProcessAllWidgets(&cy_capsense_context);
    				Cy_CapSense_RunTuner(&cy_capsense_context);
    				Cy_CapSense_ScanAllSlots(&cy_capsense_context);
    			}

    			else
    			{
                /* Process all widgets */
                Cy_CapSense_ProcessAllWidgets(&cy_capsense_context);

                /* Turns LED ON/OFF based on Touchpad status */
                led_control();

                /* Establishes synchronized communication with the CapSense Tuner tool */
                Cy_CapSense_RunTuner(&cy_capsense_context);

                /* Start the next scan */
                Cy_CapSense_ScanAllSlots(&cy_capsense_context);

    			}
            }
}

 

Thanks and regards

Sobhit 

0 Likes