cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

Anonymous
Not applicable

I am looking for the best way to create private data accessor methods in the generated APIs.

   

Here is an example of what I'm trying to do.

   

I have an ISR which is connected to digital input pin. The interrupt is called, for example, "pin_isr"
The ISR gets called on the falling edge of the digital input. So far so good.

   

Now, the ISR fills in an array of uint16's which are declared in the 'pin_isr.c' file. The declaration is in the section of the .c file bewteen #START pin_isr_intc and `#END`

   

In that same section i have the accessor method so that I can access the data, via the accessor, from inside main.c

   

Now here is the problem:

   

In order to let main.c know about the accessor method I have declared it ('prototyped' it) inside pin_isr.h - but, that file does not have any persistent areas in it, so the prototype gets lost whenever the apis get re-generated (for example it I make any changes to the schematic).

   

Is there anyway to create a 'persistent' area in the .h file, in a similar way to the #START and #END in the .c files?

   

Or, is there a better way to create accessor methods for data in the generated api files?

   

Thanks in advance,

   

Kenny.

0 Likes
Reply
2 Replies
Employee

I recommend putting the array and accessor function in a separate source file of your own. Then you can #include the .h file in pin_isr.c protected area. I'll raise your question - whether you *should* be able to put the declarations in the pin_isr.h file - with the development team though.

   

-- mgs

0 Likes
Reply
Anonymous
Not applicable

 Thanks for the fast reply.

   

I will put the array/accessors in an separate source file. It'd be interesting to hear what the dev team think.

   

-Kenny

0 Likes
Reply