Skip to content

Commit

Permalink
[modules] Compile gps_ubx_ucenter.c independently.
Browse files Browse the repository at this point in the history
closes #571
  • Loading branch information
benlaurie authored and flixr committed Oct 29, 2013
1 parent 81631c2 commit 2f37aff
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
5 changes: 2 additions & 3 deletions conf/modules/gps_ubx_ucenter.xml
Expand Up @@ -24,9 +24,8 @@ Warning: you still need to tell the driver
<init fun="gps_ubx_ucenter_init()"/>
<periodic fun="gps_ubx_ucenter_periodic()" start="gps_ubx_ucenter_init()" freq="4." autorun="TRUE"/>
<makefile target="ap">
<raw>
ap.CFLAGS += -DGPS_UBX_UCENTER=\"modules/gps/gps_ubx_ucenter.c\"
</raw>
<file name="gps_ubx_ucenter.c"/>
<define name="GPS_UBX_UCENTER"/>
</makefile>
</module>

Expand Down
1 change: 1 addition & 0 deletions sw/airborne/modules/gps/gps_ubx_ucenter.c
Expand Up @@ -28,6 +28,7 @@
*/

#include "gps_ubx_ucenter.h"
#include "subsystems/gps/gps_ubx.h"

//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions sw/airborne/modules/gps/gps_ubx_ucenter.h
Expand Up @@ -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

Expand Down
28 changes: 0 additions & 28 deletions sw/airborne/subsystems/gps/gps_ubx.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
22 changes: 22 additions & 0 deletions sw/airborne/subsystems/gps/gps_ubx.h
Expand Up @@ -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 */

0 comments on commit 2f37aff

Please sign in to comment.