diff --git a/conf/modules/gps_ubx_ucenter.xml b/conf/modules/gps_ubx_ucenter.xml
index 1f2880dfad..b5db81e04e 100644
--- a/conf/modules/gps_ubx_ucenter.xml
+++ b/conf/modules/gps_ubx_ucenter.xml
@@ -24,9 +24,8 @@ Warning: you still need to tell the driver
-
- ap.CFLAGS += -DGPS_UBX_UCENTER=\"modules/gps/gps_ubx_ucenter.c\"
-
+
+
diff --git a/sw/airborne/modules/gps/gps_ubx_ucenter.c b/sw/airborne/modules/gps/gps_ubx_ucenter.c
index 83b02aa1ff..52c8bf1598 100644
--- a/sw/airborne/modules/gps/gps_ubx_ucenter.c
+++ b/sw/airborne/modules/gps/gps_ubx_ucenter.c
@@ -28,6 +28,7 @@
*/
#include "gps_ubx_ucenter.h"
+#include "subsystems/gps/gps_ubx.h"
//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
diff --git a/sw/airborne/modules/gps/gps_ubx_ucenter.h b/sw/airborne/modules/gps/gps_ubx_ucenter.h
index 843e6c90a2..b0e93bf428 100644
--- a/sw/airborne/modules/gps/gps_ubx_ucenter.h
+++ b/sw/airborne/modules/gps/gps_ubx_ucenter.h
@@ -28,6 +28,8 @@
#ifndef GPS_UBX_UCENTER_H
#define GPS_UBX_UCENTER_H
+#include "std.h"
+
/** U-Center Variables */
#define GPS_UBX_UCENTER_CONFIG_STEPS 17
diff --git a/sw/airborne/subsystems/gps/gps_ubx.c b/sw/airborne/subsystems/gps/gps_ubx.c
index 260ed71983..160042852e 100644
--- a/sw/airborne/subsystems/gps/gps_ubx.c
+++ b/sw/airborne/subsystems/gps/gps_ubx.c
@@ -53,30 +53,7 @@
#define UTM_HEM_SOUTH 1
-#define GpsUartSend1(c) GpsLink(Transmit(c))
-#define GpsUartSetBaudrate(_a) GpsLink(SetBaudrate(_a))
#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;
@@ -267,11 +244,6 @@ void gps_ubx_parse( uint8_t c ) {
return;
}
-#ifdef GPS_UBX_UCENTER
-#include GPS_UBX_UCENTER
-#endif
-
-
void ubxsend_cfg_rst(uint16_t bbr , uint8_t reset_mode) {
#ifdef GPS_LINK
UbxSend_CFG_RST(bbr, reset_mode, 0x00);
diff --git a/sw/airborne/subsystems/gps/gps_ubx.h b/sw/airborne/subsystems/gps/gps_ubx.h
index dab9de81a5..e2d1c2ce58 100644
--- a/sw/airborne/subsystems/gps/gps_ubx.h
+++ b/sw/airborne/subsystems/gps/gps_ubx.h
@@ -134,5 +134,27 @@ extern void ubxsend_cfg_rst(uint16_t, uint8_t);
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 */