Private data accessors in generated APIs

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

cross mob
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
2 Replies