Where does PSoC Creator expect to find function prototypes?

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

cross mob
Anonymous
Not applicable

Coming from the world of TI, there was a (obscure) place on my C: drive where I could go to explore .c and .h files that my programs typically depended on. This is the place where the IDE goes when you declare include <foo.h>. Where does PSoC Creator look?

   

This question came about because, going through PSoC Creator 101 lesson 6, the second I stuck CapSense_CheckIsWidgetActive() in main.c, I got the the error message "implicit declaration of function 'CapSense_CheckIsWidgetActive' is invalid in C99". And I an stuck on how to fix it.

0 Likes
10 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Being a bit on the light side in C I put them before main() in

   

main.c

   

 

   

Maybe Bob can comment on this but I also think you can put them

   

in a .h file and #include that file before main() ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

That is where C expects to find prototype includes. PSoC Creator tells the compiler where to look for the included .h file which  has to sit somewhere. Where?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

With freedom comes responsibility...

   

A .h-file (and a .c-file,too) can be put anywhere in windows file-system, even on a network drive. Creator remembers the place of the file, only the compiler has to be told where additionally to search for #included files.

   

When a new file is created for a project it is put into a default place regardless of its type. Best practice is to right click in workspace explorer on the file class (Header Files, Source Files etc) and under "New Item..." select the appropiate file type.

   

Although the workspace explorer shows something like a directory structure, this does not reflect the real world, it only shows containers Creator keeps for you.

   

 

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The CapSense prototypes are to be found in the container "Generated Files" and are physically a bit buried in the project's structure, but there is bo need to access any of them from the window's side, only from Creator.

   

Your error shows that the named function was not found. This error usually comes from different names used in schematic and main(). When a new component is placed, a "_n" where n is a number starting with 1,  is appended to the name. This is done to allow placing multiple components of the same type. This name must match with the names of the APIs for the component, so it is quite common to change the component's name to something more appropiate.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 The compiler (or is it the IDE - I have not even compiled yet) is complaining about CapSense_CheckIsWidgetActive(). This complaint appeared even before I inserted a widget (pin) inside the partentheses. I'll fight the widget namng battle (if I must), when I get to it, which is not yet.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When you haven't compiled yet, the component's files are not generated yet, so that will be one reason for the error hint in the IDE.

   

For more help, post your complete project here, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 I got around that error by selecting the drop-down menu item which changed CapSense_CheckIsWidgetActive to CapSense_CSD_CheckIsWidgetActive (whatever CSD means). Same for the widget (pin) name. Now I have a similar problem setting the PWM duty cycle. This time the drop-down menu did not help me, but I did paste it in directly from the data sheet. So I archived and attached the project. For some reason it is missing (something).hex file, so it might not open as a project, but main.c is there.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

change #include <device.h> to #include <project.h>

   

your PWM is named LED_CONTROL, so change TCPWM_WriteCompare() to LED_CONTROL_WriteCompare()

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks for your help, Bob. My project compiles now, and I learned a lot. Now I just need to get the buttons working, but I should start a separate thread for that. Until then, I am learning the debug functions PSoC Creator.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Good idea!

   

See you in the next thread.

   

 

   

Bob

0 Likes