Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Private data accessors in generated APIs

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Private data accessors in generated APIs
Moderator:
JFMD

Post Reply
Follow this topic



Private data accessors in generated APIs

KennyMillar posted on 16 Dec 2010 2:12 PM PST
Top Contributor
25 Forum 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,

Kenny.




Re: Private data accessors in generated APIs

yfs posted on 16 Dec 2010 03:23 PM PST
Cypress Employee
77 Forum 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

 



Re: Private data accessors in generated APIs

KennyMillar posted on 16 Dec 2010 03:35 PM PST
Top Contributor
25 Forum 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.

-Kenny






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20