mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[radio control] spektrum also usable for intermcu
This commit is contained in:
@@ -195,12 +195,9 @@
|
||||
<define name="USE_AD1" value="1"/>
|
||||
<configure name="ACTUATORS" value="actuators_ppm"/>
|
||||
<define name="ADC_CHANNEL_VSUPPLY" value="AdcBank0\(6\)"/>
|
||||
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
</target>
|
||||
|
||||
<target name="sim" board="pc">
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
<subsystem name="control"/>
|
||||
<subsystem name="navigation"/>
|
||||
</target>
|
||||
@@ -212,6 +209,7 @@
|
||||
<define name="LOITER_TRIM"/>
|
||||
<define name="RADIO_CONTROL_AUTO1"/>
|
||||
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
|
||||
<subsystem name="telemetry" type="xbee_api">
|
||||
<configure name="MODEM_PORT" value="UART0"/>
|
||||
|
||||
@@ -253,6 +253,8 @@
|
||||
</target>
|
||||
|
||||
<target name="fbw" board="lisa_m_2.0">
|
||||
<configure name="SEPARATE_FBW" value="1"/>
|
||||
|
||||
<configure name="SYS_TIME_LED" value="2"/>
|
||||
<define name="RADIO_CONTROL_LED" value="4"/>
|
||||
<define name="LINK_MCU_LED" value="3"/>
|
||||
@@ -260,8 +262,6 @@
|
||||
<define name="OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP" value="1"/>
|
||||
<define name="OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_AP_CAN_FORCE_FAILSAFE" value="1"/>
|
||||
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
|
||||
<!-- split of ap/fbw specific subsystems for fbw -->
|
||||
<subsystem name="actuators" type="pwm"/>
|
||||
<subsystem name="intermcu" type="uart">
|
||||
@@ -270,7 +270,6 @@
|
||||
</target>
|
||||
|
||||
<target name="sim" board="pc">
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
<subsystem name="control"/>
|
||||
<subsystem name="navigation"/>
|
||||
</target>
|
||||
@@ -285,6 +284,10 @@
|
||||
<define name="WIND_INFO_RET"/>
|
||||
<define name="RADIO_CONTROL_AUTO1"/>
|
||||
|
||||
<subsystem name="radio_control" type="spektrum">
|
||||
<define name="RADIO_CONTROL_NB_CHANNEL" value="8"/>
|
||||
</subsystem>
|
||||
|
||||
<!-- Communication -->
|
||||
<subsystem name="telemetry" type="transparent">
|
||||
<configure name="MODEM_BAUD" value="B9600"/>
|
||||
|
||||
@@ -46,3 +46,6 @@ GPS_BAUD ?= B38400
|
||||
# e.g. <servo driver="Ppm">
|
||||
#
|
||||
ACTUATORS ?= actuators_pwm
|
||||
|
||||
# always enable SEPARATE_FBW
|
||||
SEPARATE_FBW = 1
|
||||
|
||||
@@ -3,10 +3,15 @@
|
||||
# InterMCU type CAN
|
||||
|
||||
ifneq ($(TARGET),sim)
|
||||
|
||||
# make sure that SEPARATE_FBW is configured
|
||||
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
|
||||
$(error Using intermcu via CAN, so dual mcu with separate fbw. Please add <configure name="SEPARATE_FBW" value="1"/>)
|
||||
endif
|
||||
|
||||
|
||||
$(TARGET).CFLAGS += -DINTER_MCU -DMCU_CAN_LINK
|
||||
$(TARGET).srcs += link_mcu_can.c
|
||||
$(TARGET).srcs += mcu_periph/can.c
|
||||
$(TARGET).srcs += $(SRC_ARCH)/mcu_periph/can_arch.c
|
||||
endif
|
||||
|
||||
SEPARATE_FBW=1
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
# InterMCU type SPI
|
||||
|
||||
# make sure that SEPARATE_FBW is configured
|
||||
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
|
||||
$(error Using intermcu via SPI, so dual mcu with separate fbw. Please add <configure name="SEPARATE_FBW" value="1"/>)
|
||||
endif
|
||||
|
||||
ifeq ($(INTER_MCU_SPI),)
|
||||
INTER_MCU_SPI = SPI1
|
||||
endif
|
||||
@@ -15,4 +20,3 @@ fbw.srcs += $(SRC_FIXEDWING)/link_mcu_spi.c mcu_periph/spi.c $(SRC_ARCH)/mcu_
|
||||
ap_srcs += $(SRC_FIRMWARE)/fbw_downlink.c
|
||||
ap.CFLAGS += -DMCU_SPI_LINK -DUSE_$(INTER_MCU_SPI) -DSPI_MASTER -DUSE_SPI_$(INTER_MCU_SLAVE) -DUSE_SPI
|
||||
ap.srcs += $(SRC_FIXEDWING)/link_mcu_spi.c mcu_periph/spi.c $(SRC_ARCH)/mcu_periph/spi_arch.c
|
||||
SEPARATE_FBW = 1
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
# InterMCU type UART
|
||||
|
||||
# make sure that SEPARATE_FBW is configured
|
||||
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
|
||||
$(error Using intermcu via UART, so dual mcu with separate fbw. Please add <configure name="SEPARATE_FBW" value="1"/>)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),fbw)
|
||||
ifeq ($(INTERMCU_PORT),none)
|
||||
@@ -19,14 +23,3 @@ ifneq ($(TARGET),sim)
|
||||
$(TARGET).CFLAGS += -DINTER_MCU -DMCU_UART_LINK
|
||||
$(TARGET).srcs += ./link_mcu_usart.c
|
||||
endif
|
||||
|
||||
|
||||
|
||||
#############################
|
||||
# CAN:
|
||||
# fbw.srcs += ./link_mcu_can.c ./mcu_periph/can.c ./arch/stm32/mcu_periph/can_arch.c
|
||||
# fbw.CFLAGS += -DINTER_MCU -DMCU_CAN_LINK
|
||||
# $(TARGET).CFLAGS += -DCAN_SJW_TQ=CAN_SJW_1tq -DCAN_BS1_TQ=CAN_BS1_3tq -DCAN_BS2_TQ=CAN_BS2_4tq -DCAN_PRESCALER=12 -DUSE_CAN -DUSE_CAN1 -DUSE_USB_LP_CAN1_RX0_IRQ -DCAN_ERR_RESUME=DISABLE
|
||||
|
||||
SEPARATE_FBW=1
|
||||
|
||||
|
||||
@@ -1,36 +1,38 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
|
||||
|
||||
NORADIO = False
|
||||
|
||||
ifeq ($(BOARD),classix)
|
||||
ifeq ($(TARGET),ap)
|
||||
NORADIO = True
|
||||
endif
|
||||
endif
|
||||
|
||||
RADIO_CONTROL_DATALINK_LED ?= none
|
||||
RADIO_CONTROL_LED ?= none
|
||||
|
||||
ifeq ($(NORADIO), False)
|
||||
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)
|
||||
fbw.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"radio_control/rc_datalink.h\"
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_DATALINK
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control.c
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control/rc_datalink.c
|
||||
# arch only with sim target for compatibility (empty functions)
|
||||
sim.srcs += $(SRC_ARCH)/subsystems/radio_control/rc_datalink.c
|
||||
|
||||
ap.CFLAGS += $(RC_CFLAGS)
|
||||
ap.srcs += $(RC_SRCS)
|
||||
|
||||
test_radio_control.CFLAGS += $(RC_CFLAGS)
|
||||
test_radio_control.srcs += $(RC_SRCS)
|
||||
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
|
||||
|
||||
@@ -2,37 +2,43 @@
|
||||
# Makefile for shared radio_control ppm subsystem
|
||||
#
|
||||
|
||||
NORADIO = False
|
||||
RADIO_CONTROL_LED ?= none
|
||||
|
||||
ifeq ($(BOARD),classix)
|
||||
ifeq ($(TARGET),ap)
|
||||
NORADIO = True
|
||||
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
|
||||
|
||||
ifeq ($(ARCH),stm32)
|
||||
ifdef RADIO_CONTROL_PPM_PIN
|
||||
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 UART1_RX))
|
||||
$(TARGET).CFLAGS += -DPPM_CONFIG=1
|
||||
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 SERVO6))
|
||||
$(TARGET).CFLAGS += -DPPM_CONFIG=2
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(NORADIO), False)
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL
|
||||
ifneq ($(RADIO_CONTROL_LED),none)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
fbw.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
test_radio_control.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control.c
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control/ppm.c
|
||||
$(TARGET).srcs += $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
|
||||
ifeq ($(ARCH),stm32)
|
||||
ifdef RADIO_CONTROL_PPM_PIN
|
||||
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 UART1_RX))
|
||||
$(TARGET).CFLAGS += -DPPM_CONFIG=1
|
||||
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 SERVO6))
|
||||
$(TARGET).CFLAGS += -DPPM_CONFIG=2
|
||||
endif
|
||||
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
|
||||
|
||||
@@ -8,22 +8,31 @@ ifneq ($(RADIO_CONTROL_LED),none)
|
||||
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL
|
||||
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_CFLAGS += -DUSE_$(SBUS_PORT_UPPER) -D$(SBUS_PORT_UPPER)_BAUD=B100000
|
||||
RC_CFLAGS += -DSBUS_UART_DEV=$(SBUS_PORT_LOWER)
|
||||
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/sbus.h\"
|
||||
RC_CFLAGS += -DRADIO_CONTROL_TYPE_SBUS
|
||||
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
|
||||
|
||||
ap.CFLAGS += $(RC_CFLAGS)
|
||||
ap.srcs += $(RC_SRCS)
|
||||
|
||||
test_radio_control.CFLAGS += $(RC_CFLAGS)
|
||||
test_radio_control.srcs += $(RC_SRCS)
|
||||
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
|
||||
|
||||
@@ -14,8 +14,9 @@ ifneq ($(RADIO_CONTROL_LED),none)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL
|
||||
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:
|
||||
SBUS1_PORT_UPPER=$(shell echo $(SBUS1_PORT) | tr a-z A-Z)
|
||||
@@ -23,13 +24,26 @@ 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)
|
||||
|
||||
$(TARGET).CFLAGS += -DUSE_$(SBUS1_PORT_UPPER) -D$(SBUS1_PORT_UPPER)_BAUD=B100000
|
||||
$(TARGET).CFLAGS += -DUSE_$(SBUS2_PORT_UPPER) -D$(SBUS2_PORT_UPPER)_BAUD=B100000
|
||||
$(TARGET).CFLAGS += -DSBUS1_UART_DEV=$(SBUS1_PORT_LOWER)
|
||||
$(TARGET).CFLAGS += -DSBUS2_UART_DEV=$(SBUS2_PORT_LOWER)
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/sbus_dual.h\"
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_SBUS
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control.c
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control/sbus_dual.c
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control/sbus_common.c
|
||||
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_H=\"subsystems/radio_control/sbus_dual.h\"
|
||||
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
|
||||
|
||||
@@ -4,26 +4,29 @@
|
||||
|
||||
RADIO_CONTROL_LED ?= none
|
||||
|
||||
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
|
||||
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
|
||||
endif
|
||||
|
||||
RC_CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind
|
||||
RC_CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/spektrum.h\"
|
||||
ifeq ($(ARCH), lpc21)
|
||||
RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
|
||||
endif
|
||||
ifneq ($(RADIO_CONTROL_LED),none)
|
||||
RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
|
||||
RC_CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER
|
||||
|
||||
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_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_SECONDARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)
|
||||
RC_CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)_IRQ_HANDLER
|
||||
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
|
||||
|
||||
@@ -31,8 +34,19 @@ RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/spektrum.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/spektrum_arch.c
|
||||
|
||||
$(TARGET).CFLAGS += $(RC_CFLAGS)
|
||||
$(TARGET).srcs += $(RC_SRCS)
|
||||
|
||||
test_radio_control.CFLAGS += $(RC_CFLAGS)
|
||||
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)
|
||||
|
||||
@@ -3,21 +3,30 @@
|
||||
#
|
||||
|
||||
RADIO_CONTROL_LED ?= none
|
||||
|
||||
RC_CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE_SUPERBITRF -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/superbitrf_rc.h\"
|
||||
RC_CFLAGS += -DUSE_SUPERBITRF -DUSE_SPI2 -DUSE_SPI_SLAVE2
|
||||
|
||||
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
|
||||
|
||||
ap.CFLAGS += $(RC_CFLAGS)
|
||||
ap.srcs += $(RC_SRCS)
|
||||
|
||||
test_radio_control.CFLAGS += $(RC_CFLAGS)
|
||||
test_radio_control.srcs += $(RC_SRCS)
|
||||
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
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "subsystems/radio_control.h"
|
||||
#include "subsystems/radio_control/spektrum.h"
|
||||
|
||||
#include "std.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
#if USE_NPS
|
||||
|
||||
@@ -45,14 +45,6 @@
|
||||
#include "subsystems/electrical.h"
|
||||
#include "firmwares/fixedwing/main_fbw.h"
|
||||
|
||||
#ifndef SINGLE_MCU
|
||||
// If radio_control defines
|
||||
#ifdef RADIO_CONTROL_NB_CHANNEL
|
||||
#undef RADIO_CONTROL_NB_CHANNEL
|
||||
#endif
|
||||
#include "generated/radio.h"
|
||||
#define RADIO_CONTROL_NB_CHANNEL RADIO_CTL_NB
|
||||
#endif
|
||||
|
||||
/** Data structure shared by fbw and ap processes */
|
||||
struct fbw_state {
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
#ifndef RADIO_CONTROL_H
|
||||
#define RADIO_CONTROL_H
|
||||
|
||||
#if defined RADIO_CONTROL
|
||||
|
||||
#include "led.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "paparazzi.h"
|
||||
|
||||
/* underlying hardware */
|
||||
/* underlying hardware, also include if RADIO_CONTROL is not defined for ap in dual mcu case */
|
||||
#include RADIO_CONTROL_TYPE_H
|
||||
|
||||
#if defined RADIO_CONTROL
|
||||
/* must be defined by underlying hardware */
|
||||
extern void radio_control_impl_init(void);
|
||||
/* RADIO_CONTROL_NB_CHANNEL has to be defined by the implementation */
|
||||
|
||||
Reference in New Issue
Block a user