cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ Creator & Designer

cadi_1014291
Valued Contributor

I´m checking what's new on Creator 3.3, the New Project Wizard is good, Resource-Meter is really nice (to me), but what i can't quite understand is the Macro Callbacks usage.

   

I got an interrupt component attached to an Digital Input Pin (assigned to the SW1 of the 5LP Proto Kit). With Creator 3.2 i just write this on the main.c file:

   

isr_Start();

   

and then write my custom code on the merge region on the isr.c file (i can do this on Creator 3.3 aswell) but i was looking to know how to take advantage of this "feature". Now to have the same results using Macro Callbacks i need to make this on the cyapicallbacks.h:

   

#define isr_INTERRUPT_INTERRUPT_CALLBACK

   

void isr_Interrupt_InterruptCallback(void); /* Function declaration as Creator Help says*/

   

and then need to include cyapicallbacks.h on the main.c file, plus the implementation code of the function:

   

void isr_Interrupt_InterruptCallback(void){
    SW_ClearInterrupt();
    LED_Write(~LED_Read());    
}

   

I'm using this right? What other advantages can we have with this feature?

   

Thanks in advance

   

Carlos

0 Likes
1 Solution
ETRO_SSN583
Esteemed Contributor

There is a brief description in the system reference guide, also in component author guide,

   

Creator, help menu to access both.

   

 

   

Regards, Dana.

View solution in original post

0 Likes
7 Replies
ETRO_SSN583
Esteemed Contributor

There is a brief description in the system reference guide, also in component author guide,

   

Creator, help menu to access both.

   

 

   

Regards, Dana.

View solution in original post

0 Likes
Anonymous
Not applicable

Thanks for the info.

   

I can see how the location of the callback would be fixed in component API code that *I* create, however, if I add a callback to a Cypress component, for instance, will subsequent builds leave it alone, or do I need to hide it in a "Merge Region?"

   

- Jim

0 Likes
cadi_1014291
Valued Contributor

Did a easy program and the code on the callback function is kept after newer builds, "merge region" is there just for backward compatibility.

0 Likes
Anonymous
Not applicable

I looked at it. IMHO it won't help much until cypress starts adding the hooks to the component library. But will their idea of where to add match my/our desires.

   

 

   

It will make it a little easier to take a library component, copy it, mod it for MY wanted hooks, then use it. It will make it easier to port to new releases.

   

 

   

It is more of a standard coding practice than a 'feature' like the parsing engine of regions.

   

 

   

All my opinion,

   

 

   

Ed

0 Likes
cadi_1014291
Valued Contributor

@danaaknight thanks for the help, i didn't see that documents before , just the Creator Help.

   

@psoc-ed i think i see the purpose now,  thanks for the opinion.

0 Likes
Anonymous
Not applicable

hi 

   

same thing which carlos mentioned, i used the same thing in my code can i implemnt those macros for my other functions also in creator 3.3.

   

what my question is i want to add different files for different task like for reading and computing tempereature and then displaying . i am not getting how to include those different files in main.c and how to call those functions in main.c its completely like archieving and tio bring my code to standard one plz anybody help me

0 Likes
Bob_Marlowe
Expert II

different files for different task  This is usually solved using a .h file (only Declarations, no variables except externals) and the corresponding .c file. The .h file is #included into main.c (and of course in the corresponding .c)

   

 

   

Bob

0 Likes