[sim_hitl] added new gps support

This commit is contained in:
masierra
2016-02-04 14:41:37 -08:00
parent 0a4508c994
commit 3c7e2d6b53
3 changed files with 23 additions and 9 deletions
@@ -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
+11 -2
View File
@@ -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);
}
+7 -3
View File
@@ -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 */