You are here

Private data accessors in generated APIs | Cypress Semiconductor

Private data accessors in generated APIs

Summary: 2 Replies, Latest post by KennyMillar on 16 Dec 2010 05:35 PM PST
Verified Answers: 0
Last post
Log in to post new comments.
user_93359284's picture
25 posts

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,


yfs's picture
Cypress Employee
102 posts

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


user_93359284's picture
25 posts

 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.


Log in to post new comments.