diff --git a/conf/airframes/TUDELFT/tudelft_conf.xml b/conf/airframes/TUDELFT/tudelft_conf.xml index d4c17f712f..5f0493a4d6 100644 --- a/conf/airframes/TUDELFT/tudelft_conf.xml +++ b/conf/airframes/TUDELFT/tudelft_conf.xml @@ -208,6 +208,17 @@ settings_modules="modules/air_data.xml modules/geo_mag.xml modules/gps_ubx_ucenter.xml modules/light.xml modules/digital_cam.xml" gui_color="white" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + + + + +
+ +
+ + + +
+ +
diff --git a/conf/boards/opa_ap_1.0.makefile b/conf/boards/opa_ap_1.0.makefile new file mode 100644 index 0000000000..7509ee773c --- /dev/null +++ b/conf/boards/opa_ap_1.0.makefile @@ -0,0 +1,70 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# Oversized Paparazzi (AP) Board +# +# http://wiki.paparazziuav.org/wiki/OPA +# + +BOARD=opa_ap +BOARD_VERSION=1.0 +BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" + +ARCH=stm32 +ARCH_L=f4 +HARD_FLOAT=yes +$(TARGET).ARCHDIR = $(ARCH) +$(TARGET).LDSCRIPT=$(SRC_ARCH)/lisa-mx.ld + +# ----------------------------------------------------------------------- + +# +# default flash mode is via SWD (JTAG) +# +FLASH_MODE ?= SWD + +# +# default LED configuration +# +SYS_TIME_LED ?= 1 +RADIO_CONTROL_LED ?= none +BARO_LED ?= none +AHRS_ALIGNER_LED ?= none +GPS_LED ?= none +LOGGER_LED ?= none + +# +# default uart configuration +# +MODEM_PORT ?= UART2 +MODEM_BAUD ?= B57600 + +GPS_PORT ?= UART1 +GPS_BAUD ?= B57600 + +INTERMCU_PORT ?= UART3 +INTERMCU_BAUD ?= B230400 + +# +# default IMU configuration +# +IMU_MPU_SPI_DEV ?= spi2 +IMU_MPU_SPI_SLAVE_IDX ?= SPI_SLAVE1 + +# +# BARO configuration +# + +# See baro_board.makefile + +# +# default SPI logger configuration +# +SDLOGGER_DIRECT_SPI ?= spi1 +SDLOGGER_DIRECT_SPI_SLAVE ?= SPI_SLAVE0 +HS_LOG_SPI_DEV ?= spi1 +HS_LOG_SPI_SLAVE_IDX ?= SPI_SLAVE0 + +# +# default Current Sensor configuration +# +ADC_CURRENT_SENSOR ?= ADC_2 diff --git a/conf/boards/opa_ftd_1.0.makefile b/conf/boards/opa_ftd_1.0.makefile new file mode 100644 index 0000000000..f1039cba66 --- /dev/null +++ b/conf/boards/opa_ftd_1.0.makefile @@ -0,0 +1,48 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# Oversized Paparazzi (AP) Board +# +# http://wiki.paparazziuav.org/wiki/OPA +# + +BOARD=opa_ftd +BOARD_VERSION=1.0 +BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" + +ARCH=stm32 +ARCH_L=f4 +HARD_FLOAT=yes +$(TARGET).ARCHDIR = $(ARCH) +$(TARGET).LDSCRIPT=$(SRC_ARCH)/lisa-mx.ld + +# ----------------------------------------------------------------------- + +# +# default flash mode is via SWD (JTAG) +# +FLASH_MODE ?= SWD + +# +# default LED configuration +# +SYS_TIME_LED ?= 1 +RADIO_CONTROL_LED ?= 2 +ARMING_LED ?= 3 +FBW_MODE_LED ?= none + +# +# default uart configuration +# +RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART1 +RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT ?= UART5 + +MODEM_PORT ?= UART3 +MODEM_BAUD ?= B57600 + +INTERMCU_PORT ?= UART2 +INTERMCU_BAUD ?= B230400 + +# +# default actuator configuration +# +ACTUATORS ?= actuators_pwm diff --git a/conf/firmwares/subsystems/shared/baro_board.makefile b/conf/firmwares/subsystems/shared/baro_board.makefile index 5c49b6bb8c..ca8c988b62 100644 --- a/conf/firmwares/subsystems/shared/baro_board.makefile +++ b/conf/firmwares/subsystems/shared/baro_board.makefile @@ -194,15 +194,25 @@ else ifeq ($(BOARD), umarim) # Naze32 else ifeq ($(BOARD), naze32) - BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C - BARO_BOARD_CFLAGS += -DUSE_I2C2 - BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2 - BARO_BOARD_SRCS += peripherals/ms5611.c - BARO_BOARD_SRCS += peripherals/ms5611_i2c.c - BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c + BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C + BARO_BOARD_CFLAGS += -DUSE_I2C2 + BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2 + BARO_BOARD_SRCS += peripherals/ms5611.c + BARO_BOARD_SRCS += peripherals/ms5611_i2c.c + BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c +# OPA (AP) +else ifeq ($(BOARD), opa_ap) + include $(CFG_SHARED)/spi_master.makefile + BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE2 + BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2 + BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE2 + BARO_BOARD_SRCS += peripherals/ms5611.c + BARO_BOARD_SRCS += peripherals/ms5611_spi.c + BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c endif # check board +BARO_LED ?= none ifneq ($(BARO_LED),none) BARO_BOARD_CFLAGS += -DBARO_LED=$(BARO_LED) endif diff --git a/conf/modules/heli_swashplate_mixing.xml b/conf/modules/heli_swashplate_mixing.xml index 8740354b9d..e7ab9f4158 100644 --- a/conf/modules/heli_swashplate_mixing.xml +++ b/conf/modules/heli_swashplate_mixing.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/modules/heli_throttle_curve.xml b/conf/modules/heli_throttle_curve.xml index 8b036cb8ca..8660130ef2 100644 --- a/conf/modules/heli_throttle_curve.xml +++ b/conf/modules/heli_throttle_curve.xml @@ -8,7 +8,7 @@ - + diff --git a/sw/airborne/boards/opa_ap/baro_board.h b/sw/airborne/boards/opa_ap/baro_board.h new file mode 100644 index 0000000000..95c900a56e --- /dev/null +++ b/sw/airborne/boards/opa_ap/baro_board.h @@ -0,0 +1,18 @@ + +/* + * board specific functions for the opa_ap board + * + */ + +#ifndef BOARDS_OPA_AP_BARO_H +#define BOARDS_OPA_AP_BARO_H + +// only for printing the baro type during compilation +#ifndef BARO_BOARD +#define BARO_BOARD BARO_MS5611_SPI +#endif + +extern void baro_event(void); +#define BaroEvent baro_event + +#endif /* BOARDS_OPA_AP_BARO_H */ diff --git a/sw/airborne/boards/opa_ap_1.0.h b/sw/airborne/boards/opa_ap_1.0.h new file mode 100644 index 0000000000..f007a67bb1 --- /dev/null +++ b/sw/airborne/boards/opa_ap_1.0.h @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2015 Freek van Tienen + * + * 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. + * + */ + +#ifndef CONFIG_OPA_FTD_1_0_H +#define CONFIG_OPA_FTD_1_0_H + +#define BOARD_OPA_AP + +/* OPA/FTD has a 12MHz external clock and 168MHz internal. */ +#define EXT_CLK 12000000 +#define AHB_CLK 168000000 + +/* + * Power control + */ + +/* VISION power */ +#define VISION_PWR GPIOA +#define VISION_PWR_PIN GPIO1 +#define VISION_PWR_ON gpio_set +#define VISION_PWR_OFF gpio_clear + +/* + * Onboard LEDs + */ + +/* Status (red), on PA8 */ +#ifndef USE_LED_1 +#define USE_LED_1 1 +#endif +#define LED_1_GPIO GPIOA +#define LED_1_GPIO_PIN GPIO8 +#define LED_1_GPIO_ON gpio_set +#define LED_1_GPIO_OFF gpio_clear +#define LED_1_AFIO_REMAP ((void)0) + + +/* UART */ +#define UART1_GPIO_AF GPIO_AF7 +#define UART1_GPIO_PORT_RX GPIOA +#define UART1_GPIO_RX GPIO10 +#define UART1_GPIO_PORT_TX GPIOA +#define UART1_GPIO_TX GPIO9 + +#define UART2_GPIO_AF GPIO_AF7 +#define UART2_GPIO_PORT_RX GPIOA +#define UART2_GPIO_RX GPIO3 +#define UART2_GPIO_PORT_TX GPIOA +#define UART2_GPIO_TX GPIO2 + +#define UART3_GPIO_AF GPIO_AF7 +#define UART3_GPIO_PORT_RX GPIOB +#define UART3_GPIO_RX GPIO11 +#define UART3_GPIO_PORT_TX GPIOB +#define UART3_GPIO_TX GPIO10 + +#define UART4_GPIO_AF GPIO_AF8 +#define UART4_GPIO_PORT_RX GPIOC +#define UART4_GPIO_RX GPIO11 +#define UART4_GPIO_PORT_TX GPIOC +#define UART4_GPIO_TX GPIO10 + +#define UART5_GPIO_AF GPIO_AF8 +#define UART5_GPIO_PORT_RX GPIOD +#define UART5_GPIO_RX GPIO2 + +/* SPI */ +#define SPI1_GPIO_AF GPIO_AF5 +#define SPI1_GPIO_PORT_MISO GPIOA +#define SPI1_GPIO_MISO GPIO6 +#define SPI1_GPIO_PORT_MOSI GPIOA +#define SPI1_GPIO_MOSI GPIO7 +#define SPI1_GPIO_PORT_SCK GPIOA +#define SPI1_GPIO_SCK GPIO5 +#define SPI1_GPIO_PORT_NSS GPIOA +#define SPI1_GPIO_NSS GPIO4 + +#define SPI2_GPIO_AF GPIO_AF5 +#define SPI2_GPIO_PORT_MISO GPIOB +#define SPI2_GPIO_MISO GPIO14 +#define SPI2_GPIO_PORT_MOSI GPIOB +#define SPI2_GPIO_MOSI GPIO15 +#define SPI2_GPIO_PORT_SCK GPIOB +#define SPI2_GPIO_SCK GPIO13 +#define SPI2_GPIO_PORT_NSS GPIOB +#define SPI2_GPIO_NSS GPIO12 + +#define SPI_SELECT_SLAVE0_PORT GPIOA // SD CARD (on spi1) +#define SPI_SELECT_SLAVE0_PIN GPIO4 + +#define SPI_SELECT_SLAVE1_PORT GPIOB // IMU (on spi2) +#define SPI_SELECT_SLAVE1_PIN GPIO12 + +#define SPI_SELECT_SLAVE2_PORT GPIOC // BARO (on spi2) +#define SPI_SELECT_SLAVE2_PIN GPIO13 + +/* + * ADC + */ + +/* BATT PC4/ADC14 */ +#ifndef USE_ADC_1 +#define USE_ADC_1 1 +#endif +#if USE_ADC_1 +#define AD1_1_CHANNEL 14 +#define ADC_1 AD1_1 +#define ADC_1_GPIO_PORT GPIOC +#define ADC_1_GPIO_PIN GPIO4 +#endif + +/* CURRENT PC3/ADC13 */ +#if USE_ADC_2 +#define AD1_2_CHANNEL 13 +#define ADC_2 AD1_2 +#define ADC_2_GPIO_PORT GPIOC +#define ADC_2_GPIO_PIN GPIO3 +#endif + +/* TEMP_MOTOR PC0/ADC10 */ +#ifndef USE_ADC_3 +#define USE_ADC_3 1 +#endif +#if USE_ADC_3 +#define AD1_3_CHANNEL 10 +#define ADC_3 AD1_3 +#define ADC_3_GPIO_PORT GPIOC +#define ADC_3_GPIO_PIN GPIO0 +#endif + +/* TEMP_BATT PC1/ADC11 */ +#ifndef USE_ADC_4 +#define USE_ADC_4 1 +#endif +#if USE_ADC_4 +#define AD1_4_CHANNEL 11 +#define ADC_4 AD1_4 +#define ADC_4_GPIO_PORT GPIOC +#define ADC_4_GPIO_PIN GPIO1 +#endif + +/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/ +#ifndef ADC_CHANNEL_VSUPPLY +#define ADC_CHANNEL_VSUPPLY ADC_1 +#endif + +// Default: 10k / 2k2 +// #define DefaultVoltageOfAdc(adc) (0.0045*adc) +// Opa: 31k6 / 4k7 +#define DefaultVoltageOfAdc(adc) (0.0063*adc) + +// ADC756-B050: +/-50Amp range bidirectional +// 40 mV / Ampere +// 1 ADC-count = 0,000805664 Volt, 0.040 V = 1 Ampere -> 1 Ampere = 49,6484887 ADC ticks: 1 ADC-tck = 20mA +// 5.0/3.3 from datasheet +#define DefaultMilliAmpereOfAdc(adc) (20.142*(adc-2048) * 5.0/3.3) + +/* TEMP MOTOR: NTC with 2k fixed pull up */ +// R0: 10k (@25C) +// T0: 25C -> 298.15K +// B: 3976 K +// a = (1/T0) - (1/B)*ln(R0) = 0.00103753243 +// b = 1/B = 0.00025150905 +// c = 0 +#define TEMP_ADC_CHANNEL1 ADC_3 +#define TEMP_ADC_CHANNEL1_TYPE NTC +#define TEMP_ADC_CHANNEL1_PU_R 2000 +#define TEMP_ADC_CHANNEL1_A 0.00103753243 +#define TEMP_ADC_CHANNEL1_B 0.00025150905 +#define TEMP_ADC_CHANNEL1_C 0 + +/* TEMP BATT: NTC with 2k fixed pull up */ +// R0: 10k (@25C) +// T0: 25C -> 298.15K +// B: 3976 K +// a = (1/T0) - (1/B)*ln(R0) = 0.00103753243 +// b = 1/B = 0.00025150905 +// c = 0 +#define TEMP_ADC_CHANNEL2 ADC_4 +#define TEMP_ADC_CHANNEL2_TYPE NTC +#define TEMP_ADC_CHANNEL2_PU_R 2000 +#define TEMP_ADC_CHANNEL2_A 0.00103753243 +#define TEMP_ADC_CHANNEL2_B 0.00025150905 +#define TEMP_ADC_CHANNEL2_C 0 + +/* by default activate onboard baro */ +#ifndef USE_BARO_BOARD +#define USE_BARO_BOARD 1 +#endif + +#endif /* CONFIG_OPA_AP_1_0_H */ diff --git a/sw/airborne/boards/opa_ftd_1.0.h b/sw/airborne/boards/opa_ftd_1.0.h new file mode 100644 index 0000000000..d6b5477df1 --- /dev/null +++ b/sw/airborne/boards/opa_ftd_1.0.h @@ -0,0 +1,338 @@ +/* + * Copyright (C) 2015 Freek van Tienen + * + * 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. + * + */ + +#ifndef CONFIG_OPA_FTD_1_0_H +#define CONFIG_OPA_FTD_1_0_H + +#define BOARD_OPA_FTD + +/* OPA/FTD has a 12MHz external clock and 168MHz internal. */ +#define EXT_CLK 12000000 +#define AHB_CLK 168000000 + +/* + * MCU Power control + */ +#define MCU_PWR GPIOB +#define MCU_PWR_PIN GPIO5 +#define MCU_PWR_ON gpio_set +#define MCU_PWR_OFF gpio_clear + +/* + * Buttons + */ + +/* E-Stop button */ +#define BTN_ESTOP GPIOB +#define BTN_ESTOP_PIN GPIO12 + +/* + * Onboard LEDs + */ + +/* Status (red), on PA8 */ +#ifndef USE_LED_1 +#define USE_LED_1 1 +#endif +#define LED_1_GPIO GPIOA +#define LED_1_GPIO_PIN GPIO8 +#define LED_1_GPIO_ON gpio_set +#define LED_1_GPIO_OFF gpio_clear +#define LED_1_AFIO_REMAP ((void)0) + +/* RC (green), on PC5 */ +#ifndef USE_LED_2 +#define USE_LED_2 1 +#endif +#define LED_2_GPIO GPIOC +#define LED_2_GPIO_PIN GPIO5 +#define LED_2_GPIO_ON gpio_set +#define LED_2_GPIO_OFF gpio_clear +#define LED_2_AFIO_REMAP ((void)0) + +/* Status LED ext, PB13 */ +#ifndef USE_LED_3 +#define USE_LED_3 1 +#endif +#define LED_3_GPIO GPIOB +#define LED_3_GPIO_PIN GPIO13 +#define LED_3_GPIO_ON gpio_set +#define LED_3_GPIO_OFF gpio_clear +#define LED_3_AFIO_REMAP ((void)0) + + +/* Default actuators driver */ +#define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h" +#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y) +#define ActuatorsDefaultInit() ActuatorsPwmInit() +#define ActuatorsDefaultCommit() ActuatorsPwmCommit() + + +/* UART */ +#define UART1_GPIO_AF GPIO_AF7 +#define UART1_GPIO_PORT_RX GPIOA +#define UART1_GPIO_RX GPIO10 + +#define UART2_GPIO_AF GPIO_AF7 +#define UART2_GPIO_PORT_RX GPIOA +#define UART2_GPIO_RX GPIO3 +#define UART2_GPIO_PORT_TX GPIOA +#define UART2_GPIO_TX GPIO2 + +#define UART3_GPIO_AF GPIO_AF7 +#define UART3_GPIO_PORT_RX GPIOB +#define UART3_GPIO_RX GPIO11 +#define UART3_GPIO_PORT_TX GPIOB +#define UART3_GPIO_TX GPIO10 + +#define UART4_GPIO_AF GPIO_AF8 +#define UART4_GPIO_PORT_RX GPIOC +#define UART4_GPIO_RX GPIO11 +#define UART4_GPIO_PORT_TX GPIOC +#define UART4_GPIO_TX GPIO10 + +#define UART5_GPIO_AF GPIO_AF8 +#define UART5_GPIO_PORT_RX GPIOD +#define UART5_GPIO_RX GPIO2 + +/* + * Spektrum + */ +/* Define power pin */ +#define RADIO_CONTROL_POWER GPIOC +#define RADIO_CONTROL_POWER_PIN GPIO13 +#define RADIO_CONTROL_POWER_ON gpio_set +#define RADIO_CONTROL_POWER_OFF gpio_clear + +/* The line that is pulled low at power up to initiate the bind process */ +#define SPEKTRUM_BIND_PIN GPIO2 +#define SPEKTRUM_BIND_PIN_PORT GPIOB + +#define SPEKTRUM_UART1_RCC RCC_USART1 +#define SPEKTRUM_UART1_BANK GPIOA +#define SPEKTRUM_UART1_PIN GPIO10 +#define SPEKTRUM_UART1_AF GPIO_AF7 +#define SPEKTRUM_UART1_IRQ NVIC_USART1_IRQ +#define SPEKTRUM_UART1_ISR usart1_isr +#define SPEKTRUM_UART1_DEV USART1 + +#define SPEKTRUM_UART5_RCC RCC_UART5 +#define SPEKTRUM_UART5_BANK GPIOD +#define SPEKTRUM_UART5_PIN GPIO2 +#define SPEKTRUM_UART5_AF GPIO_AF8 +#define SPEKTRUM_UART5_IRQ NVIC_UART5_IRQ +#define SPEKTRUM_UART5_ISR uart5_isr +#define SPEKTRUM_UART5_DEV UART5 + +/* SPI */ +#define SPI1_GPIO_AF GPIO_AF5 +#define SPI1_GPIO_PORT_MISO GPIOA +#define SPI1_GPIO_MISO GPIO6 +#define SPI1_GPIO_PORT_MOSI GPIOA +#define SPI1_GPIO_MOSI GPIO7 +#define SPI1_GPIO_PORT_SCK GPIOA +#define SPI1_GPIO_SCK GPIO5 +#define SPI1_GPIO_PORT_NSS GPIOA +#define SPI1_GPIO_NSS GPIO4 + +#define SPI_SELECT_SLAVE0_PORT GPIOA +#define SPI_SELECT_SLAVE0_PIN GPIO4 + + +/* + * ADC + */ + +/* BATT PC4/ADC14 */ +#ifndef USE_ADC_1 +#define USE_ADC_1 1 +#endif +#if USE_ADC_1 +#define AD1_1_CHANNEL 14 +#define ADC_1 AD1_1 +#define ADC_1_GPIO_PORT GPIOC +#define ADC_1_GPIO_PIN GPIO4 +#endif + +/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/ +#ifndef ADC_CHANNEL_VSUPPLY +#define ADC_CHANNEL_VSUPPLY ADC_1 +#endif + + +// Default: 10k / 2k2 -> +// #define DefaultVoltageOfAdc(adc) (0.00446777*adc) + +// Opa-FBW: 10k / 4k7 +#define DefaultVoltageOfAdc(adc) (00.00252*adc) + + +/* + * PWM + * + */ +#define PWM_USE_TIM3 1 +#define PWM_USE_TIM4 1 +#define PWM_USE_TIM5 1 + +#define USE_PWM1 1 +#define USE_PWM2 1 +#define USE_PWM3 1 +#define USE_PWM4 1 +#define USE_PWM5 1 +#define USE_PWM6 1 +#define USE_PWM7 1 +#define USE_PWM8 1 +#define USE_PWM9 1 +#define USE_PWM10 1 +#define ACTUATORS_PWM_NB 10 + + +// PWM_SERVO_x is the index of the servo in the actuators_pwm_values array +#if USE_PWM1 +#define PWM_SERVO_1 0 +#define PWM_SERVO_1_TIMER TIM3 +#define PWM_SERVO_1_GPIO GPIOC +#define PWM_SERVO_1_PIN GPIO6 +#define PWM_SERVO_1_AF GPIO_AF2 +#define PWM_SERVO_1_OC TIM_OC1 +#define PWM_SERVO_1_OC_BIT (1<<0) +#else +#define PWM_SERVO_1_OC_BIT 0 +#endif + +#if USE_PWM2 +#define PWM_SERVO_2 1 +#define PWM_SERVO_2_TIMER TIM3 +#define PWM_SERVO_2_GPIO GPIOC +#define PWM_SERVO_2_PIN GPIO7 +#define PWM_SERVO_2_AF GPIO_AF2 +#define PWM_SERVO_2_OC TIM_OC2 +#define PWM_SERVO_2_OC_BIT (1<<1) +#else +#define PWM_SERVO_2_OC_BIT 0 +#endif + +#if USE_PWM3 +#define PWM_SERVO_3 2 +#define PWM_SERVO_3_TIMER TIM3 +#define PWM_SERVO_3_GPIO GPIOC +#define PWM_SERVO_3_PIN GPIO8 +#define PWM_SERVO_3_AF GPIO_AF2 +#define PWM_SERVO_3_OC TIM_OC3 +#define PWM_SERVO_3_OC_BIT (1<<2) +#else +#define PWM_SERVO_3_OC_BIT 0 +#endif + +#if USE_PWM4 +#define PWM_SERVO_4 3 +#define PWM_SERVO_4_TIMER TIM3 +#define PWM_SERVO_4_GPIO GPIOC +#define PWM_SERVO_4_PIN GPIO9 +#define PWM_SERVO_4_AF GPIO_AF2 +#define PWM_SERVO_4_OC TIM_OC4 +#define PWM_SERVO_4_OC_BIT (1<<3) +#else +#define PWM_SERVO_4_OC_BIT 0 +#endif + +#if USE_PWM5 +#define PWM_SERVO_5 4 +#define PWM_SERVO_5_TIMER TIM5 +#define PWM_SERVO_5_GPIO GPIOA +#define PWM_SERVO_5_PIN GPIO0 +#define PWM_SERVO_5_AF GPIO_AF2 +#define PWM_SERVO_5_OC TIM_OC1 +#define PWM_SERVO_5_OC_BIT (1<<0) +#else +#define PWM_SERVO_5_OC_BIT 0 +#endif + +#if USE_PWM6 +#define PWM_SERVO_6 5 +#define PWM_SERVO_6_TIMER TIM5 +#define PWM_SERVO_6_GPIO GPIOA +#define PWM_SERVO_6_PIN GPIO1 +#define PWM_SERVO_6_AF GPIO_AF2 +#define PWM_SERVO_6_OC TIM_OC2 +#define PWM_SERVO_6_OC_BIT (1<<1) +#else +#define PWM_SERVO_6_OC_BIT 0 +#endif + +#if USE_PWM7 +#define PWM_SERVO_7 6 +#define PWM_SERVO_7_TIMER TIM4 +#define PWM_SERVO_7_GPIO GPIOB +#define PWM_SERVO_7_PIN GPIO6 +#define PWM_SERVO_7_AF GPIO_AF2 +#define PWM_SERVO_7_OC TIM_OC1 +#define PWM_SERVO_7_OC_BIT (1<<0) +#else +#define PWM_SERVO_7_OC_BIT 0 +#endif + +#if USE_PWM8 +#define PWM_SERVO_8 7 +#define PWM_SERVO_8_TIMER TIM4 +#define PWM_SERVO_8_GPIO GPIOB +#define PWM_SERVO_8_PIN GPIO7 +#define PWM_SERVO_8_AF GPIO_AF2 +#define PWM_SERVO_8_OC TIM_OC2 +#define PWM_SERVO_8_OC_BIT (1<<1) +#else +#define PWM_SERVO_8_OC_BIT 0 +#endif + +#if USE_PWM9 +#define PWM_SERVO_9 8 +#define PWM_SERVO_9_TIMER TIM4 +#define PWM_SERVO_9_GPIO GPIOB +#define PWM_SERVO_9_PIN GPIO8 +#define PWM_SERVO_9_AF GPIO_AF2 +#define PWM_SERVO_9_OC TIM_OC3 +#define PWM_SERVO_9_OC_BIT (1<<2) +#else +#define PWM_SERVO_9_OC_BIT 0 +#endif + +#if USE_PWM10 +#define PWM_SERVO_10 9 +#define PWM_SERVO_10_TIMER TIM4 +#define PWM_SERVO_10_GPIO GPIOB +#define PWM_SERVO_10_PIN GPIO9 +#define PWM_SERVO_10_AF GPIO_AF2 +#define PWM_SERVO_10_OC TIM_OC4 +#define PWM_SERVO_10_OC_BIT (1<<3) +#else +#define PWM_SERVO_10_OC_BIT 0 +#endif + +/* servos 1-4 on TIM3 */ +#define PWM_TIM3_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_2_OC_BIT|PWM_SERVO_3_OC_BIT|PWM_SERVO_4_OC_BIT) +/* servos 5-6 on TIM5 */ +#define PWM_TIM5_CHAN_MASK (PWM_SERVO_5_OC_BIT|PWM_SERVO_6_OC_BIT) +/* servos 7-10 on TIM4 */ +#define PWM_TIM4_CHAN_MASK (PWM_SERVO_7_OC_BIT|PWM_SERVO_8_OC_BIT|PWM_SERVO_9_OC_BIT|PWM_SERVO_10_OC_BIT) + +#endif /* CONFIG_OPA_FTD_1_0_H */