diff --git a/conf/airframes/examples/quadrotor_lisa_mx.xml b/conf/airframes/examples/quadrotor_lisa_mx.xml index 23ab521a19..265e887ffd 100644 --- a/conf/airframes/examples/quadrotor_lisa_mx.xml +++ b/conf/airframes/examples/quadrotor_lisa_mx.xml @@ -42,6 +42,12 @@ + + + + + + diff --git a/conf/firmwares/subsystems/shared/radio_control_datalink.makefile b/conf/firmwares/subsystems/shared/radio_control_datalink.makefile index d24c413b5a..9a9db15cbd 100644 --- a/conf/firmwares/subsystems/shared/radio_control_datalink.makefile +++ b/conf/firmwares/subsystems/shared/radio_control_datalink.makefile @@ -14,10 +14,10 @@ RADIO_CONTROL_LED ?= none ifeq ($(NORADIO), False) ifneq ($(RADIO_CONTROL_DATALINK_LED),none) - ap.CFLAGS += -DRADIO_CONTROL_DATALINK_LED=$(RADIO_CONTROL_DATALINK_LED) + RC_CFLAGS += -DRADIO_CONTROL_DATALINK_LED=$(RADIO_CONTROL_DATALINK_LED) endif ifneq ($(RADIO_CONTROL_LED),none) - ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) + RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) fbw.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) endif $(TARGET).CFLAGS += -DRADIO_CONTROL @@ -27,4 +27,10 @@ ifeq ($(NORADIO), False) $(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) endif diff --git a/conf/firmwares/subsystems/shared/radio_control_ppm.makefile b/conf/firmwares/subsystems/shared/radio_control_ppm.makefile index 19801b6e74..74df6d705e 100644 --- a/conf/firmwares/subsystems/shared/radio_control_ppm.makefile +++ b/conf/firmwares/subsystems/shared/radio_control_ppm.makefile @@ -16,6 +16,7 @@ ifeq ($(NORADIO), False) 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 diff --git a/conf/firmwares/subsystems/shared/radio_control_sbus.makefile b/conf/firmwares/subsystems/shared/radio_control_sbus.makefile index 433a151085..8d977522eb 100644 --- a/conf/firmwares/subsystems/shared/radio_control_sbus.makefile +++ b/conf/firmwares/subsystems/shared/radio_control_sbus.makefile @@ -5,7 +5,7 @@ RADIO_CONTROL_LED ?= none ifneq ($(RADIO_CONTROL_LED),none) - ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) + RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) endif $(TARGET).CFLAGS += -DRADIO_CONTROL @@ -14,11 +14,16 @@ $(TARGET).CFLAGS += -DRADIO_CONTROL SBUS_PORT_UPPER=$(shell echo $(SBUS_PORT) | tr a-z A-Z) SBUS_PORT_LOWER=$(shell echo $(SBUS_PORT) | tr A-Z a-z) -$(TARGET).CFLAGS += -DUSE_$(SBUS_PORT_UPPER) -D$(SBUS_PORT_UPPER)_BAUD=B100000 -$(TARGET).CFLAGS += -DSBUS_UART_DEV=$(SBUS_PORT_LOWER) -$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/sbus.h\" -$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_SBUS -$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control.c -$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control/sbus.c -$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control/sbus_common.c +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_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) diff --git a/conf/firmwares/subsystems/shared/radio_control_spektrum.makefile b/conf/firmwares/subsystems/shared/radio_control_spektrum.makefile index 6e92d28d91..b19d2cdf4d 100644 --- a/conf/firmwares/subsystems/shared/radio_control_spektrum.makefile +++ b/conf/firmwares/subsystems/shared/radio_control_spektrum.makefile @@ -8,25 +8,31 @@ ifndef RADIO_CONTROL_SPEKTRUM_MODEL RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\" endif -ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind -ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/spektrum.h\" +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) -ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL) +RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL) endif ifneq ($(RADIO_CONTROL_LED),none) -ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) +RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) endif -ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT) -ap.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER +RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT) +RC_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) -ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_SECONDARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT) -ap.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)_IRQ_HANDLER +RC_CFLAGS += -DRADIO_CONTROL_SPEKTRUM_SECONDARY_PORT=SPEKTRUM_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT) +RC_CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)_IRQ_HANDLER endif endif -ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \ +RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c \ $(SRC_SUBSYSTEMS)/radio_control/spektrum.c \ $(SRC_ARCH)/subsystems/radio_control/spektrum_arch.c + +ap.CFLAGS += $(RC_CFLAGS) +ap.srcs += $(RC_SRCS) + +test_radio_control.CFLAGS += $(RC_CFLAGS) +test_radio_control.srcs += $(RC_SRCS) diff --git a/conf/firmwares/subsystems/shared/radio_control_superbitrf_rc.makefile b/conf/firmwares/subsystems/shared/radio_control_superbitrf_rc.makefile index 218a7c194c..bd409765fc 100644 --- a/conf/firmwares/subsystems/shared/radio_control_superbitrf_rc.makefile +++ b/conf/firmwares/subsystems/shared/radio_control_superbitrf_rc.makefile @@ -4,14 +4,20 @@ RADIO_CONTROL_LED ?= none -ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE_SUPERBITRF -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/superbitrf_rc.h\" -ap.CFLAGS += -DUSE_SUPERBITRF -DUSE_SPI2 -DUSE_SPI_SLAVE2 +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) -ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) +RC_CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) endif -ap.srcs += peripherals/cyrf6936.c \ +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) diff --git a/conf/firmwares/test_progs.makefile b/conf/firmwares/test_progs.makefile index a3a1059cd0..890774568d 100644 --- a/conf/firmwares/test_progs.makefile +++ b/conf/firmwares/test_progs.makefile @@ -327,3 +327,16 @@ test_imu.srcs += $(COMMON_TELEMETRY_SRCS) test_imu.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c test_imu.srcs += test/subsystems/test_imu.c test_imu.srcs += math/pprz_trig_int.c + + +# +# test_radio_control +# +# add appropriate radio_control subsystem to target! +# +test_radio_control.ARCHDIR = $(ARCH) +test_radio_control.CFLAGS += $(COMMON_TEST_CFLAGS) +test_radio_control.srcs += $(COMMON_TEST_SRCS) +test_radio_control.CFLAGS += $(COMMON_TELEMETRY_CFLAGS) +test_radio_control.srcs += $(COMMON_TELEMETRY_SRCS) +test_radio_control.srcs += test/subsystems/test_radio_control.c diff --git a/sw/airborne/test/subsystems/test_radio_control.c b/sw/airborne/test/subsystems/test_radio_control.c index 3f0fcfd0bb..44cab29a20 100644 --- a/sw/airborne/test/subsystems/test_radio_control.c +++ b/sw/airborne/test/subsystems/test_radio_control.c @@ -34,7 +34,6 @@ static inline void main_init( void ); static inline void main_periodic_task( void ); static inline void main_event_task( void ); static void main_on_radio_control_frame( void ); -//static void main_on_radio_control_status_changed( void ); int main( void ) { main_init(); @@ -94,8 +93,3 @@ static void main_on_radio_control_frame( void ) { } -/* -static void main_on_radio_control_status_changed( void ) { - -} -*/