diff --git a/conf/autopilot/lisa_l_test_progs.makefile b/conf/autopilot/lisa_l_test_progs.makefile index 2a04cbbb14..e6cf380777 100644 --- a/conf/autopilot/lisa_l_test_progs.makefile +++ b/conf/autopilot/lisa_l_test_progs.makefile @@ -196,11 +196,11 @@ test_rc_spektrum.ARCHDIR = $(ARCH) test_rc_spektrum.CFLAGS += -I$(SRC_ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_rc_spektrum.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_rc_spektrum.srcs += $(SRC_AIRBORNE)/mcu.c \ - $(SRC_ARCH)/mcu_arch.c \ - $(SRC_BOOZ_TEST)/booz2_test_radio_control.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c +test_rc_spektrum.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + test/subsystems/test_radio_control.c \ + $(SRC_ARCH)/stm32_exceptions.c \ + $(SRC_ARCH)/stm32_vector_table.c test_rc_spektrum.CFLAGS += -DUSE_LED test_rc_spektrum.srcs += $(SRC_ARCH)/led_hw.c @@ -397,31 +397,31 @@ test_imu_b2_2.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 test_imu_aspirin.ARCHDIR = $(ARCH) test_imu_aspirin.CFLAGS = -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT test_imu_aspirin.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -test_imu_aspirin.srcs += $(SRC_AIRBORNE)/mcu.c \ - $(SRC_ARCH)/mcu_arch.c \ - $(SRC_BOOZ_TEST)/booz_test_imu.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c +test_imu_aspirin.srcs += $(SRC_AIRBORNE)/mcu.c \ + $(SRC_ARCH)/mcu_arch.c \ + $(SRC_BOOZ_TEST)/booz_test_imu.c \ + $(SRC_ARCH)/stm32_exceptions.c \ + $(SRC_ARCH)/stm32_vector_table.c test_imu_aspirin.CFLAGS += -DUSE_LED test_imu_aspirin.srcs += $(SRC_ARCH)/led_hw.c -test_imu_aspirin.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1 +test_imu_aspirin.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=$(SYS_TIME_LED) test_imu_aspirin.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' test_imu_aspirin.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c -test_imu_aspirin.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 +test_imu_aspirin.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) test_imu_aspirin.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -test_imu_aspirin.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 +test_imu_aspirin.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) test_imu_aspirin.srcs += downlink.c pprz_transport.c test_imu_aspirin.srcs += math/pprz_trig_int.c test_imu_aspirin.CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin.h\" -DIMU_OVERRIDE_CHANNELS test_imu_aspirin.srcs += $(SRC_SUBSYSTEMS)/imu.c \ - $(SRC_SUBSYSTEMS)/imu/imu_aspirin.c \ - $(SRC_ARCH)/subsystems/imu/imu_aspirin_arch.c + $(SRC_SUBSYSTEMS)/imu/imu_aspirin.c \ + $(SRC_ARCH)/subsystems/imu/imu_aspirin_arch.c test_imu_aspirin.srcs += peripherals/hmc5843.c $(SRC_ARCH)/peripherals/hmc5843_arch.c test_imu_aspirin.CFLAGS += -DUSE_I2C2 diff --git a/sw/airborne/test/subsystems/test_radio_control.c b/sw/airborne/test/subsystems/test_radio_control.c new file mode 100644 index 0000000000..9daf3a9afc --- /dev/null +++ b/sw/airborne/test/subsystems/test_radio_control.c @@ -0,0 +1,104 @@ +/* + * $Id$ + * + * Copyright (C) 2008-2010 The Paparazzi Team + * + * This file is part of Paparazzi. + * + * Paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * Paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include "mcu.h" +#include "sys_time.h" +#include "interrupt_hw.h" +#include "mcu_periph/uart.h" + +#include "downlink.h" + +#include "subsystems/radio_control.h" + +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(); + while(1) { + if (sys_time_periodic()) + main_periodic_task(); + main_event_task(); + } + return 0; +} + +static inline void main_init( void ) { + mcu_init(); + sys_time_init(); + radio_control_init(); + mcu_int_enable(); +} + +extern uint32_t debug_len; + +static inline void main_periodic_task( void ) { + + RunOnceEvery(51, { + /*LED_TOGGLE(2);*/ + uint32_t blaaa= cpu_time_sec; + DOWNLINK_SEND_TIME(DefaultChannel, &blaaa); + }); + + RunOnceEvery(10, {radio_control_periodic_task();}); + + int16_t foo = 0;//RC_PPM_SIGNED_TICS_OF_USEC(2050-1500); + RunOnceEvery(10, + {DOWNLINK_SEND_BOOZ2_RADIO_CONTROL(DefaultChannel, \ + &radio_control.values[RADIO_ROLL], \ + &radio_control.values[RADIO_PITCH], \ + &radio_control.values[RADIO_YAW], \ + &radio_control.values[RADIO_THROTTLE], \ + &radio_control.values[RADIO_MODE], \ + &foo, \ + &radio_control.status);}); +#ifdef RADIO_CONTROL_TYPE_PPM + RunOnceEvery(10, + {uint8_t blaa = 0; DOWNLINK_SEND_PPM(DefaultChannel,&blaa, 8, booz_radio_control_ppm_pulses);}); +#endif + + LED_PERIODIC(); +} + +static inline void main_event_task( void ) { + + RadioControlEvent(main_on_radio_control_frame); + +} + +static void main_on_radio_control_frame( void ) { + + // RunOnceEvery(10, {DOWNLINK_SEND_RC(RADIO_CONTROL_NB_CHANNEL, radio_control.values);}); + +} + +/* +static void main_on_radio_control_status_changed( void ) { + +} +*/