diff --git a/conf/firmwares/subsystems/fixedwing/telemetry_superbitrf.makefile b/conf/firmwares/subsystems/fixedwing/telemetry_superbitrf.makefile index 6018d66b928..5a7a9d9678d 100644 --- a/conf/firmwares/subsystems/fixedwing/telemetry_superbitrf.makefile +++ b/conf/firmwares/subsystems/fixedwing/telemetry_superbitrf.makefile @@ -2,12 +2,12 @@ # The superbitRF module as telemetry downlink/uplink # # -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_FBW_DEVICE=superbitrf -DDOWNLINK_AP_DEVICE=superbitrf -ap.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=SUPERBITRF -#ap.CFLAGS += -DUSE_SUPERBITRF -DUSE_SPI2 -DUSE_SPI_SLAVE2 -ap.srcs += peripherals/cyrf6936.c -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/superbitrf.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c +# include shared part for ap +ifeq ($(TARGET),ap) +include $(CFG_SHARED)/telemetry_superbitrf.makefile +endif + ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c # avoid fbw_telemetry_mode error diff --git a/conf/firmwares/subsystems/fixedwing/telemetry_transparent.makefile b/conf/firmwares/subsystems/fixedwing/telemetry_transparent.makefile index 8f4fa0a48e2..52d2e09b334 100644 --- a/conf/firmwares/subsystems/fixedwing/telemetry_transparent.makefile +++ b/conf/firmwares/subsystems/fixedwing/telemetry_transparent.makefile @@ -1,15 +1,11 @@ # Hey Emacs, this is a -*- makefile -*- -PPRZ_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) +# include shared part for ap +ifeq ($(TARGET),ap) +include $(CFG_SHARED)/telemetry_transparent.makefile +endif -telemetry_CFLAGS = -DUSE_$(MODEM_PORT) -telemetry_CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -telemetry_CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(PPRZ_MODEM_PORT_LOWER) -DPPRZ_UART=$(PPRZ_MODEM_PORT_LOWER) -telemetry_CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -telemetry_srcs = subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c - -ap.CFLAGS += $(telemetry_CFLAGS) -ap.srcs += $(telemetry_srcs) $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c +ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c # avoid fbw_telemetry_mode error ap.srcs += $(SRC_FIRMWARE)/fbw_downlink.c diff --git a/conf/firmwares/subsystems/fixedwing/telemetry_transparent_usb.makefile b/conf/firmwares/subsystems/fixedwing/telemetry_transparent_usb.makefile index 88c315f87d7..797f16a1f87 100644 --- a/conf/firmwares/subsystems/fixedwing/telemetry_transparent_usb.makefile +++ b/conf/firmwares/subsystems/fixedwing/telemetry_transparent_usb.makefile @@ -2,28 +2,13 @@ #serial USB (e.g. /dev/ttyACM0) -telemetry_CFLAGS = -DDOWNLINK -DDOWNLINK_DEVICE=usb_serial -DPPRZ_UART=usb_serial -telemetry_CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -DUSE_USB_SERIAL -telemetry_srcs = subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c -telemetry_srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c $(SRC_FIRMWARE)/fbw_downlink.c -# avoid fbw_telemetry_mode error -telemetry_srcs += $(SRC_FIRMWARE)/fbw_downlink.c +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_transparent_usb.makefile +endif -ap.CFLAGS += $(telemetry_CFLAGS) -ap.srcs += $(telemetry_srcs) +ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c $(SRC_FIRMWARE)/fbw_downlink.c +# avoid fbw_telemetry_mode error +ap.srcs += $(SRC_FIRMWARE)/fbw_downlink.c fbw.srcs += $(SRC_FIRMWARE)/fbw_downlink.c -ifeq ($(ARCH), lpc21) -ap.CFLAGS += -DUSE_USB_HIGH_PCLK -ap.srcs += $(SRC_ARCH)/usb_ser_hw.c $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c -ap.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c -else -ifeq ($(ARCH), stm32) -ap.srcs += $(SRC_ARCH)/usb_ser_hw.c -else -ifneq ($(ARCH), sim) -$(error telemetry_transparent_usb currently only implemented for the lpc21 and stm32) -endif -endif -endif diff --git a/conf/firmwares/subsystems/fixedwing/telemetry_w5100.makefile b/conf/firmwares/subsystems/fixedwing/telemetry_w5100.makefile index 59408909d47..eb949fe7bd6 100644 --- a/conf/firmwares/subsystems/fixedwing/telemetry_w5100.makefile +++ b/conf/firmwares/subsystems/fixedwing/telemetry_w5100.makefile @@ -2,36 +2,13 @@ # W5100 ethernet chip. -W5100_IP ?= "192,168,25,47" -W5100_SUBNET ?= "255,255,255,0" -W5100_MULTICAST_IP ?= "224,1,1,11" -W5100_MULTICAST_PORT ?= "1234" +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_w5100.makefile +endif -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=chip0 -ap.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=W5100 -ap.CFLAGS += -DW5100_IP=$(W5100_IP) -DW5100_SUBNET=$(W5100_SUBNET) -DW5100_MULTICAST_IP=$(W5100_MULTICAST_IP) -DW5100_MULTICAST_PORT=$(W5100_MULTICAST_PORT) -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/w5100.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c # avoid fbw_telemetry_mode error ap.srcs += $(SRC_FIRMWARE)/fbw_downlink.c fbw.srcs += $(SRC_FIRMWARE)/fbw_downlink.c - -ifeq ($(ARCH), lpc21) -# only an issue of setting the DRDY pin in w5100.c, which is stm32 specific -$(error Not implemented for the LCP21x yet.) -ap.CFLAGS += -DUSE_SPI1 -# default SPI device for W5100 is already SPI1 -ap.CFLAGS += -DUSE_SPI_SLAVE0 -ap.CFLAGS += -DW5100_SLAVE_IDX=0 -else ifeq ($(ARCH), stm32) -# on extra SPI1 connector -ap.CFLAGS += -DUSE_SPI1 -# default SPI device for W5100 is already SPI1 -# Slave select configuration -# SLAVE1 is SS on external SPI1 connector (PA04) -ap.CFLAGS += -DUSE_SPI_SLAVE1 -# default slave select for W5100 is already SLAVE1 -#ap.CFLAGS += -DW5100_SLAVE_IDX=1 -endif diff --git a/conf/firmwares/subsystems/fixedwing/telemetry_xbee_api.makefile b/conf/firmwares/subsystems/fixedwing/telemetry_xbee_api.makefile index e0cd6781427..b5efeeffd12 100644 --- a/conf/firmwares/subsystems/fixedwing/telemetry_xbee_api.makefile +++ b/conf/firmwares/subsystems/fixedwing/telemetry_xbee_api.makefile @@ -2,14 +2,11 @@ # XBee modems in API mode -XBEE_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) +# include shared part for ap +ifeq ($(TARGET),ap) +include $(CFG_SHARED)/telemetry_xbee_api.makefile +endif -ap.CFLAGS += -DUSE_$(MODEM_PORT) -ap.CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -DXBEE_BAUD=$(MODEM_BAUD) - -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(XBEE_MODEM_PORT_LOWER) -DXBEE_UART=$(XBEE_MODEM_PORT_LOWER) -ap.CFLAGS += -DDOWNLINK_TRANSPORT=xbee_tp -DDATALINK=XBEE -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/xbee.c subsystems/datalink/telemetry.c ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/ap_downlink.c # avoid fbw_telemetry_mode error diff --git a/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile b/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile index 4c16104bc95..2551e244ddf 100644 --- a/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile +++ b/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile @@ -65,8 +65,6 @@ nps.srcs += $(NPSDIR)/nps_main.c \ # for geo mag calculation nps.srcs += math/pprz_geodetic_wmm2010.c -nps.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_TRANSPORT=ivy_tp -DDOWNLINK_DEVICE=ivy_tp -nps.srcs += subsystems/datalink/ivy_transport.c -nps.srcs += subsystems/datalink/downlink.c subsystems/datalink/telemetry.c +include $(CFG_SHARED)/telemetry_ivy.makefile nps.srcs += $(SRC_FIRMWARE)/rotorcraft_telemetry.c nps.srcs += $(SRC_FIRMWARE)/datalink.c diff --git a/conf/firmwares/subsystems/rotorcraft/telemetry_superbitrf.makefile b/conf/firmwares/subsystems/rotorcraft/telemetry_superbitrf.makefile index 995472343d8..294bd0a08e1 100644 --- a/conf/firmwares/subsystems/rotorcraft/telemetry_superbitrf.makefile +++ b/conf/firmwares/subsystems/rotorcraft/telemetry_superbitrf.makefile @@ -1,11 +1,11 @@ # # The superbitRF module as telemetry downlink/uplink # -# -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=superbitrf -ap.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=SUPERBITRF -#ap.CFLAGS += -DUSE_SUPERBITRF -DUSE_SPI2 -DUSE_SPI_SLAVE2 -ap.srcs += peripherals/cyrf6936.c -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/superbitrf.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c +# include generic part +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_superbitrf.makefile +endif + +# add rotorcraft specific files ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c diff --git a/conf/firmwares/subsystems/rotorcraft/telemetry_transparent.makefile b/conf/firmwares/subsystems/rotorcraft/telemetry_transparent.makefile index 760c9b8ce13..e10be4b5ac8 100644 --- a/conf/firmwares/subsystems/rotorcraft/telemetry_transparent.makefile +++ b/conf/firmwares/subsystems/rotorcraft/telemetry_transparent.makefile @@ -5,12 +5,8 @@ # MODEM_BAUD # -PPRZ_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_transparent.makefile +endif -ap.CFLAGS += -DUSE_$(MODEM_PORT) -ap.CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) - -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(PPRZ_MODEM_PORT_LOWER) -DPPRZ_UART=$(PPRZ_MODEM_PORT_LOWER) -ap.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c diff --git a/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_udp.makefile b/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_udp.makefile index d45a02e62dc..80c56f35203 100644 --- a/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_udp.makefile +++ b/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_udp.makefile @@ -1,23 +1,8 @@ #serial UDP -include $(CFG_SHARED)/udp.makefile +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_transparent_udp.makefile +endif -MODEM_DEV ?= UDP0 -MODEM_PORT_OUT ?= 4242 -MODEM_PORT_IN ?= 4243 -MODEM_BROADCAST ?= TRUE - -UDP_MODEM_PORT_LOWER=$(shell echo $(MODEM_DEV) | tr A-Z a-z) - - -MODEM_CFLAGS = -DUSE_$(MODEM_DEV) -D$(MODEM_DEV)_PORT_OUT=$(MODEM_PORT_OUT) -D$(MODEM_DEV)_PORT_IN=$(MODEM_PORT_IN) -MODEM_CFLAGS += -D$(MODEM_DEV)_BROADCAST=$(MODEM_BROADCAST) -D$(MODEM_DEV)_HOST=\"$(MODEM_HOST)\" - -TELEM_CFLAGS = -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(UDP_MODEM_PORT_LOWER) -DPPRZ_UART=$(UDP_MODEM_PORT_LOWER) -TELEM_CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ - - -ap.CFLAGS += $(MODEM_CFLAGS) $(TELEM_CFLAGS) -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c diff --git a/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_usb.makefile b/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_usb.makefile index 018de29dfb5..07d75baabb2 100644 --- a/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_usb.makefile +++ b/conf/firmwares/subsystems/rotorcraft/telemetry_transparent_usb.makefile @@ -1,23 +1,8 @@ #serial USB (e.g. /dev/ttyACM0) -ifeq ($(ARCH), lpc21) -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=usb_serial -DPPRZ_UART=usb_serial -ap.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -DUSE_USB_SERIAL -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c -ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c -ap.srcs += $(SRC_ARCH)/usb_ser_hw.c $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c -ap.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c -else -ifeq ($(ARCH), stm32) -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=usb_serial -DPPRZ_UART=usb_serial -ap.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -DUSE_USB_SERIAL -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c -ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c -ap.srcs += $(SRC_ARCH)/usb_ser_hw.c -else -ifneq ($(ARCH), sim) -$(error telemetry_transparent_usb currently only implemented for the lpc21 and stm32) -endif -endif +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_transparent_usb.makefile endif + +ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c diff --git a/conf/firmwares/subsystems/rotorcraft/telemetry_udp.makefile b/conf/firmwares/subsystems/rotorcraft/telemetry_udp.makefile deleted file mode 100644 index 1e813fc4429..00000000000 --- a/conf/firmwares/subsystems/rotorcraft/telemetry_udp.makefile +++ /dev/null @@ -1 +0,0 @@ -$(error The telemetry_udp subsystem has been renamed, please replace with in your airframe file.) diff --git a/conf/firmwares/subsystems/rotorcraft/telemetry_xbee_api.makefile b/conf/firmwares/subsystems/rotorcraft/telemetry_xbee_api.makefile index 62dfb06615e..d0ccc027491 100644 --- a/conf/firmwares/subsystems/rotorcraft/telemetry_xbee_api.makefile +++ b/conf/firmwares/subsystems/rotorcraft/telemetry_xbee_api.makefile @@ -6,12 +6,8 @@ # MODEM_BAUD # -XBEE_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) +ifeq ($(TARGET), ap) +include $(CFG_SHARED)/telemetry_xbee_api.makefile +endif -ap.CFLAGS += -DUSE_$(MODEM_PORT) -ap.CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -DXBEE_BAUD=$(MODEM_BAUD) - -ap.CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(XBEE_MODEM_PORT_LOWER) -DXBEE_UART=$(XBEE_MODEM_PORT_LOWER) -ap.CFLAGS += -DDOWNLINK_TRANSPORT=xbee_tp -DDATALINK=XBEE -ap.srcs += subsystems/datalink/downlink.c subsystems/datalink/xbee.c subsystems/datalink/telemetry.c ap.srcs += $(SRC_FIRMWARE)/datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c diff --git a/conf/firmwares/subsystems/shared/telemetry_ivy.makefile b/conf/firmwares/subsystems/shared/telemetry_ivy.makefile new file mode 100644 index 00000000000..c8c0dc86008 --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_ivy.makefile @@ -0,0 +1,3 @@ +$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_TRANSPORT=ivy_tp -DDOWNLINK_DEVICE=ivy_tp +$(TARGET).srcs += subsystems/datalink/ivy_transport.c +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/telemetry.c diff --git a/conf/firmwares/subsystems/shared/telemetry_superbitrf.makefile b/conf/firmwares/subsystems/shared/telemetry_superbitrf.makefile new file mode 100644 index 00000000000..fce4da75ad2 --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_superbitrf.makefile @@ -0,0 +1,10 @@ +# +# The superbitRF module as telemetry downlink/uplink +# +# + +$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=superbitrf +$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=SUPERBITRF + +$(TARGET).srcs += peripherals/cyrf6936.c +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/superbitrf.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c diff --git a/conf/firmwares/subsystems/shared/telemetry_transparent.makefile b/conf/firmwares/subsystems/shared/telemetry_transparent.makefile new file mode 100644 index 00000000000..6401eb7ba33 --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_transparent.makefile @@ -0,0 +1,16 @@ +# +# Expected from board file or overriden as xml param : +# +# MODEM_PORT +# MODEM_BAUD +# + +PPRZ_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) + +$(TARGET).CFLAGS += -DUSE_$(MODEM_PORT) +$(TARGET).CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) + +$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(PPRZ_MODEM_PORT_LOWER) -DPPRZ_UART=$(PPRZ_MODEM_PORT_LOWER) +$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c + diff --git a/conf/firmwares/subsystems/shared/telemetry_transparent_udp.makefile b/conf/firmwares/subsystems/shared/telemetry_transparent_udp.makefile new file mode 100644 index 00000000000..93d1b8abce1 --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_transparent_udp.makefile @@ -0,0 +1,23 @@ + +#serial UDP + +include $(CFG_SHARED)/udp.makefile + +MODEM_DEV ?= UDP0 +MODEM_PORT_OUT ?= 4242 +MODEM_PORT_IN ?= 4243 +MODEM_BROADCAST ?= TRUE + +UDP_MODEM_PORT_LOWER=$(shell echo $(MODEM_DEV) | tr A-Z a-z) + + +MODEM_CFLAGS = -DUSE_$(MODEM_DEV) -D$(MODEM_DEV)_PORT_OUT=$(MODEM_PORT_OUT) -D$(MODEM_DEV)_PORT_IN=$(MODEM_PORT_IN) +MODEM_CFLAGS += -D$(MODEM_DEV)_BROADCAST=$(MODEM_BROADCAST) -D$(MODEM_DEV)_HOST=\"$(MODEM_HOST)\" + +TELEM_CFLAGS = -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(UDP_MODEM_PORT_LOWER) -DPPRZ_UART=$(UDP_MODEM_PORT_LOWER) +TELEM_CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ + + +$(TARGET).CFLAGS += $(MODEM_CFLAGS) $(TELEM_CFLAGS) +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c + diff --git a/conf/firmwares/subsystems/shared/telemetry_transparent_usb.makefile b/conf/firmwares/subsystems/shared/telemetry_transparent_usb.makefile new file mode 100644 index 00000000000..67ab9fab7be --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_transparent_usb.makefile @@ -0,0 +1,19 @@ + +#serial USB (e.g. /dev/ttyACM0) + +$(TARGET).CFLAGS += -DDOWNLINK -DDOWNLINK_DEVICE=usb_serial -DPPRZ_UART=usb_serial +$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -DUSE_USB_SERIAL +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c + +ifeq ($(ARCH), lpc21) +$(TARGET).srcs += $(SRC_ARCH)/usb_ser_hw.c $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c +$(TARGET).srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c +else +ifeq ($(ARCH), stm32) +$(TARGET).srcs += $(SRC_ARCH)/usb_ser_hw.c +else +ifneq ($(ARCH), sim) +$(error telemetry_transparent_usb currently only implemented for the lpc21 and stm32) +endif +endif +endif diff --git a/conf/firmwares/subsystems/shared/telemetry_w5100.makefile b/conf/firmwares/subsystems/shared/telemetry_w5100.makefile new file mode 100644 index 00000000000..59901cba917 --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_w5100.makefile @@ -0,0 +1,31 @@ +# Hey Emacs, this is a -*- makefile -*- + +# W5100 ethernet chip. + +W5100_IP ?= "192,168,25,47" +W5100_SUBNET ?= "255,255,255,0" +W5100_MULTICAST_IP ?= "224,1,1,11" +W5100_MULTICAST_PORT ?= "1234" + +$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=chip0 +$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=W5100 +$(TARGET).CFLAGS += -DW5100_IP=$(W5100_IP) -DW5100_SUBNET=$(W5100_SUBNET) -DW5100_MULTICAST_IP=$(W5100_MULTICAST_IP) -DW5100_MULTICAST_PORT=$(W5100_MULTICAST_PORT) +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/w5100.c subsystems/datalink/pprz_transport.c subsystems/datalink/telemetry.c + +ifeq ($(ARCH), lpc21) +# only an issue of setting the DRDY pin in w5100.c, which is stm32 specific +$(error Not implemented for the LCP21x yet.) +$(TARGET).CFLAGS += -DUSE_SPI1 +# default SPI device for W5100 is already SPI1 +$(TARGET).CFLAGS += -DUSE_SPI_SLAVE0 +$(TARGET).CFLAGS += -DW5100_SLAVE_IDX=0 +else ifeq ($(ARCH), stm32) +# on extra SPI1 connector +$(TARGET).CFLAGS += -DUSE_SPI1 +# default SPI device for W5100 is already SPI1 +# Slave select configuration +# SLAVE1 is SS on external SPI1 connector (PA04) +$(TARGET).CFLAGS += -DUSE_SPI_SLAVE1 +# default slave select for W5100 is already SLAVE1 +#$(TARGET).CFLAGS += -DW5100_SLAVE_IDX=1 +endif diff --git a/conf/firmwares/subsystems/shared/telemetry_xbee_api.makefile b/conf/firmwares/subsystems/shared/telemetry_xbee_api.makefile new file mode 100644 index 00000000000..f0b0b0b9842 --- /dev/null +++ b/conf/firmwares/subsystems/shared/telemetry_xbee_api.makefile @@ -0,0 +1,16 @@ +# XBee modems in API mode +# +# Expected from board file or overriden as xml param : +# +# MODEM_PORT +# MODEM_BAUD +# + +XBEE_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z) + +$(TARGET).CFLAGS += -DUSE_$(MODEM_PORT) +$(TARGET).CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) -DXBEE_BAUD=$(MODEM_BAUD) + +$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(XBEE_MODEM_PORT_LOWER) -DXBEE_UART=$(XBEE_MODEM_PORT_LOWER) +$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=xbee_tp -DDATALINK=XBEE +$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/xbee.c subsystems/datalink/telemetry.c diff --git a/sw/airborne/subsystems/datalink/downlink.h b/sw/airborne/subsystems/datalink/downlink.h index 816725db8e5..d0970fcd793 100644 --- a/sw/airborne/subsystems/datalink/downlink.h +++ b/sw/airborne/subsystems/datalink/downlink.h @@ -76,12 +76,6 @@ #define DefaultChannel DOWNLINK_TRANSPORT #endif -// FIXME are DOWNLINK_AP|FBW_DEVICE distinction really necessary ? -// by default use AP_DEVICE if nothing is set ? -#ifndef DOWNLINK_DEVICE -#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE -#endif - #ifndef DefaultDevice #define DefaultDevice DOWNLINK_DEVICE #endif