make a new function/lib for avr with c++ in winavr

Status
Not open for further replies.

mohseni

New Member
Dear users

Is it possible to make new function or a lib.( I dont know which one is correct) for avr including a header to introduce this function to winavr and use this function in main body of program? if so, how can build the body of header? if I write the codes of function in a text and save it by .h suffix, it will be allright? should I compile it before use it? I'll be pleased if someone help me.....
 
You can make a function right in your c++ program. But if you use it frequently you can make it into a file of its own.

Usually you declare the function (write its prototype) in a header (.h) file and define it (write the function body) in a .c file.

You would .include both the .h and .c files in your main c program. In WinAVR this means putting their names in the program as well as making sure there is a copy in the project under "Source Files" and "Header Files".
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…