Hi Haiyang, I can answer the first 2 questions. ## is a C preprocessing operator and is used to merge tokens. For instance, if you define:
#define R(i) x ## i
and in you code you write
R(4) = 30;
after the preprocessor you will have:
x4 = 30;
Hence with the chain
#define __GpsLink(dev, _x) dev##_x #define _GpsLink(dev, _x) __GpsLink(dev, _x)
#define GpsLink(_x) _GpsLink(GPS_LINK, _x)
if you assign
GPS_LINK = Uart0 (this assignment can be found in a .xml file)
the _expression_ "GpsLink(ChAvailable())" become
Uart0ChAvailable().
Best Regards
Mario
Date: Wed, 7 May 2008 22:49:34 -0600 From: address@hidden To: address@hidden Subject: [Paparazzi-devel] Question about gps.h
Hi, guys. We are trying to hook up a IMU with Tiny13 through UART1. But I have some questions while understanding the code about the GPS part.
(1) Where is the definition for function "ChAvailable()" used in "#define GpsBuffer() GpsLink(ChAvailable()) --- gps.h "?
I used the command "address@hidden:~/paparazzi3$ grep -r -n 'ChAvailable()' *". But I still can not find the definition. The only possible place is in sw/airborne/arm7/uart_hw.h:46: #define Uart0ChAvailable(). But they have different names. Some tricks here?
(2) What is this "dev##_x"? like /dev/ttyUSB0 in linux or what? -----------------------------From gps.h--------------------------------------------- #define __GpsLink(dev, _x) dev##_x #define _GpsLink(dev, _x) __GpsLink(dev, _x)
#define GpsLink(_x) _GpsLink(GPS_LINK, _x)
(3) Do u guys know any good documentations about the paparazzi programming, especially the airbore code?
Thanks Haiyang
Windows Live Mobile Da oggi la posta di Hotmail la controlli anche dal tuo cellulare!
|