diff --git a/conf/airframes/mm/extra/probe_t.xml b/conf/airframes/mm/extra/probe_t.xml index 129b5e2f9c..b9120d8065 100755 --- a/conf/airframes/mm/extra/probe_t.xml +++ b/conf/airframes/mm/extra/probe_t.xml @@ -1,6 +1,40 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -184,66 +218,5 @@ - - -CONFIG = \"tiny_2_1.h\" - -include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile - -FLASH_MODE=IAP - -ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1 -ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c - -ap.srcs += commands.c - -ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 -ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c - -ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c - -ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 -ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c - -#TRANSPARENT -#ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600 -#ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c pprz_transport.c - - -ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c - -ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -ap.srcs += $(SRC_ARCH)/adc_hw.c - -ap.CFLAGS += -DGPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_USE_LATLONG -# -DGPS_LED=2 -ap.srcs += gps_ubx.c gps.c latlong.c - -ap.CFLAGS += -DINFRARED -DALT_KALMAN -DWIND_INFO -DWIND_INFO_RET -ap.srcs += infrared.c estimator.c - -ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM -ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c - -ap.srcs += nav_line.c -ap.srcs += nav_survey_rectangle.c - -# MAX11040 adc -ap.CFLAGS += -DMAX11040_DRDY_VIC_SLOT=12 -DSSP_VIC_SLOT=11 -DUSE_MAX11040 -ap.srcs += max11040.c $(SRC_ARCH)/max11040_hw.c - -ap.srcs += snav.c - -# Config for SITL simulation -include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile -sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -sim.srcs += nav_line.c nav_survey_rectangle.c - -sim.srcs += joystick.c -sim.CFLAGS += -DUSE_JOYSTICK - - - + diff --git a/conf/modules/max11040.xml b/conf/modules/max11040.xml new file mode 100644 index 0000000000..2c73114ee8 --- /dev/null +++ b/conf/modules/max11040.xml @@ -0,0 +1,14 @@ + + + +
+ +
+ + + + + + +
+ diff --git a/sw/airborne/arch/lpc21/max11040_hw.c b/sw/airborne/arch/lpc21/max11040_hw.c deleted file mode 100644 index 881b7a4abf..0000000000 --- a/sw/airborne/arch/lpc21/max11040_hw.c +++ /dev/null @@ -1,76 +0,0 @@ - -/* MAX11040 connected on SPI1 - - SS on P0.20 (SSEL) - DRDY on P0.16 (EINT0) -*/ - - -#include "led.h" -#include "max11040.h" - -#ifdef LOGGER -extern unsigned int getclock(void); -#endif - -volatile uint8_t num_irqs = 0; - -static void EXTINT_ISR(void) __attribute__((naked)); - -void max11040_hw_init( void ) { - - /* configure DRDY pin */ - /* connected pin to EXINT */ - MAXM_DRDY_PINSEL |= MAXM_DRDY_PINSEL_VAL << MAXM_DRDY_PINSEL_BIT; - SetBit(EXTMODE, MAXM_DRDY_EINT); /* EINT is edge trigered */ - ClearBit(EXTPOLAR, MAXM_DRDY_EINT); /* EINT is trigered on falling edge */ - SetBit(EXTINT, MAXM_DRDY_EINT); /* clear pending EINT */ - - /* initialize interrupt vector */ - VICIntSelect &= ~VIC_BIT( MAXM_DRDY_VIC_IT ); /* select EINT as IRQ source */ - VICIntEnable = VIC_BIT( MAXM_DRDY_VIC_IT ); /* enable it */ - _VIC_CNTL(MAX11040_DRDY_VIC_SLOT) = VIC_ENABLE | MAXM_DRDY_VIC_IT; - _VIC_ADDR(MAX11040_DRDY_VIC_SLOT) = (uint32_t)EXTINT_ISR; /* address of the ISR */ -} - -void EXTINT_ISR(void) { - ISR_ENTRY(); - - if (num_irqs++ == 5) - { - /* switch SSEL P0.20 to be used as GPIO */ - PINSEL1 &= ~(3 << 8); - IO0DIR |= 1 << 20; - max11040_status = MAX11040_DATA2; - } - - if (max11040_status == MAX11040_DATA2) { - -//LED_TOGGLE(2); -//LED_TOGGLE(3); - -#ifdef LOGGER - max11040_timestamp[max11040_buf_in] = getclock(); -#endif - - MaxmSelect(); - - /* read data */ - SSP_Send(0xF0); - SSP_Send(0x00); - SSP_Send(0x00); - SSP_Send(0x00); - SSP_Send(0x00); - SSP_Send(0x00); - SSP_Send(0x00); - - max11040_count = 0; - } - - /* clear EINT */ - SetBit(EXTINT, MAXM_DRDY_EINT); - - VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */ - ISR_EXIT(); -} - diff --git a/sw/airborne/max11040.c b/sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c similarity index 59% rename from sw/airborne/max11040.c rename to sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c index 9b4aa547cc..0dc8e53e2e 100644 --- a/sw/airborne/max11040.c +++ b/sw/airborne/arch/lpc21/modules/adcs/max11040_hw.c @@ -1,15 +1,46 @@ +/* + * $Id$ + * + * Copyright (C) 2010 Martin Mueller + * + * 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 "max11040.h" +/** \file max11040.c + * \brief Maxim MAX11040 ADC hw interface + * + * SS on P0.20 (SSEL) + * DRDY on P0.16 (EINT0) + */ -volatile uint8_t max11040_status; -volatile uint8_t max11040_data; -volatile int32_t max11040_values[MAX11040_BUF_SIZE][MAXM_NB_CHAN] = {{0}}; -volatile uint32_t max11040_timestamp[MAX11040_BUF_SIZE] = {0}; -volatile uint8_t max11040_count = 0; -volatile uint32_t max11040_buf_in = 0; -volatile uint32_t max11040_buf_out = 0; +#include "armVIC.h" +#include "max11040_hw.h" +#include "modules/adcs/max11040.h" + +#ifdef LOGGER +extern unsigned int getclock(void); +#endif + +volatile uint8_t num_irqs = 0; static void SSP_ISR(void) __attribute__((naked)); +static void EXTINT_ISR(void) __attribute__((naked)); static void SSP_ISR(void) { @@ -25,10 +56,10 @@ static void SSP_ISR(void) { foo = SSPDR; foo = SSPDR; /* write configuration register */ - SSP_Send(0x60); /* wr conf */ - SSP_Send(0x30); /* adc0: en24bit, xtalen, no faultdis */ + SSP_Send(0x60); /* wr conf */ + SSP_Send(0x30); /* adc0: en24bit, xtalen, no faultdis */ for (i=1; i