diff --git a/conf/firmwares/test_progs.makefile b/conf/firmwares/test_progs.makefile index befda75f03..ed4acb49af 100644 --- a/conf/firmwares/test_progs.makefile +++ b/conf/firmwares/test_progs.makefile @@ -64,13 +64,34 @@ COMMON_TEST_SRCS += $(SRC_ARCH)/led_hw.c COMMON_TEST_SRCS += $(SRC_ARCH)/mcu_periph/gpio_arch.c endif +# pprz downlink/datalink +COMMON_TELEMETRY_CFLAGS = -DDOWNLINK -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ +COMMON_TELEMETRY_SRCS = subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c + +# check if we are using UDP +ifneq (,$(findstring UDP, $(MODEM_DEV))) +include $(CFG_SHARED)/udp.makefile +MODEM_PORT_OUT ?= 4242 +MODEM_PORT_IN ?= 4243 +MODEM_BROADCAST ?= TRUE +UDP_MODEM_PORT_LOWER=$(shell echo $(MODEM_DEV) | tr A-Z a-z) + +COMMON_TELEMETRY_CFLAGS += -DUSE_$(MODEM_DEV) -D$(MODEM_DEV)_PORT_OUT=$(MODEM_PORT_OUT) -D$(MODEM_DEV)_PORT_IN=$(MODEM_PORT_IN) +COMMON_TELEMETRY_CFLAGS += -D$(MODEM_DEV)_BROADCAST=$(MODEM_BROADCAST) -D$(MODEM_DEV)_HOST=\"$(MODEM_HOST)\" +COMMON_TELEMETRY_CFLAGS += -DPPRZ_UART=$(MODEM_DEV) +COMMON_TELEMETRY_CFLAGS += -DDOWNLINK_DEVICE=$(UDP_MODEM_PORT_LOWER) +else +# via UART COMMON_TELEMETRY_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) -COMMON_TELEMETRY_CFLAGS = -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -COMMON_TELEMETRY_CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=pprz_tp -DDOWNLINK_DEVICE=$(COMMON_TELEMETRY_MODEM_PORT_LOWER) -COMMON_TELEMETRY_CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=$(MODEM_PORT) -COMMON_TELEMETRY_SRCS = mcu_periph/uart.c -COMMON_TELEMETRY_SRCS += $(SRC_ARCH)/mcu_periph/uart_arch.c -COMMON_TELEMETRY_SRCS += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c +COMMON_TELEMETRY_CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) +COMMON_TELEMETRY_CFLAGS += -DPPRZ_UART=$(MODEM_PORT) +COMMON_TELEMETRY_CFLAGS += -DDOWNLINK_DEVICE=$(COMMON_TELEMETRY_MODEM_PORT_LOWER) +COMMON_TELEMETRY_SRCS += mcu_periph/uart.c +COMMON_TELEMETRY_SRCS += $(SRC_ARCH)/mcu_periph/uart_arch.c +ifeq ($(ARCH), linux) +COMMON_TELEMETRY_SRCS += $(SRC_ARCH)/serial_port.c +endif +endif #UART #COMMON_TEST_SRCS += math/pprz_trig_int.c diff --git a/sw/airborne/test/subsystems/test_settings.c b/sw/airborne/test/subsystems/test_settings.c index 5fae641f83..f03994c521 100644 --- a/sw/airborne/test/subsystems/test_settings.c +++ b/sw/airborne/test/subsystems/test_settings.c @@ -30,8 +30,9 @@ #include "subsystems/settings.h" #include "generated/settings.h" -#include "mcu_periph/uart.h" -#include "messages.h" +#if USE_UDP +#include "mcu_periph/udp.h" +#endif static inline void main_init(void); static inline void main_periodic(void); @@ -64,6 +65,9 @@ static inline void main_init(void) mcu_int_enable(); +#if DOWNLINK + downlink_init(); +#endif } static inline void main_periodic(void) @@ -77,7 +81,9 @@ static inline void main_periodic(void) static inline void main_event(void) { - +#if USE_UDP + udp_event(); +#endif DatalinkEvent(); }