diff --git a/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile b/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile index b674b38242..58d37aad10 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile @@ -3,7 +3,7 @@ GPS_LED ?= none ap.srcs += $(SRC_SUBSYSTEMS)/gps.c -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" +ap.CFLAGS += -DPRIMARY_GPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_datalink.c ap.CFLAGS += -DUSE_GPS -DGPS_DATALINK @@ -14,5 +14,5 @@ endif nps.CFLAGS += -DUSE_GPS nps.srcs += $(SRC_SUBSYSTEMS)/gps.c -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" +nps.CFLAGS += -DPRIMARY_GPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c diff --git a/sw/airborne/subsystems/gps/gps_datalink.c b/sw/airborne/subsystems/gps/gps_datalink.c index 788a3569c8..fa8d3bcf6a 100644 --- a/sw/airborne/subsystems/gps/gps_datalink.c +++ b/sw/airborne/subsystems/gps/gps_datalink.c @@ -40,7 +40,7 @@ struct EnuCoor_i enu_pos, enu_speed; bool_t gps_available; ///< Is set to TRUE when a new REMOTE_GPS packet is received and parsed /** GPS initialization */ -void gps_impl_init(void) +void datalink_gps_impl_init(void) { gps.fix = GPS_FIX_NONE; gps_available = FALSE; @@ -58,6 +58,10 @@ void gps_impl_init(void) ltp_def_from_ecef_i(<p_def, &ecef_nav0); } +void datalink_gps_event(void) +{ +} + // Parse the REMOTE_GPS_SMALL datalink packet void parse_gps_datalink_small(uint8_t num_sv, uint32_t pos_xyz, uint32_t speed_xyz, int16_t heading) { @@ -173,3 +177,11 @@ void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t e AbiSendMsgGPS(GPS_DATALINK_ID, now_ts, &gps); } + +/* + * register callbacks & structs + */ +void datalink_gps_register(void) +{ + gps_register_impl(datalink_gps_impl_init, datalink_gps_event, GPS_DATALINK_ID, 0); +} diff --git a/sw/airborne/subsystems/gps/gps_datalink.h b/sw/airborne/subsystems/gps/gps_datalink.h index 3d82d80277..6bda9a09a0 100644 --- a/sw/airborne/subsystems/gps/gps_datalink.h +++ b/sw/airborne/subsystems/gps/gps_datalink.h @@ -32,7 +32,15 @@ #include "std.h" #include "generated/airframe.h" -#define GPS_NB_CHANNELS 0 +#define DATALINK_GPS_NB_CHANNELS 0 + +#ifndef PrimaryGpsImpl +#define PrimaryGpsImpl datalink +#endif + +extern void datalink_gps_event(void); +extern void datalink_gps_impl_init(void); +extern void datalink_gps_register(void); extern bool_t gps_available; @@ -44,6 +52,6 @@ extern void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, in uint32_t tow, int32_t course); // dummy -#define GpsEvent() {} +// #define GpsEvent() {} #endif /* GPS_DATALINK_H */