component creation - accessing component definitions

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

cross mob
Anonymous
Not applicable

Hi,

   

 

   

I've created my own component which internally uses an SPI master component (v2_50).

   

I've added an API and can access the functions of the SPI ok for example  `$INSTANCE_NAME`_SPI_ClearRxBuffer() works fine.

   

But using a definition of the component creates an error message - example:   `$INSTANCE_NAME`_SPI_STS_TX_FIFO_NOT_FULL would result in an error message: undeclared (first use in function).

   

If i comment out the line of code and compile the project, i can access the definition in main - auto completion shows it to exist.

   

In my component API i have included cytypes.h and cyfitter.h.

   

I've tried including <project.h> but this also causes a compile error.

   

Any help would be appreciated.

   

kind regards,

   

Damian

0 Likes
1 Solution
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

Hi damian,

   

I'm also making a component with a SPI Master in it, you can see my API implementation here:

   

https://github.com/C47D/PSoC_nRF24_CustomComponent/tree/master/nRF24.cylib/nRF24/API

   

To read the status of the SPI i'm using `$INSTANCE_NAME`_SPI_STS_SPI_IDLE, i think your `$INSTANCE_NAME`_SPI_STS_TX_FIFO_NOT_FULL is fine, maybe the problem is including the header files, i'm placing <project.h> and <cytypes.h> on the source file (funcs.c) and <cyfitter.h> on the header file (funcs.h).

   

Hope it helps

   

Carlos

View solution in original post

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

Probably not the cause, but did you #include the corresponding .h file?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

do you mean the SPI.h file? eg #include "`$INSTANCE_NAME`_SPI.h"

   

This generates an error similar to if i include the <project.h> file: Build error: the command 'arm-none-eabi-gcc.exe' failed with exit code '1'.

   

 

   

I am including my own API header file.

   

thanks,

   

Damian

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

arm-none-eabi-gcc.exe' failed with exit code '1' This error message just shows the final giving up of the compiler. Of quite more interest would be the first error that occurred in all your tries.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

Yes I've noted that usually i see more than one error but in this instance this is the only error i receive

   

regards,

   

Damian

0 Likes
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

Hi damian,

   

I'm also making a component with a SPI Master in it, you can see my API implementation here:

   

https://github.com/C47D/PSoC_nRF24_CustomComponent/tree/master/nRF24.cylib/nRF24/API

   

To read the status of the SPI i'm using `$INSTANCE_NAME`_SPI_STS_SPI_IDLE, i think your `$INSTANCE_NAME`_SPI_STS_TX_FIFO_NOT_FULL is fine, maybe the problem is including the header files, i'm placing <project.h> and <cytypes.h> on the source file (funcs.c) and <cyfitter.h> on the header file (funcs.h).

   

Hope it helps

   

Carlos

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

Hi Bob and carlos, thanks for your input.

   

I'm still having trouble with this. I've attached the workspace bundle.

   

If someone could have a look at it and give me some advise.

   

regards,

   

Damian

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

You did not #include <sx1272_SPI.h>, this should be generated automatically into your #include sx1272.h file. Inserting this manually leads to an error-free compilation, but a handful of warnings.

   

It is very uncommon to use the #ifndef - pattern for .c files, I would suggest you to use that for .h files only. Normally only the .h file is #included and the corresponding .c is handled by the compiler and its path declarations.

   

 

   

Bob

Anonymous
Not applicable

Fantastic thanks Bob, i thought i had already tried that but obviously not.

   

really appreciate it

   

regards,

   

Damian

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

You are always welcome!

   

 

   

Greetings to Down Under, where are you located?

   

Bob

0 Likes