[modules] convert radio_control subsystems to modules

- calling init functions will be done later, it needs to be attached to
  the FBW part
- add 'cond' attribute option to more nodes in module makefile section
This commit is contained in:
Gautier Hattenberger
2017-01-12 14:25:20 +01:00
committed by Felix Ruess
parent 312e366f4e
commit bf3def687d
14 changed files with 290 additions and 264 deletions
@@ -1,38 +0,0 @@
# Hey Emacs, this is a -*- makefile -*-
RADIO_CONTROL_DATALINK_LED ?= none
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_DATALINK_LED),none)
RC_CFLAGS += -DRADIO_CONTROL_DATALINK_LED=$(RADIO_CONTROL_DATALINK_LED)
endif
ifneq ($(RADIO_CONTROL_LED),none)
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"radio_control/rc_datalink.h\"
RC_FBW_CFLAGS += -DRADIO_CONTROL
RC_FBW_CFLAGS += -DRADIO_CONTROL_TYPE_DATALINK
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/rc_datalink.c
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
# Single MCU's run RC on ap target
$(TARGET).CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
$(TARGET).srcs += $(RC_SRCS)
else
# Dual MCU case
fbw.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
fbw.srcs += $(RC_SRCS)
# define RADIO_CONTROL_TYPE for ap in dual_mcu case to get defines
# but don't add source files
ap.CFLAGS += $(RC_CFLAGS)
endif
# arch only with sim target for compatibility (empty functions)
sim.srcs += $(SRC_ARCH)/subsystems/radio_control/rc_datalink.c
@@ -1,48 +0,0 @@
#
# Makefile for shared radio_control ppm subsystem
#
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_LED),none)
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
RC_FBW_CFLAGS += -DRADIO_CONTROL
RC_FBW_CFLAGS += -DRADIO_CONTROL_TYPE_PPM
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/ppm.c
RC_SRCS += $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
#
# Some STM32 boards have the option to configure RADIO_CONTROL_PPM_PIN.
# See the board makefile for configure options of the pins.
# If they set the PPM_CONFIG makefile variable, add it to the target.
# The PPM_CONFIG define is then used in the <board>.h file to set the configuration.
#
ifeq ($(ARCH),stm32)
ifdef PPM_CONFIG
$(TARGET).CFLAGS += -DPPM_CONFIG=$(PPM_CONFIG)
endif
endif
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
# Single MCU's run RC on ap target
$(TARGET).CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
$(TARGET).srcs += $(RC_SRCS)
else
# Dual MCU case
fbw.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
fbw.srcs += $(RC_SRCS)
# define RADIO_CONTROL_TYPE for ap in dual_mcu case to get defines
# but don't add source files
ap.CFLAGS += $(RC_CFLAGS)
endif
# dummy stuff so you don't have to unload superbitrf.xml settings file for simulators
nps.srcs += $(SRC_ARCH)/subsystems/datalink/superbitrf.c
sim.srcs += $(SRC_ARCH)/subsystems/datalink/superbitrf.c
@@ -1,38 +0,0 @@
#
# Makefile for shared radio_control SBUS subsystem
#
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_LED),none)
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/sbus.h\"
RC_FBW_CFLAGS += -DRADIO_CONTROL
# convert SBUS_PORT to upper and lower case strings:
SBUS_PORT_UPPER=$(shell echo $(SBUS_PORT) | tr a-z A-Z)
SBUS_PORT_LOWER=$(shell echo $(SBUS_PORT) | tr A-Z a-z)
RC_FBW_CFLAGS += -DUSE_$(SBUS_PORT_UPPER) -D$(SBUS_PORT_UPPER)_BAUD=B100000
RC_FBW_CFLAGS += -DSBUS_UART_DEV=$(SBUS_PORT_LOWER)
RC_FBW_CFLAGS += -DRADIO_CONTROL_TYPE_SBUS
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/sbus.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/sbus_common.c
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
# Single MCU's run RC on ap target
$(TARGET).CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
$(TARGET).srcs += $(RC_SRCS)
else
# Dual MCU case
fbw.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
fbw.srcs += $(RC_SRCS)
# define RADIO_CONTROL_TYPE for ap in dual_mcu case to get defines
# but don't add source files
ap.CFLAGS += $(RC_CFLAGS)
endif
@@ -1,48 +0,0 @@
#
# Makefile for shared radio_control SBUS subsystem
#
# Uart polarity needs to be reversed:
# define RC_POLARITY_GPIO_PORT <SET_TO_SBUS_RX_PIN_GPIO>
# define RC_POLARITY_GPIO_PIN <SET_TO_SBUS_RX_PIN_GPIO_PIN>
#
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_LED),none)
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/sbus_dual.h\"
RC_FBW_CFLAGS += -DRADIO_CONTROL
# convert SBUS_PORT to upper and lower case strings:
SBUS1_PORT_UPPER=$(shell echo $(SBUS1_PORT) | tr a-z A-Z)
SBUS1_PORT_LOWER=$(shell echo $(SBUS1_PORT) | tr A-Z a-z)
SBUS2_PORT_UPPER=$(shell echo $(SBUS2_PORT) | tr a-z A-Z)
SBUS2_PORT_LOWER=$(shell echo $(SBUS2_PORT) | tr A-Z a-z)
RC_FBW_CFLAGS += -DUSE_$(SBUS1_PORT_UPPER) -D$(SBUS1_PORT_UPPER)_BAUD=B100000
RC_FBW_CFLAGS += -DUSE_$(SBUS2_PORT_UPPER) -D$(SBUS2_PORT_UPPER)_BAUD=B100000
RC_FBW_CFLAGS += -DSBUS1_UART_DEV=$(SBUS1_PORT_LOWER)
RC_FBW_CFLAGS += -DSBUS2_UART_DEV=$(SBUS2_PORT_LOWER)
RC_FBW_CFLAGS += -DRADIO_CONTROL_TYPE_SBUS
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/sbus_dual.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/sbus_common.c
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
# Single MCU's run RC on ap target
$(TARGET).CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
$(TARGET).srcs += $(RC_SRCS)
else
# Dual MCU case
fbw.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
fbw.srcs += $(RC_SRCS)
# define RADIO_CONTROL_TYPE for ap in dual_mcu case to get defines
# but don't add source files
ap.CFLAGS += $(RC_CFLAGS)
endif
@@ -1,53 +0,0 @@
#
# Makefile for shared radio_control spektrum susbsytem
#
# Define USE_DSMX on STM32 microcontrollers to bind in DSMX instead of DSM2
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_LED),none)
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/spektrum.h\"
ifeq ($(ARCH), lpc21)
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
endif
RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
endif
RC_FBW_CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind
RC_FBW_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
RC_FBW_CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER
# enable the second spektrum port if so configured
ifdef USE_SECONDARY_SPEKTRUM_RECEIVER
ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)
RC_FBW_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_SECONDARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)
RC_FBW_CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)_IRQ_HANDLER
endif
endif
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c \
$(SRC_SUBSYSTEMS)/radio_control/spektrum.c \
$(SRC_ARCH)/subsystems/radio_control/spektrum_arch.c
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
# Single MCU's run RC on ap target
$(TARGET).CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
$(TARGET).srcs += $(RC_SRCS)
else
# Dual MCU case
fbw.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
fbw.srcs += $(RC_SRCS)
# define RADIO_CONTROL_TYPE for ap in dual_mcu case to get defines
# but don't add source files
ap.CFLAGS += $(RC_CFLAGS)
endif
test_radio_control.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
test_radio_control.srcs += $(RC_SRCS)
@@ -1,32 +0,0 @@
#
# Makefile for shared radio_control superbitrf subsystem
#
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_LED),none)
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/superbitrf_rc.h\"
RC_FBW_CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE_SUPERBITRF
RC_FBW_CFLAGS += -DUSE_SUPERBITRF -DUSE_SPI2 -DUSE_SPI_SLAVE2
RC_SRCS += peripherals/cyrf6936.c \
$(SRC_SUBSYSTEMS)/datalink/superbitrf.c\
$(SRC_SUBSYSTEMS)/radio_control.c \
$(SRC_SUBSYSTEMS)/radio_control/superbitrf_rc.c
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
# Single MCU's run RC on ap target
$(TARGET).CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
$(TARGET).srcs += $(RC_SRCS)
else
# Dual MCU case
fbw.CFLAGS += $(RC_CFLAGS) $(RC_FBW_CFLAGS)
fbw.srcs += $(RC_SRCS)
# define RADIO_CONTROL_TYPE for ap in dual_mcu case to get defines
# but don't add source files
ap.CFLAGS += $(RC_CFLAGS)
endif
+6 -3
View File
@@ -63,7 +63,8 @@ fun CDATA #REQUIRED>
<!ATTLIST makefile
target CDATA #IMPLIED
firmware CDATA #IMPLIED>
firmware CDATA #IMPLIED
cond CDATA #IMPLIED>
<!ATTLIST section
name CDATA #REQUIRED
@@ -95,11 +96,13 @@ value CDATA #REQUIRED>
<!ATTLIST file
name CDATA #REQUIRED
dir CDATA #IMPLIED>
dir CDATA #IMPLIED
cond CDATA #IMPLIED>
<!ATTLIST file_arch
name CDATA #REQUIRED
dir CDATA #IMPLIED>
dir CDATA #IMPLIED
cond CDATA #IMPLIED>
<!ATTLIST settings_file
name CDATA #REQUIRED
+34
View File
@@ -0,0 +1,34 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_datalink" dir="radio_control">
<doc>
<description>
Radio control over datalink
</description>
<configure name="RADIO_CONTROL_LED" value="none|num" description="LED number or 'none' to disable"/>
<configure name="RADIO_CONTROL_DATALINK_LED" value="none|num" description="LED number or 'none' to disable"/>
</doc>
<header>
<file name="rc_datalink.h" dir="subsystems/radio_control"/>
</header>
<makefile target="ap|fbw|sim|nps">
<configure name="RADIO_CONTROL_LED" default="none"/>
<configure name="RADIO_CONTROL_DATALINK_LED" default="none"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="RADIO_CONTROL_DATALINK_LED" value="$(RADIO_CONTROL_DATALINK_LED)" cond="ifneq ($(RADIO_CONTROL_DATALINK_LED),none)"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/radio_control/rc_datalink.h" type="string"/>
</makefile>
<makefile target="fbw|sim|nps">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_DATALINK"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="rc_datalink.c" dir="subsystems/radio_control"/>
</makefile>
<makefile target="ap" cond="ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_DATALINK"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="rc_datalink.c" dir="subsystems/radio_control"/>
</makefile>
</module>
+40
View File
@@ -0,0 +1,40 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_ppm" dir="radio_control">
<doc>
<description>
Radio control based on PPM input
Some STM32 boards have the option to configure RADIO_CONTROL_PPM_PIN.
See the board makefile for configure options of the pins.
If they set the PPM_CONFIG makefile variable, add it to the target.
The PPM_CONFIG define is then used in the _board_.h file to set the configuration.
</description>
<configure name="RADIO_CONTROL_LED" value="none|num" description="LED number or 'none' to disable"/>
<configure name="PPM_CONFIG" value="num" description="Select PPM config, as some boards can used different mapping for the ppm input pin"/>
</doc>
<header>
<file name="ppm.h" dir="subsystems/radio_control"/>
</header>
<makefile target="ap|fbw|sim|nps">
<configure name="RADIO_CONTROL_LED" default="none"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/radio_control/ppm.h" type="string"/>
<define name="PPM_CONFIG" value="$(PPM_CONFIG)" cond="ifdef PPM_CONFIG"/>
</makefile>
<makefile target="fbw|sim|nps">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_PPM"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="ppm.c" dir="subsystems/radio_control"/>
<file name="ppm_arch.c" dir="$(SRC_ARCH)/subsystems/radio_control"/>
</makefile>
<makefile target="ap" cond="ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_PPM"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="ppm.c" dir="subsystems/radio_control"/>
<file name="ppm_arch.c" dir="$(SRC_ARCH)/subsystems/radio_control"/>
</makefile>
</module>
+41
View File
@@ -0,0 +1,41 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_sbus" dir="radio_control">
<doc>
<description>
Radio control based on Futaba SBUS
</description>
<configure name="RADIO_CONTROL_LED" value="none|num" description="LED number or 'none' to disable"/>
<configure name="SBUS_PORT" value="UARTX" description="UART name where SBUS receiver is plugged"/>
</doc>
<header>
<file name="sbus.h" dir="subsystems/radio_control"/>
</header>
<makefile target="ap|fbw">
<configure name="RADIO_CONTROL_LED" default="none"/>
<configure name="SBUS_UART" value="$(SBUS_PORT)" case="upper|lower"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/radio_control/sbus.h" type="string"/>
</makefile>
<makefile target="fbw">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_SBUS"/>
<define name="USE_$(SBUS_UART_UPPER)"/>
<define name="$(SBUS_UART_UPPER)_BAUD" value="B100000"/>
<define name="SBUS_UART_DEV" value="$(SBUS_UART_LOWER)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="sbus.c" dir="subsystems/radio_control"/>
<file name="sbus_common.c" dir="subsystems/radio_control"/>
</makefile>
<makefile target="ap" cond="ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_SBUS"/>
<define name="USE_$(SBUS_UART_UPPER)"/>
<define name="$(SBUS_UART_UPPER)_BAUD" value="B100000"/>
<define name="SBUS_UART_DEV" value="$(SBUS_UART_LOWER)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="sbus.c" dir="subsystems/radio_control"/>
<file name="sbus_common.c" dir="subsystems/radio_control"/>
</makefile>
</module>
+49
View File
@@ -0,0 +1,49 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_sbus_dual" dir="radio_control">
<doc>
<description>
Radio control using two Futaba SBUS receivers
</description>
<configure name="RADIO_CONTROL_LED" value="none|num" description="LED number or 'none' to disable"/>
<configure name="SBUS1_PORT" value="UARTX" description="UART name where first SBUS receiver is plugged"/>
<configure name="SBUS2_PORT" value="UARTX" description="UART name where second SBUS receiver is plugged"/>
</doc>
<header>
<file name="sbus_dual.h" dir="subsystems/radio_control"/>
</header>
<makefile target="ap|fbw">
<configure name="RADIO_CONTROL_LED" default="none"/>
<configure name="SBUS1_UART" value="$(SBUS1_PORT)" case="upper|lower"/>
<configure name="SBUS2_UART" value="$(SBUS2_PORT)" case="upper|lower"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/radio_control/sbus_dual.h" type="string"/>
</makefile>
<makefile target="fbw">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_SBUS"/>
<define name="USE_$(SBUS1_UART_UPPER)"/>
<define name="USE_$(SBUS1_UART_UPPER)"/>
<define name="$(SBUS1_UART_UPPER)_BAUD" value="B100000"/>
<define name="$(SBUS2_UART_UPPER)_BAUD" value="B100000"/>
<define name="SBUS1_UART_DEV" value="$(SBUS1_UART_LOWER)"/>
<define name="SBUS1_UART_DEV" value="$(SBUS1_UART_LOWER)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="sbus_dual.c" dir="subsystems/radio_control"/>
<file name="sbus_common.c" dir="subsystems/radio_control"/>
</makefile>
<makefile target="ap" cond="ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_SBUS"/>
<define name="USE_$(SBUS1_UART_UPPER)"/>
<define name="USE_$(SBUS1_UART_UPPER)"/>
<define name="$(SBUS1_UART_UPPER)_BAUD" value="B100000"/>
<define name="$(SBUS2_UART_UPPER)_BAUD" value="B100000"/>
<define name="SBUS1_UART_DEV" value="$(SBUS1_UART_LOWER)"/>
<define name="SBUS1_UART_DEV" value="$(SBUS1_UART_LOWER)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="sbus_dual.c" dir="subsystems/radio_control"/>
<file name="sbus_common.c" dir="subsystems/radio_control"/>
</makefile>
</module>
+56
View File
@@ -0,0 +1,56 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_spektrum" dir="radio_control">
<doc>
<description>
Radio control based on Spektrum DSM2 or DSMX receivers
Define USE_DSMX on STM32 microcontrollers to bind in DSMX instead of DSM2
</description>
<configure name="RADIO_CONTROL_LED" value="none|num" description="LED number or 'none' to disable"/>
<configure name="RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT" value="num" description="UART number for primary spektrum receiver"/>
<configure name="RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT" value="num" description="UART number for optional secondary spektrum receiver"/>
<configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" value="0|1" description="enable secondary receiver (default: disabled)"/>
</doc>
<header>
<file name="spektrum.h" dir="subsystems/radio_control"/>
</header>
<makefile target="ap|fbw|sim|nps|test_radio_control">
<configure name="RADIO_CONTROL_LED" default="none"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/radio_control/spektrum.h" type="string"/>
<raw>
ifeq ($(ARCH), lpc21)
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
endif
RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
endif
</raw>
</makefile>
<makefile target="fbw|sim|nps|test_radio_control">
<configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" default="0"/>
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_BIND_IMPL_FUNC" value="radio_control_spektrum_try_bind"/>
<define name="RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT" value="SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)"/>
<define name="OVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER"/>
<define name="RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT" value="SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<define name="OVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="spektrum.c" dir="subsystems/radio_control"/>
<file name="spektrum_arch.c" dir="$(SRC_ARCH)/subsystems/radio_control"/>
</makefile>
<makefile target="ap" cond="ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))">
<configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" default="0"/>
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_BIND_IMPL_FUNC" value="radio_control_spektrum_try_bind"/>
<define name="RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT" value="SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)"/>
<define name="OVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER"/>
<define name="RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT" value="SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<define name="OVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="spektrum.c" dir="subsystems/radio_control"/>
<file name="spektrum_arch.c" dir="$(SRC_ARCH)/subsystems/radio_control"/>
</makefile>
</module>
@@ -0,0 +1,55 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_superbitrf_rc" dir="radio_control">
<doc>
<description>
Radio control based on the SuperbitRF chip
</description>
<configure name="RADIO_CONTROL_LED" value="none|num" description="LED number or 'none' to disable"/>
<configure name="SUPERBITRF_SPI_DEV" value="SPI2" description="SPI used for SuperbitRF"/>
<configure name="SUPERBITRF_SPI_SLAVE_IDX" value="2" description="SPI slave number for SuperbitRF"/>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="Superbit">
<dl_setting var="settings_store_flag" min="1" step="1" max="1" shortname="store" handler="StoreSettings" module="autopilot" values="Store"/>
<dl_setting var="superbitrf.bind_mfg_id32" type="uint32" min="0" step="1" max="4294967295" shortname ="mfg_id" persistent="true" module="subsystems/datalink/superbitrf" handler="set_mfg_id"/>
<dl_setting var="superbitrf.num_channels" type="uint8" min="0" step="1" max="14" shortname ="#chan" persistent="true" module="subsystems/datalink/superbitrf"/>
<dl_setting var="superbitrf.protocol" type="uint8" min="0" step="1" max="32" shortname ="prot" persistent="true" module="subsystems/datalink/superbitrf" handler="set_protocol"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="superbitrf_rc.h" dir="subsystems/radio_control"/>
</header>
<makefile target="ap|fbw|sim|nps">
<configure name="RADIO_CONTROL_LED" default="none"/>
<configure name="SUPERBITRF_SPI_DEV" default="SPI2"/>
<configure name="SUPERBITRF_SPI_SLAVE_IDX" default="2"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/radio_control/superbitrf_rc.h" type="string"/>
</makefile>
<makefile target="fbw">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_SUPERBITRF"/>
<define name="USE_SUPERBITRF"/>
<define name="USE_$(SUPERBITRF_SPI_DEV)"/>
<define name="USE_SPI_SLAVE$(SUPERBITRF_SPI_SLAVE_IDX)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="superbitrf_rc.c" dir="subsystems/radio_control"/>
<file name="superbitrf.c" dir="subsystems/datalink"/>
<file name="cyrf6936.c" dir="peripherals"/>
</makefile>
<makefile target="ap" cond="ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))">
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_TYPE_SUPERBITRF"/>
<define name="USE_SUPERBITRF"/>
<define name="USE_$(SUPERBITRF_SPI_DEV)"/>
<define name="USE_SPI_SLAVE$(SUPERBITRF_SPI_SLAVE_IDX)"/>
<file name="radio_control.c" dir="subsystems"/>
<file name="superbitrf_rc.c" dir="subsystems/radio_control"/>
<file name="superbitrf.c" dir="subsystems/datalink"/>
<file name="cyrf6936.c" dir="peripherals"/>
</makefile>
</module>
+9 -4
View File
@@ -108,10 +108,11 @@ let raw_xml2mk = fun f name xml ->
let file_xml2mk = fun f ?(arch = false) dir_name target xml ->
let name = Xml.attrib xml "name" in
let dir_name = ExtXml.attrib_or_default xml "dir" ("$(" ^ dir_name ^ ")") in
let cond, cond_end = try "\n"^(Xml.attrib xml "cond"), "\nendif" with Xml.No_attribute _ -> "", "" in
let fmt =
if arch then format_of_string "%s.srcs += arch/$(ARCH)/%s/%s\n"
else format_of_string "%s.srcs += %s/%s\n" in
fprintf f fmt target dir_name name
if arch then format_of_string "%s%s.srcs += arch/$(ARCH)/%s/%s%s\n"
else format_of_string "%s%s.srcs += %s/%s%s\n" in
fprintf f fmt cond target dir_name name cond_end
(* only print the configuration flags for a module
* 'raw' section are not handled here
@@ -171,6 +172,9 @@ let module_xml2mk = fun f target firmware m ->
else Xml.Element ("makefile", [], [])
with _ -> section end
in
(* add condition if need *)
let cond = try Some (Xml.attrib section "cond") with _ -> None in
let _ = match cond with Some c -> fprintf f "%s\n" c | None -> () in
Xml.iter
(fun field ->
match Compat.bytes_lowercase (Xml.tag field) with
@@ -184,7 +188,8 @@ let module_xml2mk = fun f target firmware m ->
| "file_arch" -> file_xml2mk f ~arch:true dir_name target field
| "raw" -> raw_xml2mk f name field
| _ -> ()
) section
) section;
match cond with Some _ -> fprintf f "endif\n" | None -> ()
) m.xml
let modules_xml2mk = fun f target ac_id xml fp ->