Some general rules of thumb for interrupt handlers:
- Do not use delay functions within the handler directly or indirectly (Some LCD components use delays)
- Do not wait for an event to happen (Signal ready, Timer expires)
- When appropriate: Reset the interrupt cause and set a flag (global volatile uint8 variable) which is tested in the main loop and acted upon
Keep in mind:
Any global variablewhich gets changed within an interrupt handler must be declared as "volatile"
When you find a conflicting access you may encapsulate this within a "Critical Section". See CyEnterCriticalSection() and CyExitCriticalSection() APIs.
Of course you may use interrupts of higher priority (lower numbers) than the capsense interrupt.
There is no numeric limit, but keep the handlers short.