Creator best practice with ISR

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

cross mob
Anonymous
Not applicable

Hello,

   

In the new Creator, there is the new feature to handle API callback that will handle also interrupts.

   

What will be the preferred way to code isrs:

   
        
  1. Add the code in the generated file between the defined region?
  2.     
  3. Write the external function and register it with StartEx()?
  4.     
  5. Use the cyapicallbacks.h mechanism?
  6.    
   

Best regards

   

Juan-Carlos

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Juan-Carlos!

   

The API callbacks are for some special cases where the component does not offer an interrupt signal as the I2C for instance.

   

Usually, when the component has got an interrupt signal (or an output that can be used for that purpose) as an UART or ADC you just connect an isr-component to it and configure it as rising edge. In your code you specify the interrupt handler as

   

CY_ISR_PROTO(YourHandler); // Declaration only

   

CY_ISR(YourHandler)   // Definition

   

{
// Handler code goes here
}

   

And lastly the initialization with

   

isr_StartEx(YourHandler);

   

 

   

Bob

View solution in original post

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Juan-Carlos!

   

The API callbacks are for some special cases where the component does not offer an interrupt signal as the I2C for instance.

   

Usually, when the component has got an interrupt signal (or an output that can be used for that purpose) as an UART or ADC you just connect an isr-component to it and configure it as rising edge. In your code you specify the interrupt handler as

   

CY_ISR_PROTO(YourHandler); // Declaration only

   

CY_ISR(YourHandler)   // Definition

   

{
// Handler code goes here
}

   

And lastly the initialization with

   

isr_StartEx(YourHandler);

   

 

   

Bob

0 Likes
Anonymous
Not applicable

This is a good questions. That seems no bee very consistent.

   

I have a part with a ADC component (without ISR component! - PSoC 4 Creator 3.3).

   

   

The isr is a custom isr, as Bob writes, in main.c It works well. A separate isr-component was not necessary.

   

Reiner

   

0 Likes