Component Creation | Schematic implementation | API Generation

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

cross mob
lock attach
Attachments are accessible only for community members.
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

Hi all, i´m trying to create my first component (a nRF24), so i did the symbol, and schematic implementation (see attached), until here is where the video tutorials guide me, so reading the component author guide is how i'm trying to make the API´s, i added the .h and .c files, same name on both (nRF24).

   

Here is where the questions begins:

   

- Section 6.4 of the component author guide says i should include references to the cyfitter.h and cytypes.h files, i did as the example says:

   

#include "cytypes.h"

   

#include "cyfitter.h"

   

- on the nRF24.c i add #include "`$INSTANCE_NAME`.h" as the section 6.3 section indicates.

   

- 6.1 API Cases says when i got other components on the schematic implementation i would need to use API of those components i would refer as:

   

`$INSTANCE_NAME``[SPI]`Init()

   

so i didn't know if i must include something similar on the top of the C file like:

   

#include "`$INSTANCE_NAME``[SPI]`.h"

   

#include "`$INSTANCE_NAME``[Control]`.h"

   

 

   

When i try to use a SPI function on the nRF24.c file no help displayed, i mean no SPI_Start, i also tried `$INSTANCE_NAME``[SPI]`_ and no help is displayed, as i know i'm bad explain my questions i attach some images to try help me.

   

 

   

all help and suggestions are welcome.

   

ps: http://origin-www.cypress.com/forum/psoc-creator-software/spi-component-schmatic-implementation this topic help me, but no mention about API generation.

   

Carlos

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

The "code help" is a Creator function and has nothing to do with your supplied API-files. The hints are generated by an internal on-line compilation of  the project sources. As long as a build ends up with no errors it should work automatically. Do not forget, as long as the outputs of a component are not connected (even indirectly) to the outside world, there will be a good chance that the optimizer throws out the "unused" hardware. Did you check for any errors flagged in your generated files?

   

 

   

Bob

View solution in original post

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

Well, i had search aroung google and found no info, but had download some custom components, and open it trying to see how they was implemented, found one really useful for me to learn, all they do was:

   

- on the -h file

   

#ifndef (`$INSTANCE_NAME`_H)

   

#define `$INSTANCE_NAME`_H

   

#include "cytypes.h"    
#include "cyfitter.h" 

   

- and .c file:

   

#include "`$INSTANCE_NAME`.h"
#include <project.h>

   

APIs of the components placed on the schematic implementation are called like this:

   

    `$INSTANCE_NAME`_Timer_Start();
    `$INSTANCE_NAME`_Timer_1_Start();
    `$INSTANCE_NAME`_Counter_Start();
    
`$INSTANCE_NAME`_Timer_WritePeriod(Num_of_Imp*2-1);

   

so, that solves most of my questions for now, what i couldn't see is the "code help" with the APIs of the components on the schematic, so i guess i have to fill all by hand.

   

 

   

Carlos

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

The "code help" is a Creator function and has nothing to do with your supplied API-files. The hints are generated by an internal on-line compilation of  the project sources. As long as a build ends up with no errors it should work automatically. Do not forget, as long as the outputs of a component are not connected (even indirectly) to the outside world, there will be a good chance that the optimizer throws out the "unused" hardware. Did you check for any errors flagged in your generated files?

   

 

   

Bob

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

Hi Bob,

   

Yes my generated files don't get errors, i will try to do the control of SS and CE pins with the control register on a project, and then when got all running will integrate all in the custom component.

0 Likes