One way to do this is to create a custom component, and add it to the dependencies list. Then all you need is to add it to the dependencies (Project-> Dependencies -> Add..) and drop component to the schematic. You can find an examples of such "pure API" components here:
This is probably not what you mentioned above, but I find it convenient.
Thanks for your help but i am using PSoC Creator version 3.3 and cannot load the project its probably build with later version
What i Need is a very simple :
I have written some function to access a Nextion HMI Screen (its a touch screen that has an API - simple one). it is not so important
I will show you one functoion in my C file and a declaration in my H file and if you can point me how to do it as in your sample seriallib
I will list only one function to ease the explanation and if help will be given on only this function will be more then fine.
.c file name "HMIControls.c"
and one of the functoin is :
void HMI_SetIntegerControlValue(char* pageName, char* objectName, int value, char* pcBuf)
itoa(value, carValue, 10);
if (pageName != NULL)
sprintf(pcBuf, "%s.%s.val=%s%c%c%c", pageName, objectName, carValue, HMI_END_COMMAND, HMI_END_COMMAND, HMI_END_COMMAND) ;
sprintf(pcBuf, "%s.val=%s%c%c%c", objectName, carValue, HMI_END_COMMAND, HMI_END_COMMAND, HMI_END_COMMAND) ;
and in the .h file name "HMIControls.h" i have the prototype declaration of that function
void HMI_SetIntegerControlValue(char* pageName, char* objectName, int value, char* pcBuf);
Now what i need is how to create an empty custom component code only that i can create a library on the above function and then linked it to any project using Nextion screen that required those functionalities.
Thanks in advance
I guess I'm having difficulty understanding what you are trying to do. So I have some questions:
We decided to create a code library that can be linked and share among the project
I have created a Code library project with this two files and gave it a name.
Let say that the library name creates is "MyLib.a" and the H file is "MyFile.h" and also I Have "MyFile.c".
The library project compile OK and created the Library "MyLib.a" .
The library called "MyLib.a" as actually called "MyLib.a.cylib"?
Now I went to any project I have that uses those files embeded in my code and removed the code from it. Assuming now i can add the library and the include the h file and all will be fine.
Yes. Once you compile the code, you can remove the .c file. However you need to compile the code for the CPU types you plan to support.
Try this link: Creating a Library Project as an Object Code – KBA90606
Is there a reason you are using Creator 3.3? Creator is currently at 4.3.
2 of 2 people found this helpful
When adding your custom library to the project did you follow the steps described in this KBA?
Your link does the job
To be honest i saw it and followed the instruction and i missed the CPU type. After following carefully on what said in the link it all works OK
One small issue i figure in another library i have created.
One of my function required the use of pow function so, I have used #inclue <math.h> file and compile the lib OK.
Note : If i removed the #include <math.h> it didn't compile. so the #include <math.h> is a must for that library to compile.
So after creating the new lib.
I opened my project that required this new library functionality and made a dependency on the new lib and compile the project. the compiler complains that there is no reference to "pow" function, do you any any clue why it complains on it?
I get around this error compilation by replacing the value that pow calculates with a fixed known number and the project compile and run prefect.
1 of 1 people found this helpful
I believe that the compiler also needs to be notified about using the math library. Somewhere in the Project-> Build settings -> Compiler -> Additional libraries add "m" (math library).
Many Thanks It works OK