diff --git a/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile b/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile index c2ea1367a8..5bfb1ca832 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile @@ -1,9 +1,10 @@ # Hey Emacs, this is a -*- makefile -*- -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_hitl.h\" -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_hitl.c ap.CFLAGS += -DUSE_GPS -DHITL +ap.CFLAGS += -DPRIMARY_GPS_TYPE=\"subsystems/gps/gps_sim_hitl.h\" +ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_hitl.c + +ap.srcs += $(SRC_SUBSYSTEMS)/gps.c ifneq ($(GPS_LED),none) ap.CFLAGS += -DGPS_LED=$(GPS_LED) @@ -11,5 +12,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=\"subsystems/gps/gps_sim_nps.h\" nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c diff --git a/sw/airborne/subsystems/gps/gps_sim_hitl.c b/sw/airborne/subsystems/gps/gps_sim_hitl.c index 96c563538a..8f695ac953 100644 --- a/sw/airborne/subsystems/gps/gps_sim_hitl.c +++ b/sw/airborne/subsystems/gps/gps_sim_hitl.c @@ -24,6 +24,7 @@ * GPS subsystem simulation from rotorcrafts horizontal/vertical reference system */ +#include "subsystems/gps/gps_sim_hitl.h" #include "subsystems/gps.h" #include "subsystems/abi.h" @@ -35,12 +36,12 @@ bool_t gps_available; uint32_t gps_sim_hitl_timer; -void gps_impl_init(void) +void sim_hitl_gps_impl_init(void) { gps.fix = GPS_FIX_NONE; } -void gps_sim_hitl_event(void) +void sim_hitl_gps_event(void) { if (SysTimeTimer(gps_sim_hitl_timer) > 100000) { SysTimeTimerStart(gps_sim_hitl_timer); @@ -93,3 +94,11 @@ void gps_sim_hitl_event(void) AbiSendMsgGPS(GPS_SIM_ID, now_ts, &gps); } } + +/* + * register callbacks & structs + */ +void sim_hitl_gps_register(void) +{ + gps_register_impl(sim_hitl_gps_impl_init, sim_hitl_gps_event, GPS_SIM_ID, 0); +} diff --git a/sw/airborne/subsystems/gps/gps_sim_hitl.h b/sw/airborne/subsystems/gps/gps_sim_hitl.h index 84f4c6e145..9e27f78752 100644 --- a/sw/airborne/subsystems/gps/gps_sim_hitl.h +++ b/sw/airborne/subsystems/gps/gps_sim_hitl.h @@ -27,10 +27,14 @@ #ifndef GPS_SIM_HITL_H #define GPS_SIM_HITL_H -#include "std.h" +#ifndef PrimaryGpsImpl +#define PrimaryGpsImpl sim_hitl +#endif -extern void gps_sim_hitl_event(void); +extern void sim_hitl_gps_event(void); +extern void sim_hitl_gps_impl_init(void); +extern void sim_hitl_gps_register(void); -#define GpsEvent gps_sim_hitl_event +// #define GpsEvent gps_sim_hitl_event #endif /* GPS_SIM_HITL_H */