-
1. Re: Capsense interrupt
JoMe_264151 Dec 7, 2014 4:14 AM (in response to frgic_297391)Welcome in the forum, Frank!°
Afaik is the capsense interrupt used for internal handlins and I am afraid that touching it might have influence on the performance. There are different approaches, but you have to keep in mind the requred timing. Reading CapSense 5 buttons takes some ms, proximity switches even longer. So you may use a timer and its interrupt to scan all your CSD-components and set a flag which can be polled in the main-loop. There is an interrupt within a M0 core that will not be used by Cypress components. It is not quite easy to use, but you can. Get hands on the "Cortex M0 Generic User's Guide" from ARM describing the core CPU in depth.
Bob
-
-
3. Re: Capsense interrupt
JoMe_264151 Dec 7, 2014 12:52 PM (in response to frgic_297391)Fine that I could be of some help.
I have red somewhere that the user of a device expects a response to an action within 200 to 300 ms or it feels like "delayed". That would give you some more time and thus freeing some more precious MIPS when you set your timer to 100 ms.
Bob
-
4. Re: Capsense interrupt
frgic_297391 Dec 7, 2014 2:28 PM (in response to frgic_297391)Hello Bob,
I set it to 250ms, and yes otherwise it will slow down the complete sytem. It makes no sense to set it faster because its not common to hit 4 buttons a second. Thanks for the tip.
Frank
-
5. Re: Capsense interrupt
tovac_285016 Feb 11, 2015 3:23 PM (in response to frgic_297391)Hi,
I am having trouble getting CapSense to work inside an interrupt unless I comment out:
// Wait for scanning
while(CapSense_IsBusy());
If I comment it out, it works fine. To those in this post who have this working (and anyone else), are you waiting for CapSense? I have tried the timer at 100 and 250ms.
Thank you,
Tom -
6. Re: Capsense interrupt
DaKn_263916 Feb 11, 2015 5:58 PM (in response to frgic_297391)Just a thought but generally speaking do not wait inside a ISR, or
for that matter create any blocking like f() calls,etc. Rather use a flag
inside ISR and process outside. You tie up the CPU if the wait f() is
blocking, and if it is not you would wind up with an imprecise wait
period.
Regards, Dana.
-
7. Re: Capsense interrupt
JoMe_264151 Feb 12, 2015 12:34 AM (in response to frgic_297391)Some more information concerning interrupts: While an interrupt is handled, all other interrupts of lower and same priority are getting postponed (this is what the priorities are good for) until the handler returns from interrupt.
This additionally shows why Dana's advice to keep handlers short and fast is more than good programming-style,
Bob
-
8. Re: Capsense interrupt
userc_38891 Nov 9, 2016 2:46 AM (in response to frgic_297391)Hello,
can anyone tell me when the internal CapSense interrrupt occurs?
I need this information to design my low power application... My approach is to put the Cpu to Sleep while CapSense is busy and would be woken up by this interrrupt.
If the interrupt occurs when CapSense read is completed, this would be perfect.
Thanks in advance
-
9. Re: Capsense interrupt
JoMe_264151 Nov 9, 2016 3:08 AM (in response to frgic_297391)You do not need to use the interrupt. When going to sleep, the CPU will be woken up by any interrupt. Check for CapSense_IsBusy() and if so, go to sleep again. Nonetheless: there is a macro callback defined "CapSense_ISR_EXIT_CALLBACK". See Creator help on how to use macro callbacks.
Bob
-
10. Re: Capsense interrupt
MaHi_2791116 Nov 30, 2019 7:09 PM (in response to frgic_297391)Hi all, JoMe_264151 you mentioned "So you may use a timer and its interrupt to scan all your CSD-components and set a flag which can be polled in the main-loop." I want to basically do the same as the above post - remove the capsense button (i have 1) and put it into an interrupt just like a mechanical button - "when button is pressed do this" - in my case iterate the mode of the device at any time whilst running my code on the device. Im new to PSOC and cant find any sample code anywhere which seems crazy as I'm sure this is a common thing.
To re-itterate when the capsense signal is "seen" itterate the mode whilst I'm running my code in the for loop of the main program.
can anyone help with sample code for this?