- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Everyone,
I do not know how the following code is not working correctly. The thing is that it should be LED should ON regarding into if(CapSense_IsAnyWidgetActive()) statement but code cannot go into if(CapSense_IsAnyWidgetActive()) statement. I checked with LED_Write() function.
"if(CapSense_NOT_BUSY == CapSense_IsBusy()){
CapSense_ProcessAllWidgets();
LED_Write(LED_OFF); " working correctly. I see that LED is turn off but I said before that code cannot go into if(CapSense_IsAnyWidgetActive()) function. How can be possible? What is wrong?
Code:
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
CapSense_Start();
CapSense_ScanAllWidgets();
CapSense_RunTuner();
for(;;)
{
/* Place your application code here. */
if(CapSense_NOT_BUSY == CapSense_IsBusy()){
CapSense_ProcessAllWidgets();
LED_Write(LED_OFF);
if(CapSense_IsAnyWidgetActive()){
LED_Write(LED_ON);
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I wonder if you are calling CapSense_ScanAllWidgets()
at the end of the if (CapSense_NOT_BUSY ...) block?
something like ...
if (CapSense_NOT_BUSY == CapSense_IsBusy()) {
CapSense_ProcessAllWidgets() ;
LED_Write(LED_OFF) ;
if (CapSense_IsAnyWidgetActive()) {
LED_Write(LED_ON) ;
/* ... */
}
/* ... */
CapSense_ScanAllWidgets() ; // <-------
}
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your quick respond. Yes, I checked the section however I did not see anything wrong with my code... How my code is not working correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I wonder if you are calling CapSense_ScanAllWidgets()
at the end of the if (CapSense_NOT_BUSY ...) block?
something like ...
if (CapSense_NOT_BUSY == CapSense_IsBusy()) {
CapSense_ProcessAllWidgets() ;
LED_Write(LED_OFF) ;
if (CapSense_IsAnyWidgetActive()) {
LED_Write(LED_ON) ;
/* ... */
}
/* ... */
CapSense_ScanAllWidgets() ; // <-------
}
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Moto. You are right... I forgot to add. When I add the statement you mentioned it did work 🙂