Added PX4 board files and configs

This commit is contained in:
kevindehecker
2016-03-04 15:18:18 +01:00
parent 133e7e83ae
commit f01a1b9da4
11 changed files with 473 additions and 125 deletions
+48
View File
@@ -0,0 +1,48 @@
# Hey Emacs, this is a -*- makefile -*-
#
# px4io_2.4.makefile
#
# This is for the main MCU (STM32F427) on the PX4 board
# See https://pixhawk.org/modules/pixhawk for details
#
BOARD=px4io
BOARD_VERSION=2.4
BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\"
ARCH=stm32
$(TARGET).ARCHDIR = $(ARCH)
$(TARGET).LDSCRIPT=$(SRC_ARCH)/px4io_2.4.ld
# default flash mode is via usb dfu bootloader
# possibilities: DFU, SWD, PX4_BOOTLOADER
PX4_BL_PORT ?= "/dev/serial/by-id/usb-FTDI_*"
PX4_PROTOTYPE ?= "${PAPARAZZI_HOME}/sw/tools/px4/px4io-v2.prototype"
FLASH_MODE ?= PX4_BOOTLOADER
$(TARGET).MAKEFILE = stm32
#
# default LED configuration
#
RADIO_CONTROL_LED ?= none
BARO_LED ?= none
AHRS_ALIGNER_LED ?= none
GPS_LED ?= none
SYS_TIME_LED ?= 1
FBW_MODE_LED ?= 3
#
# default UART configuration (modem, gps, spektrum)
#
RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART1
#
# default actuator configuration
#
# you can use different actuators by adding a configure option to your firmware section
# e.g. <configure name="ACTUATORS" value="actuators_ppm/>
# and by setting the correct "driver" attribute in servo section
# e.g. <servo driver="Ppm">
#
ACTUATORS ?= actuators_pwm
@@ -11,6 +11,7 @@ ifeq ($(TARGET),fbw)
INTERMCU_PORT ?= UART2
INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z)
fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600
fbw.CFLAGS += -DFBW_MODE_LED=$(FBW_MODE_LED)
else
INTERMCU_PORT ?= UART5
INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z)
@@ -4,18 +4,24 @@
ifeq ($(TARGET),fbw)
INTERMCU_PORT ?= UART3
INTERMCU_BAUD ?= B230400
INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z)
fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B230400
fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=$(INTERMCU_BAUD)
fbw.CFLAGS += -DINTER_MCU_FBW -DDOWNLINK
fbw.CFLAGS += -DFBW_MODE_LED=$(FBW_MODE_LED)
fbw.srcs += pprzlink/src/pprz_transport.c
fbw.srcs += subsystems/intermcu/intermcu_fbw.c
else
INTERMCU_PORT ?= UART3
INTERMCU_BAUD ?= B230400
INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z)
ap.CFLAGS += -DINTER_MCU_AP -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER)
ap.CFLAGS += -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B230400
ap.CFLAGS += -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=$(INTERMCU_BAUD)
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/intermcu/intermcu_ap.h\" -DRADIO_CONTROL
RADIO_CONTROL_LED ?= none
ifneq ($(RADIO_CONTROL_LED),none)
$(TARGET).CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
endif
ap.srcs += subsystems/intermcu/intermcu_ap.c
ap.srcs += pprzlink/src/pprz_transport.c
@@ -167,7 +167,7 @@ else ifeq ($(BOARD), krooz)
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
# PX4FMU
else ifeq ($(BOARD), px4fmu)
else ifeq ($(BOARD),$(filter $(BOARD),px4fmu))
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
BARO_BOARD_SRCS += peripherals/ms5611.c
+70 -4
View File
@@ -86,6 +86,71 @@ const clock_scale_t hse_24mhz_3v3[CLOCK_3V3_END] = {
};
#endif
#if defined(STM32F1)
/*---------------------------------------------------------------------------*/
/** @brief RCC Set System Clock HSE at 24MHz from HSE at 24MHz
*/
void rcc_clock_setup_in_hse_24mhz_out_24mhz_pprz(void);
void rcc_clock_setup_in_hse_24mhz_out_24mhz_pprz(void)
{
/* Enable internal high-speed oscillator. */
rcc_osc_on(HSI);
rcc_wait_for_osc_ready(HSI);
/* Select HSI as SYSCLK source. */
rcc_set_sysclk_source(RCC_CFGR_SW_SYSCLKSEL_HSICLK);
/* Enable external high-speed oscillator 24MHz. */
rcc_osc_on(HSE);
rcc_wait_for_osc_ready(HSE);
rcc_set_sysclk_source(RCC_CFGR_SW_SYSCLKSEL_HSECLK);
/*
* Set prescalers for AHB, ADC, ABP1, ABP2.
* Do this before touching the PLL (TODO: why?).
*/
rcc_set_hpre(RCC_CFGR_HPRE_SYSCLK_NODIV); /* Set. 24MHz Max. 72MHz */
rcc_set_adcpre(RCC_CFGR_ADCPRE_PCLK2_DIV2); /* Set. 12MHz Max. 14MHz */
rcc_set_ppre1(RCC_CFGR_PPRE1_HCLK_NODIV); /* Set. 24MHz Max. 36MHz */
rcc_set_ppre2(RCC_CFGR_PPRE2_HCLK_NODIV); /* Set. 24MHz Max. 72MHz */
/*
* Sysclk runs with 24MHz -> 0 waitstates.
* 0WS from 0-24MHz
* 1WS from 24-48MHz
* 2WS from 48-72MHz
*/
flash_set_ws(FLASH_ACR_LATENCY_0WS);
/*
* Set the PLL multiplication factor to 2.
* 24MHz (external) * 2 (multiplier) / 2 (RCC_CFGR_PLLXTPRE_HSE_CLK_DIV2) = 24MHz
*/
rcc_set_pll_multiplication_factor(RCC_CFGR_PLLMUL_PLL_CLK_MUL2);
/* Select HSE as PLL source. */
rcc_set_pll_source(RCC_CFGR_PLLSRC_HSE_CLK);
/*
* External frequency divide by 2 before entering PLL
* (only valid/needed for HSE).
*/
rcc_set_pllxtpre(RCC_CFGR_PLLXTPRE_HSE_CLK_DIV2);
rcc_osc_on(PLL);
rcc_wait_for_osc_ready(PLL);
/* Select PLL as SYSCLK source. */
rcc_set_sysclk_source(RCC_CFGR_SW_SYSCLKSEL_PLLCLK);
/* Set the peripheral clock frequencies used */
rcc_ahb_frequency = 24000000;
rcc_apb1_frequency = 24000000;
rcc_apb2_frequency = 24000000;
}
#endif
void mcu_arch_init(void)
{
#if LUFTBOOT
@@ -121,6 +186,8 @@ void mcu_arch_init(void)
#if defined(STM32F4)
PRINT_CONFIG_MSG("Using 24MHz external clock to PLL it to 168MHz.")
rcc_clock_setup_hse_3v3(&hse_24mhz_3v3[CLOCK_3V3_168MHZ]);
#elif defined(STM32F1)
rcc_clock_setup_in_hse_24mhz_out_24mhz_pprz();
#endif
#elif EXT_CLK == 25000000
#if defined(STM32F4)
@@ -142,6 +209,7 @@ void mcu_arch_init(void)
}
#if defined(STM32F1)
#define RCC_CFGR_PPRE2_SHIFT 11
#define RCC_CFGR_PPRE2 (7 << RCC_CFGR_PPRE2_SHIFT)
@@ -191,8 +259,7 @@ uint32_t timer_get_frequency(uint32_t timer_peripheral)
#ifdef TIM11
case TIM11:
#endif
if (!rcc_get_ppre2())
{
if (!rcc_get_ppre2()) {
/* without APB2 prescaler, runs at APB2 freq */
return rcc_apb2_frequency;
} else {
@@ -216,8 +283,7 @@ uint32_t timer_get_frequency(uint32_t timer_peripheral)
#ifdef TIM14
case TIM14:
#endif
if (!rcc_get_ppre1())
{
if (!rcc_get_ppre1()) {
/* without APB1 prescaler, runs at APB1 freq */
return rcc_apb1_frequency;
} else {
@@ -40,6 +40,7 @@
#define B115200 115200
#define B230400 230400
#define B921600 921600
#define B1500000 1500000
#define UART_SPEED(_def) _def
#endif /* STM32_UART_ARCH_H */
+4 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Felix Ruess
* Copyright (C) 2016 The Paparazzi Team>
*
* This file is part of Paparazzi.
*
@@ -19,15 +19,14 @@
* Boston, MA 02111-1307, USA.
*/
/* Linker script for Pixhawk PX4FMU v2.4 (STM32F427, 2048K flash, 256K RAM). */
/* Linker script for Pixhawk PX4FMU v2.4 (STM32F427, 1024K flash, 192K RAM). */
/* Define memory regions. */
MEMORY
{
/* only 192K (SRAM1 and SRAM2) are accessible by all AHB masters. */
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 192K
/* Reserving 128kb flash for persistent settings. */
rom (rx) : ORIGIN = 0x08000000, LENGTH = 1920K
/* Pixhawk seems to have had a bad badge of f4's, so only use the first 1mb */
rom (rx) : ORIGIN = 0x08004000, LENGTH = 1008K
}
/* Include the common ld script. */
+36
View File
@@ -0,0 +1,36 @@
/*
* Hey Emacs, this is a -*- makefile -*-
*
* Copyright (C) 2016 Kevin van Hecke
*
* 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.
*/
/* Linker script for the PX4IO (STM32F103c8t6 medium density, 64 Kbytes Flash). */
/* Define memory regions. */
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
/* Leaving 2k of space at the end of rom for stored settings */
rom (rx) : ORIGIN = 0x08001000, LENGTH = 60K
}
/* Include the common ld script. */
INCLUDE libopencm3_stm32f1.ld
+16 -68
View File
@@ -4,14 +4,14 @@
#define BOARD_PX4FMU_v2
/* Pixhawk board (PX4FMUv2 has a 24MHz external clock and 168MHz internal. */
//STM32F4
#define EXT_CLK 24000000
#define AHB_CLK 168000000
/*
* Onboard LEDs
*/
/* red/amber , on PE12 */
/* red, on PE12 */
#ifndef USE_LED_1
#define USE_LED_1 1
#endif
@@ -24,13 +24,6 @@
/*
* UART
*/
/*
#define UART1_GPIO_AF GPIO_AF7
#define UART1_GPIO_PORT_RX GPIOA
#define UART1_GPIO_RX GPIO9
#define UART1_GPIO_PORT_TX GPIOA
#define UART1_GPIO_TX GPIO10
*/
//OK // conector telem1
#define UART2_GPIO_AF GPIO_AF7
@@ -156,24 +149,19 @@
// SDIO_CMD pd2
/* Onboard ADCs */
#define USE_AD_TIM4 1
#define BOARD_ADC_CHANNEL_1 11
#define BOARD_ADC_CHANNEL_2 12
#define BOARD_ADC_CHANNEL_3 13
#define BOARD_ADC_CHANNEL_4 10
#define USE_AD_TIM5 1
/* provide defines that can be used to access the ADC_x in the code or airframe file
* these directly map to the index number of the 4 adc channels defined above
* 4th (index 3) is used for bat monitoring by default
*/
#if USE_ADC_1
#define AD1_1_CHANNEL 11
#define ADC_1 AD1_1
#define ADC_1_GPIO_PORT GPIOC
#define ADC_1_GPIO_PIN GPIO1
#endif
//#if USE_ADC_1
//#define AD1_1_CHANNEL 11
//#define ADC_1 AD1_1
//#define ADC_1_GPIO_PORT GPIOC
//#define ADC_1_GPIO_PIN GPIO1
//#endif
/*
#if USE_ADC_2
#define AD1_2_CHANNEL 12
@@ -185,18 +173,19 @@
//OK current sens
#if USE_ADC_3
#define AD1_3_CHANNEL 13
#define AD1_3_CHANNEL 3
#define ADC_3 AD1_3
#define ADC_3_GPIO_PORT GPIOA
#define ADC_3_GPIO_PIN GPIO3
#endif
#define MilliAmpereOfAdc(adc)((float)adc) * (3.3f / 4096.0f) * (90.0f / 5.0f)
// Internal ADC for battery enabled by default
#ifndef USE_ADC_4
#define USE_ADC_4 1
#endif
#if USE_ADC_4
#define AD1_4_CHANNEL 10
#define AD1_4_CHANNEL 2
#define ADC_4 AD1_4
#define ADC_4_GPIO_PORT GPIOA
#define ADC_4_GPIO_PIN GPIO2
@@ -206,7 +195,7 @@
#ifndef ADC_CHANNEL_VSUPPLY
#define ADC_CHANNEL_VSUPPLY ADC_4
#endif
#define DefaultVoltageOfAdc(adc) (0.006185*adc)
#define DefaultVoltageOfAdc(adc) (0.00975f*adc) // value comes from px4 code sensors.cpp _parameters.battery_voltage_scaling = 0.0082f; Manual calib on iris = 0.0096...
/*
@@ -229,45 +218,6 @@
#define I2C3_GPIO_SDA GPIO9
*/
/*
* PPM
*/
#define USE_PPM_TIM1 1
#define PPM_CHANNEL TIM_IC1
#define PPM_TIMER_INPUT TIM_IC_IN_TI1
#define PPM_IRQ NVIC_TIM1_CC_IRQ
#define PPM_IRQ2 NVIC_TIM1_UP_TIM10_IRQ
// Capture/Compare InteruptEnable and InterruptFlag
#define PPM_CC_IE TIM_DIER_CC1IE
#define PPM_CC_IF TIM_SR_CC1IF
#define PPM_GPIO_PORT GPIOA
#define PPM_GPIO_PIN GPIO10
#define PPM_GPIO_AF GPIO_AF1
/*
* Spektrum
*/
/* The line that is pulled low at power up to initiate the bind process */
/* GPIO_EXT1 on PX4FMU */
/*
#define SPEKTRUM_BIND_PIN GPIO4
#define SPEKTRUM_BIND_PIN_PORT GPIOC
*/
/*
#define SPEKTRUM_UART2_RCC RCC_USART2
#define SPEKTRUM_UART2_BANK GPIOA
#define SPEKTRUM_UART2_PIN GPIO3
#define SPEKTRUM_UART2_AF GPIO_AF7
#define SPEKTRUM_UART2_IRQ NVIC_USART2_IRQ
#define SPEKTRUM_UART2_ISR usart2_isr
#define SPEKTRUM_UART2_DEV USART2
*/
/* Activate onboard baro by default */
#ifndef USE_BARO_BOARD
#define USE_BARO_BOARD 1
@@ -290,6 +240,7 @@
#define USE_PWM4 1
#define USE_PWM5 1
#define USE_PWM6 1
//#define USE_BUZZER 1
// Servo numbering on the PX4 starts with 1
// PWM_SERVO_x is the index of the servo in the actuators_pwm_values array
@@ -372,8 +323,7 @@
#define PWM_SERVO_6_OC_BIT 0
#endif
//Buzzer
/*
//Buzzer (alarm)
#if USE_BUZZER
#define PWM_BUZZER
#define PWM_BUZZER_TIMER TIM2
@@ -385,11 +335,9 @@
#else
#define PWM_BUZZER_OC_BIT 0
#endif
*/
#define PWM_TIM1_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_2_OC_BIT|PWM_SERVO_3_OC_BIT|PWM_SERVO_4_OC_BIT)
//#define PWM_TIM2_CHAN_MASK (PWM_BUZZER_OC_BIT)
#define PWM_TIM2_CHAN_MASK (PWM_BUZZER_OC_BIT)
#define PWM_TIM4_CHAN_MASK (PWM_SERVO_5_OC_BIT|PWM_SERVO_6_OC_BIT)
#endif /* CONFIG_PX4FMU_2_4_H */
+243
View File
@@ -0,0 +1,243 @@
#ifndef CONFIG_PX4IO_2_4_H
#define CONFIG_PX4IO_2_4_H
#define BOARD_PX4IO
//STM32F103c8t6 (medium density!)
/* Pixhawk board (PX4FIOv2 has a 24MHz external clock and 24MHz internal. */
#define EXT_CLK 24000000 //this osc is actually outside of the specs (max 16MHz)
#define AHB_CLK 24000000
/*
* LEDs
*/
/* blue led, a.k.a. ACT */
#ifndef USE_LED_1
#define USE_LED_1 1
#endif
#define LED_1_GPIO GPIOB
#define LED_1_GPIO_PIN GPIO14
#define LED_1_GPIO_ON gpio_clear
#define LED_1_GPIO_OFF gpio_set
#define LED_1_AFIO_REMAP ((void)0)
//led Amber a.k.a b/e led
#ifndef USE_LED_2
#define USE_LED_2 1
#endif
#define LED_2_GPIO GPIOB
#define LED_2_GPIO_PIN GPIO15
#define LED_2_GPIO_ON gpio_clear
#define LED_2_GPIO_OFF gpio_set
#define LED_2_AFIO_REMAP ((void)0)
//safety led in the switch, red
#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_clear
#define LED_3_GPIO_OFF gpio_set
#define LED_3_AFIO_REMAP ((void)0)
//TODO: safety switch is on PB5!
/*
* UART
*/
// fmu debug / spektrum receiver (only rx)
#define UART1_GPIO_AF 0
#define UART1_GPIO_PORT_RX GPIOA
#define UART1_GPIO_RX GPIO10
#define UART1_GPIO_PORT_TX GPIOA
#define UART1_GPIO_TX GPIO9
// intermcu fmu
#define UART2_GPIO_AF 0
#define UART2_GPIO_PORT_RX GPIOA
#define UART2_GPIO_RX GPIO3
#define UART2_GPIO_PORT_TX GPIOA
#define UART2_GPIO_TX GPIO2
/*
* Spektrum
*/
/* The line that is pulled low at power up to initiate the bind process */
#define SPEKTRUM_POWER_PIN_PORT GPIOC
#define SPEKTRUM_POWER_PIN GPIO13
#define SPEKTRUM_TIMER 3
#define SPEKTRUM_UART1_RCC RCC_USART1
#define SPEKTRUM_UART1_BANK GPIOA
#define SPEKTRUM_UART1_PIN GPIO10
#define SPEKTRUM_UART1_AF 0
#define SPEKTRUM_UART1_IRQ NVIC_USART1_IRQ
#define SPEKTRUM_UART1_ISR usart1_isr
#define SPEKTRUM_UART1_DEV USART1
/*
* PPM input
*/
#define USE_PPM_TIM1 1
#define PPM_CHANNEL TIM_IC1
#define PPM_TIMER_INPUT TIM_IC_IN_TI1
#define PPM_IRQ NVIC_TIM1_UP_IRQ
#define PPM_IRQ2 NVIC_TIM1_CC_IRQ
// Capture/Compare InteruptEnable and InterruptFlag
#define PPM_CC_IE TIM_DIER_CC1IE
#define PPM_CC_IF TIM_SR_CC1IF
#define PPM_GPIO_PORT GPIOA
#define PPM_GPIO_PIN GPIO8
#define PPM_GPIO_AF 0
//#define USE_AD_TIM1 1
#ifndef USE_ADC_1
#define USE_ADC_1 0
#endif
#if USE_ADC_1 // VDD servo ADC12_IN4, untested
#define AD1_1_CHANNEL 12
#define ADC_1 AD1_4
#define ADC_1_GPIO_PORT GPIOA
#define ADC_1_GPIO_PIN GPIO4
#endif
/*
* PWM
*
*/
//sevo outputs on px4io f1:
//chn: 1 2 3 4 5 6 7 8
//pin: A0 A1 B8 B9 A6 A7 B0 B1
//timer/channel: 2/1 2/2 4/3 4/4 3/1 3/2 3/3 3/4
#define PWM_USE_TIM2 1
//#define PWM_USE_TIM3 1 // spektrum already uses tim3
#define PWM_USE_TIM4 1
//#define ACTUATORS_PWM_NB 4
#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
// 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 TIM2
#define PWM_SERVO_1_GPIO GPIOA
#define PWM_SERVO_1_PIN GPIO0
#define PWM_SERVO_1_AF 0
#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 TIM2
#define PWM_SERVO_2_GPIO GPIOA
#define PWM_SERVO_2_PIN GPIO1
#define PWM_SERVO_2_AF 0
#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 TIM4
#define PWM_SERVO_3_GPIO GPIOB
#define PWM_SERVO_3_PIN GPIO8
#define PWM_SERVO_3_AF 0
#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 TIM4
#define PWM_SERVO_4_GPIO GPIOB
#define PWM_SERVO_4_PIN GPIO9
#define PWM_SERVO_4_AF 0
#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 TIM3
#define PWM_SERVO_5_GPIO GPIOA
#define PWM_SERVO_5_PIN GPIO6
#define PWM_SERVO_5_AF 0
#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 TIM3
#define PWM_SERVO_6_GPIO GPIOA
#define PWM_SERVO_6_PIN GPIO7
#define PWM_SERVO_6_AF 0
#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 TIM3
#define PWM_SERVO_7_GPIO GPIOB
#define PWM_SERVO_7_PIN GPIO0
#define PWM_SERVO_7_AF 0
#define PWM_SERVO_7_OC TIM_OC3
#define PWM_SERVO_7_OC_BIT (1<<2)
#else
#define PWM_SERVO_7_OC_BIT 0
#endif
#if USE_PWM8
#define PWM_SERVO_8 7
#define PWM_SERVO_8_TIMER TIM3
#define PWM_SERVO_8_GPIO GPIOB
#define PWM_SERVO_8_PIN GPIO1
#define PWM_SERVO_8_AF 0
#define PWM_SERVO_8_OC TIM_OC4
#define PWM_SERVO_8_OC_BIT (1<<3)
#else
#define PWM_SERVO_8_OC_BIT 0
#endif
/* servos 1-2 on TIM2 */
#define PWM_TIM2_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_2_OC_BIT)
/* servos 3-4 on TIM4 */
#define PWM_TIM4_CHAN_MASK (PWM_SERVO_3_OC_BIT|PWM_SERVO_4_OC_BIT)
/* servos 5-8 on TIM3 */
//#define PWM_TIM3_CHAN_MASK (PWM_SERVO_5_OC_BIT|PWM_SERVO_6_OC_BIT|PWM_SERVO_7_OC_BIT|PWM_SERVO_8_OC_BIT)
/* Default actuators driver */
#define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
#define ActuatorsDefaultInit() ActuatorsPwmInit()
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
#endif /* CONFIG_PX4IO_2_4_H */
+1 -1
View File
@@ -64,7 +64,7 @@ void radio_control_periodic_task(void)
radio_control.time_since_last_frame++;
}
#if defined RADIO_CONTROL_LED
#if defined(RADIO_CONTROL_LED)
if (radio_control.status == RC_OK) {
LED_ON(RADIO_CONTROL_LED);
} else {