diff --git a/conf/autopilot/booz2_board_proto.h b/conf/autopilot/booz2_board_proto.h deleted file mode 100644 index ec05fa7bc4..0000000000 --- a/conf/autopilot/booz2_board_proto.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef CONFIG_TINY_H -#define CONFIG_TINY_H - -/* Master oscillator freq. */ -#define FOSC (12000000) - -/* PLL multiplier */ -#define PLL_MUL (5) - -/* CPU clock freq. */ -#define CCLK (FOSC * PLL_MUL) - -/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */ -#define PBSD_BITS 0x00 -#define PBSD_VAL 4 - -/* Peripheral bus clock freq. */ -#define PCLK (CCLK / PBSD_VAL) - -/* Onboard leds */ -#define LED_1_BANK 1 -#define LED_1_PIN 28 - -#define LED_2_BANK 1 -#define LED_2_PIN 19 - -/* Switch pin */ -#define LED_3_BANK 0 -#define LED_3_PIN 11 - -#define POWER_SWITCH_LED 3 - -/* daugther board leds */ -#define LED_4_BANK 0 -#define LED_4_PIN 15 - -#define LED_5_BANK 0 -#define LED_5_PIN 13 -#define LED_5_INVERTED - -#define LED_6_BANK 0 -#define LED_6_PIN 12 - -#define LED_7_BANK 0 -#define LED_7_PIN 22 - - - - -/* P0.5 aka MAT0.1 */ -#define SERVO_CLOCK_PIN 5 -#define SERVO_CLOCK_PINSEL PINSEL0 -#define SERVO_CLOCK_PINSEL_VAL 0x02 -#define SERVO_CLOCK_PINSEL_BIT 10 -/* p1.23 */ -#define SERVO_DATA_PIN 23 -/* p1.24 */ -#define SERVO_RESET_PIN 24 - -/* PPM : rc rx on P0.6*/ -#define PPM_PINSEL PINSEL0 -#define PPM_PINSEL_VAL 0x02 -#define PPM_PINSEL_BIT 12 - -/* ADC */ - -#define ADC_0 AdcBank0(3) -#ifdef USE_ADC_0 -#ifndef USE_AD0 -#define USE_AD0 -#endif -#define USE_AD0_3 -#endif - -#define ADC_1 AdcBank0(2) -#ifdef USE_ADC_1 -#ifndef USE_AD0 -#define USE_AD0 -#endif -#define USE_AD0_2 -#endif - - -#define ADC_2 AdcBank0(1) -#ifdef USE_ADC_2 -#ifndef USE_AD0 -#define USE_AD0 -#endif -#define USE_AD0_1 -#endif - -#define ADC_3 AdcBank0(4) -#ifdef USE_ADC_3 -#ifndef USE_AD0 -#define USE_AD0 -#endif -#define USE_AD0_4 -#endif - -#define ADC_4 AdcBank1(7) -#ifdef USE_ADC_4 -#ifndef USE_AD1 -#define USE_AD1 -#endif -#define USE_AD1_7 -#endif - -#define ADC_5 AdcBank1(3) -#ifdef USE_ADC_5 -#ifndef USE_AD1 -#define USE_AD1 -#endif -#define USE_AD1_3 -#endif - -#define ADC_6 AdcBank1(4) -#ifdef USE_ADC_6 -#ifndef USE_AD1 -#define USE_AD1 -#endif -#define USE_AD1_4 -#endif - -#define ADC_7 AdcBank1(5) -#ifdef USE_ADC_7 -#ifndef USE_AD1 -#define USE_AD1 -#endif -#define USE_AD1_5 -#endif - -#define ADC_CHANNEL_VSUPPLY AdcBank1(6) -#ifndef USE_AD1 -#define USE_AD1 -#endif -#define USE_AD1_6 - - -#ifndef VoltageOfAdc -#define VoltageOfAdc(adc) (0.01787109375*adc) -#endif - -#define SPI_SELECT_SLAVE0_PORT 0 -#define SPI_SELECT_SLAVE0_PIN 20 - -#define SPI1_DRDY_PINSEL PINSEL0 -#define SPI1_DRDY_PINSEL_BIT 14 -#define SPI1_DRDY_PINSEL_VAL 3 -#define SPI1_DRDY_EINT 2 -#define SPI1_DRDY_VIC_IT VIC_EINT2 - - -/* pressure : P0.28 AD0.1 */ -#define ANALOG_BARO_PINSEL PINSEL1 -#define ANALOG_BARO_PINSEL_VAL 0x01 -#define ANALOG_BARO_PINSEL_BIT 24 -#define ANALOG_BARO_ADC 0 - - -#endif /* CONFIG_TINY_H */ diff --git a/conf/autopilot/booz2_board_v1_0.h b/conf/autopilot/booz2_board_v1_0.h index 8c1a15f578..3b35376919 100644 --- a/conf/autopilot/booz2_board_v1_0.h +++ b/conf/autopilot/booz2_board_v1_0.h @@ -36,6 +36,12 @@ #define PPM_PINSEL PINSEL1 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 24 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 + /* ADC */ diff --git a/conf/autopilot/classix.h b/conf/autopilot/classix.h index 7fa81ffcb3..99601ce918 100644 --- a/conf/autopilot/classix.h +++ b/conf/autopilot/classix.h @@ -34,6 +34,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* SERVOS : 4017 on FBW_RC0 connector */ diff --git a/conf/autopilot/disc_board.h b/conf/autopilot/disc_board.h deleted file mode 100644 index 74044e810f..0000000000 --- a/conf/autopilot/disc_board.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef CONFIG_DISCBOARD_H -#define CONFIG_DISCBOARD_H - -#define LED_1_BANK A -#define LED_1_PIN 7 - -#define LED_2_BANK A -#define LED_2_PIN 6 - -#define LED_3_BANK A -#define LED_3_PIN 5 - -#define LED_4_BANK A -#define LED_4_PIN 4 - -#define LED_5_BANK A -#define LED_5_PIN 3 - -#define LED_6_BANK A -#define LED_6_PIN 2 - -#define LED_7_BANK A -#define LED_7_PIN 1 - -#define LED_8_BANK A -#define LED_8_PIN 0 - -/* clock in MHz */ -#define CLOCK 16 - -/* PPM input on mega128 ICP */ -#define PPM_DDR DDRD -#define PPM_PORT PORTD -#define PPM_PIN PD4 - -#endif /* CONFIG_DISCBOARD_H */ diff --git a/conf/autopilot/disc_board.makefile b/conf/autopilot/disc_board.makefile deleted file mode 100644 index c9b10d68ac..0000000000 --- a/conf/autopilot/disc_board.makefile +++ /dev/null @@ -1,25 +0,0 @@ -ARCHI=avr - -ap.ARCHDIR = $(ARCHI) -ap.ARCH = atmega128 -ap.TARGET = autopilot -ap.TARGETDIR = autopilot - -# 16MHz resonator -#ap.LOW_FUSE = CF -#ap.HIGH_FUSE = 89 -#ap.EXT_FUSE = ff -#ap.LOCK_FUSE = ff - - -# default values -#ap.LOW_FUSE = E1 -#ap.HIGH_FUSE = 99 -#ap.EXT_FUSE = ff -#ap.LOCK_FUSE = ff - - -ap.CFLAGS += -DFBW -DCONFIG=\"gorrazoptere_091.h\" -ap.srcs = $(SRC_ARCH)/adc_hw.c sys_time.c main_fbw.c main.c -ap.CFLAGS += -DANTON_QUAD -DLED -# pid.c estimator.c if_calib.c nav.c main_ap.c mainloop.c main.c diff --git a/conf/autopilot/robostix.h b/conf/autopilot/robostix.h deleted file mode 100644 index 55684edafe..0000000000 --- a/conf/autopilot/robostix.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CONFIG_ROBOSTIX_H -#define CONFIG_ROBOSTIX_H - -#define LED_1_BANK G -#define LED_1_PIN 4 - -#define LED_2_BANK G -#define LED_2_PIN 3 - -#define LED_3_BANK B -#define LED_3_PIN 4 - -/* clock in MHz */ -#define CLOCK 16 - -/* PPM input on mega128 ICP (PD4) */ -#define PPM_DDR DDRD -#define PPM_PORT PORTD -#define PPM_PIN PD4 - -#endif /* CONFIG_ROBOSTIX_H */ diff --git a/conf/autopilot/tiny_0_99.h b/conf/autopilot/tiny_0_99.h index af72e1c11c..d56d9a72f1 100644 --- a/conf/autopilot/tiny_0_99.h +++ b/conf/autopilot/tiny_0_99.h @@ -43,6 +43,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* ADC */ diff --git a/conf/autopilot/tiny_1_1.h b/conf/autopilot/tiny_1_1.h index 91b7edba24..3604af628d 100644 --- a/conf/autopilot/tiny_1_1.h +++ b/conf/autopilot/tiny_1_1.h @@ -44,6 +44,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* ADC */ diff --git a/conf/autopilot/tiny_2_0.h b/conf/autopilot/tiny_2_0.h index 05b8490ab2..7eb77fd445 100644 --- a/conf/autopilot/tiny_2_0.h +++ b/conf/autopilot/tiny_2_0.h @@ -49,6 +49,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* ADC */ diff --git a/conf/autopilot/tiny_2_1.h b/conf/autopilot/tiny_2_1.h index c9ac15dac1..e7bd82b864 100644 --- a/conf/autopilot/tiny_2_1.h +++ b/conf/autopilot/tiny_2_1.h @@ -61,6 +61,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* ADC */ diff --git a/conf/autopilot/tiny_2_1_1.h b/conf/autopilot/tiny_2_1_1.h index adb1c7ff17..35ac48e58a 100644 --- a/conf/autopilot/tiny_2_1_1.h +++ b/conf/autopilot/tiny_2_1_1.h @@ -61,6 +61,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* ADC */ diff --git a/conf/autopilot/tiny_2_1_1_usb.h b/conf/autopilot/tiny_2_1_1_usb.h index a020f8673d..240bea8b88 100644 --- a/conf/autopilot/tiny_2_1_1_usb.h +++ b/conf/autopilot/tiny_2_1_1_usb.h @@ -69,6 +69,11 @@ #define PPM_PINSEL PINSEL0 #define PPM_PINSEL_VAL 0x02 #define PPM_PINSEL_BIT 12 +#define PPM_CRI TIR_CR2I +#define PPM_CCR_CRF TCCR_CR2_F +#define PPM_CCR_CRR TCCR_CR2_R +#define PPM_CCR_CRI TCCR_CR2_I +#define PPM_CR T0CR2 /* ADC */ diff --git a/sw/airborne/arm7/ppm_hw.h b/sw/airborne/arm7/ppm_hw.h index d4155cd222..b891d35931 100644 --- a/sw/airborne/arm7/ppm_hw.h +++ b/sw/airborne/arm7/ppm_hw.h @@ -13,31 +13,11 @@ #include "LPC21xx.h" #include CONFIG -#ifndef PPM_CRI -#define PPM_CRI TIR_CR2I -#endif - -#ifndef PPM_CCR_CRF -#define PPM_CCR_CRF TCCR_CR2_F -#endif - -#ifndef PPM_CCR_CRR -#define PPM_CCR_CRR TCCR_CR2_R -#endif - -#ifndef PPM_CCR_CRI -#define PPM_CCR_CRI TCCR_CR2_I -#endif - -#ifndef PPM_CR -#define PPM_CR T0CR2 -#endif - static inline void ppm_init ( void ) { /* select pin for capture */ PPM_PINSEL |= PPM_PINSEL_VAL << PPM_PINSEL_BIT; - /* enable capture 0.2 on falling edge + trigger interrupt */ + /* enable capture 0.2 on falling or rising edge + trigger interrupt */ #if defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_POSITIVE T0CCR = PPM_CCR_CRF | PPM_CCR_CRI; #elif defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_NEGATIVE