Including header files

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Including header files

1,644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charithjperera on Sun Feb 06 01:13:14 MST 2011
Hi Everyone,

Sorry for that seems to be an extremely noob question - how do I define header files so I am able to use the functions defined in them and their corresponding c files?
Also - how could I get trig functions? including math.h seemed to do nothing - I am looking for the inverse trig functions.

I am prototyping a tilt sensor that includes an lpcxpresso 1114 talking to two sensors through I2C. I started off with the I2C example and now I have modified it completely so it collects, process and returns the data over the console through semihosting.

I require GPIO functionality and the timer for interrupts and to get the change in time for numerical integration. including the gpio.h and timer headers as is done in the blinker example did nothing, are there any settings that need to be changed or is there another way to define them?

Also - how could I implement inverse trig functions? Is there a standard library such as math that i'd be able to use with the lpcxpresso?

Thanks,
Charith
0 Kudos
Reply
3 Replies

1,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Feb 07 02:05:30 MST 2011
The math.h header provided with LPCXpresso IDE does include the standard inverse trig functions - acos(), asin(), atan() and atan2(). For more information on these functions, see http://www.cplusplus.com/reference/clibrary/cmath/

All you should need to do is add the line:

#include <math.h> 


to your source file, and you should then be able to call these functions. If you are still having problems, then I suggest that you post a code snippet, together with the warning/errors that you are seeing.

With regards to your problems with GPIO and timers, these should typically "just work" if you code includes appropriate headers and calls the appropriate functions.

However you will need to explain in more detail exactly which examples you are basing your own development off. There have been several revisions of examples over time, and, for example, the latest examples from NXP are structured somewhat differently to previous revisions.

I would always suggest that you start with the examples provided with the latest version of LPCXpresso IDE (3.6.2 at present), and then make sure that you read any documentation/readmes provided as part of example projects to understand how they are structured before trying to modify them extensively.

Regards,
CodeRedSupport
0 Kudos
Reply

1,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Sun Feb 06 22:51:41 MST 2011
This are no drivers, this are source (*.c) and header (.h) files of your project.

Use right button to copy and paste this files between your projects.

So copy timer.h / timer.c from blinky project, paste them in your actual project and use them in your main (as in blinky main).

To read more about including math.h search for math.h in:

http://support.code-red-tech.com/CodeRedWiki/WikiHome
0 Kudos
Reply

1,498 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charithjperera on Sun Feb 06 22:36:09 MST 2011
Hi All,

Just an update - it seemed to be related to these two types of icons the drivers can take, see the screenshot.
The I2C example could only make use of some of thoese drivers; the ones that had the drop down option on the side and as such - I was unable to use the timer. GPIO and I2C worked fine though.

The blinker example however had the dropdown option for all of the drivers and upon copying my code to that directory - I was able to make use of all the drivers.

Does anybody know what's going on here? My best guess is that there are some project parameters that are being annoying.

Thanks,
Charith
0 Kudos
Reply