[modules] mavlink: easily configure UDP

This commit is contained in:
Felix Ruess
2014-12-11 15:33:35 +01:00
parent 22603a0037
commit 8183d9bdd9
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -3,7 +3,7 @@
<module name="datalink">
<doc>
<description>Basic MAVLink implementation</description>
<configure name="MAVLINK_PORT" value="UARTx|UDPx" description="The port device to use for mavlink"/>
<configure name="MAVLINK_PORT" value="UARTx|UDPx|UsbS" description="The port device to use for mavlink (default: UART1)"/>
<configure name="MAVLINK_BAUD" value="B57600" description="Baud rate if MAVLINK_PORT is a UART"/>
</doc>
<header>
@@ -18,18 +18,23 @@
<file name="mavlink.c"/>
<raw>
MAVLINK_PORT ?= UART1
MAVLINK_BAUD ?= B57600
MAVLINK_PORT_LOWER=$(shell echo $(MAVLINK_PORT) | tr A-Z a-z)
MAVLINK_PORT_UPPER=$(shell echo $(MAVLINK_PORT) | tr a-z A-Z)
ifeq ($(MAVLINK_PORT), UsbS)
ap.CFLAGS += -DUSE_USB_SERIAL
ap.srcs += $(SRC_ARCH)/usb_ser_hw.c
ap.CFLAGS += -DMAVLINK_DEV=UsbS
else
ifeq ($(findstring UDP,$(MAVLINK_PORT)), UDP)
include $(CFG_SHARED)/udp.makefile
$(TARGET).CFLAGS += -DMAVLINK_DEV=$(MAVLINK_PORT_UPPER)
$(TARGET).CFLAGS += -DUSE_$(MAVLINK_PORT_UPPER)
else
MAVLINK_BAUD ?= B57600
ap.CFLAGS += -DMAVLINK_DEV=$(MAVLINK_PORT_UPPER)
ap.CFLAGS += -DUSE_$(MAVLINK_PORT_UPPER)
ap.CFLAGS += -D$(MAVLINK_PORT_UPPER)_BAUD=$(MAVLINK_BAUD)
endif
endif
</raw>
</makefile>
</module>
+1 -1
View File
@@ -46,7 +46,7 @@
extern mavlink_system_t mavlink_system;
#ifndef MAVLINK_DEV
#define MAVLINK_DEV UDP0
#define MAVLINK_DEV UART1
#endif
/*