diff --git a/conf/airframes/Poine/booz2_a7.xml b/conf/airframes/Poine/booz2_a7.xml index d3b42fb2f7..dbe89e64b9 100644 --- a/conf/airframes/Poine/booz2_a7.xml +++ b/conf/airframes/Poine/booz2_a7.xml @@ -206,6 +206,7 @@ + diff --git a/conf/autopilot/lisa_l_test_progs.makefile b/conf/autopilot/lisa_l_test_progs.makefile index 27366fed21..4bfb7548a6 100644 --- a/conf/autopilot/lisa_l_test_progs.makefile +++ b/conf/autopilot/lisa_l_test_progs.makefile @@ -195,3 +195,38 @@ test_rc_ppm.srcs += $(SRC_BOOZ)/booz_radio_control.c \ $(SRC_BOOZ)/radio_control/booz_radio_control_ppm.c \ $(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_ppm_arch.c test_rc_ppm.CFLAGS += -DUSE_TIM2_IRQ + +# +# test_adc +# +# configuration +# SYS_TIME_LED +# MODEM_PORT +# MODEM_BAUD +# RADIO_CONTROL_LED +# +test_adc.ARCHDIR = $(ARCHI) +test_adc.TARGET = test_adc +test_adc.TARGETDIR = test_adc +test_adc.CFLAGS = -I$(SRC_LISA) -I$(ARCHI) -DPERIPHERALS_AUTO_INIT +test_adc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) +test_adc.srcs = $(SRC_LISA)/test_adc.c \ + $(SRC_ARCH)/stm32_exceptions.c \ + $(SRC_ARCH)/stm32_vector_table.c +test_adc.CFLAGS += -DUSE_LED +test_adc.srcs += $(SRC_ARCH)/led_hw.c +test_adc.CFLAGS += -DUSE_SYS_TIME +test_adc.CFLAGS +=-DSYS_TIME_LED=$(SYS_TIME_LED) +test_adc.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' +test_adc.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c + +test_adc.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) +test_adc.srcs += $(SRC_ARCH)/uart_hw.c +test_adc.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart2 + +test_adc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) +test_adc.srcs += downlink.c pprz_transport.c + +test_adc.srcs += $(SRC_ARCH)/adc_hw.c +test_adc.CFLAGS += -DUSE_AD1 -DUSE_AD1_1 -DUSE_AD1_2 -DUSE_AD1_3 -DUSE_AD1_4 +test_adc.CFLAGS += -DUSE_ADC1_2_IRQ_HANDLER \ No newline at end of file diff --git a/sw/airborne/lisa/test_adc.c b/sw/airborne/lisa/test_adc.c index a0c754cb08..f823cab49d 100644 --- a/sw/airborne/lisa/test_adc.c +++ b/sw/airborne/lisa/test_adc.c @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2009 Antoine Drouin + * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. * @@ -18,7 +18,8 @@ * 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. + * Boston, MA 02111-1307, USA. + * */ #include @@ -47,9 +48,7 @@ extern uint8_t adc_new_data_trigger; static inline void main_init( void ) { hw_init(); sys_time_init(); - led_init(); - adc_init(); - + adc_init(); adc_buf_channel(0, &adc0_buf, 3); adc_buf_channel(1, &adc1_buf, 3); adc_buf_channel(2, &adc2_buf, 3); @@ -57,32 +56,33 @@ static inline void main_init( void ) { } int main( void ) { - main_init(); - - while(1) { - if (sys_time_periodic()) { - main_periodic_task(); - DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); - } - - main_event_task(); - } - return 0; + main_init(); + + while(1) { + if (sys_time_periodic()) { + main_periodic_task(); + } + main_event_task(); + } + return 0; } static inline void main_periodic_task( void ) { - LED_PERIODIC(); + RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);}); + RunOnceEvery(100, {/*LED_TOGGLE(7);*/ DOWNLINK_SEND_TIME(DefaultChannel, &cpu_time_sec);}); + LED_PERIODIC(); } static inline void main_event_task( void ) { - uint8_t down = 123; - - if (adc_new_data_trigger) { - DOWNLINK_SEND_PONG(DefaultChannel); - adc_new_data_trigger = 0; - LED_TOGGLE(7); -// down = (((adc0_buf.values[0]) >> 4) & 0x00ff); - DOWNLINK_SEND_BOOZ_DEBUG_FOO(DefaultChannel, &down); - } + + if (adc_new_data_trigger) { + adc_new_data_trigger = 0; + uint16_t v1 = 123; + uint16_t v2 = 123; + v1 = (((adc0_buf.values[0]) >> 4) & 0x00ff); + v2 = (((adc1_buf.values[0]) >> 4) & 0x00ff); + RunOnceEvery(100, {DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &v1, &v2)}); + } + } diff --git a/sw/airborne/stm32/stm32_vector_table.c b/sw/airborne/stm32/stm32_vector_table.c index 01628537a1..28070beed1 100644 --- a/sw/airborne/stm32/stm32_vector_table.c +++ b/sw/airborne/stm32/stm32_vector_table.c @@ -152,6 +152,13 @@ extern void dma1_c4_irq_handler(void); #define DMA1_C4_IRQ_HANDLER null_handler #endif +#ifdef USE_ADC1_2_IRQ_HANDLER +extern void adc1_2_irq_handler(void); +#define ADC1_2_IRQ_HANDLER adc1_2_irq_handler +#else +#define ADC1_2_IRQ_HANDLER null_handler +#endif + #ifdef USE_TIM1_UP_IRQ extern void tim1_up_irq_handler(void); @@ -229,7 +236,7 @@ void (* const vector_table[])(void) = { null_handler, /* dma1_channel5_irq_handler */ null_handler, /* dma1_channel6_irq_handler */ null_handler, /* dma1_channel7_irq_handler */ - null_handler, /* adc1_2_irq_handler */ + ADC1_2_IRQ_HANDLER, /* adc1_2_irq_handler */ USB_HP_CAN1_TX_IRQ_HANDLER, /* usb_hp_can_tx_irq_handler */ USB_LP_CAN1_RX0_IRQ_HANDLER, /* usb_lp_can_rx0_irq_handler */ null_handler, /* can_rx1_irq_handler */