3 Replies Latest reply on Sep 18, 2015 9:12 AM by user_365962704

    Component Creation | Schematic implementation | API Generation

    user_365962704

      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

        • 1. Re: Component Creation | Schematic implementation | API Generation
          user_365962704

          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

          • 2. Re: Component Creation | Schematic implementation | API Generation
            user_1377889

            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

            • 3. Re: Component Creation | Schematic implementation | API Generation
              user_365962704

              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.