[modules] Compile gps_ubx_ucenter.c independently.

closes #571
This commit is contained in:
Ben Laurie
2013-10-29 10:57:33 +00:00
committed by Felix Ruess
parent 81631c2f8e
commit 2f37affd61
5 changed files with 27 additions and 31 deletions
+2 -3
View File
@@ -24,9 +24,8 @@ Warning: you still need to tell the driver
<init fun="gps_ubx_ucenter_init()"/> <init fun="gps_ubx_ucenter_init()"/>
<periodic fun="gps_ubx_ucenter_periodic()" start="gps_ubx_ucenter_init()" freq="4." autorun="TRUE"/> <periodic fun="gps_ubx_ucenter_periodic()" start="gps_ubx_ucenter_init()" freq="4." autorun="TRUE"/>
<makefile target="ap"> <makefile target="ap">
<raw> <file name="gps_ubx_ucenter.c"/>
ap.CFLAGS += -DGPS_UBX_UCENTER=\"modules/gps/gps_ubx_ucenter.c\" <define name="GPS_UBX_UCENTER"/>
</raw>
</makefile> </makefile>
</module> </module>
@@ -28,6 +28,7 @@
*/ */
#include "gps_ubx_ucenter.h" #include "gps_ubx_ucenter.h"
#include "subsystems/gps/gps_ubx.h"
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
@@ -28,6 +28,8 @@
#ifndef GPS_UBX_UCENTER_H #ifndef GPS_UBX_UCENTER_H
#define GPS_UBX_UCENTER_H #define GPS_UBX_UCENTER_H
#include "std.h"
/** U-Center Variables */ /** U-Center Variables */
#define GPS_UBX_UCENTER_CONFIG_STEPS 17 #define GPS_UBX_UCENTER_CONFIG_STEPS 17
-28
View File
@@ -53,30 +53,7 @@
#define UTM_HEM_SOUTH 1 #define UTM_HEM_SOUTH 1
#define GpsUartSend1(c) GpsLink(Transmit(c))
#define GpsUartSetBaudrate(_a) GpsLink(SetBaudrate(_a))
#define GpsUartRunning GpsLink(TxRunning) #define GpsUartRunning GpsLink(TxRunning)
#define GpsUartSendMessage GpsLink(SendMessage)
#define UbxInitCheksum() { gps_ubx.send_ck_a = gps_ubx.send_ck_b = 0; }
#define UpdateChecksum(c) { gps_ubx.send_ck_a += c; gps_ubx.send_ck_b += gps_ubx.send_ck_a; }
#define UbxTrailer() { GpsUartSend1(gps_ubx.send_ck_a); GpsUartSend1(gps_ubx.send_ck_b); GpsUartSendMessage(); }
#define UbxSend1(c) { uint8_t i8=c; GpsUartSend1(i8); UpdateChecksum(i8); }
#define UbxSend2(c) { uint16_t i16=c; UbxSend1(i16&0xff); UbxSend1(i16 >> 8); }
#define UbxSend1ByAddr(x) { UbxSend1(*x); }
#define UbxSend2ByAddr(x) { UbxSend1(*x); UbxSend1(*(x+1)); }
#define UbxSend4ByAddr(x) { UbxSend1(*x); UbxSend1(*(x+1)); UbxSend1(*(x+2)); UbxSend1(*(x+3)); }
#define UbxHeader(nav_id, msg_id, len) { \
GpsUartSend1(UBX_SYNC1); \
GpsUartSend1(UBX_SYNC2); \
UbxInitCheksum(); \
UbxSend1(nav_id); \
UbxSend1(msg_id); \
UbxSend2(len); \
}
struct GpsUbx gps_ubx; struct GpsUbx gps_ubx;
@@ -267,11 +244,6 @@ void gps_ubx_parse( uint8_t c ) {
return; return;
} }
#ifdef GPS_UBX_UCENTER
#include GPS_UBX_UCENTER
#endif
void ubxsend_cfg_rst(uint16_t bbr , uint8_t reset_mode) { void ubxsend_cfg_rst(uint16_t bbr , uint8_t reset_mode) {
#ifdef GPS_LINK #ifdef GPS_LINK
UbxSend_CFG_RST(bbr, reset_mode, 0x00); UbxSend_CFG_RST(bbr, reset_mode, 0x00);
+22
View File
@@ -134,5 +134,27 @@ extern void ubxsend_cfg_rst(uint16_t, uint8_t);
ubxsend_cfg_rst(gps_ubx.reset, CFG_RST_Reset_Controlled); \ ubxsend_cfg_rst(gps_ubx.reset, CFG_RST_Reset_Controlled); \
} }
#define GpsUartSendMessage GpsLink(SendMessage)
#define GpsUartSend1(c) GpsLink(Transmit(c))
#define UbxInitCheksum() { gps_ubx.send_ck_a = gps_ubx.send_ck_b = 0; }
#define UpdateChecksum(c) { gps_ubx.send_ck_a += c; gps_ubx.send_ck_b += gps_ubx.send_ck_a; }
#define UbxSend1(c) { uint8_t i8=c; GpsUartSend1(i8); UpdateChecksum(i8); }
#define UbxSend2(c) { uint16_t i16=c; UbxSend1(i16&0xff); UbxSend1(i16 >> 8); }
#define UbxSend1ByAddr(x) { UbxSend1(*x); }
#define UbxSend2ByAddr(x) { UbxSend1(*x); UbxSend1(*(x+1)); }
#define UbxSend4ByAddr(x) { UbxSend1(*x); UbxSend1(*(x+1)); UbxSend1(*(x+2)); UbxSend1(*(x+3)); }
#define GpsUartSetBaudrate(_a) GpsLink(SetBaudrate(_a))
#define UbxHeader(nav_id, msg_id, len) { \
GpsUartSend1(UBX_SYNC1); \
GpsUartSend1(UBX_SYNC2); \
UbxInitCheksum(); \
UbxSend1(nav_id); \
UbxSend1(msg_id); \
UbxSend2(len); \
}
#define UbxTrailer() { GpsUartSend1(gps_ubx.send_ck_a); GpsUartSend1(gps_ubx.send_ck_b); GpsUartSendMessage(); }
#endif /* GPS_UBX_H */ #endif /* GPS_UBX_H */